diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..47dcf33cf --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +dist/ +lib/ +node_modules/ +jest.config.js \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index d097bf7db..71ee5451a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,17 +1,55 @@ { - "env": { - "commonjs": true, - "es6": true, - "node": true - }, - "extends": "eslint:recommended", - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, + "plugins": ["jest", "@typescript-eslint"], + "extends": ["plugin:github/recommended"], + "parser": "@typescript-eslint/parser", "parserOptions": { - "ecmaVersion": 2018 + "ecmaVersion": 9, + "sourceType": "module", + "project": "./tsconfig.json" }, "rules": { + "i18n-text/no-en": "off", + "eslint-comments/no-use": "off", + "import/no-namespace": "off", + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "error", + "@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}], + "@typescript-eslint/no-require-imports": "error", + "@typescript-eslint/array-type": "error", + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/ban-ts-comment": "error", + "camelcase": "off", + "@typescript-eslint/consistent-type-assertions": "error", + "@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}], + "@typescript-eslint/func-call-spacing": ["error", "never"], + "@typescript-eslint/no-array-constructor": "error", + "@typescript-eslint/no-empty-interface": "error", + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/no-extraneous-class": "error", + "@typescript-eslint/no-for-in-array": "error", + "@typescript-eslint/no-inferrable-types": "error", + "@typescript-eslint/no-misused-new": "error", + "@typescript-eslint/no-namespace": "error", + "@typescript-eslint/no-non-null-assertion": "warn", + "@typescript-eslint/no-unnecessary-qualifier": "error", + "@typescript-eslint/no-unnecessary-type-assertion": "error", + "@typescript-eslint/no-useless-constructor": "error", + "@typescript-eslint/no-var-requires": "error", + "@typescript-eslint/prefer-for-of": "warn", + "@typescript-eslint/prefer-function-type": "warn", + "@typescript-eslint/prefer-includes": "error", + "@typescript-eslint/prefer-string-starts-ends-with": "error", + "@typescript-eslint/promise-function-async": "error", + "@typescript-eslint/require-array-sort-compare": "error", + "@typescript-eslint/restrict-plus-operands": "error", + "semi": "off", + "@typescript-eslint/semi": ["error", "never"], + "@typescript-eslint/type-annotation-spacing": "error", + "@typescript-eslint/unbound-method": "error" + }, + "env": { + "node": true, + "es6": true, + "jest/globals": true } -} \ No newline at end of file + } \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8e588507f..bcd8a71e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: "Main" +name: 'Main' on: push: @@ -20,6 +20,8 @@ jobs: token: ${{ secrets.DIAWI_TOKEN }} file: ./example.apk comment: 'Uploaded from Github Action' - + - name: Output - run: echo "Diawi URL = ${{ steps.diawi.outputs['url'] }}" \ No newline at end of file + run: | + echo "Diawi URL = ${{ steps.diawi.outputs['url'] }}" + echo "Diawi QR Code = ${{ steps.diawi.outputs['qrcode'] }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..cddb73ecc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: 'Test' + +on: + push: + branches: + - typescript + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: typescript + + - uses: ./ + id: diawi + with: + token: ${{ secrets.DIAWI_TOKEN }} + file: ./example.apk + comment: 'Uploaded from Github Action' + + - name: Output + run: | + echo "Diawi URL = ${{ steps.diawi.outputs['url'] }}" + echo "Diawi QR Code = ${{ steps.diawi.outputs['qrcode'] }}" diff --git a/.gitignore b/.gitignore index 43917a37e..4ecb7a9d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,17 @@ -# comment this out distribution branches -#node_modules/ - -# Editors -.vscode +# Dependency directory +node_modules +# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids @@ -22,11 +24,12 @@ lib-cov # Coverage directory used by tools like istanbul coverage +*.lcov # nyc test coverage .nyc_output -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) @@ -38,12 +41,15 @@ bower_components # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release -# Other Dependency directories +# Dependency directories jspm_packages/ # TypeScript v1 declaration files typings/ +# TypeScript cache +*.tsbuildinfo + # Optional npm cache directory .npm @@ -61,6 +67,33 @@ typings/ # dotenv environment variables file .env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache # next.js build output .next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# OS metadata +.DS_Store +Thumbs.db + +# Ignore built ts files +__tests__/runner/* +lib/**/* diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..218694729 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +dist/ +lib/ +node_modules/ \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..bd30a2658 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,10 @@ +{ + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "semi": false, + "singleQuote": true, + "trailingComma": "none", + "bracketSpacing": false, + "arrowParens": "avoid" +} \ No newline at end of file diff --git a/action.yml b/action.yml index 67b150917..a7821959d 100644 --- a/action.yml +++ b/action.yml @@ -36,7 +36,7 @@ outputs: description: 'QRCode generated by Diawi' runs: using: 'node16' - main: 'index.js' + main: 'dist/index.js' branding: color: 'blue' icon: 'package' \ No newline at end of file diff --git a/diawi.js b/diawi.js deleted file mode 100644 index cef097ec2..000000000 --- a/diawi.js +++ /dev/null @@ -1,109 +0,0 @@ -const fs = require('fs'); -const axios = require('axios'); -const FormData = require('form-data'); -const util = require('util'); -const EventEmitter = require('events').EventEmitter; - -const UPLOAD_URL = 'https://upload.diawi.com/'; -const STATUS_URL = 'https://upload.diawi.com/status'; -const POLL_MAX_COUNT = 10; -const POLL_INTERVAL = 2; - -const sleep = (seconds) => { - return new Promise((resolve) => { - setTimeout(resolve, (seconds * 1000)); - }); -}; - -const Diawi = function (parameters) { - - if (!parameters) { - parameters = {}; - } - - this.token = parameters.token.trim(); - this.path = parameters.path.trim(); - if (!fs.existsSync(this.path)) { - throw (new Error('Could not find file at ' + this.path)); - } - - // Create the required form fields - this.formData = { - token: this.token, - file: fs.createReadStream(this.path), - }; - - // Append the optional parameters to the formData - ['password', 'comment', 'callback_emails', 'wall_of_apps', 'find_by_udid', 'installation_notifications'] - .forEach((key) => { - if (parameters[key]) { - this.formData[key] = parameters[key]; - } - }); -}; - -Diawi.prototype.execute = async function () { - try { - - const data = new FormData(); - for ( var key in this.formData ) { - data.append(key, this.formData[key]); - } - - const config = { - headers: data.getHeaders() /* { 'Content-Type': 'multipart/form-data' } */, - maxContentLength: Infinity, - maxBodyLength: Infinity - }; - - const response = await axios.post(UPLOAD_URL, data, config); - - this.job = response.data.job; - - this.poll.bind(this)(); - } catch (error) { - this.emit('error', new Error(error)); - } -}; - -Diawi.prototype.poll = function (pollCount) { - - if (pollCount > POLL_MAX_COUNT) { - this.emit('error', new Error('Timed out polling for job completion')); - return; - } - - sleep(POLL_INTERVAL).then(function () { - const url = STATUS_URL + '?job=' + this.job + '&token=' + this.token; - return axios.get(url); - }.bind(this)).then(function (response) { - try { - switch (response.data.status) { - case 2000: - if (response.data.link) { - this.emit('complete', response.data.link, response.data.qrcode); - } else { - this.emit('error', new Error('Failed to get link from success response')); - } - return; - case 2001: - // Nothing, this just means poll again - break; - default: - this.emit('error', new Error('Error in status response - ' + response.data.message)); - return; - } - this.poll(pollCount + 1); - } catch (err) { - this.emit('error', new Error(err)); - return; - } - }.bind(this)) - .catch(function (error) { - this.emit('error', new Error(error)); - }.bind(this)); -}; - -util.inherits(Diawi, EventEmitter); - -module.exports = Diawi; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 000000000..30eb19004 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,10757 @@ +require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 9009: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"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 __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.uploadToDiawi = void 0; +const node_fs_1 = __nccwpck_require__(7561); +const axios_1 = __importDefault(__nccwpck_require__(8757)); +const form_data_1 = __importDefault(__nccwpck_require__(4334)); +const UPLOAD_URL = 'https://upload.diawi.com'; +const POLL_MAX_COUNT = 10; +const POLL_INTERVAL = 2; +function uploadToDiawi(args) { + return __awaiter(this, void 0, void 0, function* () { + if (!(0, node_fs_1.existsSync)(args.file)) { + throw new Error(`Could not find file at ${args.file}`); + } + const file = (0, node_fs_1.createReadStream)(args.file); + const data = new form_data_1.default(); + data.append('token', args.token); + data.append('file', file); + data.append('password', args.password); + data.append('callback_emails', args.recipients); + data.append('wall_of_apps', args.wallOfApps ? '1' : '0'); + data.append('find_by_udid', args.findByUdid ? '1' : '0'); + data.append('installation_notifications', args.installationNotifications ? '1' : '0'); + data.append('comment', args.comment); + const response = yield axios_1.default.post(UPLOAD_URL, data, { + headers: { 'Content-Type': 'multipart/form-data' }, + maxContentLength: Infinity, + maxBodyLength: Infinity + }); + const job = response.data.job; + return pollUploadStatus(job, args.token); + }); +} +exports.uploadToDiawi = uploadToDiawi; +function pollUploadStatus(job, token) { + return __awaiter(this, void 0, void 0, function* () { + let pollCount = 0; + while (pollCount < POLL_MAX_COUNT) { + const response = yield axios_1.default.get(`${UPLOAD_URL}/status?job=${job}&token=${token}`); + switch (response.data.status) { + case 2000: + if (response.data.link) { + return { + url: response.data.link, + qrcode: response.data.qrcode + }; + } + else { + throw new Error('Failed to get link from success response'); + } + case 2001: + // Nothing, this just means poll again + break; + default: + throw new Error(`Error in status response - ${response.data.message}`); + } + yield sleep(POLL_INTERVAL); + pollCount++; + } + throw new Error('Timed out polling for job completion'); + }); +} +const sleep = (seconds) => __awaiter(void 0, void 0, void 0, function* () { + return new Promise(resolve => { + setTimeout(resolve, seconds * 1000); + }); +}); + + +/***/ }), + +/***/ 3109: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +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()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const core = __importStar(__nccwpck_require__(2186)); +const diawi_1 = __nccwpck_require__(9009); +function run() { + return __awaiter(this, void 0, void 0, function* () { + try { + const token = core.getInput('token', { trimWhitespace: true }); + const file = core.getInput('file', { trimWhitespace: true }); + core.debug(`file: ${file}`); + const password = core.getInput('password', { trimWhitespace: true }); + // core.debug(`password: ${password}`) + const recipients = core.getInput('recipients', { trimWhitespace: true }); + core.debug(`recipients: ${recipients}`); + const wallOfApps = core.getInput('wall_of_apps', { trimWhitespace: true }) === 'true'; + core.debug(`wallOfApps: ${wallOfApps}`); + const findByUdid = core.getInput('find_by_udid', { trimWhitespace: true }) === 'true'; + core.debug(`findByUdid: ${findByUdid}`); + const installationNotifications = core.getInput('installation_notifications', { trimWhitespace: true }) === + 'true'; + core.debug(`installationNotifications: ${installationNotifications}`); + const dryRun = core.getInput('dry-run', { trimWhitespace: true }) === 'true'; + core.debug(`dryRun: ${dryRun}`); + const comment = core.getInput('comment', { trimWhitespace: true }); + core.debug(comment); // debug is only output if you set the secret `ACTIONS_STEP_DEBUG` to true + const { url, qrcode } = yield (0, diawi_1.uploadToDiawi)({ + token, + file, + password, + recipients, + wallOfApps, + findByUdid, + installationNotifications, + dryRun, + comment + }); + core.debug(`url: ${url}`); + core.setOutput('url', url); + core.debug(`qrcode: ${qrcode}`); + core.setOutput('qrcode', qrcode); + } + catch (error) { + if (error instanceof Error) + core.setFailed(error.message); + } + }); +} +run(); + + +/***/ }), + +/***/ 7351: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.issue = exports.issueCommand = void 0; +const os = __importStar(__nccwpck_require__(2037)); +const utils_1 = __nccwpck_require__(5278); +/** + * 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 utils_1.toCommandValue(s) + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A'); +} +function escapeProperty(s) { + return utils_1.toCommandValue(s) + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A') + .replace(/:/g, '%3A') + .replace(/,/g, '%2C'); +} +//# sourceMappingURL=command.js.map + +/***/ }), + +/***/ 2186: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +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()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; +const command_1 = __nccwpck_require__(7351); +const file_command_1 = __nccwpck_require__(717); +const utils_1 = __nccwpck_require__(5278); +const os = __importStar(__nccwpck_require__(2037)); +const path = __importStar(__nccwpck_require__(1017)); +const oidc_utils_1 = __nccwpck_require__(8041); +/** + * 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. Non-string values will be converted to a string via JSON.stringify + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function exportVariable(name, val) { + const convertedVal = utils_1.toCommandValue(val); + process.env[name] = convertedVal; + const filePath = process.env['GITHUB_ENV'] || ''; + if (filePath) { + return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val)); + } + command_1.issueCommand('set-env', { name }, convertedVal); +} +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) { + const filePath = process.env['GITHUB_PATH'] || ''; + if (filePath) { + file_command_1.issueFileCommand('PATH', inputPath); + } + else { + command_1.issueCommand('add-path', {}, inputPath); + } + process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; +} +exports.addPath = addPath; +/** + * Gets the value of an input. + * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. + * Returns an empty string if the value is not defined. + * + * @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}`); + } + if (options && options.trimWhitespace === false) { + return val; + } + return val.trim(); +} +exports.getInput = getInput; +/** + * Gets the values of an multiline input. Each value is also trimmed. + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns string[] + * + */ +function getMultilineInput(name, options) { + const inputs = getInput(name, options) + .split('\n') + .filter(x => x !== ''); + if (options && options.trimWhitespace === false) { + return inputs; + } + return inputs.map(input => input.trim()); +} +exports.getMultilineInput = getMultilineInput; +/** + * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. + * Support boolean input list: `true | True | TRUE | false | False | FALSE` . + * The return value is also in boolean type. + * ref: https://yaml.org/spec/1.2/spec.html#id2804923 + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns boolean + */ +function getBooleanInput(name, options) { + const trueValue = ['true', 'True', 'TRUE']; + const falseValue = ['false', 'False', 'FALSE']; + const val = getInput(name, options); + if (trueValue.includes(val)) + return true; + if (falseValue.includes(val)) + return false; + throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + + `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); +} +exports.getBooleanInput = getBooleanInput; +/** + * Sets the value of an output. + * + * @param name name of the output to set + * @param value value to store. Non-string values will be converted to a string via JSON.stringify + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function setOutput(name, value) { + const filePath = process.env['GITHUB_OUTPUT'] || ''; + if (filePath) { + return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value)); + } + process.stdout.write(os.EOL); + command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value)); +} +exports.setOutput = setOutput; +/** + * Enables or disables the echoing of commands into stdout for the rest of the step. + * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. + * + */ +function setCommandEcho(enabled) { + command_1.issue('echo', enabled ? 'on' : 'off'); +} +exports.setCommandEcho = setCommandEcho; +//----------------------------------------------------------------------- +// 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. Errors will be converted to string via toString() + * @param properties optional properties to add to the annotation. + */ +function error(message, properties = {}) { + command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); +} +exports.error = error; +/** + * Adds a warning issue + * @param message warning issue message. Errors will be converted to string via toString() + * @param properties optional properties to add to the annotation. + */ +function warning(message, properties = {}) { + command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); +} +exports.warning = warning; +/** + * Adds a notice issue + * @param message notice issue message. Errors will be converted to string via toString() + * @param properties optional properties to add to the annotation. + */ +function notice(message, properties = {}) { + command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); +} +exports.notice = notice; +/** + * 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. Non-string values will be converted to a string via JSON.stringify + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function saveState(name, value) { + const filePath = process.env['GITHUB_STATE'] || ''; + if (filePath) { + return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value)); + } + command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(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; +function getIDToken(aud) { + return __awaiter(this, void 0, void 0, function* () { + return yield oidc_utils_1.OidcClient.getIDToken(aud); + }); +} +exports.getIDToken = getIDToken; +/** + * Summary exports + */ +var summary_1 = __nccwpck_require__(1327); +Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); +/** + * @deprecated use core.summary + */ +var summary_2 = __nccwpck_require__(1327); +Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); +/** + * Path exports + */ +var path_utils_1 = __nccwpck_require__(2981); +Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); +Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); +Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); +//# sourceMappingURL=core.js.map + +/***/ }), + +/***/ 717: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +// For internal use, subject to change. +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +const fs = __importStar(__nccwpck_require__(7147)); +const os = __importStar(__nccwpck_require__(2037)); +const uuid_1 = __nccwpck_require__(5840); +const utils_1 = __nccwpck_require__(5278); +function issueFileCommand(command, message) { + const filePath = process.env[`GITHUB_${command}`]; + if (!filePath) { + throw new Error(`Unable to find environment variable for file command ${command}`); + } + if (!fs.existsSync(filePath)) { + throw new Error(`Missing file at path: ${filePath}`); + } + fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { + encoding: 'utf8' + }); +} +exports.issueFileCommand = issueFileCommand; +function prepareKeyValueMessage(key, value) { + const delimiter = `ghadelimiter_${uuid_1.v4()}`; + const convertedValue = utils_1.toCommandValue(value); + // These should realistically never happen, but just in case someone finds a + // way to exploit uuid generation let's not allow keys or values that contain + // the delimiter. + if (key.includes(delimiter)) { + throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); + } + if (convertedValue.includes(delimiter)) { + throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); + } + return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; +} +exports.prepareKeyValueMessage = prepareKeyValueMessage; +//# sourceMappingURL=file-command.js.map + +/***/ }), + +/***/ 8041: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"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()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OidcClient = void 0; +const http_client_1 = __nccwpck_require__(6255); +const auth_1 = __nccwpck_require__(5526); +const core_1 = __nccwpck_require__(2186); +class OidcClient { + static createHttpClient(allowRetry = true, maxRetry = 10) { + const requestOptions = { + allowRetries: allowRetry, + maxRetries: maxRetry + }; + return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); + } + static getRequestToken() { + const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; + if (!token) { + throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); + } + return token; + } + static getIDTokenUrl() { + const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; + if (!runtimeUrl) { + throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); + } + return runtimeUrl; + } + static getCall(id_token_url) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + const httpclient = OidcClient.createHttpClient(); + const res = yield httpclient + .getJson(id_token_url) + .catch(error => { + throw new Error(`Failed to get ID Token. \n + Error Code : ${error.statusCode}\n + Error Message: ${error.result.message}`); + }); + const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; + if (!id_token) { + throw new Error('Response json body do not have ID Token field'); + } + return id_token; + }); + } + static getIDToken(audience) { + return __awaiter(this, void 0, void 0, function* () { + try { + // New ID Token is requested from action service + let id_token_url = OidcClient.getIDTokenUrl(); + if (audience) { + const encodedAudience = encodeURIComponent(audience); + id_token_url = `${id_token_url}&audience=${encodedAudience}`; + } + core_1.debug(`ID token url is ${id_token_url}`); + const id_token = yield OidcClient.getCall(id_token_url); + core_1.setSecret(id_token); + return id_token; + } + catch (error) { + throw new Error(`Error message: ${error.message}`); + } + }); + } +} +exports.OidcClient = OidcClient; +//# sourceMappingURL=oidc-utils.js.map + +/***/ }), + +/***/ 2981: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; +const path = __importStar(__nccwpck_require__(1017)); +/** + * toPosixPath converts the given path to the posix form. On Windows, \\ will be + * replaced with /. + * + * @param pth. Path to transform. + * @return string Posix path. + */ +function toPosixPath(pth) { + return pth.replace(/[\\]/g, '/'); +} +exports.toPosixPath = toPosixPath; +/** + * toWin32Path converts the given path to the win32 form. On Linux, / will be + * replaced with \\. + * + * @param pth. Path to transform. + * @return string Win32 path. + */ +function toWin32Path(pth) { + return pth.replace(/[/]/g, '\\'); +} +exports.toWin32Path = toWin32Path; +/** + * toPlatformPath converts the given path to a platform-specific path. It does + * this by replacing instances of / and \ with the platform-specific path + * separator. + * + * @param pth The path to platformize. + * @return string The platform-specific path. + */ +function toPlatformPath(pth) { + return pth.replace(/[/\\]/g, path.sep); +} +exports.toPlatformPath = toPlatformPath; +//# sourceMappingURL=path-utils.js.map + +/***/ }), + +/***/ 1327: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"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()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; +const os_1 = __nccwpck_require__(2037); +const fs_1 = __nccwpck_require__(7147); +const { access, appendFile, writeFile } = fs_1.promises; +exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; +exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; +class Summary { + constructor() { + this._buffer = ''; + } + /** + * Finds the summary file path from the environment, rejects if env var is not found or file does not exist + * Also checks r/w permissions. + * + * @returns step summary file path + */ + filePath() { + return __awaiter(this, void 0, void 0, function* () { + if (this._filePath) { + return this._filePath; + } + const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; + if (!pathFromEnv) { + throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); + } + try { + yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); + } + catch (_a) { + throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); + } + this._filePath = pathFromEnv; + return this._filePath; + }); + } + /** + * Wraps content in an HTML tag, adding any HTML attributes + * + * @param {string} tag HTML tag to wrap + * @param {string | null} content content within the tag + * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add + * + * @returns {string} content wrapped in HTML element + */ + wrap(tag, content, attrs = {}) { + const htmlAttrs = Object.entries(attrs) + .map(([key, value]) => ` ${key}="${value}"`) + .join(''); + if (!content) { + return `<${tag}${htmlAttrs}>`; + } + return `<${tag}${htmlAttrs}>${content}`; + } + /** + * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. + * + * @param {SummaryWriteOptions} [options] (optional) options for write operation + * + * @returns {Promise} summary instance + */ + write(options) { + return __awaiter(this, void 0, void 0, function* () { + const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); + const filePath = yield this.filePath(); + const writeFunc = overwrite ? writeFile : appendFile; + yield writeFunc(filePath, this._buffer, { encoding: 'utf8' }); + return this.emptyBuffer(); + }); + } + /** + * Clears the summary buffer and wipes the summary file + * + * @returns {Summary} summary instance + */ + clear() { + return __awaiter(this, void 0, void 0, function* () { + return this.emptyBuffer().write({ overwrite: true }); + }); + } + /** + * Returns the current summary buffer as a string + * + * @returns {string} string of summary buffer + */ + stringify() { + return this._buffer; + } + /** + * If the summary buffer is empty + * + * @returns {boolen} true if the buffer is empty + */ + isEmptyBuffer() { + return this._buffer.length === 0; + } + /** + * Resets the summary buffer without writing to summary file + * + * @returns {Summary} summary instance + */ + emptyBuffer() { + this._buffer = ''; + return this; + } + /** + * Adds raw text to the summary buffer + * + * @param {string} text content to add + * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) + * + * @returns {Summary} summary instance + */ + addRaw(text, addEOL = false) { + this._buffer += text; + return addEOL ? this.addEOL() : this; + } + /** + * Adds the operating system-specific end-of-line marker to the buffer + * + * @returns {Summary} summary instance + */ + addEOL() { + return this.addRaw(os_1.EOL); + } + /** + * Adds an HTML codeblock to the summary buffer + * + * @param {string} code content to render within fenced code block + * @param {string} lang (optional) language to syntax highlight code + * + * @returns {Summary} summary instance + */ + addCodeBlock(code, lang) { + const attrs = Object.assign({}, (lang && { lang })); + const element = this.wrap('pre', this.wrap('code', code), attrs); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML list to the summary buffer + * + * @param {string[]} items list of items to render + * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) + * + * @returns {Summary} summary instance + */ + addList(items, ordered = false) { + const tag = ordered ? 'ol' : 'ul'; + const listItems = items.map(item => this.wrap('li', item)).join(''); + const element = this.wrap(tag, listItems); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML table to the summary buffer + * + * @param {SummaryTableCell[]} rows table rows + * + * @returns {Summary} summary instance + */ + addTable(rows) { + const tableBody = rows + .map(row => { + const cells = row + .map(cell => { + if (typeof cell === 'string') { + return this.wrap('td', cell); + } + const { header, data, colspan, rowspan } = cell; + const tag = header ? 'th' : 'td'; + const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })); + return this.wrap(tag, data, attrs); + }) + .join(''); + return this.wrap('tr', cells); + }) + .join(''); + const element = this.wrap('table', tableBody); + return this.addRaw(element).addEOL(); + } + /** + * Adds a collapsable HTML details element to the summary buffer + * + * @param {string} label text for the closed state + * @param {string} content collapsable content + * + * @returns {Summary} summary instance + */ + addDetails(label, content) { + const element = this.wrap('details', this.wrap('summary', label) + content); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML image tag to the summary buffer + * + * @param {string} src path to the image you to embed + * @param {string} alt text description of the image + * @param {SummaryImageOptions} options (optional) addition image attributes + * + * @returns {Summary} summary instance + */ + addImage(src, alt, options) { + const { width, height } = options || {}; + const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height })); + const element = this.wrap('img', null, Object.assign({ src, alt }, attrs)); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML section heading element + * + * @param {string} text heading text + * @param {number | string} [level=1] (optional) the heading level, default: 1 + * + * @returns {Summary} summary instance + */ + addHeading(text, level) { + const tag = `h${level}`; + const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag) + ? tag + : 'h1'; + const element = this.wrap(allowedTag, text); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML thematic break (
) to the summary buffer + * + * @returns {Summary} summary instance + */ + addSeparator() { + const element = this.wrap('hr', null); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML line break (
) to the summary buffer + * + * @returns {Summary} summary instance + */ + addBreak() { + const element = this.wrap('br', null); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML blockquote to the summary buffer + * + * @param {string} text quote text + * @param {string} cite (optional) citation url + * + * @returns {Summary} summary instance + */ + addQuote(text, cite) { + const attrs = Object.assign({}, (cite && { cite })); + const element = this.wrap('blockquote', text, attrs); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML anchor tag to the summary buffer + * + * @param {string} text link text/content + * @param {string} href hyperlink + * + * @returns {Summary} summary instance + */ + addLink(text, href) { + const element = this.wrap('a', text, { href }); + return this.addRaw(element).addEOL(); + } +} +const _summary = new Summary(); +/** + * @deprecated use `core.summary` + */ +exports.markdownSummary = _summary; +exports.summary = _summary; +//# sourceMappingURL=summary.js.map + +/***/ }), + +/***/ 5278: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toCommandProperties = exports.toCommandValue = void 0; +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +function toCommandValue(input) { + if (input === null || input === undefined) { + return ''; + } + else if (typeof input === 'string' || input instanceof String) { + return input; + } + return JSON.stringify(input); +} +exports.toCommandValue = toCommandValue; +/** + * + * @param annotationProperties + * @returns The command properties to send with the actual annotation command + * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 + */ +function toCommandProperties(annotationProperties) { + if (!Object.keys(annotationProperties).length) { + return {}; + } + return { + title: annotationProperties.title, + file: annotationProperties.file, + line: annotationProperties.startLine, + endLine: annotationProperties.endLine, + col: annotationProperties.startColumn, + endColumn: annotationProperties.endColumn + }; +} +exports.toCommandProperties = toCommandProperties; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 5526: +/***/ (function(__unused_webpack_module, exports) { + +"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()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; +class BasicCredentialHandler { + constructor(username, password) { + this.username = username; + this.password = password; + } + prepareRequest(options) { + if (!options.headers) { + throw Error('The request has no headers'); + } + options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`; + } + // This handler cannot handle 401 + canHandleAuthentication() { + return false; + } + handleAuthentication() { + return __awaiter(this, void 0, void 0, function* () { + throw new Error('not implemented'); + }); + } +} +exports.BasicCredentialHandler = BasicCredentialHandler; +class BearerCredentialHandler { + constructor(token) { + this.token = token; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + if (!options.headers) { + throw Error('The request has no headers'); + } + options.headers['Authorization'] = `Bearer ${this.token}`; + } + // This handler cannot handle 401 + canHandleAuthentication() { + return false; + } + handleAuthentication() { + return __awaiter(this, void 0, void 0, function* () { + throw new Error('not implemented'); + }); + } +} +exports.BearerCredentialHandler = BearerCredentialHandler; +class PersonalAccessTokenCredentialHandler { + constructor(token) { + this.token = token; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + if (!options.headers) { + throw Error('The request has no headers'); + } + options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`; + } + // This handler cannot handle 401 + canHandleAuthentication() { + return false; + } + handleAuthentication() { + return __awaiter(this, void 0, void 0, function* () { + throw new Error('not implemented'); + }); + } +} +exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; +//# sourceMappingURL=auth.js.map + +/***/ }), + +/***/ 6255: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* eslint-disable @typescript-eslint/no-explicit-any */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +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()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; +const http = __importStar(__nccwpck_require__(3685)); +const https = __importStar(__nccwpck_require__(5687)); +const pm = __importStar(__nccwpck_require__(9835)); +const tunnel = __importStar(__nccwpck_require__(4294)); +var HttpCodes; +(function (HttpCodes) { + HttpCodes[HttpCodes["OK"] = 200] = "OK"; + HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; + HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; + HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; + HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; + HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; + HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; + HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; + HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; + HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; +})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +var Headers; +(function (Headers) { + Headers["Accept"] = "accept"; + Headers["ContentType"] = "content-type"; +})(Headers = exports.Headers || (exports.Headers = {})); +var MediaTypes; +(function (MediaTypes) { + MediaTypes["ApplicationJson"] = "application/json"; +})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); +/** + * Returns the proxy URL, depending upon the supplied url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ +function getProxyUrl(serverUrl) { + const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); + return proxyUrl ? proxyUrl.href : ''; +} +exports.getProxyUrl = getProxyUrl; +const HttpRedirectCodes = [ + HttpCodes.MovedPermanently, + HttpCodes.ResourceMoved, + HttpCodes.SeeOther, + HttpCodes.TemporaryRedirect, + HttpCodes.PermanentRedirect +]; +const HttpResponseRetryCodes = [ + HttpCodes.BadGateway, + HttpCodes.ServiceUnavailable, + HttpCodes.GatewayTimeout +]; +const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; +const ExponentialBackoffCeiling = 10; +const ExponentialBackoffTimeSlice = 5; +class HttpClientError extends Error { + constructor(message, statusCode) { + super(message); + this.name = 'HttpClientError'; + this.statusCode = statusCode; + Object.setPrototypeOf(this, HttpClientError.prototype); + } +} +exports.HttpClientError = HttpClientError; +class HttpClientResponse { + constructor(message) { + this.message = message; + } + readBody() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { + let output = Buffer.alloc(0); + this.message.on('data', (chunk) => { + output = Buffer.concat([output, chunk]); + }); + this.message.on('end', () => { + resolve(output.toString()); + }); + })); + }); + } +} +exports.HttpClientResponse = HttpClientResponse; +function isHttps(requestUrl) { + const parsedUrl = new URL(requestUrl); + return parsedUrl.protocol === 'https:'; +} +exports.isHttps = isHttps; +class HttpClient { + constructor(userAgent, handlers, requestOptions) { + this._ignoreSslError = false; + this._allowRedirects = true; + this._allowRedirectDowngrade = false; + this._maxRedirects = 50; + this._allowRetries = false; + this._maxRetries = 1; + this._keepAlive = false; + this._disposed = false; + this.userAgent = userAgent; + this.handlers = handlers || []; + this.requestOptions = requestOptions; + if (requestOptions) { + if (requestOptions.ignoreSslError != null) { + this._ignoreSslError = requestOptions.ignoreSslError; + } + this._socketTimeout = requestOptions.socketTimeout; + if (requestOptions.allowRedirects != null) { + this._allowRedirects = requestOptions.allowRedirects; + } + if (requestOptions.allowRedirectDowngrade != null) { + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; + } + if (requestOptions.maxRedirects != null) { + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); + } + if (requestOptions.keepAlive != null) { + this._keepAlive = requestOptions.keepAlive; + } + if (requestOptions.allowRetries != null) { + this._allowRetries = requestOptions.allowRetries; + } + if (requestOptions.maxRetries != null) { + this._maxRetries = requestOptions.maxRetries; + } + } + } + options(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); + }); + } + get(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('GET', requestUrl, null, additionalHeaders || {}); + }); + } + del(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); + }); + } + post(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('POST', requestUrl, data, additionalHeaders || {}); + }); + } + patch(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); + }); + } + put(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('PUT', requestUrl, data, additionalHeaders || {}); + }); + } + head(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); + }); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request(verb, requestUrl, stream, additionalHeaders); + }); + } + /** + * Gets a typed object from an endpoint + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise + */ + getJson(requestUrl, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + const res = yield this.get(requestUrl, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + postJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.post(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + putJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.put(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + patchJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.patch(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + /** + * Makes a raw http request. + * All other methods such as get, post, patch, and request ultimately call this. + * Prefer get, del, post and patch + */ + request(verb, requestUrl, data, headers) { + return __awaiter(this, void 0, void 0, function* () { + if (this._disposed) { + throw new Error('Client has already been disposed.'); + } + const parsedUrl = new URL(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + // Only perform retries on reads since writes may not be idempotent. + const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) + ? this._maxRetries + 1 + : 1; + let numTries = 0; + let response; + do { + response = yield this.requestRaw(info, data); + // Check if it's an authentication challenge + if (response && + response.message && + response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (const handler of this.handlers) { + if (handler.canHandleAuthentication(response)) { + authenticationHandler = handler; + break; + } + } + if (authenticationHandler) { + return authenticationHandler.handleAuthentication(this, info, data); + } + else { + // We have received an unauthorized response but have no handlers to handle it. + // Let the response return to the caller. + return response; + } + } + let redirectsRemaining = this._maxRedirects; + while (response.message.statusCode && + HttpRedirectCodes.includes(response.message.statusCode) && + this._allowRedirects && + redirectsRemaining > 0) { + const redirectUrl = response.message.headers['location']; + if (!redirectUrl) { + // if there's no location to redirect to, we won't + break; + } + const parsedRedirectUrl = new URL(redirectUrl); + if (parsedUrl.protocol === 'https:' && + parsedUrl.protocol !== parsedRedirectUrl.protocol && + !this._allowRedirectDowngrade) { + throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); + } + // we need to finish reading the response before reassigning response + // which will leak the open socket. + yield response.readBody(); + // strip authorization header if redirected to a different hostname + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { + for (const header in headers) { + // header names are case insensitive + if (header.toLowerCase() === 'authorization') { + delete headers[header]; + } + } + } + // let's make the request with the new redirectUrl + info = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = yield this.requestRaw(info, data); + redirectsRemaining--; + } + if (!response.message.statusCode || + !HttpResponseRetryCodes.includes(response.message.statusCode)) { + // If not a retry code, return immediately instead of retrying + return response; + } + numTries += 1; + if (numTries < maxTries) { + yield response.readBody(); + yield this._performExponentialBackoff(numTries); + } + } while (numTries < maxTries); + return response; + }); + } + /** + * Needs to be called if keepAlive is set to true in request options. + */ + dispose() { + if (this._agent) { + this._agent.destroy(); + } + this._disposed = true; + } + /** + * Raw request. + * @param info + * @param data + */ + requestRaw(info, data) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + function callbackForResult(err, res) { + if (err) { + reject(err); + } + else if (!res) { + // If `err` is not passed, then `res` must be passed. + reject(new Error('Unknown error')); + } + else { + resolve(res); + } + } + this.requestRawWithCallback(info, data, callbackForResult); + }); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + if (typeof data === 'string') { + if (!info.options.headers) { + info.options.headers = {}; + } + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); + } + let callbackCalled = false; + function handleResult(err, res) { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + } + const req = info.httpModule.request(info.options, (msg) => { + const res = new HttpClientResponse(msg); + handleResult(undefined, res); + }); + let socket; + req.on('socket', sock => { + socket = sock; + }); + // If we ever get disconnected, we want the socket to timeout eventually + req.setTimeout(this._socketTimeout || 3 * 60000, () => { + if (socket) { + socket.end(); + } + handleResult(new Error(`Request timeout: ${info.options.path}`)); + }); + req.on('error', function (err) { + // err has statusCode property + // res should have headers + handleResult(err); + }); + if (data && typeof data === 'string') { + req.write(data, 'utf8'); + } + if (data && typeof data !== 'string') { + data.on('close', function () { + req.end(); + }); + data.pipe(req); + } + else { + req.end(); + } + } + /** + * Gets an http agent. This function is useful when you need an http agent that handles + * routing through a proxy server - depending upon the url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ + getAgent(serverUrl) { + const parsedUrl = new URL(serverUrl); + return this._getAgent(parsedUrl); + } + _prepareRequest(method, requestUrl, headers) { + const info = {}; + info.parsedUrl = requestUrl; + const usingSsl = info.parsedUrl.protocol === 'https:'; + info.httpModule = usingSsl ? https : http; + const defaultPort = usingSsl ? 443 : 80; + info.options = {}; + info.options.host = info.parsedUrl.hostname; + info.options.port = info.parsedUrl.port + ? parseInt(info.parsedUrl.port) + : defaultPort; + info.options.path = + (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); + info.options.method = method; + info.options.headers = this._mergeHeaders(headers); + if (this.userAgent != null) { + info.options.headers['user-agent'] = this.userAgent; + } + info.options.agent = this._getAgent(info.parsedUrl); + // gives handlers an opportunity to participate + if (this.handlers) { + for (const handler of this.handlers) { + handler.prepareRequest(info.options); + } + } + return info; + } + _mergeHeaders(headers) { + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); + } + return lowercaseKeys(headers || {}); + } + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { + let clientHeader; + if (this.requestOptions && this.requestOptions.headers) { + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; + } + return additionalHeaders[header] || clientHeader || _default; + } + _getAgent(parsedUrl) { + let agent; + const proxyUrl = pm.getProxyUrl(parsedUrl); + const useProxy = proxyUrl && proxyUrl.hostname; + if (this._keepAlive && useProxy) { + agent = this._proxyAgent; + } + if (this._keepAlive && !useProxy) { + agent = this._agent; + } + // if agent is already assigned use that agent. + if (agent) { + return agent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + let maxSockets = 100; + if (this.requestOptions) { + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; + } + // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. + if (proxyUrl && proxyUrl.hostname) { + const agentOptions = { + maxSockets, + keepAlive: this._keepAlive, + proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { + proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` + })), { host: proxyUrl.hostname, port: proxyUrl.port }) + }; + let tunnelAgent; + const overHttps = proxyUrl.protocol === 'https:'; + if (usingSsl) { + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + } + else { + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + } + agent = tunnelAgent(agentOptions); + this._proxyAgent = agent; + } + // if reusing agent across request and tunneling agent isn't assigned create a new agent + if (this._keepAlive && !agent) { + const options = { keepAlive: this._keepAlive, maxSockets }; + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + this._agent = agent; + } + // if not using private agent and tunnel agent isn't setup then use global agent + if (!agent) { + agent = usingSsl ? https.globalAgent : http.globalAgent; + } + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + agent.options = Object.assign(agent.options || {}, { + rejectUnauthorized: false + }); + } + return agent; + } + _performExponentialBackoff(retryNumber) { + return __awaiter(this, void 0, void 0, function* () { + retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); + const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); + return new Promise(resolve => setTimeout(() => resolve(), ms)); + }); + } + _processResponse(res, options) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + const statusCode = res.message.statusCode || 0; + const response = { + statusCode, + result: null, + headers: {} + }; + // not found leads to null obj returned + if (statusCode === HttpCodes.NotFound) { + resolve(response); + } + // get the result from the body + function dateTimeDeserializer(key, value) { + if (typeof value === 'string') { + const a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + let obj; + let contents; + try { + contents = yield res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, dateTimeDeserializer); + } + else { + obj = JSON.parse(contents); + } + response.result = obj; + } + response.headers = res.message.headers; + } + catch (err) { + // Invalid resource (contents not json); leaving result obj null + } + // note that 3xx redirects are handled by the http layer. + if (statusCode > 299) { + let msg; + // if exception/error in body, attempt to get better error + if (obj && obj.message) { + msg = obj.message; + } + else if (contents && contents.length > 0) { + // it may be the case that the exception is in the body message as string + msg = contents; + } + else { + msg = `Failed request: (${statusCode})`; + } + const err = new HttpClientError(msg, statusCode); + err.result = response.result; + reject(err); + } + else { + resolve(response); + } + })); + }); + } +} +exports.HttpClient = HttpClient; +const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 9835: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.checkBypass = exports.getProxyUrl = void 0; +function getProxyUrl(reqUrl) { + const usingSsl = reqUrl.protocol === 'https:'; + if (checkBypass(reqUrl)) { + return undefined; + } + const proxyVar = (() => { + if (usingSsl) { + return process.env['https_proxy'] || process.env['HTTPS_PROXY']; + } + else { + return process.env['http_proxy'] || process.env['HTTP_PROXY']; + } + })(); + if (proxyVar) { + return new URL(proxyVar); + } + else { + return undefined; + } +} +exports.getProxyUrl = getProxyUrl; +function checkBypass(reqUrl) { + if (!reqUrl.hostname) { + return false; + } + const reqHost = reqUrl.hostname; + if (isLoopbackAddress(reqHost)) { + return true; + } + const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; + if (!noProxy) { + return false; + } + // Determine the request port + let reqPort; + if (reqUrl.port) { + reqPort = Number(reqUrl.port); + } + else if (reqUrl.protocol === 'http:') { + reqPort = 80; + } + else if (reqUrl.protocol === 'https:') { + reqPort = 443; + } + // Format the request hostname and hostname with port + const upperReqHosts = [reqUrl.hostname.toUpperCase()]; + if (typeof reqPort === 'number') { + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); + } + // Compare request host against noproxy + for (const upperNoProxyItem of noProxy + .split(',') + .map(x => x.trim().toUpperCase()) + .filter(x => x)) { + if (upperNoProxyItem === '*' || + upperReqHosts.some(x => x === upperNoProxyItem || + x.endsWith(`.${upperNoProxyItem}`) || + (upperNoProxyItem.startsWith('.') && + x.endsWith(`${upperNoProxyItem}`)))) { + return true; + } + } + return false; +} +exports.checkBypass = checkBypass; +function isLoopbackAddress(host) { + const hostLower = host.toLowerCase(); + return (hostLower === 'localhost' || + hostLower.startsWith('127.') || + hostLower.startsWith('[::1]') || + hostLower.startsWith('[0:0:0:0:0:0:0:1]')); +} +//# sourceMappingURL=proxy.js.map + +/***/ }), + +/***/ 4812: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = +{ + parallel : __nccwpck_require__(8210), + serial : __nccwpck_require__(445), + serialOrdered : __nccwpck_require__(3578) +}; + + +/***/ }), + +/***/ 1700: +/***/ ((module) => { + +// API +module.exports = abort; + +/** + * Aborts leftover active jobs + * + * @param {object} state - current state object + */ +function abort(state) +{ + Object.keys(state.jobs).forEach(clean.bind(state)); + + // reset leftover jobs + state.jobs = {}; +} + +/** + * Cleans up leftover job by invoking abort function for the provided job id + * + * @this state + * @param {string|number} key - job id to abort + */ +function clean(key) +{ + if (typeof this.jobs[key] == 'function') + { + this.jobs[key](); + } +} + + +/***/ }), + +/***/ 2794: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var defer = __nccwpck_require__(5295); + +// API +module.exports = async; + +/** + * Runs provided callback asynchronously + * even if callback itself is not + * + * @param {function} callback - callback to invoke + * @returns {function} - augmented callback + */ +function async(callback) +{ + var isAsync = false; + + // check if async happened + defer(function() { isAsync = true; }); + + return function async_callback(err, result) + { + if (isAsync) + { + callback(err, result); + } + else + { + defer(function nextTick_callback() + { + callback(err, result); + }); + } + }; +} + + +/***/ }), + +/***/ 5295: +/***/ ((module) => { + +module.exports = defer; + +/** + * Runs provided function on next iteration of the event loop + * + * @param {function} fn - function to run + */ +function defer(fn) +{ + var nextTick = typeof setImmediate == 'function' + ? setImmediate + : ( + typeof process == 'object' && typeof process.nextTick == 'function' + ? process.nextTick + : null + ); + + if (nextTick) + { + nextTick(fn); + } + else + { + setTimeout(fn, 0); + } +} + + +/***/ }), + +/***/ 9023: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var async = __nccwpck_require__(2794) + , abort = __nccwpck_require__(1700) + ; + +// API +module.exports = iterate; + +/** + * Iterates over each job object + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {object} state - current job status + * @param {function} callback - invoked when all elements processed + */ +function iterate(list, iterator, state, callback) +{ + // store current index + var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; + + state.jobs[key] = runJob(iterator, key, list[key], function(error, output) + { + // don't repeat yourself + // skip secondary callbacks + if (!(key in state.jobs)) + { + return; + } + + // clean up jobs + delete state.jobs[key]; + + if (error) + { + // don't process rest of the results + // stop still active jobs + // and reset the list + abort(state); + } + else + { + state.results[key] = output; + } + + // return salvaged results + callback(error, state.results); + }); +} + +/** + * Runs iterator over provided job element + * + * @param {function} iterator - iterator to invoke + * @param {string|number} key - key/index of the element in the list of jobs + * @param {mixed} item - job description + * @param {function} callback - invoked after iterator is done with the job + * @returns {function|mixed} - job abort function or something else + */ +function runJob(iterator, key, item, callback) +{ + var aborter; + + // allow shortcut if iterator expects only two arguments + if (iterator.length == 2) + { + aborter = iterator(item, async(callback)); + } + // otherwise go with full three arguments + else + { + aborter = iterator(item, key, async(callback)); + } + + return aborter; +} + + +/***/ }), + +/***/ 2474: +/***/ ((module) => { + +// API +module.exports = state; + +/** + * Creates initial state object + * for iteration over list + * + * @param {array|object} list - list to iterate over + * @param {function|null} sortMethod - function to use for keys sort, + * or `null` to keep them as is + * @returns {object} - initial state object + */ +function state(list, sortMethod) +{ + var isNamedList = !Array.isArray(list) + , initState = + { + index : 0, + keyedList: isNamedList || sortMethod ? Object.keys(list) : null, + jobs : {}, + results : isNamedList ? {} : [], + size : isNamedList ? Object.keys(list).length : list.length + } + ; + + if (sortMethod) + { + // sort array keys based on it's values + // sort object's keys just on own merit + initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) + { + return sortMethod(list[a], list[b]); + }); + } + + return initState; +} + + +/***/ }), + +/***/ 7942: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var abort = __nccwpck_require__(1700) + , async = __nccwpck_require__(2794) + ; + +// API +module.exports = terminator; + +/** + * Terminates jobs in the attached state context + * + * @this AsyncKitState# + * @param {function} callback - final callback to invoke after termination + */ +function terminator(callback) +{ + if (!Object.keys(this.jobs).length) + { + return; + } + + // fast forward iteration index + this.index = this.size; + + // abort jobs + abort(this); + + // send back results we have so far + async(callback)(null, this.results); +} + + +/***/ }), + +/***/ 8210: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var iterate = __nccwpck_require__(9023) + , initState = __nccwpck_require__(2474) + , terminator = __nccwpck_require__(7942) + ; + +// Public API +module.exports = parallel; + +/** + * Runs iterator over provided array elements in parallel + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function parallel(list, iterator, callback) +{ + var state = initState(list); + + while (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, function(error, result) + { + if (error) + { + callback(error, result); + return; + } + + // looks like it's the last one + if (Object.keys(state.jobs).length === 0) + { + callback(null, state.results); + return; + } + }); + + state.index++; + } + + return terminator.bind(state, callback); +} + + +/***/ }), + +/***/ 445: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var serialOrdered = __nccwpck_require__(3578); + +// Public API +module.exports = serial; + +/** + * Runs iterator over provided array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serial(list, iterator, callback) +{ + return serialOrdered(list, iterator, null, callback); +} + + +/***/ }), + +/***/ 3578: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var iterate = __nccwpck_require__(9023) + , initState = __nccwpck_require__(2474) + , terminator = __nccwpck_require__(7942) + ; + +// Public API +module.exports = serialOrdered; +// sorting helpers +module.exports.ascending = ascending; +module.exports.descending = descending; + +/** + * Runs iterator over provided sorted array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serialOrdered(list, iterator, sortMethod, callback) +{ + var state = initState(list, sortMethod); + + iterate(list, iterator, state, function iteratorHandler(error, result) + { + if (error) + { + callback(error, result); + return; + } + + state.index++; + + // are we there yet? + if (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, iteratorHandler); + return; + } + + // done here + callback(null, state.results); + }); + + return terminator.bind(state, callback); +} + +/* + * -- Sort methods + */ + +/** + * sort helper to sort array elements in ascending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function ascending(a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} + +/** + * sort helper to sort array elements in descending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function descending(a, b) +{ + return -1 * ascending(a, b); +} + + +/***/ }), + +/***/ 5443: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var util = __nccwpck_require__(3837); +var Stream = (__nccwpck_require__(2781).Stream); +var DelayedStream = __nccwpck_require__(8611); + +module.exports = CombinedStream; +function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + + this._released = false; + this._streams = []; + this._currentStream = null; + this._insideLoop = false; + this._pendingNext = false; +} +util.inherits(CombinedStream, Stream); + +CombinedStream.create = function(options) { + var combinedStream = new this(); + + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + + return combinedStream; +}; + +CombinedStream.isStreamLike = function(stream) { + return (typeof stream !== 'function') + && (typeof stream !== 'string') + && (typeof stream !== 'boolean') + && (typeof stream !== 'number') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; + } + + this._handleErrors(stream); + + if (this.pauseStreams) { + stream.pause(); + } + } + + this._streams.push(stream); + return this; +}; + +CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); + return dest; +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + + if (this._insideLoop) { + this._pendingNext = true; + return; // defer call + } + + this._insideLoop = true; + try { + do { + this._pendingNext = false; + this._realGetNext(); + } while (this._pendingNext); + } finally { + this._insideLoop = false; + } +}; + +CombinedStream.prototype._realGetNext = function() { + var stream = this._streams.shift(); + + + if (typeof stream == 'undefined') { + this.end(); + return; + } + + if (typeof stream !== 'function') { + this._pipeNext(stream); + return; + } + + var getStream = stream; + getStream(function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('data', this._checkDataSize.bind(this)); + this._handleErrors(stream); + } + + this._pipeNext(stream); + }.bind(this)); +}; + +CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('end', this._getNext.bind(this)); + stream.pipe(this, {end: false}); + return; + } + + var value = stream; + this.write(value); + this._getNext(); +}; + +CombinedStream.prototype._handleErrors = function(stream) { + var self = this; + stream.on('error', function(err) { + self._emitError(err); + }); +}; + +CombinedStream.prototype.write = function(data) { + this.emit('data', data); +}; + +CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); + this.emit('resume'); +}; + +CombinedStream.prototype.end = function() { + this._reset(); + this.emit('end'); +}; + +CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit('close'); +}; + +CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; +}; + +CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; + this._emitError(new Error(message)); +}; + +CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + + var self = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + + self.dataSize += stream.dataSize; + }); + + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } +}; + +CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit('error', err); +}; + + +/***/ }), + +/***/ 8222: +/***/ ((module, exports, __nccwpck_require__) => { + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = __nccwpck_require__(6243)(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + + +/***/ }), + +/***/ 6243: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __nccwpck_require__(900); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; + + +/***/ }), + +/***/ 8237: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __nccwpck_require__(8222); +} else { + module.exports = __nccwpck_require__(4874); +} + + +/***/ }), + +/***/ 4874: +/***/ ((module, exports, __nccwpck_require__) => { + +/** + * Module dependencies. + */ + +const tty = __nccwpck_require__(6224); +const util = __nccwpck_require__(3837); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __nccwpck_require__(9318); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = __nccwpck_require__(6243)(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + + +/***/ }), + +/***/ 8611: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var Stream = (__nccwpck_require__(2781).Stream); +var util = __nccwpck_require__(3837); + +module.exports = DelayedStream; +function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; +} +util.inherits(DelayedStream, Stream); + +DelayedStream.create = function(source, options) { + var delayedStream = new this(); + + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + + delayedStream.source = source; + + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + + source.on('error', function() {}); + if (delayedStream.pauseStream) { + source.pause(); + } + + return delayedStream; +}; + +Object.defineProperty(DelayedStream.prototype, 'readable', { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } +}); + +DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); +}; + +DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + + this.source.resume(); +}; + +DelayedStream.prototype.pause = function() { + this.source.pause(); +}; + +DelayedStream.prototype.release = function() { + this._released = true; + + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; +}; + +DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; +}; + +DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + + if (args[0] === 'data') { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + + this._bufferedEvents.push(args); +}; + +DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + + if (this.dataSize <= this.maxDataSize) { + return; + } + + this._maxDataSizeExceeded = true; + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this.emit('error', new Error(message)); +}; + + +/***/ }), + +/***/ 1133: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var debug; + +module.exports = function () { + if (!debug) { + try { + /* eslint global-require: off */ + debug = __nccwpck_require__(8237)("follow-redirects"); + } + catch (error) { /* */ } + if (typeof debug !== "function") { + debug = function () { /* */ }; + } + } + debug.apply(null, arguments); +}; + + +/***/ }), + +/***/ 7707: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var url = __nccwpck_require__(7310); +var URL = url.URL; +var http = __nccwpck_require__(3685); +var https = __nccwpck_require__(5687); +var Writable = (__nccwpck_require__(2781).Writable); +var assert = __nccwpck_require__(9491); +var debug = __nccwpck_require__(1133); + +// Create handlers that pass events from native requests +var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; +var eventHandlers = Object.create(null); +events.forEach(function (event) { + eventHandlers[event] = function (arg1, arg2, arg3) { + this._redirectable.emit(event, arg1, arg2, arg3); + }; +}); + +var InvalidUrlError = createErrorType( + "ERR_INVALID_URL", + "Invalid URL", + TypeError +); +// Error types with codes +var RedirectionError = createErrorType( + "ERR_FR_REDIRECTION_FAILURE", + "Redirected request failed" +); +var TooManyRedirectsError = createErrorType( + "ERR_FR_TOO_MANY_REDIRECTS", + "Maximum number of redirects exceeded" +); +var MaxBodyLengthExceededError = createErrorType( + "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", + "Request body larger than maxBodyLength limit" +); +var WriteAfterEndError = createErrorType( + "ERR_STREAM_WRITE_AFTER_END", + "write after end" +); + +// An HTTP(S) request that can be redirected +function RedirectableRequest(options, responseCallback) { + // Initialize the request + Writable.call(this); + this._sanitizeOptions(options); + this._options = options; + this._ended = false; + this._ending = false; + this._redirectCount = 0; + this._redirects = []; + this._requestBodyLength = 0; + this._requestBodyBuffers = []; + + // Attach a callback if passed + if (responseCallback) { + this.on("response", responseCallback); + } + + // React to responses of native requests + var self = this; + this._onNativeResponse = function (response) { + self._processResponse(response); + }; + + // Perform the first request + this._performRequest(); +} +RedirectableRequest.prototype = Object.create(Writable.prototype); + +RedirectableRequest.prototype.abort = function () { + abortRequest(this._currentRequest); + this.emit("abort"); +}; + +// Writes buffered data to the current native request +RedirectableRequest.prototype.write = function (data, encoding, callback) { + // Writing is not allowed if end has been called + if (this._ending) { + throw new WriteAfterEndError(); + } + + // Validate input and shift parameters if necessary + if (!isString(data) && !isBuffer(data)) { + throw new TypeError("data should be a string, Buffer or Uint8Array"); + } + if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Ignore empty buffers, since writing them doesn't invoke the callback + // https://github.com/nodejs/node/issues/22066 + if (data.length === 0) { + if (callback) { + callback(); + } + return; + } + // Only write when we don't exceed the maximum body length + if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { + this._requestBodyLength += data.length; + this._requestBodyBuffers.push({ data: data, encoding: encoding }); + this._currentRequest.write(data, encoding, callback); + } + // Error when we exceed the maximum body length + else { + this.emit("error", new MaxBodyLengthExceededError()); + this.abort(); + } +}; + +// Ends the current native request +RedirectableRequest.prototype.end = function (data, encoding, callback) { + // Shift parameters if necessary + if (isFunction(data)) { + callback = data; + data = encoding = null; + } + else if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Write data if needed and end + if (!data) { + this._ended = this._ending = true; + this._currentRequest.end(null, null, callback); + } + else { + var self = this; + var currentRequest = this._currentRequest; + this.write(data, encoding, function () { + self._ended = true; + currentRequest.end(null, null, callback); + }); + this._ending = true; + } +}; + +// Sets a header value on the current native request +RedirectableRequest.prototype.setHeader = function (name, value) { + this._options.headers[name] = value; + this._currentRequest.setHeader(name, value); +}; + +// Clears a header value on the current native request +RedirectableRequest.prototype.removeHeader = function (name) { + delete this._options.headers[name]; + this._currentRequest.removeHeader(name); +}; + +// Global timeout for all underlying requests +RedirectableRequest.prototype.setTimeout = function (msecs, callback) { + var self = this; + + // Destroys the socket on timeout + function destroyOnTimeout(socket) { + socket.setTimeout(msecs); + socket.removeListener("timeout", socket.destroy); + socket.addListener("timeout", socket.destroy); + } + + // Sets up a timer to trigger a timeout event + function startTimer(socket) { + if (self._timeout) { + clearTimeout(self._timeout); + } + self._timeout = setTimeout(function () { + self.emit("timeout"); + clearTimer(); + }, msecs); + destroyOnTimeout(socket); + } + + // Stops a timeout from triggering + function clearTimer() { + // Clear the timeout + if (self._timeout) { + clearTimeout(self._timeout); + self._timeout = null; + } + + // Clean up all attached listeners + self.removeListener("abort", clearTimer); + self.removeListener("error", clearTimer); + self.removeListener("response", clearTimer); + if (callback) { + self.removeListener("timeout", callback); + } + if (!self.socket) { + self._currentRequest.removeListener("socket", startTimer); + } + } + + // Attach callback if passed + if (callback) { + this.on("timeout", callback); + } + + // Start the timer if or when the socket is opened + if (this.socket) { + startTimer(this.socket); + } + else { + this._currentRequest.once("socket", startTimer); + } + + // Clean up on events + this.on("socket", destroyOnTimeout); + this.on("abort", clearTimer); + this.on("error", clearTimer); + this.on("response", clearTimer); + + return this; +}; + +// Proxy all other public ClientRequest methods +[ + "flushHeaders", "getHeader", + "setNoDelay", "setSocketKeepAlive", +].forEach(function (method) { + RedirectableRequest.prototype[method] = function (a, b) { + return this._currentRequest[method](a, b); + }; +}); + +// Proxy all public ClientRequest properties +["aborted", "connection", "socket"].forEach(function (property) { + Object.defineProperty(RedirectableRequest.prototype, property, { + get: function () { return this._currentRequest[property]; }, + }); +}); + +RedirectableRequest.prototype._sanitizeOptions = function (options) { + // Ensure headers are always present + if (!options.headers) { + options.headers = {}; + } + + // Since http.request treats host as an alias of hostname, + // but the url module interprets host as hostname plus port, + // eliminate the host property to avoid confusion. + if (options.host) { + // Use hostname if set, because it has precedence + if (!options.hostname) { + options.hostname = options.host; + } + delete options.host; + } + + // Complete the URL object when necessary + if (!options.pathname && options.path) { + var searchPos = options.path.indexOf("?"); + if (searchPos < 0) { + options.pathname = options.path; + } + else { + options.pathname = options.path.substring(0, searchPos); + options.search = options.path.substring(searchPos); + } + } +}; + + +// Executes the next native request (initial or redirect) +RedirectableRequest.prototype._performRequest = function () { + // Load the native protocol + var protocol = this._options.protocol; + var nativeProtocol = this._options.nativeProtocols[protocol]; + if (!nativeProtocol) { + this.emit("error", new TypeError("Unsupported protocol " + protocol)); + return; + } + + // If specified, use the agent corresponding to the protocol + // (HTTP and HTTPS use different types of agents) + if (this._options.agents) { + var scheme = protocol.slice(0, -1); + this._options.agent = this._options.agents[scheme]; + } + + // Create the native request and set up its event handlers + var request = this._currentRequest = + nativeProtocol.request(this._options, this._onNativeResponse); + request._redirectable = this; + for (var event of events) { + request.on(event, eventHandlers[event]); + } + + // RFC7230§5.3.1: When making a request directly to an origin server, […] + // a client MUST send only the absolute path […] as the request-target. + this._currentUrl = /^\//.test(this._options.path) ? + url.format(this._options) : + // When making a request to a proxy, […] + // a client MUST send the target URI in absolute-form […]. + this._options.path; + + // End a redirected request + // (The first request must be ended explicitly with RedirectableRequest#end) + if (this._isRedirect) { + // Write the request entity and end + var i = 0; + var self = this; + var buffers = this._requestBodyBuffers; + (function writeNext(error) { + // Only write if this request has not been redirected yet + /* istanbul ignore else */ + if (request === self._currentRequest) { + // Report any write errors + /* istanbul ignore if */ + if (error) { + self.emit("error", error); + } + // Write the next buffer if there are still left + else if (i < buffers.length) { + var buffer = buffers[i++]; + /* istanbul ignore else */ + if (!request.finished) { + request.write(buffer.data, buffer.encoding, writeNext); + } + } + // End the request if `end` has been called on us + else if (self._ended) { + request.end(); + } + } + }()); + } +}; + +// Processes a response from the current native request +RedirectableRequest.prototype._processResponse = function (response) { + // Store the redirected response + var statusCode = response.statusCode; + if (this._options.trackRedirects) { + this._redirects.push({ + url: this._currentUrl, + headers: response.headers, + statusCode: statusCode, + }); + } + + // RFC7231§6.4: The 3xx (Redirection) class of status code indicates + // that further action needs to be taken by the user agent in order to + // fulfill the request. If a Location header field is provided, + // the user agent MAY automatically redirect its request to the URI + // referenced by the Location field value, + // even if the specific status code is not understood. + + // If the response is not a redirect; return it as-is + var location = response.headers.location; + if (!location || this._options.followRedirects === false || + statusCode < 300 || statusCode >= 400) { + response.responseUrl = this._currentUrl; + response.redirects = this._redirects; + this.emit("response", response); + + // Clean up + this._requestBodyBuffers = []; + return; + } + + // The response is a redirect, so abort the current request + abortRequest(this._currentRequest); + // Discard the remainder of the response to avoid waiting for data + response.destroy(); + + // RFC7231§6.4: A client SHOULD detect and intervene + // in cyclical redirections (i.e., "infinite" redirection loops). + if (++this._redirectCount > this._options.maxRedirects) { + this.emit("error", new TooManyRedirectsError()); + return; + } + + // Store the request headers if applicable + var requestHeaders; + var beforeRedirect = this._options.beforeRedirect; + if (beforeRedirect) { + requestHeaders = Object.assign({ + // The Host header was set by nativeProtocol.request + Host: response.req.getHeader("host"), + }, this._options.headers); + } + + // RFC7231§6.4: Automatic redirection needs to done with + // care for methods not known to be safe, […] + // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change + // the request method from POST to GET for the subsequent request. + var method = this._options.method; + if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || + // RFC7231§6.4.4: The 303 (See Other) status code indicates that + // the server is redirecting the user agent to a different resource […] + // A user agent can perform a retrieval request targeting that URI + // (a GET or HEAD request if using HTTP) […] + (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { + this._options.method = "GET"; + // Drop a possible entity and headers related to it + this._requestBodyBuffers = []; + removeMatchingHeaders(/^content-/i, this._options.headers); + } + + // Drop the Host header, as the redirect might lead to a different host + var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers); + + // If the redirect is relative, carry over the host of the last request + var currentUrlParts = url.parse(this._currentUrl); + var currentHost = currentHostHeader || currentUrlParts.host; + var currentUrl = /^\w+:/.test(location) ? this._currentUrl : + url.format(Object.assign(currentUrlParts, { host: currentHost })); + + // Determine the URL of the redirection + var redirectUrl; + try { + redirectUrl = url.resolve(currentUrl, location); + } + catch (cause) { + this.emit("error", new RedirectionError({ cause: cause })); + return; + } + + // Create the redirected request + debug("redirecting to", redirectUrl); + this._isRedirect = true; + var redirectUrlParts = url.parse(redirectUrl); + Object.assign(this._options, redirectUrlParts); + + // Drop confidential headers when redirecting to a less secure protocol + // or to a different domain that is not a superdomain + if (redirectUrlParts.protocol !== currentUrlParts.protocol && + redirectUrlParts.protocol !== "https:" || + redirectUrlParts.host !== currentHost && + !isSubdomain(redirectUrlParts.host, currentHost)) { + removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers); + } + + // Evaluate the beforeRedirect callback + if (isFunction(beforeRedirect)) { + var responseDetails = { + headers: response.headers, + statusCode: statusCode, + }; + var requestDetails = { + url: currentUrl, + method: method, + headers: requestHeaders, + }; + try { + beforeRedirect(this._options, responseDetails, requestDetails); + } + catch (err) { + this.emit("error", err); + return; + } + this._sanitizeOptions(this._options); + } + + // Perform the redirected request + try { + this._performRequest(); + } + catch (cause) { + this.emit("error", new RedirectionError({ cause: cause })); + } +}; + +// Wraps the key/value object of protocols with redirect functionality +function wrap(protocols) { + // Default settings + var exports = { + maxRedirects: 21, + maxBodyLength: 10 * 1024 * 1024, + }; + + // Wrap each protocol + var nativeProtocols = {}; + Object.keys(protocols).forEach(function (scheme) { + var protocol = scheme + ":"; + var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; + var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); + + // Executes a request, following redirects + function request(input, options, callback) { + // Parse parameters + if (isString(input)) { + var parsed; + try { + parsed = urlToOptions(new URL(input)); + } + catch (err) { + /* istanbul ignore next */ + parsed = url.parse(input); + } + if (!isString(parsed.protocol)) { + throw new InvalidUrlError({ input }); + } + input = parsed; + } + else if (URL && (input instanceof URL)) { + input = urlToOptions(input); + } + else { + callback = options; + options = input; + input = { protocol: protocol }; + } + if (isFunction(options)) { + callback = options; + options = null; + } + + // Set defaults + options = Object.assign({ + maxRedirects: exports.maxRedirects, + maxBodyLength: exports.maxBodyLength, + }, input, options); + options.nativeProtocols = nativeProtocols; + if (!isString(options.host) && !isString(options.hostname)) { + options.hostname = "::1"; + } + + assert.equal(options.protocol, protocol, "protocol mismatch"); + debug("options", options); + return new RedirectableRequest(options, callback); + } + + // Executes a GET request, following redirects + function get(input, options, callback) { + var wrappedRequest = wrappedProtocol.request(input, options, callback); + wrappedRequest.end(); + return wrappedRequest; + } + + // Expose the properties on the wrapped protocol + Object.defineProperties(wrappedProtocol, { + request: { value: request, configurable: true, enumerable: true, writable: true }, + get: { value: get, configurable: true, enumerable: true, writable: true }, + }); + }); + return exports; +} + +/* istanbul ignore next */ +function noop() { /* empty */ } + +// from https://github.com/nodejs/node/blob/master/lib/internal/url.js +function urlToOptions(urlObject) { + var options = { + protocol: urlObject.protocol, + hostname: urlObject.hostname.startsWith("[") ? + /* istanbul ignore next */ + urlObject.hostname.slice(1, -1) : + urlObject.hostname, + hash: urlObject.hash, + search: urlObject.search, + pathname: urlObject.pathname, + path: urlObject.pathname + urlObject.search, + href: urlObject.href, + }; + if (urlObject.port !== "") { + options.port = Number(urlObject.port); + } + return options; +} + +function removeMatchingHeaders(regex, headers) { + var lastValue; + for (var header in headers) { + if (regex.test(header)) { + lastValue = headers[header]; + delete headers[header]; + } + } + return (lastValue === null || typeof lastValue === "undefined") ? + undefined : String(lastValue).trim(); +} + +function createErrorType(code, message, baseClass) { + // Create constructor + function CustomError(properties) { + Error.captureStackTrace(this, this.constructor); + Object.assign(this, properties || {}); + this.code = code; + this.message = this.cause ? message + ": " + this.cause.message : message; + } + + // Attach constructor and set default properties + CustomError.prototype = new (baseClass || Error)(); + CustomError.prototype.constructor = CustomError; + CustomError.prototype.name = "Error [" + code + "]"; + return CustomError; +} + +function abortRequest(request) { + for (var event of events) { + request.removeListener(event, eventHandlers[event]); + } + request.on("error", noop); + request.abort(); +} + +function isSubdomain(subdomain, domain) { + assert(isString(subdomain) && isString(domain)); + var dot = subdomain.length - domain.length - 1; + return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); +} + +function isString(value) { + return typeof value === "string" || value instanceof String; +} + +function isFunction(value) { + return typeof value === "function"; +} + +function isBuffer(value) { + return typeof value === "object" && ("length" in value); +} + +// Exports +module.exports = wrap({ http: http, https: https }); +module.exports.wrap = wrap; + + +/***/ }), + +/***/ 4334: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var CombinedStream = __nccwpck_require__(5443); +var util = __nccwpck_require__(3837); +var path = __nccwpck_require__(1017); +var http = __nccwpck_require__(3685); +var https = __nccwpck_require__(5687); +var parseUrl = (__nccwpck_require__(7310).parse); +var fs = __nccwpck_require__(7147); +var Stream = (__nccwpck_require__(2781).Stream); +var mime = __nccwpck_require__(3583); +var asynckit = __nccwpck_require__(4812); +var populate = __nccwpck_require__(7142); + +// Public API +module.exports = FormData; + +// make it a Stream +util.inherits(FormData, CombinedStream); + +/** + * Create readable "multipart/form-data" streams. + * Can be used to submit forms + * and file uploads to other web applications. + * + * @constructor + * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream + */ +function FormData(options) { + if (!(this instanceof FormData)) { + return new FormData(options); + } + + this._overheadLength = 0; + this._valueLength = 0; + this._valuesToMeasure = []; + + CombinedStream.call(this); + + options = options || {}; + for (var option in options) { + this[option] = options[option]; + } +} + +FormData.LINE_BREAK = '\r\n'; +FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream'; + +FormData.prototype.append = function(field, value, options) { + + options = options || {}; + + // allow filename as single option + if (typeof options == 'string') { + options = {filename: options}; + } + + var append = CombinedStream.prototype.append.bind(this); + + // all that streamy business can't handle numbers + if (typeof value == 'number') { + value = '' + value; + } + + // https://github.com/felixge/node-form-data/issues/38 + if (util.isArray(value)) { + // Please convert your array into string + // the way web server expects it + this._error(new Error('Arrays are not supported.')); + return; + } + + var header = this._multiPartHeader(field, value, options); + var footer = this._multiPartFooter(); + + append(header); + append(value); + append(footer); + + // pass along options.knownLength + this._trackLength(header, value, options); +}; + +FormData.prototype._trackLength = function(header, value, options) { + var valueLength = 0; + + // used w/ getLengthSync(), when length is known. + // e.g. for streaming directly from a remote server, + // w/ a known file a size, and not wanting to wait for + // incoming file to finish to get its size. + if (options.knownLength != null) { + valueLength += +options.knownLength; + } else if (Buffer.isBuffer(value)) { + valueLength = value.length; + } else if (typeof value === 'string') { + valueLength = Buffer.byteLength(value); + } + + this._valueLength += valueLength; + + // @check why add CRLF? does this account for custom/multiple CRLFs? + this._overheadLength += + Buffer.byteLength(header) + + FormData.LINE_BREAK.length; + + // empty or either doesn't have path or not an http response or not a stream + if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream))) { + return; + } + + // no need to bother with the length + if (!options.knownLength) { + this._valuesToMeasure.push(value); + } +}; + +FormData.prototype._lengthRetriever = function(value, callback) { + + if (value.hasOwnProperty('fd')) { + + // take read range into a account + // `end` = Infinity –> read file till the end + // + // TODO: Looks like there is bug in Node fs.createReadStream + // it doesn't respect `end` options without `start` options + // Fix it when node fixes it. + // https://github.com/joyent/node/issues/7819 + if (value.end != undefined && value.end != Infinity && value.start != undefined) { + + // when end specified + // no need to calculate range + // inclusive, starts with 0 + callback(null, value.end + 1 - (value.start ? value.start : 0)); + + // not that fast snoopy + } else { + // still need to fetch file size from fs + fs.stat(value.path, function(err, stat) { + + var fileSize; + + if (err) { + callback(err); + return; + } + + // update final size based on the range options + fileSize = stat.size - (value.start ? value.start : 0); + callback(null, fileSize); + }); + } + + // or http response + } else if (value.hasOwnProperty('httpVersion')) { + callback(null, +value.headers['content-length']); + + // or request stream http://github.com/mikeal/request + } else if (value.hasOwnProperty('httpModule')) { + // wait till response come back + value.on('response', function(response) { + value.pause(); + callback(null, +response.headers['content-length']); + }); + value.resume(); + + // something else + } else { + callback('Unknown stream'); + } +}; + +FormData.prototype._multiPartHeader = function(field, value, options) { + // custom header specified (as string)? + // it becomes responsible for boundary + // (e.g. to handle extra CRLFs on .NET servers) + if (typeof options.header == 'string') { + return options.header; + } + + var contentDisposition = this._getContentDisposition(value, options); + var contentType = this._getContentType(value, options); + + var contents = ''; + var headers = { + // add custom disposition as third element or keep it two elements if not + 'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []), + // if no content type. allow it to be empty array + 'Content-Type': [].concat(contentType || []) + }; + + // allow custom headers. + if (typeof options.header == 'object') { + populate(headers, options.header); + } + + var header; + for (var prop in headers) { + if (!headers.hasOwnProperty(prop)) continue; + header = headers[prop]; + + // skip nullish headers. + if (header == null) { + continue; + } + + // convert all headers to arrays. + if (!Array.isArray(header)) { + header = [header]; + } + + // add non-empty headers. + if (header.length) { + contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK; + } + } + + return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; +}; + +FormData.prototype._getContentDisposition = function(value, options) { + + var filename + , contentDisposition + ; + + if (typeof options.filepath === 'string') { + // custom filepath for relative paths + filename = path.normalize(options.filepath).replace(/\\/g, '/'); + } else if (options.filename || value.name || value.path) { + // custom filename take precedence + // formidable and the browser add a name property + // fs- and request- streams have path property + filename = path.basename(options.filename || value.name || value.path); + } else if (value.readable && value.hasOwnProperty('httpVersion')) { + // or try http response + filename = path.basename(value.client._httpMessage.path || ''); + } + + if (filename) { + contentDisposition = 'filename="' + filename + '"'; + } + + return contentDisposition; +}; + +FormData.prototype._getContentType = function(value, options) { + + // use custom content-type above all + var contentType = options.contentType; + + // or try `name` from formidable, browser + if (!contentType && value.name) { + contentType = mime.lookup(value.name); + } + + // or try `path` from fs-, request- streams + if (!contentType && value.path) { + contentType = mime.lookup(value.path); + } + + // or if it's http-reponse + if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) { + contentType = value.headers['content-type']; + } + + // or guess it from the filepath or filename + if (!contentType && (options.filepath || options.filename)) { + contentType = mime.lookup(options.filepath || options.filename); + } + + // fallback to the default content type if `value` is not simple value + if (!contentType && typeof value == 'object') { + contentType = FormData.DEFAULT_CONTENT_TYPE; + } + + return contentType; +}; + +FormData.prototype._multiPartFooter = function() { + return function(next) { + var footer = FormData.LINE_BREAK; + + var lastPart = (this._streams.length === 0); + if (lastPart) { + footer += this._lastBoundary(); + } + + next(footer); + }.bind(this); +}; + +FormData.prototype._lastBoundary = function() { + return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK; +}; + +FormData.prototype.getHeaders = function(userHeaders) { + var header; + var formHeaders = { + 'content-type': 'multipart/form-data; boundary=' + this.getBoundary() + }; + + for (header in userHeaders) { + if (userHeaders.hasOwnProperty(header)) { + formHeaders[header.toLowerCase()] = userHeaders[header]; + } + } + + return formHeaders; +}; + +FormData.prototype.setBoundary = function(boundary) { + this._boundary = boundary; +}; + +FormData.prototype.getBoundary = function() { + if (!this._boundary) { + this._generateBoundary(); + } + + return this._boundary; +}; + +FormData.prototype.getBuffer = function() { + var dataBuffer = new Buffer.alloc( 0 ); + var boundary = this.getBoundary(); + + // Create the form content. Add Line breaks to the end of data. + for (var i = 0, len = this._streams.length; i < len; i++) { + if (typeof this._streams[i] !== 'function') { + + // Add content to the buffer. + if(Buffer.isBuffer(this._streams[i])) { + dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]); + }else { + dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]); + } + + // Add break after content. + if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) { + dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] ); + } + } + } + + // Add the footer and return the Buffer object. + return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] ); +}; + +FormData.prototype._generateBoundary = function() { + // This generates a 50 character boundary similar to those used by Firefox. + // They are optimized for boyer-moore parsing. + var boundary = '--------------------------'; + for (var i = 0; i < 24; i++) { + boundary += Math.floor(Math.random() * 10).toString(16); + } + + this._boundary = boundary; +}; + +// Note: getLengthSync DOESN'T calculate streams length +// As workaround one can calculate file size manually +// and add it as knownLength option +FormData.prototype.getLengthSync = function() { + var knownLength = this._overheadLength + this._valueLength; + + // Don't get confused, there are 3 "internal" streams for each keyval pair + // so it basically checks if there is any value added to the form + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + + // https://github.com/form-data/form-data/issues/40 + if (!this.hasKnownLength()) { + // Some async length retrievers are present + // therefore synchronous length calculation is false. + // Please use getLength(callback) to get proper length + this._error(new Error('Cannot calculate proper length in synchronous way.')); + } + + return knownLength; +}; + +// Public API to check if length of added values is known +// https://github.com/form-data/form-data/issues/196 +// https://github.com/form-data/form-data/issues/262 +FormData.prototype.hasKnownLength = function() { + var hasKnownLength = true; + + if (this._valuesToMeasure.length) { + hasKnownLength = false; + } + + return hasKnownLength; +}; + +FormData.prototype.getLength = function(cb) { + var knownLength = this._overheadLength + this._valueLength; + + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + + if (!this._valuesToMeasure.length) { + process.nextTick(cb.bind(this, null, knownLength)); + return; + } + + asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) { + if (err) { + cb(err); + return; + } + + values.forEach(function(length) { + knownLength += length; + }); + + cb(null, knownLength); + }); +}; + +FormData.prototype.submit = function(params, cb) { + var request + , options + , defaults = {method: 'post'} + ; + + // parse provided url if it's string + // or treat it as options object + if (typeof params == 'string') { + + params = parseUrl(params); + options = populate({ + port: params.port, + path: params.pathname, + host: params.hostname, + protocol: params.protocol + }, defaults); + + // use custom params + } else { + + options = populate(params, defaults); + // if no port provided use default one + if (!options.port) { + options.port = options.protocol == 'https:' ? 443 : 80; + } + } + + // put that good code in getHeaders to some use + options.headers = this.getHeaders(params.headers); + + // https if specified, fallback to http in any other case + if (options.protocol == 'https:') { + request = https.request(options); + } else { + request = http.request(options); + } + + // get content length and fire away + this.getLength(function(err, length) { + if (err && err !== 'Unknown stream') { + this._error(err); + return; + } + + // add content length + if (length) { + request.setHeader('Content-Length', length); + } + + this.pipe(request); + if (cb) { + var onResponse; + + var callback = function (error, responce) { + request.removeListener('error', callback); + request.removeListener('response', onResponse); + + return cb.call(this, error, responce); + }; + + onResponse = callback.bind(this, null); + + request.on('error', callback); + request.on('response', onResponse); + } + }.bind(this)); + + return request; +}; + +FormData.prototype._error = function(err) { + if (!this.error) { + this.error = err; + this.pause(); + this.emit('error', err); + } +}; + +FormData.prototype.toString = function () { + return '[object FormData]'; +}; + + +/***/ }), + +/***/ 7142: +/***/ ((module) => { + +// populates missing values +module.exports = function(dst, src) { + + Object.keys(src).forEach(function(prop) + { + dst[prop] = dst[prop] || src[prop]; + }); + + return dst; +}; + + +/***/ }), + +/***/ 1621: +/***/ ((module) => { + +"use strict"; + + +module.exports = (flag, argv = process.argv) => { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +}; + + +/***/ }), + +/***/ 7426: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/*! + * mime-db + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Module exports. + */ + +module.exports = __nccwpck_require__(3765) + + +/***/ }), + +/***/ 3583: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; +/*! + * mime-types + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module dependencies. + * @private + */ + +var db = __nccwpck_require__(7426) +var extname = (__nccwpck_require__(1017).extname) + +/** + * Module variables. + * @private + */ + +var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ +var TEXT_TYPE_REGEXP = /^text\//i + +/** + * Module exports. + * @public + */ + +exports.charset = charset +exports.charsets = { lookup: charset } +exports.contentType = contentType +exports.extension = extension +exports.extensions = Object.create(null) +exports.lookup = lookup +exports.types = Object.create(null) + +// Populate the extensions/types maps +populateMaps(exports.extensions, exports.types) + +/** + * Get the default charset for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function charset (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + var mime = match && db[match[1].toLowerCase()] + + if (mime && mime.charset) { + return mime.charset + } + + // default text/* to utf-8 + if (match && TEXT_TYPE_REGEXP.test(match[1])) { + return 'UTF-8' + } + + return false +} + +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} str + * @return {boolean|string} + */ + +function contentType (str) { + // TODO: should this even be in this module? + if (!str || typeof str !== 'string') { + return false + } + + var mime = str.indexOf('/') === -1 + ? exports.lookup(str) + : str + + if (!mime) { + return false + } + + // TODO: use content-type or other module + if (mime.indexOf('charset') === -1) { + var charset = exports.charset(mime) + if (charset) mime += '; charset=' + charset.toLowerCase() + } + + return mime +} + +/** + * Get the default extension for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function extension (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + + // get extensions + var exts = match && exports.extensions[match[1].toLowerCase()] + + if (!exts || !exts.length) { + return false + } + + return exts[0] +} + +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {boolean|string} + */ + +function lookup (path) { + if (!path || typeof path !== 'string') { + return false + } + + // get the extension ("ext" or ".ext" or full path) + var extension = extname('x.' + path) + .toLowerCase() + .substr(1) + + if (!extension) { + return false + } + + return exports.types[extension] || false +} + +/** + * Populate the extensions and types maps. + * @private + */ + +function populateMaps (extensions, types) { + // source preference (least -> most) + var preference = ['nginx', 'apache', undefined, 'iana'] + + Object.keys(db).forEach(function forEachMimeType (type) { + var mime = db[type] + var exts = mime.extensions + + if (!exts || !exts.length) { + return + } + + // mime -> extensions + extensions[type] = exts + + // extension -> mime + for (var i = 0; i < exts.length; i++) { + var extension = exts[i] + + if (types[extension]) { + var from = preference.indexOf(db[types[extension]].source) + var to = preference.indexOf(mime.source) + + if (types[extension] !== 'application/octet-stream' && + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { + // skip the remapping + continue + } + } + + // set the extension -> mime + types[extension] = type + } + }) +} + + +/***/ }), + +/***/ 900: +/***/ ((module) => { + +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} + + +/***/ }), + +/***/ 3329: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +var parseUrl = (__nccwpck_require__(7310).parse); + +var DEFAULT_PORTS = { + ftp: 21, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443, +}; + +var stringEndsWith = String.prototype.endsWith || function(s) { + return s.length <= this.length && + this.indexOf(s, this.length - s.length) !== -1; +}; + +/** + * @param {string|object} url - The URL, or the result from url.parse. + * @return {string} The URL of the proxy that should handle the request to the + * given URL. If no proxy is set, this will be an empty string. + */ +function getProxyForUrl(url) { + var parsedUrl = typeof url === 'string' ? parseUrl(url) : url || {}; + var proto = parsedUrl.protocol; + var hostname = parsedUrl.host; + var port = parsedUrl.port; + if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') { + return ''; // Don't proxy URLs without a valid scheme or host. + } + + proto = proto.split(':', 1)[0]; + // Stripping ports in this way instead of using parsedUrl.hostname to make + // sure that the brackets around IPv6 addresses are kept. + hostname = hostname.replace(/:\d*$/, ''); + port = parseInt(port) || DEFAULT_PORTS[proto] || 0; + if (!shouldProxy(hostname, port)) { + return ''; // Don't proxy URLs that match NO_PROXY. + } + + var proxy = + getEnv('npm_config_' + proto + '_proxy') || + getEnv(proto + '_proxy') || + getEnv('npm_config_proxy') || + getEnv('all_proxy'); + if (proxy && proxy.indexOf('://') === -1) { + // Missing scheme in proxy, default to the requested URL's scheme. + proxy = proto + '://' + proxy; + } + return proxy; +} + +/** + * Determines whether a given URL should be proxied. + * + * @param {string} hostname - The host name of the URL. + * @param {number} port - The effective port of the URL. + * @returns {boolean} Whether the given URL should be proxied. + * @private + */ +function shouldProxy(hostname, port) { + var NO_PROXY = + (getEnv('npm_config_no_proxy') || getEnv('no_proxy')).toLowerCase(); + if (!NO_PROXY) { + return true; // Always proxy if NO_PROXY is not set. + } + if (NO_PROXY === '*') { + return false; // Never proxy if wildcard is set. + } + + return NO_PROXY.split(/[,\s]/).every(function(proxy) { + if (!proxy) { + return true; // Skip zero-length hosts. + } + var parsedProxy = proxy.match(/^(.+):(\d+)$/); + var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy; + var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0; + if (parsedProxyPort && parsedProxyPort !== port) { + return true; // Skip if ports don't match. + } + + if (!/^[.*]/.test(parsedProxyHostname)) { + // No wildcards, so stop proxying if there is an exact match. + return hostname !== parsedProxyHostname; + } + + if (parsedProxyHostname.charAt(0) === '*') { + // Remove leading wildcard. + parsedProxyHostname = parsedProxyHostname.slice(1); + } + // Stop proxying if the hostname ends with the no_proxy host. + return !stringEndsWith.call(hostname, parsedProxyHostname); + }); +} + +/** + * Get the value for an environment variable. + * + * @param {string} key - The name of the environment variable. + * @return {string} The value of the environment variable. + * @private + */ +function getEnv(key) { + return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || ''; +} + +exports.getProxyForUrl = getProxyForUrl; + + +/***/ }), + +/***/ 9318: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const os = __nccwpck_require__(2037); +const tty = __nccwpck_require__(6224); +const hasFlag = __nccwpck_require__(1621); + +const {env} = process; + +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false') || + hasFlag('color=never')) { + forceColor = 0; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = 1; +} + +if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + forceColor = 1; + } else if (env.FORCE_COLOR === 'false') { + forceColor = 0; + } else { + forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); + } +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { + return 0; + } + + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } + + const min = forceColor || 0; + + if (env.TERM === 'dumb') { + return min; + } + + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + return min; +} + +function getSupportLevel(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) +}; + + +/***/ }), + +/***/ 4294: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = __nccwpck_require__(4219); + + +/***/ }), + +/***/ 4219: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +var net = __nccwpck_require__(1808); +var tls = __nccwpck_require__(4404); +var http = __nccwpck_require__(3685); +var https = __nccwpck_require__(5687); +var events = __nccwpck_require__(2361); +var assert = __nccwpck_require__(9491); +var util = __nccwpck_require__(3837); + + +exports.httpOverHttp = httpOverHttp; +exports.httpsOverHttp = httpsOverHttp; +exports.httpOverHttps = httpOverHttps; +exports.httpsOverHttps = httpsOverHttps; + + +function httpOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + return agent; +} + +function httpsOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} + +function httpOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + return agent; +} + +function httpsOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} + + +function TunnelingAgent(options) { + var self = this; + self.options = options || {}; + self.proxyOptions = self.options.proxy || {}; + self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; + self.requests = []; + self.sockets = []; + + self.on('free', function onFree(socket, host, port, localAddress) { + var options = toOptions(host, port, localAddress); + for (var i = 0, len = self.requests.length; i < len; ++i) { + var pending = self.requests[i]; + if (pending.host === options.host && pending.port === options.port) { + // Detect the request to connect same origin server, + // reuse the connection. + self.requests.splice(i, 1); + pending.request.onSocket(socket); + return; + } + } + socket.destroy(); + self.removeSocket(socket); + }); +} +util.inherits(TunnelingAgent, events.EventEmitter); + +TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { + var self = this; + var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); + + if (self.sockets.length >= this.maxSockets) { + // We are over limit so we'll add it to the queue. + self.requests.push(options); + return; + } + + // If we are under maxSockets create a new one. + self.createSocket(options, function(socket) { + socket.on('free', onFree); + socket.on('close', onCloseOrRemove); + socket.on('agentRemove', onCloseOrRemove); + req.onSocket(socket); + + function onFree() { + self.emit('free', socket, options); + } + + function onCloseOrRemove(err) { + self.removeSocket(socket); + socket.removeListener('free', onFree); + socket.removeListener('close', onCloseOrRemove); + socket.removeListener('agentRemove', onCloseOrRemove); + } + }); +}; + +TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { + var self = this; + var placeholder = {}; + self.sockets.push(placeholder); + + var connectOptions = mergeOptions({}, self.proxyOptions, { + method: 'CONNECT', + path: options.host + ':' + options.port, + agent: false, + headers: { + host: options.host + ':' + options.port + } + }); + if (options.localAddress) { + connectOptions.localAddress = options.localAddress; + } + if (connectOptions.proxyAuth) { + connectOptions.headers = connectOptions.headers || {}; + connectOptions.headers['Proxy-Authorization'] = 'Basic ' + + new Buffer(connectOptions.proxyAuth).toString('base64'); + } + + debug('making CONNECT request'); + var connectReq = self.request(connectOptions); + connectReq.useChunkedEncodingByDefault = false; // for v0.6 + connectReq.once('response', onResponse); // for v0.6 + connectReq.once('upgrade', onUpgrade); // for v0.6 + connectReq.once('connect', onConnect); // for v0.7 or later + connectReq.once('error', onError); + connectReq.end(); + + function onResponse(res) { + // Very hacky. This is necessary to avoid http-parser leaks. + res.upgrade = true; + } + + function onUpgrade(res, socket, head) { + // Hacky. + process.nextTick(function() { + onConnect(res, socket, head); + }); + } + + function onConnect(res, socket, head) { + connectReq.removeAllListeners(); + socket.removeAllListeners(); + + if (res.statusCode !== 200) { + debug('tunneling socket could not be established, statusCode=%d', + res.statusCode); + socket.destroy(); + var error = new Error('tunneling socket could not be established, ' + + 'statusCode=' + res.statusCode); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + if (head.length > 0) { + debug('got illegal response body from proxy'); + socket.destroy(); + var error = new Error('got illegal response body from proxy'); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + debug('tunneling connection has established'); + self.sockets[self.sockets.indexOf(placeholder)] = socket; + return cb(socket); + } + + function onError(cause) { + connectReq.removeAllListeners(); + + debug('tunneling socket could not be established, cause=%s\n', + cause.message, cause.stack); + var error = new Error('tunneling socket could not be established, ' + + 'cause=' + cause.message); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + } +}; + +TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { + var pos = this.sockets.indexOf(socket) + if (pos === -1) { + return; + } + this.sockets.splice(pos, 1); + + var pending = this.requests.shift(); + if (pending) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createSocket(pending, function(socket) { + pending.request.onSocket(socket); + }); + } +}; + +function createSecureSocket(options, cb) { + var self = this; + TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { + var hostHeader = options.request.getHeader('host'); + var tlsOptions = mergeOptions({}, self.options, { + socket: socket, + servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host + }); + + // 0 is dummy port for v0.6 + var secureSocket = tls.connect(0, tlsOptions); + self.sockets[self.sockets.indexOf(socket)] = secureSocket; + cb(secureSocket); + }); +} + + +function toOptions(host, port, localAddress) { + if (typeof host === 'string') { // since v0.10 + return { + host: host, + port: port, + localAddress: localAddress + }; + } + return host; // for v0.11 or later +} + +function mergeOptions(target) { + for (var i = 1, len = arguments.length; i < len; ++i) { + var overrides = arguments[i]; + if (typeof overrides === 'object') { + var keys = Object.keys(overrides); + for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { + var k = keys[j]; + if (overrides[k] !== undefined) { + target[k] = overrides[k]; + } + } + } + } + return target; +} + + +var debug; +if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { + debug = function() { + var args = Array.prototype.slice.call(arguments); + if (typeof args[0] === 'string') { + args[0] = 'TUNNEL: ' + args[0]; + } else { + args.unshift('TUNNEL:'); + } + console.error.apply(console, args); + } +} else { + debug = function() {}; +} +exports.debug = debug; // for test + + +/***/ }), + +/***/ 5840: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "v1", ({ + enumerable: true, + get: function () { + return _v.default; + } +})); +Object.defineProperty(exports, "v3", ({ + enumerable: true, + get: function () { + return _v2.default; + } +})); +Object.defineProperty(exports, "v4", ({ + enumerable: true, + get: function () { + return _v3.default; + } +})); +Object.defineProperty(exports, "v5", ({ + enumerable: true, + get: function () { + return _v4.default; + } +})); +Object.defineProperty(exports, "NIL", ({ + enumerable: true, + get: function () { + return _nil.default; + } +})); +Object.defineProperty(exports, "version", ({ + enumerable: true, + get: function () { + return _version.default; + } +})); +Object.defineProperty(exports, "validate", ({ + enumerable: true, + get: function () { + return _validate.default; + } +})); +Object.defineProperty(exports, "stringify", ({ + enumerable: true, + get: function () { + return _stringify.default; + } +})); +Object.defineProperty(exports, "parse", ({ + enumerable: true, + get: function () { + return _parse.default; + } +})); + +var _v = _interopRequireDefault(__nccwpck_require__(8628)); + +var _v2 = _interopRequireDefault(__nccwpck_require__(6409)); + +var _v3 = _interopRequireDefault(__nccwpck_require__(5122)); + +var _v4 = _interopRequireDefault(__nccwpck_require__(9120)); + +var _nil = _interopRequireDefault(__nccwpck_require__(5332)); + +var _version = _interopRequireDefault(__nccwpck_require__(1595)); + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +var _parse = _interopRequireDefault(__nccwpck_require__(2746)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/***/ }), + +/***/ 4569: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('md5').update(bytes).digest(); +} + +var _default = md5; +exports["default"] = _default; + +/***/ }), + +/***/ 5332: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports["default"] = _default; + +/***/ }), + +/***/ 2746: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function parse(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ + + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ + + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ + + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ + + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) + + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} + +var _default = parse; +exports["default"] = _default; + +/***/ }), + +/***/ 814: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; +exports["default"] = _default; + +/***/ }), + +/***/ 807: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = rng; + +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + +let poolPtr = rnds8Pool.length; + +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); + + poolPtr = 0; + } + + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} + +/***/ }), + +/***/ 5274: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('sha1').update(bytes).digest(); +} + +var _default = sha1; +exports["default"] = _default; + +/***/ }), + +/***/ 8950: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +const byteToHex = []; + +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).substr(1)); +} + +function stringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!(0, _validate.default)(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +var _default = stringify; +exports["default"] = _default; + +/***/ }), + +/***/ 8628: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _rng = _interopRequireDefault(__nccwpck_require__(807)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html +let _nodeId; + +let _clockseq; // Previous uuid creation time + + +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || _rng.default)(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + + + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + + + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested + + + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + msecs += 12219292800000; // `time_low` + + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` + + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + + b[i++] = clockseq & 0xff; // `node` + + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf || (0, _stringify.default)(b); +} + +var _default = v1; +exports["default"] = _default; + +/***/ }), + +/***/ 6409: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _v = _interopRequireDefault(__nccwpck_require__(5998)); + +var _md = _interopRequireDefault(__nccwpck_require__(4569)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v3 = (0, _v.default)('v3', 0x30, _md.default); +var _default = v3; +exports["default"] = _default; + +/***/ }), + +/***/ 5998: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = _default; +exports.URL = exports.DNS = void 0; + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +var _parse = _interopRequireDefault(__nccwpck_require__(2746)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape + + const bytes = []; + + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + + return bytes; +} + +const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +exports.DNS = DNS; +const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +exports.URL = URL; + +function _default(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + if (typeof value === 'string') { + value = stringToBytes(value); + } + + if (typeof namespace === 'string') { + namespace = (0, _parse.default)(namespace); + } + + if (namespace.length !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` + + + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + + return buf; + } + + return (0, _stringify.default)(bytes); + } // Function#name is not settable on some platforms (#270) + + + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} + +/***/ }), + +/***/ 5122: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _rng = _interopRequireDefault(__nccwpck_require__(807)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function v4(options, buf, offset) { + options = options || {}; + + const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; + } + + return (0, _stringify.default)(rnds); +} + +var _default = v4; +exports["default"] = _default; + +/***/ }), + +/***/ 9120: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _v = _interopRequireDefault(__nccwpck_require__(5998)); + +var _sha = _interopRequireDefault(__nccwpck_require__(5274)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v5 = (0, _v.default)('v5', 0x50, _sha.default); +var _default = v5; +exports["default"] = _default; + +/***/ }), + +/***/ 6900: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _regex = _interopRequireDefault(__nccwpck_require__(814)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function validate(uuid) { + return typeof uuid === 'string' && _regex.default.test(uuid); +} + +var _default = validate; +exports["default"] = _default; + +/***/ }), + +/***/ 1595: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function version(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + return parseInt(uuid.substr(14, 1), 16); +} + +var _default = version; +exports["default"] = _default; + +/***/ }), + +/***/ 9491: +/***/ ((module) => { + +"use strict"; +module.exports = require("assert"); + +/***/ }), + +/***/ 6113: +/***/ ((module) => { + +"use strict"; +module.exports = require("crypto"); + +/***/ }), + +/***/ 2361: +/***/ ((module) => { + +"use strict"; +module.exports = require("events"); + +/***/ }), + +/***/ 7147: +/***/ ((module) => { + +"use strict"; +module.exports = require("fs"); + +/***/ }), + +/***/ 3685: +/***/ ((module) => { + +"use strict"; +module.exports = require("http"); + +/***/ }), + +/***/ 5687: +/***/ ((module) => { + +"use strict"; +module.exports = require("https"); + +/***/ }), + +/***/ 1808: +/***/ ((module) => { + +"use strict"; +module.exports = require("net"); + +/***/ }), + +/***/ 7561: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:fs"); + +/***/ }), + +/***/ 2037: +/***/ ((module) => { + +"use strict"; +module.exports = require("os"); + +/***/ }), + +/***/ 1017: +/***/ ((module) => { + +"use strict"; +module.exports = require("path"); + +/***/ }), + +/***/ 2781: +/***/ ((module) => { + +"use strict"; +module.exports = require("stream"); + +/***/ }), + +/***/ 4404: +/***/ ((module) => { + +"use strict"; +module.exports = require("tls"); + +/***/ }), + +/***/ 6224: +/***/ ((module) => { + +"use strict"; +module.exports = require("tty"); + +/***/ }), + +/***/ 7310: +/***/ ((module) => { + +"use strict"; +module.exports = require("url"); + +/***/ }), + +/***/ 3837: +/***/ ((module) => { + +"use strict"; +module.exports = require("util"); + +/***/ }), + +/***/ 9796: +/***/ ((module) => { + +"use strict"; +module.exports = require("zlib"); + +/***/ }), + +/***/ 8757: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors + + +const FormData$1 = __nccwpck_require__(4334); +const url = __nccwpck_require__(7310); +const proxyFromEnv = __nccwpck_require__(3329); +const http = __nccwpck_require__(3685); +const https = __nccwpck_require__(5687); +const util = __nccwpck_require__(3837); +const followRedirects = __nccwpck_require__(7707); +const zlib = __nccwpck_require__(9796); +const stream = __nccwpck_require__(2781); +const EventEmitter = __nccwpck_require__(2361); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1); +const url__default = /*#__PURE__*/_interopDefaultLegacy(url); +const http__default = /*#__PURE__*/_interopDefaultLegacy(http); +const https__default = /*#__PURE__*/_interopDefaultLegacy(https); +const util__default = /*#__PURE__*/_interopDefaultLegacy(util); +const followRedirects__default = /*#__PURE__*/_interopDefaultLegacy(followRedirects); +const zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib); +const stream__default = /*#__PURE__*/_interopDefaultLegacy(stream); +const EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter); + +function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} + +// utils is a library of generic helper functions non-specific to axios + +const {toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +}; + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +}; + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +}; + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }; + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +}; + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +}; + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +}; + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +}; + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +}; + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +}; + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +}; + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +}; + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + if (reducer(descriptor, name, obj) !== false) { + reducedDescriptors[name] = descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +}; + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +}; + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + }; + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +}; + +const noop = () => {}; + +const toFiniteNumber = (value, defaultValue) => { + value = +value; + return Number.isFinite(value) ? value : defaultValue; +}; + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz'; + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +}; + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0]; + } + + return str; +}; + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + }; + + return visit(obj, 0); +}; + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +const utils = { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable +}; + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +const prototype$1 = AxiosError.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError, descriptors); +Object.defineProperty(prototype$1, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype$1); + + utils.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils.isPlainObject(thing) || utils.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData(obj, formData, options) { + if (!utils.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (FormData__default["default"] || FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils.isSpecCompliantForm(formData); + + if (!utils.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils.isBlob(value)) { + throw new AxiosError('Blob is not supported. Use a Buffer instead.'); + } + + if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils.isArray(value) && isFlatArray(value)) || + ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils.forEach(value, function each(el, key) { + const result = !(utils.isUndefined(el) || el === null) && visitor.call( + formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function encode$1(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && toFormData(params, this, options); +} + +const prototype = AxiosURLSearchParams.prototype; + +prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode$1); + } : encode$1; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils.isURLSearchParams(params) ? + params.toString() : + new AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +const InterceptorManager$1 = InterceptorManager; + +const transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; + +const URLSearchParams = url__default["default"].URLSearchParams; + +const platform = { + isNode: true, + classes: { + URLSearchParams, + FormData: FormData__default["default"], + Blob: typeof Blob !== 'undefined' && Blob || null + }, + protocols: [ 'http', 'https', 'file', 'data' ] +}; + +function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (utils.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils.isArray(target) ? target.length : name; + + if (isLast) { + if (utils.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils.isFormData(formData) && utils.isFunction(formData.entries)) { + const obj = {}; + + utils.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +const DEFAULT_CONTENT_TYPE = { + 'Content-Type': undefined +}; + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: transitionalDefaults, + + adapter: ['xhr', 'http'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils.isObject(data); + + if (isObjectPayload && utils.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils.isFormData(data); + + if (isFormData) { + if (!hasJSONContentType) { + return data; + } + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + + if (utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return toFormData( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*' + } + } +}; + +utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { + defaults.headers[method] = {}; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); +}); + +const defaults$1 = defaults; + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +const parseHeaders = rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}; + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils.isString(value)) return; + + if (utils.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils.forEach(this, (value, header) => { + const key = utils.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +utils.freezeMethods(AxiosHeaders.prototype); +utils.freezeMethods(AxiosHeaders); + +const AxiosHeaders$1 = AxiosHeaders; + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +function transformData(fns, response) { + const config = this || defaults$1; + const context = response || config; + const headers = AxiosHeaders$1.from(context.headers); + let data = context.data; + + utils.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} + +function isCancel(value) { + return !!(value && value.__CANCEL__); +} + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils.inherits(CanceledError, AxiosError, { + __CANCEL__: true +}); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError( + 'Request failed with status code ' + response.status, + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} + +const VERSION = "1.4.0"; + +function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} + +const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/; + +/** + * Parse data uri to a Buffer or Blob + * + * @param {String} uri + * @param {?Boolean} asBlob + * @param {?Object} options + * @param {?Function} options.Blob + * + * @returns {Buffer|Blob} + */ +function fromDataURI(uri, asBlob, options) { + const _Blob = options && options.Blob || platform.classes.Blob; + const protocol = parseProtocol(uri); + + if (asBlob === undefined && _Blob) { + asBlob = true; + } + + if (protocol === 'data') { + uri = protocol.length ? uri.slice(protocol.length + 1) : uri; + + const match = DATA_URL_PATTERN.exec(uri); + + if (!match) { + throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL); + } + + const mime = match[1]; + const isBase64 = match[2]; + const body = match[3]; + const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8'); + + if (asBlob) { + if (!_Blob) { + throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT); + } + + return new _Blob([buffer], {type: mime}); + } + + return buffer; + } + + throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT); +} + +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1000 / freq; + let timer = null; + return function throttled(force, args) { + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, args); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, args); + }, threshold - (now - timestamp)); + } + }; +} + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +const kInternals = Symbol('internals'); + +class AxiosTransformStream extends stream__default["default"].Transform{ + constructor(options) { + options = utils.toFlatObject(options, { + maxRate: 0, + chunkSize: 64 * 1024, + minChunkSize: 100, + timeWindow: 500, + ticksRate: 2, + samplesCount: 15 + }, null, (prop, source) => { + return !utils.isUndefined(source[prop]); + }); + + super({ + readableHighWaterMark: options.chunkSize + }); + + const self = this; + + const internals = this[kInternals] = { + length: options.length, + timeWindow: options.timeWindow, + ticksRate: options.ticksRate, + chunkSize: options.chunkSize, + maxRate: options.maxRate, + minChunkSize: options.minChunkSize, + bytesSeen: 0, + isCaptured: false, + notifiedBytesLoaded: 0, + ts: Date.now(), + bytes: 0, + onReadCallback: null + }; + + const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow); + + this.on('newListener', event => { + if (event === 'progress') { + if (!internals.isCaptured) { + internals.isCaptured = true; + } + } + }); + + let bytesNotified = 0; + + internals.updateProgress = throttle(function throttledHandler() { + const totalBytes = internals.length; + const bytesTransferred = internals.bytesSeen; + const progressBytes = bytesTransferred - bytesNotified; + if (!progressBytes || self.destroyed) return; + + const rate = _speedometer(progressBytes); + + bytesNotified = bytesTransferred; + + process.nextTick(() => { + self.emit('progress', { + 'loaded': bytesTransferred, + 'total': totalBytes, + 'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined, + 'bytes': progressBytes, + 'rate': rate ? rate : undefined, + 'estimated': rate && totalBytes && bytesTransferred <= totalBytes ? + (totalBytes - bytesTransferred) / rate : undefined + }); + }); + }, internals.ticksRate); + + const onFinish = () => { + internals.updateProgress(true); + }; + + this.once('end', onFinish); + this.once('error', onFinish); + } + + _read(size) { + const internals = this[kInternals]; + + if (internals.onReadCallback) { + internals.onReadCallback(); + } + + return super._read(size); + } + + _transform(chunk, encoding, callback) { + const self = this; + const internals = this[kInternals]; + const maxRate = internals.maxRate; + + const readableHighWaterMark = this.readableHighWaterMark; + + const timeWindow = internals.timeWindow; + + const divider = 1000 / timeWindow; + const bytesThreshold = (maxRate / divider); + const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0; + + function pushChunk(_chunk, _callback) { + const bytes = Buffer.byteLength(_chunk); + internals.bytesSeen += bytes; + internals.bytes += bytes; + + if (internals.isCaptured) { + internals.updateProgress(); + } + + if (self.push(_chunk)) { + process.nextTick(_callback); + } else { + internals.onReadCallback = () => { + internals.onReadCallback = null; + process.nextTick(_callback); + }; + } + } + + const transformChunk = (_chunk, _callback) => { + const chunkSize = Buffer.byteLength(_chunk); + let chunkRemainder = null; + let maxChunkSize = readableHighWaterMark; + let bytesLeft; + let passed = 0; + + if (maxRate) { + const now = Date.now(); + + if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) { + internals.ts = now; + bytesLeft = bytesThreshold - internals.bytes; + internals.bytes = bytesLeft < 0 ? -bytesLeft : 0; + passed = 0; + } + + bytesLeft = bytesThreshold - internals.bytes; + } + + if (maxRate) { + if (bytesLeft <= 0) { + // next time window + return setTimeout(() => { + _callback(null, _chunk); + }, timeWindow - passed); + } + + if (bytesLeft < maxChunkSize) { + maxChunkSize = bytesLeft; + } + } + + if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) { + chunkRemainder = _chunk.subarray(maxChunkSize); + _chunk = _chunk.subarray(0, maxChunkSize); + } + + pushChunk(_chunk, chunkRemainder ? () => { + process.nextTick(_callback, null, chunkRemainder); + } : _callback); + }; + + transformChunk(chunk, function transformNextChunk(err, _chunk) { + if (err) { + return callback(err); + } + + if (_chunk) { + transformChunk(_chunk, transformNextChunk); + } else { + callback(null); + } + }); + } + + setLength(length) { + this[kInternals].length = +length; + return this; + } +} + +const AxiosTransformStream$1 = AxiosTransformStream; + +const {asyncIterator} = Symbol; + +const readBlob = async function* (blob) { + if (blob.stream) { + yield* blob.stream(); + } else if (blob.arrayBuffer) { + yield await blob.arrayBuffer(); + } else if (blob[asyncIterator]) { + yield* blob[asyncIterator](); + } else { + yield blob; + } +}; + +const readBlob$1 = readBlob; + +const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_'; + +const textEncoder = new util.TextEncoder(); + +const CRLF = '\r\n'; +const CRLF_BYTES = textEncoder.encode(CRLF); +const CRLF_BYTES_COUNT = 2; + +class FormDataPart { + constructor(name, value) { + const {escapeName} = this.constructor; + const isStringValue = utils.isString(value); + + let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${ + !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : '' + }${CRLF}`; + + if (isStringValue) { + value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF)); + } else { + headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`; + } + + this.headers = textEncoder.encode(headers + CRLF); + + this.contentLength = isStringValue ? value.byteLength : value.size; + + this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT; + + this.name = name; + this.value = value; + } + + async *encode(){ + yield this.headers; + + const {value} = this; + + if(utils.isTypedArray(value)) { + yield value; + } else { + yield* readBlob$1(value); + } + + yield CRLF_BYTES; + } + + static escapeName(name) { + return String(name).replace(/[\r\n"]/g, (match) => ({ + '\r' : '%0D', + '\n' : '%0A', + '"' : '%22', + }[match])); + } +} + +const formDataToStream = (form, headersHandler, options) => { + const { + tag = 'form-data-boundary', + size = 25, + boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET) + } = options || {}; + + if(!utils.isFormData(form)) { + throw TypeError('FormData instance required'); + } + + if (boundary.length < 1 || boundary.length > 70) { + throw Error('boundary must be 10-70 characters long') + } + + const boundaryBytes = textEncoder.encode('--' + boundary + CRLF); + const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF); + let contentLength = footerBytes.byteLength; + + const parts = Array.from(form.entries()).map(([name, value]) => { + const part = new FormDataPart(name, value); + contentLength += part.size; + return part; + }); + + contentLength += boundaryBytes.byteLength * parts.length; + + contentLength = utils.toFiniteNumber(contentLength); + + const computedHeaders = { + 'Content-Type': `multipart/form-data; boundary=${boundary}` + }; + + if (Number.isFinite(contentLength)) { + computedHeaders['Content-Length'] = contentLength; + } + + headersHandler && headersHandler(computedHeaders); + + return stream.Readable.from((async function *() { + for(const part of parts) { + yield boundaryBytes; + yield* part.encode(); + } + + yield footerBytes; + })()); +}; + +const formDataToStream$1 = formDataToStream; + +class ZlibHeaderTransformStream extends stream__default["default"].Transform { + __transform(chunk, encoding, callback) { + this.push(chunk); + callback(); + } + + _transform(chunk, encoding, callback) { + if (chunk.length !== 0) { + this._transform = this.__transform; + + // Add Default Compression headers if no zlib headers are present + if (chunk[0] !== 120) { // Hex: 78 + const header = Buffer.alloc(2); + header[0] = 120; // Hex: 78 + header[1] = 156; // Hex: 9C + this.push(header, encoding); + } + } + + this.__transform(chunk, encoding, callback); + } +} + +const ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream; + +const callbackify = (fn, reducer) => { + return utils.isAsyncFn(fn) ? function (...args) { + const cb = args.pop(); + fn.apply(this, args).then((value) => { + try { + reducer ? cb(null, ...reducer(value)) : cb(null, value); + } catch (err) { + cb(err); + } + }, cb); + } : fn; +}; + +const callbackify$1 = callbackify; + +const zlibOptions = { + flush: zlib__default["default"].constants.Z_SYNC_FLUSH, + finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH +}; + +const brotliOptions = { + flush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH, + finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH +}; + +const isBrotliSupported = utils.isFunction(zlib__default["default"].createBrotliDecompress); + +const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"]; + +const isHttps = /https:?/; + +const supportedProtocols = platform.protocols.map(protocol => { + return protocol + ':'; +}); + +/** + * If the proxy or config beforeRedirects functions are defined, call them with the options + * object. + * + * @param {Object} options - The options object that was passed to the request. + * + * @returns {Object} + */ +function dispatchBeforeRedirect(options) { + if (options.beforeRedirects.proxy) { + options.beforeRedirects.proxy(options); + } + if (options.beforeRedirects.config) { + options.beforeRedirects.config(options); + } +} + +/** + * If the proxy or config afterRedirects functions are defined, call them with the options + * + * @param {http.ClientRequestArgs} options + * @param {AxiosProxyConfig} configProxy configuration from Axios options object + * @param {string} location + * + * @returns {http.ClientRequestArgs} + */ +function setProxy(options, configProxy, location) { + let proxy = configProxy; + if (!proxy && proxy !== false) { + const proxyUrl = proxyFromEnv.getProxyForUrl(location); + if (proxyUrl) { + proxy = new URL(proxyUrl); + } + } + if (proxy) { + // Basic proxy authorization + if (proxy.username) { + proxy.auth = (proxy.username || '') + ':' + (proxy.password || ''); + } + + if (proxy.auth) { + // Support proxy auth object form + if (proxy.auth.username || proxy.auth.password) { + proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || ''); + } + const base64 = Buffer + .from(proxy.auth, 'utf8') + .toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; + } + + options.headers.host = options.hostname + (options.port ? ':' + options.port : ''); + const proxyHost = proxy.hostname || proxy.host; + options.hostname = proxyHost; + // Replace 'host' since options is not a URL object + options.host = proxyHost; + options.port = proxy.port; + options.path = location; + if (proxy.protocol) { + options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`; + } + } + + options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) { + // Configure proxy for redirected request, passing the original config proxy to apply + // the exact same logic as if the redirected request was performed by axios directly. + setProxy(redirectOptions, configProxy, redirectOptions.href); + }; +} + +const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process'; + +// temporary hotfix + +const wrapAsync = (asyncExecutor) => { + return new Promise((resolve, reject) => { + let onDone; + let isDone; + + const done = (value, isRejected) => { + if (isDone) return; + isDone = true; + onDone && onDone(value, isRejected); + }; + + const _resolve = (value) => { + done(value); + resolve(value); + }; + + const _reject = (reason) => { + done(reason, true); + reject(reason); + }; + + asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject); + }) +}; + +/*eslint consistent-return:0*/ +const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) { + return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) { + let {data, lookup, family} = config; + const {responseType, responseEncoding} = config; + const method = config.method.toUpperCase(); + let isDone; + let rejected = false; + let req; + + if (lookup && utils.isAsyncFn(lookup)) { + lookup = callbackify$1(lookup, (entry) => { + if(utils.isString(entry)) { + entry = [entry, entry.indexOf('.') < 0 ? 6 : 4]; + } else if (!utils.isArray(entry)) { + throw new TypeError('lookup async function must return an array [ip: string, family: number]]') + } + return entry; + }); + } + + // temporary internal emitter until the AxiosRequest class will be implemented + const emitter = new EventEmitter__default["default"](); + + const onFinished = () => { + if (config.cancelToken) { + config.cancelToken.unsubscribe(abort); + } + + if (config.signal) { + config.signal.removeEventListener('abort', abort); + } + + emitter.removeAllListeners(); + }; + + onDone((value, isRejected) => { + isDone = true; + if (isRejected) { + rejected = true; + onFinished(); + } + }); + + function abort(reason) { + emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason); + } + + emitter.once('abort', reject); + + if (config.cancelToken || config.signal) { + config.cancelToken && config.cancelToken.subscribe(abort); + if (config.signal) { + config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort); + } + } + + // Parse url + const fullPath = buildFullPath(config.baseURL, config.url); + const parsed = new URL(fullPath, 'http://localhost'); + const protocol = parsed.protocol || supportedProtocols[0]; + + if (protocol === 'data:') { + let convertedData; + + if (method !== 'GET') { + return settle(resolve, reject, { + status: 405, + statusText: 'method not allowed', + headers: {}, + config + }); + } + + try { + convertedData = fromDataURI(config.url, responseType === 'blob', { + Blob: config.env && config.env.Blob + }); + } catch (err) { + throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config); + } + + if (responseType === 'text') { + convertedData = convertedData.toString(responseEncoding); + + if (!responseEncoding || responseEncoding === 'utf8') { + convertedData = utils.stripBOM(convertedData); + } + } else if (responseType === 'stream') { + convertedData = stream__default["default"].Readable.from(convertedData); + } + + return settle(resolve, reject, { + data: convertedData, + status: 200, + statusText: 'OK', + headers: new AxiosHeaders$1(), + config + }); + } + + if (supportedProtocols.indexOf(protocol) === -1) { + return reject(new AxiosError( + 'Unsupported protocol ' + protocol, + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + const headers = AxiosHeaders$1.from(config.headers).normalize(); + + // Set User-Agent (required by some servers) + // See https://github.com/axios/axios/issues/69 + // User-Agent is specified; handle case where no UA header is desired + // Only set header if it hasn't been set in config + headers.set('User-Agent', 'axios/' + VERSION, false); + + const onDownloadProgress = config.onDownloadProgress; + const onUploadProgress = config.onUploadProgress; + const maxRate = config.maxRate; + let maxUploadRate = undefined; + let maxDownloadRate = undefined; + + // support for spec compliant FormData objects + if (utils.isSpecCompliantForm(data)) { + const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i); + + data = formDataToStream$1(data, (formHeaders) => { + headers.set(formHeaders); + }, { + tag: `axios-${VERSION}-boundary`, + boundary: userBoundary && userBoundary[1] || undefined + }); + // support for https://www.npmjs.com/package/form-data api + } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) { + headers.set(data.getHeaders()); + + if (!headers.hasContentLength()) { + try { + const knownLength = await util__default["default"].promisify(data.getLength).call(data); + Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength); + /*eslint no-empty:0*/ + } catch (e) { + } + } + } else if (utils.isBlob(data)) { + data.size && headers.setContentType(data.type || 'application/octet-stream'); + headers.setContentLength(data.size || 0); + data = stream__default["default"].Readable.from(readBlob$1(data)); + } else if (data && !utils.isStream(data)) { + if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils.isString(data)) { + data = Buffer.from(data, 'utf-8'); + } else { + return reject(new AxiosError( + 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + // Add Content-Length header if data exists + headers.setContentLength(data.length, false); + + if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) { + return reject(new AxiosError( + 'Request body larger than maxBodyLength limit', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + } + + const contentLength = utils.toFiniteNumber(headers.getContentLength()); + + if (utils.isArray(maxRate)) { + maxUploadRate = maxRate[0]; + maxDownloadRate = maxRate[1]; + } else { + maxUploadRate = maxDownloadRate = maxRate; + } + + if (data && (onUploadProgress || maxUploadRate)) { + if (!utils.isStream(data)) { + data = stream__default["default"].Readable.from(data, {objectMode: false}); + } + + data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({ + length: contentLength, + maxRate: utils.toFiniteNumber(maxUploadRate) + })], utils.noop); + + onUploadProgress && data.on('progress', progress => { + onUploadProgress(Object.assign(progress, { + upload: true + })); + }); + } + + // HTTP basic authentication + let auth = undefined; + if (config.auth) { + const username = config.auth.username || ''; + const password = config.auth.password || ''; + auth = username + ':' + password; + } + + if (!auth && parsed.username) { + const urlUsername = parsed.username; + const urlPassword = parsed.password; + auth = urlUsername + ':' + urlPassword; + } + + auth && headers.delete('authorization'); + + let path; + + try { + path = buildURL( + parsed.pathname + parsed.search, + config.params, + config.paramsSerializer + ).replace(/^\?/, ''); + } catch (err) { + const customErr = new Error(err.message); + customErr.config = config; + customErr.url = config.url; + customErr.exists = true; + return reject(customErr); + } + + headers.set( + 'Accept-Encoding', + 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false + ); + + const options = { + path, + method: method, + headers: headers.toJSON(), + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth, + protocol, + family, + lookup, + beforeRedirect: dispatchBeforeRedirect, + beforeRedirects: {} + }; + + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); + } + + let transport; + const isHttpsRequest = isHttps.test(options.protocol); + options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsRequest ? https__default["default"] : http__default["default"]; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + if (config.beforeRedirect) { + options.beforeRedirects.config = config.beforeRedirect; + } + transport = isHttpsRequest ? httpsFollow : httpFollow; + } + + if (config.maxBodyLength > -1) { + options.maxBodyLength = config.maxBodyLength; + } else { + // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited + options.maxBodyLength = Infinity; + } + + if (config.insecureHTTPParser) { + options.insecureHTTPParser = config.insecureHTTPParser; + } + + // Create the request + req = transport.request(options, function handleResponse(res) { + if (req.destroyed) return; + + const streams = [res]; + + const responseLength = +res.headers['content-length']; + + if (onDownloadProgress) { + const transformStream = new AxiosTransformStream$1({ + length: utils.toFiniteNumber(responseLength), + maxRate: utils.toFiniteNumber(maxDownloadRate) + }); + + onDownloadProgress && transformStream.on('progress', progress => { + onDownloadProgress(Object.assign(progress, { + download: true + })); + }); + + streams.push(transformStream); + } + + // decompress the response body transparently if required + let responseStream = res; + + // return the last request in case of redirects + const lastRequest = res.req || req; + + // if decompress disabled we should not decompress + if (config.decompress !== false && res.headers['content-encoding']) { + // if no content, but headers still say that it is encoded, + // remove the header not confuse downstream operations + if (method === 'HEAD' || res.statusCode === 204) { + delete res.headers['content-encoding']; + } + + switch (res.headers['content-encoding']) { + /*eslint default-case:0*/ + case 'gzip': + case 'x-gzip': + case 'compress': + case 'x-compress': + // add the unzipper to the body stream processing pipeline + streams.push(zlib__default["default"].createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'deflate': + streams.push(new ZlibHeaderTransformStream$1()); + + // add the unzipper to the body stream processing pipeline + streams.push(zlib__default["default"].createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'br': + if (isBrotliSupported) { + streams.push(zlib__default["default"].createBrotliDecompress(brotliOptions)); + delete res.headers['content-encoding']; + } + } + } + + responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils.noop) : streams[0]; + + const offListeners = stream__default["default"].finished(responseStream, () => { + offListeners(); + onFinished(); + }); + + const response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: new AxiosHeaders$1(res.headers), + config, + request: lastRequest + }; + + if (responseType === 'stream') { + response.data = responseStream; + settle(resolve, reject, response); + } else { + const responseBuffer = []; + let totalResponseBytes = 0; + + responseStream.on('data', function handleStreamData(chunk) { + responseBuffer.push(chunk); + totalResponseBytes += chunk.length; + + // make sure the content length is not over the maxContentLength if specified + if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { + // stream.destroy() emit aborted event before calling reject() on Node.js v16 + rejected = true; + responseStream.destroy(); + reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, config, lastRequest)); + } + }); + + responseStream.on('aborted', function handlerStreamAborted() { + if (rejected) { + return; + } + + const err = new AxiosError( + 'maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, + config, + lastRequest + ); + responseStream.destroy(err); + reject(err); + }); + + responseStream.on('error', function handleStreamError(err) { + if (req.destroyed) return; + reject(AxiosError.from(err, null, config, lastRequest)); + }); + + responseStream.on('end', function handleStreamEnd() { + try { + let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer); + if (responseType !== 'arraybuffer') { + responseData = responseData.toString(responseEncoding); + if (!responseEncoding || responseEncoding === 'utf8') { + responseData = utils.stripBOM(responseData); + } + } + response.data = responseData; + } catch (err) { + reject(AxiosError.from(err, null, config, response.request, response)); + } + settle(resolve, reject, response); + }); + } + + emitter.once('abort', err => { + if (!responseStream.destroyed) { + responseStream.emit('error', err); + responseStream.destroy(); + } + }); + }); + + emitter.once('abort', err => { + reject(err); + req.destroy(err); + }); + + // Handle errors + req.on('error', function handleRequestError(err) { + // @todo remove + // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return; + reject(AxiosError.from(err, null, config, req)); + }); + + // set tcp keep alive to prevent drop connection by peer + req.on('socket', function handleRequestSocket(socket) { + // default interval of sending ack packet is 1 minute + socket.setKeepAlive(true, 1000 * 60); + }); + + // Handle request timeout + if (config.timeout) { + // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types. + const timeout = parseInt(config.timeout, 10); + + if (isNaN(timeout)) { + reject(new AxiosError( + 'error trying to parse `config.timeout` to int', + AxiosError.ERR_BAD_OPTION_VALUE, + config, + req + )); + + return; + } + + // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. + // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. + // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. + // And then these socket which be hang up will devouring CPU little by little. + // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. + req.setTimeout(timeout, function handleRequestTimeout() { + if (isDone) return; + let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = config.transitional || transitionalDefaults; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + config, + req + )); + abort(); + }); + } + + + // Send the request + if (utils.isStream(data)) { + let ended = false; + let errored = false; + + data.on('end', () => { + ended = true; + }); + + data.once('error', err => { + errored = true; + req.destroy(err); + }); + + data.on('close', () => { + if (!ended && !errored) { + abort(new CanceledError('Request stream has been aborted', config, req)); + } + }); + + data.pipe(req); + } else { + req.end(data); + } + }); +}; + +const cookies = platform.isStandardBrowserEnv ? + +// Standard browser envs support document.cookie + (function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + const cookie = []; + cookie.push(name + '=' + encodeURIComponent(value)); + + if (utils.isNumber(expires)) { + cookie.push('expires=' + new Date(expires).toGMTString()); + } + + if (utils.isString(path)) { + cookie.push('path=' + path); + } + + if (utils.isString(domain)) { + cookie.push('domain=' + domain); + } + + if (secure === true) { + cookie.push('secure'); + } + + document.cookie = cookie.join('; '); + }, + + read: function read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + }; + })() : + +// Non standard browser env (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return { + write: function write() {}, + read: function read() { return null; }, + remove: function remove() {} + }; + })(); + +const isURLSameOrigin = platform.isStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); + +function progressEventReducer(listener, isDownloadStream) { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + + return e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e + }; + + data[isDownloadStream ? 'download' : 'upload'] = true; + + listener(data); + }; +} + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +const xhrAdapter = isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + let requestData = config.data; + const requestHeaders = AxiosHeaders$1.from(config.headers).normalize(); + const responseType = config.responseType; + let onCanceled; + function done() { + if (config.cancelToken) { + config.cancelToken.unsubscribe(onCanceled); + } + + if (config.signal) { + config.signal.removeEventListener('abort', onCanceled); + } + } + + if (utils.isFormData(requestData)) { + if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) { + requestHeaders.setContentType(false); // Let the browser set it + } else { + requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks + } + } + + let request = new XMLHttpRequest(); + + // HTTP basic authentication + if (config.auth) { + const username = config.auth.username || ''; + const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; + requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password)); + } + + const fullPath = buildFullPath(config.baseURL, config.url); + + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); + + // Set the request timeout in MS + request.timeout = config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = AxiosHeaders$1.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = config.transitional || transitionalDefaults; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + config, + request)); + + // Clean up request + request = null; + }; + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + if (platform.isStandardBrowserEnv) { + // Add xsrf header + const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) + && config.xsrfCookieName && cookies.read(config.xsrfCookieName); + + if (xsrfValue) { + requestHeaders.set(config.xsrfHeaderName, xsrfValue); + } + } + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = config.responseType; + } + + // Handle progress if needed + if (typeof config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress)); + } + + if (config.cancelToken || config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + + config.cancelToken && config.cancelToken.subscribe(onCanceled); + if (config.signal) { + config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(fullPath); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +}; + +const knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter +}; + +utils.forEach(knownAdapters, (fn, value) => { + if(fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const adapters = { + getAdapter: (adapters) => { + adapters = utils.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) { + break; + } + } + + if (!adapter) { + if (adapter === false) { + throw new AxiosError( + `Adapter ${nameOrAdapter} is not supported by the environment`, + 'ERR_NOT_SUPPORT' + ); + } + + throw new Error( + utils.hasOwnProp(knownAdapters, nameOrAdapter) ? + `Adapter '${nameOrAdapter}' is not available in the build` : + `Unknown adapter '${nameOrAdapter}'` + ); + } + + if (!utils.isFunction(adapter)) { + throw new TypeError('adapter is not a function'); + } + + return adapter; + }, + adapters: knownAdapters +}; + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = AxiosHeaders$1.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = AxiosHeaders$1.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders$1.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} + +const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge.call({caseless}, target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} + +const validators$1 = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators$1[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new AxiosError( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } +} + +const validator = { + assertOptions, + validators: validators$1 +}; + +const validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + let contextHeaders; + + // Flatten headers + contextHeaders = headers && utils.merge( + headers.common, + headers[config.method] + ); + + contextHeaders && utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = AxiosHeaders$1.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +const Axios$1 = Axios; + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +const CancelToken$1 = CancelToken; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +function isAxiosError(payload) { + return utils.isObject(payload) && (payload.isAxiosError === true); +} + +const HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode).forEach(([key, value]) => { + HttpStatusCode[value] = key; +}); + +const HttpStatusCode$1 = HttpStatusCode; + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new Axios$1(defaultConfig); + const instance = bind(Axios$1.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(defaults$1); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios$1; + +// Expose Cancel & CancelToken +axios.CanceledError = CanceledError; +axios.CancelToken = CancelToken$1; +axios.isCancel = isCancel; +axios.VERSION = VERSION; +axios.toFormData = toFormData; + +// Expose AxiosError class +axios.AxiosError = AxiosError; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig; + +axios.AxiosHeaders = AxiosHeaders$1; + +axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.HttpStatusCode = HttpStatusCode$1; + +axios.default = axios; + +module.exports = axios; +//# sourceMappingURL=axios.cjs.map + + +/***/ }), + +/***/ 3765: +/***/ ((module) => { + +"use strict"; +module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"iana"},"application/3gpdash-qoe-report+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/3gpp-ims+xml":{"source":"iana","compressible":true},"application/3gpphal+json":{"source":"iana","compressible":true},"application/3gpphalforms+json":{"source":"iana","compressible":true},"application/a2l":{"source":"iana"},"application/ace+cbor":{"source":"iana"},"application/activemessage":{"source":"iana"},"application/activity+json":{"source":"iana","compressible":true},"application/alto-costmap+json":{"source":"iana","compressible":true},"application/alto-costmapfilter+json":{"source":"iana","compressible":true},"application/alto-directory+json":{"source":"iana","compressible":true},"application/alto-endpointcost+json":{"source":"iana","compressible":true},"application/alto-endpointcostparams+json":{"source":"iana","compressible":true},"application/alto-endpointprop+json":{"source":"iana","compressible":true},"application/alto-endpointpropparams+json":{"source":"iana","compressible":true},"application/alto-error+json":{"source":"iana","compressible":true},"application/alto-networkmap+json":{"source":"iana","compressible":true},"application/alto-networkmapfilter+json":{"source":"iana","compressible":true},"application/alto-updatestreamcontrol+json":{"source":"iana","compressible":true},"application/alto-updatestreamparams+json":{"source":"iana","compressible":true},"application/aml":{"source":"iana"},"application/andrew-inset":{"source":"iana","extensions":["ez"]},"application/applefile":{"source":"iana"},"application/applixware":{"source":"apache","extensions":["aw"]},"application/at+jwt":{"source":"iana"},"application/atf":{"source":"iana"},"application/atfx":{"source":"iana"},"application/atom+xml":{"source":"iana","compressible":true,"extensions":["atom"]},"application/atomcat+xml":{"source":"iana","compressible":true,"extensions":["atomcat"]},"application/atomdeleted+xml":{"source":"iana","compressible":true,"extensions":["atomdeleted"]},"application/atomicmail":{"source":"iana"},"application/atomsvc+xml":{"source":"iana","compressible":true,"extensions":["atomsvc"]},"application/atsc-dwd+xml":{"source":"iana","compressible":true,"extensions":["dwd"]},"application/atsc-dynamic-event-message":{"source":"iana"},"application/atsc-held+xml":{"source":"iana","compressible":true,"extensions":["held"]},"application/atsc-rdt+json":{"source":"iana","compressible":true},"application/atsc-rsat+xml":{"source":"iana","compressible":true,"extensions":["rsat"]},"application/atxml":{"source":"iana"},"application/auth-policy+xml":{"source":"iana","compressible":true},"application/bacnet-xdd+zip":{"source":"iana","compressible":false},"application/batch-smtp":{"source":"iana"},"application/bdoc":{"compressible":false,"extensions":["bdoc"]},"application/beep+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/calendar+json":{"source":"iana","compressible":true},"application/calendar+xml":{"source":"iana","compressible":true,"extensions":["xcs"]},"application/call-completion":{"source":"iana"},"application/cals-1840":{"source":"iana"},"application/captive+json":{"source":"iana","compressible":true},"application/cbor":{"source":"iana"},"application/cbor-seq":{"source":"iana"},"application/cccex":{"source":"iana"},"application/ccmp+xml":{"source":"iana","compressible":true},"application/ccxml+xml":{"source":"iana","compressible":true,"extensions":["ccxml"]},"application/cdfx+xml":{"source":"iana","compressible":true,"extensions":["cdfx"]},"application/cdmi-capability":{"source":"iana","extensions":["cdmia"]},"application/cdmi-container":{"source":"iana","extensions":["cdmic"]},"application/cdmi-domain":{"source":"iana","extensions":["cdmid"]},"application/cdmi-object":{"source":"iana","extensions":["cdmio"]},"application/cdmi-queue":{"source":"iana","extensions":["cdmiq"]},"application/cdni":{"source":"iana"},"application/cea":{"source":"iana"},"application/cea-2018+xml":{"source":"iana","compressible":true},"application/cellml+xml":{"source":"iana","compressible":true},"application/cfw":{"source":"iana"},"application/city+json":{"source":"iana","compressible":true},"application/clr":{"source":"iana"},"application/clue+xml":{"source":"iana","compressible":true},"application/clue_info+xml":{"source":"iana","compressible":true},"application/cms":{"source":"iana"},"application/cnrp+xml":{"source":"iana","compressible":true},"application/coap-group+json":{"source":"iana","compressible":true},"application/coap-payload":{"source":"iana"},"application/commonground":{"source":"iana"},"application/conference-info+xml":{"source":"iana","compressible":true},"application/cose":{"source":"iana"},"application/cose-key":{"source":"iana"},"application/cose-key-set":{"source":"iana"},"application/cpl+xml":{"source":"iana","compressible":true,"extensions":["cpl"]},"application/csrattrs":{"source":"iana"},"application/csta+xml":{"source":"iana","compressible":true},"application/cstadata+xml":{"source":"iana","compressible":true},"application/csvm+json":{"source":"iana","compressible":true},"application/cu-seeme":{"source":"apache","extensions":["cu"]},"application/cwt":{"source":"iana"},"application/cybercash":{"source":"iana"},"application/dart":{"compressible":true},"application/dash+xml":{"source":"iana","compressible":true,"extensions":["mpd"]},"application/dash-patch+xml":{"source":"iana","compressible":true,"extensions":["mpp"]},"application/dashdelta":{"source":"iana"},"application/davmount+xml":{"source":"iana","compressible":true,"extensions":["davmount"]},"application/dca-rft":{"source":"iana"},"application/dcd":{"source":"iana"},"application/dec-dx":{"source":"iana"},"application/dialog-info+xml":{"source":"iana","compressible":true},"application/dicom":{"source":"iana"},"application/dicom+json":{"source":"iana","compressible":true},"application/dicom+xml":{"source":"iana","compressible":true},"application/dii":{"source":"iana"},"application/dit":{"source":"iana"},"application/dns":{"source":"iana"},"application/dns+json":{"source":"iana","compressible":true},"application/dns-message":{"source":"iana"},"application/docbook+xml":{"source":"apache","compressible":true,"extensions":["dbk"]},"application/dots+cbor":{"source":"iana"},"application/dskpp+xml":{"source":"iana","compressible":true},"application/dssc+der":{"source":"iana","extensions":["dssc"]},"application/dssc+xml":{"source":"iana","compressible":true,"extensions":["xdssc"]},"application/dvcs":{"source":"iana"},"application/ecmascript":{"source":"iana","compressible":true,"extensions":["es","ecma"]},"application/edi-consent":{"source":"iana"},"application/edi-x12":{"source":"iana","compressible":false},"application/edifact":{"source":"iana","compressible":false},"application/efi":{"source":"iana"},"application/elm+json":{"source":"iana","charset":"UTF-8","compressible":true},"application/elm+xml":{"source":"iana","compressible":true},"application/emergencycalldata.cap+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/emergencycalldata.comment+xml":{"source":"iana","compressible":true},"application/emergencycalldata.control+xml":{"source":"iana","compressible":true},"application/emergencycalldata.deviceinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.ecall.msd":{"source":"iana"},"application/emergencycalldata.providerinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.serviceinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.subscriberinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.veds+xml":{"source":"iana","compressible":true},"application/emma+xml":{"source":"iana","compressible":true,"extensions":["emma"]},"application/emotionml+xml":{"source":"iana","compressible":true,"extensions":["emotionml"]},"application/encaprtp":{"source":"iana"},"application/epp+xml":{"source":"iana","compressible":true},"application/epub+zip":{"source":"iana","compressible":false,"extensions":["epub"]},"application/eshop":{"source":"iana"},"application/exi":{"source":"iana","extensions":["exi"]},"application/expect-ct-report+json":{"source":"iana","compressible":true},"application/express":{"source":"iana","extensions":["exp"]},"application/fastinfoset":{"source":"iana"},"application/fastsoap":{"source":"iana"},"application/fdt+xml":{"source":"iana","compressible":true,"extensions":["fdt"]},"application/fhir+json":{"source":"iana","charset":"UTF-8","compressible":true},"application/fhir+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/fido.trusted-apps+json":{"compressible":true},"application/fits":{"source":"iana"},"application/flexfec":{"source":"iana"},"application/font-sfnt":{"source":"iana"},"application/font-tdpfr":{"source":"iana","extensions":["pfr"]},"application/font-woff":{"source":"iana","compressible":false},"application/framework-attributes+xml":{"source":"iana","compressible":true},"application/geo+json":{"source":"iana","compressible":true,"extensions":["geojson"]},"application/geo+json-seq":{"source":"iana"},"application/geopackage+sqlite3":{"source":"iana"},"application/geoxacml+xml":{"source":"iana","compressible":true},"application/gltf-buffer":{"source":"iana"},"application/gml+xml":{"source":"iana","compressible":true,"extensions":["gml"]},"application/gpx+xml":{"source":"apache","compressible":true,"extensions":["gpx"]},"application/gxf":{"source":"apache","extensions":["gxf"]},"application/gzip":{"source":"iana","compressible":false,"extensions":["gz"]},"application/h224":{"source":"iana"},"application/held+xml":{"source":"iana","compressible":true},"application/hjson":{"extensions":["hjson"]},"application/http":{"source":"iana"},"application/hyperstudio":{"source":"iana","extensions":["stk"]},"application/ibe-key-request+xml":{"source":"iana","compressible":true},"application/ibe-pkg-reply+xml":{"source":"iana","compressible":true},"application/ibe-pp-data":{"source":"iana"},"application/iges":{"source":"iana"},"application/im-iscomposing+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/index":{"source":"iana"},"application/index.cmd":{"source":"iana"},"application/index.obj":{"source":"iana"},"application/index.response":{"source":"iana"},"application/index.vnd":{"source":"iana"},"application/inkml+xml":{"source":"iana","compressible":true,"extensions":["ink","inkml"]},"application/iotp":{"source":"iana"},"application/ipfix":{"source":"iana","extensions":["ipfix"]},"application/ipp":{"source":"iana"},"application/isup":{"source":"iana"},"application/its+xml":{"source":"iana","compressible":true,"extensions":["its"]},"application/java-archive":{"source":"apache","compressible":false,"extensions":["jar","war","ear"]},"application/java-serialized-object":{"source":"apache","compressible":false,"extensions":["ser"]},"application/java-vm":{"source":"apache","compressible":false,"extensions":["class"]},"application/javascript":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["js","mjs"]},"application/jf2feed+json":{"source":"iana","compressible":true},"application/jose":{"source":"iana"},"application/jose+json":{"source":"iana","compressible":true},"application/jrd+json":{"source":"iana","compressible":true},"application/jscalendar+json":{"source":"iana","compressible":true},"application/json":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["json","map"]},"application/json-patch+json":{"source":"iana","compressible":true},"application/json-seq":{"source":"iana"},"application/json5":{"extensions":["json5"]},"application/jsonml+json":{"source":"apache","compressible":true,"extensions":["jsonml"]},"application/jwk+json":{"source":"iana","compressible":true},"application/jwk-set+json":{"source":"iana","compressible":true},"application/jwt":{"source":"iana"},"application/kpml-request+xml":{"source":"iana","compressible":true},"application/kpml-response+xml":{"source":"iana","compressible":true},"application/ld+json":{"source":"iana","compressible":true,"extensions":["jsonld"]},"application/lgr+xml":{"source":"iana","compressible":true,"extensions":["lgr"]},"application/link-format":{"source":"iana"},"application/load-control+xml":{"source":"iana","compressible":true},"application/lost+xml":{"source":"iana","compressible":true,"extensions":["lostxml"]},"application/lostsync+xml":{"source":"iana","compressible":true},"application/lpf+zip":{"source":"iana","compressible":false},"application/lxf":{"source":"iana"},"application/mac-binhex40":{"source":"iana","extensions":["hqx"]},"application/mac-compactpro":{"source":"apache","extensions":["cpt"]},"application/macwriteii":{"source":"iana"},"application/mads+xml":{"source":"iana","compressible":true,"extensions":["mads"]},"application/manifest+json":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["webmanifest"]},"application/marc":{"source":"iana","extensions":["mrc"]},"application/marcxml+xml":{"source":"iana","compressible":true,"extensions":["mrcx"]},"application/mathematica":{"source":"iana","extensions":["ma","nb","mb"]},"application/mathml+xml":{"source":"iana","compressible":true,"extensions":["mathml"]},"application/mathml-content+xml":{"source":"iana","compressible":true},"application/mathml-presentation+xml":{"source":"iana","compressible":true},"application/mbms-associated-procedure-description+xml":{"source":"iana","compressible":true},"application/mbms-deregister+xml":{"source":"iana","compressible":true},"application/mbms-envelope+xml":{"source":"iana","compressible":true},"application/mbms-msk+xml":{"source":"iana","compressible":true},"application/mbms-msk-response+xml":{"source":"iana","compressible":true},"application/mbms-protection-description+xml":{"source":"iana","compressible":true},"application/mbms-reception-report+xml":{"source":"iana","compressible":true},"application/mbms-register+xml":{"source":"iana","compressible":true},"application/mbms-register-response+xml":{"source":"iana","compressible":true},"application/mbms-schedule+xml":{"source":"iana","compressible":true},"application/mbms-user-service-description+xml":{"source":"iana","compressible":true},"application/mbox":{"source":"iana","extensions":["mbox"]},"application/media-policy-dataset+xml":{"source":"iana","compressible":true,"extensions":["mpf"]},"application/media_control+xml":{"source":"iana","compressible":true},"application/mediaservercontrol+xml":{"source":"iana","compressible":true,"extensions":["mscml"]},"application/merge-patch+json":{"source":"iana","compressible":true},"application/metalink+xml":{"source":"apache","compressible":true,"extensions":["metalink"]},"application/metalink4+xml":{"source":"iana","compressible":true,"extensions":["meta4"]},"application/mets+xml":{"source":"iana","compressible":true,"extensions":["mets"]},"application/mf4":{"source":"iana"},"application/mikey":{"source":"iana"},"application/mipc":{"source":"iana"},"application/missing-blocks+cbor-seq":{"source":"iana"},"application/mmt-aei+xml":{"source":"iana","compressible":true,"extensions":["maei"]},"application/mmt-usd+xml":{"source":"iana","compressible":true,"extensions":["musd"]},"application/mods+xml":{"source":"iana","compressible":true,"extensions":["mods"]},"application/moss-keys":{"source":"iana"},"application/moss-signature":{"source":"iana"},"application/mosskey-data":{"source":"iana"},"application/mosskey-request":{"source":"iana"},"application/mp21":{"source":"iana","extensions":["m21","mp21"]},"application/mp4":{"source":"iana","extensions":["mp4s","m4p"]},"application/mpeg4-generic":{"source":"iana"},"application/mpeg4-iod":{"source":"iana"},"application/mpeg4-iod-xmt":{"source":"iana"},"application/mrb-consumer+xml":{"source":"iana","compressible":true},"application/mrb-publish+xml":{"source":"iana","compressible":true},"application/msc-ivr+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/msc-mixer+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/msword":{"source":"iana","compressible":false,"extensions":["doc","dot"]},"application/mud+json":{"source":"iana","compressible":true},"application/multipart-core":{"source":"iana"},"application/mxf":{"source":"iana","extensions":["mxf"]},"application/n-quads":{"source":"iana","extensions":["nq"]},"application/n-triples":{"source":"iana","extensions":["nt"]},"application/nasdata":{"source":"iana"},"application/news-checkgroups":{"source":"iana","charset":"US-ASCII"},"application/news-groupinfo":{"source":"iana","charset":"US-ASCII"},"application/news-transmission":{"source":"iana"},"application/nlsml+xml":{"source":"iana","compressible":true},"application/node":{"source":"iana","extensions":["cjs"]},"application/nss":{"source":"iana"},"application/oauth-authz-req+jwt":{"source":"iana"},"application/oblivious-dns-message":{"source":"iana"},"application/ocsp-request":{"source":"iana"},"application/ocsp-response":{"source":"iana"},"application/octet-stream":{"source":"iana","compressible":false,"extensions":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{"source":"iana","extensions":["oda"]},"application/odm+xml":{"source":"iana","compressible":true},"application/odx":{"source":"iana"},"application/oebps-package+xml":{"source":"iana","compressible":true,"extensions":["opf"]},"application/ogg":{"source":"iana","compressible":false,"extensions":["ogx"]},"application/omdoc+xml":{"source":"apache","compressible":true,"extensions":["omdoc"]},"application/onenote":{"source":"apache","extensions":["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{"source":"iana","compressible":true},"application/oscore":{"source":"iana"},"application/oxps":{"source":"iana","extensions":["oxps"]},"application/p21":{"source":"iana"},"application/p21+zip":{"source":"iana","compressible":false},"application/p2p-overlay+xml":{"source":"iana","compressible":true,"extensions":["relo"]},"application/parityfec":{"source":"iana"},"application/passport":{"source":"iana"},"application/patch-ops-error+xml":{"source":"iana","compressible":true,"extensions":["xer"]},"application/pdf":{"source":"iana","compressible":false,"extensions":["pdf"]},"application/pdx":{"source":"iana"},"application/pem-certificate-chain":{"source":"iana"},"application/pgp-encrypted":{"source":"iana","compressible":false,"extensions":["pgp"]},"application/pgp-keys":{"source":"iana","extensions":["asc"]},"application/pgp-signature":{"source":"iana","extensions":["asc","sig"]},"application/pics-rules":{"source":"apache","extensions":["prf"]},"application/pidf+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/pidf-diff+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/pkcs10":{"source":"iana","extensions":["p10"]},"application/pkcs12":{"source":"iana"},"application/pkcs7-mime":{"source":"iana","extensions":["p7m","p7c"]},"application/pkcs7-signature":{"source":"iana","extensions":["p7s"]},"application/pkcs8":{"source":"iana","extensions":["p8"]},"application/pkcs8-encrypted":{"source":"iana"},"application/pkix-attr-cert":{"source":"iana","extensions":["ac"]},"application/pkix-cert":{"source":"iana","extensions":["cer"]},"application/pkix-crl":{"source":"iana","extensions":["crl"]},"application/pkix-pkipath":{"source":"iana","extensions":["pkipath"]},"application/pkixcmp":{"source":"iana","extensions":["pki"]},"application/pls+xml":{"source":"iana","compressible":true,"extensions":["pls"]},"application/poc-settings+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/postscript":{"source":"iana","compressible":true,"extensions":["ai","eps","ps"]},"application/ppsp-tracker+json":{"source":"iana","compressible":true},"application/problem+json":{"source":"iana","compressible":true},"application/problem+xml":{"source":"iana","compressible":true},"application/provenance+xml":{"source":"iana","compressible":true,"extensions":["provx"]},"application/prs.alvestrand.titrax-sheet":{"source":"iana"},"application/prs.cww":{"source":"iana","extensions":["cww"]},"application/prs.cyn":{"source":"iana","charset":"7-BIT"},"application/prs.hpub+zip":{"source":"iana","compressible":false},"application/prs.nprend":{"source":"iana"},"application/prs.plucker":{"source":"iana"},"application/prs.rdf-xml-crypt":{"source":"iana"},"application/prs.xsf+xml":{"source":"iana","compressible":true},"application/pskc+xml":{"source":"iana","compressible":true,"extensions":["pskcxml"]},"application/pvd+json":{"source":"iana","compressible":true},"application/qsig":{"source":"iana"},"application/raml+yaml":{"compressible":true,"extensions":["raml"]},"application/raptorfec":{"source":"iana"},"application/rdap+json":{"source":"iana","compressible":true},"application/rdf+xml":{"source":"iana","compressible":true,"extensions":["rdf","owl"]},"application/reginfo+xml":{"source":"iana","compressible":true,"extensions":["rif"]},"application/relax-ng-compact-syntax":{"source":"iana","extensions":["rnc"]},"application/remote-printing":{"source":"iana"},"application/reputon+json":{"source":"iana","compressible":true},"application/resource-lists+xml":{"source":"iana","compressible":true,"extensions":["rl"]},"application/resource-lists-diff+xml":{"source":"iana","compressible":true,"extensions":["rld"]},"application/rfc+xml":{"source":"iana","compressible":true},"application/riscos":{"source":"iana"},"application/rlmi+xml":{"source":"iana","compressible":true},"application/rls-services+xml":{"source":"iana","compressible":true,"extensions":["rs"]},"application/route-apd+xml":{"source":"iana","compressible":true,"extensions":["rapd"]},"application/route-s-tsid+xml":{"source":"iana","compressible":true,"extensions":["sls"]},"application/route-usd+xml":{"source":"iana","compressible":true,"extensions":["rusd"]},"application/rpki-ghostbusters":{"source":"iana","extensions":["gbr"]},"application/rpki-manifest":{"source":"iana","extensions":["mft"]},"application/rpki-publication":{"source":"iana"},"application/rpki-roa":{"source":"iana","extensions":["roa"]},"application/rpki-updown":{"source":"iana"},"application/rsd+xml":{"source":"apache","compressible":true,"extensions":["rsd"]},"application/rss+xml":{"source":"apache","compressible":true,"extensions":["rss"]},"application/rtf":{"source":"iana","compressible":true,"extensions":["rtf"]},"application/rtploopback":{"source":"iana"},"application/rtx":{"source":"iana"},"application/samlassertion+xml":{"source":"iana","compressible":true},"application/samlmetadata+xml":{"source":"iana","compressible":true},"application/sarif+json":{"source":"iana","compressible":true},"application/sarif-external-properties+json":{"source":"iana","compressible":true},"application/sbe":{"source":"iana"},"application/sbml+xml":{"source":"iana","compressible":true,"extensions":["sbml"]},"application/scaip+xml":{"source":"iana","compressible":true},"application/scim+json":{"source":"iana","compressible":true},"application/scvp-cv-request":{"source":"iana","extensions":["scq"]},"application/scvp-cv-response":{"source":"iana","extensions":["scs"]},"application/scvp-vp-request":{"source":"iana","extensions":["spq"]},"application/scvp-vp-response":{"source":"iana","extensions":["spp"]},"application/sdp":{"source":"iana","extensions":["sdp"]},"application/secevent+jwt":{"source":"iana"},"application/senml+cbor":{"source":"iana"},"application/senml+json":{"source":"iana","compressible":true},"application/senml+xml":{"source":"iana","compressible":true,"extensions":["senmlx"]},"application/senml-etch+cbor":{"source":"iana"},"application/senml-etch+json":{"source":"iana","compressible":true},"application/senml-exi":{"source":"iana"},"application/sensml+cbor":{"source":"iana"},"application/sensml+json":{"source":"iana","compressible":true},"application/sensml+xml":{"source":"iana","compressible":true,"extensions":["sensmlx"]},"application/sensml-exi":{"source":"iana"},"application/sep+xml":{"source":"iana","compressible":true},"application/sep-exi":{"source":"iana"},"application/session-info":{"source":"iana"},"application/set-payment":{"source":"iana"},"application/set-payment-initiation":{"source":"iana","extensions":["setpay"]},"application/set-registration":{"source":"iana"},"application/set-registration-initiation":{"source":"iana","extensions":["setreg"]},"application/sgml":{"source":"iana"},"application/sgml-open-catalog":{"source":"iana"},"application/shf+xml":{"source":"iana","compressible":true,"extensions":["shf"]},"application/sieve":{"source":"iana","extensions":["siv","sieve"]},"application/simple-filter+xml":{"source":"iana","compressible":true},"application/simple-message-summary":{"source":"iana"},"application/simplesymbolcontainer":{"source":"iana"},"application/sipc":{"source":"iana"},"application/slate":{"source":"iana"},"application/smil":{"source":"iana"},"application/smil+xml":{"source":"iana","compressible":true,"extensions":["smi","smil"]},"application/smpte336m":{"source":"iana"},"application/soap+fastinfoset":{"source":"iana"},"application/soap+xml":{"source":"iana","compressible":true},"application/sparql-query":{"source":"iana","extensions":["rq"]},"application/sparql-results+xml":{"source":"iana","compressible":true,"extensions":["srx"]},"application/spdx+json":{"source":"iana","compressible":true},"application/spirits-event+xml":{"source":"iana","compressible":true},"application/sql":{"source":"iana"},"application/srgs":{"source":"iana","extensions":["gram"]},"application/srgs+xml":{"source":"iana","compressible":true,"extensions":["grxml"]},"application/sru+xml":{"source":"iana","compressible":true,"extensions":["sru"]},"application/ssdl+xml":{"source":"apache","compressible":true,"extensions":["ssdl"]},"application/ssml+xml":{"source":"iana","compressible":true,"extensions":["ssml"]},"application/stix+json":{"source":"iana","compressible":true},"application/swid+xml":{"source":"iana","compressible":true,"extensions":["swidtag"]},"application/tamp-apex-update":{"source":"iana"},"application/tamp-apex-update-confirm":{"source":"iana"},"application/tamp-community-update":{"source":"iana"},"application/tamp-community-update-confirm":{"source":"iana"},"application/tamp-error":{"source":"iana"},"application/tamp-sequence-adjust":{"source":"iana"},"application/tamp-sequence-adjust-confirm":{"source":"iana"},"application/tamp-status-query":{"source":"iana"},"application/tamp-status-response":{"source":"iana"},"application/tamp-update":{"source":"iana"},"application/tamp-update-confirm":{"source":"iana"},"application/tar":{"compressible":true},"application/taxii+json":{"source":"iana","compressible":true},"application/td+json":{"source":"iana","compressible":true},"application/tei+xml":{"source":"iana","compressible":true,"extensions":["tei","teicorpus"]},"application/tetra_isi":{"source":"iana"},"application/thraud+xml":{"source":"iana","compressible":true,"extensions":["tfi"]},"application/timestamp-query":{"source":"iana"},"application/timestamp-reply":{"source":"iana"},"application/timestamped-data":{"source":"iana","extensions":["tsd"]},"application/tlsrpt+gzip":{"source":"iana"},"application/tlsrpt+json":{"source":"iana","compressible":true},"application/tnauthlist":{"source":"iana"},"application/token-introspection+jwt":{"source":"iana"},"application/toml":{"compressible":true,"extensions":["toml"]},"application/trickle-ice-sdpfrag":{"source":"iana"},"application/trig":{"source":"iana","extensions":["trig"]},"application/ttml+xml":{"source":"iana","compressible":true,"extensions":["ttml"]},"application/tve-trigger":{"source":"iana"},"application/tzif":{"source":"iana"},"application/tzif-leap":{"source":"iana"},"application/ubjson":{"compressible":false,"extensions":["ubj"]},"application/ulpfec":{"source":"iana"},"application/urc-grpsheet+xml":{"source":"iana","compressible":true},"application/urc-ressheet+xml":{"source":"iana","compressible":true,"extensions":["rsheet"]},"application/urc-targetdesc+xml":{"source":"iana","compressible":true,"extensions":["td"]},"application/urc-uisocketdesc+xml":{"source":"iana","compressible":true},"application/vcard+json":{"source":"iana","compressible":true},"application/vcard+xml":{"source":"iana","compressible":true},"application/vemmi":{"source":"iana"},"application/vividence.scriptfile":{"source":"apache"},"application/vnd.1000minds.decision-model+xml":{"source":"iana","compressible":true,"extensions":["1km"]},"application/vnd.3gpp-prose+xml":{"source":"iana","compressible":true},"application/vnd.3gpp-prose-pc3ch+xml":{"source":"iana","compressible":true},"application/vnd.3gpp-v2x-local-service-information":{"source":"iana"},"application/vnd.3gpp.5gnas":{"source":"iana"},"application/vnd.3gpp.access-transfer-events+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.bsf+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.gmop+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.gtpc":{"source":"iana"},"application/vnd.3gpp.interworking-data":{"source":"iana"},"application/vnd.3gpp.lpp":{"source":"iana"},"application/vnd.3gpp.mc-signalling-ear":{"source":"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-payload":{"source":"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-signalling":{"source":"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-user-profile+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-affiliation-command+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-floor-request+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-location-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-service-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-signed+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-ue-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-ue-init-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-user-profile+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-location-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-service-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-transmission-request+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-ue-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-user-profile+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mid-call+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.ngap":{"source":"iana"},"application/vnd.3gpp.pfcp":{"source":"iana"},"application/vnd.3gpp.pic-bw-large":{"source":"iana","extensions":["plb"]},"application/vnd.3gpp.pic-bw-small":{"source":"iana","extensions":["psb"]},"application/vnd.3gpp.pic-bw-var":{"source":"iana","extensions":["pvb"]},"application/vnd.3gpp.s1ap":{"source":"iana"},"application/vnd.3gpp.sms":{"source":"iana"},"application/vnd.3gpp.sms+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.srvcc-ext+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.srvcc-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.state-and-event-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.ussd+xml":{"source":"iana","compressible":true},"application/vnd.3gpp2.bcmcsinfo+xml":{"source":"iana","compressible":true},"application/vnd.3gpp2.sms":{"source":"iana"},"application/vnd.3gpp2.tcap":{"source":"iana","extensions":["tcap"]},"application/vnd.3lightssoftware.imagescal":{"source":"iana"},"application/vnd.3m.post-it-notes":{"source":"iana","extensions":["pwn"]},"application/vnd.accpac.simply.aso":{"source":"iana","extensions":["aso"]},"application/vnd.accpac.simply.imp":{"source":"iana","extensions":["imp"]},"application/vnd.acucobol":{"source":"iana","extensions":["acu"]},"application/vnd.acucorp":{"source":"iana","extensions":["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{"source":"apache","compressible":false,"extensions":["air"]},"application/vnd.adobe.flash.movie":{"source":"iana"},"application/vnd.adobe.formscentral.fcdt":{"source":"iana","extensions":["fcdt"]},"application/vnd.adobe.fxp":{"source":"iana","extensions":["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{"source":"iana"},"application/vnd.adobe.xdp+xml":{"source":"iana","compressible":true,"extensions":["xdp"]},"application/vnd.adobe.xfdf":{"source":"iana","extensions":["xfdf"]},"application/vnd.aether.imp":{"source":"iana"},"application/vnd.afpc.afplinedata":{"source":"iana"},"application/vnd.afpc.afplinedata-pagedef":{"source":"iana"},"application/vnd.afpc.cmoca-cmresource":{"source":"iana"},"application/vnd.afpc.foca-charset":{"source":"iana"},"application/vnd.afpc.foca-codedfont":{"source":"iana"},"application/vnd.afpc.foca-codepage":{"source":"iana"},"application/vnd.afpc.modca":{"source":"iana"},"application/vnd.afpc.modca-cmtable":{"source":"iana"},"application/vnd.afpc.modca-formdef":{"source":"iana"},"application/vnd.afpc.modca-mediummap":{"source":"iana"},"application/vnd.afpc.modca-objectcontainer":{"source":"iana"},"application/vnd.afpc.modca-overlay":{"source":"iana"},"application/vnd.afpc.modca-pagesegment":{"source":"iana"},"application/vnd.age":{"source":"iana","extensions":["age"]},"application/vnd.ah-barcode":{"source":"iana"},"application/vnd.ahead.space":{"source":"iana","extensions":["ahead"]},"application/vnd.airzip.filesecure.azf":{"source":"iana","extensions":["azf"]},"application/vnd.airzip.filesecure.azs":{"source":"iana","extensions":["azs"]},"application/vnd.amadeus+json":{"source":"iana","compressible":true},"application/vnd.amazon.ebook":{"source":"apache","extensions":["azw"]},"application/vnd.amazon.mobi8-ebook":{"source":"iana"},"application/vnd.americandynamics.acc":{"source":"iana","extensions":["acc"]},"application/vnd.amiga.ami":{"source":"iana","extensions":["ami"]},"application/vnd.amundsen.maze+xml":{"source":"iana","compressible":true},"application/vnd.android.ota":{"source":"iana"},"application/vnd.android.package-archive":{"source":"apache","compressible":false,"extensions":["apk"]},"application/vnd.anki":{"source":"iana"},"application/vnd.anser-web-certificate-issue-initiation":{"source":"iana","extensions":["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{"source":"apache","extensions":["fti"]},"application/vnd.antix.game-component":{"source":"iana","extensions":["atx"]},"application/vnd.apache.arrow.file":{"source":"iana"},"application/vnd.apache.arrow.stream":{"source":"iana"},"application/vnd.apache.thrift.binary":{"source":"iana"},"application/vnd.apache.thrift.compact":{"source":"iana"},"application/vnd.apache.thrift.json":{"source":"iana"},"application/vnd.api+json":{"source":"iana","compressible":true},"application/vnd.aplextor.warrp+json":{"source":"iana","compressible":true},"application/vnd.apothekende.reservation+json":{"source":"iana","compressible":true},"application/vnd.apple.installer+xml":{"source":"iana","compressible":true,"extensions":["mpkg"]},"application/vnd.apple.keynote":{"source":"iana","extensions":["key"]},"application/vnd.apple.mpegurl":{"source":"iana","extensions":["m3u8"]},"application/vnd.apple.numbers":{"source":"iana","extensions":["numbers"]},"application/vnd.apple.pages":{"source":"iana","extensions":["pages"]},"application/vnd.apple.pkpass":{"compressible":false,"extensions":["pkpass"]},"application/vnd.arastra.swi":{"source":"iana"},"application/vnd.aristanetworks.swi":{"source":"iana","extensions":["swi"]},"application/vnd.artisan+json":{"source":"iana","compressible":true},"application/vnd.artsquare":{"source":"iana"},"application/vnd.astraea-software.iota":{"source":"iana","extensions":["iota"]},"application/vnd.audiograph":{"source":"iana","extensions":["aep"]},"application/vnd.autopackage":{"source":"iana"},"application/vnd.avalon+json":{"source":"iana","compressible":true},"application/vnd.avistar+xml":{"source":"iana","compressible":true},"application/vnd.balsamiq.bmml+xml":{"source":"iana","compressible":true,"extensions":["bmml"]},"application/vnd.balsamiq.bmpr":{"source":"iana"},"application/vnd.banana-accounting":{"source":"iana"},"application/vnd.bbf.usp.error":{"source":"iana"},"application/vnd.bbf.usp.msg":{"source":"iana"},"application/vnd.bbf.usp.msg+json":{"source":"iana","compressible":true},"application/vnd.bekitzur-stech+json":{"source":"iana","compressible":true},"application/vnd.bint.med-content":{"source":"iana"},"application/vnd.biopax.rdf+xml":{"source":"iana","compressible":true},"application/vnd.blink-idb-value-wrapper":{"source":"iana"},"application/vnd.blueice.multipass":{"source":"iana","extensions":["mpm"]},"application/vnd.bluetooth.ep.oob":{"source":"iana"},"application/vnd.bluetooth.le.oob":{"source":"iana"},"application/vnd.bmi":{"source":"iana","extensions":["bmi"]},"application/vnd.bpf":{"source":"iana"},"application/vnd.bpf3":{"source":"iana"},"application/vnd.businessobjects":{"source":"iana","extensions":["rep"]},"application/vnd.byu.uapi+json":{"source":"iana","compressible":true},"application/vnd.cab-jscript":{"source":"iana"},"application/vnd.canon-cpdl":{"source":"iana"},"application/vnd.canon-lips":{"source":"iana"},"application/vnd.capasystems-pg+json":{"source":"iana","compressible":true},"application/vnd.cendio.thinlinc.clientconf":{"source":"iana"},"application/vnd.century-systems.tcp_stream":{"source":"iana"},"application/vnd.chemdraw+xml":{"source":"iana","compressible":true,"extensions":["cdxml"]},"application/vnd.chess-pgn":{"source":"iana"},"application/vnd.chipnuts.karaoke-mmd":{"source":"iana","extensions":["mmd"]},"application/vnd.ciedi":{"source":"iana"},"application/vnd.cinderella":{"source":"iana","extensions":["cdy"]},"application/vnd.cirpack.isdn-ext":{"source":"iana"},"application/vnd.citationstyles.style+xml":{"source":"iana","compressible":true,"extensions":["csl"]},"application/vnd.claymore":{"source":"iana","extensions":["cla"]},"application/vnd.cloanto.rp9":{"source":"iana","extensions":["rp9"]},"application/vnd.clonk.c4group":{"source":"iana","extensions":["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{"source":"iana","extensions":["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{"source":"iana","extensions":["c11amz"]},"application/vnd.coffeescript":{"source":"iana"},"application/vnd.collabio.xodocuments.document":{"source":"iana"},"application/vnd.collabio.xodocuments.document-template":{"source":"iana"},"application/vnd.collabio.xodocuments.presentation":{"source":"iana"},"application/vnd.collabio.xodocuments.presentation-template":{"source":"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{"source":"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{"source":"iana"},"application/vnd.collection+json":{"source":"iana","compressible":true},"application/vnd.collection.doc+json":{"source":"iana","compressible":true},"application/vnd.collection.next+json":{"source":"iana","compressible":true},"application/vnd.comicbook+zip":{"source":"iana","compressible":false},"application/vnd.comicbook-rar":{"source":"iana"},"application/vnd.commerce-battelle":{"source":"iana"},"application/vnd.commonspace":{"source":"iana","extensions":["csp"]},"application/vnd.contact.cmsg":{"source":"iana","extensions":["cdbcmsg"]},"application/vnd.coreos.ignition+json":{"source":"iana","compressible":true},"application/vnd.cosmocaller":{"source":"iana","extensions":["cmc"]},"application/vnd.crick.clicker":{"source":"iana","extensions":["clkx"]},"application/vnd.crick.clicker.keyboard":{"source":"iana","extensions":["clkk"]},"application/vnd.crick.clicker.palette":{"source":"iana","extensions":["clkp"]},"application/vnd.crick.clicker.template":{"source":"iana","extensions":["clkt"]},"application/vnd.crick.clicker.wordbank":{"source":"iana","extensions":["clkw"]},"application/vnd.criticaltools.wbs+xml":{"source":"iana","compressible":true,"extensions":["wbs"]},"application/vnd.cryptii.pipe+json":{"source":"iana","compressible":true},"application/vnd.crypto-shade-file":{"source":"iana"},"application/vnd.cryptomator.encrypted":{"source":"iana"},"application/vnd.cryptomator.vault":{"source":"iana"},"application/vnd.ctc-posml":{"source":"iana","extensions":["pml"]},"application/vnd.ctct.ws+xml":{"source":"iana","compressible":true},"application/vnd.cups-pdf":{"source":"iana"},"application/vnd.cups-postscript":{"source":"iana"},"application/vnd.cups-ppd":{"source":"iana","extensions":["ppd"]},"application/vnd.cups-raster":{"source":"iana"},"application/vnd.cups-raw":{"source":"iana"},"application/vnd.curl":{"source":"iana"},"application/vnd.curl.car":{"source":"apache","extensions":["car"]},"application/vnd.curl.pcurl":{"source":"apache","extensions":["pcurl"]},"application/vnd.cyan.dean.root+xml":{"source":"iana","compressible":true},"application/vnd.cybank":{"source":"iana"},"application/vnd.cyclonedx+json":{"source":"iana","compressible":true},"application/vnd.cyclonedx+xml":{"source":"iana","compressible":true},"application/vnd.d2l.coursepackage1p0+zip":{"source":"iana","compressible":false},"application/vnd.d3m-dataset":{"source":"iana"},"application/vnd.d3m-problem":{"source":"iana"},"application/vnd.dart":{"source":"iana","compressible":true,"extensions":["dart"]},"application/vnd.data-vision.rdz":{"source":"iana","extensions":["rdz"]},"application/vnd.datapackage+json":{"source":"iana","compressible":true},"application/vnd.dataresource+json":{"source":"iana","compressible":true},"application/vnd.dbf":{"source":"iana","extensions":["dbf"]},"application/vnd.debian.binary-package":{"source":"iana"},"application/vnd.dece.data":{"source":"iana","extensions":["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{"source":"iana","compressible":true,"extensions":["uvt","uvvt"]},"application/vnd.dece.unspecified":{"source":"iana","extensions":["uvx","uvvx"]},"application/vnd.dece.zip":{"source":"iana","extensions":["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{"source":"iana","extensions":["fe_launch"]},"application/vnd.desmume.movie":{"source":"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{"source":"iana"},"application/vnd.dm.delegation+xml":{"source":"iana","compressible":true},"application/vnd.dna":{"source":"iana","extensions":["dna"]},"application/vnd.document+json":{"source":"iana","compressible":true},"application/vnd.dolby.mlp":{"source":"apache","extensions":["mlp"]},"application/vnd.dolby.mobile.1":{"source":"iana"},"application/vnd.dolby.mobile.2":{"source":"iana"},"application/vnd.doremir.scorecloud-binary-document":{"source":"iana"},"application/vnd.dpgraph":{"source":"iana","extensions":["dpg"]},"application/vnd.dreamfactory":{"source":"iana","extensions":["dfac"]},"application/vnd.drive+json":{"source":"iana","compressible":true},"application/vnd.ds-keypoint":{"source":"apache","extensions":["kpxx"]},"application/vnd.dtg.local":{"source":"iana"},"application/vnd.dtg.local.flash":{"source":"iana"},"application/vnd.dtg.local.html":{"source":"iana"},"application/vnd.dvb.ait":{"source":"iana","extensions":["ait"]},"application/vnd.dvb.dvbisl+xml":{"source":"iana","compressible":true},"application/vnd.dvb.dvbj":{"source":"iana"},"application/vnd.dvb.esgcontainer":{"source":"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{"source":"iana"},"application/vnd.dvb.ipdcesgaccess":{"source":"iana"},"application/vnd.dvb.ipdcesgaccess2":{"source":"iana"},"application/vnd.dvb.ipdcesgpdd":{"source":"iana"},"application/vnd.dvb.ipdcroaming":{"source":"iana"},"application/vnd.dvb.iptv.alfec-base":{"source":"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{"source":"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-container+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-generic+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-ia-msglist+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-ia-registration-request+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-ia-registration-response+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-init+xml":{"source":"iana","compressible":true},"application/vnd.dvb.pfr":{"source":"iana"},"application/vnd.dvb.service":{"source":"iana","extensions":["svc"]},"application/vnd.dxr":{"source":"iana"},"application/vnd.dynageo":{"source":"iana","extensions":["geo"]},"application/vnd.dzr":{"source":"iana"},"application/vnd.easykaraoke.cdgdownload":{"source":"iana"},"application/vnd.ecdis-update":{"source":"iana"},"application/vnd.ecip.rlp":{"source":"iana"},"application/vnd.eclipse.ditto+json":{"source":"iana","compressible":true},"application/vnd.ecowin.chart":{"source":"iana","extensions":["mag"]},"application/vnd.ecowin.filerequest":{"source":"iana"},"application/vnd.ecowin.fileupdate":{"source":"iana"},"application/vnd.ecowin.series":{"source":"iana"},"application/vnd.ecowin.seriesrequest":{"source":"iana"},"application/vnd.ecowin.seriesupdate":{"source":"iana"},"application/vnd.efi.img":{"source":"iana"},"application/vnd.efi.iso":{"source":"iana"},"application/vnd.emclient.accessrequest+xml":{"source":"iana","compressible":true},"application/vnd.enliven":{"source":"iana","extensions":["nml"]},"application/vnd.enphase.envoy":{"source":"iana"},"application/vnd.eprints.data+xml":{"source":"iana","compressible":true},"application/vnd.epson.esf":{"source":"iana","extensions":["esf"]},"application/vnd.epson.msf":{"source":"iana","extensions":["msf"]},"application/vnd.epson.quickanime":{"source":"iana","extensions":["qam"]},"application/vnd.epson.salt":{"source":"iana","extensions":["slt"]},"application/vnd.epson.ssf":{"source":"iana","extensions":["ssf"]},"application/vnd.ericsson.quickcall":{"source":"iana"},"application/vnd.espass-espass+zip":{"source":"iana","compressible":false},"application/vnd.eszigno3+xml":{"source":"iana","compressible":true,"extensions":["es3","et3"]},"application/vnd.etsi.aoc+xml":{"source":"iana","compressible":true},"application/vnd.etsi.asic-e+zip":{"source":"iana","compressible":false},"application/vnd.etsi.asic-s+zip":{"source":"iana","compressible":false},"application/vnd.etsi.cug+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvcommand+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvdiscovery+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvprofile+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsad-bc+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsad-cod+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsad-npvr+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvservice+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsync+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvueprofile+xml":{"source":"iana","compressible":true},"application/vnd.etsi.mcid+xml":{"source":"iana","compressible":true},"application/vnd.etsi.mheg5":{"source":"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{"source":"iana","compressible":true},"application/vnd.etsi.pstn+xml":{"source":"iana","compressible":true},"application/vnd.etsi.sci+xml":{"source":"iana","compressible":true},"application/vnd.etsi.simservs+xml":{"source":"iana","compressible":true},"application/vnd.etsi.timestamp-token":{"source":"iana"},"application/vnd.etsi.tsl+xml":{"source":"iana","compressible":true},"application/vnd.etsi.tsl.der":{"source":"iana"},"application/vnd.eu.kasparian.car+json":{"source":"iana","compressible":true},"application/vnd.eudora.data":{"source":"iana"},"application/vnd.evolv.ecig.profile":{"source":"iana"},"application/vnd.evolv.ecig.settings":{"source":"iana"},"application/vnd.evolv.ecig.theme":{"source":"iana"},"application/vnd.exstream-empower+zip":{"source":"iana","compressible":false},"application/vnd.exstream-package":{"source":"iana"},"application/vnd.ezpix-album":{"source":"iana","extensions":["ez2"]},"application/vnd.ezpix-package":{"source":"iana","extensions":["ez3"]},"application/vnd.f-secure.mobile":{"source":"iana"},"application/vnd.familysearch.gedcom+zip":{"source":"iana","compressible":false},"application/vnd.fastcopy-disk-image":{"source":"iana"},"application/vnd.fdf":{"source":"iana","extensions":["fdf"]},"application/vnd.fdsn.mseed":{"source":"iana","extensions":["mseed"]},"application/vnd.fdsn.seed":{"source":"iana","extensions":["seed","dataless"]},"application/vnd.ffsns":{"source":"iana"},"application/vnd.ficlab.flb+zip":{"source":"iana","compressible":false},"application/vnd.filmit.zfc":{"source":"iana"},"application/vnd.fints":{"source":"iana"},"application/vnd.firemonkeys.cloudcell":{"source":"iana"},"application/vnd.flographit":{"source":"iana","extensions":["gph"]},"application/vnd.fluxtime.clip":{"source":"iana","extensions":["ftc"]},"application/vnd.font-fontforge-sfd":{"source":"iana"},"application/vnd.framemaker":{"source":"iana","extensions":["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{"source":"iana","extensions":["fnc"]},"application/vnd.frogans.ltf":{"source":"iana","extensions":["ltf"]},"application/vnd.fsc.weblaunch":{"source":"iana","extensions":["fsc"]},"application/vnd.fujifilm.fb.docuworks":{"source":"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{"source":"iana"},"application/vnd.fujifilm.fb.docuworks.container":{"source":"iana"},"application/vnd.fujifilm.fb.jfi+xml":{"source":"iana","compressible":true},"application/vnd.fujitsu.oasys":{"source":"iana","extensions":["oas"]},"application/vnd.fujitsu.oasys2":{"source":"iana","extensions":["oa2"]},"application/vnd.fujitsu.oasys3":{"source":"iana","extensions":["oa3"]},"application/vnd.fujitsu.oasysgp":{"source":"iana","extensions":["fg5"]},"application/vnd.fujitsu.oasysprs":{"source":"iana","extensions":["bh2"]},"application/vnd.fujixerox.art-ex":{"source":"iana"},"application/vnd.fujixerox.art4":{"source":"iana"},"application/vnd.fujixerox.ddd":{"source":"iana","extensions":["ddd"]},"application/vnd.fujixerox.docuworks":{"source":"iana","extensions":["xdw"]},"application/vnd.fujixerox.docuworks.binder":{"source":"iana","extensions":["xbd"]},"application/vnd.fujixerox.docuworks.container":{"source":"iana"},"application/vnd.fujixerox.hbpl":{"source":"iana"},"application/vnd.fut-misnet":{"source":"iana"},"application/vnd.futoin+cbor":{"source":"iana"},"application/vnd.futoin+json":{"source":"iana","compressible":true},"application/vnd.fuzzysheet":{"source":"iana","extensions":["fzs"]},"application/vnd.genomatix.tuxedo":{"source":"iana","extensions":["txd"]},"application/vnd.gentics.grd+json":{"source":"iana","compressible":true},"application/vnd.geo+json":{"source":"iana","compressible":true},"application/vnd.geocube+xml":{"source":"iana","compressible":true},"application/vnd.geogebra.file":{"source":"iana","extensions":["ggb"]},"application/vnd.geogebra.slides":{"source":"iana"},"application/vnd.geogebra.tool":{"source":"iana","extensions":["ggt"]},"application/vnd.geometry-explorer":{"source":"iana","extensions":["gex","gre"]},"application/vnd.geonext":{"source":"iana","extensions":["gxt"]},"application/vnd.geoplan":{"source":"iana","extensions":["g2w"]},"application/vnd.geospace":{"source":"iana","extensions":["g3w"]},"application/vnd.gerber":{"source":"iana"},"application/vnd.globalplatform.card-content-mgt":{"source":"iana"},"application/vnd.globalplatform.card-content-mgt-response":{"source":"iana"},"application/vnd.gmx":{"source":"iana","extensions":["gmx"]},"application/vnd.google-apps.document":{"compressible":false,"extensions":["gdoc"]},"application/vnd.google-apps.presentation":{"compressible":false,"extensions":["gslides"]},"application/vnd.google-apps.spreadsheet":{"compressible":false,"extensions":["gsheet"]},"application/vnd.google-earth.kml+xml":{"source":"iana","compressible":true,"extensions":["kml"]},"application/vnd.google-earth.kmz":{"source":"iana","compressible":false,"extensions":["kmz"]},"application/vnd.gov.sk.e-form+xml":{"source":"iana","compressible":true},"application/vnd.gov.sk.e-form+zip":{"source":"iana","compressible":false},"application/vnd.gov.sk.xmldatacontainer+xml":{"source":"iana","compressible":true},"application/vnd.grafeq":{"source":"iana","extensions":["gqf","gqs"]},"application/vnd.gridmp":{"source":"iana"},"application/vnd.groove-account":{"source":"iana","extensions":["gac"]},"application/vnd.groove-help":{"source":"iana","extensions":["ghf"]},"application/vnd.groove-identity-message":{"source":"iana","extensions":["gim"]},"application/vnd.groove-injector":{"source":"iana","extensions":["grv"]},"application/vnd.groove-tool-message":{"source":"iana","extensions":["gtm"]},"application/vnd.groove-tool-template":{"source":"iana","extensions":["tpl"]},"application/vnd.groove-vcard":{"source":"iana","extensions":["vcg"]},"application/vnd.hal+json":{"source":"iana","compressible":true},"application/vnd.hal+xml":{"source":"iana","compressible":true,"extensions":["hal"]},"application/vnd.handheld-entertainment+xml":{"source":"iana","compressible":true,"extensions":["zmm"]},"application/vnd.hbci":{"source":"iana","extensions":["hbci"]},"application/vnd.hc+json":{"source":"iana","compressible":true},"application/vnd.hcl-bireports":{"source":"iana"},"application/vnd.hdt":{"source":"iana"},"application/vnd.heroku+json":{"source":"iana","compressible":true},"application/vnd.hhe.lesson-player":{"source":"iana","extensions":["les"]},"application/vnd.hl7cda+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.hl7v2+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.hp-hpgl":{"source":"iana","extensions":["hpgl"]},"application/vnd.hp-hpid":{"source":"iana","extensions":["hpid"]},"application/vnd.hp-hps":{"source":"iana","extensions":["hps"]},"application/vnd.hp-jlyt":{"source":"iana","extensions":["jlt"]},"application/vnd.hp-pcl":{"source":"iana","extensions":["pcl"]},"application/vnd.hp-pclxl":{"source":"iana","extensions":["pclxl"]},"application/vnd.httphone":{"source":"iana"},"application/vnd.hydrostatix.sof-data":{"source":"iana","extensions":["sfd-hdstx"]},"application/vnd.hyper+json":{"source":"iana","compressible":true},"application/vnd.hyper-item+json":{"source":"iana","compressible":true},"application/vnd.hyperdrive+json":{"source":"iana","compressible":true},"application/vnd.hzn-3d-crossword":{"source":"iana"},"application/vnd.ibm.afplinedata":{"source":"iana"},"application/vnd.ibm.electronic-media":{"source":"iana"},"application/vnd.ibm.minipay":{"source":"iana","extensions":["mpy"]},"application/vnd.ibm.modcap":{"source":"iana","extensions":["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{"source":"iana","extensions":["irm"]},"application/vnd.ibm.secure-container":{"source":"iana","extensions":["sc"]},"application/vnd.iccprofile":{"source":"iana","extensions":["icc","icm"]},"application/vnd.ieee.1905":{"source":"iana"},"application/vnd.igloader":{"source":"iana","extensions":["igl"]},"application/vnd.imagemeter.folder+zip":{"source":"iana","compressible":false},"application/vnd.imagemeter.image+zip":{"source":"iana","compressible":false},"application/vnd.immervision-ivp":{"source":"iana","extensions":["ivp"]},"application/vnd.immervision-ivu":{"source":"iana","extensions":["ivu"]},"application/vnd.ims.imsccv1p1":{"source":"iana"},"application/vnd.ims.imsccv1p2":{"source":"iana"},"application/vnd.ims.imsccv1p3":{"source":"iana"},"application/vnd.ims.lis.v2.result+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolproxy+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolproxy.id+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolsettings+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolsettings.simple+json":{"source":"iana","compressible":true},"application/vnd.informedcontrol.rms+xml":{"source":"iana","compressible":true},"application/vnd.informix-visionary":{"source":"iana"},"application/vnd.infotech.project":{"source":"iana"},"application/vnd.infotech.project+xml":{"source":"iana","compressible":true},"application/vnd.innopath.wamp.notification":{"source":"iana"},"application/vnd.insors.igm":{"source":"iana","extensions":["igm"]},"application/vnd.intercon.formnet":{"source":"iana","extensions":["xpw","xpx"]},"application/vnd.intergeo":{"source":"iana","extensions":["i2g"]},"application/vnd.intertrust.digibox":{"source":"iana"},"application/vnd.intertrust.nncp":{"source":"iana"},"application/vnd.intu.qbo":{"source":"iana","extensions":["qbo"]},"application/vnd.intu.qfx":{"source":"iana","extensions":["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.conceptitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.knowledgeitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.newsitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.newsmessage+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.packageitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.planningitem+xml":{"source":"iana","compressible":true},"application/vnd.ipunplugged.rcprofile":{"source":"iana","extensions":["rcprofile"]},"application/vnd.irepository.package+xml":{"source":"iana","compressible":true,"extensions":["irp"]},"application/vnd.is-xpr":{"source":"iana","extensions":["xpr"]},"application/vnd.isac.fcs":{"source":"iana","extensions":["fcs"]},"application/vnd.iso11783-10+zip":{"source":"iana","compressible":false},"application/vnd.jam":{"source":"iana","extensions":["jam"]},"application/vnd.japannet-directory-service":{"source":"iana"},"application/vnd.japannet-jpnstore-wakeup":{"source":"iana"},"application/vnd.japannet-payment-wakeup":{"source":"iana"},"application/vnd.japannet-registration":{"source":"iana"},"application/vnd.japannet-registration-wakeup":{"source":"iana"},"application/vnd.japannet-setstore-wakeup":{"source":"iana"},"application/vnd.japannet-verification":{"source":"iana"},"application/vnd.japannet-verification-wakeup":{"source":"iana"},"application/vnd.jcp.javame.midlet-rms":{"source":"iana","extensions":["rms"]},"application/vnd.jisp":{"source":"iana","extensions":["jisp"]},"application/vnd.joost.joda-archive":{"source":"iana","extensions":["joda"]},"application/vnd.jsk.isdn-ngn":{"source":"iana"},"application/vnd.kahootz":{"source":"iana","extensions":["ktz","ktr"]},"application/vnd.kde.karbon":{"source":"iana","extensions":["karbon"]},"application/vnd.kde.kchart":{"source":"iana","extensions":["chrt"]},"application/vnd.kde.kformula":{"source":"iana","extensions":["kfo"]},"application/vnd.kde.kivio":{"source":"iana","extensions":["flw"]},"application/vnd.kde.kontour":{"source":"iana","extensions":["kon"]},"application/vnd.kde.kpresenter":{"source":"iana","extensions":["kpr","kpt"]},"application/vnd.kde.kspread":{"source":"iana","extensions":["ksp"]},"application/vnd.kde.kword":{"source":"iana","extensions":["kwd","kwt"]},"application/vnd.kenameaapp":{"source":"iana","extensions":["htke"]},"application/vnd.kidspiration":{"source":"iana","extensions":["kia"]},"application/vnd.kinar":{"source":"iana","extensions":["kne","knp"]},"application/vnd.koan":{"source":"iana","extensions":["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{"source":"iana","extensions":["sse"]},"application/vnd.las":{"source":"iana"},"application/vnd.las.las+json":{"source":"iana","compressible":true},"application/vnd.las.las+xml":{"source":"iana","compressible":true,"extensions":["lasxml"]},"application/vnd.laszip":{"source":"iana"},"application/vnd.leap+json":{"source":"iana","compressible":true},"application/vnd.liberty-request+xml":{"source":"iana","compressible":true},"application/vnd.llamagraphics.life-balance.desktop":{"source":"iana","extensions":["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{"source":"iana","compressible":true,"extensions":["lbe"]},"application/vnd.logipipe.circuit+zip":{"source":"iana","compressible":false},"application/vnd.loom":{"source":"iana"},"application/vnd.lotus-1-2-3":{"source":"iana","extensions":["123"]},"application/vnd.lotus-approach":{"source":"iana","extensions":["apr"]},"application/vnd.lotus-freelance":{"source":"iana","extensions":["pre"]},"application/vnd.lotus-notes":{"source":"iana","extensions":["nsf"]},"application/vnd.lotus-organizer":{"source":"iana","extensions":["org"]},"application/vnd.lotus-screencam":{"source":"iana","extensions":["scm"]},"application/vnd.lotus-wordpro":{"source":"iana","extensions":["lwp"]},"application/vnd.macports.portpkg":{"source":"iana","extensions":["portpkg"]},"application/vnd.mapbox-vector-tile":{"source":"iana","extensions":["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{"source":"iana","compressible":true},"application/vnd.marlin.drm.conftoken+xml":{"source":"iana","compressible":true},"application/vnd.marlin.drm.license+xml":{"source":"iana","compressible":true},"application/vnd.marlin.drm.mdcf":{"source":"iana"},"application/vnd.mason+json":{"source":"iana","compressible":true},"application/vnd.maxar.archive.3tz+zip":{"source":"iana","compressible":false},"application/vnd.maxmind.maxmind-db":{"source":"iana"},"application/vnd.mcd":{"source":"iana","extensions":["mcd"]},"application/vnd.medcalcdata":{"source":"iana","extensions":["mc1"]},"application/vnd.mediastation.cdkey":{"source":"iana","extensions":["cdkey"]},"application/vnd.meridian-slingshot":{"source":"iana"},"application/vnd.mfer":{"source":"iana","extensions":["mwf"]},"application/vnd.mfmp":{"source":"iana","extensions":["mfm"]},"application/vnd.micro+json":{"source":"iana","compressible":true},"application/vnd.micrografx.flo":{"source":"iana","extensions":["flo"]},"application/vnd.micrografx.igx":{"source":"iana","extensions":["igx"]},"application/vnd.microsoft.portable-executable":{"source":"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{"source":"iana"},"application/vnd.miele+json":{"source":"iana","compressible":true},"application/vnd.mif":{"source":"iana","extensions":["mif"]},"application/vnd.minisoft-hp3000-save":{"source":"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{"source":"iana"},"application/vnd.mobius.daf":{"source":"iana","extensions":["daf"]},"application/vnd.mobius.dis":{"source":"iana","extensions":["dis"]},"application/vnd.mobius.mbk":{"source":"iana","extensions":["mbk"]},"application/vnd.mobius.mqy":{"source":"iana","extensions":["mqy"]},"application/vnd.mobius.msl":{"source":"iana","extensions":["msl"]},"application/vnd.mobius.plc":{"source":"iana","extensions":["plc"]},"application/vnd.mobius.txf":{"source":"iana","extensions":["txf"]},"application/vnd.mophun.application":{"source":"iana","extensions":["mpn"]},"application/vnd.mophun.certificate":{"source":"iana","extensions":["mpc"]},"application/vnd.motorola.flexsuite":{"source":"iana"},"application/vnd.motorola.flexsuite.adsi":{"source":"iana"},"application/vnd.motorola.flexsuite.fis":{"source":"iana"},"application/vnd.motorola.flexsuite.gotap":{"source":"iana"},"application/vnd.motorola.flexsuite.kmr":{"source":"iana"},"application/vnd.motorola.flexsuite.ttc":{"source":"iana"},"application/vnd.motorola.flexsuite.wem":{"source":"iana"},"application/vnd.motorola.iprm":{"source":"iana"},"application/vnd.mozilla.xul+xml":{"source":"iana","compressible":true,"extensions":["xul"]},"application/vnd.ms-3mfdocument":{"source":"iana"},"application/vnd.ms-artgalry":{"source":"iana","extensions":["cil"]},"application/vnd.ms-asf":{"source":"iana"},"application/vnd.ms-cab-compressed":{"source":"iana","extensions":["cab"]},"application/vnd.ms-color.iccprofile":{"source":"apache"},"application/vnd.ms-excel":{"source":"iana","compressible":false,"extensions":["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{"source":"iana","extensions":["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{"source":"iana","extensions":["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{"source":"iana","extensions":["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{"source":"iana","extensions":["xltm"]},"application/vnd.ms-fontobject":{"source":"iana","compressible":true,"extensions":["eot"]},"application/vnd.ms-htmlhelp":{"source":"iana","extensions":["chm"]},"application/vnd.ms-ims":{"source":"iana","extensions":["ims"]},"application/vnd.ms-lrm":{"source":"iana","extensions":["lrm"]},"application/vnd.ms-office.activex+xml":{"source":"iana","compressible":true},"application/vnd.ms-officetheme":{"source":"iana","extensions":["thmx"]},"application/vnd.ms-opentype":{"source":"apache","compressible":true},"application/vnd.ms-outlook":{"compressible":false,"extensions":["msg"]},"application/vnd.ms-package.obfuscated-opentype":{"source":"apache"},"application/vnd.ms-pki.seccat":{"source":"apache","extensions":["cat"]},"application/vnd.ms-pki.stl":{"source":"apache","extensions":["stl"]},"application/vnd.ms-playready.initiator+xml":{"source":"iana","compressible":true},"application/vnd.ms-powerpoint":{"source":"iana","compressible":false,"extensions":["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{"source":"iana","extensions":["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{"source":"iana","extensions":["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{"source":"iana","extensions":["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{"source":"iana","extensions":["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{"source":"iana","extensions":["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{"source":"iana","compressible":true},"application/vnd.ms-printing.printticket+xml":{"source":"apache","compressible":true},"application/vnd.ms-printschematicket+xml":{"source":"iana","compressible":true},"application/vnd.ms-project":{"source":"iana","extensions":["mpp","mpt"]},"application/vnd.ms-tnef":{"source":"iana"},"application/vnd.ms-windows.devicepairing":{"source":"iana"},"application/vnd.ms-windows.nwprinting.oob":{"source":"iana"},"application/vnd.ms-windows.printerpairing":{"source":"iana"},"application/vnd.ms-windows.wsd.oob":{"source":"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{"source":"iana"},"application/vnd.ms-wmdrm.lic-resp":{"source":"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{"source":"iana"},"application/vnd.ms-wmdrm.meter-resp":{"source":"iana"},"application/vnd.ms-word.document.macroenabled.12":{"source":"iana","extensions":["docm"]},"application/vnd.ms-word.template.macroenabled.12":{"source":"iana","extensions":["dotm"]},"application/vnd.ms-works":{"source":"iana","extensions":["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{"source":"iana","extensions":["wpl"]},"application/vnd.ms-xpsdocument":{"source":"iana","compressible":false,"extensions":["xps"]},"application/vnd.msa-disk-image":{"source":"iana"},"application/vnd.mseq":{"source":"iana","extensions":["mseq"]},"application/vnd.msign":{"source":"iana"},"application/vnd.multiad.creator":{"source":"iana"},"application/vnd.multiad.creator.cif":{"source":"iana"},"application/vnd.music-niff":{"source":"iana"},"application/vnd.musician":{"source":"iana","extensions":["mus"]},"application/vnd.muvee.style":{"source":"iana","extensions":["msty"]},"application/vnd.mynfc":{"source":"iana","extensions":["taglet"]},"application/vnd.nacamar.ybrid+json":{"source":"iana","compressible":true},"application/vnd.ncd.control":{"source":"iana"},"application/vnd.ncd.reference":{"source":"iana"},"application/vnd.nearst.inv+json":{"source":"iana","compressible":true},"application/vnd.nebumind.line":{"source":"iana"},"application/vnd.nervana":{"source":"iana"},"application/vnd.netfpx":{"source":"iana"},"application/vnd.neurolanguage.nlu":{"source":"iana","extensions":["nlu"]},"application/vnd.nimn":{"source":"iana"},"application/vnd.nintendo.nitro.rom":{"source":"iana"},"application/vnd.nintendo.snes.rom":{"source":"iana"},"application/vnd.nitf":{"source":"iana","extensions":["ntf","nitf"]},"application/vnd.noblenet-directory":{"source":"iana","extensions":["nnd"]},"application/vnd.noblenet-sealer":{"source":"iana","extensions":["nns"]},"application/vnd.noblenet-web":{"source":"iana","extensions":["nnw"]},"application/vnd.nokia.catalogs":{"source":"iana"},"application/vnd.nokia.conml+wbxml":{"source":"iana"},"application/vnd.nokia.conml+xml":{"source":"iana","compressible":true},"application/vnd.nokia.iptv.config+xml":{"source":"iana","compressible":true},"application/vnd.nokia.isds-radio-presets":{"source":"iana"},"application/vnd.nokia.landmark+wbxml":{"source":"iana"},"application/vnd.nokia.landmark+xml":{"source":"iana","compressible":true},"application/vnd.nokia.landmarkcollection+xml":{"source":"iana","compressible":true},"application/vnd.nokia.n-gage.ac+xml":{"source":"iana","compressible":true,"extensions":["ac"]},"application/vnd.nokia.n-gage.data":{"source":"iana","extensions":["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{"source":"iana","extensions":["n-gage"]},"application/vnd.nokia.ncd":{"source":"iana"},"application/vnd.nokia.pcd+wbxml":{"source":"iana"},"application/vnd.nokia.pcd+xml":{"source":"iana","compressible":true},"application/vnd.nokia.radio-preset":{"source":"iana","extensions":["rpst"]},"application/vnd.nokia.radio-presets":{"source":"iana","extensions":["rpss"]},"application/vnd.novadigm.edm":{"source":"iana","extensions":["edm"]},"application/vnd.novadigm.edx":{"source":"iana","extensions":["edx"]},"application/vnd.novadigm.ext":{"source":"iana","extensions":["ext"]},"application/vnd.ntt-local.content-share":{"source":"iana"},"application/vnd.ntt-local.file-transfer":{"source":"iana"},"application/vnd.ntt-local.ogw_remote-access":{"source":"iana"},"application/vnd.ntt-local.sip-ta_remote":{"source":"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{"source":"iana"},"application/vnd.oasis.opendocument.chart":{"source":"iana","extensions":["odc"]},"application/vnd.oasis.opendocument.chart-template":{"source":"iana","extensions":["otc"]},"application/vnd.oasis.opendocument.database":{"source":"iana","extensions":["odb"]},"application/vnd.oasis.opendocument.formula":{"source":"iana","extensions":["odf"]},"application/vnd.oasis.opendocument.formula-template":{"source":"iana","extensions":["odft"]},"application/vnd.oasis.opendocument.graphics":{"source":"iana","compressible":false,"extensions":["odg"]},"application/vnd.oasis.opendocument.graphics-template":{"source":"iana","extensions":["otg"]},"application/vnd.oasis.opendocument.image":{"source":"iana","extensions":["odi"]},"application/vnd.oasis.opendocument.image-template":{"source":"iana","extensions":["oti"]},"application/vnd.oasis.opendocument.presentation":{"source":"iana","compressible":false,"extensions":["odp"]},"application/vnd.oasis.opendocument.presentation-template":{"source":"iana","extensions":["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{"source":"iana","compressible":false,"extensions":["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{"source":"iana","extensions":["ots"]},"application/vnd.oasis.opendocument.text":{"source":"iana","compressible":false,"extensions":["odt"]},"application/vnd.oasis.opendocument.text-master":{"source":"iana","extensions":["odm"]},"application/vnd.oasis.opendocument.text-template":{"source":"iana","extensions":["ott"]},"application/vnd.oasis.opendocument.text-web":{"source":"iana","extensions":["oth"]},"application/vnd.obn":{"source":"iana"},"application/vnd.ocf+cbor":{"source":"iana"},"application/vnd.oci.image.manifest.v1+json":{"source":"iana","compressible":true},"application/vnd.oftn.l10n+json":{"source":"iana","compressible":true},"application/vnd.oipf.contentaccessdownload+xml":{"source":"iana","compressible":true},"application/vnd.oipf.contentaccessstreaming+xml":{"source":"iana","compressible":true},"application/vnd.oipf.cspg-hexbinary":{"source":"iana"},"application/vnd.oipf.dae.svg+xml":{"source":"iana","compressible":true},"application/vnd.oipf.dae.xhtml+xml":{"source":"iana","compressible":true},"application/vnd.oipf.mippvcontrolmessage+xml":{"source":"iana","compressible":true},"application/vnd.oipf.pae.gem":{"source":"iana"},"application/vnd.oipf.spdiscovery+xml":{"source":"iana","compressible":true},"application/vnd.oipf.spdlist+xml":{"source":"iana","compressible":true},"application/vnd.oipf.ueprofile+xml":{"source":"iana","compressible":true},"application/vnd.oipf.userprofile+xml":{"source":"iana","compressible":true},"application/vnd.olpc-sugar":{"source":"iana","extensions":["xo"]},"application/vnd.oma-scws-config":{"source":"iana"},"application/vnd.oma-scws-http-request":{"source":"iana"},"application/vnd.oma-scws-http-response":{"source":"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.drm-trigger+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.imd+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.ltkm":{"source":"iana"},"application/vnd.oma.bcast.notification+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.provisioningtrigger":{"source":"iana"},"application/vnd.oma.bcast.sgboot":{"source":"iana"},"application/vnd.oma.bcast.sgdd+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.sgdu":{"source":"iana"},"application/vnd.oma.bcast.simple-symbol-container":{"source":"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.sprov+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.stkm":{"source":"iana"},"application/vnd.oma.cab-address-book+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-feature-handler+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-pcc+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-subs-invite+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-user-prefs+xml":{"source":"iana","compressible":true},"application/vnd.oma.dcd":{"source":"iana"},"application/vnd.oma.dcdc":{"source":"iana"},"application/vnd.oma.dd2+xml":{"source":"iana","compressible":true,"extensions":["dd2"]},"application/vnd.oma.drm.risd+xml":{"source":"iana","compressible":true},"application/vnd.oma.group-usage-list+xml":{"source":"iana","compressible":true},"application/vnd.oma.lwm2m+cbor":{"source":"iana"},"application/vnd.oma.lwm2m+json":{"source":"iana","compressible":true},"application/vnd.oma.lwm2m+tlv":{"source":"iana"},"application/vnd.oma.pal+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.detailed-progress-report+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.final-report+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.groups+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.invocation-descriptor+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.optimized-progress-report+xml":{"source":"iana","compressible":true},"application/vnd.oma.push":{"source":"iana"},"application/vnd.oma.scidm.messages+xml":{"source":"iana","compressible":true},"application/vnd.oma.xcap-directory+xml":{"source":"iana","compressible":true},"application/vnd.omads-email+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.omads-file+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.omads-folder+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.omaloc-supl-init":{"source":"iana"},"application/vnd.onepager":{"source":"iana"},"application/vnd.onepagertamp":{"source":"iana"},"application/vnd.onepagertamx":{"source":"iana"},"application/vnd.onepagertat":{"source":"iana"},"application/vnd.onepagertatp":{"source":"iana"},"application/vnd.onepagertatx":{"source":"iana"},"application/vnd.openblox.game+xml":{"source":"iana","compressible":true,"extensions":["obgx"]},"application/vnd.openblox.game-binary":{"source":"iana"},"application/vnd.openeye.oeb":{"source":"iana"},"application/vnd.openofficeorg.extension":{"source":"apache","extensions":["oxt"]},"application/vnd.openstreetmap.data+xml":{"source":"iana","compressible":true,"extensions":["osm"]},"application/vnd.opentimestamps.ots":{"source":"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawing+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{"source":"iana","compressible":false,"extensions":["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slide":{"source":"iana","extensions":["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{"source":"iana","extensions":["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.template":{"source":"iana","extensions":["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"source":"iana","compressible":false,"extensions":["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{"source":"iana","extensions":["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.theme+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.vmldrawing":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{"source":"iana","compressible":false,"extensions":["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{"source":"iana","extensions":["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-package.core-properties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-package.relationships+xml":{"source":"iana","compressible":true},"application/vnd.oracle.resource+json":{"source":"iana","compressible":true},"application/vnd.orange.indata":{"source":"iana"},"application/vnd.osa.netdeploy":{"source":"iana"},"application/vnd.osgeo.mapguide.package":{"source":"iana","extensions":["mgp"]},"application/vnd.osgi.bundle":{"source":"iana"},"application/vnd.osgi.dp":{"source":"iana","extensions":["dp"]},"application/vnd.osgi.subsystem":{"source":"iana","extensions":["esa"]},"application/vnd.otps.ct-kip+xml":{"source":"iana","compressible":true},"application/vnd.oxli.countgraph":{"source":"iana"},"application/vnd.pagerduty+json":{"source":"iana","compressible":true},"application/vnd.palm":{"source":"iana","extensions":["pdb","pqa","oprc"]},"application/vnd.panoply":{"source":"iana"},"application/vnd.paos.xml":{"source":"iana"},"application/vnd.patentdive":{"source":"iana"},"application/vnd.patientecommsdoc":{"source":"iana"},"application/vnd.pawaafile":{"source":"iana","extensions":["paw"]},"application/vnd.pcos":{"source":"iana"},"application/vnd.pg.format":{"source":"iana","extensions":["str"]},"application/vnd.pg.osasli":{"source":"iana","extensions":["ei6"]},"application/vnd.piaccess.application-licence":{"source":"iana"},"application/vnd.picsel":{"source":"iana","extensions":["efif"]},"application/vnd.pmi.widget":{"source":"iana","extensions":["wg"]},"application/vnd.poc.group-advertisement+xml":{"source":"iana","compressible":true},"application/vnd.pocketlearn":{"source":"iana","extensions":["plf"]},"application/vnd.powerbuilder6":{"source":"iana","extensions":["pbd"]},"application/vnd.powerbuilder6-s":{"source":"iana"},"application/vnd.powerbuilder7":{"source":"iana"},"application/vnd.powerbuilder7-s":{"source":"iana"},"application/vnd.powerbuilder75":{"source":"iana"},"application/vnd.powerbuilder75-s":{"source":"iana"},"application/vnd.preminet":{"source":"iana"},"application/vnd.previewsystems.box":{"source":"iana","extensions":["box"]},"application/vnd.proteus.magazine":{"source":"iana","extensions":["mgz"]},"application/vnd.psfs":{"source":"iana"},"application/vnd.publishare-delta-tree":{"source":"iana","extensions":["qps"]},"application/vnd.pvi.ptid1":{"source":"iana","extensions":["ptid"]},"application/vnd.pwg-multiplexed":{"source":"iana"},"application/vnd.pwg-xhtml-print+xml":{"source":"iana","compressible":true},"application/vnd.qualcomm.brew-app-res":{"source":"iana"},"application/vnd.quarantainenet":{"source":"iana"},"application/vnd.quark.quarkxpress":{"source":"iana","extensions":["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{"source":"iana"},"application/vnd.radisys.moml+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-conf+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-conn+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-dialog+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-stream+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-conf+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-base+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-fax-detect+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-group+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-speech+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-transform+xml":{"source":"iana","compressible":true},"application/vnd.rainstor.data":{"source":"iana"},"application/vnd.rapid":{"source":"iana"},"application/vnd.rar":{"source":"iana","extensions":["rar"]},"application/vnd.realvnc.bed":{"source":"iana","extensions":["bed"]},"application/vnd.recordare.musicxml":{"source":"iana","extensions":["mxl"]},"application/vnd.recordare.musicxml+xml":{"source":"iana","compressible":true,"extensions":["musicxml"]},"application/vnd.renlearn.rlprint":{"source":"iana"},"application/vnd.resilient.logic":{"source":"iana"},"application/vnd.restful+json":{"source":"iana","compressible":true},"application/vnd.rig.cryptonote":{"source":"iana","extensions":["cryptonote"]},"application/vnd.rim.cod":{"source":"apache","extensions":["cod"]},"application/vnd.rn-realmedia":{"source":"apache","extensions":["rm"]},"application/vnd.rn-realmedia-vbr":{"source":"apache","extensions":["rmvb"]},"application/vnd.route66.link66+xml":{"source":"iana","compressible":true,"extensions":["link66"]},"application/vnd.rs-274x":{"source":"iana"},"application/vnd.ruckus.download":{"source":"iana"},"application/vnd.s3sms":{"source":"iana"},"application/vnd.sailingtracker.track":{"source":"iana","extensions":["st"]},"application/vnd.sar":{"source":"iana"},"application/vnd.sbm.cid":{"source":"iana"},"application/vnd.sbm.mid2":{"source":"iana"},"application/vnd.scribus":{"source":"iana"},"application/vnd.sealed.3df":{"source":"iana"},"application/vnd.sealed.csf":{"source":"iana"},"application/vnd.sealed.doc":{"source":"iana"},"application/vnd.sealed.eml":{"source":"iana"},"application/vnd.sealed.mht":{"source":"iana"},"application/vnd.sealed.net":{"source":"iana"},"application/vnd.sealed.ppt":{"source":"iana"},"application/vnd.sealed.tiff":{"source":"iana"},"application/vnd.sealed.xls":{"source":"iana"},"application/vnd.sealedmedia.softseal.html":{"source":"iana"},"application/vnd.sealedmedia.softseal.pdf":{"source":"iana"},"application/vnd.seemail":{"source":"iana","extensions":["see"]},"application/vnd.seis+json":{"source":"iana","compressible":true},"application/vnd.sema":{"source":"iana","extensions":["sema"]},"application/vnd.semd":{"source":"iana","extensions":["semd"]},"application/vnd.semf":{"source":"iana","extensions":["semf"]},"application/vnd.shade-save-file":{"source":"iana"},"application/vnd.shana.informed.formdata":{"source":"iana","extensions":["ifm"]},"application/vnd.shana.informed.formtemplate":{"source":"iana","extensions":["itp"]},"application/vnd.shana.informed.interchange":{"source":"iana","extensions":["iif"]},"application/vnd.shana.informed.package":{"source":"iana","extensions":["ipk"]},"application/vnd.shootproof+json":{"source":"iana","compressible":true},"application/vnd.shopkick+json":{"source":"iana","compressible":true},"application/vnd.shp":{"source":"iana"},"application/vnd.shx":{"source":"iana"},"application/vnd.sigrok.session":{"source":"iana"},"application/vnd.simtech-mindmapper":{"source":"iana","extensions":["twd","twds"]},"application/vnd.siren+json":{"source":"iana","compressible":true},"application/vnd.smaf":{"source":"iana","extensions":["mmf"]},"application/vnd.smart.notebook":{"source":"iana"},"application/vnd.smart.teacher":{"source":"iana","extensions":["teacher"]},"application/vnd.snesdev-page-table":{"source":"iana"},"application/vnd.software602.filler.form+xml":{"source":"iana","compressible":true,"extensions":["fo"]},"application/vnd.software602.filler.form-xml-zip":{"source":"iana"},"application/vnd.solent.sdkm+xml":{"source":"iana","compressible":true,"extensions":["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{"source":"iana","extensions":["dxp"]},"application/vnd.spotfire.sfs":{"source":"iana","extensions":["sfs"]},"application/vnd.sqlite3":{"source":"iana"},"application/vnd.sss-cod":{"source":"iana"},"application/vnd.sss-dtf":{"source":"iana"},"application/vnd.sss-ntf":{"source":"iana"},"application/vnd.stardivision.calc":{"source":"apache","extensions":["sdc"]},"application/vnd.stardivision.draw":{"source":"apache","extensions":["sda"]},"application/vnd.stardivision.impress":{"source":"apache","extensions":["sdd"]},"application/vnd.stardivision.math":{"source":"apache","extensions":["smf"]},"application/vnd.stardivision.writer":{"source":"apache","extensions":["sdw","vor"]},"application/vnd.stardivision.writer-global":{"source":"apache","extensions":["sgl"]},"application/vnd.stepmania.package":{"source":"iana","extensions":["smzip"]},"application/vnd.stepmania.stepchart":{"source":"iana","extensions":["sm"]},"application/vnd.street-stream":{"source":"iana"},"application/vnd.sun.wadl+xml":{"source":"iana","compressible":true,"extensions":["wadl"]},"application/vnd.sun.xml.calc":{"source":"apache","extensions":["sxc"]},"application/vnd.sun.xml.calc.template":{"source":"apache","extensions":["stc"]},"application/vnd.sun.xml.draw":{"source":"apache","extensions":["sxd"]},"application/vnd.sun.xml.draw.template":{"source":"apache","extensions":["std"]},"application/vnd.sun.xml.impress":{"source":"apache","extensions":["sxi"]},"application/vnd.sun.xml.impress.template":{"source":"apache","extensions":["sti"]},"application/vnd.sun.xml.math":{"source":"apache","extensions":["sxm"]},"application/vnd.sun.xml.writer":{"source":"apache","extensions":["sxw"]},"application/vnd.sun.xml.writer.global":{"source":"apache","extensions":["sxg"]},"application/vnd.sun.xml.writer.template":{"source":"apache","extensions":["stw"]},"application/vnd.sus-calendar":{"source":"iana","extensions":["sus","susp"]},"application/vnd.svd":{"source":"iana","extensions":["svd"]},"application/vnd.swiftview-ics":{"source":"iana"},"application/vnd.sycle+xml":{"source":"iana","compressible":true},"application/vnd.syft+json":{"source":"iana","compressible":true},"application/vnd.symbian.install":{"source":"apache","extensions":["sis","sisx"]},"application/vnd.syncml+xml":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["xsm"]},"application/vnd.syncml.dm+wbxml":{"source":"iana","charset":"UTF-8","extensions":["bdm"]},"application/vnd.syncml.dm+xml":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["xdm"]},"application/vnd.syncml.dm.notification":{"source":"iana"},"application/vnd.syncml.dmddf+wbxml":{"source":"iana"},"application/vnd.syncml.dmddf+xml":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{"source":"iana"},"application/vnd.syncml.dmtnds+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.syncml.ds.notification":{"source":"iana"},"application/vnd.tableschema+json":{"source":"iana","compressible":true},"application/vnd.tao.intent-module-archive":{"source":"iana","extensions":["tao"]},"application/vnd.tcpdump.pcap":{"source":"iana","extensions":["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{"source":"iana","compressible":true},"application/vnd.tmd.mediaflex.api+xml":{"source":"iana","compressible":true},"application/vnd.tml":{"source":"iana"},"application/vnd.tmobile-livetv":{"source":"iana","extensions":["tmo"]},"application/vnd.tri.onesource":{"source":"iana"},"application/vnd.trid.tpt":{"source":"iana","extensions":["tpt"]},"application/vnd.triscape.mxs":{"source":"iana","extensions":["mxs"]},"application/vnd.trueapp":{"source":"iana","extensions":["tra"]},"application/vnd.truedoc":{"source":"iana"},"application/vnd.ubisoft.webplayer":{"source":"iana"},"application/vnd.ufdl":{"source":"iana","extensions":["ufd","ufdl"]},"application/vnd.uiq.theme":{"source":"iana","extensions":["utz"]},"application/vnd.umajin":{"source":"iana","extensions":["umj"]},"application/vnd.unity":{"source":"iana","extensions":["unityweb"]},"application/vnd.uoml+xml":{"source":"iana","compressible":true,"extensions":["uoml"]},"application/vnd.uplanet.alert":{"source":"iana"},"application/vnd.uplanet.alert-wbxml":{"source":"iana"},"application/vnd.uplanet.bearer-choice":{"source":"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{"source":"iana"},"application/vnd.uplanet.cacheop":{"source":"iana"},"application/vnd.uplanet.cacheop-wbxml":{"source":"iana"},"application/vnd.uplanet.channel":{"source":"iana"},"application/vnd.uplanet.channel-wbxml":{"source":"iana"},"application/vnd.uplanet.list":{"source":"iana"},"application/vnd.uplanet.list-wbxml":{"source":"iana"},"application/vnd.uplanet.listcmd":{"source":"iana"},"application/vnd.uplanet.listcmd-wbxml":{"source":"iana"},"application/vnd.uplanet.signal":{"source":"iana"},"application/vnd.uri-map":{"source":"iana"},"application/vnd.valve.source.material":{"source":"iana"},"application/vnd.vcx":{"source":"iana","extensions":["vcx"]},"application/vnd.vd-study":{"source":"iana"},"application/vnd.vectorworks":{"source":"iana"},"application/vnd.vel+json":{"source":"iana","compressible":true},"application/vnd.verimatrix.vcas":{"source":"iana"},"application/vnd.veritone.aion+json":{"source":"iana","compressible":true},"application/vnd.veryant.thin":{"source":"iana"},"application/vnd.ves.encrypted":{"source":"iana"},"application/vnd.vidsoft.vidconference":{"source":"iana"},"application/vnd.visio":{"source":"iana","extensions":["vsd","vst","vss","vsw"]},"application/vnd.visionary":{"source":"iana","extensions":["vis"]},"application/vnd.vividence.scriptfile":{"source":"iana"},"application/vnd.vsf":{"source":"iana","extensions":["vsf"]},"application/vnd.wap.sic":{"source":"iana"},"application/vnd.wap.slc":{"source":"iana"},"application/vnd.wap.wbxml":{"source":"iana","charset":"UTF-8","extensions":["wbxml"]},"application/vnd.wap.wmlc":{"source":"iana","extensions":["wmlc"]},"application/vnd.wap.wmlscriptc":{"source":"iana","extensions":["wmlsc"]},"application/vnd.webturbo":{"source":"iana","extensions":["wtb"]},"application/vnd.wfa.dpp":{"source":"iana"},"application/vnd.wfa.p2p":{"source":"iana"},"application/vnd.wfa.wsc":{"source":"iana"},"application/vnd.windows.devicepairing":{"source":"iana"},"application/vnd.wmc":{"source":"iana"},"application/vnd.wmf.bootstrap":{"source":"iana"},"application/vnd.wolfram.mathematica":{"source":"iana"},"application/vnd.wolfram.mathematica.package":{"source":"iana"},"application/vnd.wolfram.player":{"source":"iana","extensions":["nbp"]},"application/vnd.wordperfect":{"source":"iana","extensions":["wpd"]},"application/vnd.wqd":{"source":"iana","extensions":["wqd"]},"application/vnd.wrq-hp3000-labelled":{"source":"iana"},"application/vnd.wt.stf":{"source":"iana","extensions":["stf"]},"application/vnd.wv.csp+wbxml":{"source":"iana"},"application/vnd.wv.csp+xml":{"source":"iana","compressible":true},"application/vnd.wv.ssp+xml":{"source":"iana","compressible":true},"application/vnd.xacml+json":{"source":"iana","compressible":true},"application/vnd.xara":{"source":"iana","extensions":["xar"]},"application/vnd.xfdl":{"source":"iana","extensions":["xfdl"]},"application/vnd.xfdl.webform":{"source":"iana"},"application/vnd.xmi+xml":{"source":"iana","compressible":true},"application/vnd.xmpie.cpkg":{"source":"iana"},"application/vnd.xmpie.dpkg":{"source":"iana"},"application/vnd.xmpie.plan":{"source":"iana"},"application/vnd.xmpie.ppkg":{"source":"iana"},"application/vnd.xmpie.xlim":{"source":"iana"},"application/vnd.yamaha.hv-dic":{"source":"iana","extensions":["hvd"]},"application/vnd.yamaha.hv-script":{"source":"iana","extensions":["hvs"]},"application/vnd.yamaha.hv-voice":{"source":"iana","extensions":["hvp"]},"application/vnd.yamaha.openscoreformat":{"source":"iana","extensions":["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{"source":"iana","compressible":true,"extensions":["osfpvg"]},"application/vnd.yamaha.remote-setup":{"source":"iana"},"application/vnd.yamaha.smaf-audio":{"source":"iana","extensions":["saf"]},"application/vnd.yamaha.smaf-phrase":{"source":"iana","extensions":["spf"]},"application/vnd.yamaha.through-ngn":{"source":"iana"},"application/vnd.yamaha.tunnel-udpencap":{"source":"iana"},"application/vnd.yaoweme":{"source":"iana"},"application/vnd.yellowriver-custom-menu":{"source":"iana","extensions":["cmp"]},"application/vnd.youtube.yt":{"source":"iana"},"application/vnd.zul":{"source":"iana","extensions":["zir","zirz"]},"application/vnd.zzazz.deck+xml":{"source":"iana","compressible":true,"extensions":["zaz"]},"application/voicexml+xml":{"source":"iana","compressible":true,"extensions":["vxml"]},"application/voucher-cms+json":{"source":"iana","compressible":true},"application/vq-rtcpxr":{"source":"iana"},"application/wasm":{"source":"iana","compressible":true,"extensions":["wasm"]},"application/watcherinfo+xml":{"source":"iana","compressible":true,"extensions":["wif"]},"application/webpush-options+json":{"source":"iana","compressible":true},"application/whoispp-query":{"source":"iana"},"application/whoispp-response":{"source":"iana"},"application/widget":{"source":"iana","extensions":["wgt"]},"application/winhlp":{"source":"apache","extensions":["hlp"]},"application/wita":{"source":"iana"},"application/wordperfect5.1":{"source":"iana"},"application/wsdl+xml":{"source":"iana","compressible":true,"extensions":["wsdl"]},"application/wspolicy+xml":{"source":"iana","compressible":true,"extensions":["wspolicy"]},"application/x-7z-compressed":{"source":"apache","compressible":false,"extensions":["7z"]},"application/x-abiword":{"source":"apache","extensions":["abw"]},"application/x-ace-compressed":{"source":"apache","extensions":["ace"]},"application/x-amf":{"source":"apache"},"application/x-apple-diskimage":{"source":"apache","extensions":["dmg"]},"application/x-arj":{"compressible":false,"extensions":["arj"]},"application/x-authorware-bin":{"source":"apache","extensions":["aab","x32","u32","vox"]},"application/x-authorware-map":{"source":"apache","extensions":["aam"]},"application/x-authorware-seg":{"source":"apache","extensions":["aas"]},"application/x-bcpio":{"source":"apache","extensions":["bcpio"]},"application/x-bdoc":{"compressible":false,"extensions":["bdoc"]},"application/x-bittorrent":{"source":"apache","extensions":["torrent"]},"application/x-blorb":{"source":"apache","extensions":["blb","blorb"]},"application/x-bzip":{"source":"apache","compressible":false,"extensions":["bz"]},"application/x-bzip2":{"source":"apache","compressible":false,"extensions":["bz2","boz"]},"application/x-cbr":{"source":"apache","extensions":["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{"source":"apache","extensions":["vcd"]},"application/x-cfs-compressed":{"source":"apache","extensions":["cfs"]},"application/x-chat":{"source":"apache","extensions":["chat"]},"application/x-chess-pgn":{"source":"apache","extensions":["pgn"]},"application/x-chrome-extension":{"extensions":["crx"]},"application/x-cocoa":{"source":"nginx","extensions":["cco"]},"application/x-compress":{"source":"apache"},"application/x-conference":{"source":"apache","extensions":["nsc"]},"application/x-cpio":{"source":"apache","extensions":["cpio"]},"application/x-csh":{"source":"apache","extensions":["csh"]},"application/x-deb":{"compressible":false},"application/x-debian-package":{"source":"apache","extensions":["deb","udeb"]},"application/x-dgc-compressed":{"source":"apache","extensions":["dgc"]},"application/x-director":{"source":"apache","extensions":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{"source":"apache","extensions":["wad"]},"application/x-dtbncx+xml":{"source":"apache","compressible":true,"extensions":["ncx"]},"application/x-dtbook+xml":{"source":"apache","compressible":true,"extensions":["dtb"]},"application/x-dtbresource+xml":{"source":"apache","compressible":true,"extensions":["res"]},"application/x-dvi":{"source":"apache","compressible":false,"extensions":["dvi"]},"application/x-envoy":{"source":"apache","extensions":["evy"]},"application/x-eva":{"source":"apache","extensions":["eva"]},"application/x-font-bdf":{"source":"apache","extensions":["bdf"]},"application/x-font-dos":{"source":"apache"},"application/x-font-framemaker":{"source":"apache"},"application/x-font-ghostscript":{"source":"apache","extensions":["gsf"]},"application/x-font-libgrx":{"source":"apache"},"application/x-font-linux-psf":{"source":"apache","extensions":["psf"]},"application/x-font-pcf":{"source":"apache","extensions":["pcf"]},"application/x-font-snf":{"source":"apache","extensions":["snf"]},"application/x-font-speedo":{"source":"apache"},"application/x-font-sunos-news":{"source":"apache"},"application/x-font-type1":{"source":"apache","extensions":["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{"source":"apache"},"application/x-freearc":{"source":"apache","extensions":["arc"]},"application/x-futuresplash":{"source":"apache","extensions":["spl"]},"application/x-gca-compressed":{"source":"apache","extensions":["gca"]},"application/x-glulx":{"source":"apache","extensions":["ulx"]},"application/x-gnumeric":{"source":"apache","extensions":["gnumeric"]},"application/x-gramps-xml":{"source":"apache","extensions":["gramps"]},"application/x-gtar":{"source":"apache","extensions":["gtar"]},"application/x-gzip":{"source":"apache"},"application/x-hdf":{"source":"apache","extensions":["hdf"]},"application/x-httpd-php":{"compressible":true,"extensions":["php"]},"application/x-install-instructions":{"source":"apache","extensions":["install"]},"application/x-iso9660-image":{"source":"apache","extensions":["iso"]},"application/x-iwork-keynote-sffkey":{"extensions":["key"]},"application/x-iwork-numbers-sffnumbers":{"extensions":["numbers"]},"application/x-iwork-pages-sffpages":{"extensions":["pages"]},"application/x-java-archive-diff":{"source":"nginx","extensions":["jardiff"]},"application/x-java-jnlp-file":{"source":"apache","compressible":false,"extensions":["jnlp"]},"application/x-javascript":{"compressible":true},"application/x-keepass2":{"extensions":["kdbx"]},"application/x-latex":{"source":"apache","compressible":false,"extensions":["latex"]},"application/x-lua-bytecode":{"extensions":["luac"]},"application/x-lzh-compressed":{"source":"apache","extensions":["lzh","lha"]},"application/x-makeself":{"source":"nginx","extensions":["run"]},"application/x-mie":{"source":"apache","extensions":["mie"]},"application/x-mobipocket-ebook":{"source":"apache","extensions":["prc","mobi"]},"application/x-mpegurl":{"compressible":false},"application/x-ms-application":{"source":"apache","extensions":["application"]},"application/x-ms-shortcut":{"source":"apache","extensions":["lnk"]},"application/x-ms-wmd":{"source":"apache","extensions":["wmd"]},"application/x-ms-wmz":{"source":"apache","extensions":["wmz"]},"application/x-ms-xbap":{"source":"apache","extensions":["xbap"]},"application/x-msaccess":{"source":"apache","extensions":["mdb"]},"application/x-msbinder":{"source":"apache","extensions":["obd"]},"application/x-mscardfile":{"source":"apache","extensions":["crd"]},"application/x-msclip":{"source":"apache","extensions":["clp"]},"application/x-msdos-program":{"extensions":["exe"]},"application/x-msdownload":{"source":"apache","extensions":["exe","dll","com","bat","msi"]},"application/x-msmediaview":{"source":"apache","extensions":["mvb","m13","m14"]},"application/x-msmetafile":{"source":"apache","extensions":["wmf","wmz","emf","emz"]},"application/x-msmoney":{"source":"apache","extensions":["mny"]},"application/x-mspublisher":{"source":"apache","extensions":["pub"]},"application/x-msschedule":{"source":"apache","extensions":["scd"]},"application/x-msterminal":{"source":"apache","extensions":["trm"]},"application/x-mswrite":{"source":"apache","extensions":["wri"]},"application/x-netcdf":{"source":"apache","extensions":["nc","cdf"]},"application/x-ns-proxy-autoconfig":{"compressible":true,"extensions":["pac"]},"application/x-nzb":{"source":"apache","extensions":["nzb"]},"application/x-perl":{"source":"nginx","extensions":["pl","pm"]},"application/x-pilot":{"source":"nginx","extensions":["prc","pdb"]},"application/x-pkcs12":{"source":"apache","compressible":false,"extensions":["p12","pfx"]},"application/x-pkcs7-certificates":{"source":"apache","extensions":["p7b","spc"]},"application/x-pkcs7-certreqresp":{"source":"apache","extensions":["p7r"]},"application/x-pki-message":{"source":"iana"},"application/x-rar-compressed":{"source":"apache","compressible":false,"extensions":["rar"]},"application/x-redhat-package-manager":{"source":"nginx","extensions":["rpm"]},"application/x-research-info-systems":{"source":"apache","extensions":["ris"]},"application/x-sea":{"source":"nginx","extensions":["sea"]},"application/x-sh":{"source":"apache","compressible":true,"extensions":["sh"]},"application/x-shar":{"source":"apache","extensions":["shar"]},"application/x-shockwave-flash":{"source":"apache","compressible":false,"extensions":["swf"]},"application/x-silverlight-app":{"source":"apache","extensions":["xap"]},"application/x-sql":{"source":"apache","extensions":["sql"]},"application/x-stuffit":{"source":"apache","compressible":false,"extensions":["sit"]},"application/x-stuffitx":{"source":"apache","extensions":["sitx"]},"application/x-subrip":{"source":"apache","extensions":["srt"]},"application/x-sv4cpio":{"source":"apache","extensions":["sv4cpio"]},"application/x-sv4crc":{"source":"apache","extensions":["sv4crc"]},"application/x-t3vm-image":{"source":"apache","extensions":["t3"]},"application/x-tads":{"source":"apache","extensions":["gam"]},"application/x-tar":{"source":"apache","compressible":true,"extensions":["tar"]},"application/x-tcl":{"source":"apache","extensions":["tcl","tk"]},"application/x-tex":{"source":"apache","extensions":["tex"]},"application/x-tex-tfm":{"source":"apache","extensions":["tfm"]},"application/x-texinfo":{"source":"apache","extensions":["texinfo","texi"]},"application/x-tgif":{"source":"apache","extensions":["obj"]},"application/x-ustar":{"source":"apache","extensions":["ustar"]},"application/x-virtualbox-hdd":{"compressible":true,"extensions":["hdd"]},"application/x-virtualbox-ova":{"compressible":true,"extensions":["ova"]},"application/x-virtualbox-ovf":{"compressible":true,"extensions":["ovf"]},"application/x-virtualbox-vbox":{"compressible":true,"extensions":["vbox"]},"application/x-virtualbox-vbox-extpack":{"compressible":false,"extensions":["vbox-extpack"]},"application/x-virtualbox-vdi":{"compressible":true,"extensions":["vdi"]},"application/x-virtualbox-vhd":{"compressible":true,"extensions":["vhd"]},"application/x-virtualbox-vmdk":{"compressible":true,"extensions":["vmdk"]},"application/x-wais-source":{"source":"apache","extensions":["src"]},"application/x-web-app-manifest+json":{"compressible":true,"extensions":["webapp"]},"application/x-www-form-urlencoded":{"source":"iana","compressible":true},"application/x-x509-ca-cert":{"source":"iana","extensions":["der","crt","pem"]},"application/x-x509-ca-ra-cert":{"source":"iana"},"application/x-x509-next-ca-cert":{"source":"iana"},"application/x-xfig":{"source":"apache","extensions":["fig"]},"application/x-xliff+xml":{"source":"apache","compressible":true,"extensions":["xlf"]},"application/x-xpinstall":{"source":"apache","compressible":false,"extensions":["xpi"]},"application/x-xz":{"source":"apache","extensions":["xz"]},"application/x-zmachine":{"source":"apache","extensions":["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{"source":"iana"},"application/xacml+xml":{"source":"iana","compressible":true},"application/xaml+xml":{"source":"apache","compressible":true,"extensions":["xaml"]},"application/xcap-att+xml":{"source":"iana","compressible":true,"extensions":["xav"]},"application/xcap-caps+xml":{"source":"iana","compressible":true,"extensions":["xca"]},"application/xcap-diff+xml":{"source":"iana","compressible":true,"extensions":["xdf"]},"application/xcap-el+xml":{"source":"iana","compressible":true,"extensions":["xel"]},"application/xcap-error+xml":{"source":"iana","compressible":true},"application/xcap-ns+xml":{"source":"iana","compressible":true,"extensions":["xns"]},"application/xcon-conference-info+xml":{"source":"iana","compressible":true},"application/xcon-conference-info-diff+xml":{"source":"iana","compressible":true},"application/xenc+xml":{"source":"iana","compressible":true,"extensions":["xenc"]},"application/xhtml+xml":{"source":"iana","compressible":true,"extensions":["xhtml","xht"]},"application/xhtml-voice+xml":{"source":"apache","compressible":true},"application/xliff+xml":{"source":"iana","compressible":true,"extensions":["xlf"]},"application/xml":{"source":"iana","compressible":true,"extensions":["xml","xsl","xsd","rng"]},"application/xml-dtd":{"source":"iana","compressible":true,"extensions":["dtd"]},"application/xml-external-parsed-entity":{"source":"iana"},"application/xml-patch+xml":{"source":"iana","compressible":true},"application/xmpp+xml":{"source":"iana","compressible":true},"application/xop+xml":{"source":"iana","compressible":true,"extensions":["xop"]},"application/xproc+xml":{"source":"apache","compressible":true,"extensions":["xpl"]},"application/xslt+xml":{"source":"iana","compressible":true,"extensions":["xsl","xslt"]},"application/xspf+xml":{"source":"apache","compressible":true,"extensions":["xspf"]},"application/xv+xml":{"source":"iana","compressible":true,"extensions":["mxml","xhvml","xvml","xvm"]},"application/yang":{"source":"iana","extensions":["yang"]},"application/yang-data+json":{"source":"iana","compressible":true},"application/yang-data+xml":{"source":"iana","compressible":true},"application/yang-patch+json":{"source":"iana","compressible":true},"application/yang-patch+xml":{"source":"iana","compressible":true},"application/yin+xml":{"source":"iana","compressible":true,"extensions":["yin"]},"application/zip":{"source":"iana","compressible":false,"extensions":["zip"]},"application/zlib":{"source":"iana"},"application/zstd":{"source":"iana"},"audio/1d-interleaved-parityfec":{"source":"iana"},"audio/32kadpcm":{"source":"iana"},"audio/3gpp":{"source":"iana","compressible":false,"extensions":["3gpp"]},"audio/3gpp2":{"source":"iana"},"audio/aac":{"source":"iana"},"audio/ac3":{"source":"iana"},"audio/adpcm":{"source":"apache","extensions":["adp"]},"audio/amr":{"source":"iana","extensions":["amr"]},"audio/amr-wb":{"source":"iana"},"audio/amr-wb+":{"source":"iana"},"audio/aptx":{"source":"iana"},"audio/asc":{"source":"iana"},"audio/atrac-advanced-lossless":{"source":"iana"},"audio/atrac-x":{"source":"iana"},"audio/atrac3":{"source":"iana"},"audio/basic":{"source":"iana","compressible":false,"extensions":["au","snd"]},"audio/bv16":{"source":"iana"},"audio/bv32":{"source":"iana"},"audio/clearmode":{"source":"iana"},"audio/cn":{"source":"iana"},"audio/dat12":{"source":"iana"},"audio/dls":{"source":"iana"},"audio/dsr-es201108":{"source":"iana"},"audio/dsr-es202050":{"source":"iana"},"audio/dsr-es202211":{"source":"iana"},"audio/dsr-es202212":{"source":"iana"},"audio/dv":{"source":"iana"},"audio/dvi4":{"source":"iana"},"audio/eac3":{"source":"iana"},"audio/encaprtp":{"source":"iana"},"audio/evrc":{"source":"iana"},"audio/evrc-qcp":{"source":"iana"},"audio/evrc0":{"source":"iana"},"audio/evrc1":{"source":"iana"},"audio/evrcb":{"source":"iana"},"audio/evrcb0":{"source":"iana"},"audio/evrcb1":{"source":"iana"},"audio/evrcnw":{"source":"iana"},"audio/evrcnw0":{"source":"iana"},"audio/evrcnw1":{"source":"iana"},"audio/evrcwb":{"source":"iana"},"audio/evrcwb0":{"source":"iana"},"audio/evrcwb1":{"source":"iana"},"audio/evs":{"source":"iana"},"audio/flexfec":{"source":"iana"},"audio/fwdred":{"source":"iana"},"audio/g711-0":{"source":"iana"},"audio/g719":{"source":"iana"},"audio/g722":{"source":"iana"},"audio/g7221":{"source":"iana"},"audio/g723":{"source":"iana"},"audio/g726-16":{"source":"iana"},"audio/g726-24":{"source":"iana"},"audio/g726-32":{"source":"iana"},"audio/g726-40":{"source":"iana"},"audio/g728":{"source":"iana"},"audio/g729":{"source":"iana"},"audio/g7291":{"source":"iana"},"audio/g729d":{"source":"iana"},"audio/g729e":{"source":"iana"},"audio/gsm":{"source":"iana"},"audio/gsm-efr":{"source":"iana"},"audio/gsm-hr-08":{"source":"iana"},"audio/ilbc":{"source":"iana"},"audio/ip-mr_v2.5":{"source":"iana"},"audio/isac":{"source":"apache"},"audio/l16":{"source":"iana"},"audio/l20":{"source":"iana"},"audio/l24":{"source":"iana","compressible":false},"audio/l8":{"source":"iana"},"audio/lpc":{"source":"iana"},"audio/melp":{"source":"iana"},"audio/melp1200":{"source":"iana"},"audio/melp2400":{"source":"iana"},"audio/melp600":{"source":"iana"},"audio/mhas":{"source":"iana"},"audio/midi":{"source":"apache","extensions":["mid","midi","kar","rmi"]},"audio/mobile-xmf":{"source":"iana","extensions":["mxmf"]},"audio/mp3":{"compressible":false,"extensions":["mp3"]},"audio/mp4":{"source":"iana","compressible":false,"extensions":["m4a","mp4a"]},"audio/mp4a-latm":{"source":"iana"},"audio/mpa":{"source":"iana"},"audio/mpa-robust":{"source":"iana"},"audio/mpeg":{"source":"iana","compressible":false,"extensions":["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{"source":"iana"},"audio/musepack":{"source":"apache"},"audio/ogg":{"source":"iana","compressible":false,"extensions":["oga","ogg","spx","opus"]},"audio/opus":{"source":"iana"},"audio/parityfec":{"source":"iana"},"audio/pcma":{"source":"iana"},"audio/pcma-wb":{"source":"iana"},"audio/pcmu":{"source":"iana"},"audio/pcmu-wb":{"source":"iana"},"audio/prs.sid":{"source":"iana"},"audio/qcelp":{"source":"iana"},"audio/raptorfec":{"source":"iana"},"audio/red":{"source":"iana"},"audio/rtp-enc-aescm128":{"source":"iana"},"audio/rtp-midi":{"source":"iana"},"audio/rtploopback":{"source":"iana"},"audio/rtx":{"source":"iana"},"audio/s3m":{"source":"apache","extensions":["s3m"]},"audio/scip":{"source":"iana"},"audio/silk":{"source":"apache","extensions":["sil"]},"audio/smv":{"source":"iana"},"audio/smv-qcp":{"source":"iana"},"audio/smv0":{"source":"iana"},"audio/sofa":{"source":"iana"},"audio/sp-midi":{"source":"iana"},"audio/speex":{"source":"iana"},"audio/t140c":{"source":"iana"},"audio/t38":{"source":"iana"},"audio/telephone-event":{"source":"iana"},"audio/tetra_acelp":{"source":"iana"},"audio/tetra_acelp_bb":{"source":"iana"},"audio/tone":{"source":"iana"},"audio/tsvcis":{"source":"iana"},"audio/uemclip":{"source":"iana"},"audio/ulpfec":{"source":"iana"},"audio/usac":{"source":"iana"},"audio/vdvi":{"source":"iana"},"audio/vmr-wb":{"source":"iana"},"audio/vnd.3gpp.iufp":{"source":"iana"},"audio/vnd.4sb":{"source":"iana"},"audio/vnd.audiokoz":{"source":"iana"},"audio/vnd.celp":{"source":"iana"},"audio/vnd.cisco.nse":{"source":"iana"},"audio/vnd.cmles.radio-events":{"source":"iana"},"audio/vnd.cns.anp1":{"source":"iana"},"audio/vnd.cns.inf1":{"source":"iana"},"audio/vnd.dece.audio":{"source":"iana","extensions":["uva","uvva"]},"audio/vnd.digital-winds":{"source":"iana","extensions":["eol"]},"audio/vnd.dlna.adts":{"source":"iana"},"audio/vnd.dolby.heaac.1":{"source":"iana"},"audio/vnd.dolby.heaac.2":{"source":"iana"},"audio/vnd.dolby.mlp":{"source":"iana"},"audio/vnd.dolby.mps":{"source":"iana"},"audio/vnd.dolby.pl2":{"source":"iana"},"audio/vnd.dolby.pl2x":{"source":"iana"},"audio/vnd.dolby.pl2z":{"source":"iana"},"audio/vnd.dolby.pulse.1":{"source":"iana"},"audio/vnd.dra":{"source":"iana","extensions":["dra"]},"audio/vnd.dts":{"source":"iana","extensions":["dts"]},"audio/vnd.dts.hd":{"source":"iana","extensions":["dtshd"]},"audio/vnd.dts.uhd":{"source":"iana"},"audio/vnd.dvb.file":{"source":"iana"},"audio/vnd.everad.plj":{"source":"iana"},"audio/vnd.hns.audio":{"source":"iana"},"audio/vnd.lucent.voice":{"source":"iana","extensions":["lvp"]},"audio/vnd.ms-playready.media.pya":{"source":"iana","extensions":["pya"]},"audio/vnd.nokia.mobile-xmf":{"source":"iana"},"audio/vnd.nortel.vbk":{"source":"iana"},"audio/vnd.nuera.ecelp4800":{"source":"iana","extensions":["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{"source":"iana","extensions":["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{"source":"iana","extensions":["ecelp9600"]},"audio/vnd.octel.sbc":{"source":"iana"},"audio/vnd.presonus.multitrack":{"source":"iana"},"audio/vnd.qcelp":{"source":"iana"},"audio/vnd.rhetorex.32kadpcm":{"source":"iana"},"audio/vnd.rip":{"source":"iana","extensions":["rip"]},"audio/vnd.rn-realaudio":{"compressible":false},"audio/vnd.sealedmedia.softseal.mpeg":{"source":"iana"},"audio/vnd.vmx.cvsd":{"source":"iana"},"audio/vnd.wave":{"compressible":false},"audio/vorbis":{"source":"iana","compressible":false},"audio/vorbis-config":{"source":"iana"},"audio/wav":{"compressible":false,"extensions":["wav"]},"audio/wave":{"compressible":false,"extensions":["wav"]},"audio/webm":{"source":"apache","compressible":false,"extensions":["weba"]},"audio/x-aac":{"source":"apache","compressible":false,"extensions":["aac"]},"audio/x-aiff":{"source":"apache","extensions":["aif","aiff","aifc"]},"audio/x-caf":{"source":"apache","compressible":false,"extensions":["caf"]},"audio/x-flac":{"source":"apache","extensions":["flac"]},"audio/x-m4a":{"source":"nginx","extensions":["m4a"]},"audio/x-matroska":{"source":"apache","extensions":["mka"]},"audio/x-mpegurl":{"source":"apache","extensions":["m3u"]},"audio/x-ms-wax":{"source":"apache","extensions":["wax"]},"audio/x-ms-wma":{"source":"apache","extensions":["wma"]},"audio/x-pn-realaudio":{"source":"apache","extensions":["ram","ra"]},"audio/x-pn-realaudio-plugin":{"source":"apache","extensions":["rmp"]},"audio/x-realaudio":{"source":"nginx","extensions":["ra"]},"audio/x-tta":{"source":"apache"},"audio/x-wav":{"source":"apache","extensions":["wav"]},"audio/xm":{"source":"apache","extensions":["xm"]},"chemical/x-cdx":{"source":"apache","extensions":["cdx"]},"chemical/x-cif":{"source":"apache","extensions":["cif"]},"chemical/x-cmdf":{"source":"apache","extensions":["cmdf"]},"chemical/x-cml":{"source":"apache","extensions":["cml"]},"chemical/x-csml":{"source":"apache","extensions":["csml"]},"chemical/x-pdb":{"source":"apache"},"chemical/x-xyz":{"source":"apache","extensions":["xyz"]},"font/collection":{"source":"iana","extensions":["ttc"]},"font/otf":{"source":"iana","compressible":true,"extensions":["otf"]},"font/sfnt":{"source":"iana"},"font/ttf":{"source":"iana","compressible":true,"extensions":["ttf"]},"font/woff":{"source":"iana","extensions":["woff"]},"font/woff2":{"source":"iana","extensions":["woff2"]},"image/aces":{"source":"iana","extensions":["exr"]},"image/apng":{"compressible":false,"extensions":["apng"]},"image/avci":{"source":"iana","extensions":["avci"]},"image/avcs":{"source":"iana","extensions":["avcs"]},"image/avif":{"source":"iana","compressible":false,"extensions":["avif"]},"image/bmp":{"source":"iana","compressible":true,"extensions":["bmp"]},"image/cgm":{"source":"iana","extensions":["cgm"]},"image/dicom-rle":{"source":"iana","extensions":["drle"]},"image/emf":{"source":"iana","extensions":["emf"]},"image/fits":{"source":"iana","extensions":["fits"]},"image/g3fax":{"source":"iana","extensions":["g3"]},"image/gif":{"source":"iana","compressible":false,"extensions":["gif"]},"image/heic":{"source":"iana","extensions":["heic"]},"image/heic-sequence":{"source":"iana","extensions":["heics"]},"image/heif":{"source":"iana","extensions":["heif"]},"image/heif-sequence":{"source":"iana","extensions":["heifs"]},"image/hej2k":{"source":"iana","extensions":["hej2"]},"image/hsj2":{"source":"iana","extensions":["hsj2"]},"image/ief":{"source":"iana","extensions":["ief"]},"image/jls":{"source":"iana","extensions":["jls"]},"image/jp2":{"source":"iana","compressible":false,"extensions":["jp2","jpg2"]},"image/jpeg":{"source":"iana","compressible":false,"extensions":["jpeg","jpg","jpe"]},"image/jph":{"source":"iana","extensions":["jph"]},"image/jphc":{"source":"iana","extensions":["jhc"]},"image/jpm":{"source":"iana","compressible":false,"extensions":["jpm"]},"image/jpx":{"source":"iana","compressible":false,"extensions":["jpx","jpf"]},"image/jxr":{"source":"iana","extensions":["jxr"]},"image/jxra":{"source":"iana","extensions":["jxra"]},"image/jxrs":{"source":"iana","extensions":["jxrs"]},"image/jxs":{"source":"iana","extensions":["jxs"]},"image/jxsc":{"source":"iana","extensions":["jxsc"]},"image/jxsi":{"source":"iana","extensions":["jxsi"]},"image/jxss":{"source":"iana","extensions":["jxss"]},"image/ktx":{"source":"iana","extensions":["ktx"]},"image/ktx2":{"source":"iana","extensions":["ktx2"]},"image/naplps":{"source":"iana"},"image/pjpeg":{"compressible":false},"image/png":{"source":"iana","compressible":false,"extensions":["png"]},"image/prs.btif":{"source":"iana","extensions":["btif"]},"image/prs.pti":{"source":"iana","extensions":["pti"]},"image/pwg-raster":{"source":"iana"},"image/sgi":{"source":"apache","extensions":["sgi"]},"image/svg+xml":{"source":"iana","compressible":true,"extensions":["svg","svgz"]},"image/t38":{"source":"iana","extensions":["t38"]},"image/tiff":{"source":"iana","compressible":false,"extensions":["tif","tiff"]},"image/tiff-fx":{"source":"iana","extensions":["tfx"]},"image/vnd.adobe.photoshop":{"source":"iana","compressible":true,"extensions":["psd"]},"image/vnd.airzip.accelerator.azv":{"source":"iana","extensions":["azv"]},"image/vnd.cns.inf2":{"source":"iana"},"image/vnd.dece.graphic":{"source":"iana","extensions":["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{"source":"iana","extensions":["djvu","djv"]},"image/vnd.dvb.subtitle":{"source":"iana","extensions":["sub"]},"image/vnd.dwg":{"source":"iana","extensions":["dwg"]},"image/vnd.dxf":{"source":"iana","extensions":["dxf"]},"image/vnd.fastbidsheet":{"source":"iana","extensions":["fbs"]},"image/vnd.fpx":{"source":"iana","extensions":["fpx"]},"image/vnd.fst":{"source":"iana","extensions":["fst"]},"image/vnd.fujixerox.edmics-mmr":{"source":"iana","extensions":["mmr"]},"image/vnd.fujixerox.edmics-rlc":{"source":"iana","extensions":["rlc"]},"image/vnd.globalgraphics.pgb":{"source":"iana"},"image/vnd.microsoft.icon":{"source":"iana","compressible":true,"extensions":["ico"]},"image/vnd.mix":{"source":"iana"},"image/vnd.mozilla.apng":{"source":"iana"},"image/vnd.ms-dds":{"compressible":true,"extensions":["dds"]},"image/vnd.ms-modi":{"source":"iana","extensions":["mdi"]},"image/vnd.ms-photo":{"source":"apache","extensions":["wdp"]},"image/vnd.net-fpx":{"source":"iana","extensions":["npx"]},"image/vnd.pco.b16":{"source":"iana","extensions":["b16"]},"image/vnd.radiance":{"source":"iana"},"image/vnd.sealed.png":{"source":"iana"},"image/vnd.sealedmedia.softseal.gif":{"source":"iana"},"image/vnd.sealedmedia.softseal.jpg":{"source":"iana"},"image/vnd.svf":{"source":"iana"},"image/vnd.tencent.tap":{"source":"iana","extensions":["tap"]},"image/vnd.valve.source.texture":{"source":"iana","extensions":["vtf"]},"image/vnd.wap.wbmp":{"source":"iana","extensions":["wbmp"]},"image/vnd.xiff":{"source":"iana","extensions":["xif"]},"image/vnd.zbrush.pcx":{"source":"iana","extensions":["pcx"]},"image/webp":{"source":"apache","extensions":["webp"]},"image/wmf":{"source":"iana","extensions":["wmf"]},"image/x-3ds":{"source":"apache","extensions":["3ds"]},"image/x-cmu-raster":{"source":"apache","extensions":["ras"]},"image/x-cmx":{"source":"apache","extensions":["cmx"]},"image/x-freehand":{"source":"apache","extensions":["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{"source":"apache","compressible":true,"extensions":["ico"]},"image/x-jng":{"source":"nginx","extensions":["jng"]},"image/x-mrsid-image":{"source":"apache","extensions":["sid"]},"image/x-ms-bmp":{"source":"nginx","compressible":true,"extensions":["bmp"]},"image/x-pcx":{"source":"apache","extensions":["pcx"]},"image/x-pict":{"source":"apache","extensions":["pic","pct"]},"image/x-portable-anymap":{"source":"apache","extensions":["pnm"]},"image/x-portable-bitmap":{"source":"apache","extensions":["pbm"]},"image/x-portable-graymap":{"source":"apache","extensions":["pgm"]},"image/x-portable-pixmap":{"source":"apache","extensions":["ppm"]},"image/x-rgb":{"source":"apache","extensions":["rgb"]},"image/x-tga":{"source":"apache","extensions":["tga"]},"image/x-xbitmap":{"source":"apache","extensions":["xbm"]},"image/x-xcf":{"compressible":false},"image/x-xpixmap":{"source":"apache","extensions":["xpm"]},"image/x-xwindowdump":{"source":"apache","extensions":["xwd"]},"message/cpim":{"source":"iana"},"message/delivery-status":{"source":"iana"},"message/disposition-notification":{"source":"iana","extensions":["disposition-notification"]},"message/external-body":{"source":"iana"},"message/feedback-report":{"source":"iana"},"message/global":{"source":"iana","extensions":["u8msg"]},"message/global-delivery-status":{"source":"iana","extensions":["u8dsn"]},"message/global-disposition-notification":{"source":"iana","extensions":["u8mdn"]},"message/global-headers":{"source":"iana","extensions":["u8hdr"]},"message/http":{"source":"iana","compressible":false},"message/imdn+xml":{"source":"iana","compressible":true},"message/news":{"source":"iana"},"message/partial":{"source":"iana","compressible":false},"message/rfc822":{"source":"iana","compressible":true,"extensions":["eml","mime"]},"message/s-http":{"source":"iana"},"message/sip":{"source":"iana"},"message/sipfrag":{"source":"iana"},"message/tracking-status":{"source":"iana"},"message/vnd.si.simp":{"source":"iana"},"message/vnd.wfa.wsc":{"source":"iana","extensions":["wsc"]},"model/3mf":{"source":"iana","extensions":["3mf"]},"model/e57":{"source":"iana"},"model/gltf+json":{"source":"iana","compressible":true,"extensions":["gltf"]},"model/gltf-binary":{"source":"iana","compressible":true,"extensions":["glb"]},"model/iges":{"source":"iana","compressible":false,"extensions":["igs","iges"]},"model/mesh":{"source":"iana","compressible":false,"extensions":["msh","mesh","silo"]},"model/mtl":{"source":"iana","extensions":["mtl"]},"model/obj":{"source":"iana","extensions":["obj"]},"model/step":{"source":"iana"},"model/step+xml":{"source":"iana","compressible":true,"extensions":["stpx"]},"model/step+zip":{"source":"iana","compressible":false,"extensions":["stpz"]},"model/step-xml+zip":{"source":"iana","compressible":false,"extensions":["stpxz"]},"model/stl":{"source":"iana","extensions":["stl"]},"model/vnd.collada+xml":{"source":"iana","compressible":true,"extensions":["dae"]},"model/vnd.dwf":{"source":"iana","extensions":["dwf"]},"model/vnd.flatland.3dml":{"source":"iana"},"model/vnd.gdl":{"source":"iana","extensions":["gdl"]},"model/vnd.gs-gdl":{"source":"apache"},"model/vnd.gs.gdl":{"source":"iana"},"model/vnd.gtw":{"source":"iana","extensions":["gtw"]},"model/vnd.moml+xml":{"source":"iana","compressible":true},"model/vnd.mts":{"source":"iana","extensions":["mts"]},"model/vnd.opengex":{"source":"iana","extensions":["ogex"]},"model/vnd.parasolid.transmit.binary":{"source":"iana","extensions":["x_b"]},"model/vnd.parasolid.transmit.text":{"source":"iana","extensions":["x_t"]},"model/vnd.pytha.pyox":{"source":"iana"},"model/vnd.rosette.annotated-data-model":{"source":"iana"},"model/vnd.sap.vds":{"source":"iana","extensions":["vds"]},"model/vnd.usdz+zip":{"source":"iana","compressible":false,"extensions":["usdz"]},"model/vnd.valve.source.compiled-map":{"source":"iana","extensions":["bsp"]},"model/vnd.vtu":{"source":"iana","extensions":["vtu"]},"model/vrml":{"source":"iana","compressible":false,"extensions":["wrl","vrml"]},"model/x3d+binary":{"source":"apache","compressible":false,"extensions":["x3db","x3dbz"]},"model/x3d+fastinfoset":{"source":"iana","extensions":["x3db"]},"model/x3d+vrml":{"source":"apache","compressible":false,"extensions":["x3dv","x3dvz"]},"model/x3d+xml":{"source":"iana","compressible":true,"extensions":["x3d","x3dz"]},"model/x3d-vrml":{"source":"iana","extensions":["x3dv"]},"multipart/alternative":{"source":"iana","compressible":false},"multipart/appledouble":{"source":"iana"},"multipart/byteranges":{"source":"iana"},"multipart/digest":{"source":"iana"},"multipart/encrypted":{"source":"iana","compressible":false},"multipart/form-data":{"source":"iana","compressible":false},"multipart/header-set":{"source":"iana"},"multipart/mixed":{"source":"iana"},"multipart/multilingual":{"source":"iana"},"multipart/parallel":{"source":"iana"},"multipart/related":{"source":"iana","compressible":false},"multipart/report":{"source":"iana"},"multipart/signed":{"source":"iana","compressible":false},"multipart/vnd.bint.med-plus":{"source":"iana"},"multipart/voice-message":{"source":"iana"},"multipart/x-mixed-replace":{"source":"iana"},"text/1d-interleaved-parityfec":{"source":"iana"},"text/cache-manifest":{"source":"iana","compressible":true,"extensions":["appcache","manifest"]},"text/calendar":{"source":"iana","extensions":["ics","ifb"]},"text/calender":{"compressible":true},"text/cmd":{"compressible":true},"text/coffeescript":{"extensions":["coffee","litcoffee"]},"text/cql":{"source":"iana"},"text/cql-expression":{"source":"iana"},"text/cql-identifier":{"source":"iana"},"text/css":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["css"]},"text/csv":{"source":"iana","compressible":true,"extensions":["csv"]},"text/csv-schema":{"source":"iana"},"text/directory":{"source":"iana"},"text/dns":{"source":"iana"},"text/ecmascript":{"source":"iana"},"text/encaprtp":{"source":"iana"},"text/enriched":{"source":"iana"},"text/fhirpath":{"source":"iana"},"text/flexfec":{"source":"iana"},"text/fwdred":{"source":"iana"},"text/gff3":{"source":"iana"},"text/grammar-ref-list":{"source":"iana"},"text/html":{"source":"iana","compressible":true,"extensions":["html","htm","shtml"]},"text/jade":{"extensions":["jade"]},"text/javascript":{"source":"iana","compressible":true},"text/jcr-cnd":{"source":"iana"},"text/jsx":{"compressible":true,"extensions":["jsx"]},"text/less":{"compressible":true,"extensions":["less"]},"text/markdown":{"source":"iana","compressible":true,"extensions":["markdown","md"]},"text/mathml":{"source":"nginx","extensions":["mml"]},"text/mdx":{"compressible":true,"extensions":["mdx"]},"text/mizar":{"source":"iana"},"text/n3":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["n3"]},"text/parameters":{"source":"iana","charset":"UTF-8"},"text/parityfec":{"source":"iana"},"text/plain":{"source":"iana","compressible":true,"extensions":["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{"source":"iana","charset":"UTF-8"},"text/prs.fallenstein.rst":{"source":"iana"},"text/prs.lines.tag":{"source":"iana","extensions":["dsc"]},"text/prs.prop.logic":{"source":"iana"},"text/raptorfec":{"source":"iana"},"text/red":{"source":"iana"},"text/rfc822-headers":{"source":"iana"},"text/richtext":{"source":"iana","compressible":true,"extensions":["rtx"]},"text/rtf":{"source":"iana","compressible":true,"extensions":["rtf"]},"text/rtp-enc-aescm128":{"source":"iana"},"text/rtploopback":{"source":"iana"},"text/rtx":{"source":"iana"},"text/sgml":{"source":"iana","extensions":["sgml","sgm"]},"text/shaclc":{"source":"iana"},"text/shex":{"source":"iana","extensions":["shex"]},"text/slim":{"extensions":["slim","slm"]},"text/spdx":{"source":"iana","extensions":["spdx"]},"text/strings":{"source":"iana"},"text/stylus":{"extensions":["stylus","styl"]},"text/t140":{"source":"iana"},"text/tab-separated-values":{"source":"iana","compressible":true,"extensions":["tsv"]},"text/troff":{"source":"iana","extensions":["t","tr","roff","man","me","ms"]},"text/turtle":{"source":"iana","charset":"UTF-8","extensions":["ttl"]},"text/ulpfec":{"source":"iana"},"text/uri-list":{"source":"iana","compressible":true,"extensions":["uri","uris","urls"]},"text/vcard":{"source":"iana","compressible":true,"extensions":["vcard"]},"text/vnd.a":{"source":"iana"},"text/vnd.abc":{"source":"iana"},"text/vnd.ascii-art":{"source":"iana"},"text/vnd.curl":{"source":"iana","extensions":["curl"]},"text/vnd.curl.dcurl":{"source":"apache","extensions":["dcurl"]},"text/vnd.curl.mcurl":{"source":"apache","extensions":["mcurl"]},"text/vnd.curl.scurl":{"source":"apache","extensions":["scurl"]},"text/vnd.debian.copyright":{"source":"iana","charset":"UTF-8"},"text/vnd.dmclientscript":{"source":"iana"},"text/vnd.dvb.subtitle":{"source":"iana","extensions":["sub"]},"text/vnd.esmertec.theme-descriptor":{"source":"iana","charset":"UTF-8"},"text/vnd.familysearch.gedcom":{"source":"iana","extensions":["ged"]},"text/vnd.ficlab.flt":{"source":"iana"},"text/vnd.fly":{"source":"iana","extensions":["fly"]},"text/vnd.fmi.flexstor":{"source":"iana","extensions":["flx"]},"text/vnd.gml":{"source":"iana"},"text/vnd.graphviz":{"source":"iana","extensions":["gv"]},"text/vnd.hans":{"source":"iana"},"text/vnd.hgl":{"source":"iana"},"text/vnd.in3d.3dml":{"source":"iana","extensions":["3dml"]},"text/vnd.in3d.spot":{"source":"iana","extensions":["spot"]},"text/vnd.iptc.newsml":{"source":"iana"},"text/vnd.iptc.nitf":{"source":"iana"},"text/vnd.latex-z":{"source":"iana"},"text/vnd.motorola.reflex":{"source":"iana"},"text/vnd.ms-mediapackage":{"source":"iana"},"text/vnd.net2phone.commcenter.command":{"source":"iana"},"text/vnd.radisys.msml-basic-layout":{"source":"iana"},"text/vnd.senx.warpscript":{"source":"iana"},"text/vnd.si.uricatalogue":{"source":"iana"},"text/vnd.sosi":{"source":"iana"},"text/vnd.sun.j2me.app-descriptor":{"source":"iana","charset":"UTF-8","extensions":["jad"]},"text/vnd.trolltech.linguist":{"source":"iana","charset":"UTF-8"},"text/vnd.wap.si":{"source":"iana"},"text/vnd.wap.sl":{"source":"iana"},"text/vnd.wap.wml":{"source":"iana","extensions":["wml"]},"text/vnd.wap.wmlscript":{"source":"iana","extensions":["wmls"]},"text/vtt":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["vtt"]},"text/x-asm":{"source":"apache","extensions":["s","asm"]},"text/x-c":{"source":"apache","extensions":["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{"source":"nginx","extensions":["htc"]},"text/x-fortran":{"source":"apache","extensions":["f","for","f77","f90"]},"text/x-gwt-rpc":{"compressible":true},"text/x-handlebars-template":{"extensions":["hbs"]},"text/x-java-source":{"source":"apache","extensions":["java"]},"text/x-jquery-tmpl":{"compressible":true},"text/x-lua":{"extensions":["lua"]},"text/x-markdown":{"compressible":true,"extensions":["mkd"]},"text/x-nfo":{"source":"apache","extensions":["nfo"]},"text/x-opml":{"source":"apache","extensions":["opml"]},"text/x-org":{"compressible":true,"extensions":["org"]},"text/x-pascal":{"source":"apache","extensions":["p","pas"]},"text/x-processing":{"compressible":true,"extensions":["pde"]},"text/x-sass":{"extensions":["sass"]},"text/x-scss":{"extensions":["scss"]},"text/x-setext":{"source":"apache","extensions":["etx"]},"text/x-sfv":{"source":"apache","extensions":["sfv"]},"text/x-suse-ymp":{"compressible":true,"extensions":["ymp"]},"text/x-uuencode":{"source":"apache","extensions":["uu"]},"text/x-vcalendar":{"source":"apache","extensions":["vcs"]},"text/x-vcard":{"source":"apache","extensions":["vcf"]},"text/xml":{"source":"iana","compressible":true,"extensions":["xml"]},"text/xml-external-parsed-entity":{"source":"iana"},"text/yaml":{"compressible":true,"extensions":["yaml","yml"]},"video/1d-interleaved-parityfec":{"source":"iana"},"video/3gpp":{"source":"iana","extensions":["3gp","3gpp"]},"video/3gpp-tt":{"source":"iana"},"video/3gpp2":{"source":"iana","extensions":["3g2"]},"video/av1":{"source":"iana"},"video/bmpeg":{"source":"iana"},"video/bt656":{"source":"iana"},"video/celb":{"source":"iana"},"video/dv":{"source":"iana"},"video/encaprtp":{"source":"iana"},"video/ffv1":{"source":"iana"},"video/flexfec":{"source":"iana"},"video/h261":{"source":"iana","extensions":["h261"]},"video/h263":{"source":"iana","extensions":["h263"]},"video/h263-1998":{"source":"iana"},"video/h263-2000":{"source":"iana"},"video/h264":{"source":"iana","extensions":["h264"]},"video/h264-rcdo":{"source":"iana"},"video/h264-svc":{"source":"iana"},"video/h265":{"source":"iana"},"video/iso.segment":{"source":"iana","extensions":["m4s"]},"video/jpeg":{"source":"iana","extensions":["jpgv"]},"video/jpeg2000":{"source":"iana"},"video/jpm":{"source":"apache","extensions":["jpm","jpgm"]},"video/jxsv":{"source":"iana"},"video/mj2":{"source":"iana","extensions":["mj2","mjp2"]},"video/mp1s":{"source":"iana"},"video/mp2p":{"source":"iana"},"video/mp2t":{"source":"iana","extensions":["ts"]},"video/mp4":{"source":"iana","compressible":false,"extensions":["mp4","mp4v","mpg4"]},"video/mp4v-es":{"source":"iana"},"video/mpeg":{"source":"iana","compressible":false,"extensions":["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{"source":"iana"},"video/mpv":{"source":"iana"},"video/nv":{"source":"iana"},"video/ogg":{"source":"iana","compressible":false,"extensions":["ogv"]},"video/parityfec":{"source":"iana"},"video/pointer":{"source":"iana"},"video/quicktime":{"source":"iana","compressible":false,"extensions":["qt","mov"]},"video/raptorfec":{"source":"iana"},"video/raw":{"source":"iana"},"video/rtp-enc-aescm128":{"source":"iana"},"video/rtploopback":{"source":"iana"},"video/rtx":{"source":"iana"},"video/scip":{"source":"iana"},"video/smpte291":{"source":"iana"},"video/smpte292m":{"source":"iana"},"video/ulpfec":{"source":"iana"},"video/vc1":{"source":"iana"},"video/vc2":{"source":"iana"},"video/vnd.cctv":{"source":"iana"},"video/vnd.dece.hd":{"source":"iana","extensions":["uvh","uvvh"]},"video/vnd.dece.mobile":{"source":"iana","extensions":["uvm","uvvm"]},"video/vnd.dece.mp4":{"source":"iana"},"video/vnd.dece.pd":{"source":"iana","extensions":["uvp","uvvp"]},"video/vnd.dece.sd":{"source":"iana","extensions":["uvs","uvvs"]},"video/vnd.dece.video":{"source":"iana","extensions":["uvv","uvvv"]},"video/vnd.directv.mpeg":{"source":"iana"},"video/vnd.directv.mpeg-tts":{"source":"iana"},"video/vnd.dlna.mpeg-tts":{"source":"iana"},"video/vnd.dvb.file":{"source":"iana","extensions":["dvb"]},"video/vnd.fvt":{"source":"iana","extensions":["fvt"]},"video/vnd.hns.video":{"source":"iana"},"video/vnd.iptvforum.1dparityfec-1010":{"source":"iana"},"video/vnd.iptvforum.1dparityfec-2005":{"source":"iana"},"video/vnd.iptvforum.2dparityfec-1010":{"source":"iana"},"video/vnd.iptvforum.2dparityfec-2005":{"source":"iana"},"video/vnd.iptvforum.ttsavc":{"source":"iana"},"video/vnd.iptvforum.ttsmpeg2":{"source":"iana"},"video/vnd.motorola.video":{"source":"iana"},"video/vnd.motorola.videop":{"source":"iana"},"video/vnd.mpegurl":{"source":"iana","extensions":["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{"source":"iana","extensions":["pyv"]},"video/vnd.nokia.interleaved-multimedia":{"source":"iana"},"video/vnd.nokia.mp4vr":{"source":"iana"},"video/vnd.nokia.videovoip":{"source":"iana"},"video/vnd.objectvideo":{"source":"iana"},"video/vnd.radgamettools.bink":{"source":"iana"},"video/vnd.radgamettools.smacker":{"source":"iana"},"video/vnd.sealed.mpeg1":{"source":"iana"},"video/vnd.sealed.mpeg4":{"source":"iana"},"video/vnd.sealed.swf":{"source":"iana"},"video/vnd.sealedmedia.softseal.mov":{"source":"iana"},"video/vnd.uvvu.mp4":{"source":"iana","extensions":["uvu","uvvu"]},"video/vnd.vivo":{"source":"iana","extensions":["viv"]},"video/vnd.youtube.yt":{"source":"iana"},"video/vp8":{"source":"iana"},"video/vp9":{"source":"iana"},"video/webm":{"source":"apache","compressible":false,"extensions":["webm"]},"video/x-f4v":{"source":"apache","extensions":["f4v"]},"video/x-fli":{"source":"apache","extensions":["fli"]},"video/x-flv":{"source":"apache","compressible":false,"extensions":["flv"]},"video/x-m4v":{"source":"apache","extensions":["m4v"]},"video/x-matroska":{"source":"apache","compressible":false,"extensions":["mkv","mk3d","mks"]},"video/x-mng":{"source":"apache","extensions":["mng"]},"video/x-ms-asf":{"source":"apache","extensions":["asf","asx"]},"video/x-ms-vob":{"source":"apache","extensions":["vob"]},"video/x-ms-wm":{"source":"apache","extensions":["wm"]},"video/x-ms-wmv":{"source":"apache","compressible":false,"extensions":["wmv"]},"video/x-ms-wmx":{"source":"apache","extensions":["wmx"]},"video/x-ms-wvx":{"source":"apache","extensions":["wvx"]},"video/x-msvideo":{"source":"apache","extensions":["avi"]},"video/x-sgi-movie":{"source":"apache","extensions":["movie"]},"video/x-smv":{"source":"apache","extensions":["smv"]},"x-conference/x-cooltalk":{"source":"apache","extensions":["ice"]},"x-shader/x-fragment":{"compressible":true},"x-shader/x-vertex":{"compressible":true}}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __nccwpck_require__(3109); +/******/ module.exports = __webpack_exports__; +/******/ +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 000000000..bcdaaf596 --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC/UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC1RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC5lBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC3EA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC/MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC5QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACjRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACtQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC1GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC5mBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACpfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACjKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC3GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACtIA;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACvQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC1GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC7EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACpBA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC5oIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC7BA;AACA;;;;AEDA;AACA;AACA;AACA","sources":["../webpack://action-upload-diawi/./lib/diawi.js","../webpack://action-upload-diawi/./lib/main.js","../webpack://action-upload-diawi/./node_modules/@actions/core/lib/command.js","../webpack://action-upload-diawi/./node_modules/@actions/core/lib/core.js","../webpack://action-upload-diawi/./node_modules/@actions/core/lib/file-command.js","../webpack://action-upload-diawi/./node_modules/@actions/core/lib/oidc-utils.js","../webpack://action-upload-diawi/./node_modules/@actions/core/lib/path-utils.js","../webpack://action-upload-diawi/./node_modules/@actions/core/lib/summary.js","../webpack://action-upload-diawi/./node_modules/@actions/core/lib/utils.js","../webpack://action-upload-diawi/./node_modules/@actions/http-client/lib/auth.js","../webpack://action-upload-diawi/./node_modules/@actions/http-client/lib/index.js","../webpack://action-upload-diawi/./node_modules/@actions/http-client/lib/proxy.js","../webpack://action-upload-diawi/./node_modules/asynckit/index.js","../webpack://action-upload-diawi/./node_modules/asynckit/lib/abort.js","../webpack://action-upload-diawi/./node_modules/asynckit/lib/async.js","../webpack://action-upload-diawi/./node_modules/asynckit/lib/defer.js","../webpack://action-upload-diawi/./node_modules/asynckit/lib/iterate.js","../webpack://action-upload-diawi/./node_modules/asynckit/lib/state.js","../webpack://action-upload-diawi/./node_modules/asynckit/lib/terminator.js","../webpack://action-upload-diawi/./node_modules/asynckit/parallel.js","../webpack://action-upload-diawi/./node_modules/asynckit/serial.js","../webpack://action-upload-diawi/./node_modules/asynckit/serialOrdered.js","../webpack://action-upload-diawi/./node_modules/combined-stream/lib/combined_stream.js","../webpack://action-upload-diawi/./node_modules/debug/src/browser.js","../webpack://action-upload-diawi/./node_modules/debug/src/common.js","../webpack://action-upload-diawi/./node_modules/debug/src/index.js","../webpack://action-upload-diawi/./node_modules/debug/src/node.js","../webpack://action-upload-diawi/./node_modules/delayed-stream/lib/delayed_stream.js","../webpack://action-upload-diawi/./node_modules/follow-redirects/debug.js","../webpack://action-upload-diawi/./node_modules/follow-redirects/index.js","../webpack://action-upload-diawi/./node_modules/form-data/lib/form_data.js","../webpack://action-upload-diawi/./node_modules/form-data/lib/populate.js","../webpack://action-upload-diawi/./node_modules/has-flag/index.js","../webpack://action-upload-diawi/./node_modules/mime-db/index.js","../webpack://action-upload-diawi/./node_modules/mime-types/index.js","../webpack://action-upload-diawi/./node_modules/ms/index.js","../webpack://action-upload-diawi/./node_modules/proxy-from-env/index.js","../webpack://action-upload-diawi/./node_modules/supports-color/index.js","../webpack://action-upload-diawi/./node_modules/tunnel/index.js","../webpack://action-upload-diawi/./node_modules/tunnel/lib/tunnel.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/index.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/md5.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/nil.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/parse.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/regex.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/rng.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/sha1.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/stringify.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/v1.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/v3.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/v35.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/v4.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/v5.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/validate.js","../webpack://action-upload-diawi/./node_modules/uuid/dist/version.js","../webpack://action-upload-diawi/external node-commonjs \"assert\"","../webpack://action-upload-diawi/external node-commonjs \"crypto\"","../webpack://action-upload-diawi/external node-commonjs \"events\"","../webpack://action-upload-diawi/external node-commonjs \"fs\"","../webpack://action-upload-diawi/external node-commonjs \"http\"","../webpack://action-upload-diawi/external node-commonjs \"https\"","../webpack://action-upload-diawi/external node-commonjs \"net\"","../webpack://action-upload-diawi/external node-commonjs \"node:fs\"","../webpack://action-upload-diawi/external node-commonjs \"os\"","../webpack://action-upload-diawi/external node-commonjs \"path\"","../webpack://action-upload-diawi/external node-commonjs \"stream\"","../webpack://action-upload-diawi/external node-commonjs \"tls\"","../webpack://action-upload-diawi/external node-commonjs \"tty\"","../webpack://action-upload-diawi/external node-commonjs \"url\"","../webpack://action-upload-diawi/external node-commonjs \"util\"","../webpack://action-upload-diawi/external node-commonjs \"zlib\"","../webpack://action-upload-diawi/./node_modules/axios/dist/node/axios.cjs","../webpack://action-upload-diawi/webpack/bootstrap","../webpack://action-upload-diawi/webpack/runtime/compat","../webpack://action-upload-diawi/webpack/before-startup","../webpack://action-upload-diawi/webpack/startup","../webpack://action-upload-diawi/webpack/after-startup"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.uploadToDiawi = void 0;\nconst node_fs_1 = require(\"node:fs\");\nconst axios_1 = __importDefault(require(\"axios\"));\nconst form_data_1 = __importDefault(require(\"form-data\"));\nconst UPLOAD_URL = 'https://upload.diawi.com';\nconst POLL_MAX_COUNT = 10;\nconst POLL_INTERVAL = 2;\nfunction uploadToDiawi(args) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!(0, node_fs_1.existsSync)(args.file)) {\n throw new Error(`Could not find file at ${args.file}`);\n }\n const file = (0, node_fs_1.createReadStream)(args.file);\n const data = new form_data_1.default();\n data.append('token', args.token);\n data.append('file', file);\n data.append('password', args.password);\n data.append('callback_emails', args.recipients);\n data.append('wall_of_apps', args.wallOfApps ? '1' : '0');\n data.append('find_by_udid', args.findByUdid ? '1' : '0');\n data.append('installation_notifications', args.installationNotifications ? '1' : '0');\n data.append('comment', args.comment);\n const response = yield axios_1.default.post(UPLOAD_URL, data, {\n headers: { 'Content-Type': 'multipart/form-data' },\n maxContentLength: Infinity,\n maxBodyLength: Infinity\n });\n const job = response.data.job;\n return pollUploadStatus(job, args.token);\n });\n}\nexports.uploadToDiawi = uploadToDiawi;\nfunction pollUploadStatus(job, token) {\n return __awaiter(this, void 0, void 0, function* () {\n let pollCount = 0;\n while (pollCount < POLL_MAX_COUNT) {\n const response = yield axios_1.default.get(`${UPLOAD_URL}/status?job=${job}&token=${token}`);\n switch (response.data.status) {\n case 2000:\n if (response.data.link) {\n return {\n url: response.data.link,\n qrcode: response.data.qrcode\n };\n }\n else {\n throw new Error('Failed to get link from success response');\n }\n case 2001:\n // Nothing, this just means poll again\n break;\n default:\n throw new Error(`Error in status response - ${response.data.message}`);\n }\n yield sleep(POLL_INTERVAL);\n pollCount++;\n }\n throw new Error('Timed out polling for job completion');\n });\n}\nconst sleep = (seconds) => __awaiter(void 0, void 0, void 0, function* () {\n return new Promise(resolve => {\n setTimeout(resolve, seconds * 1000);\n });\n});\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst core = __importStar(require(\"@actions/core\"));\nconst diawi_1 = require(\"./diawi\");\nfunction run() {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const token = core.getInput('token', { trimWhitespace: true });\n const file = core.getInput('file', { trimWhitespace: true });\n core.debug(`file: ${file}`);\n const password = core.getInput('password', { trimWhitespace: true });\n // core.debug(`password: ${password}`)\n const recipients = core.getInput('recipients', { trimWhitespace: true });\n core.debug(`recipients: ${recipients}`);\n const wallOfApps = core.getInput('wall_of_apps', { trimWhitespace: true }) === 'true';\n core.debug(`wallOfApps: ${wallOfApps}`);\n const findByUdid = core.getInput('find_by_udid', { trimWhitespace: true }) === 'true';\n core.debug(`findByUdid: ${findByUdid}`);\n const installationNotifications = core.getInput('installation_notifications', { trimWhitespace: true }) ===\n 'true';\n core.debug(`installationNotifications: ${installationNotifications}`);\n const dryRun = core.getInput('dry-run', { trimWhitespace: true }) === 'true';\n core.debug(`dryRun: ${dryRun}`);\n const comment = core.getInput('comment', { trimWhitespace: true });\n core.debug(comment); // debug is only output if you set the secret `ACTIONS_STEP_DEBUG` to true\n const { url, qrcode } = yield (0, diawi_1.uploadToDiawi)({\n token,\n file,\n password,\n recipients,\n wallOfApps,\n findByUdid,\n installationNotifications,\n dryRun,\n comment\n });\n core.debug(`url: ${url}`);\n core.setOutput('url', url);\n core.debug(`qrcode: ${qrcode}`);\n core.setOutput('qrcode', qrcode);\n }\n catch (error) {\n if (error instanceof Error)\n core.setFailed(error.message);\n }\n });\n}\nrun();\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.issue = exports.issueCommand = void 0;\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\n/**\n * Commands\n *\n * Command Format:\n * ::name key=value,key=value::message\n *\n * Examples:\n * ::warning::This is the message\n * ::set-env name=MY_VAR::some value\n */\nfunction issueCommand(command, properties, message) {\n const cmd = new Command(command, properties, message);\n process.stdout.write(cmd.toString() + os.EOL);\n}\nexports.issueCommand = issueCommand;\nfunction issue(name, message = '') {\n issueCommand(name, {}, message);\n}\nexports.issue = issue;\nconst CMD_STRING = '::';\nclass Command {\n constructor(command, properties, message) {\n if (!command) {\n command = 'missing.command';\n }\n this.command = command;\n this.properties = properties;\n this.message = message;\n }\n toString() {\n let cmdStr = CMD_STRING + this.command;\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' ';\n let first = true;\n for (const key in this.properties) {\n if (this.properties.hasOwnProperty(key)) {\n const val = this.properties[key];\n if (val) {\n if (first) {\n first = false;\n }\n else {\n cmdStr += ',';\n }\n cmdStr += `${key}=${escapeProperty(val)}`;\n }\n }\n }\n }\n cmdStr += `${CMD_STRING}${escapeData(this.message)}`;\n return cmdStr;\n }\n}\nfunction escapeData(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A');\n}\nfunction escapeProperty(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A')\n .replace(/:/g, '%3A')\n .replace(/,/g, '%2C');\n}\n//# sourceMappingURL=command.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;\nconst command_1 = require(\"./command\");\nconst file_command_1 = require(\"./file-command\");\nconst utils_1 = require(\"./utils\");\nconst os = __importStar(require(\"os\"));\nconst path = __importStar(require(\"path\"));\nconst oidc_utils_1 = require(\"./oidc-utils\");\n/**\n * The code to exit an action\n */\nvar ExitCode;\n(function (ExitCode) {\n /**\n * A code indicating that the action was successful\n */\n ExitCode[ExitCode[\"Success\"] = 0] = \"Success\";\n /**\n * A code indicating that the action was a failure\n */\n ExitCode[ExitCode[\"Failure\"] = 1] = \"Failure\";\n})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));\n//-----------------------------------------------------------------------\n// Variables\n//-----------------------------------------------------------------------\n/**\n * Sets env variable for this action and future actions in the job\n * @param name the name of the variable to set\n * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction exportVariable(name, val) {\n const convertedVal = utils_1.toCommandValue(val);\n process.env[name] = convertedVal;\n const filePath = process.env['GITHUB_ENV'] || '';\n if (filePath) {\n return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));\n }\n command_1.issueCommand('set-env', { name }, convertedVal);\n}\nexports.exportVariable = exportVariable;\n/**\n * Registers a secret which will get masked from logs\n * @param secret value of the secret\n */\nfunction setSecret(secret) {\n command_1.issueCommand('add-mask', {}, secret);\n}\nexports.setSecret = setSecret;\n/**\n * Prepends inputPath to the PATH (for this action and future actions)\n * @param inputPath\n */\nfunction addPath(inputPath) {\n const filePath = process.env['GITHUB_PATH'] || '';\n if (filePath) {\n file_command_1.issueFileCommand('PATH', inputPath);\n }\n else {\n command_1.issueCommand('add-path', {}, inputPath);\n }\n process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;\n}\nexports.addPath = addPath;\n/**\n * Gets the value of an input.\n * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.\n * Returns an empty string if the value is not defined.\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns string\n */\nfunction getInput(name, options) {\n const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';\n if (options && options.required && !val) {\n throw new Error(`Input required and not supplied: ${name}`);\n }\n if (options && options.trimWhitespace === false) {\n return val;\n }\n return val.trim();\n}\nexports.getInput = getInput;\n/**\n * Gets the values of an multiline input. Each value is also trimmed.\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns string[]\n *\n */\nfunction getMultilineInput(name, options) {\n const inputs = getInput(name, options)\n .split('\\n')\n .filter(x => x !== '');\n if (options && options.trimWhitespace === false) {\n return inputs;\n }\n return inputs.map(input => input.trim());\n}\nexports.getMultilineInput = getMultilineInput;\n/**\n * Gets the input value of the boolean type in the YAML 1.2 \"core schema\" specification.\n * Support boolean input list: `true | True | TRUE | false | False | FALSE` .\n * The return value is also in boolean type.\n * ref: https://yaml.org/spec/1.2/spec.html#id2804923\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns boolean\n */\nfunction getBooleanInput(name, options) {\n const trueValue = ['true', 'True', 'TRUE'];\n const falseValue = ['false', 'False', 'FALSE'];\n const val = getInput(name, options);\n if (trueValue.includes(val))\n return true;\n if (falseValue.includes(val))\n return false;\n throw new TypeError(`Input does not meet YAML 1.2 \"Core Schema\" specification: ${name}\\n` +\n `Support boolean input list: \\`true | True | TRUE | false | False | FALSE\\``);\n}\nexports.getBooleanInput = getBooleanInput;\n/**\n * Sets the value of an output.\n *\n * @param name name of the output to set\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction setOutput(name, value) {\n const filePath = process.env['GITHUB_OUTPUT'] || '';\n if (filePath) {\n return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));\n }\n process.stdout.write(os.EOL);\n command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));\n}\nexports.setOutput = setOutput;\n/**\n * Enables or disables the echoing of commands into stdout for the rest of the step.\n * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.\n *\n */\nfunction setCommandEcho(enabled) {\n command_1.issue('echo', enabled ? 'on' : 'off');\n}\nexports.setCommandEcho = setCommandEcho;\n//-----------------------------------------------------------------------\n// Results\n//-----------------------------------------------------------------------\n/**\n * Sets the action status to failed.\n * When the action exits it will be with an exit code of 1\n * @param message add error issue message\n */\nfunction setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}\nexports.setFailed = setFailed;\n//-----------------------------------------------------------------------\n// Logging Commands\n//-----------------------------------------------------------------------\n/**\n * Gets whether Actions Step Debug is on or not\n */\nfunction isDebug() {\n return process.env['RUNNER_DEBUG'] === '1';\n}\nexports.isDebug = isDebug;\n/**\n * Writes debug message to user log\n * @param message debug message\n */\nfunction debug(message) {\n command_1.issueCommand('debug', {}, message);\n}\nexports.debug = debug;\n/**\n * Adds an error issue\n * @param message error issue message. Errors will be converted to string via toString()\n * @param properties optional properties to add to the annotation.\n */\nfunction error(message, properties = {}) {\n command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);\n}\nexports.error = error;\n/**\n * Adds a warning issue\n * @param message warning issue message. Errors will be converted to string via toString()\n * @param properties optional properties to add to the annotation.\n */\nfunction warning(message, properties = {}) {\n command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);\n}\nexports.warning = warning;\n/**\n * Adds a notice issue\n * @param message notice issue message. Errors will be converted to string via toString()\n * @param properties optional properties to add to the annotation.\n */\nfunction notice(message, properties = {}) {\n command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);\n}\nexports.notice = notice;\n/**\n * Writes info to log with console.log.\n * @param message info message\n */\nfunction info(message) {\n process.stdout.write(message + os.EOL);\n}\nexports.info = info;\n/**\n * Begin an output group.\n *\n * Output until the next `groupEnd` will be foldable in this group\n *\n * @param name The name of the output group\n */\nfunction startGroup(name) {\n command_1.issue('group', name);\n}\nexports.startGroup = startGroup;\n/**\n * End an output group.\n */\nfunction endGroup() {\n command_1.issue('endgroup');\n}\nexports.endGroup = endGroup;\n/**\n * Wrap an asynchronous function call in a group.\n *\n * Returns the same type as the function itself.\n *\n * @param name The name of the group\n * @param fn The function to wrap in the group\n */\nfunction group(name, fn) {\n return __awaiter(this, void 0, void 0, function* () {\n startGroup(name);\n let result;\n try {\n result = yield fn();\n }\n finally {\n endGroup();\n }\n return result;\n });\n}\nexports.group = group;\n//-----------------------------------------------------------------------\n// Wrapper action state\n//-----------------------------------------------------------------------\n/**\n * Saves state for current action, the state can only be retrieved by this action's post job execution.\n *\n * @param name name of the state to store\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction saveState(name, value) {\n const filePath = process.env['GITHUB_STATE'] || '';\n if (filePath) {\n return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));\n }\n command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));\n}\nexports.saveState = saveState;\n/**\n * Gets the value of an state set by this action's main execution.\n *\n * @param name name of the state to get\n * @returns string\n */\nfunction getState(name) {\n return process.env[`STATE_${name}`] || '';\n}\nexports.getState = getState;\nfunction getIDToken(aud) {\n return __awaiter(this, void 0, void 0, function* () {\n return yield oidc_utils_1.OidcClient.getIDToken(aud);\n });\n}\nexports.getIDToken = getIDToken;\n/**\n * Summary exports\n */\nvar summary_1 = require(\"./summary\");\nObject.defineProperty(exports, \"summary\", { enumerable: true, get: function () { return summary_1.summary; } });\n/**\n * @deprecated use core.summary\n */\nvar summary_2 = require(\"./summary\");\nObject.defineProperty(exports, \"markdownSummary\", { enumerable: true, get: function () { return summary_2.markdownSummary; } });\n/**\n * Path exports\n */\nvar path_utils_1 = require(\"./path-utils\");\nObject.defineProperty(exports, \"toPosixPath\", { enumerable: true, get: function () { return path_utils_1.toPosixPath; } });\nObject.defineProperty(exports, \"toWin32Path\", { enumerable: true, get: function () { return path_utils_1.toWin32Path; } });\nObject.defineProperty(exports, \"toPlatformPath\", { enumerable: true, get: function () { return path_utils_1.toPlatformPath; } });\n//# sourceMappingURL=core.js.map","\"use strict\";\n// For internal use, subject to change.\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.prepareKeyValueMessage = exports.issueFileCommand = void 0;\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nconst fs = __importStar(require(\"fs\"));\nconst os = __importStar(require(\"os\"));\nconst uuid_1 = require(\"uuid\");\nconst utils_1 = require(\"./utils\");\nfunction issueFileCommand(command, message) {\n const filePath = process.env[`GITHUB_${command}`];\n if (!filePath) {\n throw new Error(`Unable to find environment variable for file command ${command}`);\n }\n if (!fs.existsSync(filePath)) {\n throw new Error(`Missing file at path: ${filePath}`);\n }\n fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {\n encoding: 'utf8'\n });\n}\nexports.issueFileCommand = issueFileCommand;\nfunction prepareKeyValueMessage(key, value) {\n const delimiter = `ghadelimiter_${uuid_1.v4()}`;\n const convertedValue = utils_1.toCommandValue(value);\n // These should realistically never happen, but just in case someone finds a\n // way to exploit uuid generation let's not allow keys or values that contain\n // the delimiter.\n if (key.includes(delimiter)) {\n throw new Error(`Unexpected input: name should not contain the delimiter \"${delimiter}\"`);\n }\n if (convertedValue.includes(delimiter)) {\n throw new Error(`Unexpected input: value should not contain the delimiter \"${delimiter}\"`);\n }\n return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;\n}\nexports.prepareKeyValueMessage = prepareKeyValueMessage;\n//# sourceMappingURL=file-command.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.OidcClient = void 0;\nconst http_client_1 = require(\"@actions/http-client\");\nconst auth_1 = require(\"@actions/http-client/lib/auth\");\nconst core_1 = require(\"./core\");\nclass OidcClient {\n static createHttpClient(allowRetry = true, maxRetry = 10) {\n const requestOptions = {\n allowRetries: allowRetry,\n maxRetries: maxRetry\n };\n return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);\n }\n static getRequestToken() {\n const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];\n if (!token) {\n throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');\n }\n return token;\n }\n static getIDTokenUrl() {\n const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];\n if (!runtimeUrl) {\n throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');\n }\n return runtimeUrl;\n }\n static getCall(id_token_url) {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n const httpclient = OidcClient.createHttpClient();\n const res = yield httpclient\n .getJson(id_token_url)\n .catch(error => {\n throw new Error(`Failed to get ID Token. \\n \n Error Code : ${error.statusCode}\\n \n Error Message: ${error.result.message}`);\n });\n const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;\n if (!id_token) {\n throw new Error('Response json body do not have ID Token field');\n }\n return id_token;\n });\n }\n static getIDToken(audience) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n // New ID Token is requested from action service\n let id_token_url = OidcClient.getIDTokenUrl();\n if (audience) {\n const encodedAudience = encodeURIComponent(audience);\n id_token_url = `${id_token_url}&audience=${encodedAudience}`;\n }\n core_1.debug(`ID token url is ${id_token_url}`);\n const id_token = yield OidcClient.getCall(id_token_url);\n core_1.setSecret(id_token);\n return id_token;\n }\n catch (error) {\n throw new Error(`Error message: ${error.message}`);\n }\n });\n }\n}\nexports.OidcClient = OidcClient;\n//# sourceMappingURL=oidc-utils.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;\nconst path = __importStar(require(\"path\"));\n/**\n * toPosixPath converts the given path to the posix form. On Windows, \\\\ will be\n * replaced with /.\n *\n * @param pth. Path to transform.\n * @return string Posix path.\n */\nfunction toPosixPath(pth) {\n return pth.replace(/[\\\\]/g, '/');\n}\nexports.toPosixPath = toPosixPath;\n/**\n * toWin32Path converts the given path to the win32 form. On Linux, / will be\n * replaced with \\\\.\n *\n * @param pth. Path to transform.\n * @return string Win32 path.\n */\nfunction toWin32Path(pth) {\n return pth.replace(/[/]/g, '\\\\');\n}\nexports.toWin32Path = toWin32Path;\n/**\n * toPlatformPath converts the given path to a platform-specific path. It does\n * this by replacing instances of / and \\ with the platform-specific path\n * separator.\n *\n * @param pth The path to platformize.\n * @return string The platform-specific path.\n */\nfunction toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}\nexports.toPlatformPath = toPlatformPath;\n//# sourceMappingURL=path-utils.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;\nconst os_1 = require(\"os\");\nconst fs_1 = require(\"fs\");\nconst { access, appendFile, writeFile } = fs_1.promises;\nexports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';\nexports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';\nclass Summary {\n constructor() {\n this._buffer = '';\n }\n /**\n * Finds the summary file path from the environment, rejects if env var is not found or file does not exist\n * Also checks r/w permissions.\n *\n * @returns step summary file path\n */\n filePath() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._filePath) {\n return this._filePath;\n }\n const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];\n if (!pathFromEnv) {\n throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);\n }\n try {\n yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);\n }\n catch (_a) {\n throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);\n }\n this._filePath = pathFromEnv;\n return this._filePath;\n });\n }\n /**\n * Wraps content in an HTML tag, adding any HTML attributes\n *\n * @param {string} tag HTML tag to wrap\n * @param {string | null} content content within the tag\n * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add\n *\n * @returns {string} content wrapped in HTML element\n */\n wrap(tag, content, attrs = {}) {\n const htmlAttrs = Object.entries(attrs)\n .map(([key, value]) => ` ${key}=\"${value}\"`)\n .join('');\n if (!content) {\n return `<${tag}${htmlAttrs}>`;\n }\n return `<${tag}${htmlAttrs}>${content}`;\n }\n /**\n * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.\n *\n * @param {SummaryWriteOptions} [options] (optional) options for write operation\n *\n * @returns {Promise} summary instance\n */\n write(options) {\n return __awaiter(this, void 0, void 0, function* () {\n const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);\n const filePath = yield this.filePath();\n const writeFunc = overwrite ? writeFile : appendFile;\n yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });\n return this.emptyBuffer();\n });\n }\n /**\n * Clears the summary buffer and wipes the summary file\n *\n * @returns {Summary} summary instance\n */\n clear() {\n return __awaiter(this, void 0, void 0, function* () {\n return this.emptyBuffer().write({ overwrite: true });\n });\n }\n /**\n * Returns the current summary buffer as a string\n *\n * @returns {string} string of summary buffer\n */\n stringify() {\n return this._buffer;\n }\n /**\n * If the summary buffer is empty\n *\n * @returns {boolen} true if the buffer is empty\n */\n isEmptyBuffer() {\n return this._buffer.length === 0;\n }\n /**\n * Resets the summary buffer without writing to summary file\n *\n * @returns {Summary} summary instance\n */\n emptyBuffer() {\n this._buffer = '';\n return this;\n }\n /**\n * Adds raw text to the summary buffer\n *\n * @param {string} text content to add\n * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)\n *\n * @returns {Summary} summary instance\n */\n addRaw(text, addEOL = false) {\n this._buffer += text;\n return addEOL ? this.addEOL() : this;\n }\n /**\n * Adds the operating system-specific end-of-line marker to the buffer\n *\n * @returns {Summary} summary instance\n */\n addEOL() {\n return this.addRaw(os_1.EOL);\n }\n /**\n * Adds an HTML codeblock to the summary buffer\n *\n * @param {string} code content to render within fenced code block\n * @param {string} lang (optional) language to syntax highlight code\n *\n * @returns {Summary} summary instance\n */\n addCodeBlock(code, lang) {\n const attrs = Object.assign({}, (lang && { lang }));\n const element = this.wrap('pre', this.wrap('code', code), attrs);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML list to the summary buffer\n *\n * @param {string[]} items list of items to render\n * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)\n *\n * @returns {Summary} summary instance\n */\n addList(items, ordered = false) {\n const tag = ordered ? 'ol' : 'ul';\n const listItems = items.map(item => this.wrap('li', item)).join('');\n const element = this.wrap(tag, listItems);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML table to the summary buffer\n *\n * @param {SummaryTableCell[]} rows table rows\n *\n * @returns {Summary} summary instance\n */\n addTable(rows) {\n const tableBody = rows\n .map(row => {\n const cells = row\n .map(cell => {\n if (typeof cell === 'string') {\n return this.wrap('td', cell);\n }\n const { header, data, colspan, rowspan } = cell;\n const tag = header ? 'th' : 'td';\n const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));\n return this.wrap(tag, data, attrs);\n })\n .join('');\n return this.wrap('tr', cells);\n })\n .join('');\n const element = this.wrap('table', tableBody);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds a collapsable HTML details element to the summary buffer\n *\n * @param {string} label text for the closed state\n * @param {string} content collapsable content\n *\n * @returns {Summary} summary instance\n */\n addDetails(label, content) {\n const element = this.wrap('details', this.wrap('summary', label) + content);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML image tag to the summary buffer\n *\n * @param {string} src path to the image you to embed\n * @param {string} alt text description of the image\n * @param {SummaryImageOptions} options (optional) addition image attributes\n *\n * @returns {Summary} summary instance\n */\n addImage(src, alt, options) {\n const { width, height } = options || {};\n const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));\n const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML section heading element\n *\n * @param {string} text heading text\n * @param {number | string} [level=1] (optional) the heading level, default: 1\n *\n * @returns {Summary} summary instance\n */\n addHeading(text, level) {\n const tag = `h${level}`;\n const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)\n ? tag\n : 'h1';\n const element = this.wrap(allowedTag, text);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML thematic break (
) to the summary buffer\n *\n * @returns {Summary} summary instance\n */\n addSeparator() {\n const element = this.wrap('hr', null);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML line break (
) to the summary buffer\n *\n * @returns {Summary} summary instance\n */\n addBreak() {\n const element = this.wrap('br', null);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML blockquote to the summary buffer\n *\n * @param {string} text quote text\n * @param {string} cite (optional) citation url\n *\n * @returns {Summary} summary instance\n */\n addQuote(text, cite) {\n const attrs = Object.assign({}, (cite && { cite }));\n const element = this.wrap('blockquote', text, attrs);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML anchor tag to the summary buffer\n *\n * @param {string} text link text/content\n * @param {string} href hyperlink\n *\n * @returns {Summary} summary instance\n */\n addLink(text, href) {\n const element = this.wrap('a', text, { href });\n return this.addRaw(element).addEOL();\n }\n}\nconst _summary = new Summary();\n/**\n * @deprecated use `core.summary`\n */\nexports.markdownSummary = _summary;\nexports.summary = _summary;\n//# sourceMappingURL=summary.js.map","\"use strict\";\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.toCommandProperties = exports.toCommandValue = void 0;\n/**\n * Sanitizes an input into a string so it can be passed into issueCommand safely\n * @param input input to sanitize into a string\n */\nfunction toCommandValue(input) {\n if (input === null || input === undefined) {\n return '';\n }\n else if (typeof input === 'string' || input instanceof String) {\n return input;\n }\n return JSON.stringify(input);\n}\nexports.toCommandValue = toCommandValue;\n/**\n *\n * @param annotationProperties\n * @returns The command properties to send with the actual annotation command\n * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646\n */\nfunction toCommandProperties(annotationProperties) {\n if (!Object.keys(annotationProperties).length) {\n return {};\n }\n return {\n title: annotationProperties.title,\n file: annotationProperties.file,\n line: annotationProperties.startLine,\n endLine: annotationProperties.endLine,\n col: annotationProperties.startColumn,\n endColumn: annotationProperties.endColumn\n };\n}\nexports.toCommandProperties = toCommandProperties;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0;\nclass BasicCredentialHandler {\n constructor(username, password) {\n this.username = username;\n this.password = password;\n }\n prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;\n }\n // This handler cannot handle 401\n canHandleAuthentication() {\n return false;\n }\n handleAuthentication() {\n return __awaiter(this, void 0, void 0, function* () {\n throw new Error('not implemented');\n });\n }\n}\nexports.BasicCredentialHandler = BasicCredentialHandler;\nclass BearerCredentialHandler {\n constructor(token) {\n this.token = token;\n }\n // currently implements pre-authorization\n // TODO: support preAuth = false where it hooks on 401\n prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }\n // This handler cannot handle 401\n canHandleAuthentication() {\n return false;\n }\n handleAuthentication() {\n return __awaiter(this, void 0, void 0, function* () {\n throw new Error('not implemented');\n });\n }\n}\nexports.BearerCredentialHandler = BearerCredentialHandler;\nclass PersonalAccessTokenCredentialHandler {\n constructor(token) {\n this.token = token;\n }\n // currently implements pre-authorization\n // TODO: support preAuth = false where it hooks on 401\n prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }\n // This handler cannot handle 401\n canHandleAuthentication() {\n return false;\n }\n handleAuthentication() {\n return __awaiter(this, void 0, void 0, function* () {\n throw new Error('not implemented');\n });\n }\n}\nexports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;\n//# sourceMappingURL=auth.js.map","\"use strict\";\n/* eslint-disable @typescript-eslint/no-explicit-any */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;\nconst http = __importStar(require(\"http\"));\nconst https = __importStar(require(\"https\"));\nconst pm = __importStar(require(\"./proxy\"));\nconst tunnel = __importStar(require(\"tunnel\"));\nvar HttpCodes;\n(function (HttpCodes) {\n HttpCodes[HttpCodes[\"OK\"] = 200] = \"OK\";\n HttpCodes[HttpCodes[\"MultipleChoices\"] = 300] = \"MultipleChoices\";\n HttpCodes[HttpCodes[\"MovedPermanently\"] = 301] = \"MovedPermanently\";\n HttpCodes[HttpCodes[\"ResourceMoved\"] = 302] = \"ResourceMoved\";\n HttpCodes[HttpCodes[\"SeeOther\"] = 303] = \"SeeOther\";\n HttpCodes[HttpCodes[\"NotModified\"] = 304] = \"NotModified\";\n HttpCodes[HttpCodes[\"UseProxy\"] = 305] = \"UseProxy\";\n HttpCodes[HttpCodes[\"SwitchProxy\"] = 306] = \"SwitchProxy\";\n HttpCodes[HttpCodes[\"TemporaryRedirect\"] = 307] = \"TemporaryRedirect\";\n HttpCodes[HttpCodes[\"PermanentRedirect\"] = 308] = \"PermanentRedirect\";\n HttpCodes[HttpCodes[\"BadRequest\"] = 400] = \"BadRequest\";\n HttpCodes[HttpCodes[\"Unauthorized\"] = 401] = \"Unauthorized\";\n HttpCodes[HttpCodes[\"PaymentRequired\"] = 402] = \"PaymentRequired\";\n HttpCodes[HttpCodes[\"Forbidden\"] = 403] = \"Forbidden\";\n HttpCodes[HttpCodes[\"NotFound\"] = 404] = \"NotFound\";\n HttpCodes[HttpCodes[\"MethodNotAllowed\"] = 405] = \"MethodNotAllowed\";\n HttpCodes[HttpCodes[\"NotAcceptable\"] = 406] = \"NotAcceptable\";\n HttpCodes[HttpCodes[\"ProxyAuthenticationRequired\"] = 407] = \"ProxyAuthenticationRequired\";\n HttpCodes[HttpCodes[\"RequestTimeout\"] = 408] = \"RequestTimeout\";\n HttpCodes[HttpCodes[\"Conflict\"] = 409] = \"Conflict\";\n HttpCodes[HttpCodes[\"Gone\"] = 410] = \"Gone\";\n HttpCodes[HttpCodes[\"TooManyRequests\"] = 429] = \"TooManyRequests\";\n HttpCodes[HttpCodes[\"InternalServerError\"] = 500] = \"InternalServerError\";\n HttpCodes[HttpCodes[\"NotImplemented\"] = 501] = \"NotImplemented\";\n HttpCodes[HttpCodes[\"BadGateway\"] = 502] = \"BadGateway\";\n HttpCodes[HttpCodes[\"ServiceUnavailable\"] = 503] = \"ServiceUnavailable\";\n HttpCodes[HttpCodes[\"GatewayTimeout\"] = 504] = \"GatewayTimeout\";\n})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));\nvar Headers;\n(function (Headers) {\n Headers[\"Accept\"] = \"accept\";\n Headers[\"ContentType\"] = \"content-type\";\n})(Headers = exports.Headers || (exports.Headers = {}));\nvar MediaTypes;\n(function (MediaTypes) {\n MediaTypes[\"ApplicationJson\"] = \"application/json\";\n})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));\n/**\n * Returns the proxy URL, depending upon the supplied url and proxy environment variables.\n * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com\n */\nfunction getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}\nexports.getProxyUrl = getProxyUrl;\nconst HttpRedirectCodes = [\n HttpCodes.MovedPermanently,\n HttpCodes.ResourceMoved,\n HttpCodes.SeeOther,\n HttpCodes.TemporaryRedirect,\n HttpCodes.PermanentRedirect\n];\nconst HttpResponseRetryCodes = [\n HttpCodes.BadGateway,\n HttpCodes.ServiceUnavailable,\n HttpCodes.GatewayTimeout\n];\nconst RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];\nconst ExponentialBackoffCeiling = 10;\nconst ExponentialBackoffTimeSlice = 5;\nclass HttpClientError extends Error {\n constructor(message, statusCode) {\n super(message);\n this.name = 'HttpClientError';\n this.statusCode = statusCode;\n Object.setPrototypeOf(this, HttpClientError.prototype);\n }\n}\nexports.HttpClientError = HttpClientError;\nclass HttpClientResponse {\n constructor(message) {\n this.message = message;\n }\n readBody() {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {\n let output = Buffer.alloc(0);\n this.message.on('data', (chunk) => {\n output = Buffer.concat([output, chunk]);\n });\n this.message.on('end', () => {\n resolve(output.toString());\n });\n }));\n });\n }\n}\nexports.HttpClientResponse = HttpClientResponse;\nfunction isHttps(requestUrl) {\n const parsedUrl = new URL(requestUrl);\n return parsedUrl.protocol === 'https:';\n}\nexports.isHttps = isHttps;\nclass HttpClient {\n constructor(userAgent, handlers, requestOptions) {\n this._ignoreSslError = false;\n this._allowRedirects = true;\n this._allowRedirectDowngrade = false;\n this._maxRedirects = 50;\n this._allowRetries = false;\n this._maxRetries = 1;\n this._keepAlive = false;\n this._disposed = false;\n this.userAgent = userAgent;\n this.handlers = handlers || [];\n this.requestOptions = requestOptions;\n if (requestOptions) {\n if (requestOptions.ignoreSslError != null) {\n this._ignoreSslError = requestOptions.ignoreSslError;\n }\n this._socketTimeout = requestOptions.socketTimeout;\n if (requestOptions.allowRedirects != null) {\n this._allowRedirects = requestOptions.allowRedirects;\n }\n if (requestOptions.allowRedirectDowngrade != null) {\n this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;\n }\n if (requestOptions.maxRedirects != null) {\n this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);\n }\n if (requestOptions.keepAlive != null) {\n this._keepAlive = requestOptions.keepAlive;\n }\n if (requestOptions.allowRetries != null) {\n this._allowRetries = requestOptions.allowRetries;\n }\n if (requestOptions.maxRetries != null) {\n this._maxRetries = requestOptions.maxRetries;\n }\n }\n }\n options(requestUrl, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});\n });\n }\n get(requestUrl, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('GET', requestUrl, null, additionalHeaders || {});\n });\n }\n del(requestUrl, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('DELETE', requestUrl, null, additionalHeaders || {});\n });\n }\n post(requestUrl, data, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('POST', requestUrl, data, additionalHeaders || {});\n });\n }\n patch(requestUrl, data, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('PATCH', requestUrl, data, additionalHeaders || {});\n });\n }\n put(requestUrl, data, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('PUT', requestUrl, data, additionalHeaders || {});\n });\n }\n head(requestUrl, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('HEAD', requestUrl, null, additionalHeaders || {});\n });\n }\n sendStream(verb, requestUrl, stream, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request(verb, requestUrl, stream, additionalHeaders);\n });\n }\n /**\n * Gets a typed object from an endpoint\n * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise\n */\n getJson(requestUrl, additionalHeaders = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n const res = yield this.get(requestUrl, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n });\n }\n postJson(requestUrl, obj, additionalHeaders = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const data = JSON.stringify(obj, null, 2);\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);\n const res = yield this.post(requestUrl, data, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n });\n }\n putJson(requestUrl, obj, additionalHeaders = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const data = JSON.stringify(obj, null, 2);\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);\n const res = yield this.put(requestUrl, data, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n });\n }\n patchJson(requestUrl, obj, additionalHeaders = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const data = JSON.stringify(obj, null, 2);\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);\n const res = yield this.patch(requestUrl, data, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n });\n }\n /**\n * Makes a raw http request.\n * All other methods such as get, post, patch, and request ultimately call this.\n * Prefer get, del, post and patch\n */\n request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }\n /**\n * Needs to be called if keepAlive is set to true in request options.\n */\n dispose() {\n if (this._agent) {\n this._agent.destroy();\n }\n this._disposed = true;\n }\n /**\n * Raw request.\n * @param info\n * @param data\n */\n requestRaw(info, data) {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve, reject) => {\n function callbackForResult(err, res) {\n if (err) {\n reject(err);\n }\n else if (!res) {\n // If `err` is not passed, then `res` must be passed.\n reject(new Error('Unknown error'));\n }\n else {\n resolve(res);\n }\n }\n this.requestRawWithCallback(info, data, callbackForResult);\n });\n });\n }\n /**\n * Raw request with callback.\n * @param info\n * @param data\n * @param onResult\n */\n requestRawWithCallback(info, data, onResult) {\n if (typeof data === 'string') {\n if (!info.options.headers) {\n info.options.headers = {};\n }\n info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');\n }\n let callbackCalled = false;\n function handleResult(err, res) {\n if (!callbackCalled) {\n callbackCalled = true;\n onResult(err, res);\n }\n }\n const req = info.httpModule.request(info.options, (msg) => {\n const res = new HttpClientResponse(msg);\n handleResult(undefined, res);\n });\n let socket;\n req.on('socket', sock => {\n socket = sock;\n });\n // If we ever get disconnected, we want the socket to timeout eventually\n req.setTimeout(this._socketTimeout || 3 * 60000, () => {\n if (socket) {\n socket.end();\n }\n handleResult(new Error(`Request timeout: ${info.options.path}`));\n });\n req.on('error', function (err) {\n // err has statusCode property\n // res should have headers\n handleResult(err);\n });\n if (data && typeof data === 'string') {\n req.write(data, 'utf8');\n }\n if (data && typeof data !== 'string') {\n data.on('close', function () {\n req.end();\n });\n data.pipe(req);\n }\n else {\n req.end();\n }\n }\n /**\n * Gets an http agent. This function is useful when you need an http agent that handles\n * routing through a proxy server - depending upon the url and proxy environment variables.\n * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com\n */\n getAgent(serverUrl) {\n const parsedUrl = new URL(serverUrl);\n return this._getAgent(parsedUrl);\n }\n _prepareRequest(method, requestUrl, headers) {\n const info = {};\n info.parsedUrl = requestUrl;\n const usingSsl = info.parsedUrl.protocol === 'https:';\n info.httpModule = usingSsl ? https : http;\n const defaultPort = usingSsl ? 443 : 80;\n info.options = {};\n info.options.host = info.parsedUrl.hostname;\n info.options.port = info.parsedUrl.port\n ? parseInt(info.parsedUrl.port)\n : defaultPort;\n info.options.path =\n (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');\n info.options.method = method;\n info.options.headers = this._mergeHeaders(headers);\n if (this.userAgent != null) {\n info.options.headers['user-agent'] = this.userAgent;\n }\n info.options.agent = this._getAgent(info.parsedUrl);\n // gives handlers an opportunity to participate\n if (this.handlers) {\n for (const handler of this.handlers) {\n handler.prepareRequest(info.options);\n }\n }\n return info;\n }\n _mergeHeaders(headers) {\n if (this.requestOptions && this.requestOptions.headers) {\n return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));\n }\n return lowercaseKeys(headers || {});\n }\n _getExistingOrDefaultHeader(additionalHeaders, header, _default) {\n let clientHeader;\n if (this.requestOptions && this.requestOptions.headers) {\n clientHeader = lowercaseKeys(this.requestOptions.headers)[header];\n }\n return additionalHeaders[header] || clientHeader || _default;\n }\n _getAgent(parsedUrl) {\n let agent;\n const proxyUrl = pm.getProxyUrl(parsedUrl);\n const useProxy = proxyUrl && proxyUrl.hostname;\n if (this._keepAlive && useProxy) {\n agent = this._proxyAgent;\n }\n if (this._keepAlive && !useProxy) {\n agent = this._agent;\n }\n // if agent is already assigned use that agent.\n if (agent) {\n return agent;\n }\n const usingSsl = parsedUrl.protocol === 'https:';\n let maxSockets = 100;\n if (this.requestOptions) {\n maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;\n }\n // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.\n if (proxyUrl && proxyUrl.hostname) {\n const agentOptions = {\n maxSockets,\n keepAlive: this._keepAlive,\n proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {\n proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`\n })), { host: proxyUrl.hostname, port: proxyUrl.port })\n };\n let tunnelAgent;\n const overHttps = proxyUrl.protocol === 'https:';\n if (usingSsl) {\n tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;\n }\n else {\n tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;\n }\n agent = tunnelAgent(agentOptions);\n this._proxyAgent = agent;\n }\n // if reusing agent across request and tunneling agent isn't assigned create a new agent\n if (this._keepAlive && !agent) {\n const options = { keepAlive: this._keepAlive, maxSockets };\n agent = usingSsl ? new https.Agent(options) : new http.Agent(options);\n this._agent = agent;\n }\n // if not using private agent and tunnel agent isn't setup then use global agent\n if (!agent) {\n agent = usingSsl ? https.globalAgent : http.globalAgent;\n }\n if (usingSsl && this._ignoreSslError) {\n // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process\n // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options\n // we have to cast it to any and change it directly\n agent.options = Object.assign(agent.options || {}, {\n rejectUnauthorized: false\n });\n }\n return agent;\n }\n _performExponentialBackoff(retryNumber) {\n return __awaiter(this, void 0, void 0, function* () {\n retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);\n const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);\n return new Promise(resolve => setTimeout(() => resolve(), ms));\n });\n }\n _processResponse(res, options) {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {\n const statusCode = res.message.statusCode || 0;\n const response = {\n statusCode,\n result: null,\n headers: {}\n };\n // not found leads to null obj returned\n if (statusCode === HttpCodes.NotFound) {\n resolve(response);\n }\n // get the result from the body\n function dateTimeDeserializer(key, value) {\n if (typeof value === 'string') {\n const a = new Date(value);\n if (!isNaN(a.valueOf())) {\n return a;\n }\n }\n return value;\n }\n let obj;\n let contents;\n try {\n contents = yield res.readBody();\n if (contents && contents.length > 0) {\n if (options && options.deserializeDates) {\n obj = JSON.parse(contents, dateTimeDeserializer);\n }\n else {\n obj = JSON.parse(contents);\n }\n response.result = obj;\n }\n response.headers = res.message.headers;\n }\n catch (err) {\n // Invalid resource (contents not json); leaving result obj null\n }\n // note that 3xx redirects are handled by the http layer.\n if (statusCode > 299) {\n let msg;\n // if exception/error in body, attempt to get better error\n if (obj && obj.message) {\n msg = obj.message;\n }\n else if (contents && contents.length > 0) {\n // it may be the case that the exception is in the body message as string\n msg = contents;\n }\n else {\n msg = `Failed request: (${statusCode})`;\n }\n const err = new HttpClientError(msg, statusCode);\n err.result = response.result;\n reject(err);\n }\n else {\n resolve(response);\n }\n }));\n });\n }\n}\nexports.HttpClient = HttpClient;\nconst lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.checkBypass = exports.getProxyUrl = void 0;\nfunction getProxyUrl(reqUrl) {\n const usingSsl = reqUrl.protocol === 'https:';\n if (checkBypass(reqUrl)) {\n return undefined;\n }\n const proxyVar = (() => {\n if (usingSsl) {\n return process.env['https_proxy'] || process.env['HTTPS_PROXY'];\n }\n else {\n return process.env['http_proxy'] || process.env['HTTP_PROXY'];\n }\n })();\n if (proxyVar) {\n return new URL(proxyVar);\n }\n else {\n return undefined;\n }\n}\nexports.getProxyUrl = getProxyUrl;\nfunction checkBypass(reqUrl) {\n if (!reqUrl.hostname) {\n return false;\n }\n const reqHost = reqUrl.hostname;\n if (isLoopbackAddress(reqHost)) {\n return true;\n }\n const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';\n if (!noProxy) {\n return false;\n }\n // Determine the request port\n let reqPort;\n if (reqUrl.port) {\n reqPort = Number(reqUrl.port);\n }\n else if (reqUrl.protocol === 'http:') {\n reqPort = 80;\n }\n else if (reqUrl.protocol === 'https:') {\n reqPort = 443;\n }\n // Format the request hostname and hostname with port\n const upperReqHosts = [reqUrl.hostname.toUpperCase()];\n if (typeof reqPort === 'number') {\n upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);\n }\n // Compare request host against noproxy\n for (const upperNoProxyItem of noProxy\n .split(',')\n .map(x => x.trim().toUpperCase())\n .filter(x => x)) {\n if (upperNoProxyItem === '*' ||\n upperReqHosts.some(x => x === upperNoProxyItem ||\n x.endsWith(`.${upperNoProxyItem}`) ||\n (upperNoProxyItem.startsWith('.') &&\n x.endsWith(`${upperNoProxyItem}`)))) {\n return true;\n }\n }\n return false;\n}\nexports.checkBypass = checkBypass;\nfunction isLoopbackAddress(host) {\n const hostLower = host.toLowerCase();\n return (hostLower === 'localhost' ||\n hostLower.startsWith('127.') ||\n hostLower.startsWith('[::1]') ||\n hostLower.startsWith('[0:0:0:0:0:0:0:1]'));\n}\n//# sourceMappingURL=proxy.js.map","module.exports =\n{\n parallel : require('./parallel.js'),\n serial : require('./serial.js'),\n serialOrdered : require('./serialOrdered.js')\n};\n","// API\nmodule.exports = abort;\n\n/**\n * Aborts leftover active jobs\n *\n * @param {object} state - current state object\n */\nfunction abort(state)\n{\n Object.keys(state.jobs).forEach(clean.bind(state));\n\n // reset leftover jobs\n state.jobs = {};\n}\n\n/**\n * Cleans up leftover job by invoking abort function for the provided job id\n *\n * @this state\n * @param {string|number} key - job id to abort\n */\nfunction clean(key)\n{\n if (typeof this.jobs[key] == 'function')\n {\n this.jobs[key]();\n }\n}\n","var defer = require('./defer.js');\n\n// API\nmodule.exports = async;\n\n/**\n * Runs provided callback asynchronously\n * even if callback itself is not\n *\n * @param {function} callback - callback to invoke\n * @returns {function} - augmented callback\n */\nfunction async(callback)\n{\n var isAsync = false;\n\n // check if async happened\n defer(function() { isAsync = true; });\n\n return function async_callback(err, result)\n {\n if (isAsync)\n {\n callback(err, result);\n }\n else\n {\n defer(function nextTick_callback()\n {\n callback(err, result);\n });\n }\n };\n}\n","module.exports = defer;\n\n/**\n * Runs provided function on next iteration of the event loop\n *\n * @param {function} fn - function to run\n */\nfunction defer(fn)\n{\n var nextTick = typeof setImmediate == 'function'\n ? setImmediate\n : (\n typeof process == 'object' && typeof process.nextTick == 'function'\n ? process.nextTick\n : null\n );\n\n if (nextTick)\n {\n nextTick(fn);\n }\n else\n {\n setTimeout(fn, 0);\n }\n}\n","var async = require('./async.js')\n , abort = require('./abort.js')\n ;\n\n// API\nmodule.exports = iterate;\n\n/**\n * Iterates over each job object\n *\n * @param {array|object} list - array or object (named list) to iterate over\n * @param {function} iterator - iterator to run\n * @param {object} state - current job status\n * @param {function} callback - invoked when all elements processed\n */\nfunction iterate(list, iterator, state, callback)\n{\n // store current index\n var key = state['keyedList'] ? state['keyedList'][state.index] : state.index;\n\n state.jobs[key] = runJob(iterator, key, list[key], function(error, output)\n {\n // don't repeat yourself\n // skip secondary callbacks\n if (!(key in state.jobs))\n {\n return;\n }\n\n // clean up jobs\n delete state.jobs[key];\n\n if (error)\n {\n // don't process rest of the results\n // stop still active jobs\n // and reset the list\n abort(state);\n }\n else\n {\n state.results[key] = output;\n }\n\n // return salvaged results\n callback(error, state.results);\n });\n}\n\n/**\n * Runs iterator over provided job element\n *\n * @param {function} iterator - iterator to invoke\n * @param {string|number} key - key/index of the element in the list of jobs\n * @param {mixed} item - job description\n * @param {function} callback - invoked after iterator is done with the job\n * @returns {function|mixed} - job abort function or something else\n */\nfunction runJob(iterator, key, item, callback)\n{\n var aborter;\n\n // allow shortcut if iterator expects only two arguments\n if (iterator.length == 2)\n {\n aborter = iterator(item, async(callback));\n }\n // otherwise go with full three arguments\n else\n {\n aborter = iterator(item, key, async(callback));\n }\n\n return aborter;\n}\n","// API\nmodule.exports = state;\n\n/**\n * Creates initial state object\n * for iteration over list\n *\n * @param {array|object} list - list to iterate over\n * @param {function|null} sortMethod - function to use for keys sort,\n * or `null` to keep them as is\n * @returns {object} - initial state object\n */\nfunction state(list, sortMethod)\n{\n var isNamedList = !Array.isArray(list)\n , initState =\n {\n index : 0,\n keyedList: isNamedList || sortMethod ? Object.keys(list) : null,\n jobs : {},\n results : isNamedList ? {} : [],\n size : isNamedList ? Object.keys(list).length : list.length\n }\n ;\n\n if (sortMethod)\n {\n // sort array keys based on it's values\n // sort object's keys just on own merit\n initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)\n {\n return sortMethod(list[a], list[b]);\n });\n }\n\n return initState;\n}\n","var abort = require('./abort.js')\n , async = require('./async.js')\n ;\n\n// API\nmodule.exports = terminator;\n\n/**\n * Terminates jobs in the attached state context\n *\n * @this AsyncKitState#\n * @param {function} callback - final callback to invoke after termination\n */\nfunction terminator(callback)\n{\n if (!Object.keys(this.jobs).length)\n {\n return;\n }\n\n // fast forward iteration index\n this.index = this.size;\n\n // abort jobs\n abort(this);\n\n // send back results we have so far\n async(callback)(null, this.results);\n}\n","var iterate = require('./lib/iterate.js')\n , initState = require('./lib/state.js')\n , terminator = require('./lib/terminator.js')\n ;\n\n// Public API\nmodule.exports = parallel;\n\n/**\n * Runs iterator over provided array elements in parallel\n *\n * @param {array|object} list - array or object (named list) to iterate over\n * @param {function} iterator - iterator to run\n * @param {function} callback - invoked when all elements processed\n * @returns {function} - jobs terminator\n */\nfunction parallel(list, iterator, callback)\n{\n var state = initState(list);\n\n while (state.index < (state['keyedList'] || list).length)\n {\n iterate(list, iterator, state, function(error, result)\n {\n if (error)\n {\n callback(error, result);\n return;\n }\n\n // looks like it's the last one\n if (Object.keys(state.jobs).length === 0)\n {\n callback(null, state.results);\n return;\n }\n });\n\n state.index++;\n }\n\n return terminator.bind(state, callback);\n}\n","var serialOrdered = require('./serialOrdered.js');\n\n// Public API\nmodule.exports = serial;\n\n/**\n * Runs iterator over provided array elements in series\n *\n * @param {array|object} list - array or object (named list) to iterate over\n * @param {function} iterator - iterator to run\n * @param {function} callback - invoked when all elements processed\n * @returns {function} - jobs terminator\n */\nfunction serial(list, iterator, callback)\n{\n return serialOrdered(list, iterator, null, callback);\n}\n","var iterate = require('./lib/iterate.js')\n , initState = require('./lib/state.js')\n , terminator = require('./lib/terminator.js')\n ;\n\n// Public API\nmodule.exports = serialOrdered;\n// sorting helpers\nmodule.exports.ascending = ascending;\nmodule.exports.descending = descending;\n\n/**\n * Runs iterator over provided sorted array elements in series\n *\n * @param {array|object} list - array or object (named list) to iterate over\n * @param {function} iterator - iterator to run\n * @param {function} sortMethod - custom sort function\n * @param {function} callback - invoked when all elements processed\n * @returns {function} - jobs terminator\n */\nfunction serialOrdered(list, iterator, sortMethod, callback)\n{\n var state = initState(list, sortMethod);\n\n iterate(list, iterator, state, function iteratorHandler(error, result)\n {\n if (error)\n {\n callback(error, result);\n return;\n }\n\n state.index++;\n\n // are we there yet?\n if (state.index < (state['keyedList'] || list).length)\n {\n iterate(list, iterator, state, iteratorHandler);\n return;\n }\n\n // done here\n callback(null, state.results);\n });\n\n return terminator.bind(state, callback);\n}\n\n/*\n * -- Sort methods\n */\n\n/**\n * sort helper to sort array elements in ascending order\n *\n * @param {mixed} a - an item to compare\n * @param {mixed} b - an item to compare\n * @returns {number} - comparison result\n */\nfunction ascending(a, b)\n{\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/**\n * sort helper to sort array elements in descending order\n *\n * @param {mixed} a - an item to compare\n * @param {mixed} b - an item to compare\n * @returns {number} - comparison result\n */\nfunction descending(a, b)\n{\n return -1 * ascending(a, b);\n}\n","var util = require('util');\nvar Stream = require('stream').Stream;\nvar DelayedStream = require('delayed-stream');\n\nmodule.exports = CombinedStream;\nfunction CombinedStream() {\n this.writable = false;\n this.readable = true;\n this.dataSize = 0;\n this.maxDataSize = 2 * 1024 * 1024;\n this.pauseStreams = true;\n\n this._released = false;\n this._streams = [];\n this._currentStream = null;\n this._insideLoop = false;\n this._pendingNext = false;\n}\nutil.inherits(CombinedStream, Stream);\n\nCombinedStream.create = function(options) {\n var combinedStream = new this();\n\n options = options || {};\n for (var option in options) {\n combinedStream[option] = options[option];\n }\n\n return combinedStream;\n};\n\nCombinedStream.isStreamLike = function(stream) {\n return (typeof stream !== 'function')\n && (typeof stream !== 'string')\n && (typeof stream !== 'boolean')\n && (typeof stream !== 'number')\n && (!Buffer.isBuffer(stream));\n};\n\nCombinedStream.prototype.append = function(stream) {\n var isStreamLike = CombinedStream.isStreamLike(stream);\n\n if (isStreamLike) {\n if (!(stream instanceof DelayedStream)) {\n var newStream = DelayedStream.create(stream, {\n maxDataSize: Infinity,\n pauseStream: this.pauseStreams,\n });\n stream.on('data', this._checkDataSize.bind(this));\n stream = newStream;\n }\n\n this._handleErrors(stream);\n\n if (this.pauseStreams) {\n stream.pause();\n }\n }\n\n this._streams.push(stream);\n return this;\n};\n\nCombinedStream.prototype.pipe = function(dest, options) {\n Stream.prototype.pipe.call(this, dest, options);\n this.resume();\n return dest;\n};\n\nCombinedStream.prototype._getNext = function() {\n this._currentStream = null;\n\n if (this._insideLoop) {\n this._pendingNext = true;\n return; // defer call\n }\n\n this._insideLoop = true;\n try {\n do {\n this._pendingNext = false;\n this._realGetNext();\n } while (this._pendingNext);\n } finally {\n this._insideLoop = false;\n }\n};\n\nCombinedStream.prototype._realGetNext = function() {\n var stream = this._streams.shift();\n\n\n if (typeof stream == 'undefined') {\n this.end();\n return;\n }\n\n if (typeof stream !== 'function') {\n this._pipeNext(stream);\n return;\n }\n\n var getStream = stream;\n getStream(function(stream) {\n var isStreamLike = CombinedStream.isStreamLike(stream);\n if (isStreamLike) {\n stream.on('data', this._checkDataSize.bind(this));\n this._handleErrors(stream);\n }\n\n this._pipeNext(stream);\n }.bind(this));\n};\n\nCombinedStream.prototype._pipeNext = function(stream) {\n this._currentStream = stream;\n\n var isStreamLike = CombinedStream.isStreamLike(stream);\n if (isStreamLike) {\n stream.on('end', this._getNext.bind(this));\n stream.pipe(this, {end: false});\n return;\n }\n\n var value = stream;\n this.write(value);\n this._getNext();\n};\n\nCombinedStream.prototype._handleErrors = function(stream) {\n var self = this;\n stream.on('error', function(err) {\n self._emitError(err);\n });\n};\n\nCombinedStream.prototype.write = function(data) {\n this.emit('data', data);\n};\n\nCombinedStream.prototype.pause = function() {\n if (!this.pauseStreams) {\n return;\n }\n\n if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause();\n this.emit('pause');\n};\n\nCombinedStream.prototype.resume = function() {\n if (!this._released) {\n this._released = true;\n this.writable = true;\n this._getNext();\n }\n\n if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume();\n this.emit('resume');\n};\n\nCombinedStream.prototype.end = function() {\n this._reset();\n this.emit('end');\n};\n\nCombinedStream.prototype.destroy = function() {\n this._reset();\n this.emit('close');\n};\n\nCombinedStream.prototype._reset = function() {\n this.writable = false;\n this._streams = [];\n this._currentStream = null;\n};\n\nCombinedStream.prototype._checkDataSize = function() {\n this._updateDataSize();\n if (this.dataSize <= this.maxDataSize) {\n return;\n }\n\n var message =\n 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.';\n this._emitError(new Error(message));\n};\n\nCombinedStream.prototype._updateDataSize = function() {\n this.dataSize = 0;\n\n var self = this;\n this._streams.forEach(function(stream) {\n if (!stream.dataSize) {\n return;\n }\n\n self.dataSize += stream.dataSize;\n });\n\n if (this._currentStream && this._currentStream.dataSize) {\n this.dataSize += this._currentStream.dataSize;\n }\n};\n\nCombinedStream.prototype._emitError = function(err) {\n this._reset();\n this.emit('error', err);\n};\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/**\n * Detect Electron renderer / nwjs process, which is node, but we should\n * treat as a browser.\n */\n\nif (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {\n\tmodule.exports = require('./browser.js');\n} else {\n\tmodule.exports = require('./node.js');\n}\n","/**\n * Module dependencies.\n */\n\nconst tty = require('tty');\nconst util = require('util');\n\n/**\n * This is the Node.js implementation of `debug()`.\n */\n\nexports.init = init;\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.destroy = util.deprecate(\n\t() => {},\n\t'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'\n);\n\n/**\n * Colors.\n */\n\nexports.colors = [6, 2, 3, 4, 5, 1];\n\ntry {\n\t// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)\n\t// eslint-disable-next-line import/no-extraneous-dependencies\n\tconst supportsColor = require('supports-color');\n\n\tif (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {\n\t\texports.colors = [\n\t\t\t20,\n\t\t\t21,\n\t\t\t26,\n\t\t\t27,\n\t\t\t32,\n\t\t\t33,\n\t\t\t38,\n\t\t\t39,\n\t\t\t40,\n\t\t\t41,\n\t\t\t42,\n\t\t\t43,\n\t\t\t44,\n\t\t\t45,\n\t\t\t56,\n\t\t\t57,\n\t\t\t62,\n\t\t\t63,\n\t\t\t68,\n\t\t\t69,\n\t\t\t74,\n\t\t\t75,\n\t\t\t76,\n\t\t\t77,\n\t\t\t78,\n\t\t\t79,\n\t\t\t80,\n\t\t\t81,\n\t\t\t92,\n\t\t\t93,\n\t\t\t98,\n\t\t\t99,\n\t\t\t112,\n\t\t\t113,\n\t\t\t128,\n\t\t\t129,\n\t\t\t134,\n\t\t\t135,\n\t\t\t148,\n\t\t\t149,\n\t\t\t160,\n\t\t\t161,\n\t\t\t162,\n\t\t\t163,\n\t\t\t164,\n\t\t\t165,\n\t\t\t166,\n\t\t\t167,\n\t\t\t168,\n\t\t\t169,\n\t\t\t170,\n\t\t\t171,\n\t\t\t172,\n\t\t\t173,\n\t\t\t178,\n\t\t\t179,\n\t\t\t184,\n\t\t\t185,\n\t\t\t196,\n\t\t\t197,\n\t\t\t198,\n\t\t\t199,\n\t\t\t200,\n\t\t\t201,\n\t\t\t202,\n\t\t\t203,\n\t\t\t204,\n\t\t\t205,\n\t\t\t206,\n\t\t\t207,\n\t\t\t208,\n\t\t\t209,\n\t\t\t214,\n\t\t\t215,\n\t\t\t220,\n\t\t\t221\n\t\t];\n\t}\n} catch (error) {\n\t// Swallow - we only care if `supports-color` is available; it doesn't have to be.\n}\n\n/**\n * Build up the default `inspectOpts` object from the environment variables.\n *\n * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js\n */\n\nexports.inspectOpts = Object.keys(process.env).filter(key => {\n\treturn /^debug_/i.test(key);\n}).reduce((obj, key) => {\n\t// Camel-case\n\tconst prop = key\n\t\t.substring(6)\n\t\t.toLowerCase()\n\t\t.replace(/_([a-z])/g, (_, k) => {\n\t\t\treturn k.toUpperCase();\n\t\t});\n\n\t// Coerce string value into JS value\n\tlet val = process.env[key];\n\tif (/^(yes|on|true|enabled)$/i.test(val)) {\n\t\tval = true;\n\t} else if (/^(no|off|false|disabled)$/i.test(val)) {\n\t\tval = false;\n\t} else if (val === 'null') {\n\t\tval = null;\n\t} else {\n\t\tval = Number(val);\n\t}\n\n\tobj[prop] = val;\n\treturn obj;\n}, {});\n\n/**\n * Is stdout a TTY? Colored output is enabled when `true`.\n */\n\nfunction useColors() {\n\treturn 'colors' in exports.inspectOpts ?\n\t\tBoolean(exports.inspectOpts.colors) :\n\t\ttty.isatty(process.stderr.fd);\n}\n\n/**\n * Adds ANSI color escape codes if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\tconst {namespace: name, useColors} = this;\n\n\tif (useColors) {\n\t\tconst c = this.color;\n\t\tconst colorCode = '\\u001B[3' + (c < 8 ? c : '8;5;' + c);\n\t\tconst prefix = ` ${colorCode};1m${name} \\u001B[0m`;\n\n\t\targs[0] = prefix + args[0].split('\\n').join('\\n' + prefix);\n\t\targs.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\\u001B[0m');\n\t} else {\n\t\targs[0] = getDate() + name + ' ' + args[0];\n\t}\n}\n\nfunction getDate() {\n\tif (exports.inspectOpts.hideDate) {\n\t\treturn '';\n\t}\n\treturn new Date().toISOString() + ' ';\n}\n\n/**\n * Invokes `util.format()` with the specified arguments and writes to stderr.\n */\n\nfunction log(...args) {\n\treturn process.stderr.write(util.format(...args) + '\\n');\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\tif (namespaces) {\n\t\tprocess.env.DEBUG = namespaces;\n\t} else {\n\t\t// If you set a process.env field to null or undefined, it gets cast to the\n\t\t// string 'null' or 'undefined'. Just delete instead.\n\t\tdelete process.env.DEBUG;\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n\treturn process.env.DEBUG;\n}\n\n/**\n * Init logic for `debug` instances.\n *\n * Create a new `inspectOpts` object in case `useColors` is set\n * differently for a particular `debug` instance.\n */\n\nfunction init(debug) {\n\tdebug.inspectOpts = {};\n\n\tconst keys = Object.keys(exports.inspectOpts);\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tdebug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %o to `util.inspect()`, all on a single line.\n */\n\nformatters.o = function (v) {\n\tthis.inspectOpts.colors = this.useColors;\n\treturn util.inspect(v, this.inspectOpts)\n\t\t.split('\\n')\n\t\t.map(str => str.trim())\n\t\t.join(' ');\n};\n\n/**\n * Map %O to `util.inspect()`, allowing multiple lines if needed.\n */\n\nformatters.O = function (v) {\n\tthis.inspectOpts.colors = this.useColors;\n\treturn util.inspect(v, this.inspectOpts);\n};\n","var Stream = require('stream').Stream;\nvar util = require('util');\n\nmodule.exports = DelayedStream;\nfunction DelayedStream() {\n this.source = null;\n this.dataSize = 0;\n this.maxDataSize = 1024 * 1024;\n this.pauseStream = true;\n\n this._maxDataSizeExceeded = false;\n this._released = false;\n this._bufferedEvents = [];\n}\nutil.inherits(DelayedStream, Stream);\n\nDelayedStream.create = function(source, options) {\n var delayedStream = new this();\n\n options = options || {};\n for (var option in options) {\n delayedStream[option] = options[option];\n }\n\n delayedStream.source = source;\n\n var realEmit = source.emit;\n source.emit = function() {\n delayedStream._handleEmit(arguments);\n return realEmit.apply(source, arguments);\n };\n\n source.on('error', function() {});\n if (delayedStream.pauseStream) {\n source.pause();\n }\n\n return delayedStream;\n};\n\nObject.defineProperty(DelayedStream.prototype, 'readable', {\n configurable: true,\n enumerable: true,\n get: function() {\n return this.source.readable;\n }\n});\n\nDelayedStream.prototype.setEncoding = function() {\n return this.source.setEncoding.apply(this.source, arguments);\n};\n\nDelayedStream.prototype.resume = function() {\n if (!this._released) {\n this.release();\n }\n\n this.source.resume();\n};\n\nDelayedStream.prototype.pause = function() {\n this.source.pause();\n};\n\nDelayedStream.prototype.release = function() {\n this._released = true;\n\n this._bufferedEvents.forEach(function(args) {\n this.emit.apply(this, args);\n }.bind(this));\n this._bufferedEvents = [];\n};\n\nDelayedStream.prototype.pipe = function() {\n var r = Stream.prototype.pipe.apply(this, arguments);\n this.resume();\n return r;\n};\n\nDelayedStream.prototype._handleEmit = function(args) {\n if (this._released) {\n this.emit.apply(this, args);\n return;\n }\n\n if (args[0] === 'data') {\n this.dataSize += args[1].length;\n this._checkIfMaxDataSizeExceeded();\n }\n\n this._bufferedEvents.push(args);\n};\n\nDelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {\n if (this._maxDataSizeExceeded) {\n return;\n }\n\n if (this.dataSize <= this.maxDataSize) {\n return;\n }\n\n this._maxDataSizeExceeded = true;\n var message =\n 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'\n this.emit('error', new Error(message));\n};\n","var debug;\n\nmodule.exports = function () {\n if (!debug) {\n try {\n /* eslint global-require: off */\n debug = require(\"debug\")(\"follow-redirects\");\n }\n catch (error) { /* */ }\n if (typeof debug !== \"function\") {\n debug = function () { /* */ };\n }\n }\n debug.apply(null, arguments);\n};\n","var url = require(\"url\");\nvar URL = url.URL;\nvar http = require(\"http\");\nvar https = require(\"https\");\nvar Writable = require(\"stream\").Writable;\nvar assert = require(\"assert\");\nvar debug = require(\"./debug\");\n\n// Create handlers that pass events from native requests\nvar events = [\"abort\", \"aborted\", \"connect\", \"error\", \"socket\", \"timeout\"];\nvar eventHandlers = Object.create(null);\nevents.forEach(function (event) {\n eventHandlers[event] = function (arg1, arg2, arg3) {\n this._redirectable.emit(event, arg1, arg2, arg3);\n };\n});\n\nvar InvalidUrlError = createErrorType(\n \"ERR_INVALID_URL\",\n \"Invalid URL\",\n TypeError\n);\n// Error types with codes\nvar RedirectionError = createErrorType(\n \"ERR_FR_REDIRECTION_FAILURE\",\n \"Redirected request failed\"\n);\nvar TooManyRedirectsError = createErrorType(\n \"ERR_FR_TOO_MANY_REDIRECTS\",\n \"Maximum number of redirects exceeded\"\n);\nvar MaxBodyLengthExceededError = createErrorType(\n \"ERR_FR_MAX_BODY_LENGTH_EXCEEDED\",\n \"Request body larger than maxBodyLength limit\"\n);\nvar WriteAfterEndError = createErrorType(\n \"ERR_STREAM_WRITE_AFTER_END\",\n \"write after end\"\n);\n\n// An HTTP(S) request that can be redirected\nfunction RedirectableRequest(options, responseCallback) {\n // Initialize the request\n Writable.call(this);\n this._sanitizeOptions(options);\n this._options = options;\n this._ended = false;\n this._ending = false;\n this._redirectCount = 0;\n this._redirects = [];\n this._requestBodyLength = 0;\n this._requestBodyBuffers = [];\n\n // Attach a callback if passed\n if (responseCallback) {\n this.on(\"response\", responseCallback);\n }\n\n // React to responses of native requests\n var self = this;\n this._onNativeResponse = function (response) {\n self._processResponse(response);\n };\n\n // Perform the first request\n this._performRequest();\n}\nRedirectableRequest.prototype = Object.create(Writable.prototype);\n\nRedirectableRequest.prototype.abort = function () {\n abortRequest(this._currentRequest);\n this.emit(\"abort\");\n};\n\n// Writes buffered data to the current native request\nRedirectableRequest.prototype.write = function (data, encoding, callback) {\n // Writing is not allowed if end has been called\n if (this._ending) {\n throw new WriteAfterEndError();\n }\n\n // Validate input and shift parameters if necessary\n if (!isString(data) && !isBuffer(data)) {\n throw new TypeError(\"data should be a string, Buffer or Uint8Array\");\n }\n if (isFunction(encoding)) {\n callback = encoding;\n encoding = null;\n }\n\n // Ignore empty buffers, since writing them doesn't invoke the callback\n // https://github.com/nodejs/node/issues/22066\n if (data.length === 0) {\n if (callback) {\n callback();\n }\n return;\n }\n // Only write when we don't exceed the maximum body length\n if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {\n this._requestBodyLength += data.length;\n this._requestBodyBuffers.push({ data: data, encoding: encoding });\n this._currentRequest.write(data, encoding, callback);\n }\n // Error when we exceed the maximum body length\n else {\n this.emit(\"error\", new MaxBodyLengthExceededError());\n this.abort();\n }\n};\n\n// Ends the current native request\nRedirectableRequest.prototype.end = function (data, encoding, callback) {\n // Shift parameters if necessary\n if (isFunction(data)) {\n callback = data;\n data = encoding = null;\n }\n else if (isFunction(encoding)) {\n callback = encoding;\n encoding = null;\n }\n\n // Write data if needed and end\n if (!data) {\n this._ended = this._ending = true;\n this._currentRequest.end(null, null, callback);\n }\n else {\n var self = this;\n var currentRequest = this._currentRequest;\n this.write(data, encoding, function () {\n self._ended = true;\n currentRequest.end(null, null, callback);\n });\n this._ending = true;\n }\n};\n\n// Sets a header value on the current native request\nRedirectableRequest.prototype.setHeader = function (name, value) {\n this._options.headers[name] = value;\n this._currentRequest.setHeader(name, value);\n};\n\n// Clears a header value on the current native request\nRedirectableRequest.prototype.removeHeader = function (name) {\n delete this._options.headers[name];\n this._currentRequest.removeHeader(name);\n};\n\n// Global timeout for all underlying requests\nRedirectableRequest.prototype.setTimeout = function (msecs, callback) {\n var self = this;\n\n // Destroys the socket on timeout\n function destroyOnTimeout(socket) {\n socket.setTimeout(msecs);\n socket.removeListener(\"timeout\", socket.destroy);\n socket.addListener(\"timeout\", socket.destroy);\n }\n\n // Sets up a timer to trigger a timeout event\n function startTimer(socket) {\n if (self._timeout) {\n clearTimeout(self._timeout);\n }\n self._timeout = setTimeout(function () {\n self.emit(\"timeout\");\n clearTimer();\n }, msecs);\n destroyOnTimeout(socket);\n }\n\n // Stops a timeout from triggering\n function clearTimer() {\n // Clear the timeout\n if (self._timeout) {\n clearTimeout(self._timeout);\n self._timeout = null;\n }\n\n // Clean up all attached listeners\n self.removeListener(\"abort\", clearTimer);\n self.removeListener(\"error\", clearTimer);\n self.removeListener(\"response\", clearTimer);\n if (callback) {\n self.removeListener(\"timeout\", callback);\n }\n if (!self.socket) {\n self._currentRequest.removeListener(\"socket\", startTimer);\n }\n }\n\n // Attach callback if passed\n if (callback) {\n this.on(\"timeout\", callback);\n }\n\n // Start the timer if or when the socket is opened\n if (this.socket) {\n startTimer(this.socket);\n }\n else {\n this._currentRequest.once(\"socket\", startTimer);\n }\n\n // Clean up on events\n this.on(\"socket\", destroyOnTimeout);\n this.on(\"abort\", clearTimer);\n this.on(\"error\", clearTimer);\n this.on(\"response\", clearTimer);\n\n return this;\n};\n\n// Proxy all other public ClientRequest methods\n[\n \"flushHeaders\", \"getHeader\",\n \"setNoDelay\", \"setSocketKeepAlive\",\n].forEach(function (method) {\n RedirectableRequest.prototype[method] = function (a, b) {\n return this._currentRequest[method](a, b);\n };\n});\n\n// Proxy all public ClientRequest properties\n[\"aborted\", \"connection\", \"socket\"].forEach(function (property) {\n Object.defineProperty(RedirectableRequest.prototype, property, {\n get: function () { return this._currentRequest[property]; },\n });\n});\n\nRedirectableRequest.prototype._sanitizeOptions = function (options) {\n // Ensure headers are always present\n if (!options.headers) {\n options.headers = {};\n }\n\n // Since http.request treats host as an alias of hostname,\n // but the url module interprets host as hostname plus port,\n // eliminate the host property to avoid confusion.\n if (options.host) {\n // Use hostname if set, because it has precedence\n if (!options.hostname) {\n options.hostname = options.host;\n }\n delete options.host;\n }\n\n // Complete the URL object when necessary\n if (!options.pathname && options.path) {\n var searchPos = options.path.indexOf(\"?\");\n if (searchPos < 0) {\n options.pathname = options.path;\n }\n else {\n options.pathname = options.path.substring(0, searchPos);\n options.search = options.path.substring(searchPos);\n }\n }\n};\n\n\n// Executes the next native request (initial or redirect)\nRedirectableRequest.prototype._performRequest = function () {\n // Load the native protocol\n var protocol = this._options.protocol;\n var nativeProtocol = this._options.nativeProtocols[protocol];\n if (!nativeProtocol) {\n this.emit(\"error\", new TypeError(\"Unsupported protocol \" + protocol));\n return;\n }\n\n // If specified, use the agent corresponding to the protocol\n // (HTTP and HTTPS use different types of agents)\n if (this._options.agents) {\n var scheme = protocol.slice(0, -1);\n this._options.agent = this._options.agents[scheme];\n }\n\n // Create the native request and set up its event handlers\n var request = this._currentRequest =\n nativeProtocol.request(this._options, this._onNativeResponse);\n request._redirectable = this;\n for (var event of events) {\n request.on(event, eventHandlers[event]);\n }\n\n // RFC7230§5.3.1: When making a request directly to an origin server, […]\n // a client MUST send only the absolute path […] as the request-target.\n this._currentUrl = /^\\//.test(this._options.path) ?\n url.format(this._options) :\n // When making a request to a proxy, […]\n // a client MUST send the target URI in absolute-form […].\n this._options.path;\n\n // End a redirected request\n // (The first request must be ended explicitly with RedirectableRequest#end)\n if (this._isRedirect) {\n // Write the request entity and end\n var i = 0;\n var self = this;\n var buffers = this._requestBodyBuffers;\n (function writeNext(error) {\n // Only write if this request has not been redirected yet\n /* istanbul ignore else */\n if (request === self._currentRequest) {\n // Report any write errors\n /* istanbul ignore if */\n if (error) {\n self.emit(\"error\", error);\n }\n // Write the next buffer if there are still left\n else if (i < buffers.length) {\n var buffer = buffers[i++];\n /* istanbul ignore else */\n if (!request.finished) {\n request.write(buffer.data, buffer.encoding, writeNext);\n }\n }\n // End the request if `end` has been called on us\n else if (self._ended) {\n request.end();\n }\n }\n }());\n }\n};\n\n// Processes a response from the current native request\nRedirectableRequest.prototype._processResponse = function (response) {\n // Store the redirected response\n var statusCode = response.statusCode;\n if (this._options.trackRedirects) {\n this._redirects.push({\n url: this._currentUrl,\n headers: response.headers,\n statusCode: statusCode,\n });\n }\n\n // RFC7231§6.4: The 3xx (Redirection) class of status code indicates\n // that further action needs to be taken by the user agent in order to\n // fulfill the request. If a Location header field is provided,\n // the user agent MAY automatically redirect its request to the URI\n // referenced by the Location field value,\n // even if the specific status code is not understood.\n\n // If the response is not a redirect; return it as-is\n var location = response.headers.location;\n if (!location || this._options.followRedirects === false ||\n statusCode < 300 || statusCode >= 400) {\n response.responseUrl = this._currentUrl;\n response.redirects = this._redirects;\n this.emit(\"response\", response);\n\n // Clean up\n this._requestBodyBuffers = [];\n return;\n }\n\n // The response is a redirect, so abort the current request\n abortRequest(this._currentRequest);\n // Discard the remainder of the response to avoid waiting for data\n response.destroy();\n\n // RFC7231§6.4: A client SHOULD detect and intervene\n // in cyclical redirections (i.e., \"infinite\" redirection loops).\n if (++this._redirectCount > this._options.maxRedirects) {\n this.emit(\"error\", new TooManyRedirectsError());\n return;\n }\n\n // Store the request headers if applicable\n var requestHeaders;\n var beforeRedirect = this._options.beforeRedirect;\n if (beforeRedirect) {\n requestHeaders = Object.assign({\n // The Host header was set by nativeProtocol.request\n Host: response.req.getHeader(\"host\"),\n }, this._options.headers);\n }\n\n // RFC7231§6.4: Automatic redirection needs to done with\n // care for methods not known to be safe, […]\n // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change\n // the request method from POST to GET for the subsequent request.\n var method = this._options.method;\n if ((statusCode === 301 || statusCode === 302) && this._options.method === \"POST\" ||\n // RFC7231§6.4.4: The 303 (See Other) status code indicates that\n // the server is redirecting the user agent to a different resource […]\n // A user agent can perform a retrieval request targeting that URI\n // (a GET or HEAD request if using HTTP) […]\n (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {\n this._options.method = \"GET\";\n // Drop a possible entity and headers related to it\n this._requestBodyBuffers = [];\n removeMatchingHeaders(/^content-/i, this._options.headers);\n }\n\n // Drop the Host header, as the redirect might lead to a different host\n var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);\n\n // If the redirect is relative, carry over the host of the last request\n var currentUrlParts = url.parse(this._currentUrl);\n var currentHost = currentHostHeader || currentUrlParts.host;\n var currentUrl = /^\\w+:/.test(location) ? this._currentUrl :\n url.format(Object.assign(currentUrlParts, { host: currentHost }));\n\n // Determine the URL of the redirection\n var redirectUrl;\n try {\n redirectUrl = url.resolve(currentUrl, location);\n }\n catch (cause) {\n this.emit(\"error\", new RedirectionError({ cause: cause }));\n return;\n }\n\n // Create the redirected request\n debug(\"redirecting to\", redirectUrl);\n this._isRedirect = true;\n var redirectUrlParts = url.parse(redirectUrl);\n Object.assign(this._options, redirectUrlParts);\n\n // Drop confidential headers when redirecting to a less secure protocol\n // or to a different domain that is not a superdomain\n if (redirectUrlParts.protocol !== currentUrlParts.protocol &&\n redirectUrlParts.protocol !== \"https:\" ||\n redirectUrlParts.host !== currentHost &&\n !isSubdomain(redirectUrlParts.host, currentHost)) {\n removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);\n }\n\n // Evaluate the beforeRedirect callback\n if (isFunction(beforeRedirect)) {\n var responseDetails = {\n headers: response.headers,\n statusCode: statusCode,\n };\n var requestDetails = {\n url: currentUrl,\n method: method,\n headers: requestHeaders,\n };\n try {\n beforeRedirect(this._options, responseDetails, requestDetails);\n }\n catch (err) {\n this.emit(\"error\", err);\n return;\n }\n this._sanitizeOptions(this._options);\n }\n\n // Perform the redirected request\n try {\n this._performRequest();\n }\n catch (cause) {\n this.emit(\"error\", new RedirectionError({ cause: cause }));\n }\n};\n\n// Wraps the key/value object of protocols with redirect functionality\nfunction wrap(protocols) {\n // Default settings\n var exports = {\n maxRedirects: 21,\n maxBodyLength: 10 * 1024 * 1024,\n };\n\n // Wrap each protocol\n var nativeProtocols = {};\n Object.keys(protocols).forEach(function (scheme) {\n var protocol = scheme + \":\";\n var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];\n var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);\n\n // Executes a request, following redirects\n function request(input, options, callback) {\n // Parse parameters\n if (isString(input)) {\n var parsed;\n try {\n parsed = urlToOptions(new URL(input));\n }\n catch (err) {\n /* istanbul ignore next */\n parsed = url.parse(input);\n }\n if (!isString(parsed.protocol)) {\n throw new InvalidUrlError({ input });\n }\n input = parsed;\n }\n else if (URL && (input instanceof URL)) {\n input = urlToOptions(input);\n }\n else {\n callback = options;\n options = input;\n input = { protocol: protocol };\n }\n if (isFunction(options)) {\n callback = options;\n options = null;\n }\n\n // Set defaults\n options = Object.assign({\n maxRedirects: exports.maxRedirects,\n maxBodyLength: exports.maxBodyLength,\n }, input, options);\n options.nativeProtocols = nativeProtocols;\n if (!isString(options.host) && !isString(options.hostname)) {\n options.hostname = \"::1\";\n }\n\n assert.equal(options.protocol, protocol, \"protocol mismatch\");\n debug(\"options\", options);\n return new RedirectableRequest(options, callback);\n }\n\n // Executes a GET request, following redirects\n function get(input, options, callback) {\n var wrappedRequest = wrappedProtocol.request(input, options, callback);\n wrappedRequest.end();\n return wrappedRequest;\n }\n\n // Expose the properties on the wrapped protocol\n Object.defineProperties(wrappedProtocol, {\n request: { value: request, configurable: true, enumerable: true, writable: true },\n get: { value: get, configurable: true, enumerable: true, writable: true },\n });\n });\n return exports;\n}\n\n/* istanbul ignore next */\nfunction noop() { /* empty */ }\n\n// from https://github.com/nodejs/node/blob/master/lib/internal/url.js\nfunction urlToOptions(urlObject) {\n var options = {\n protocol: urlObject.protocol,\n hostname: urlObject.hostname.startsWith(\"[\") ?\n /* istanbul ignore next */\n urlObject.hostname.slice(1, -1) :\n urlObject.hostname,\n hash: urlObject.hash,\n search: urlObject.search,\n pathname: urlObject.pathname,\n path: urlObject.pathname + urlObject.search,\n href: urlObject.href,\n };\n if (urlObject.port !== \"\") {\n options.port = Number(urlObject.port);\n }\n return options;\n}\n\nfunction removeMatchingHeaders(regex, headers) {\n var lastValue;\n for (var header in headers) {\n if (regex.test(header)) {\n lastValue = headers[header];\n delete headers[header];\n }\n }\n return (lastValue === null || typeof lastValue === \"undefined\") ?\n undefined : String(lastValue).trim();\n}\n\nfunction createErrorType(code, message, baseClass) {\n // Create constructor\n function CustomError(properties) {\n Error.captureStackTrace(this, this.constructor);\n Object.assign(this, properties || {});\n this.code = code;\n this.message = this.cause ? message + \": \" + this.cause.message : message;\n }\n\n // Attach constructor and set default properties\n CustomError.prototype = new (baseClass || Error)();\n CustomError.prototype.constructor = CustomError;\n CustomError.prototype.name = \"Error [\" + code + \"]\";\n return CustomError;\n}\n\nfunction abortRequest(request) {\n for (var event of events) {\n request.removeListener(event, eventHandlers[event]);\n }\n request.on(\"error\", noop);\n request.abort();\n}\n\nfunction isSubdomain(subdomain, domain) {\n assert(isString(subdomain) && isString(domain));\n var dot = subdomain.length - domain.length - 1;\n return dot > 0 && subdomain[dot] === \".\" && subdomain.endsWith(domain);\n}\n\nfunction isString(value) {\n return typeof value === \"string\" || value instanceof String;\n}\n\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\n\nfunction isBuffer(value) {\n return typeof value === \"object\" && (\"length\" in value);\n}\n\n// Exports\nmodule.exports = wrap({ http: http, https: https });\nmodule.exports.wrap = wrap;\n","var CombinedStream = require('combined-stream');\nvar util = require('util');\nvar path = require('path');\nvar http = require('http');\nvar https = require('https');\nvar parseUrl = require('url').parse;\nvar fs = require('fs');\nvar Stream = require('stream').Stream;\nvar mime = require('mime-types');\nvar asynckit = require('asynckit');\nvar populate = require('./populate.js');\n\n// Public API\nmodule.exports = FormData;\n\n// make it a Stream\nutil.inherits(FormData, CombinedStream);\n\n/**\n * Create readable \"multipart/form-data\" streams.\n * Can be used to submit forms\n * and file uploads to other web applications.\n *\n * @constructor\n * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream\n */\nfunction FormData(options) {\n if (!(this instanceof FormData)) {\n return new FormData(options);\n }\n\n this._overheadLength = 0;\n this._valueLength = 0;\n this._valuesToMeasure = [];\n\n CombinedStream.call(this);\n\n options = options || {};\n for (var option in options) {\n this[option] = options[option];\n }\n}\n\nFormData.LINE_BREAK = '\\r\\n';\nFormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';\n\nFormData.prototype.append = function(field, value, options) {\n\n options = options || {};\n\n // allow filename as single option\n if (typeof options == 'string') {\n options = {filename: options};\n }\n\n var append = CombinedStream.prototype.append.bind(this);\n\n // all that streamy business can't handle numbers\n if (typeof value == 'number') {\n value = '' + value;\n }\n\n // https://github.com/felixge/node-form-data/issues/38\n if (util.isArray(value)) {\n // Please convert your array into string\n // the way web server expects it\n this._error(new Error('Arrays are not supported.'));\n return;\n }\n\n var header = this._multiPartHeader(field, value, options);\n var footer = this._multiPartFooter();\n\n append(header);\n append(value);\n append(footer);\n\n // pass along options.knownLength\n this._trackLength(header, value, options);\n};\n\nFormData.prototype._trackLength = function(header, value, options) {\n var valueLength = 0;\n\n // used w/ getLengthSync(), when length is known.\n // e.g. for streaming directly from a remote server,\n // w/ a known file a size, and not wanting to wait for\n // incoming file to finish to get its size.\n if (options.knownLength != null) {\n valueLength += +options.knownLength;\n } else if (Buffer.isBuffer(value)) {\n valueLength = value.length;\n } else if (typeof value === 'string') {\n valueLength = Buffer.byteLength(value);\n }\n\n this._valueLength += valueLength;\n\n // @check why add CRLF? does this account for custom/multiple CRLFs?\n this._overheadLength +=\n Buffer.byteLength(header) +\n FormData.LINE_BREAK.length;\n\n // empty or either doesn't have path or not an http response or not a stream\n if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream))) {\n return;\n }\n\n // no need to bother with the length\n if (!options.knownLength) {\n this._valuesToMeasure.push(value);\n }\n};\n\nFormData.prototype._lengthRetriever = function(value, callback) {\n\n if (value.hasOwnProperty('fd')) {\n\n // take read range into a account\n // `end` = Infinity –> read file till the end\n //\n // TODO: Looks like there is bug in Node fs.createReadStream\n // it doesn't respect `end` options without `start` options\n // Fix it when node fixes it.\n // https://github.com/joyent/node/issues/7819\n if (value.end != undefined && value.end != Infinity && value.start != undefined) {\n\n // when end specified\n // no need to calculate range\n // inclusive, starts with 0\n callback(null, value.end + 1 - (value.start ? value.start : 0));\n\n // not that fast snoopy\n } else {\n // still need to fetch file size from fs\n fs.stat(value.path, function(err, stat) {\n\n var fileSize;\n\n if (err) {\n callback(err);\n return;\n }\n\n // update final size based on the range options\n fileSize = stat.size - (value.start ? value.start : 0);\n callback(null, fileSize);\n });\n }\n\n // or http response\n } else if (value.hasOwnProperty('httpVersion')) {\n callback(null, +value.headers['content-length']);\n\n // or request stream http://github.com/mikeal/request\n } else if (value.hasOwnProperty('httpModule')) {\n // wait till response come back\n value.on('response', function(response) {\n value.pause();\n callback(null, +response.headers['content-length']);\n });\n value.resume();\n\n // something else\n } else {\n callback('Unknown stream');\n }\n};\n\nFormData.prototype._multiPartHeader = function(field, value, options) {\n // custom header specified (as string)?\n // it becomes responsible for boundary\n // (e.g. to handle extra CRLFs on .NET servers)\n if (typeof options.header == 'string') {\n return options.header;\n }\n\n var contentDisposition = this._getContentDisposition(value, options);\n var contentType = this._getContentType(value, options);\n\n var contents = '';\n var headers = {\n // add custom disposition as third element or keep it two elements if not\n 'Content-Disposition': ['form-data', 'name=\"' + field + '\"'].concat(contentDisposition || []),\n // if no content type. allow it to be empty array\n 'Content-Type': [].concat(contentType || [])\n };\n\n // allow custom headers.\n if (typeof options.header == 'object') {\n populate(headers, options.header);\n }\n\n var header;\n for (var prop in headers) {\n if (!headers.hasOwnProperty(prop)) continue;\n header = headers[prop];\n\n // skip nullish headers.\n if (header == null) {\n continue;\n }\n\n // convert all headers to arrays.\n if (!Array.isArray(header)) {\n header = [header];\n }\n\n // add non-empty headers.\n if (header.length) {\n contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;\n }\n }\n\n return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;\n};\n\nFormData.prototype._getContentDisposition = function(value, options) {\n\n var filename\n , contentDisposition\n ;\n\n if (typeof options.filepath === 'string') {\n // custom filepath for relative paths\n filename = path.normalize(options.filepath).replace(/\\\\/g, '/');\n } else if (options.filename || value.name || value.path) {\n // custom filename take precedence\n // formidable and the browser add a name property\n // fs- and request- streams have path property\n filename = path.basename(options.filename || value.name || value.path);\n } else if (value.readable && value.hasOwnProperty('httpVersion')) {\n // or try http response\n filename = path.basename(value.client._httpMessage.path || '');\n }\n\n if (filename) {\n contentDisposition = 'filename=\"' + filename + '\"';\n }\n\n return contentDisposition;\n};\n\nFormData.prototype._getContentType = function(value, options) {\n\n // use custom content-type above all\n var contentType = options.contentType;\n\n // or try `name` from formidable, browser\n if (!contentType && value.name) {\n contentType = mime.lookup(value.name);\n }\n\n // or try `path` from fs-, request- streams\n if (!contentType && value.path) {\n contentType = mime.lookup(value.path);\n }\n\n // or if it's http-reponse\n if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {\n contentType = value.headers['content-type'];\n }\n\n // or guess it from the filepath or filename\n if (!contentType && (options.filepath || options.filename)) {\n contentType = mime.lookup(options.filepath || options.filename);\n }\n\n // fallback to the default content type if `value` is not simple value\n if (!contentType && typeof value == 'object') {\n contentType = FormData.DEFAULT_CONTENT_TYPE;\n }\n\n return contentType;\n};\n\nFormData.prototype._multiPartFooter = function() {\n return function(next) {\n var footer = FormData.LINE_BREAK;\n\n var lastPart = (this._streams.length === 0);\n if (lastPart) {\n footer += this._lastBoundary();\n }\n\n next(footer);\n }.bind(this);\n};\n\nFormData.prototype._lastBoundary = function() {\n return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;\n};\n\nFormData.prototype.getHeaders = function(userHeaders) {\n var header;\n var formHeaders = {\n 'content-type': 'multipart/form-data; boundary=' + this.getBoundary()\n };\n\n for (header in userHeaders) {\n if (userHeaders.hasOwnProperty(header)) {\n formHeaders[header.toLowerCase()] = userHeaders[header];\n }\n }\n\n return formHeaders;\n};\n\nFormData.prototype.setBoundary = function(boundary) {\n this._boundary = boundary;\n};\n\nFormData.prototype.getBoundary = function() {\n if (!this._boundary) {\n this._generateBoundary();\n }\n\n return this._boundary;\n};\n\nFormData.prototype.getBuffer = function() {\n var dataBuffer = new Buffer.alloc( 0 );\n var boundary = this.getBoundary();\n\n // Create the form content. Add Line breaks to the end of data.\n for (var i = 0, len = this._streams.length; i < len; i++) {\n if (typeof this._streams[i] !== 'function') {\n\n // Add content to the buffer.\n if(Buffer.isBuffer(this._streams[i])) {\n dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);\n }else {\n dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);\n }\n\n // Add break after content.\n if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {\n dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );\n }\n }\n }\n\n // Add the footer and return the Buffer object.\n return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );\n};\n\nFormData.prototype._generateBoundary = function() {\n // This generates a 50 character boundary similar to those used by Firefox.\n // They are optimized for boyer-moore parsing.\n var boundary = '--------------------------';\n for (var i = 0; i < 24; i++) {\n boundary += Math.floor(Math.random() * 10).toString(16);\n }\n\n this._boundary = boundary;\n};\n\n// Note: getLengthSync DOESN'T calculate streams length\n// As workaround one can calculate file size manually\n// and add it as knownLength option\nFormData.prototype.getLengthSync = function() {\n var knownLength = this._overheadLength + this._valueLength;\n\n // Don't get confused, there are 3 \"internal\" streams for each keyval pair\n // so it basically checks if there is any value added to the form\n if (this._streams.length) {\n knownLength += this._lastBoundary().length;\n }\n\n // https://github.com/form-data/form-data/issues/40\n if (!this.hasKnownLength()) {\n // Some async length retrievers are present\n // therefore synchronous length calculation is false.\n // Please use getLength(callback) to get proper length\n this._error(new Error('Cannot calculate proper length in synchronous way.'));\n }\n\n return knownLength;\n};\n\n// Public API to check if length of added values is known\n// https://github.com/form-data/form-data/issues/196\n// https://github.com/form-data/form-data/issues/262\nFormData.prototype.hasKnownLength = function() {\n var hasKnownLength = true;\n\n if (this._valuesToMeasure.length) {\n hasKnownLength = false;\n }\n\n return hasKnownLength;\n};\n\nFormData.prototype.getLength = function(cb) {\n var knownLength = this._overheadLength + this._valueLength;\n\n if (this._streams.length) {\n knownLength += this._lastBoundary().length;\n }\n\n if (!this._valuesToMeasure.length) {\n process.nextTick(cb.bind(this, null, knownLength));\n return;\n }\n\n asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {\n if (err) {\n cb(err);\n return;\n }\n\n values.forEach(function(length) {\n knownLength += length;\n });\n\n cb(null, knownLength);\n });\n};\n\nFormData.prototype.submit = function(params, cb) {\n var request\n , options\n , defaults = {method: 'post'}\n ;\n\n // parse provided url if it's string\n // or treat it as options object\n if (typeof params == 'string') {\n\n params = parseUrl(params);\n options = populate({\n port: params.port,\n path: params.pathname,\n host: params.hostname,\n protocol: params.protocol\n }, defaults);\n\n // use custom params\n } else {\n\n options = populate(params, defaults);\n // if no port provided use default one\n if (!options.port) {\n options.port = options.protocol == 'https:' ? 443 : 80;\n }\n }\n\n // put that good code in getHeaders to some use\n options.headers = this.getHeaders(params.headers);\n\n // https if specified, fallback to http in any other case\n if (options.protocol == 'https:') {\n request = https.request(options);\n } else {\n request = http.request(options);\n }\n\n // get content length and fire away\n this.getLength(function(err, length) {\n if (err && err !== 'Unknown stream') {\n this._error(err);\n return;\n }\n\n // add content length\n if (length) {\n request.setHeader('Content-Length', length);\n }\n\n this.pipe(request);\n if (cb) {\n var onResponse;\n\n var callback = function (error, responce) {\n request.removeListener('error', callback);\n request.removeListener('response', onResponse);\n\n return cb.call(this, error, responce);\n };\n\n onResponse = callback.bind(this, null);\n\n request.on('error', callback);\n request.on('response', onResponse);\n }\n }.bind(this));\n\n return request;\n};\n\nFormData.prototype._error = function(err) {\n if (!this.error) {\n this.error = err;\n this.pause();\n this.emit('error', err);\n }\n};\n\nFormData.prototype.toString = function () {\n return '[object FormData]';\n};\n","// populates missing values\nmodule.exports = function(dst, src) {\n\n Object.keys(src).forEach(function(prop)\n {\n dst[prop] = dst[prop] || src[prop];\n });\n\n return dst;\n};\n","'use strict';\n\nmodule.exports = (flag, argv = process.argv) => {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n};\n","/*!\n * mime-db\n * Copyright(c) 2014 Jonathan Ong\n * Copyright(c) 2015-2022 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n/**\n * Module exports.\n */\n\nmodule.exports = require('./db.json')\n","/*!\n * mime-types\n * Copyright(c) 2014 Jonathan Ong\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict'\n\n/**\n * Module dependencies.\n * @private\n */\n\nvar db = require('mime-db')\nvar extname = require('path').extname\n\n/**\n * Module variables.\n * @private\n */\n\nvar EXTRACT_TYPE_REGEXP = /^\\s*([^;\\s]*)(?:;|\\s|$)/\nvar TEXT_TYPE_REGEXP = /^text\\//i\n\n/**\n * Module exports.\n * @public\n */\n\nexports.charset = charset\nexports.charsets = { lookup: charset }\nexports.contentType = contentType\nexports.extension = extension\nexports.extensions = Object.create(null)\nexports.lookup = lookup\nexports.types = Object.create(null)\n\n// Populate the extensions/types maps\npopulateMaps(exports.extensions, exports.types)\n\n/**\n * Get the default charset for a MIME type.\n *\n * @param {string} type\n * @return {boolean|string}\n */\n\nfunction charset (type) {\n if (!type || typeof type !== 'string') {\n return false\n }\n\n // TODO: use media-typer\n var match = EXTRACT_TYPE_REGEXP.exec(type)\n var mime = match && db[match[1].toLowerCase()]\n\n if (mime && mime.charset) {\n return mime.charset\n }\n\n // default text/* to utf-8\n if (match && TEXT_TYPE_REGEXP.test(match[1])) {\n return 'UTF-8'\n }\n\n return false\n}\n\n/**\n * Create a full Content-Type header given a MIME type or extension.\n *\n * @param {string} str\n * @return {boolean|string}\n */\n\nfunction contentType (str) {\n // TODO: should this even be in this module?\n if (!str || typeof str !== 'string') {\n return false\n }\n\n var mime = str.indexOf('/') === -1\n ? exports.lookup(str)\n : str\n\n if (!mime) {\n return false\n }\n\n // TODO: use content-type or other module\n if (mime.indexOf('charset') === -1) {\n var charset = exports.charset(mime)\n if (charset) mime += '; charset=' + charset.toLowerCase()\n }\n\n return mime\n}\n\n/**\n * Get the default extension for a MIME type.\n *\n * @param {string} type\n * @return {boolean|string}\n */\n\nfunction extension (type) {\n if (!type || typeof type !== 'string') {\n return false\n }\n\n // TODO: use media-typer\n var match = EXTRACT_TYPE_REGEXP.exec(type)\n\n // get extensions\n var exts = match && exports.extensions[match[1].toLowerCase()]\n\n if (!exts || !exts.length) {\n return false\n }\n\n return exts[0]\n}\n\n/**\n * Lookup the MIME type for a file path/extension.\n *\n * @param {string} path\n * @return {boolean|string}\n */\n\nfunction lookup (path) {\n if (!path || typeof path !== 'string') {\n return false\n }\n\n // get the extension (\"ext\" or \".ext\" or full path)\n var extension = extname('x.' + path)\n .toLowerCase()\n .substr(1)\n\n if (!extension) {\n return false\n }\n\n return exports.types[extension] || false\n}\n\n/**\n * Populate the extensions and types maps.\n * @private\n */\n\nfunction populateMaps (extensions, types) {\n // source preference (least -> most)\n var preference = ['nginx', 'apache', undefined, 'iana']\n\n Object.keys(db).forEach(function forEachMimeType (type) {\n var mime = db[type]\n var exts = mime.extensions\n\n if (!exts || !exts.length) {\n return\n }\n\n // mime -> extensions\n extensions[type] = exts\n\n // extension -> mime\n for (var i = 0; i < exts.length; i++) {\n var extension = exts[i]\n\n if (types[extension]) {\n var from = preference.indexOf(db[types[extension]].source)\n var to = preference.indexOf(mime.source)\n\n if (types[extension] !== 'application/octet-stream' &&\n (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {\n // skip the remapping\n continue\n }\n }\n\n // set the extension -> mime\n types[extension] = type\n }\n })\n}\n","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","'use strict';\n\nvar parseUrl = require('url').parse;\n\nvar DEFAULT_PORTS = {\n ftp: 21,\n gopher: 70,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443,\n};\n\nvar stringEndsWith = String.prototype.endsWith || function(s) {\n return s.length <= this.length &&\n this.indexOf(s, this.length - s.length) !== -1;\n};\n\n/**\n * @param {string|object} url - The URL, or the result from url.parse.\n * @return {string} The URL of the proxy that should handle the request to the\n * given URL. If no proxy is set, this will be an empty string.\n */\nfunction getProxyForUrl(url) {\n var parsedUrl = typeof url === 'string' ? parseUrl(url) : url || {};\n var proto = parsedUrl.protocol;\n var hostname = parsedUrl.host;\n var port = parsedUrl.port;\n if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') {\n return ''; // Don't proxy URLs without a valid scheme or host.\n }\n\n proto = proto.split(':', 1)[0];\n // Stripping ports in this way instead of using parsedUrl.hostname to make\n // sure that the brackets around IPv6 addresses are kept.\n hostname = hostname.replace(/:\\d*$/, '');\n port = parseInt(port) || DEFAULT_PORTS[proto] || 0;\n if (!shouldProxy(hostname, port)) {\n return ''; // Don't proxy URLs that match NO_PROXY.\n }\n\n var proxy =\n getEnv('npm_config_' + proto + '_proxy') ||\n getEnv(proto + '_proxy') ||\n getEnv('npm_config_proxy') ||\n getEnv('all_proxy');\n if (proxy && proxy.indexOf('://') === -1) {\n // Missing scheme in proxy, default to the requested URL's scheme.\n proxy = proto + '://' + proxy;\n }\n return proxy;\n}\n\n/**\n * Determines whether a given URL should be proxied.\n *\n * @param {string} hostname - The host name of the URL.\n * @param {number} port - The effective port of the URL.\n * @returns {boolean} Whether the given URL should be proxied.\n * @private\n */\nfunction shouldProxy(hostname, port) {\n var NO_PROXY =\n (getEnv('npm_config_no_proxy') || getEnv('no_proxy')).toLowerCase();\n if (!NO_PROXY) {\n return true; // Always proxy if NO_PROXY is not set.\n }\n if (NO_PROXY === '*') {\n return false; // Never proxy if wildcard is set.\n }\n\n return NO_PROXY.split(/[,\\s]/).every(function(proxy) {\n if (!proxy) {\n return true; // Skip zero-length hosts.\n }\n var parsedProxy = proxy.match(/^(.+):(\\d+)$/);\n var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;\n var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;\n if (parsedProxyPort && parsedProxyPort !== port) {\n return true; // Skip if ports don't match.\n }\n\n if (!/^[.*]/.test(parsedProxyHostname)) {\n // No wildcards, so stop proxying if there is an exact match.\n return hostname !== parsedProxyHostname;\n }\n\n if (parsedProxyHostname.charAt(0) === '*') {\n // Remove leading wildcard.\n parsedProxyHostname = parsedProxyHostname.slice(1);\n }\n // Stop proxying if the hostname ends with the no_proxy host.\n return !stringEndsWith.call(hostname, parsedProxyHostname);\n });\n}\n\n/**\n * Get the value for an environment variable.\n *\n * @param {string} key - The name of the environment variable.\n * @return {string} The value of the environment variable.\n * @private\n */\nfunction getEnv(key) {\n return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';\n}\n\nexports.getProxyForUrl = getProxyForUrl;\n","'use strict';\nconst os = require('os');\nconst tty = require('tty');\nconst hasFlag = require('has-flag');\n\nconst {env} = process;\n\nlet forceColor;\nif (hasFlag('no-color') ||\n\thasFlag('no-colors') ||\n\thasFlag('color=false') ||\n\thasFlag('color=never')) {\n\tforceColor = 0;\n} else if (hasFlag('color') ||\n\thasFlag('colors') ||\n\thasFlag('color=true') ||\n\thasFlag('color=always')) {\n\tforceColor = 1;\n}\n\nif ('FORCE_COLOR' in env) {\n\tif (env.FORCE_COLOR === 'true') {\n\t\tforceColor = 1;\n\t} else if (env.FORCE_COLOR === 'false') {\n\t\tforceColor = 0;\n\t} else {\n\t\tforceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3\n\t};\n}\n\nfunction supportsColor(haveStream, streamIsTTY) {\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (hasFlag('color=16m') ||\n\t\thasFlag('color=full') ||\n\t\thasFlag('color=truecolor')) {\n\t\treturn 3;\n\t}\n\n\tif (hasFlag('color=256')) {\n\t\treturn 2;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10 &&\n\t\t\tNumber(osRelease[2]) >= 10586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app':\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\tcase 'Apple_Terminal':\n\t\t\t\treturn 2;\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nfunction getSupportLevel(stream) {\n\tconst level = supportsColor(stream, stream && stream.isTTY);\n\treturn translateLevel(level);\n}\n\nmodule.exports = {\n\tsupportsColor: getSupportLevel,\n\tstdout: translateLevel(supportsColor(true, tty.isatty(1))),\n\tstderr: translateLevel(supportsColor(true, tty.isatty(2)))\n};\n","module.exports = require('./lib/tunnel');\n","'use strict';\n\nvar net = require('net');\nvar tls = require('tls');\nvar http = require('http');\nvar https = require('https');\nvar events = require('events');\nvar assert = require('assert');\nvar util = require('util');\n\n\nexports.httpOverHttp = httpOverHttp;\nexports.httpsOverHttp = httpsOverHttp;\nexports.httpOverHttps = httpOverHttps;\nexports.httpsOverHttps = httpsOverHttps;\n\n\nfunction httpOverHttp(options) {\n var agent = new TunnelingAgent(options);\n agent.request = http.request;\n return agent;\n}\n\nfunction httpsOverHttp(options) {\n var agent = new TunnelingAgent(options);\n agent.request = http.request;\n agent.createSocket = createSecureSocket;\n agent.defaultPort = 443;\n return agent;\n}\n\nfunction httpOverHttps(options) {\n var agent = new TunnelingAgent(options);\n agent.request = https.request;\n return agent;\n}\n\nfunction httpsOverHttps(options) {\n var agent = new TunnelingAgent(options);\n agent.request = https.request;\n agent.createSocket = createSecureSocket;\n agent.defaultPort = 443;\n return agent;\n}\n\n\nfunction TunnelingAgent(options) {\n var self = this;\n self.options = options || {};\n self.proxyOptions = self.options.proxy || {};\n self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;\n self.requests = [];\n self.sockets = [];\n\n self.on('free', function onFree(socket, host, port, localAddress) {\n var options = toOptions(host, port, localAddress);\n for (var i = 0, len = self.requests.length; i < len; ++i) {\n var pending = self.requests[i];\n if (pending.host === options.host && pending.port === options.port) {\n // Detect the request to connect same origin server,\n // reuse the connection.\n self.requests.splice(i, 1);\n pending.request.onSocket(socket);\n return;\n }\n }\n socket.destroy();\n self.removeSocket(socket);\n });\n}\nutil.inherits(TunnelingAgent, events.EventEmitter);\n\nTunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {\n var self = this;\n var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));\n\n if (self.sockets.length >= this.maxSockets) {\n // We are over limit so we'll add it to the queue.\n self.requests.push(options);\n return;\n }\n\n // If we are under maxSockets create a new one.\n self.createSocket(options, function(socket) {\n socket.on('free', onFree);\n socket.on('close', onCloseOrRemove);\n socket.on('agentRemove', onCloseOrRemove);\n req.onSocket(socket);\n\n function onFree() {\n self.emit('free', socket, options);\n }\n\n function onCloseOrRemove(err) {\n self.removeSocket(socket);\n socket.removeListener('free', onFree);\n socket.removeListener('close', onCloseOrRemove);\n socket.removeListener('agentRemove', onCloseOrRemove);\n }\n });\n};\n\nTunnelingAgent.prototype.createSocket = function createSocket(options, cb) {\n var self = this;\n var placeholder = {};\n self.sockets.push(placeholder);\n\n var connectOptions = mergeOptions({}, self.proxyOptions, {\n method: 'CONNECT',\n path: options.host + ':' + options.port,\n agent: false,\n headers: {\n host: options.host + ':' + options.port\n }\n });\n if (options.localAddress) {\n connectOptions.localAddress = options.localAddress;\n }\n if (connectOptions.proxyAuth) {\n connectOptions.headers = connectOptions.headers || {};\n connectOptions.headers['Proxy-Authorization'] = 'Basic ' +\n new Buffer(connectOptions.proxyAuth).toString('base64');\n }\n\n debug('making CONNECT request');\n var connectReq = self.request(connectOptions);\n connectReq.useChunkedEncodingByDefault = false; // for v0.6\n connectReq.once('response', onResponse); // for v0.6\n connectReq.once('upgrade', onUpgrade); // for v0.6\n connectReq.once('connect', onConnect); // for v0.7 or later\n connectReq.once('error', onError);\n connectReq.end();\n\n function onResponse(res) {\n // Very hacky. This is necessary to avoid http-parser leaks.\n res.upgrade = true;\n }\n\n function onUpgrade(res, socket, head) {\n // Hacky.\n process.nextTick(function() {\n onConnect(res, socket, head);\n });\n }\n\n function onConnect(res, socket, head) {\n connectReq.removeAllListeners();\n socket.removeAllListeners();\n\n if (res.statusCode !== 200) {\n debug('tunneling socket could not be established, statusCode=%d',\n res.statusCode);\n socket.destroy();\n var error = new Error('tunneling socket could not be established, ' +\n 'statusCode=' + res.statusCode);\n error.code = 'ECONNRESET';\n options.request.emit('error', error);\n self.removeSocket(placeholder);\n return;\n }\n if (head.length > 0) {\n debug('got illegal response body from proxy');\n socket.destroy();\n var error = new Error('got illegal response body from proxy');\n error.code = 'ECONNRESET';\n options.request.emit('error', error);\n self.removeSocket(placeholder);\n return;\n }\n debug('tunneling connection has established');\n self.sockets[self.sockets.indexOf(placeholder)] = socket;\n return cb(socket);\n }\n\n function onError(cause) {\n connectReq.removeAllListeners();\n\n debug('tunneling socket could not be established, cause=%s\\n',\n cause.message, cause.stack);\n var error = new Error('tunneling socket could not be established, ' +\n 'cause=' + cause.message);\n error.code = 'ECONNRESET';\n options.request.emit('error', error);\n self.removeSocket(placeholder);\n }\n};\n\nTunnelingAgent.prototype.removeSocket = function removeSocket(socket) {\n var pos = this.sockets.indexOf(socket)\n if (pos === -1) {\n return;\n }\n this.sockets.splice(pos, 1);\n\n var pending = this.requests.shift();\n if (pending) {\n // If we have pending requests and a socket gets closed a new one\n // needs to be created to take over in the pool for the one that closed.\n this.createSocket(pending, function(socket) {\n pending.request.onSocket(socket);\n });\n }\n};\n\nfunction createSecureSocket(options, cb) {\n var self = this;\n TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {\n var hostHeader = options.request.getHeader('host');\n var tlsOptions = mergeOptions({}, self.options, {\n socket: socket,\n servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host\n });\n\n // 0 is dummy port for v0.6\n var secureSocket = tls.connect(0, tlsOptions);\n self.sockets[self.sockets.indexOf(socket)] = secureSocket;\n cb(secureSocket);\n });\n}\n\n\nfunction toOptions(host, port, localAddress) {\n if (typeof host === 'string') { // since v0.10\n return {\n host: host,\n port: port,\n localAddress: localAddress\n };\n }\n return host; // for v0.11 or later\n}\n\nfunction mergeOptions(target) {\n for (var i = 1, len = arguments.length; i < len; ++i) {\n var overrides = arguments[i];\n if (typeof overrides === 'object') {\n var keys = Object.keys(overrides);\n for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {\n var k = keys[j];\n if (overrides[k] !== undefined) {\n target[k] = overrides[k];\n }\n }\n }\n }\n return target;\n}\n\n\nvar debug;\nif (process.env.NODE_DEBUG && /\\btunnel\\b/.test(process.env.NODE_DEBUG)) {\n debug = function() {\n var args = Array.prototype.slice.call(arguments);\n if (typeof args[0] === 'string') {\n args[0] = 'TUNNEL: ' + args[0];\n } else {\n args.unshift('TUNNEL:');\n }\n console.error.apply(console, args);\n }\n} else {\n debug = function() {};\n}\nexports.debug = debug; // for test\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"v1\", {\n enumerable: true,\n get: function () {\n return _v.default;\n }\n});\nObject.defineProperty(exports, \"v3\", {\n enumerable: true,\n get: function () {\n return _v2.default;\n }\n});\nObject.defineProperty(exports, \"v4\", {\n enumerable: true,\n get: function () {\n return _v3.default;\n }\n});\nObject.defineProperty(exports, \"v5\", {\n enumerable: true,\n get: function () {\n return _v4.default;\n }\n});\nObject.defineProperty(exports, \"NIL\", {\n enumerable: true,\n get: function () {\n return _nil.default;\n }\n});\nObject.defineProperty(exports, \"version\", {\n enumerable: true,\n get: function () {\n return _version.default;\n }\n});\nObject.defineProperty(exports, \"validate\", {\n enumerable: true,\n get: function () {\n return _validate.default;\n }\n});\nObject.defineProperty(exports, \"stringify\", {\n enumerable: true,\n get: function () {\n return _stringify.default;\n }\n});\nObject.defineProperty(exports, \"parse\", {\n enumerable: true,\n get: function () {\n return _parse.default;\n }\n});\n\nvar _v = _interopRequireDefault(require(\"./v1.js\"));\n\nvar _v2 = _interopRequireDefault(require(\"./v3.js\"));\n\nvar _v3 = _interopRequireDefault(require(\"./v4.js\"));\n\nvar _v4 = _interopRequireDefault(require(\"./v5.js\"));\n\nvar _nil = _interopRequireDefault(require(\"./nil.js\"));\n\nvar _version = _interopRequireDefault(require(\"./version.js\"));\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _crypto = _interopRequireDefault(require(\"crypto\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction md5(bytes) {\n if (Array.isArray(bytes)) {\n bytes = Buffer.from(bytes);\n } else if (typeof bytes === 'string') {\n bytes = Buffer.from(bytes, 'utf8');\n }\n\n return _crypto.default.createHash('md5').update(bytes).digest();\n}\n\nvar _default = md5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _default = '00000000-0000-0000-0000-000000000000';\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction parse(uuid) {\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n let v;\n const arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nvar _default = parse;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = rng;\n\nvar _crypto = _interopRequireDefault(require(\"crypto\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate\n\nlet poolPtr = rnds8Pool.length;\n\nfunction rng() {\n if (poolPtr > rnds8Pool.length - 16) {\n _crypto.default.randomFillSync(rnds8Pool);\n\n poolPtr = 0;\n }\n\n return rnds8Pool.slice(poolPtr, poolPtr += 16);\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _crypto = _interopRequireDefault(require(\"crypto\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction sha1(bytes) {\n if (Array.isArray(bytes)) {\n bytes = Buffer.from(bytes);\n } else if (typeof bytes === 'string') {\n bytes = Buffer.from(bytes, 'utf8');\n }\n\n return _crypto.default.createHash('sha1').update(bytes).digest();\n}\n\nvar _default = sha1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nvar _default = stringify;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\nlet _nodeId;\n\nlet _clockseq; // Previous uuid creation time\n\n\nlet _lastMSecs = 0;\nlet _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n let i = buf && offset || 0;\n const b = buf || new Array(16);\n options = options || {};\n let node = options.node || _nodeId;\n let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n const seedBytes = options.random || (options.rng || _rng.default)();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (let n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || (0, _stringify.default)(b);\n}\n\nvar _default = v1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _md = _interopRequireDefault(require(\"./md5.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v3 = (0, _v.default)('v3', 0x30, _md.default);\nvar _default = v3;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nexports.URL = exports.DNS = void 0;\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n const bytes = [];\n\n for (let i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nconst DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexports.DNS = DNS;\nconst URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexports.URL = URL;\n\nfunction _default(name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = (0, _parse.default)(namespace);\n }\n\n if (namespace.length !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n let bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return (0, _stringify.default)(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction v4(options, buf, offset) {\n options = options || {};\n\n const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return (0, _stringify.default)(rnds);\n}\n\nvar _default = v4;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _sha = _interopRequireDefault(require(\"./sha1.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v5 = (0, _v.default)('v5', 0x50, _sha.default);\nvar _default = v5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _regex = _interopRequireDefault(require(\"./regex.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && _regex.default.test(uuid);\n}\n\nvar _default = validate;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction version(uuid) {\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n return parseInt(uuid.substr(14, 1), 16);\n}\n\nvar _default = version;\nexports.default = _default;","module.exports = require(\"assert\");","module.exports = require(\"crypto\");","module.exports = require(\"events\");","module.exports = require(\"fs\");","module.exports = require(\"http\");","module.exports = require(\"https\");","module.exports = require(\"net\");","module.exports = require(\"node:fs\");","module.exports = require(\"os\");","module.exports = require(\"path\");","module.exports = require(\"stream\");","module.exports = require(\"tls\");","module.exports = require(\"tty\");","module.exports = require(\"url\");","module.exports = require(\"util\");","module.exports = require(\"zlib\");","// Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors\n'use strict';\n\nconst FormData$1 = require('form-data');\nconst url = require('url');\nconst proxyFromEnv = require('proxy-from-env');\nconst http = require('http');\nconst https = require('https');\nconst util = require('util');\nconst followRedirects = require('follow-redirects');\nconst zlib = require('zlib');\nconst stream = require('stream');\nconst EventEmitter = require('events');\n\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\nconst FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1);\nconst url__default = /*#__PURE__*/_interopDefaultLegacy(url);\nconst http__default = /*#__PURE__*/_interopDefaultLegacy(http);\nconst https__default = /*#__PURE__*/_interopDefaultLegacy(https);\nconst util__default = /*#__PURE__*/_interopDefaultLegacy(util);\nconst followRedirects__default = /*#__PURE__*/_interopDefaultLegacy(followRedirects);\nconst zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);\nconst stream__default = /*#__PURE__*/_interopDefaultLegacy(stream);\nconst EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);\n\nfunction bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n};\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n};\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n};\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n };\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n};\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n};\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n};\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n};\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n};\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n};\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n};\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n};\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n if (reducer(descriptor, name, obj) !== false) {\n reducedDescriptors[name] = descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n};\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n};\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n };\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n};\n\nconst noop = () => {};\n\nconst toFiniteNumber = (value, defaultValue) => {\n value = +value;\n return Number.isFinite(value) ? value : defaultValue;\n};\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz';\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n};\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0];\n }\n\n return str;\n};\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n };\n\n return visit(obj, 0);\n};\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nconst utils = {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype$1 = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype$1, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype$1);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (FormData__default[\"default\"] || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode$1(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode$1);\n } : encode$1;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nfunction buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nconst InterceptorManager$1 = InterceptorManager;\n\nconst transitionalDefaults = {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n\nconst URLSearchParams = url__default[\"default\"].URLSearchParams;\n\nconst platform = {\n isNode: true,\n classes: {\n URLSearchParams,\n FormData: FormData__default[\"default\"],\n Blob: typeof Blob !== 'undefined' && Blob || null\n },\n protocols: [ 'http', 'https', 'file', 'data' ]\n};\n\nfunction toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nconst DEFAULT_CONTENT_TYPE = {\n 'Content-Type': undefined\n};\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n if (!hasJSONContentType) {\n return data;\n }\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nconst defaults$1 = defaults;\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nconst parseHeaders = rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite);\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\nutils.freezeMethods(AxiosHeaders.prototype);\nutils.freezeMethods(AxiosHeaders);\n\nconst AxiosHeaders$1 = AxiosHeaders;\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nfunction transformData(fns, response) {\n const config = this || defaults$1;\n const context = response || config;\n const headers = AxiosHeaders$1.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n\nfunction isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nfunction settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nfunction isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nfunction combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nfunction buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n\nconst VERSION = \"1.4.0\";\n\nfunction parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n\nconst DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\\s\\S]*)$/;\n\n/**\n * Parse data uri to a Buffer or Blob\n *\n * @param {String} uri\n * @param {?Boolean} asBlob\n * @param {?Object} options\n * @param {?Function} options.Blob\n *\n * @returns {Buffer|Blob}\n */\nfunction fromDataURI(uri, asBlob, options) {\n const _Blob = options && options.Blob || platform.classes.Blob;\n const protocol = parseProtocol(uri);\n\n if (asBlob === undefined && _Blob) {\n asBlob = true;\n }\n\n if (protocol === 'data') {\n uri = protocol.length ? uri.slice(protocol.length + 1) : uri;\n\n const match = DATA_URL_PATTERN.exec(uri);\n\n if (!match) {\n throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);\n }\n\n const mime = match[1];\n const isBase64 = match[2];\n const body = match[3];\n const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8');\n\n if (asBlob) {\n if (!_Blob) {\n throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);\n }\n\n return new _Blob([buffer], {type: mime});\n }\n\n return buffer;\n }\n\n throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);\n}\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled(force, args) {\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, args);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, args);\n }, threshold - (now - timestamp));\n }\n };\n}\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nconst kInternals = Symbol('internals');\n\nclass AxiosTransformStream extends stream__default[\"default\"].Transform{\n constructor(options) {\n options = utils.toFlatObject(options, {\n maxRate: 0,\n chunkSize: 64 * 1024,\n minChunkSize: 100,\n timeWindow: 500,\n ticksRate: 2,\n samplesCount: 15\n }, null, (prop, source) => {\n return !utils.isUndefined(source[prop]);\n });\n\n super({\n readableHighWaterMark: options.chunkSize\n });\n\n const self = this;\n\n const internals = this[kInternals] = {\n length: options.length,\n timeWindow: options.timeWindow,\n ticksRate: options.ticksRate,\n chunkSize: options.chunkSize,\n maxRate: options.maxRate,\n minChunkSize: options.minChunkSize,\n bytesSeen: 0,\n isCaptured: false,\n notifiedBytesLoaded: 0,\n ts: Date.now(),\n bytes: 0,\n onReadCallback: null\n };\n\n const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);\n\n this.on('newListener', event => {\n if (event === 'progress') {\n if (!internals.isCaptured) {\n internals.isCaptured = true;\n }\n }\n });\n\n let bytesNotified = 0;\n\n internals.updateProgress = throttle(function throttledHandler() {\n const totalBytes = internals.length;\n const bytesTransferred = internals.bytesSeen;\n const progressBytes = bytesTransferred - bytesNotified;\n if (!progressBytes || self.destroyed) return;\n\n const rate = _speedometer(progressBytes);\n\n bytesNotified = bytesTransferred;\n\n process.nextTick(() => {\n self.emit('progress', {\n 'loaded': bytesTransferred,\n 'total': totalBytes,\n 'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,\n 'bytes': progressBytes,\n 'rate': rate ? rate : undefined,\n 'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?\n (totalBytes - bytesTransferred) / rate : undefined\n });\n });\n }, internals.ticksRate);\n\n const onFinish = () => {\n internals.updateProgress(true);\n };\n\n this.once('end', onFinish);\n this.once('error', onFinish);\n }\n\n _read(size) {\n const internals = this[kInternals];\n\n if (internals.onReadCallback) {\n internals.onReadCallback();\n }\n\n return super._read(size);\n }\n\n _transform(chunk, encoding, callback) {\n const self = this;\n const internals = this[kInternals];\n const maxRate = internals.maxRate;\n\n const readableHighWaterMark = this.readableHighWaterMark;\n\n const timeWindow = internals.timeWindow;\n\n const divider = 1000 / timeWindow;\n const bytesThreshold = (maxRate / divider);\n const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;\n\n function pushChunk(_chunk, _callback) {\n const bytes = Buffer.byteLength(_chunk);\n internals.bytesSeen += bytes;\n internals.bytes += bytes;\n\n if (internals.isCaptured) {\n internals.updateProgress();\n }\n\n if (self.push(_chunk)) {\n process.nextTick(_callback);\n } else {\n internals.onReadCallback = () => {\n internals.onReadCallback = null;\n process.nextTick(_callback);\n };\n }\n }\n\n const transformChunk = (_chunk, _callback) => {\n const chunkSize = Buffer.byteLength(_chunk);\n let chunkRemainder = null;\n let maxChunkSize = readableHighWaterMark;\n let bytesLeft;\n let passed = 0;\n\n if (maxRate) {\n const now = Date.now();\n\n if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) {\n internals.ts = now;\n bytesLeft = bytesThreshold - internals.bytes;\n internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;\n passed = 0;\n }\n\n bytesLeft = bytesThreshold - internals.bytes;\n }\n\n if (maxRate) {\n if (bytesLeft <= 0) {\n // next time window\n return setTimeout(() => {\n _callback(null, _chunk);\n }, timeWindow - passed);\n }\n\n if (bytesLeft < maxChunkSize) {\n maxChunkSize = bytesLeft;\n }\n }\n\n if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) {\n chunkRemainder = _chunk.subarray(maxChunkSize);\n _chunk = _chunk.subarray(0, maxChunkSize);\n }\n\n pushChunk(_chunk, chunkRemainder ? () => {\n process.nextTick(_callback, null, chunkRemainder);\n } : _callback);\n };\n\n transformChunk(chunk, function transformNextChunk(err, _chunk) {\n if (err) {\n return callback(err);\n }\n\n if (_chunk) {\n transformChunk(_chunk, transformNextChunk);\n } else {\n callback(null);\n }\n });\n }\n\n setLength(length) {\n this[kInternals].length = +length;\n return this;\n }\n}\n\nconst AxiosTransformStream$1 = AxiosTransformStream;\n\nconst {asyncIterator} = Symbol;\n\nconst readBlob = async function* (blob) {\n if (blob.stream) {\n yield* blob.stream();\n } else if (blob.arrayBuffer) {\n yield await blob.arrayBuffer();\n } else if (blob[asyncIterator]) {\n yield* blob[asyncIterator]();\n } else {\n yield blob;\n }\n};\n\nconst readBlob$1 = readBlob;\n\nconst BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';\n\nconst textEncoder = new util.TextEncoder();\n\nconst CRLF = '\\r\\n';\nconst CRLF_BYTES = textEncoder.encode(CRLF);\nconst CRLF_BYTES_COUNT = 2;\n\nclass FormDataPart {\n constructor(name, value) {\n const {escapeName} = this.constructor;\n const isStringValue = utils.isString(value);\n\n let headers = `Content-Disposition: form-data; name=\"${escapeName(name)}\"${\n !isStringValue && value.name ? `; filename=\"${escapeName(value.name)}\"` : ''\n }${CRLF}`;\n\n if (isStringValue) {\n value = textEncoder.encode(String(value).replace(/\\r?\\n|\\r\\n?/g, CRLF));\n } else {\n headers += `Content-Type: ${value.type || \"application/octet-stream\"}${CRLF}`;\n }\n\n this.headers = textEncoder.encode(headers + CRLF);\n\n this.contentLength = isStringValue ? value.byteLength : value.size;\n\n this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;\n\n this.name = name;\n this.value = value;\n }\n\n async *encode(){\n yield this.headers;\n\n const {value} = this;\n\n if(utils.isTypedArray(value)) {\n yield value;\n } else {\n yield* readBlob$1(value);\n }\n\n yield CRLF_BYTES;\n }\n\n static escapeName(name) {\n return String(name).replace(/[\\r\\n\"]/g, (match) => ({\n '\\r' : '%0D',\n '\\n' : '%0A',\n '\"' : '%22',\n }[match]));\n }\n}\n\nconst formDataToStream = (form, headersHandler, options) => {\n const {\n tag = 'form-data-boundary',\n size = 25,\n boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)\n } = options || {};\n\n if(!utils.isFormData(form)) {\n throw TypeError('FormData instance required');\n }\n\n if (boundary.length < 1 || boundary.length > 70) {\n throw Error('boundary must be 10-70 characters long')\n }\n\n const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);\n const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);\n let contentLength = footerBytes.byteLength;\n\n const parts = Array.from(form.entries()).map(([name, value]) => {\n const part = new FormDataPart(name, value);\n contentLength += part.size;\n return part;\n });\n\n contentLength += boundaryBytes.byteLength * parts.length;\n\n contentLength = utils.toFiniteNumber(contentLength);\n\n const computedHeaders = {\n 'Content-Type': `multipart/form-data; boundary=${boundary}`\n };\n\n if (Number.isFinite(contentLength)) {\n computedHeaders['Content-Length'] = contentLength;\n }\n\n headersHandler && headersHandler(computedHeaders);\n\n return stream.Readable.from((async function *() {\n for(const part of parts) {\n yield boundaryBytes;\n yield* part.encode();\n }\n\n yield footerBytes;\n })());\n};\n\nconst formDataToStream$1 = formDataToStream;\n\nclass ZlibHeaderTransformStream extends stream__default[\"default\"].Transform {\n __transform(chunk, encoding, callback) {\n this.push(chunk);\n callback();\n }\n\n _transform(chunk, encoding, callback) {\n if (chunk.length !== 0) {\n this._transform = this.__transform;\n\n // Add Default Compression headers if no zlib headers are present\n if (chunk[0] !== 120) { // Hex: 78\n const header = Buffer.alloc(2);\n header[0] = 120; // Hex: 78\n header[1] = 156; // Hex: 9C \n this.push(header, encoding);\n }\n }\n\n this.__transform(chunk, encoding, callback);\n }\n}\n\nconst ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream;\n\nconst callbackify = (fn, reducer) => {\n return utils.isAsyncFn(fn) ? function (...args) {\n const cb = args.pop();\n fn.apply(this, args).then((value) => {\n try {\n reducer ? cb(null, ...reducer(value)) : cb(null, value);\n } catch (err) {\n cb(err);\n }\n }, cb);\n } : fn;\n};\n\nconst callbackify$1 = callbackify;\n\nconst zlibOptions = {\n flush: zlib__default[\"default\"].constants.Z_SYNC_FLUSH,\n finishFlush: zlib__default[\"default\"].constants.Z_SYNC_FLUSH\n};\n\nconst brotliOptions = {\n flush: zlib__default[\"default\"].constants.BROTLI_OPERATION_FLUSH,\n finishFlush: zlib__default[\"default\"].constants.BROTLI_OPERATION_FLUSH\n};\n\nconst isBrotliSupported = utils.isFunction(zlib__default[\"default\"].createBrotliDecompress);\n\nconst {http: httpFollow, https: httpsFollow} = followRedirects__default[\"default\"];\n\nconst isHttps = /https:?/;\n\nconst supportedProtocols = platform.protocols.map(protocol => {\n return protocol + ':';\n});\n\n/**\n * If the proxy or config beforeRedirects functions are defined, call them with the options\n * object.\n *\n * @param {Object} options - The options object that was passed to the request.\n *\n * @returns {Object}\n */\nfunction dispatchBeforeRedirect(options) {\n if (options.beforeRedirects.proxy) {\n options.beforeRedirects.proxy(options);\n }\n if (options.beforeRedirects.config) {\n options.beforeRedirects.config(options);\n }\n}\n\n/**\n * If the proxy or config afterRedirects functions are defined, call them with the options\n *\n * @param {http.ClientRequestArgs} options\n * @param {AxiosProxyConfig} configProxy configuration from Axios options object\n * @param {string} location\n *\n * @returns {http.ClientRequestArgs}\n */\nfunction setProxy(options, configProxy, location) {\n let proxy = configProxy;\n if (!proxy && proxy !== false) {\n const proxyUrl = proxyFromEnv.getProxyForUrl(location);\n if (proxyUrl) {\n proxy = new URL(proxyUrl);\n }\n }\n if (proxy) {\n // Basic proxy authorization\n if (proxy.username) {\n proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');\n }\n\n if (proxy.auth) {\n // Support proxy auth object form\n if (proxy.auth.username || proxy.auth.password) {\n proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');\n }\n const base64 = Buffer\n .from(proxy.auth, 'utf8')\n .toString('base64');\n options.headers['Proxy-Authorization'] = 'Basic ' + base64;\n }\n\n options.headers.host = options.hostname + (options.port ? ':' + options.port : '');\n const proxyHost = proxy.hostname || proxy.host;\n options.hostname = proxyHost;\n // Replace 'host' since options is not a URL object\n options.host = proxyHost;\n options.port = proxy.port;\n options.path = location;\n if (proxy.protocol) {\n options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`;\n }\n }\n\n options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {\n // Configure proxy for redirected request, passing the original config proxy to apply\n // the exact same logic as if the redirected request was performed by axios directly.\n setProxy(redirectOptions, configProxy, redirectOptions.href);\n };\n}\n\nconst isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';\n\n// temporary hotfix\n\nconst wrapAsync = (asyncExecutor) => {\n return new Promise((resolve, reject) => {\n let onDone;\n let isDone;\n\n const done = (value, isRejected) => {\n if (isDone) return;\n isDone = true;\n onDone && onDone(value, isRejected);\n };\n\n const _resolve = (value) => {\n done(value);\n resolve(value);\n };\n\n const _reject = (reason) => {\n done(reason, true);\n reject(reason);\n };\n\n asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);\n })\n};\n\n/*eslint consistent-return:0*/\nconst httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {\n return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {\n let {data, lookup, family} = config;\n const {responseType, responseEncoding} = config;\n const method = config.method.toUpperCase();\n let isDone;\n let rejected = false;\n let req;\n\n if (lookup && utils.isAsyncFn(lookup)) {\n lookup = callbackify$1(lookup, (entry) => {\n if(utils.isString(entry)) {\n entry = [entry, entry.indexOf('.') < 0 ? 6 : 4];\n } else if (!utils.isArray(entry)) {\n throw new TypeError('lookup async function must return an array [ip: string, family: number]]')\n }\n return entry;\n });\n }\n\n // temporary internal emitter until the AxiosRequest class will be implemented\n const emitter = new EventEmitter__default[\"default\"]();\n\n const onFinished = () => {\n if (config.cancelToken) {\n config.cancelToken.unsubscribe(abort);\n }\n\n if (config.signal) {\n config.signal.removeEventListener('abort', abort);\n }\n\n emitter.removeAllListeners();\n };\n\n onDone((value, isRejected) => {\n isDone = true;\n if (isRejected) {\n rejected = true;\n onFinished();\n }\n });\n\n function abort(reason) {\n emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);\n }\n\n emitter.once('abort', reject);\n\n if (config.cancelToken || config.signal) {\n config.cancelToken && config.cancelToken.subscribe(abort);\n if (config.signal) {\n config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);\n }\n }\n\n // Parse url\n const fullPath = buildFullPath(config.baseURL, config.url);\n const parsed = new URL(fullPath, 'http://localhost');\n const protocol = parsed.protocol || supportedProtocols[0];\n\n if (protocol === 'data:') {\n let convertedData;\n\n if (method !== 'GET') {\n return settle(resolve, reject, {\n status: 405,\n statusText: 'method not allowed',\n headers: {},\n config\n });\n }\n\n try {\n convertedData = fromDataURI(config.url, responseType === 'blob', {\n Blob: config.env && config.env.Blob\n });\n } catch (err) {\n throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);\n }\n\n if (responseType === 'text') {\n convertedData = convertedData.toString(responseEncoding);\n\n if (!responseEncoding || responseEncoding === 'utf8') {\n convertedData = utils.stripBOM(convertedData);\n }\n } else if (responseType === 'stream') {\n convertedData = stream__default[\"default\"].Readable.from(convertedData);\n }\n\n return settle(resolve, reject, {\n data: convertedData,\n status: 200,\n statusText: 'OK',\n headers: new AxiosHeaders$1(),\n config\n });\n }\n\n if (supportedProtocols.indexOf(protocol) === -1) {\n return reject(new AxiosError(\n 'Unsupported protocol ' + protocol,\n AxiosError.ERR_BAD_REQUEST,\n config\n ));\n }\n\n const headers = AxiosHeaders$1.from(config.headers).normalize();\n\n // Set User-Agent (required by some servers)\n // See https://github.com/axios/axios/issues/69\n // User-Agent is specified; handle case where no UA header is desired\n // Only set header if it hasn't been set in config\n headers.set('User-Agent', 'axios/' + VERSION, false);\n\n const onDownloadProgress = config.onDownloadProgress;\n const onUploadProgress = config.onUploadProgress;\n const maxRate = config.maxRate;\n let maxUploadRate = undefined;\n let maxDownloadRate = undefined;\n\n // support for spec compliant FormData objects\n if (utils.isSpecCompliantForm(data)) {\n const userBoundary = headers.getContentType(/boundary=([-_\\w\\d]{10,70})/i);\n\n data = formDataToStream$1(data, (formHeaders) => {\n headers.set(formHeaders);\n }, {\n tag: `axios-${VERSION}-boundary`,\n boundary: userBoundary && userBoundary[1] || undefined\n });\n // support for https://www.npmjs.com/package/form-data api\n } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {\n headers.set(data.getHeaders());\n\n if (!headers.hasContentLength()) {\n try {\n const knownLength = await util__default[\"default\"].promisify(data.getLength).call(data);\n Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);\n /*eslint no-empty:0*/\n } catch (e) {\n }\n }\n } else if (utils.isBlob(data)) {\n data.size && headers.setContentType(data.type || 'application/octet-stream');\n headers.setContentLength(data.size || 0);\n data = stream__default[\"default\"].Readable.from(readBlob$1(data));\n } else if (data && !utils.isStream(data)) {\n if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {\n data = Buffer.from(new Uint8Array(data));\n } else if (utils.isString(data)) {\n data = Buffer.from(data, 'utf-8');\n } else {\n return reject(new AxiosError(\n 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',\n AxiosError.ERR_BAD_REQUEST,\n config\n ));\n }\n\n // Add Content-Length header if data exists\n headers.setContentLength(data.length, false);\n\n if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {\n return reject(new AxiosError(\n 'Request body larger than maxBodyLength limit',\n AxiosError.ERR_BAD_REQUEST,\n config\n ));\n }\n }\n\n const contentLength = utils.toFiniteNumber(headers.getContentLength());\n\n if (utils.isArray(maxRate)) {\n maxUploadRate = maxRate[0];\n maxDownloadRate = maxRate[1];\n } else {\n maxUploadRate = maxDownloadRate = maxRate;\n }\n\n if (data && (onUploadProgress || maxUploadRate)) {\n if (!utils.isStream(data)) {\n data = stream__default[\"default\"].Readable.from(data, {objectMode: false});\n }\n\n data = stream__default[\"default\"].pipeline([data, new AxiosTransformStream$1({\n length: contentLength,\n maxRate: utils.toFiniteNumber(maxUploadRate)\n })], utils.noop);\n\n onUploadProgress && data.on('progress', progress => {\n onUploadProgress(Object.assign(progress, {\n upload: true\n }));\n });\n }\n\n // HTTP basic authentication\n let auth = undefined;\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password || '';\n auth = username + ':' + password;\n }\n\n if (!auth && parsed.username) {\n const urlUsername = parsed.username;\n const urlPassword = parsed.password;\n auth = urlUsername + ':' + urlPassword;\n }\n\n auth && headers.delete('authorization');\n\n let path;\n\n try {\n path = buildURL(\n parsed.pathname + parsed.search,\n config.params,\n config.paramsSerializer\n ).replace(/^\\?/, '');\n } catch (err) {\n const customErr = new Error(err.message);\n customErr.config = config;\n customErr.url = config.url;\n customErr.exists = true;\n return reject(customErr);\n }\n\n headers.set(\n 'Accept-Encoding',\n 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false\n );\n\n const options = {\n path,\n method: method,\n headers: headers.toJSON(),\n agents: { http: config.httpAgent, https: config.httpsAgent },\n auth,\n protocol,\n family,\n lookup,\n beforeRedirect: dispatchBeforeRedirect,\n beforeRedirects: {}\n };\n\n if (config.socketPath) {\n options.socketPath = config.socketPath;\n } else {\n options.hostname = parsed.hostname;\n options.port = parsed.port;\n setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);\n }\n\n let transport;\n const isHttpsRequest = isHttps.test(options.protocol);\n options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;\n if (config.transport) {\n transport = config.transport;\n } else if (config.maxRedirects === 0) {\n transport = isHttpsRequest ? https__default[\"default\"] : http__default[\"default\"];\n } else {\n if (config.maxRedirects) {\n options.maxRedirects = config.maxRedirects;\n }\n if (config.beforeRedirect) {\n options.beforeRedirects.config = config.beforeRedirect;\n }\n transport = isHttpsRequest ? httpsFollow : httpFollow;\n }\n\n if (config.maxBodyLength > -1) {\n options.maxBodyLength = config.maxBodyLength;\n } else {\n // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited\n options.maxBodyLength = Infinity;\n }\n\n if (config.insecureHTTPParser) {\n options.insecureHTTPParser = config.insecureHTTPParser;\n }\n\n // Create the request\n req = transport.request(options, function handleResponse(res) {\n if (req.destroyed) return;\n\n const streams = [res];\n\n const responseLength = +res.headers['content-length'];\n\n if (onDownloadProgress) {\n const transformStream = new AxiosTransformStream$1({\n length: utils.toFiniteNumber(responseLength),\n maxRate: utils.toFiniteNumber(maxDownloadRate)\n });\n\n onDownloadProgress && transformStream.on('progress', progress => {\n onDownloadProgress(Object.assign(progress, {\n download: true\n }));\n });\n\n streams.push(transformStream);\n }\n\n // decompress the response body transparently if required\n let responseStream = res;\n\n // return the last request in case of redirects\n const lastRequest = res.req || req;\n\n // if decompress disabled we should not decompress\n if (config.decompress !== false && res.headers['content-encoding']) {\n // if no content, but headers still say that it is encoded,\n // remove the header not confuse downstream operations\n if (method === 'HEAD' || res.statusCode === 204) {\n delete res.headers['content-encoding'];\n }\n\n switch (res.headers['content-encoding']) {\n /*eslint default-case:0*/\n case 'gzip':\n case 'x-gzip':\n case 'compress':\n case 'x-compress':\n // add the unzipper to the body stream processing pipeline\n streams.push(zlib__default[\"default\"].createUnzip(zlibOptions));\n\n // remove the content-encoding in order to not confuse downstream operations\n delete res.headers['content-encoding'];\n break;\n case 'deflate':\n streams.push(new ZlibHeaderTransformStream$1());\n\n // add the unzipper to the body stream processing pipeline\n streams.push(zlib__default[\"default\"].createUnzip(zlibOptions));\n\n // remove the content-encoding in order to not confuse downstream operations\n delete res.headers['content-encoding'];\n break;\n case 'br':\n if (isBrotliSupported) {\n streams.push(zlib__default[\"default\"].createBrotliDecompress(brotliOptions));\n delete res.headers['content-encoding'];\n }\n }\n }\n\n responseStream = streams.length > 1 ? stream__default[\"default\"].pipeline(streams, utils.noop) : streams[0];\n\n const offListeners = stream__default[\"default\"].finished(responseStream, () => {\n offListeners();\n onFinished();\n });\n\n const response = {\n status: res.statusCode,\n statusText: res.statusMessage,\n headers: new AxiosHeaders$1(res.headers),\n config,\n request: lastRequest\n };\n\n if (responseType === 'stream') {\n response.data = responseStream;\n settle(resolve, reject, response);\n } else {\n const responseBuffer = [];\n let totalResponseBytes = 0;\n\n responseStream.on('data', function handleStreamData(chunk) {\n responseBuffer.push(chunk);\n totalResponseBytes += chunk.length;\n\n // make sure the content length is not over the maxContentLength if specified\n if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {\n // stream.destroy() emit aborted event before calling reject() on Node.js v16\n rejected = true;\n responseStream.destroy();\n reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE, config, lastRequest));\n }\n });\n\n responseStream.on('aborted', function handlerStreamAborted() {\n if (rejected) {\n return;\n }\n\n const err = new AxiosError(\n 'maxContentLength size of ' + config.maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n lastRequest\n );\n responseStream.destroy(err);\n reject(err);\n });\n\n responseStream.on('error', function handleStreamError(err) {\n if (req.destroyed) return;\n reject(AxiosError.from(err, null, config, lastRequest));\n });\n\n responseStream.on('end', function handleStreamEnd() {\n try {\n let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);\n if (responseType !== 'arraybuffer') {\n responseData = responseData.toString(responseEncoding);\n if (!responseEncoding || responseEncoding === 'utf8') {\n responseData = utils.stripBOM(responseData);\n }\n }\n response.data = responseData;\n } catch (err) {\n reject(AxiosError.from(err, null, config, response.request, response));\n }\n settle(resolve, reject, response);\n });\n }\n\n emitter.once('abort', err => {\n if (!responseStream.destroyed) {\n responseStream.emit('error', err);\n responseStream.destroy();\n }\n });\n });\n\n emitter.once('abort', err => {\n reject(err);\n req.destroy(err);\n });\n\n // Handle errors\n req.on('error', function handleRequestError(err) {\n // @todo remove\n // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;\n reject(AxiosError.from(err, null, config, req));\n });\n\n // set tcp keep alive to prevent drop connection by peer\n req.on('socket', function handleRequestSocket(socket) {\n // default interval of sending ack packet is 1 minute\n socket.setKeepAlive(true, 1000 * 60);\n });\n\n // Handle request timeout\n if (config.timeout) {\n // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.\n const timeout = parseInt(config.timeout, 10);\n\n if (isNaN(timeout)) {\n reject(new AxiosError(\n 'error trying to parse `config.timeout` to int',\n AxiosError.ERR_BAD_OPTION_VALUE,\n config,\n req\n ));\n\n return;\n }\n\n // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.\n // And timer callback will be fired, and abort() will be invoked before connection, then get \"socket hang up\" and code ECONNRESET.\n // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.\n // And then these socket which be hang up will devouring CPU little by little.\n // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.\n req.setTimeout(timeout, function handleRequestTimeout() {\n if (isDone) return;\n let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = config.transitional || transitionalDefaults;\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n config,\n req\n ));\n abort();\n });\n }\n\n\n // Send the request\n if (utils.isStream(data)) {\n let ended = false;\n let errored = false;\n\n data.on('end', () => {\n ended = true;\n });\n\n data.once('error', err => {\n errored = true;\n req.destroy(err);\n });\n\n data.on('close', () => {\n if (!ended && !errored) {\n abort(new CanceledError('Request stream has been aborted', config, req));\n }\n });\n\n data.pipe(req);\n } else {\n req.end(data);\n }\n });\n};\n\nconst cookies = platform.isStandardBrowserEnv ?\n\n// Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n const cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n// Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })();\n\nconst isURLSameOrigin = platform.isStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n\nfunction progressEventReducer(listener, isDownloadStream) {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n };\n}\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nconst xhrAdapter = isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n let requestData = config.data;\n const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();\n const responseType = config.responseType;\n let onCanceled;\n function done() {\n if (config.cancelToken) {\n config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (config.signal) {\n config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n if (utils.isFormData(requestData)) {\n if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {\n requestHeaders.setContentType(false); // Let the browser set it\n } else {\n requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks\n }\n }\n\n let request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));\n }\n\n const fullPath = buildFullPath(config.baseURL, config.url);\n\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders$1.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = config.transitional || transitionalDefaults;\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (platform.isStandardBrowserEnv) {\n // Add xsrf header\n const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))\n && config.xsrfCookieName && cookies.read(config.xsrfCookieName);\n\n if (xsrfValue) {\n requestHeaders.set(config.xsrfHeaderName, xsrfValue);\n }\n }\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = config.responseType;\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));\n }\n\n if (config.cancelToken || config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n config.cancelToken && config.cancelToken.subscribe(onCanceled);\n if (config.signal) {\n config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(fullPath);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n};\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter\n};\n\nutils.forEach(knownAdapters, (fn, value) => {\n if(fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst adapters = {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {\n break;\n }\n }\n\n if (!adapter) {\n if (adapter === false) {\n throw new AxiosError(\n `Adapter ${nameOrAdapter} is not supported by the environment`,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n throw new Error(\n utils.hasOwnProp(knownAdapters, nameOrAdapter) ?\n `Adapter '${nameOrAdapter}' is not available in the build` :\n `Unknown adapter '${nameOrAdapter}'`\n );\n }\n\n if (!utils.isFunction(adapter)) {\n throw new TypeError('adapter is not a function');\n }\n\n return adapter;\n },\n adapters: knownAdapters\n};\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nfunction dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders$1.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders$1.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders$1.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nfunction mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n\nconst validators$1 = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators$1[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators$1.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nconst validator = {\n assertOptions,\n validators: validators$1\n};\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager$1(),\n response: new InterceptorManager$1()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n };\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n let contextHeaders;\n\n // Flatten headers\n contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n contextHeaders && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders$1.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nconst Axios$1 = Axios;\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nconst CancelToken$1 = CancelToken;\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nfunction spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nfunction isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n\nconst HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nconst HttpStatusCode$1 = HttpStatusCode;\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios$1(defaultConfig);\n const instance = bind(Axios$1.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults$1);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios$1;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken$1;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders$1;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.HttpStatusCode = HttpStatusCode$1;\n\naxios.default = axios;\n\nmodule.exports = axios;\n//# sourceMappingURL=axios.cjs.map\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\tvar threw = true;\n\ttry {\n\t\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\t\tthrew = false;\n\t} finally {\n\t\tif(threw) delete __webpack_module_cache__[moduleId];\n\t}\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\nif (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = __dirname + \"/\";","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(3109);\n",""],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/licenses.txt b/dist/licenses.txt new file mode 100644 index 000000000..19c2002fb --- /dev/null +++ b/dist/licenses.txt @@ -0,0 +1,353 @@ +@actions/core +MIT +The MIT License (MIT) + +Copyright 2019 GitHub + +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. + +@actions/http-client +MIT +Actions Http Client for Node.js + +Copyright (c) GitHub, Inc. + +All rights reserved. + +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. + + +asynckit +MIT +The MIT License (MIT) + +Copyright (c) 2016 Alex Indigo + +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. + + +axios +MIT +# Copyright (c) 2014-present Matt Zabriskie & Collaborators + +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. + + +combined-stream +MIT +Copyright (c) 2011 Debuggable Limited + +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. + + +debug +MIT +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +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. + + + +delayed-stream +MIT +Copyright (c) 2011 Debuggable Limited + +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. + + +follow-redirects +MIT +Copyright 2014–present Olivier Lalonde , James Talmage , Ruben Verborgh + +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. + + +form-data +MIT +Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and 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. + + +has-flag +MIT +MIT License + +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. + + +mime-db +MIT +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015-2022 Douglas Christopher Wilson + +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. + + +mime-types +MIT +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015 Douglas Christopher Wilson + +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. + + +ms +MIT +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +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. + + +proxy-from-env +MIT +The MIT License + +Copyright (C) 2016-2018 Rob Wu + +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. + + +supports-color +MIT +MIT License + +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. + + +tunnel +MIT +The MIT License (MIT) + +Copyright (c) 2012 Koichi Kobayashi + +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. + + +uuid +MIT +The MIT License (MIT) + +Copyright (c) 2010-2020 Robert Kieffer and other 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/dist/sourcemap-register.js b/dist/sourcemap-register.js new file mode 100644 index 000000000..466141d40 --- /dev/null +++ b/dist/sourcemap-register.js @@ -0,0 +1 @@ +(()=>{var e={650:e=>{var r=Object.prototype.toString;var n=typeof Buffer.alloc==="function"&&typeof Buffer.allocUnsafe==="function"&&typeof Buffer.from==="function";function isArrayBuffer(e){return r.call(e).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(e,r,t){r>>>=0;var o=e.byteLength-r;if(o<0){throw new RangeError("'offset' is out of bounds")}if(t===undefined){t=o}else{t>>>=0;if(t>o){throw new RangeError("'length' is out of bounds")}}return n?Buffer.from(e.slice(r,r+t)):new Buffer(new Uint8Array(e.slice(r,r+t)))}function fromString(e,r){if(typeof r!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}return n?Buffer.from(e,r):new Buffer(e,r)}function bufferFrom(e,r,t){if(typeof e==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(e)){return fromArrayBuffer(e,r,t)}if(typeof e==="string"){return fromString(e,r)}return n?Buffer.from(e):new Buffer(e)}e.exports=bufferFrom},274:(e,r,n)=>{var t=n(339);var o=Object.prototype.hasOwnProperty;var i=typeof Map!=="undefined";function ArraySet(){this._array=[];this._set=i?new Map:Object.create(null)}ArraySet.fromArray=function ArraySet_fromArray(e,r){var n=new ArraySet;for(var t=0,o=e.length;t=0){return r}}else{var n=t.toSetString(e);if(o.call(this._set,n)){return this._set[n]}}throw new Error('"'+e+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(e){if(e>=0&&e{var t=n(190);var o=5;var i=1<>1;return r?-n:n}r.encode=function base64VLQ_encode(e){var r="";var n;var i=toVLQSigned(e);do{n=i&a;i>>>=o;if(i>0){n|=u}r+=t.encode(n)}while(i>0);return r};r.decode=function base64VLQ_decode(e,r,n){var i=e.length;var s=0;var l=0;var c,p;do{if(r>=i){throw new Error("Expected more digits in base 64 VLQ value.")}p=t.decode(e.charCodeAt(r++));if(p===-1){throw new Error("Invalid base64 digit: "+e.charAt(r-1))}c=!!(p&u);p&=a;s=s+(p<{var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(0<=e&&e{r.GREATEST_LOWER_BOUND=1;r.LEAST_UPPER_BOUND=2;function recursiveSearch(e,n,t,o,i,a){var u=Math.floor((n-e)/2)+e;var s=i(t,o[u],true);if(s===0){return u}else if(s>0){if(n-u>1){return recursiveSearch(u,n,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return n1){return recursiveSearch(e,u,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return u}else{return e<0?-1:e}}}r.search=function search(e,n,t,o){if(n.length===0){return-1}var i=recursiveSearch(-1,n.length,e,n,t,o||r.GREATEST_LOWER_BOUND);if(i<0){return-1}while(i-1>=0){if(t(n[i],n[i-1],true)!==0){break}--i}return i}},680:(e,r,n)=>{var t=n(339);function generatedPositionAfter(e,r){var n=e.generatedLine;var o=r.generatedLine;var i=e.generatedColumn;var a=r.generatedColumn;return o>n||o==n&&a>=i||t.compareByGeneratedPositionsInflated(e,r)<=0}function MappingList(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=function MappingList_forEach(e,r){this._array.forEach(e,r)};MappingList.prototype.add=function MappingList_add(e){if(generatedPositionAfter(this._last,e)){this._last=e;this._array.push(e)}else{this._sorted=false;this._array.push(e)}};MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(t.compareByGeneratedPositionsInflated);this._sorted=true}return this._array};r.H=MappingList},758:(e,r)=>{function swap(e,r,n){var t=e[r];e[r]=e[n];e[n]=t}function randomIntInRange(e,r){return Math.round(e+Math.random()*(r-e))}function doQuickSort(e,r,n,t){if(n{var t;var o=n(339);var i=n(345);var a=n(274).I;var u=n(449);var s=n(758).U;function SourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}return n.sections!=null?new IndexedSourceMapConsumer(n,r):new BasicSourceMapConsumer(n,r)}SourceMapConsumer.fromSourceMap=function(e,r){return BasicSourceMapConsumer.fromSourceMap(e,r)};SourceMapConsumer.prototype._version=3;SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{configurable:true,enumerable:true,get:function(){if(!this.__generatedMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{configurable:true,enumerable:true,get:function(){if(!this.__originalMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._charIsMappingSeparator=function SourceMapConsumer_charIsMappingSeparator(e,r){var n=e.charAt(r);return n===";"||n===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(e,r){throw new Error("Subclasses must implement _parseMappings")};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.GREATEST_LOWER_BOUND=1;SourceMapConsumer.LEAST_UPPER_BOUND=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(e,r,n){var t=r||null;var i=n||SourceMapConsumer.GENERATED_ORDER;var a;switch(i){case SourceMapConsumer.GENERATED_ORDER:a=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;a.map((function(e){var r=e.source===null?null:this._sources.at(e.source);r=o.computeSourceURL(u,r,this._sourceMapURL);return{source:r,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name===null?null:this._names.at(e.name)}}),this).forEach(e,t)};SourceMapConsumer.prototype.allGeneratedPositionsFor=function SourceMapConsumer_allGeneratedPositionsFor(e){var r=o.getArg(e,"line");var n={source:o.getArg(e,"source"),originalLine:r,originalColumn:o.getArg(e,"column",0)};n.source=this._findSourceIndex(n.source);if(n.source<0){return[]}var t=[];var a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,i.LEAST_UPPER_BOUND);if(a>=0){var u=this._originalMappings[a];if(e.column===undefined){var s=u.originalLine;while(u&&u.originalLine===s){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}else{var l=u.originalColumn;while(u&&u.originalLine===r&&u.originalColumn==l){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}}return t};r.SourceMapConsumer=SourceMapConsumer;function BasicSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sources");var u=o.getArg(n,"names",[]);var s=o.getArg(n,"sourceRoot",null);var l=o.getArg(n,"sourcesContent",null);var c=o.getArg(n,"mappings");var p=o.getArg(n,"file",null);if(t!=this._version){throw new Error("Unsupported version: "+t)}if(s){s=o.normalize(s)}i=i.map(String).map(o.normalize).map((function(e){return s&&o.isAbsolute(s)&&o.isAbsolute(e)?o.relative(s,e):e}));this._names=a.fromArray(u.map(String),true);this._sources=a.fromArray(i,true);this._absoluteSources=this._sources.toArray().map((function(e){return o.computeSourceURL(s,e,r)}));this.sourceRoot=s;this.sourcesContent=l;this._mappings=c;this._sourceMapURL=r;this.file=p}BasicSourceMapConsumer.prototype=Object.create(SourceMapConsumer.prototype);BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer;BasicSourceMapConsumer.prototype._findSourceIndex=function(e){var r=e;if(this.sourceRoot!=null){r=o.relative(this.sourceRoot,r)}if(this._sources.has(r)){return this._sources.indexOf(r)}var n;for(n=0;n1){v.source=l+_[1];l+=_[1];v.originalLine=i+_[2];i=v.originalLine;v.originalLine+=1;v.originalColumn=a+_[3];a=v.originalColumn;if(_.length>4){v.name=c+_[4];c+=_[4]}}m.push(v);if(typeof v.originalLine==="number"){d.push(v)}}}s(m,o.compareByGeneratedPositionsDeflated);this.__generatedMappings=m;s(d,o.compareByOriginalPositions);this.__originalMappings=d};BasicSourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(e,r,n,t,o,a){if(e[n]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+e[n])}if(e[t]<0){throw new TypeError("Column must be greater than or equal to 0, got "+e[t])}return i.search(e,r,o,a)};BasicSourceMapConsumer.prototype.computeColumnSpans=function SourceMapConsumer_computeColumnSpans(){for(var e=0;e=0){var t=this._generatedMappings[n];if(t.generatedLine===r.generatedLine){var i=o.getArg(t,"source",null);if(i!==null){i=this._sources.at(i);i=o.computeSourceURL(this.sourceRoot,i,this._sourceMapURL)}var a=o.getArg(t,"name",null);if(a!==null){a=this._names.at(a)}return{source:i,line:o.getArg(t,"originalLine",null),column:o.getArg(t,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}};BasicSourceMapConsumer.prototype.hasContentsOfAllSources=function BasicSourceMapConsumer_hasContentsOfAllSources(){if(!this.sourcesContent){return false}return this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return e==null}))};BasicSourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(e,r){if(!this.sourcesContent){return null}var n=this._findSourceIndex(e);if(n>=0){return this.sourcesContent[n]}var t=e;if(this.sourceRoot!=null){t=o.relative(this.sourceRoot,t)}var i;if(this.sourceRoot!=null&&(i=o.urlParse(this.sourceRoot))){var a=t.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(a)){return this.sourcesContent[this._sources.indexOf(a)]}if((!i.path||i.path=="/")&&this._sources.has("/"+t)){return this.sourcesContent[this._sources.indexOf("/"+t)]}}if(r){return null}else{throw new Error('"'+t+'" is not in the SourceMap.')}};BasicSourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(e){var r=o.getArg(e,"source");r=this._findSourceIndex(r);if(r<0){return{line:null,column:null,lastColumn:null}}var n={source:r,originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")};var t=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",SourceMapConsumer.GREATEST_LOWER_BOUND));if(t>=0){var i=this._originalMappings[t];if(i.source===n.source){return{line:o.getArg(i,"generatedLine",null),column:o.getArg(i,"generatedColumn",null),lastColumn:o.getArg(i,"lastGeneratedColumn",null)}}}return{line:null,column:null,lastColumn:null}};t=BasicSourceMapConsumer;function IndexedSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sections");if(t!=this._version){throw new Error("Unsupported version: "+t)}this._sources=new a;this._names=new a;var u={line:-1,column:0};this._sections=i.map((function(e){if(e.url){throw new Error("Support for url field in sections not implemented.")}var n=o.getArg(e,"offset");var t=o.getArg(n,"line");var i=o.getArg(n,"column");if(t{var t=n(449);var o=n(339);var i=n(274).I;var a=n(680).H;function SourceMapGenerator(e){if(!e){e={}}this._file=o.getArg(e,"file",null);this._sourceRoot=o.getArg(e,"sourceRoot",null);this._skipValidation=o.getArg(e,"skipValidation",false);this._sources=new i;this._names=new i;this._mappings=new a;this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(e){var r=e.sourceRoot;var n=new SourceMapGenerator({file:e.file,sourceRoot:r});e.eachMapping((function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};if(e.source!=null){t.source=e.source;if(r!=null){t.source=o.relative(r,t.source)}t.original={line:e.originalLine,column:e.originalColumn};if(e.name!=null){t.name=e.name}}n.addMapping(t)}));e.sources.forEach((function(t){var i=t;if(r!==null){i=o.relative(r,t)}if(!n._sources.has(i)){n._sources.add(i)}var a=e.sourceContentFor(t);if(a!=null){n.setSourceContent(t,a)}}));return n};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(e){var r=o.getArg(e,"generated");var n=o.getArg(e,"original",null);var t=o.getArg(e,"source",null);var i=o.getArg(e,"name",null);if(!this._skipValidation){this._validateMapping(r,n,t,i)}if(t!=null){t=String(t);if(!this._sources.has(t)){this._sources.add(t)}}if(i!=null){i=String(i);if(!this._names.has(i)){this._names.add(i)}}this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:t,name:i})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(e,r){var n=e;if(this._sourceRoot!=null){n=o.relative(this._sourceRoot,n)}if(r!=null){if(!this._sourcesContents){this._sourcesContents=Object.create(null)}this._sourcesContents[o.toSetString(n)]=r}else if(this._sourcesContents){delete this._sourcesContents[o.toSetString(n)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(e,r,n){var t=r;if(r==null){if(e.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}t=e.file}var a=this._sourceRoot;if(a!=null){t=o.relative(a,t)}var u=new i;var s=new i;this._mappings.unsortedForEach((function(r){if(r.source===t&&r.originalLine!=null){var i=e.originalPositionFor({line:r.originalLine,column:r.originalColumn});if(i.source!=null){r.source=i.source;if(n!=null){r.source=o.join(n,r.source)}if(a!=null){r.source=o.relative(a,r.source)}r.originalLine=i.line;r.originalColumn=i.column;if(i.name!=null){r.name=i.name}}}var l=r.source;if(l!=null&&!u.has(l)){u.add(l)}var c=r.name;if(c!=null&&!s.has(c)){s.add(c)}}),this);this._sources=u;this._names=s;e.sources.forEach((function(r){var t=e.sourceContentFor(r);if(t!=null){if(n!=null){r=o.join(n,r)}if(a!=null){r=o.relative(a,r)}this.setSourceContent(r,t)}}),this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(e,r,n,t){if(r&&typeof r.line!=="number"&&typeof r.column!=="number"){throw new Error("original.line and original.column are not numbers -- you probably meant to omit "+"the original mapping entirely and only map the generated position. If so, pass "+"null for the original mapping instead of an object with empty or null values.")}if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!r&&!n&&!t){return}else if(e&&"line"in e&&"column"in e&&r&&"line"in r&&"column"in r&&e.line>0&&e.column>=0&&r.line>0&&r.column>=0&&n){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:r,name:t}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var e=0;var r=1;var n=0;var i=0;var a=0;var u=0;var s="";var l;var c;var p;var f;var g=this._mappings.toArray();for(var h=0,d=g.length;h0){if(!o.compareByGeneratedPositionsInflated(c,g[h-1])){continue}l+=","}}l+=t.encode(c.generatedColumn-e);e=c.generatedColumn;if(c.source!=null){f=this._sources.indexOf(c.source);l+=t.encode(f-u);u=f;l+=t.encode(c.originalLine-1-i);i=c.originalLine-1;l+=t.encode(c.originalColumn-n);n=c.originalColumn;if(c.name!=null){p=this._names.indexOf(c.name);l+=t.encode(p-a);a=p}}s+=l}return s};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(e,r){return e.map((function(e){if(!this._sourcesContents){return null}if(r!=null){e=o.relative(r,e)}var n=o.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){e.file=this._file}if(this._sourceRoot!=null){e.sourceRoot=this._sourceRoot}if(this._sourcesContents){e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)}return e};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON())};r.h=SourceMapGenerator},351:(e,r,n)=>{var t;var o=n(591).h;var i=n(339);var a=/(\r?\n)/;var u=10;var s="$$$isSourceNode$$$";function SourceNode(e,r,n,t,o){this.children=[];this.sourceContents={};this.line=e==null?null:e;this.column=r==null?null:r;this.source=n==null?null:n;this.name=o==null?null:o;this[s]=true;if(t!=null)this.add(t)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(e,r,n){var t=new SourceNode;var o=e.split(a);var u=0;var shiftNextLine=function(){var e=getNextLine();var r=getNextLine()||"";return e+r;function getNextLine(){return u=0;r--){this.prepend(e[r])}}else if(e[s]||typeof e==="string"){this.children.unshift(e)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e)}return this};SourceNode.prototype.walk=function SourceNode_walk(e){var r;for(var n=0,t=this.children.length;n0){r=[];for(n=0;n{function getArg(e,r,n){if(r in e){return e[r]}else if(arguments.length===3){return n}else{throw new Error('"'+r+'" is a required argument.')}}r.getArg=getArg;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;var t=/^data:.+\,.+$/;function urlParse(e){var r=e.match(n);if(!r){return null}return{scheme:r[1],auth:r[2],host:r[3],port:r[4],path:r[5]}}r.urlParse=urlParse;function urlGenerate(e){var r="";if(e.scheme){r+=e.scheme+":"}r+="//";if(e.auth){r+=e.auth+"@"}if(e.host){r+=e.host}if(e.port){r+=":"+e.port}if(e.path){r+=e.path}return r}r.urlGenerate=urlGenerate;function normalize(e){var n=e;var t=urlParse(e);if(t){if(!t.path){return e}n=t.path}var o=r.isAbsolute(n);var i=n.split(/\/+/);for(var a,u=0,s=i.length-1;s>=0;s--){a=i[s];if(a==="."){i.splice(s,1)}else if(a===".."){u++}else if(u>0){if(a===""){i.splice(s+1,u);u=0}else{i.splice(s,2);u--}}}n=i.join("/");if(n===""){n=o?"/":"."}if(t){t.path=n;return urlGenerate(t)}return n}r.normalize=normalize;function join(e,r){if(e===""){e="."}if(r===""){r="."}var n=urlParse(r);var o=urlParse(e);if(o){e=o.path||"/"}if(n&&!n.scheme){if(o){n.scheme=o.scheme}return urlGenerate(n)}if(n||r.match(t)){return r}if(o&&!o.host&&!o.path){o.host=r;return urlGenerate(o)}var i=r.charAt(0)==="/"?r:normalize(e.replace(/\/+$/,"")+"/"+r);if(o){o.path=i;return urlGenerate(o)}return i}r.join=join;r.isAbsolute=function(e){return e.charAt(0)==="/"||n.test(e)};function relative(e,r){if(e===""){e="."}e=e.replace(/\/$/,"");var n=0;while(r.indexOf(e+"/")!==0){var t=e.lastIndexOf("/");if(t<0){return r}e=e.slice(0,t);if(e.match(/^([^\/]+:\/)?\/*$/)){return r}++n}return Array(n+1).join("../")+r.substr(e.length+1)}r.relative=relative;var o=function(){var e=Object.create(null);return!("__proto__"in e)}();function identity(e){return e}function toSetString(e){if(isProtoString(e)){return"$"+e}return e}r.toSetString=o?identity:toSetString;function fromSetString(e){if(isProtoString(e)){return e.slice(1)}return e}r.fromSetString=o?identity:fromSetString;function isProtoString(e){if(!e){return false}var r=e.length;if(r<9){return false}if(e.charCodeAt(r-1)!==95||e.charCodeAt(r-2)!==95||e.charCodeAt(r-3)!==111||e.charCodeAt(r-4)!==116||e.charCodeAt(r-5)!==111||e.charCodeAt(r-6)!==114||e.charCodeAt(r-7)!==112||e.charCodeAt(r-8)!==95||e.charCodeAt(r-9)!==95){return false}for(var n=r-10;n>=0;n--){if(e.charCodeAt(n)!==36){return false}}return true}function compareByOriginalPositions(e,r,n){var t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0||n){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0){return t}t=e.generatedLine-r.generatedLine;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositionsDeflated(e,r,n){var t=e.generatedLine-r.generatedLine;if(t!==0){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0||n){return t}t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsDeflated=compareByGeneratedPositionsDeflated;function strcmp(e,r){if(e===r){return 0}if(e===null){return 1}if(r===null){return-1}if(e>r){return 1}return-1}function compareByGeneratedPositionsInflated(e,r){var n=e.generatedLine-r.generatedLine;if(n!==0){return n}n=e.generatedColumn-r.generatedColumn;if(n!==0){return n}n=strcmp(e.source,r.source);if(n!==0){return n}n=e.originalLine-r.originalLine;if(n!==0){return n}n=e.originalColumn-r.originalColumn;if(n!==0){return n}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}r.parseSourceMapInput=parseSourceMapInput;function computeSourceURL(e,r,n){r=r||"";if(e){if(e[e.length-1]!=="/"&&r[0]!=="/"){e+="/"}r=e+r}if(n){var t=urlParse(n);if(!t){throw new Error("sourceMapURL could not be parsed")}if(t.path){var o=t.path.lastIndexOf("/");if(o>=0){t.path=t.path.substring(0,o+1)}}r=join(urlGenerate(t),r)}return normalize(r)}r.computeSourceURL=computeSourceURL},997:(e,r,n)=>{n(591).h;r.SourceMapConsumer=n(952).SourceMapConsumer;n(351)},284:(e,r,n)=>{e=n.nmd(e);var t=n(997).SourceMapConsumer;var o=n(17);var i;try{i=n(147);if(!i.existsSync||!i.readFileSync){i=null}}catch(e){}var a=n(650);function dynamicRequire(e,r){return e.require(r)}var u=false;var s=false;var l=false;var c="auto";var p={};var f={};var g=/^data:application\/json[^,]+base64,/;var h=[];var d=[];function isInBrowser(){if(c==="browser")return true;if(c==="node")return false;return typeof window!=="undefined"&&typeof XMLHttpRequest==="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function hasGlobalProcessEventEmitter(){return typeof process==="object"&&process!==null&&typeof process.on==="function"}function globalProcessVersion(){if(typeof process==="object"&&process!==null){return process.version}else{return""}}function globalProcessStderr(){if(typeof process==="object"&&process!==null){return process.stderr}}function globalProcessExit(e){if(typeof process==="object"&&process!==null&&typeof process.exit==="function"){return process.exit(e)}}function handlerExec(e){return function(r){for(var n=0;n"}var n=this.getLineNumber();if(n!=null){r+=":"+n;var t=this.getColumnNumber();if(t){r+=":"+t}}}var o="";var i=this.getFunctionName();var a=true;var u=this.isConstructor();var s=!(this.isToplevel()||u);if(s){var l=this.getTypeName();if(l==="[object Object]"){l="null"}var c=this.getMethodName();if(i){if(l&&i.indexOf(l)!=0){o+=l+"."}o+=i;if(c&&i.indexOf("."+c)!=i.length-c.length-1){o+=" [as "+c+"]"}}else{o+=l+"."+(c||"")}}else if(u){o+="new "+(i||"")}else if(i){o+=i}else{o+=r;a=false}if(a){o+=" ("+r+")"}return o}function cloneCallSite(e){var r={};Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(n){r[n]=/^(?:is|get)/.test(n)?function(){return e[n].call(e)}:e[n]}));r.toString=CallSiteToString;return r}function wrapCallSite(e,r){if(r===undefined){r={nextPosition:null,curPosition:null}}if(e.isNative()){r.curPosition=null;return e}var n=e.getFileName()||e.getScriptNameOrSourceURL();if(n){var t=e.getLineNumber();var o=e.getColumnNumber()-1;var i=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;var a=i.test(globalProcessVersion())?0:62;if(t===1&&o>a&&!isInBrowser()&&!e.isEval()){o-=a}var u=mapSourcePosition({source:n,line:t,column:o});r.curPosition=u;e=cloneCallSite(e);var s=e.getFunctionName;e.getFunctionName=function(){if(r.nextPosition==null){return s()}return r.nextPosition.name||s()};e.getFileName=function(){return u.source};e.getLineNumber=function(){return u.line};e.getColumnNumber=function(){return u.column+1};e.getScriptNameOrSourceURL=function(){return u.source};return e}var l=e.isEval()&&e.getEvalOrigin();if(l){l=mapEvalOrigin(l);e=cloneCallSite(e);e.getEvalOrigin=function(){return l};return e}return e}function prepareStackTrace(e,r){if(l){p={};f={}}var n=e.name||"Error";var t=e.message||"";var o=n+": "+t;var i={nextPosition:null,curPosition:null};var a=[];for(var u=r.length-1;u>=0;u--){a.push("\n at "+wrapCallSite(r[u],i));i.nextPosition=i.curPosition}i.curPosition=i.nextPosition=null;return o+a.reverse().join("")}function getErrorSource(e){var r=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(r){var n=r[1];var t=+r[2];var o=+r[3];var a=p[n];if(!a&&i&&i.existsSync(n)){try{a=i.readFileSync(n,"utf8")}catch(e){a=""}}if(a){var u=a.split(/(?:\r\n|\r|\n)/)[t-1];if(u){return n+":"+t+"\n"+u+"\n"+new Array(o).join(" ")+"^"}}}return null}function printErrorAndExit(e){var r=getErrorSource(e);var n=globalProcessStderr();if(n&&n._handle&&n._handle.setBlocking){n._handle.setBlocking(true)}if(r){console.error();console.error(r)}console.error(e.stack);globalProcessExit(1)}function shimEmitUncaughtException(){var e=process.emit;process.emit=function(r){if(r==="uncaughtException"){var n=arguments[1]&&arguments[1].stack;var t=this.listeners(r).length>0;if(n&&!t){return printErrorAndExit(arguments[1])}}return e.apply(this,arguments)}}var S=h.slice(0);var _=d.slice(0);r.wrapCallSite=wrapCallSite;r.getErrorSource=getErrorSource;r.mapSourcePosition=mapSourcePosition;r.retrieveSourceMap=v;r.install=function(r){r=r||{};if(r.environment){c=r.environment;if(["node","browser","auto"].indexOf(c)===-1){throw new Error("environment "+c+" was unknown. Available options are {auto, browser, node}")}}if(r.retrieveFile){if(r.overrideRetrieveFile){h.length=0}h.unshift(r.retrieveFile)}if(r.retrieveSourceMap){if(r.overrideRetrieveSourceMap){d.length=0}d.unshift(r.retrieveSourceMap)}if(r.hookRequire&&!isInBrowser()){var n=dynamicRequire(e,"module");var t=n.prototype._compile;if(!t.__sourceMapSupport){n.prototype._compile=function(e,r){p[r]=e;f[r]=undefined;return t.call(this,e,r)};n.prototype._compile.__sourceMapSupport=true}}if(!l){l="emptyCacheBetweenOperations"in r?r.emptyCacheBetweenOperations:false}if(!u){u=true;Error.prepareStackTrace=prepareStackTrace}if(!s){var o="handleUncaughtExceptions"in r?r.handleUncaughtExceptions:true;try{var i=dynamicRequire(e,"worker_threads");if(i.isMainThread===false){o=false}}catch(e){}if(o&&hasGlobalProcessEventEmitter()){s=true;shimEmitUncaughtException()}}};r.resetRetrieveHandlers=function(){h.length=0;d.length=0;h=S.slice(0);d=_.slice(0);v=handlerExec(d);m=handlerExec(h)}},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")}};var r={};function __webpack_require__(n){var t=r[n];if(t!==undefined){return t.exports}var o=r[n]={id:n,loaded:false,exports:{}};var i=true;try{e[n](o,o.exports,__webpack_require__);i=false}finally{if(i)delete r[n]}o.loaded=true;return o.exports}(()=>{__webpack_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __webpack_require__!=="undefined")__webpack_require__.ab=__dirname+"/";var n={};(()=>{__webpack_require__(284).install()})();module.exports=n})(); \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 5d9f17a0f..000000000 --- a/index.js +++ /dev/null @@ -1,40 +0,0 @@ -const core = require('@actions/core'); -const Diawi = require('./diawi.js'); - -async function run() { - try { - const parameters = { - token: core.getInput('token'), - path: core.getInput('file'), - password: core.getInput('password'), - callback_emails: core.getInput('recipients'), - wall_of_apps: core.getInput('wall_of_apps') === true ? 1 : 0, - installation_notifications: core.getInput('installation_notifications') === true ? 1 : 0, - find_by_udid: core.getInput('find_by_udid') === true ? 1 : 0, - comment: core.getInput('comment'), - }; - //console.log(`Parameters: ${parameters}`) - - const diawiCommand = new Diawi(parameters) - .on('complete', function (url, qrcode) { - console.log('url: ' + url); - console.log('qrcode: ' + qrcode); - core.setOutput('url', url); - core.setOutput('qrcode', qrcode); - }) - .on('error', function (error) { - console.error('Failed: ', error); - core.setFailed(error.message); - process.exit(1); - }); - - if (!core.getInput('dry-run')) { - diawiCommand.execute(); - } - } - catch (error) { - core.setFailed(error.message); - } -} - -run() \ No newline at end of file diff --git a/index.test.js b/index.test.js deleted file mode 100644 index 2b13d3e58..000000000 --- a/index.test.js +++ /dev/null @@ -1,10 +0,0 @@ -const process = require('process'); -const cp = require('child_process'); -const path = require('path'); - -// shows how the runner will run a javascript action with env / stdout protocol -test('test runs', () => { - process.env['DIAWI_TOKEN'] = ''; - const ip = path.join(__dirname, 'index.js'); - console.log(cp.execSync(`node ${ip}`).toString()); -}) diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000..b0ed2b36f --- /dev/null +++ b/jest.config.js @@ -0,0 +1,9 @@ +module.exports = { + clearMocks: true, + moduleFileExtensions: ['js', 'ts'], + testMatch: ['**/*.test.ts'], + transform: { + '^.+\\.ts$': 'ts-jest' + }, + verbose: true +} diff --git a/node_modules/.bin/acorn b/node_modules/.bin/acorn deleted file mode 120000 index cf7676038..000000000 --- a/node_modules/.bin/acorn +++ /dev/null @@ -1 +0,0 @@ -../acorn/bin/acorn \ No newline at end of file diff --git a/node_modules/.bin/browserslist b/node_modules/.bin/browserslist deleted file mode 120000 index 3cd991b25..000000000 --- a/node_modules/.bin/browserslist +++ /dev/null @@ -1 +0,0 @@ -../browserslist/cli.js \ No newline at end of file diff --git a/node_modules/.bin/eslint b/node_modules/.bin/eslint deleted file mode 120000 index 810e4bcb3..000000000 --- a/node_modules/.bin/eslint +++ /dev/null @@ -1 +0,0 @@ -../eslint/bin/eslint.js \ No newline at end of file diff --git a/node_modules/.bin/esparse b/node_modules/.bin/esparse deleted file mode 120000 index 7423b18b2..000000000 --- a/node_modules/.bin/esparse +++ /dev/null @@ -1 +0,0 @@ -../esprima/bin/esparse.js \ No newline at end of file diff --git a/node_modules/.bin/esvalidate b/node_modules/.bin/esvalidate deleted file mode 120000 index 16069effb..000000000 --- a/node_modules/.bin/esvalidate +++ /dev/null @@ -1 +0,0 @@ -../esprima/bin/esvalidate.js \ No newline at end of file diff --git a/node_modules/.bin/import-local-fixture b/node_modules/.bin/import-local-fixture deleted file mode 120000 index ff4b10482..000000000 --- a/node_modules/.bin/import-local-fixture +++ /dev/null @@ -1 +0,0 @@ -../import-local/fixtures/cli.js \ No newline at end of file diff --git a/node_modules/.bin/jest b/node_modules/.bin/jest deleted file mode 120000 index 61c186154..000000000 --- a/node_modules/.bin/jest +++ /dev/null @@ -1 +0,0 @@ -../jest/bin/jest.js \ No newline at end of file diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml deleted file mode 120000 index 9dbd010d4..000000000 --- a/node_modules/.bin/js-yaml +++ /dev/null @@ -1 +0,0 @@ -../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/node_modules/.bin/jsesc b/node_modules/.bin/jsesc deleted file mode 120000 index 7237604c3..000000000 --- a/node_modules/.bin/jsesc +++ /dev/null @@ -1 +0,0 @@ -../jsesc/bin/jsesc \ No newline at end of file diff --git a/node_modules/.bin/json5 b/node_modules/.bin/json5 deleted file mode 120000 index 217f37981..000000000 --- a/node_modules/.bin/json5 +++ /dev/null @@ -1 +0,0 @@ -../json5/lib/cli.js \ No newline at end of file diff --git a/node_modules/.bin/node-which b/node_modules/.bin/node-which deleted file mode 120000 index 6f8415ec5..000000000 --- a/node_modules/.bin/node-which +++ /dev/null @@ -1 +0,0 @@ -../which/bin/node-which \ No newline at end of file diff --git a/node_modules/.bin/parser b/node_modules/.bin/parser deleted file mode 120000 index ce7bf97ef..000000000 --- a/node_modules/.bin/parser +++ /dev/null @@ -1 +0,0 @@ -../@babel/parser/bin/babel-parser.js \ No newline at end of file diff --git a/node_modules/.bin/resolve b/node_modules/.bin/resolve deleted file mode 120000 index b6afda6c7..000000000 --- a/node_modules/.bin/resolve +++ /dev/null @@ -1 +0,0 @@ -../resolve/bin/resolve \ No newline at end of file diff --git a/node_modules/.bin/rimraf b/node_modules/.bin/rimraf deleted file mode 120000 index 4cd49a49d..000000000 --- a/node_modules/.bin/rimraf +++ /dev/null @@ -1 +0,0 @@ -../rimraf/bin.js \ No newline at end of file diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver deleted file mode 120000 index 5aaadf42c..000000000 --- a/node_modules/.bin/semver +++ /dev/null @@ -1 +0,0 @@ -../semver/bin/semver.js \ No newline at end of file diff --git a/node_modules/.bin/update-browserslist-db b/node_modules/.bin/update-browserslist-db deleted file mode 120000 index b11e16f3d..000000000 --- a/node_modules/.bin/update-browserslist-db +++ /dev/null @@ -1 +0,0 @@ -../update-browserslist-db/cli.js \ No newline at end of file diff --git a/node_modules/.bin/uuid b/node_modules/.bin/uuid deleted file mode 120000 index 588f70ecc..000000000 --- a/node_modules/.bin/uuid +++ /dev/null @@ -1 +0,0 @@ -../uuid/dist/bin/uuid \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json deleted file mode 100644 index f5238125d..000000000 --- a/node_modules/.package-lock.json +++ /dev/null @@ -1,4403 +0,0 @@ -{ - "name": "action-upload-diawi", - "version": "1.3.2", - "lockfileVersion": 3, - "requires": true, - "packages": { - "node_modules/@actions/core": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", - "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", - "dependencies": { - "@actions/http-client": "^2.0.1", - "uuid": "^8.3.2" - } - }, - "node_modules/@actions/http-client": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz", - "integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==", - "dependencies": { - "tunnel": "^0.0.6" - } - }, - "node_modules/@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", - "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", - "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", - "dev": true, - "dependencies": { - "@babel/highlight": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.21.7", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.7.tgz", - "integrity": "sha512-KYMqFYTaenzMK4yUtf4EW9wc4N9ef80FsbMtkwool5zpwl4YrT1SdWYSTRcT94KO4hannogdS+LxY7L+arP3gA==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.21.8", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.8.tgz", - "integrity": "sha512-YeM22Sondbo523Sz0+CirSPnbj9bG3P0CdHcBZdqUuaeOaYEFbOLoGU7lebvGP6P5J/WE9wOn7u7C4J9HvS1xQ==", - "dev": true, - "dependencies": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.5", - "@babel/helper-compilation-targets": "^7.21.5", - "@babel/helper-module-transforms": "^7.21.5", - "@babel/helpers": "^7.21.5", - "@babel/parser": "^7.21.8", - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.5", - "@babel/types": "^7.21.5", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.2", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/core/node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true - }, - "node_modules/@babel/generator": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.5.tgz", - "integrity": "sha512-SrKK/sRv8GesIW1bDagf9cCG38IOMYZusoe1dfg0D8aiUe3Amvoj1QtjTPAWcfrZFvIwlleLb0gxzQidL9w14w==", - "dev": true, - "dependencies": { - "@babel/types": "^7.21.5", - "@jridgewell/gen-mapping": "^0.3.2", - "@jridgewell/trace-mapping": "^0.3.17", - "jsesc": "^2.5.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.5.tgz", - "integrity": "sha512-1RkbFGUKex4lvsB9yhIfWltJM5cZKUftB2eNajaDv3dCMEp49iBG0K14uH8NnX9IPux2+mK7JGEOB0jn48/J6w==", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.21.5", - "@babel/helper-validator-option": "^7.21.0", - "browserslist": "^4.21.3", - "lru-cache": "^5.1.1", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.21.5.tgz", - "integrity": "sha512-IYl4gZ3ETsWocUWgsFZLM5i1BYx9SoemminVEXadgLBa9TdeorzgLKm8wWLA6J1N/kT3Kch8XIk1laNzYoHKvQ==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", - "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", - "dev": true, - "dependencies": { - "@babel/template": "^7.20.7", - "@babel/types": "^7.21.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz", - "integrity": "sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==", - "dev": true, - "dependencies": { - "@babel/types": "^7.21.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.5.tgz", - "integrity": "sha512-bI2Z9zBGY2q5yMHoBvJ2a9iX3ZOAzJPm7Q8Yz6YeoUjU/Cvhmi2G4QyTNyPBqqXSgTjUxRg3L0xV45HvkNWWBw==", - "dev": true, - "dependencies": { - "@babel/helper-environment-visitor": "^7.21.5", - "@babel/helper-module-imports": "^7.21.4", - "@babel/helper-simple-access": "^7.21.5", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.19.1", - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.5", - "@babel/types": "^7.21.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz", - "integrity": "sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.21.5.tgz", - "integrity": "sha512-ENPDAMC1wAjR0uaCUwliBdiSl1KBJAVnMTzXqi64c2MG8MPR6ii4qf7bSXDqSFbr4W6W028/rf5ivoHop5/mkg==", - "dev": true, - "dependencies": { - "@babel/types": "^7.21.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz", - "integrity": "sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", - "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.5.tgz", - "integrity": "sha512-BSY+JSlHxOmGsPTydUkPf1MdMQ3M81x5xGCOVgWM3G8XH77sJ292Y2oqcp0CbbgxhqBuI46iUz1tT7hqP7EfgA==", - "dev": true, - "dependencies": { - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.5", - "@babel/types": "^7.21.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/parser": { - "version": "7.21.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.8.tgz", - "integrity": "sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.21.4.tgz", - "integrity": "sha512-5hewiLct5OKyh6PLKEYaFclcqtIgCb6bmELouxjF6up5q3Sov7rOayW4RwhbaBL0dit8rA80GNfY+UuDp2mBbQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.21.4.tgz", - "integrity": "sha512-xz0D39NvhQn4t4RNsHmDnnsaQizIlUkdtYvLs8La1BlfjQ6JEwxkJGeqJMW2tAXx+q6H+WFuUTXNdYVpEya0YA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/template": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", - "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.5.tgz", - "integrity": "sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.5", - "@babel/helper-environment-visitor": "^7.21.5", - "@babel/helper-function-name": "^7.21.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.5", - "@babel/types": "^7.21.5", - "debug": "^4.1.0", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse/node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/types": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.5.tgz", - "integrity": "sha512-m4AfNvVF2mVC/F7fDEdH2El3HzUg9It/XsCxZiOTTA3m3qYfcSVSbTfM6Q9xG+hYDniZssYhlXKKUMD5m8tF4Q==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.21.5", - "@babel/helper-validator-identifier": "^7.19.1", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", - "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", - "dev": true, - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", - "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.5.2", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/js": { - "version": "8.41.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.41.0.tgz", - "integrity": "sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.8", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", - "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", - "dev": true, - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true - }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", - "dev": true, - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/console": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.5.0.tgz", - "integrity": "sha512-NEpkObxPwyw/XxZVLPmAGKE89IQRp4puc6IQRPru6JKd1M3fW9v1xM1AnzIJE65hbCkzQAdnL8P47e9hzhiYLQ==", - "dev": true, - "dependencies": { - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/core": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.5.0.tgz", - "integrity": "sha512-28UzQc7ulUrOQw1IsN/kv1QES3q2kkbl/wGslyhAclqZ/8cMdB5M68BffkIdSJgKBUt50d3hbwJ92XESlE7LiQ==", - "dev": true, - "dependencies": { - "@jest/console": "^29.5.0", - "@jest/reporters": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.5.0", - "jest-config": "^29.5.0", - "jest-haste-map": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-regex-util": "^29.4.3", - "jest-resolve": "^29.5.0", - "jest-resolve-dependencies": "^29.5.0", - "jest-runner": "^29.5.0", - "jest-runtime": "^29.5.0", - "jest-snapshot": "^29.5.0", - "jest-util": "^29.5.0", - "jest-validate": "^29.5.0", - "jest-watcher": "^29.5.0", - "micromatch": "^4.0.4", - "pretty-format": "^29.5.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/@jest/environment": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.5.0.tgz", - "integrity": "sha512-5FXw2+wD29YU1d4I2htpRX7jYnAyTRjP2CsXQdo9SAM8g3ifxWPSV0HnClSn71xwctr0U3oZIIH+dtbfmnbXVQ==", - "dev": true, - "dependencies": { - "@jest/fake-timers": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "jest-mock": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/expect": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.5.0.tgz", - "integrity": "sha512-PueDR2HGihN3ciUNGr4uelropW7rqUfTiOn+8u0leg/42UhblPxHkfoh0Ruu3I9Y1962P3u2DY4+h7GVTSVU6g==", - "dev": true, - "dependencies": { - "expect": "^29.5.0", - "jest-snapshot": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/expect-utils": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.5.0.tgz", - "integrity": "sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg==", - "dev": true, - "dependencies": { - "jest-get-type": "^29.4.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/fake-timers": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.5.0.tgz", - "integrity": "sha512-9ARvuAAQcBwDAqOnglWq2zwNIRUDtk/SCkp/ToGEhFv5r86K21l+VEs0qNTaXtyiY0lEePl3kylijSYJQqdbDg==", - "dev": true, - "dependencies": { - "@jest/types": "^29.5.0", - "@sinonjs/fake-timers": "^10.0.2", - "@types/node": "*", - "jest-message-util": "^29.5.0", - "jest-mock": "^29.5.0", - "jest-util": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/globals": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.5.0.tgz", - "integrity": "sha512-S02y0qMWGihdzNbUiqSAiKSpSozSuHX5UYc7QbnHP+D9Lyw8DgGGCinrN9uSuHPeKgSSzvPom2q1nAtBvUsvPQ==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.5.0", - "@jest/expect": "^29.5.0", - "@jest/types": "^29.5.0", - "jest-mock": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/reporters": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.5.0.tgz", - "integrity": "sha512-D05STXqj/M8bP9hQNSICtPqz97u7ffGzZu+9XLucXhkOFBqKcXe04JLZOgIekOxdb73MAoBUFnqvf7MCpKk5OA==", - "dev": true, - "dependencies": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@jridgewell/trace-mapping": "^0.3.15", - "@types/node": "*", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0", - "jest-worker": "^29.5.0", - "slash": "^3.0.0", - "string-length": "^4.0.1", - "strip-ansi": "^6.0.0", - "v8-to-istanbul": "^9.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/@jest/schemas": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.3.tgz", - "integrity": "sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==", - "dev": true, - "dependencies": { - "@sinclair/typebox": "^0.25.16" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/source-map": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.4.3.tgz", - "integrity": "sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.15", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/test-result": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.5.0.tgz", - "integrity": "sha512-fGl4rfitnbfLsrfx1uUpDEESS7zM8JdgZgOCQuxQvL1Sn/I6ijeAVQWGfXI9zb1i9Mzo495cIpVZhA0yr60PkQ==", - "dev": true, - "dependencies": { - "@jest/console": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/test-sequencer": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz", - "integrity": "sha512-yPafQEcKjkSfDXyvtgiV4pevSeyuA6MQr6ZIdVkWJly9vkqjnFfcfhRQqpD5whjoU8EORki752xQmjaqoFjzMQ==", - "dev": true, - "dependencies": { - "@jest/test-result": "^29.5.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/transform": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.5.0.tgz", - "integrity": "sha512-8vbeZWqLJOvHaDfeMuoHITGKSz5qWc9u04lnWrQE3VyuSw604PzQM824ZeX9XSjUCeDiE3GuxZe5UKa8J61NQw==", - "dev": true, - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/types": "^29.5.0", - "@jridgewell/trace-mapping": "^0.3.15", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", - "convert-source-map": "^2.0.0", - "fast-json-stable-stringify": "^2.1.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "jest-regex-util": "^29.4.3", - "jest-util": "^29.5.0", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", - "slash": "^3.0.0", - "write-file-atomic": "^4.0.2" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/types": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz", - "integrity": "sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==", - "dev": true, - "dependencies": { - "@jest/schemas": "^29.4.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", - "dev": true, - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - }, - "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@sinclair/typebox": { - "version": "0.25.24", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", - "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==", - "dev": true - }, - "node_modules/@sinonjs/commons": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", - "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", - "dev": true, - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@sinonjs/fake-timers": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.1.0.tgz", - "integrity": "sha512-w1qd368vtrwttm1PRJWPW1QHlbmHrVDGs1eBH/jZvRPUFS4MNXV9Q33EQdjOdeAxZ7O8+3wM7zxztm2nfUSyKw==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^3.0.0" - } - }, - "node_modules/@types/babel__core": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", - "integrity": "sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", - "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", - "dev": true, - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", - "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.18.5", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.5.tgz", - "integrity": "sha512-enCvTL8m/EHS/zIvJno9nE+ndYPh1/oNFzRYRmtUqJICG2VnCSBzMLW5VN2KCQU91f23tsNKR8v7VJJQMatl7Q==", - "dev": true, - "dependencies": { - "@babel/types": "^7.3.0" - } - }, - "node_modules/@types/graceful-fs": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", - "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", - "dev": true - }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-coverage": "*" - } - }, - "node_modules/@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", - "dev": true, - "dependencies": { - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/@types/node": { - "version": "20.1.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.7.tgz", - "integrity": "sha512-WCuw/o4GSwDGMoonES8rcvwsig77dGCMbZDrZr2x4ZZiNW4P/gcoZXe/0twgtobcTkmg9TuKflxYL/DuwDyJzg==", - "dev": true - }, - "node_modules/@types/prettier": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", - "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", - "dev": true - }, - "node_modules/@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", - "dev": true - }, - "node_modules/@types/yargs": { - "version": "17.0.24", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", - "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", - "dev": true, - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@types/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", - "dev": true - }, - "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-escapes/node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/axios": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", - "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/babel-jest": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.5.0.tgz", - "integrity": "sha512-mA4eCDh5mSo2EcA9xQjVTpmbbNk32Zb3Q3QFQsNhaK56Q+yoXowzFodLux30HRgyOho5rsQ6B0P9QpMkvvnJ0Q==", - "dev": true, - "dependencies": { - "@jest/transform": "^29.5.0", - "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.5.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.8.0" - } - }, - "node_modules/babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-jest-hoist": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz", - "integrity": "sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w==", - "dev": true, - "dependencies": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.1.14", - "@types/babel__traverse": "^7.0.6" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/babel-preset-current-node-syntax": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", - "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", - "dev": true, - "dependencies": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/babel-preset-jest": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz", - "integrity": "sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg==", - "dev": true, - "dependencies": { - "babel-plugin-jest-hoist": "^29.5.0", - "babel-preset-current-node-syntax": "^1.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browserslist": { - "version": "4.21.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", - "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - } - ], - "dependencies": { - "caniuse-lite": "^1.0.30001449", - "electron-to-chromium": "^1.4.284", - "node-releases": "^2.0.8", - "update-browserslist-db": "^1.0.10" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "dependencies": { - "node-int64": "^0.4.0" - } - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001488", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001488.tgz", - "integrity": "sha512-NORIQuuL4xGpIy6iCCQGN4iFjlBXtfKWIenlUuyZJumLRIindLb7wXM+GO8erEhb7vXfcnf4BAg2PrSDN5TNLQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ] - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/char-regex": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", - "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/ci-info": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", - "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "engines": { - "node": ">=8" - } - }, - "node_modules/cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", - "dev": true - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", - "dev": true, - "engines": { - "iojs": ">= 1.0.0", - "node": ">= 0.12.0" - } - }, - "node_modules/collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", - "dev": true - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", - "dev": true - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/diff-sequences": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", - "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.4.397", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.397.tgz", - "integrity": "sha512-jwnPxhh350Q/aMatQia31KAIQdhEsYS0fFZ0BQQlN9tfvOEwShu6ZNwI4kL/xBabjcB/nTy6lSt17kNIluJZ8Q==", - "dev": true - }, - "node_modules/emittery": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", - "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sindresorhus/emittery?sponsor=1" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "8.41.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.41.0.tgz", - "integrity": "sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.3", - "@eslint/js": "8.41.0", - "@humanwhocodes/config-array": "^0.11.8", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.0", - "eslint-visitor-keys": "^3.4.1", - "espree": "^9.5.2", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-scope": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", - "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", - "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/espree": { - "version": "9.5.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", - "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", - "dev": true, - "dependencies": { - "acorn": "^8.8.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/expect": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.5.0.tgz", - "integrity": "sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg==", - "dev": true, - "dependencies": { - "@jest/expect-utils": "^29.5.0", - "jest-get-type": "^29.4.3", - "jest-matcher-utils": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fb-watchman": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", - "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", - "dev": true, - "dependencies": { - "bser": "2.1.1" - } - }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true - }, - "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/fs": { - "version": "0.0.1-security", - "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", - "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-local": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", - "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", - "dev": true, - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true - }, - "node_modules/is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-instrument": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", - "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", - "dev": true, - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", - "dev": true, - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", - "dev": true, - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.5.0.tgz", - "integrity": "sha512-juMg3he2uru1QoXX078zTa7pO85QyB9xajZc6bU+d9yEGwrKX6+vGmJQ3UdVZsvTEUARIdObzH68QItim6OSSQ==", - "dev": true, - "dependencies": { - "@jest/core": "^29.5.0", - "@jest/types": "^29.5.0", - "import-local": "^3.0.2", - "jest-cli": "^29.5.0" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-changed-files": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.5.0.tgz", - "integrity": "sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag==", - "dev": true, - "dependencies": { - "execa": "^5.0.0", - "p-limit": "^3.1.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-circus": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.5.0.tgz", - "integrity": "sha512-gq/ongqeQKAplVxqJmbeUOJJKkW3dDNPY8PjhJ5G0lBRvu0e3EWGxGy5cI4LAGA7gV2UHCtWBI4EMXK8c9nQKA==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.5.0", - "@jest/expect": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "dedent": "^0.7.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^29.5.0", - "jest-matcher-utils": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-runtime": "^29.5.0", - "jest-snapshot": "^29.5.0", - "jest-util": "^29.5.0", - "p-limit": "^3.1.0", - "pretty-format": "^29.5.0", - "pure-rand": "^6.0.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-cli": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.5.0.tgz", - "integrity": "sha512-L1KcP1l4HtfwdxXNFCL5bmUbLQiKrakMUriBEcc1Vfz6gx31ORKdreuWvmQVBit+1ss9NNR3yxjwfwzZNdQXJw==", - "dev": true, - "dependencies": { - "@jest/core": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/types": "^29.5.0", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "import-local": "^3.0.2", - "jest-config": "^29.5.0", - "jest-util": "^29.5.0", - "jest-validate": "^29.5.0", - "prompts": "^2.0.1", - "yargs": "^17.3.1" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-config": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.5.0.tgz", - "integrity": "sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA==", - "dev": true, - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.5.0", - "@jest/types": "^29.5.0", - "babel-jest": "^29.5.0", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.5.0", - "jest-environment-node": "^29.5.0", - "jest-get-type": "^29.4.3", - "jest-regex-util": "^29.4.3", - "jest-resolve": "^29.5.0", - "jest-runner": "^29.5.0", - "jest-util": "^29.5.0", - "jest-validate": "^29.5.0", - "micromatch": "^4.0.4", - "parse-json": "^5.2.0", - "pretty-format": "^29.5.0", - "slash": "^3.0.0", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@types/node": "*", - "ts-node": ">=9.0.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "ts-node": { - "optional": true - } - } - }, - "node_modules/jest-diff": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.5.0.tgz", - "integrity": "sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==", - "dev": true, - "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^29.4.3", - "jest-get-type": "^29.4.3", - "pretty-format": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-docblock": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.4.3.tgz", - "integrity": "sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg==", - "dev": true, - "dependencies": { - "detect-newline": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-each": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.5.0.tgz", - "integrity": "sha512-HM5kIJ1BTnVt+DQZ2ALp3rzXEl+g726csObrW/jpEGl+CDSSQpOJJX2KE/vEg8cxcMXdyEPu6U4QX5eruQv5hA==", - "dev": true, - "dependencies": { - "@jest/types": "^29.5.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.4.3", - "jest-util": "^29.5.0", - "pretty-format": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-environment-node": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.5.0.tgz", - "integrity": "sha512-ExxuIK/+yQ+6PRGaHkKewYtg6hto2uGCgvKdb2nfJfKXgZ17DfXjvbZ+jA1Qt9A8EQSfPnt5FKIfnOO3u1h9qw==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.5.0", - "@jest/fake-timers": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "jest-mock": "^29.5.0", - "jest-util": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-get-type": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", - "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-haste-map": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.5.0.tgz", - "integrity": "sha512-IspOPnnBro8YfVYSw6yDRKh/TiCdRngjxeacCps1cQ9cgVN6+10JUcuJ1EabrgYLOATsIAigxA0rLR9x/YlrSA==", - "dev": true, - "dependencies": { - "@jest/types": "^29.5.0", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.4.3", - "jest-util": "^29.5.0", - "jest-worker": "^29.5.0", - "micromatch": "^4.0.4", - "walker": "^1.0.8" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "optionalDependencies": { - "fsevents": "^2.3.2" - } - }, - "node_modules/jest-leak-detector": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz", - "integrity": "sha512-u9YdeeVnghBUtpN5mVxjID7KbkKE1QU4f6uUwuxiY0vYRi9BUCLKlPEZfDGR67ofdFmDz9oPAy2G92Ujrntmow==", - "dev": true, - "dependencies": { - "jest-get-type": "^29.4.3", - "pretty-format": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-matcher-utils": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz", - "integrity": "sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw==", - "dev": true, - "dependencies": { - "chalk": "^4.0.0", - "jest-diff": "^29.5.0", - "jest-get-type": "^29.4.3", - "pretty-format": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-message-util": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.5.0.tgz", - "integrity": "sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.5.0", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^29.5.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-mock": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.5.0.tgz", - "integrity": "sha512-GqOzvdWDE4fAV2bWQLQCkujxYWL7RxjCnj71b5VhDAGOevB3qj3Ovg26A5NI84ZpODxyzaozXLOh2NCgkbvyaw==", - "dev": true, - "dependencies": { - "@jest/types": "^29.5.0", - "@types/node": "*", - "jest-util": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-pnp-resolver": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", - "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", - "dev": true, - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "jest-resolve": "*" - }, - "peerDependenciesMeta": { - "jest-resolve": { - "optional": true - } - } - }, - "node_modules/jest-regex-util": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.4.3.tgz", - "integrity": "sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-resolve": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.5.0.tgz", - "integrity": "sha512-1TzxJ37FQq7J10jPtQjcc+MkCkE3GBpBecsSUWJ0qZNJpmg6m0D9/7II03yJulm3H/fvVjgqLh/k2eYg+ui52w==", - "dev": true, - "dependencies": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.5.0", - "jest-validate": "^29.5.0", - "resolve": "^1.20.0", - "resolve.exports": "^2.0.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-resolve-dependencies": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.5.0.tgz", - "integrity": "sha512-sjV3GFr0hDJMBpYeUuGduP+YeCRbd7S/ck6IvL3kQ9cpySYKqcqhdLLC2rFwrcL7tz5vYibomBrsFYWkIGGjOg==", - "dev": true, - "dependencies": { - "jest-regex-util": "^29.4.3", - "jest-snapshot": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runner": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.5.0.tgz", - "integrity": "sha512-m7b6ypERhFghJsslMLhydaXBiLf7+jXy8FwGRHO3BGV1mcQpPbwiqiKUR2zU2NJuNeMenJmlFZCsIqzJCTeGLQ==", - "dev": true, - "dependencies": { - "@jest/console": "^29.5.0", - "@jest/environment": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.4.3", - "jest-environment-node": "^29.5.0", - "jest-haste-map": "^29.5.0", - "jest-leak-detector": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-resolve": "^29.5.0", - "jest-runtime": "^29.5.0", - "jest-util": "^29.5.0", - "jest-watcher": "^29.5.0", - "jest-worker": "^29.5.0", - "p-limit": "^3.1.0", - "source-map-support": "0.5.13" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runtime": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.5.0.tgz", - "integrity": "sha512-1Hr6Hh7bAgXQP+pln3homOiEZtCDZFqwmle7Ew2j8OlbkIu6uE3Y/etJQG8MLQs3Zy90xrp2C0BRrtPHG4zryw==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.5.0", - "@jest/fake-timers": "^29.5.0", - "@jest/globals": "^29.5.0", - "@jest/source-map": "^29.4.3", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "cjs-module-lexer": "^1.0.0", - "collect-v8-coverage": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-mock": "^29.5.0", - "jest-regex-util": "^29.4.3", - "jest-resolve": "^29.5.0", - "jest-snapshot": "^29.5.0", - "jest-util": "^29.5.0", - "slash": "^3.0.0", - "strip-bom": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-snapshot": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.5.0.tgz", - "integrity": "sha512-x7Wolra5V0tt3wRs3/ts3S6ciSQVypgGQlJpz2rsdQYoUKxMxPNaoHMGJN6qAuPJqS+2iQ1ZUn5kl7HCyls84g==", - "dev": true, - "dependencies": { - "@babel/core": "^7.11.6", - "@babel/generator": "^7.7.2", - "@babel/plugin-syntax-jsx": "^7.7.2", - "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", - "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", - "babel-preset-current-node-syntax": "^1.0.0", - "chalk": "^4.0.0", - "expect": "^29.5.0", - "graceful-fs": "^4.2.9", - "jest-diff": "^29.5.0", - "jest-get-type": "^29.4.3", - "jest-matcher-utils": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0", - "natural-compare": "^1.4.0", - "pretty-format": "^29.5.0", - "semver": "^7.3.5" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-snapshot/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", - "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jest-snapshot/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/jest-util": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.5.0.tgz", - "integrity": "sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ==", - "dev": true, - "dependencies": { - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-validate": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.5.0.tgz", - "integrity": "sha512-pC26etNIi+y3HV8A+tUGr/lph9B18GnzSRAkPaaZJIE1eFdiYm6/CewuiJQ8/RlfHd1u/8Ioi8/sJ+CmbA+zAQ==", - "dev": true, - "dependencies": { - "@jest/types": "^29.5.0", - "camelcase": "^6.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.4.3", - "leven": "^3.1.0", - "pretty-format": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-validate/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/jest-watcher": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.5.0.tgz", - "integrity": "sha512-KmTojKcapuqYrKDpRwfqcQ3zjMlwu27SYext9pt4GlF5FUgB+7XE1mcCnSm6a4uUpFyQIkb6ZhzZvHl+jiBCiA==", - "dev": true, - "dependencies": { - "@jest/test-result": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "jest-util": "^29.5.0", - "string-length": "^4.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-worker": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", - "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", - "dev": true, - "dependencies": { - "@types/node": "*", - "jest-util": "^29.5.0", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/makeerror": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", - "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", - "dev": true, - "dependencies": { - "tmpl": "1.0.5" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node_modules/node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "dev": true - }, - "node_modules/node-releases": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", - "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", - "dev": true - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path": { - "version": "0.12.7", - "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", - "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", - "dependencies": { - "process": "^0.11.1", - "util": "^0.10.3" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/pkg-dir/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/pretty-format": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.5.0.tgz", - "integrity": "sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==", - "dev": true, - "dependencies": { - "@jest/schemas": "^29.4.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "dev": true, - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, - "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/pure-rand": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", - "integrity": "sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/dubzzz" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" - } - ] - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", - "dev": true, - "dependencies": { - "is-core-module": "^2.11.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "dependencies": { - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-cwd/node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/resolve.exports": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", - "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "node_modules/sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", - "dev": true - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", - "dev": true, - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, - "node_modules/stack-utils": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", - "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/stack-utils/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-length": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", - "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", - "dev": true, - "dependencies": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "node_modules/tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", - "dev": true - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/util": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", - "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", - "dependencies": { - "inherits": "2.0.3" - } - }, - "node_modules/util/node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/v8-to-istanbul": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", - "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/v8-to-istanbul/node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true - }, - "node_modules/walker": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", - "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", - "dev": true, - "dependencies": { - "makeerror": "1.0.12" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", - "dev": true, - "dependencies": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/node_modules/@actions/core/LICENSE.md b/node_modules/@actions/core/LICENSE.md deleted file mode 100644 index dbae2edb2..000000000 --- a/node_modules/@actions/core/LICENSE.md +++ /dev/null @@ -1,9 +0,0 @@ -The MIT License (MIT) - -Copyright 2019 GitHub - -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/@actions/core/README.md b/node_modules/@actions/core/README.md deleted file mode 100644 index 3c20c8ea5..000000000 --- a/node_modules/@actions/core/README.md +++ /dev/null @@ -1,335 +0,0 @@ -# `@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` which returns a `string` or `getBooleanInput` which parses a boolean based on the [yaml 1.2 specification](https://yaml.org/spec/1.2/spec.html#id2804923). If `required` set to be false, the input should have a default value in `action.yml`. - -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 }); -const myBooleanInput = core.getBooleanInput('booleanInputName', { required: true }); -const myMultilineInput = core.getMultilineInput('multilineInputName', { 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 - core.info('Output to the actions build log') - - core.notice('This is a message that will also emit an annotation') -} -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 -}) -``` - -#### Annotations - -This library has 3 methods that will produce [annotations](https://docs.github.com/en/rest/reference/checks#create-a-check-run). -```js -core.error('This is a bad error. This will also fail the build.') - -core.warning('Something went wrong, but it\'s not bad enough to fail the build.') - -core.notice('Something happened that you might want to know about.') -``` - -These will surface to the UI in the Actions page and on Pull Requests. They look something like this: - -![Annotations Image](../../docs/assets/annotations.png) - -These annotations can also be attached to particular lines and columns of your source files to show exactly where a problem is occuring. - -These options are: -```typescript -export interface AnnotationProperties { - /** - * A title for the annotation. - */ - title?: string - - /** - * The name of the file for which the annotation should be created. - */ - file?: string - - /** - * The start line for the annotation. - */ - startLine?: number - - /** - * The end line for the annotation. Defaults to `startLine` when `startLine` is provided. - */ - endLine?: number - - /** - * The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values. - */ - startColumn?: number - - /** - * The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values. - * Defaults to `startColumn` when `startColumn` is provided. - */ - endColumn?: number -} -``` - -#### Styling output - -Colored output is supported in the Action logs via standard [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code). 3/4 bit, 8 bit and 24 bit colors are all supported. - -Foreground colors: - -```js -// 3/4 bit -core.info('\u001b[35mThis foreground will be magenta') - -// 8 bit -core.info('\u001b[38;5;6mThis foreground will be cyan') - -// 24 bit -core.info('\u001b[38;2;255;0;0mThis foreground will be bright red') -``` - -Background colors: - -```js -// 3/4 bit -core.info('\u001b[43mThis background will be yellow'); - -// 8 bit -core.info('\u001b[48;5;6mThis background will be cyan') - -// 24 bit -core.info('\u001b[48;2;255;0;0mThis background will be bright red') -``` - -Special styles: - -```js -core.info('\u001b[1mBold text') -core.info('\u001b[3mItalic text') -core.info('\u001b[4mUnderlined text') -``` - -ANSI escape codes can be combined with one another: - -```js -core.info('\u001b[31;46mRed foreground with a cyan background and \u001b[1mbold text at the end'); -``` - -> Note: Escape codes reset at the start of each line - -```js -core.info('\u001b[35mThis foreground will be magenta') -core.info('This foreground will reset to the default') -``` - -Manually typing escape codes can be a little difficult, but you can use third party modules such as [ansi-styles](https://github.com/chalk/ansi-styles). - -```js -const style = require('ansi-styles'); -core.info(style.color.ansi16m.hex('#abcdef') + 'Hello world!') -``` - -#### 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); -``` - -#### OIDC Token - -You can use these methods to interact with the GitHub OIDC provider and get a JWT ID token which would help to get access token from third party cloud providers. - -**Method Name**: getIDToken() - -**Inputs** - -audience : optional - -**Outputs** - -A [JWT](https://jwt.io/) ID Token - -In action's `main.ts`: -```js -const core = require('@actions/core'); -async function getIDTokenAction(): Promise { - - const audience = core.getInput('audience', {required: false}) - - const id_token1 = await core.getIDToken() // ID Token with default audience - const id_token2 = await core.getIDToken(audience) // ID token with custom audience - - // this id_token can be used to get access token from third party cloud providers -} -getIDTokenAction() -``` - -In action's `actions.yml`: - -```yaml -name: 'GetIDToken' -description: 'Get ID token from Github OIDC provider' -inputs: - audience: - description: 'Audience for which the ID token is intended for' - required: false -outputs: - id_token1: - description: 'ID token obtained from OIDC provider' - id_token2: - description: 'ID token obtained from OIDC provider' -runs: - using: 'node12' - main: 'dist/index.js' -``` - -#### Filesystem path helpers - -You can use these methods to manipulate file paths across operating systems. - -The `toPosixPath` function converts input paths to Posix-style (Linux) paths. -The `toWin32Path` function converts input paths to Windows-style paths. These -functions work independently of the underlying runner operating system. - -```js -toPosixPath('\\foo\\bar') // => /foo/bar -toWin32Path('/foo/bar') // => \foo\bar -``` - -The `toPlatformPath` function converts input paths to the expected value on the runner's operating system. - -```js -// On a Windows runner. -toPlatformPath('/foo/bar') // => \foo\bar - -// On a Linux runner. -toPlatformPath('\\foo\\bar') // => /foo/bar -``` diff --git a/node_modules/@actions/core/lib/command.d.ts b/node_modules/@actions/core/lib/command.d.ts deleted file mode 100644 index 53f8f4b8d..000000000 --- a/node_modules/@actions/core/lib/command.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export interface CommandProperties { - [key: string]: any; -} -/** - * 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: any): void; -export declare function issue(name: string, message?: string): void; diff --git a/node_modules/@actions/core/lib/command.js b/node_modules/@actions/core/lib/command.js deleted file mode 100644 index 0b28c66b8..000000000 --- a/node_modules/@actions/core/lib/command.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.issue = exports.issueCommand = void 0; -const os = __importStar(require("os")); -const utils_1 = require("./utils"); -/** - * 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 utils_1.toCommandValue(s) - .replace(/%/g, '%25') - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A'); -} -function escapeProperty(s) { - return utils_1.toCommandValue(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 deleted file mode 100644 index 51c7c6375..000000000 --- a/node_modules/@actions/core/lib/command.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;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AAE;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,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,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,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,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 deleted file mode 100644 index 1defb5722..000000000 --- a/node_modules/@actions/core/lib/core.d.ts +++ /dev/null @@ -1,198 +0,0 @@ -/** - * 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; - /** Optional. Whether leading/trailing whitespace will be trimmed for the input. Defaults to true */ - trimWhitespace?: 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 -} -/** - * Optional properties that can be sent with annotatation commands (notice, error, and warning) - * See: https://docs.github.com/en/rest/reference/checks#create-a-check-run for more information about annotations. - */ -export interface AnnotationProperties { - /** - * A title for the annotation. - */ - title?: string; - /** - * The path of the file for which the annotation should be created. - */ - file?: string; - /** - * The start line for the annotation. - */ - startLine?: number; - /** - * The end line for the annotation. Defaults to `startLine` when `startLine` is provided. - */ - endLine?: number; - /** - * The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values. - */ - startColumn?: number; - /** - * The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values. - * Defaults to `startColumn` when `startColumn` is provided. - */ - endColumn?: number; -} -/** - * 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. Non-string values will be converted to a string via JSON.stringify - */ -export declare function exportVariable(name: string, val: any): 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. - * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. - * Returns an empty string if the value is not defined. - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns string - */ -export declare function getInput(name: string, options?: InputOptions): string; -/** - * Gets the values of an multiline input. Each value is also trimmed. - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns string[] - * - */ -export declare function getMultilineInput(name: string, options?: InputOptions): string[]; -/** - * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. - * Support boolean input list: `true | True | TRUE | false | False | FALSE` . - * The return value is also in boolean type. - * ref: https://yaml.org/spec/1.2/spec.html#id2804923 - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns boolean - */ -export declare function getBooleanInput(name: string, options?: InputOptions): boolean; -/** - * Sets the value of an output. - * - * @param name name of the output to set - * @param value value to store. Non-string values will be converted to a string via JSON.stringify - */ -export declare function setOutput(name: string, value: any): void; -/** - * Enables or disables the echoing of commands into stdout for the rest of the step. - * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. - * - */ -export declare function setCommandEcho(enabled: boolean): 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 | Error): 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. Errors will be converted to string via toString() - * @param properties optional properties to add to the annotation. - */ -export declare function error(message: string | Error, properties?: AnnotationProperties): void; -/** - * Adds a warning issue - * @param message warning issue message. Errors will be converted to string via toString() - * @param properties optional properties to add to the annotation. - */ -export declare function warning(message: string | Error, properties?: AnnotationProperties): void; -/** - * Adds a notice issue - * @param message notice issue message. Errors will be converted to string via toString() - * @param properties optional properties to add to the annotation. - */ -export declare function notice(message: string | Error, properties?: AnnotationProperties): 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. Non-string values will be converted to a string via JSON.stringify - */ -export declare function saveState(name: string, value: any): 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; -export declare function getIDToken(aud?: string): Promise; -/** - * Summary exports - */ -export { summary } from './summary'; -/** - * @deprecated use core.summary - */ -export { markdownSummary } from './summary'; -/** - * Path exports - */ -export { toPosixPath, toWin32Path, toPlatformPath } from './path-utils'; diff --git a/node_modules/@actions/core/lib/core.js b/node_modules/@actions/core/lib/core.js deleted file mode 100644 index 48df6ad09..000000000 --- a/node_modules/@actions/core/lib/core.js +++ /dev/null @@ -1,336 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -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()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = require("./command"); -const file_command_1 = require("./file-command"); -const utils_1 = require("./utils"); -const os = __importStar(require("os")); -const path = __importStar(require("path")); -const oidc_utils_1 = require("./oidc-utils"); -/** - * 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. Non-string values will be converted to a string via JSON.stringify - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function exportVariable(name, val) { - const convertedVal = utils_1.toCommandValue(val); - process.env[name] = convertedVal; - const filePath = process.env['GITHUB_ENV'] || ''; - if (filePath) { - return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val)); - } - command_1.issueCommand('set-env', { name }, convertedVal); -} -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) { - const filePath = process.env['GITHUB_PATH'] || ''; - if (filePath) { - file_command_1.issueFileCommand('PATH', inputPath); - } - else { - command_1.issueCommand('add-path', {}, inputPath); - } - process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; -} -exports.addPath = addPath; -/** - * Gets the value of an input. - * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. - * Returns an empty string if the value is not defined. - * - * @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}`); - } - if (options && options.trimWhitespace === false) { - return val; - } - return val.trim(); -} -exports.getInput = getInput; -/** - * Gets the values of an multiline input. Each value is also trimmed. - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns string[] - * - */ -function getMultilineInput(name, options) { - const inputs = getInput(name, options) - .split('\n') - .filter(x => x !== ''); - if (options && options.trimWhitespace === false) { - return inputs; - } - return inputs.map(input => input.trim()); -} -exports.getMultilineInput = getMultilineInput; -/** - * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. - * Support boolean input list: `true | True | TRUE | false | False | FALSE` . - * The return value is also in boolean type. - * ref: https://yaml.org/spec/1.2/spec.html#id2804923 - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns boolean - */ -function getBooleanInput(name, options) { - const trueValue = ['true', 'True', 'TRUE']; - const falseValue = ['false', 'False', 'FALSE']; - const val = getInput(name, options); - if (trueValue.includes(val)) - return true; - if (falseValue.includes(val)) - return false; - throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + - `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); -} -exports.getBooleanInput = getBooleanInput; -/** - * Sets the value of an output. - * - * @param name name of the output to set - * @param value value to store. Non-string values will be converted to a string via JSON.stringify - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function setOutput(name, value) { - const filePath = process.env['GITHUB_OUTPUT'] || ''; - if (filePath) { - return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value)); - } - process.stdout.write(os.EOL); - command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value)); -} -exports.setOutput = setOutput; -/** - * Enables or disables the echoing of commands into stdout for the rest of the step. - * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. - * - */ -function setCommandEcho(enabled) { - command_1.issue('echo', enabled ? 'on' : 'off'); -} -exports.setCommandEcho = setCommandEcho; -//----------------------------------------------------------------------- -// 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. Errors will be converted to string via toString() - * @param properties optional properties to add to the annotation. - */ -function error(message, properties = {}) { - command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); -} -exports.error = error; -/** - * Adds a warning issue - * @param message warning issue message. Errors will be converted to string via toString() - * @param properties optional properties to add to the annotation. - */ -function warning(message, properties = {}) { - command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); -} -exports.warning = warning; -/** - * Adds a notice issue - * @param message notice issue message. Errors will be converted to string via toString() - * @param properties optional properties to add to the annotation. - */ -function notice(message, properties = {}) { - command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); -} -exports.notice = notice; -/** - * 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. Non-string values will be converted to a string via JSON.stringify - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function saveState(name, value) { - const filePath = process.env['GITHUB_STATE'] || ''; - if (filePath) { - return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value)); - } - command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(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; -function getIDToken(aud) { - return __awaiter(this, void 0, void 0, function* () { - return yield oidc_utils_1.OidcClient.getIDToken(aud); - }); -} -exports.getIDToken = getIDToken; -/** - * Summary exports - */ -var summary_1 = require("./summary"); -Object.defineProperty(exports, "summary", { enumerable: true, get: function () { return summary_1.summary; } }); -/** - * @deprecated use core.summary - */ -var summary_2 = require("./summary"); -Object.defineProperty(exports, "markdownSummary", { enumerable: true, get: function () { return summary_2.markdownSummary; } }); -/** - * Path exports - */ -var path_utils_1 = require("./path-utils"); -Object.defineProperty(exports, "toPosixPath", { enumerable: true, get: function () { return path_utils_1.toPosixPath; } }); -Object.defineProperty(exports, "toWin32Path", { enumerable: true, get: function () { return path_utils_1.toWin32Path; } }); -Object.defineProperty(exports, "toPlatformPath", { enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }); -//# 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 deleted file mode 100644 index 99f7fd85c..000000000 --- a/node_modules/@actions/core/lib/core.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAC7C,iDAAuE;AACvE,mCAA2D;AAE3D,uCAAwB;AACxB,2CAA4B;AAE5B,6CAAuC;AAavC;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAA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,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,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAA;IAClD,IAAI,QAAQ,EAAE;QACZ,OAAO,+BAAgB,CAAC,OAAO,EAAE,qCAAsB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;KACtE;IAED,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,sBAAc,CAAC,KAAK,CAAC,CAAC,CAAA;AAC3D,CAAC;AAPD,8BAOC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC;AAED,SAAsB,UAAU,CAAC,GAAY;;QAC3C,OAAO,MAAM,uBAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACzC,CAAC;CAAA;AAFD,gCAEC;AAED;;GAEG;AACH,qCAAiC;AAAzB,kGAAA,OAAO,OAAA;AAEf;;GAEG;AACH,qCAAyC;AAAjC,0GAAA,eAAe,OAAA;AAEvB;;GAEG;AACH,2CAAqE;AAA7D,yGAAA,WAAW,OAAA;AAAE,yGAAA,WAAW,OAAA;AAAE,4GAAA,cAAc,OAAA"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/file-command.d.ts b/node_modules/@actions/core/lib/file-command.d.ts deleted file mode 100644 index 2d1f2f425..000000000 --- a/node_modules/@actions/core/lib/file-command.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function issueFileCommand(command: string, message: any): void; -export declare function prepareKeyValueMessage(key: string, value: any): string; diff --git a/node_modules/@actions/core/lib/file-command.js b/node_modules/@actions/core/lib/file-command.js deleted file mode 100644 index 2d0d738fd..000000000 --- a/node_modules/@actions/core/lib/file-command.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -// For internal use, subject to change. -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; -// We use any as a valid input type -/* eslint-disable @typescript-eslint/no-explicit-any */ -const fs = __importStar(require("fs")); -const os = __importStar(require("os")); -const uuid_1 = require("uuid"); -const utils_1 = require("./utils"); -function issueFileCommand(command, message) { - const filePath = process.env[`GITHUB_${command}`]; - if (!filePath) { - throw new Error(`Unable to find environment variable for file command ${command}`); - } - if (!fs.existsSync(filePath)) { - throw new Error(`Missing file at path: ${filePath}`); - } - fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { - encoding: 'utf8' - }); -} -exports.issueFileCommand = issueFileCommand; -function prepareKeyValueMessage(key, value) { - const delimiter = `ghadelimiter_${uuid_1.v4()}`; - const convertedValue = utils_1.toCommandValue(value); - // These should realistically never happen, but just in case someone finds a - // way to exploit uuid generation let's not allow keys or values that contain - // the delimiter. - if (key.includes(delimiter)) { - throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); - } - if (convertedValue.includes(delimiter)) { - throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); - } - return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; -} -exports.prepareKeyValueMessage = prepareKeyValueMessage; -//# sourceMappingURL=file-command.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/file-command.js.map b/node_modules/@actions/core/lib/file-command.js.map deleted file mode 100644 index b1a9d54d7..000000000 --- a/node_modules/@actions/core/lib/file-command.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;;;;;;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,+BAAiC;AACjC,mCAAsC;AAEtC,SAAgB,gBAAgB,CAAC,OAAe,EAAE,OAAY;IAC5D,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,4CAcC;AAED,SAAgB,sBAAsB,CAAC,GAAW,EAAE,KAAU;IAC5D,MAAM,SAAS,GAAG,gBAAgB,SAAM,EAAE,EAAE,CAAA;IAC5C,MAAM,cAAc,GAAG,sBAAc,CAAC,KAAK,CAAC,CAAA;IAE5C,4EAA4E;IAC5E,6EAA6E;IAC7E,iBAAiB;IACjB,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,4DAA4D,SAAS,GAAG,CACzE,CAAA;KACF;IAED,IAAI,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CACb,6DAA6D,SAAS,GAAG,CAC1E,CAAA;KACF;IAED,OAAO,GAAG,GAAG,KAAK,SAAS,GAAG,EAAE,CAAC,GAAG,GAAG,cAAc,GAAG,EAAE,CAAC,GAAG,GAAG,SAAS,EAAE,CAAA;AAC9E,CAAC;AApBD,wDAoBC"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/oidc-utils.d.ts b/node_modules/@actions/core/lib/oidc-utils.d.ts deleted file mode 100644 index 657c7f4ad..000000000 --- a/node_modules/@actions/core/lib/oidc-utils.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare class OidcClient { - private static createHttpClient; - private static getRequestToken; - private static getIDTokenUrl; - private static getCall; - static getIDToken(audience?: string): Promise; -} diff --git a/node_modules/@actions/core/lib/oidc-utils.js b/node_modules/@actions/core/lib/oidc-utils.js deleted file mode 100644 index f70127708..000000000 --- a/node_modules/@actions/core/lib/oidc-utils.js +++ /dev/null @@ -1,77 +0,0 @@ -"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()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OidcClient = void 0; -const http_client_1 = require("@actions/http-client"); -const auth_1 = require("@actions/http-client/lib/auth"); -const core_1 = require("./core"); -class OidcClient { - static createHttpClient(allowRetry = true, maxRetry = 10) { - const requestOptions = { - allowRetries: allowRetry, - maxRetries: maxRetry - }; - return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); - } - static getRequestToken() { - const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; - if (!token) { - throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); - } - return token; - } - static getIDTokenUrl() { - const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; - if (!runtimeUrl) { - throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); - } - return runtimeUrl; - } - static getCall(id_token_url) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - const httpclient = OidcClient.createHttpClient(); - const res = yield httpclient - .getJson(id_token_url) - .catch(error => { - throw new Error(`Failed to get ID Token. \n - Error Code : ${error.statusCode}\n - Error Message: ${error.result.message}`); - }); - const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; - if (!id_token) { - throw new Error('Response json body do not have ID Token field'); - } - return id_token; - }); - } - static getIDToken(audience) { - return __awaiter(this, void 0, void 0, function* () { - try { - // New ID Token is requested from action service - let id_token_url = OidcClient.getIDTokenUrl(); - if (audience) { - const encodedAudience = encodeURIComponent(audience); - id_token_url = `${id_token_url}&audience=${encodedAudience}`; - } - core_1.debug(`ID token url is ${id_token_url}`); - const id_token = yield OidcClient.getCall(id_token_url); - core_1.setSecret(id_token); - return id_token; - } - catch (error) { - throw new Error(`Error message: ${error.message}`); - } - }); - } -} -exports.OidcClient = OidcClient; -//# sourceMappingURL=oidc-utils.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/oidc-utils.js.map b/node_modules/@actions/core/lib/oidc-utils.js.map deleted file mode 100644 index 284fa1d39..000000000 --- a/node_modules/@actions/core/lib/oidc-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oidc-utils.js","sourceRoot":"","sources":["../src/oidc-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAA+C;AAC/C,wDAAqE;AACrE,iCAAuC;AAKvC,MAAa,UAAU;IACb,MAAM,CAAC,gBAAgB,CAC7B,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,EAAE;QAEb,MAAM,cAAc,GAAmB;YACrC,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;SACrB,CAAA;QAED,OAAO,IAAI,wBAAU,CACnB,qBAAqB,EACrB,CAAC,IAAI,8BAAuB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,EAC3D,cAAc,CACf,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAC3D,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEO,MAAM,CAAC,aAAa;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;QAC9D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,MAAM,CAAO,OAAO,CAAC,YAAoB;;;YAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;YAEhD,MAAM,GAAG,GAAG,MAAM,UAAU;iBACzB,OAAO,CAAgB,YAAY,CAAC;iBACpC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,MAAM,IAAI,KAAK,CACb;uBACa,KAAK,CAAC,UAAU;yBACd,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CACtC,CAAA;YACH,CAAC,CAAC,CAAA;YAEJ,MAAM,QAAQ,SAAG,GAAG,CAAC,MAAM,0CAAE,KAAK,CAAA;YAClC,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;aACjE;YACD,OAAO,QAAQ,CAAA;;KAChB;IAED,MAAM,CAAO,UAAU,CAAC,QAAiB;;YACvC,IAAI;gBACF,gDAAgD;gBAChD,IAAI,YAAY,GAAW,UAAU,CAAC,aAAa,EAAE,CAAA;gBACrD,IAAI,QAAQ,EAAE;oBACZ,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;oBACpD,YAAY,GAAG,GAAG,YAAY,aAAa,eAAe,EAAE,CAAA;iBAC7D;gBAED,YAAK,CAAC,mBAAmB,YAAY,EAAE,CAAC,CAAA;gBAExC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACvD,gBAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,OAAO,QAAQ,CAAA;aAChB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;CACF;AAzED,gCAyEC"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/path-utils.d.ts b/node_modules/@actions/core/lib/path-utils.d.ts deleted file mode 100644 index 1fee9f392..000000000 --- a/node_modules/@actions/core/lib/path-utils.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * toPosixPath converts the given path to the posix form. On Windows, \\ will be - * replaced with /. - * - * @param pth. Path to transform. - * @return string Posix path. - */ -export declare function toPosixPath(pth: string): string; -/** - * toWin32Path converts the given path to the win32 form. On Linux, / will be - * replaced with \\. - * - * @param pth. Path to transform. - * @return string Win32 path. - */ -export declare function toWin32Path(pth: string): string; -/** - * toPlatformPath converts the given path to a platform-specific path. It does - * this by replacing instances of / and \ with the platform-specific path - * separator. - * - * @param pth The path to platformize. - * @return string The platform-specific path. - */ -export declare function toPlatformPath(pth: string): string; diff --git a/node_modules/@actions/core/lib/path-utils.js b/node_modules/@actions/core/lib/path-utils.js deleted file mode 100644 index 7251c829c..000000000 --- a/node_modules/@actions/core/lib/path-utils.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; -const path = __importStar(require("path")); -/** - * toPosixPath converts the given path to the posix form. On Windows, \\ will be - * replaced with /. - * - * @param pth. Path to transform. - * @return string Posix path. - */ -function toPosixPath(pth) { - return pth.replace(/[\\]/g, '/'); -} -exports.toPosixPath = toPosixPath; -/** - * toWin32Path converts the given path to the win32 form. On Linux, / will be - * replaced with \\. - * - * @param pth. Path to transform. - * @return string Win32 path. - */ -function toWin32Path(pth) { - return pth.replace(/[/]/g, '\\'); -} -exports.toWin32Path = toWin32Path; -/** - * toPlatformPath converts the given path to a platform-specific path. It does - * this by replacing instances of / and \ with the platform-specific path - * separator. - * - * @param pth The path to platformize. - * @return string The platform-specific path. - */ -function toPlatformPath(pth) { - return pth.replace(/[/\\]/g, path.sep); -} -exports.toPlatformPath = toPlatformPath; -//# sourceMappingURL=path-utils.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/path-utils.js.map b/node_modules/@actions/core/lib/path-utils.js.map deleted file mode 100644 index 7ab1cacec..000000000 --- a/node_modules/@actions/core/lib/path-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAE5B;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC;AAFD,kCAEC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAClC,CAAC;AAFD,kCAEC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,wCAEC"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/summary.d.ts b/node_modules/@actions/core/lib/summary.d.ts deleted file mode 100644 index bb7925555..000000000 --- a/node_modules/@actions/core/lib/summary.d.ts +++ /dev/null @@ -1,202 +0,0 @@ -export declare const SUMMARY_ENV_VAR = "GITHUB_STEP_SUMMARY"; -export declare const SUMMARY_DOCS_URL = "https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary"; -export declare type SummaryTableRow = (SummaryTableCell | string)[]; -export interface SummaryTableCell { - /** - * Cell content - */ - data: string; - /** - * Render cell as header - * (optional) default: false - */ - header?: boolean; - /** - * Number of columns the cell extends - * (optional) default: '1' - */ - colspan?: string; - /** - * Number of rows the cell extends - * (optional) default: '1' - */ - rowspan?: string; -} -export interface SummaryImageOptions { - /** - * The width of the image in pixels. Must be an integer without a unit. - * (optional) - */ - width?: string; - /** - * The height of the image in pixels. Must be an integer without a unit. - * (optional) - */ - height?: string; -} -export interface SummaryWriteOptions { - /** - * Replace all existing content in summary file with buffer contents - * (optional) default: false - */ - overwrite?: boolean; -} -declare class Summary { - private _buffer; - private _filePath?; - constructor(); - /** - * Finds the summary file path from the environment, rejects if env var is not found or file does not exist - * Also checks r/w permissions. - * - * @returns step summary file path - */ - private filePath; - /** - * Wraps content in an HTML tag, adding any HTML attributes - * - * @param {string} tag HTML tag to wrap - * @param {string | null} content content within the tag - * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add - * - * @returns {string} content wrapped in HTML element - */ - private wrap; - /** - * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. - * - * @param {SummaryWriteOptions} [options] (optional) options for write operation - * - * @returns {Promise} summary instance - */ - write(options?: SummaryWriteOptions): Promise; - /** - * Clears the summary buffer and wipes the summary file - * - * @returns {Summary} summary instance - */ - clear(): Promise; - /** - * Returns the current summary buffer as a string - * - * @returns {string} string of summary buffer - */ - stringify(): string; - /** - * If the summary buffer is empty - * - * @returns {boolen} true if the buffer is empty - */ - isEmptyBuffer(): boolean; - /** - * Resets the summary buffer without writing to summary file - * - * @returns {Summary} summary instance - */ - emptyBuffer(): Summary; - /** - * Adds raw text to the summary buffer - * - * @param {string} text content to add - * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) - * - * @returns {Summary} summary instance - */ - addRaw(text: string, addEOL?: boolean): Summary; - /** - * Adds the operating system-specific end-of-line marker to the buffer - * - * @returns {Summary} summary instance - */ - addEOL(): Summary; - /** - * Adds an HTML codeblock to the summary buffer - * - * @param {string} code content to render within fenced code block - * @param {string} lang (optional) language to syntax highlight code - * - * @returns {Summary} summary instance - */ - addCodeBlock(code: string, lang?: string): Summary; - /** - * Adds an HTML list to the summary buffer - * - * @param {string[]} items list of items to render - * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) - * - * @returns {Summary} summary instance - */ - addList(items: string[], ordered?: boolean): Summary; - /** - * Adds an HTML table to the summary buffer - * - * @param {SummaryTableCell[]} rows table rows - * - * @returns {Summary} summary instance - */ - addTable(rows: SummaryTableRow[]): Summary; - /** - * Adds a collapsable HTML details element to the summary buffer - * - * @param {string} label text for the closed state - * @param {string} content collapsable content - * - * @returns {Summary} summary instance - */ - addDetails(label: string, content: string): Summary; - /** - * Adds an HTML image tag to the summary buffer - * - * @param {string} src path to the image you to embed - * @param {string} alt text description of the image - * @param {SummaryImageOptions} options (optional) addition image attributes - * - * @returns {Summary} summary instance - */ - addImage(src: string, alt: string, options?: SummaryImageOptions): Summary; - /** - * Adds an HTML section heading element - * - * @param {string} text heading text - * @param {number | string} [level=1] (optional) the heading level, default: 1 - * - * @returns {Summary} summary instance - */ - addHeading(text: string, level?: number | string): Summary; - /** - * Adds an HTML thematic break (
) to the summary buffer - * - * @returns {Summary} summary instance - */ - addSeparator(): Summary; - /** - * Adds an HTML line break (
) to the summary buffer - * - * @returns {Summary} summary instance - */ - addBreak(): Summary; - /** - * Adds an HTML blockquote to the summary buffer - * - * @param {string} text quote text - * @param {string} cite (optional) citation url - * - * @returns {Summary} summary instance - */ - addQuote(text: string, cite?: string): Summary; - /** - * Adds an HTML anchor tag to the summary buffer - * - * @param {string} text link text/content - * @param {string} href hyperlink - * - * @returns {Summary} summary instance - */ - addLink(text: string, href: string): Summary; -} -/** - * @deprecated use `core.summary` - */ -export declare const markdownSummary: Summary; -export declare const summary: Summary; -export {}; diff --git a/node_modules/@actions/core/lib/summary.js b/node_modules/@actions/core/lib/summary.js deleted file mode 100644 index 04a335b8b..000000000 --- a/node_modules/@actions/core/lib/summary.js +++ /dev/null @@ -1,283 +0,0 @@ -"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()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; -const os_1 = require("os"); -const fs_1 = require("fs"); -const { access, appendFile, writeFile } = fs_1.promises; -exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; -exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; -class Summary { - constructor() { - this._buffer = ''; - } - /** - * Finds the summary file path from the environment, rejects if env var is not found or file does not exist - * Also checks r/w permissions. - * - * @returns step summary file path - */ - filePath() { - return __awaiter(this, void 0, void 0, function* () { - if (this._filePath) { - return this._filePath; - } - const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; - if (!pathFromEnv) { - throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); - } - try { - yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); - } - catch (_a) { - throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); - } - this._filePath = pathFromEnv; - return this._filePath; - }); - } - /** - * Wraps content in an HTML tag, adding any HTML attributes - * - * @param {string} tag HTML tag to wrap - * @param {string | null} content content within the tag - * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add - * - * @returns {string} content wrapped in HTML element - */ - wrap(tag, content, attrs = {}) { - const htmlAttrs = Object.entries(attrs) - .map(([key, value]) => ` ${key}="${value}"`) - .join(''); - if (!content) { - return `<${tag}${htmlAttrs}>`; - } - return `<${tag}${htmlAttrs}>${content}`; - } - /** - * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. - * - * @param {SummaryWriteOptions} [options] (optional) options for write operation - * - * @returns {Promise} summary instance - */ - write(options) { - return __awaiter(this, void 0, void 0, function* () { - const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); - const filePath = yield this.filePath(); - const writeFunc = overwrite ? writeFile : appendFile; - yield writeFunc(filePath, this._buffer, { encoding: 'utf8' }); - return this.emptyBuffer(); - }); - } - /** - * Clears the summary buffer and wipes the summary file - * - * @returns {Summary} summary instance - */ - clear() { - return __awaiter(this, void 0, void 0, function* () { - return this.emptyBuffer().write({ overwrite: true }); - }); - } - /** - * Returns the current summary buffer as a string - * - * @returns {string} string of summary buffer - */ - stringify() { - return this._buffer; - } - /** - * If the summary buffer is empty - * - * @returns {boolen} true if the buffer is empty - */ - isEmptyBuffer() { - return this._buffer.length === 0; - } - /** - * Resets the summary buffer without writing to summary file - * - * @returns {Summary} summary instance - */ - emptyBuffer() { - this._buffer = ''; - return this; - } - /** - * Adds raw text to the summary buffer - * - * @param {string} text content to add - * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) - * - * @returns {Summary} summary instance - */ - addRaw(text, addEOL = false) { - this._buffer += text; - return addEOL ? this.addEOL() : this; - } - /** - * Adds the operating system-specific end-of-line marker to the buffer - * - * @returns {Summary} summary instance - */ - addEOL() { - return this.addRaw(os_1.EOL); - } - /** - * Adds an HTML codeblock to the summary buffer - * - * @param {string} code content to render within fenced code block - * @param {string} lang (optional) language to syntax highlight code - * - * @returns {Summary} summary instance - */ - addCodeBlock(code, lang) { - const attrs = Object.assign({}, (lang && { lang })); - const element = this.wrap('pre', this.wrap('code', code), attrs); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML list to the summary buffer - * - * @param {string[]} items list of items to render - * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) - * - * @returns {Summary} summary instance - */ - addList(items, ordered = false) { - const tag = ordered ? 'ol' : 'ul'; - const listItems = items.map(item => this.wrap('li', item)).join(''); - const element = this.wrap(tag, listItems); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML table to the summary buffer - * - * @param {SummaryTableCell[]} rows table rows - * - * @returns {Summary} summary instance - */ - addTable(rows) { - const tableBody = rows - .map(row => { - const cells = row - .map(cell => { - if (typeof cell === 'string') { - return this.wrap('td', cell); - } - const { header, data, colspan, rowspan } = cell; - const tag = header ? 'th' : 'td'; - const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })); - return this.wrap(tag, data, attrs); - }) - .join(''); - return this.wrap('tr', cells); - }) - .join(''); - const element = this.wrap('table', tableBody); - return this.addRaw(element).addEOL(); - } - /** - * Adds a collapsable HTML details element to the summary buffer - * - * @param {string} label text for the closed state - * @param {string} content collapsable content - * - * @returns {Summary} summary instance - */ - addDetails(label, content) { - const element = this.wrap('details', this.wrap('summary', label) + content); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML image tag to the summary buffer - * - * @param {string} src path to the image you to embed - * @param {string} alt text description of the image - * @param {SummaryImageOptions} options (optional) addition image attributes - * - * @returns {Summary} summary instance - */ - addImage(src, alt, options) { - const { width, height } = options || {}; - const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height })); - const element = this.wrap('img', null, Object.assign({ src, alt }, attrs)); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML section heading element - * - * @param {string} text heading text - * @param {number | string} [level=1] (optional) the heading level, default: 1 - * - * @returns {Summary} summary instance - */ - addHeading(text, level) { - const tag = `h${level}`; - const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag) - ? tag - : 'h1'; - const element = this.wrap(allowedTag, text); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML thematic break (
) to the summary buffer - * - * @returns {Summary} summary instance - */ - addSeparator() { - const element = this.wrap('hr', null); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML line break (
) to the summary buffer - * - * @returns {Summary} summary instance - */ - addBreak() { - const element = this.wrap('br', null); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML blockquote to the summary buffer - * - * @param {string} text quote text - * @param {string} cite (optional) citation url - * - * @returns {Summary} summary instance - */ - addQuote(text, cite) { - const attrs = Object.assign({}, (cite && { cite })); - const element = this.wrap('blockquote', text, attrs); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML anchor tag to the summary buffer - * - * @param {string} text link text/content - * @param {string} href hyperlink - * - * @returns {Summary} summary instance - */ - addLink(text, href) { - const element = this.wrap('a', text, { href }); - return this.addRaw(element).addEOL(); - } -} -const _summary = new Summary(); -/** - * @deprecated use `core.summary` - */ -exports.markdownSummary = _summary; -exports.summary = _summary; -//# sourceMappingURL=summary.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/summary.js.map b/node_modules/@actions/core/lib/summary.js.map deleted file mode 100644 index d598f264f..000000000 --- a/node_modules/@actions/core/lib/summary.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"summary.js","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAsB;AACtB,2BAAsC;AACtC,MAAM,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAC,GAAG,aAAQ,CAAA;AAEnC,QAAA,eAAe,GAAG,qBAAqB,CAAA;AACvC,QAAA,gBAAgB,GAC3B,2GAA2G,CAAA;AA+C7G,MAAM,OAAO;IAIX;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;IACnB,CAAC;IAED;;;;;OAKG;IACW,QAAQ;;YACpB,IAAI,IAAI,CAAC,SAAS,EAAE;gBAClB,OAAO,IAAI,CAAC,SAAS,CAAA;aACtB;YAED,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAe,CAAC,CAAA;YAChD,IAAI,CAAC,WAAW,EAAE;gBAChB,MAAM,IAAI,KAAK,CACb,4CAA4C,uBAAe,6DAA6D,CACzH,CAAA;aACF;YAED,IAAI;gBACF,MAAM,MAAM,CAA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IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAA;IACtC,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAA;IACtC,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAY,EAAE,IAAa;QAClC,MAAM,KAAK,qBACN,CAAC,IAAI,IAAI,EAAC,IAAI,EAAC,CAAC,CACpB,CAAA;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAA;IACtC,CAAC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,IAAY,EAAE,IAAY;QAChC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAC,IAAI,EAAC,CAAC,CAAA;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAA;IACtC,CAAC;CACF;AAED,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAE,CAAA;AAE9B;;GAEG;AACU,QAAA,eAAe,GAAG,QAAQ,CAAA;AAC1B,QAAA,OAAO,GAAG,QAAQ,CAAA"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/utils.d.ts b/node_modules/@actions/core/lib/utils.d.ts deleted file mode 100644 index 3b9e28d5f..000000000 --- a/node_modules/@actions/core/lib/utils.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { AnnotationProperties } from './core'; -import { CommandProperties } from './command'; -/** - * Sanitizes an input into a string so it can be passed into issueCommand safely - * @param input input to sanitize into a string - */ -export declare function toCommandValue(input: any): string; -/** - * - * @param annotationProperties - * @returns The command properties to send with the actual annotation command - * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 - */ -export declare function toCommandProperties(annotationProperties: AnnotationProperties): CommandProperties; diff --git a/node_modules/@actions/core/lib/utils.js b/node_modules/@actions/core/lib/utils.js deleted file mode 100644 index 9b5ca44bb..000000000 --- a/node_modules/@actions/core/lib/utils.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -// We use any as a valid input type -/* eslint-disable @typescript-eslint/no-explicit-any */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.toCommandProperties = exports.toCommandValue = void 0; -/** - * Sanitizes an input into a string so it can be passed into issueCommand safely - * @param input input to sanitize into a string - */ -function toCommandValue(input) { - if (input === null || input === undefined) { - return ''; - } - else if (typeof input === 'string' || input instanceof String) { - return input; - } - return JSON.stringify(input); -} -exports.toCommandValue = toCommandValue; -/** - * - * @param annotationProperties - * @returns The command properties to send with the actual annotation command - * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 - */ -function toCommandProperties(annotationProperties) { - if (!Object.keys(annotationProperties).length) { - return {}; - } - return { - title: annotationProperties.title, - file: annotationProperties.file, - line: annotationProperties.startLine, - endLine: annotationProperties.endLine, - col: annotationProperties.startColumn, - endColumn: annotationProperties.endColumn - }; -} -exports.toCommandProperties = toCommandProperties; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/utils.js.map b/node_modules/@actions/core/lib/utils.js.map deleted file mode 100644 index 8211bb7e5..000000000 --- a/node_modules/@actions/core/lib/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;;AAKvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,oBAA0C;IAE1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE;QAC7C,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,KAAK,EAAE,oBAAoB,CAAC,KAAK;QACjC,IAAI,EAAE,oBAAoB,CAAC,IAAI;QAC/B,IAAI,EAAE,oBAAoB,CAAC,SAAS;QACpC,OAAO,EAAE,oBAAoB,CAAC,OAAO;QACrC,GAAG,EAAE,oBAAoB,CAAC,WAAW;QACrC,SAAS,EAAE,oBAAoB,CAAC,SAAS;KAC1C,CAAA;AACH,CAAC;AAfD,kDAeC"} \ No newline at end of file diff --git a/node_modules/@actions/core/package.json b/node_modules/@actions/core/package.json deleted file mode 100644 index 1f3824dec..000000000 --- a/node_modules/@actions/core/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "@actions/core", - "version": "1.10.0", - "description": "Actions core lib", - "keywords": [ - "github", - "actions", - "core" - ], - "homepage": "https://github.com/actions/toolkit/tree/main/packages/core", - "license": "MIT", - "main": "lib/core.js", - "types": "lib/core.d.ts", - "directories": { - "lib": "lib", - "test": "__tests__" - }, - "files": [ - "lib", - "!.DS_Store" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/actions/toolkit.git", - "directory": "packages/core" - }, - "scripts": { - "audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json", - "test": "echo \"Error: run tests from root\" && exit 1", - "tsc": "tsc" - }, - "bugs": { - "url": "https://github.com/actions/toolkit/issues" - }, - "dependencies": { - "@actions/http-client": "^2.0.1", - "uuid": "^8.3.2" - }, - "devDependencies": { - "@types/node": "^12.0.2", - "@types/uuid": "^8.3.4" - } -} diff --git a/node_modules/@actions/http-client/LICENSE b/node_modules/@actions/http-client/LICENSE deleted file mode 100644 index 5823a51c3..000000000 --- a/node_modules/@actions/http-client/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Actions Http Client for Node.js - -Copyright (c) GitHub, Inc. - -All rights reserved. - -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/@actions/http-client/README.md b/node_modules/@actions/http-client/README.md deleted file mode 100644 index 7e06adeb8..000000000 --- a/node_modules/@actions/http-client/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# `@actions/http-client` - -A lightweight HTTP client optimized for building actions. - -## Features - - - HTTP client with TypeScript generics and async/await/Promises - - Typings included! - - [Proxy support](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners) just works with actions and the runner - - Targets ES2019 (runner runs actions with node 12+). Only supported on node 12+. - - Basic, Bearer and PAT Support out of the box. Extensible handlers for others. - - Redirects supported - -Features and releases [here](./RELEASES.md) - -## Install - -``` -npm install @actions/http-client --save -``` - -## Samples - -See the [tests](./__tests__) for detailed examples. - -## Errors - -### HTTP - -The HTTP client does not throw unless truly exceptional. - -* A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body. -* Redirects (3xx) will be followed by default. - -See the [tests](./__tests__) for detailed examples. - -## Debugging - -To enable detailed console logging of all HTTP requests and responses, set the NODE_DEBUG environment varible: - -```shell -export NODE_DEBUG=http -``` - -## Node support - -The http-client is built using the latest LTS version of Node 12. It may work on previous node LTS versions but it's tested and officially supported on Node12+. - -## Support and Versioning - -We follow semver and will hold compatibility between major versions and increment the minor version with new features and capabilities (while holding compat). - -## Contributing - -We welcome PRs. Please create an issue and if applicable, a design before proceeding with code. - -once: - -``` -npm install -``` - -To build: - -``` -npm run build -``` - -To run all tests: - -``` -npm test -``` diff --git a/node_modules/@actions/http-client/lib/auth.d.ts b/node_modules/@actions/http-client/lib/auth.d.ts deleted file mode 100644 index 8cc9fc3d8..000000000 --- a/node_modules/@actions/http-client/lib/auth.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// -import * as http from 'http'; -import * as ifm from './interfaces'; -import { HttpClientResponse } from './index'; -export declare class BasicCredentialHandler implements ifm.RequestHandler { - username: string; - password: string; - constructor(username: string, password: string); - prepareRequest(options: http.RequestOptions): void; - canHandleAuthentication(): boolean; - handleAuthentication(): Promise; -} -export declare class BearerCredentialHandler implements ifm.RequestHandler { - token: string; - constructor(token: string); - prepareRequest(options: http.RequestOptions): void; - canHandleAuthentication(): boolean; - handleAuthentication(): Promise; -} -export declare class PersonalAccessTokenCredentialHandler implements ifm.RequestHandler { - token: string; - constructor(token: string); - prepareRequest(options: http.RequestOptions): void; - canHandleAuthentication(): boolean; - handleAuthentication(): Promise; -} diff --git a/node_modules/@actions/http-client/lib/auth.js b/node_modules/@actions/http-client/lib/auth.js deleted file mode 100644 index 2c150a3d6..000000000 --- a/node_modules/@actions/http-client/lib/auth.js +++ /dev/null @@ -1,81 +0,0 @@ -"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()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; -class BasicCredentialHandler { - constructor(username, password) { - this.username = username; - this.password = password; - } - prepareRequest(options) { - if (!options.headers) { - throw Error('The request has no headers'); - } - options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`; - } - // This handler cannot handle 401 - canHandleAuthentication() { - return false; - } - handleAuthentication() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('not implemented'); - }); - } -} -exports.BasicCredentialHandler = BasicCredentialHandler; -class BearerCredentialHandler { - constructor(token) { - this.token = token; - } - // currently implements pre-authorization - // TODO: support preAuth = false where it hooks on 401 - prepareRequest(options) { - if (!options.headers) { - throw Error('The request has no headers'); - } - options.headers['Authorization'] = `Bearer ${this.token}`; - } - // This handler cannot handle 401 - canHandleAuthentication() { - return false; - } - handleAuthentication() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('not implemented'); - }); - } -} -exports.BearerCredentialHandler = BearerCredentialHandler; -class PersonalAccessTokenCredentialHandler { - constructor(token) { - this.token = token; - } - // currently implements pre-authorization - // TODO: support preAuth = false where it hooks on 401 - prepareRequest(options) { - if (!options.headers) { - throw Error('The request has no headers'); - } - options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`; - } - // This handler cannot handle 401 - canHandleAuthentication() { - return false; - } - handleAuthentication() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('not implemented'); - }); - } -} -exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; -//# sourceMappingURL=auth.js.map \ No newline at end of file diff --git a/node_modules/@actions/http-client/lib/auth.js.map b/node_modules/@actions/http-client/lib/auth.js.map deleted file mode 100644 index 7d3a18af5..000000000 --- a/node_modules/@actions/http-client/lib/auth.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAa,sBAAsB;IAIjC,YAAY,QAAgB,EAAE,QAAgB;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CACpC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA1BD,wDA0BC;AAED,MAAa,uBAAuB;IAGlC,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,KAAK,EAAE,CAAA;IAC3D,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AAxBD,0DAwBC;AAED,MAAa,oCAAoC;IAI/C,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,OAAO,IAAI,CAAC,KAAK,EAAE,CACpB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA3BD,oFA2BC"} \ No newline at end of file diff --git a/node_modules/@actions/http-client/lib/index.d.ts b/node_modules/@actions/http-client/lib/index.d.ts deleted file mode 100644 index fe733d141..000000000 --- a/node_modules/@actions/http-client/lib/index.d.ts +++ /dev/null @@ -1,123 +0,0 @@ -/// -import * as http from 'http'; -import * as ifm from './interfaces'; -export declare enum HttpCodes { - OK = 200, - MultipleChoices = 300, - MovedPermanently = 301, - ResourceMoved = 302, - SeeOther = 303, - NotModified = 304, - UseProxy = 305, - SwitchProxy = 306, - TemporaryRedirect = 307, - PermanentRedirect = 308, - BadRequest = 400, - Unauthorized = 401, - PaymentRequired = 402, - Forbidden = 403, - NotFound = 404, - MethodNotAllowed = 405, - NotAcceptable = 406, - ProxyAuthenticationRequired = 407, - RequestTimeout = 408, - Conflict = 409, - Gone = 410, - TooManyRequests = 429, - InternalServerError = 500, - NotImplemented = 501, - BadGateway = 502, - ServiceUnavailable = 503, - GatewayTimeout = 504 -} -export declare enum Headers { - Accept = "accept", - ContentType = "content-type" -} -export declare enum MediaTypes { - ApplicationJson = "application/json" -} -/** - * Returns the proxy URL, depending upon the supplied url and proxy environment variables. - * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com - */ -export declare function getProxyUrl(serverUrl: string): string; -export declare class HttpClientError extends Error { - constructor(message: string, statusCode: number); - statusCode: number; - result?: any; -} -export declare class HttpClientResponse { - constructor(message: http.IncomingMessage); - message: http.IncomingMessage; - readBody(): Promise; -} -export declare function isHttps(requestUrl: string): boolean; -export declare class HttpClient { - userAgent: string | undefined; - handlers: ifm.RequestHandler[]; - requestOptions: ifm.RequestOptions | undefined; - private _ignoreSslError; - private _socketTimeout; - private _allowRedirects; - private _allowRedirectDowngrade; - private _maxRedirects; - private _allowRetries; - private _maxRetries; - private _agent; - private _proxyAgent; - private _keepAlive; - private _disposed; - constructor(userAgent?: string, handlers?: ifm.RequestHandler[], requestOptions?: ifm.RequestOptions); - options(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - get(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - del(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - post(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - patch(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - put(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - head(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - /** - * Gets a typed object from an endpoint - * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise - */ - getJson(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise>; - postJson(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise>; - putJson(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise>; - patchJson(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise>; - /** - * Makes a raw http request. - * All other methods such as get, post, patch, and request ultimately call this. - * Prefer get, del, post and patch - */ - request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream | null, headers?: http.OutgoingHttpHeaders): Promise; - /** - * Needs to be called if keepAlive is set to true in request options. - */ - dispose(): void; - /** - * Raw request. - * @param info - * @param data - */ - requestRaw(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null): Promise; - /** - * Raw request with callback. - * @param info - * @param data - * @param onResult - */ - requestRawWithCallback(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null, onResult: (err?: Error, res?: HttpClientResponse) => void): void; - /** - * Gets an http agent. This function is useful when you need an http agent that handles - * routing through a proxy server - depending upon the url and proxy environment variables. - * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com - */ - getAgent(serverUrl: string): http.Agent; - private _prepareRequest; - private _mergeHeaders; - private _getExistingOrDefaultHeader; - private _getAgent; - private _performExponentialBackoff; - private _processResponse; -} diff --git a/node_modules/@actions/http-client/lib/index.js b/node_modules/@actions/http-client/lib/index.js deleted file mode 100644 index a1b7d0323..000000000 --- a/node_modules/@actions/http-client/lib/index.js +++ /dev/null @@ -1,605 +0,0 @@ -"use strict"; -/* eslint-disable @typescript-eslint/no-explicit-any */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -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()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; -const http = __importStar(require("http")); -const https = __importStar(require("https")); -const pm = __importStar(require("./proxy")); -const tunnel = __importStar(require("tunnel")); -var HttpCodes; -(function (HttpCodes) { - HttpCodes[HttpCodes["OK"] = 200] = "OK"; - HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; - HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; - HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; - HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; - HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; - HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; - HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; - HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; - HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; - HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; - HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; - HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; - HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; - HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; - HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; - HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; - HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; - HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; - HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; - HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; - HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; - HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; - HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; - HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; - HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; - HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; -})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); -var Headers; -(function (Headers) { - Headers["Accept"] = "accept"; - Headers["ContentType"] = "content-type"; -})(Headers = exports.Headers || (exports.Headers = {})); -var MediaTypes; -(function (MediaTypes) { - MediaTypes["ApplicationJson"] = "application/json"; -})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); -/** - * Returns the proxy URL, depending upon the supplied url and proxy environment variables. - * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com - */ -function getProxyUrl(serverUrl) { - const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); - return proxyUrl ? proxyUrl.href : ''; -} -exports.getProxyUrl = getProxyUrl; -const HttpRedirectCodes = [ - HttpCodes.MovedPermanently, - HttpCodes.ResourceMoved, - HttpCodes.SeeOther, - HttpCodes.TemporaryRedirect, - HttpCodes.PermanentRedirect -]; -const HttpResponseRetryCodes = [ - HttpCodes.BadGateway, - HttpCodes.ServiceUnavailable, - HttpCodes.GatewayTimeout -]; -const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; -const ExponentialBackoffCeiling = 10; -const ExponentialBackoffTimeSlice = 5; -class HttpClientError extends Error { - constructor(message, statusCode) { - super(message); - this.name = 'HttpClientError'; - this.statusCode = statusCode; - Object.setPrototypeOf(this, HttpClientError.prototype); - } -} -exports.HttpClientError = HttpClientError; -class HttpClientResponse { - constructor(message) { - this.message = message; - } - readBody() { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { - let output = Buffer.alloc(0); - this.message.on('data', (chunk) => { - output = Buffer.concat([output, chunk]); - }); - this.message.on('end', () => { - resolve(output.toString()); - }); - })); - }); - } -} -exports.HttpClientResponse = HttpClientResponse; -function isHttps(requestUrl) { - const parsedUrl = new URL(requestUrl); - return parsedUrl.protocol === 'https:'; -} -exports.isHttps = isHttps; -class HttpClient { - constructor(userAgent, handlers, requestOptions) { - this._ignoreSslError = false; - this._allowRedirects = true; - this._allowRedirectDowngrade = false; - this._maxRedirects = 50; - this._allowRetries = false; - this._maxRetries = 1; - this._keepAlive = false; - this._disposed = false; - this.userAgent = userAgent; - this.handlers = handlers || []; - this.requestOptions = requestOptions; - if (requestOptions) { - if (requestOptions.ignoreSslError != null) { - this._ignoreSslError = requestOptions.ignoreSslError; - } - this._socketTimeout = requestOptions.socketTimeout; - if (requestOptions.allowRedirects != null) { - this._allowRedirects = requestOptions.allowRedirects; - } - if (requestOptions.allowRedirectDowngrade != null) { - this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; - } - if (requestOptions.maxRedirects != null) { - this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); - } - if (requestOptions.keepAlive != null) { - this._keepAlive = requestOptions.keepAlive; - } - if (requestOptions.allowRetries != null) { - this._allowRetries = requestOptions.allowRetries; - } - if (requestOptions.maxRetries != null) { - this._maxRetries = requestOptions.maxRetries; - } - } - } - options(requestUrl, additionalHeaders) { - return __awaiter(this, void 0, void 0, function* () { - return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); - }); - } - get(requestUrl, additionalHeaders) { - return __awaiter(this, void 0, void 0, function* () { - return this.request('GET', requestUrl, null, additionalHeaders || {}); - }); - } - del(requestUrl, additionalHeaders) { - return __awaiter(this, void 0, void 0, function* () { - return this.request('DELETE', requestUrl, null, additionalHeaders || {}); - }); - } - post(requestUrl, data, additionalHeaders) { - return __awaiter(this, void 0, void 0, function* () { - return this.request('POST', requestUrl, data, additionalHeaders || {}); - }); - } - patch(requestUrl, data, additionalHeaders) { - return __awaiter(this, void 0, void 0, function* () { - return this.request('PATCH', requestUrl, data, additionalHeaders || {}); - }); - } - put(requestUrl, data, additionalHeaders) { - return __awaiter(this, void 0, void 0, function* () { - return this.request('PUT', requestUrl, data, additionalHeaders || {}); - }); - } - head(requestUrl, additionalHeaders) { - return __awaiter(this, void 0, void 0, function* () { - return this.request('HEAD', requestUrl, null, additionalHeaders || {}); - }); - } - sendStream(verb, requestUrl, stream, additionalHeaders) { - return __awaiter(this, void 0, void 0, function* () { - return this.request(verb, requestUrl, stream, additionalHeaders); - }); - } - /** - * Gets a typed object from an endpoint - * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise - */ - getJson(requestUrl, additionalHeaders = {}) { - return __awaiter(this, void 0, void 0, function* () { - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); - const res = yield this.get(requestUrl, additionalHeaders); - return this._processResponse(res, this.requestOptions); - }); - } - postJson(requestUrl, obj, additionalHeaders = {}) { - return __awaiter(this, void 0, void 0, function* () { - const data = JSON.stringify(obj, null, 2); - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); - additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); - const res = yield this.post(requestUrl, data, additionalHeaders); - return this._processResponse(res, this.requestOptions); - }); - } - putJson(requestUrl, obj, additionalHeaders = {}) { - return __awaiter(this, void 0, void 0, function* () { - const data = JSON.stringify(obj, null, 2); - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); - additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); - const res = yield this.put(requestUrl, data, additionalHeaders); - return this._processResponse(res, this.requestOptions); - }); - } - patchJson(requestUrl, obj, additionalHeaders = {}) { - return __awaiter(this, void 0, void 0, function* () { - const data = JSON.stringify(obj, null, 2); - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); - additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); - const res = yield this.patch(requestUrl, data, additionalHeaders); - return this._processResponse(res, this.requestOptions); - }); - } - /** - * Makes a raw http request. - * All other methods such as get, post, patch, and request ultimately call this. - * Prefer get, del, post and patch - */ - request(verb, requestUrl, data, headers) { - return __awaiter(this, void 0, void 0, function* () { - if (this._disposed) { - throw new Error('Client has already been disposed.'); - } - const parsedUrl = new URL(requestUrl); - let info = this._prepareRequest(verb, parsedUrl, headers); - // Only perform retries on reads since writes may not be idempotent. - const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) - ? this._maxRetries + 1 - : 1; - let numTries = 0; - let response; - do { - response = yield this.requestRaw(info, data); - // Check if it's an authentication challenge - if (response && - response.message && - response.message.statusCode === HttpCodes.Unauthorized) { - let authenticationHandler; - for (const handler of this.handlers) { - if (handler.canHandleAuthentication(response)) { - authenticationHandler = handler; - break; - } - } - if (authenticationHandler) { - return authenticationHandler.handleAuthentication(this, info, data); - } - else { - // We have received an unauthorized response but have no handlers to handle it. - // Let the response return to the caller. - return response; - } - } - let redirectsRemaining = this._maxRedirects; - while (response.message.statusCode && - HttpRedirectCodes.includes(response.message.statusCode) && - this._allowRedirects && - redirectsRemaining > 0) { - const redirectUrl = response.message.headers['location']; - if (!redirectUrl) { - // if there's no location to redirect to, we won't - break; - } - const parsedRedirectUrl = new URL(redirectUrl); - if (parsedUrl.protocol === 'https:' && - parsedUrl.protocol !== parsedRedirectUrl.protocol && - !this._allowRedirectDowngrade) { - throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); - } - // we need to finish reading the response before reassigning response - // which will leak the open socket. - yield response.readBody(); - // strip authorization header if redirected to a different hostname - if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { - for (const header in headers) { - // header names are case insensitive - if (header.toLowerCase() === 'authorization') { - delete headers[header]; - } - } - } - // let's make the request with the new redirectUrl - info = this._prepareRequest(verb, parsedRedirectUrl, headers); - response = yield this.requestRaw(info, data); - redirectsRemaining--; - } - if (!response.message.statusCode || - !HttpResponseRetryCodes.includes(response.message.statusCode)) { - // If not a retry code, return immediately instead of retrying - return response; - } - numTries += 1; - if (numTries < maxTries) { - yield response.readBody(); - yield this._performExponentialBackoff(numTries); - } - } while (numTries < maxTries); - return response; - }); - } - /** - * Needs to be called if keepAlive is set to true in request options. - */ - dispose() { - if (this._agent) { - this._agent.destroy(); - } - this._disposed = true; - } - /** - * Raw request. - * @param info - * @param data - */ - requestRaw(info, data) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => { - function callbackForResult(err, res) { - if (err) { - reject(err); - } - else if (!res) { - // If `err` is not passed, then `res` must be passed. - reject(new Error('Unknown error')); - } - else { - resolve(res); - } - } - this.requestRawWithCallback(info, data, callbackForResult); - }); - }); - } - /** - * Raw request with callback. - * @param info - * @param data - * @param onResult - */ - requestRawWithCallback(info, data, onResult) { - if (typeof data === 'string') { - if (!info.options.headers) { - info.options.headers = {}; - } - info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); - } - let callbackCalled = false; - function handleResult(err, res) { - if (!callbackCalled) { - callbackCalled = true; - onResult(err, res); - } - } - const req = info.httpModule.request(info.options, (msg) => { - const res = new HttpClientResponse(msg); - handleResult(undefined, res); - }); - let socket; - req.on('socket', sock => { - socket = sock; - }); - // If we ever get disconnected, we want the socket to timeout eventually - req.setTimeout(this._socketTimeout || 3 * 60000, () => { - if (socket) { - socket.end(); - } - handleResult(new Error(`Request timeout: ${info.options.path}`)); - }); - req.on('error', function (err) { - // err has statusCode property - // res should have headers - handleResult(err); - }); - if (data && typeof data === 'string') { - req.write(data, 'utf8'); - } - if (data && typeof data !== 'string') { - data.on('close', function () { - req.end(); - }); - data.pipe(req); - } - else { - req.end(); - } - } - /** - * Gets an http agent. This function is useful when you need an http agent that handles - * routing through a proxy server - depending upon the url and proxy environment variables. - * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com - */ - getAgent(serverUrl) { - const parsedUrl = new URL(serverUrl); - return this._getAgent(parsedUrl); - } - _prepareRequest(method, requestUrl, headers) { - const info = {}; - info.parsedUrl = requestUrl; - const usingSsl = info.parsedUrl.protocol === 'https:'; - info.httpModule = usingSsl ? https : http; - const defaultPort = usingSsl ? 443 : 80; - info.options = {}; - info.options.host = info.parsedUrl.hostname; - info.options.port = info.parsedUrl.port - ? parseInt(info.parsedUrl.port) - : defaultPort; - info.options.path = - (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); - info.options.method = method; - info.options.headers = this._mergeHeaders(headers); - if (this.userAgent != null) { - info.options.headers['user-agent'] = this.userAgent; - } - info.options.agent = this._getAgent(info.parsedUrl); - // gives handlers an opportunity to participate - if (this.handlers) { - for (const handler of this.handlers) { - handler.prepareRequest(info.options); - } - } - return info; - } - _mergeHeaders(headers) { - if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); - } - return lowercaseKeys(headers || {}); - } - _getExistingOrDefaultHeader(additionalHeaders, header, _default) { - let clientHeader; - if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; - } - return additionalHeaders[header] || clientHeader || _default; - } - _getAgent(parsedUrl) { - let agent; - const proxyUrl = pm.getProxyUrl(parsedUrl); - const useProxy = proxyUrl && proxyUrl.hostname; - if (this._keepAlive && useProxy) { - agent = this._proxyAgent; - } - if (this._keepAlive && !useProxy) { - agent = this._agent; - } - // if agent is already assigned use that agent. - if (agent) { - return agent; - } - const usingSsl = parsedUrl.protocol === 'https:'; - let maxSockets = 100; - if (this.requestOptions) { - maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; - } - // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. - if (proxyUrl && proxyUrl.hostname) { - const agentOptions = { - maxSockets, - keepAlive: this._keepAlive, - proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { - proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` - })), { host: proxyUrl.hostname, port: proxyUrl.port }) - }; - let tunnelAgent; - const overHttps = proxyUrl.protocol === 'https:'; - if (usingSsl) { - tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; - } - else { - tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; - } - agent = tunnelAgent(agentOptions); - this._proxyAgent = agent; - } - // if reusing agent across request and tunneling agent isn't assigned create a new agent - if (this._keepAlive && !agent) { - const options = { keepAlive: this._keepAlive, maxSockets }; - agent = usingSsl ? new https.Agent(options) : new http.Agent(options); - this._agent = agent; - } - // if not using private agent and tunnel agent isn't setup then use global agent - if (!agent) { - agent = usingSsl ? https.globalAgent : http.globalAgent; - } - if (usingSsl && this._ignoreSslError) { - // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process - // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options - // we have to cast it to any and change it directly - agent.options = Object.assign(agent.options || {}, { - rejectUnauthorized: false - }); - } - return agent; - } - _performExponentialBackoff(retryNumber) { - return __awaiter(this, void 0, void 0, function* () { - retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); - const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); - return new Promise(resolve => setTimeout(() => resolve(), ms)); - }); - } - _processResponse(res, options) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { - const statusCode = res.message.statusCode || 0; - const response = { - statusCode, - result: null, - headers: {} - }; - // not found leads to null obj returned - if (statusCode === HttpCodes.NotFound) { - resolve(response); - } - // get the result from the body - function dateTimeDeserializer(key, value) { - if (typeof value === 'string') { - const a = new Date(value); - if (!isNaN(a.valueOf())) { - return a; - } - } - return value; - } - let obj; - let contents; - try { - contents = yield res.readBody(); - if (contents && contents.length > 0) { - if (options && options.deserializeDates) { - obj = JSON.parse(contents, dateTimeDeserializer); - } - else { - obj = JSON.parse(contents); - } - response.result = obj; - } - response.headers = res.message.headers; - } - catch (err) { - // Invalid resource (contents not json); leaving result obj null - } - // note that 3xx redirects are handled by the http layer. - if (statusCode > 299) { - let msg; - // if exception/error in body, attempt to get better error - if (obj && obj.message) { - msg = obj.message; - } - else if (contents && contents.length > 0) { - // it may be the case that the exception is in the body message as string - msg = contents; - } - else { - msg = `Failed request: (${statusCode})`; - } - const err = new HttpClientError(msg, statusCode); - err.result = response.result; - reject(err); - } - else { - resolve(response); - } - })); - }); - } -} -exports.HttpClient = HttpClient; -const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@actions/http-client/lib/index.js.map b/node_modules/@actions/http-client/lib/index.js.map deleted file mode 100644 index ca8ea415f..000000000 --- a/node_modules/@actions/http-client/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvD,2CAA4B;AAC5B,6CAA8B;AAG9B,4CAA6B;AAC7B,+CAAgC;AAEhC,IAAY,SA4BX;AA5BD,WAAY,SAAS;IACnB,uCAAQ,CAAA;IACR,iEAAqB,CAAA;IACrB,mEAAsB,CAAA;IACtB,6DAAmB,CAAA;IACnB,mDAAc,CAAA;IACd,yDAAiB,CAAA;IACjB,mDAAc,CAAA;IACd,yDAAiB,CAAA;IACjB,qEAAuB,CAAA;IACvB,qEAAuB,CAAA;IACvB,uDAAgB,CAAA;IAChB,2DAAkB,CAAA;IAClB,iEAAqB,CAAA;IACrB,qDAAe,CAAA;IACf,mDAAc,CAAA;IACd,mEAAsB,CAAA;IACtB,6DAAmB,CAAA;IACnB,yFAAiC,CAAA;IACjC,+DAAoB,CAAA;IACpB,mDAAc,CAAA;IACd,2CAAU,CAAA;IACV,iEAAqB,CAAA;IACrB,yEAAyB,CAAA;IACzB,+DAAoB,CAAA;IACpB,uDAAgB,CAAA;IAChB,uEAAwB,CAAA;IACxB,+DAAoB,CAAA;AACtB,CAAC,EA5BW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QA4BpB;AAED,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,4BAAiB,CAAA;IACjB,uCAA4B,CAAA;AAC9B,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB;AAED,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,kDAAoC,CAAA;AACtC,CAAC,EAFW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAErB;AAED;;;GAGG;AACH,SAAgB,WA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AAM,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC1C,yEAAyE;wBACzE,GAAG,GAAG,QAAQ,CAAA;qBACf;yBAAM;wBACL,GAAG,GAAG,oBAAoB,UAAU,GAAG,CAAA;qBACxC;oBAED,MAAM,GAAG,GAAG,IAAI,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;oBAChD,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAA;oBAE5B,MAAM,CAAC,GAAG,CAAC,CAAA;iBACZ;qBAAM;oBACL,OAAO,CAAC,QAAQ,CAAC,CAAA;iBAClB;YACH,CAAC,CAAA,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AAlpBD,gCAkpBC;AAED,MAAM,aAAa,GAAG,CAAC,GAA2B,EAAO,EAAE,CACzD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@actions/http-client/lib/interfaces.d.ts b/node_modules/@actions/http-client/lib/interfaces.d.ts deleted file mode 100644 index 54fd4a89c..000000000 --- a/node_modules/@actions/http-client/lib/interfaces.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// -import * as http from 'http'; -import * as https from 'https'; -import { HttpClientResponse } from './index'; -export interface HttpClient { - options(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - get(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - del(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - post(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - patch(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - put(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: http.OutgoingHttpHeaders): Promise; - request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: http.OutgoingHttpHeaders): Promise; - requestRaw(info: RequestInfo, data: string | NodeJS.ReadableStream): Promise; - requestRawWithCallback(info: RequestInfo, data: string | NodeJS.ReadableStream, onResult: (err?: Error, res?: HttpClientResponse) => void): void; -} -export interface RequestHandler { - prepareRequest(options: http.RequestOptions): void; - canHandleAuthentication(response: HttpClientResponse): boolean; - handleAuthentication(httpClient: HttpClient, requestInfo: RequestInfo, data: string | NodeJS.ReadableStream | null): Promise; -} -export interface RequestInfo { - options: http.RequestOptions; - parsedUrl: URL; - httpModule: typeof http | typeof https; -} -export interface RequestOptions { - headers?: http.OutgoingHttpHeaders; - socketTimeout?: number; - ignoreSslError?: boolean; - allowRedirects?: boolean; - allowRedirectDowngrade?: boolean; - maxRedirects?: number; - maxSockets?: number; - keepAlive?: boolean; - deserializeDates?: boolean; - allowRetries?: boolean; - maxRetries?: number; -} -export interface TypedResponse { - statusCode: number; - result: T | null; - headers: http.IncomingHttpHeaders; -} diff --git a/node_modules/@actions/http-client/lib/interfaces.js b/node_modules/@actions/http-client/lib/interfaces.js deleted file mode 100644 index db9191150..000000000 --- a/node_modules/@actions/http-client/lib/interfaces.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=interfaces.js.map \ No newline at end of file diff --git a/node_modules/@actions/http-client/lib/interfaces.js.map b/node_modules/@actions/http-client/lib/interfaces.js.map deleted file mode 100644 index 8fb5f7d17..000000000 --- a/node_modules/@actions/http-client/lib/interfaces.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@actions/http-client/lib/proxy.d.ts b/node_modules/@actions/http-client/lib/proxy.d.ts deleted file mode 100644 index 459986540..000000000 --- a/node_modules/@actions/http-client/lib/proxy.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function getProxyUrl(reqUrl: URL): URL | undefined; -export declare function checkBypass(reqUrl: URL): boolean; diff --git a/node_modules/@actions/http-client/lib/proxy.js b/node_modules/@actions/http-client/lib/proxy.js deleted file mode 100644 index 76abb7232..000000000 --- a/node_modules/@actions/http-client/lib/proxy.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.checkBypass = exports.getProxyUrl = void 0; -function getProxyUrl(reqUrl) { - const usingSsl = reqUrl.protocol === 'https:'; - if (checkBypass(reqUrl)) { - return undefined; - } - const proxyVar = (() => { - if (usingSsl) { - return process.env['https_proxy'] || process.env['HTTPS_PROXY']; - } - else { - return process.env['http_proxy'] || process.env['HTTP_PROXY']; - } - })(); - if (proxyVar) { - return new URL(proxyVar); - } - else { - return undefined; - } -} -exports.getProxyUrl = getProxyUrl; -function checkBypass(reqUrl) { - if (!reqUrl.hostname) { - return false; - } - const reqHost = reqUrl.hostname; - if (isLoopbackAddress(reqHost)) { - return true; - } - const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; - if (!noProxy) { - return false; - } - // Determine the request port - let reqPort; - if (reqUrl.port) { - reqPort = Number(reqUrl.port); - } - else if (reqUrl.protocol === 'http:') { - reqPort = 80; - } - else if (reqUrl.protocol === 'https:') { - reqPort = 443; - } - // Format the request hostname and hostname with port - const upperReqHosts = [reqUrl.hostname.toUpperCase()]; - if (typeof reqPort === 'number') { - upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); - } - // Compare request host against noproxy - for (const upperNoProxyItem of noProxy - .split(',') - .map(x => x.trim().toUpperCase()) - .filter(x => x)) { - if (upperNoProxyItem === '*' || - upperReqHosts.some(x => x === upperNoProxyItem || - x.endsWith(`.${upperNoProxyItem}`) || - (upperNoProxyItem.startsWith('.') && - x.endsWith(`${upperNoProxyItem}`)))) { - return true; - } - } - return false; -} -exports.checkBypass = checkBypass; -function isLoopbackAddress(host) { - const hostLower = host.toLowerCase(); - return (hostLower === 'localhost' || - hostLower.startsWith('127.') || - hostLower.startsWith('[::1]') || - hostLower.startsWith('[0:0:0:0:0:0:0:1]')); -} -//# sourceMappingURL=proxy.js.map \ No newline at end of file diff --git a/node_modules/@actions/http-client/lib/proxy.js.map b/node_modules/@actions/http-client/lib/proxy.js.map deleted file mode 100644 index b8206790d..000000000 --- a/node_modules/@actions/http-client/lib/proxy.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,MAAW;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAA;IAE7C,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,SAAS,CAAA;KACjB;IAED,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE;QACrB,IAAI,QAAQ,EAAE;YACZ,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;SAChE;aAAM;YACL,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;SAC9D;IACH,CAAC,CAAC,EAAE,CAAA;IAEJ,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;KACzB;SAAM;QACL,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AApBD,kCAoBC;AAED,SAAgB,WAAW,CAAC,MAAW;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACpB,OAAO,KAAK,CAAA;KACb;IAED,MAAM,OAAO,GAAG,MAAM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AAgB,CAAC,UAAU,CAAC,GAAG,CAAC;oBAC/B,CAAC,CAAC,QAAQ,CAAC,GAAG,gBAAgB,EAAE,CAAC,CAAC,CACvC,EACD;YACA,OAAO,IAAI,CAAA;SACZ;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAnDD,kCAmDC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;IACpC,OAAO,CACL,SAAS,KAAK,WAAW;QACzB,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;QAC5B,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC;QAC7B,SAAS,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAC1C,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@actions/http-client/package.json b/node_modules/@actions/http-client/package.json deleted file mode 100644 index 7f5c8ec3d..000000000 --- a/node_modules/@actions/http-client/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@actions/http-client", - "version": "2.1.0", - "description": "Actions Http Client", - "keywords": [ - "github", - "actions", - "http" - ], - "homepage": "https://github.com/actions/toolkit/tree/main/packages/http-client", - "license": "MIT", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "directories": { - "lib": "lib", - "test": "__tests__" - }, - "files": [ - "lib", - "!.DS_Store" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/actions/toolkit.git", - "directory": "packages/http-client" - }, - "scripts": { - "audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json", - "test": "echo \"Error: run tests from root\" && exit 1", - "build": "tsc", - "format": "prettier --write **/*.ts", - "format-check": "prettier --check **/*.ts", - "tsc": "tsc" - }, - "bugs": { - "url": "https://github.com/actions/toolkit/issues" - }, - "devDependencies": { - "@types/tunnel": "0.0.3", - "proxy": "^1.0.1" - }, - "dependencies": { - "tunnel": "^0.0.6" - } -} diff --git a/node_modules/@ampproject/remapping/LICENSE b/node_modules/@ampproject/remapping/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/node_modules/@ampproject/remapping/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@ampproject/remapping/README.md b/node_modules/@ampproject/remapping/README.md deleted file mode 100644 index 1463c9f62..000000000 --- a/node_modules/@ampproject/remapping/README.md +++ /dev/null @@ -1,218 +0,0 @@ -# @ampproject/remapping - -> Remap sequential sourcemaps through transformations to point at the original source code - -Remapping allows you to take the sourcemaps generated through transforming your code and "remap" -them to the original source locations. Think "my minified code, transformed with babel and bundled -with webpack", all pointing to the correct location in your original source code. - -With remapping, none of your source code transformations need to be aware of the input's sourcemap, -they only need to generate an output sourcemap. This greatly simplifies building custom -transformations (think a find-and-replace). - -## Installation - -```sh -npm install @ampproject/remapping -``` - -## Usage - -```typescript -function remapping( - map: SourceMap | SourceMap[], - loader: (file: string, ctx: LoaderContext) => (SourceMap | null | undefined), - options?: { excludeContent: boolean, decodedMappings: boolean } -): SourceMap; - -// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the -// "source" location (where child sources are resolved relative to, or the location of original -// source), and the ability to override the "content" of an original source for inclusion in the -// output sourcemap. -type LoaderContext = { - readonly importer: string; - readonly depth: number; - source: string; - content: string | null | undefined; -} -``` - -`remapping` takes the final output sourcemap, and a `loader` function. For every source file pointer -in the sourcemap, the `loader` will be called with the resolved path. If the path itself represents -a transformed file (it has a sourcmap associated with it), then the `loader` should return that -sourcemap. If not, the path will be treated as an original, untransformed source code. - -```js -// Babel transformed "helloworld.js" into "transformed.js" -const transformedMap = JSON.stringify({ - file: 'transformed.js', - // 1st column of 2nd line of output file translates into the 1st source - // file, line 3, column 2 - mappings: ';CAEE', - sources: ['helloworld.js'], - version: 3, -}); - -// Uglify minified "transformed.js" into "transformed.min.js" -const minifiedTransformedMap = JSON.stringify({ - file: 'transformed.min.js', - // 0th column of 1st line of output file translates into the 1st source - // file, line 2, column 1. - mappings: 'AACC', - names: [], - sources: ['transformed.js'], - version: 3, -}); - -const remapped = remapping( - minifiedTransformedMap, - (file, ctx) => { - - // The "transformed.js" file is an transformed file. - if (file === 'transformed.js') { - // The root importer is empty. - console.assert(ctx.importer === ''); - // The depth in the sourcemap tree we're currently loading. - // The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc. - console.assert(ctx.depth === 1); - - return transformedMap; - } - - // Loader will be called to load transformedMap's source file pointers as well. - console.assert(file === 'helloworld.js'); - // `transformed.js`'s sourcemap points into `helloworld.js`. - console.assert(ctx.importer === 'transformed.js'); - // This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`. - console.assert(ctx.depth === 2); - return null; - } -); - -console.log(remapped); -// { -// file: 'transpiled.min.js', -// mappings: 'AAEE', -// sources: ['helloworld.js'], -// version: 3, -// }; -``` - -In this example, `loader` will be called twice: - -1. `"transformed.js"`, the first source file pointer in the `minifiedTransformedMap`. We return the - associated sourcemap for it (its a transformed file, after all) so that sourcemap locations can - be traced through it into the source files it represents. -2. `"helloworld.js"`, our original, unmodified source code. This file does not have a sourcemap, so - we return `null`. - -The `remapped` sourcemap now points from `transformed.min.js` into locations in `helloworld.js`. If -you were to read the `mappings`, it says "0th column of the first line output line points to the 1st -column of the 2nd line of the file `helloworld.js`". - -### Multiple transformations of a file - -As a convenience, if you have multiple single-source transformations of a file, you may pass an -array of sourcemap files in the order of most-recent transformation sourcemap first. Note that this -changes the `importer` and `depth` of each call to our loader. So our above example could have been -written as: - -```js -const remapped = remapping( - [minifiedTransformedMap, transformedMap], - () => null -); - -console.log(remapped); -// { -// file: 'transpiled.min.js', -// mappings: 'AAEE', -// sources: ['helloworld.js'], -// version: 3, -// }; -``` - -### Advanced control of the loading graph - -#### `source` - -The `source` property can overridden to any value to change the location of the current load. Eg, -for an original source file, it allows us to change the location to the original source regardless -of what the sourcemap source entry says. And for transformed files, it allows us to change the -relative resolving location for child sources of the loaded sourcemap. - -```js -const remapped = remapping( - minifiedTransformedMap, - (file, ctx) => { - - if (file === 'transformed.js') { - // We pretend the transformed.js file actually exists in the 'src/' directory. When the nested - // source files are loaded, they will now be relative to `src/`. - ctx.source = 'src/transformed.js'; - return transformedMap; - } - - console.assert(file === 'src/helloworld.js'); - // We could futher change the source of this original file, eg, to be inside a nested directory - // itself. This will be reflected in the remapped sourcemap. - ctx.source = 'src/nested/transformed.js'; - return null; - } -); - -console.log(remapped); -// { -// …, -// sources: ['src/nested/helloworld.js'], -// }; -``` - - -#### `content` - -The `content` property can be overridden when we encounter an original source file. Eg, this allows -you to manually provide the source content of the original file regardless of whether the -`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove -the source content. - -```js -const remapped = remapping( - minifiedTransformedMap, - (file, ctx) => { - - if (file === 'transformed.js') { - // transformedMap does not include a `sourcesContent` field, so usually the remapped sourcemap - // would not include any `sourcesContent` values. - return transformedMap; - } - - console.assert(file === 'helloworld.js'); - // We can read the file to provide the source content. - ctx.content = fs.readFileSync(file, 'utf8'); - return null; - } -); - -console.log(remapped); -// { -// …, -// sourcesContent: [ -// 'console.log("Hello world!")', -// ], -// }; -``` - -### Options - -#### excludeContent - -By default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the -`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce -the size out the sourcemap. - -#### decodedMappings - -By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the -`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of -encoding into a VLQ string. diff --git a/node_modules/@ampproject/remapping/dist/remapping.mjs b/node_modules/@ampproject/remapping/dist/remapping.mjs deleted file mode 100644 index b5eddeda5..000000000 --- a/node_modules/@ampproject/remapping/dist/remapping.mjs +++ /dev/null @@ -1,191 +0,0 @@ -import { decodedMappings, traceSegment, TraceMap } from '@jridgewell/trace-mapping'; -import { GenMapping, maybeAddSegment, setSourceContent, toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping'; - -const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null); -const EMPTY_SOURCES = []; -function SegmentObject(source, line, column, name, content) { - return { source, line, column, name, content }; -} -function Source(map, sources, source, content) { - return { - map, - sources, - source, - content, - }; -} -/** - * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes - * (which may themselves be SourceMapTrees). - */ -function MapSource(map, sources) { - return Source(map, sources, '', null); -} -/** - * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive - * segment tracing ends at the `OriginalSource`. - */ -function OriginalSource(source, content) { - return Source(null, EMPTY_SOURCES, source, content); -} -/** - * traceMappings is only called on the root level SourceMapTree, and begins the process of - * resolving each mapping in terms of the original source files. - */ -function traceMappings(tree) { - // TODO: Eventually support sourceRoot, which has to be removed because the sources are already - // fully resolved. We'll need to make sources relative to the sourceRoot before adding them. - const gen = new GenMapping({ file: tree.map.file }); - const { sources: rootSources, map } = tree; - const rootNames = map.names; - const rootMappings = decodedMappings(map); - for (let i = 0; i < rootMappings.length; i++) { - const segments = rootMappings[i]; - for (let j = 0; j < segments.length; j++) { - const segment = segments[j]; - const genCol = segment[0]; - let traced = SOURCELESS_MAPPING; - // 1-length segments only move the current generated column, there's no source information - // to gather from it. - if (segment.length !== 1) { - const source = rootSources[segment[1]]; - traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : ''); - // If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a - // respective segment into an original source. - if (traced == null) - continue; - } - const { column, line, name, content, source } = traced; - maybeAddSegment(gen, i, genCol, source, line, column, name); - if (source && content != null) - setSourceContent(gen, source, content); - } - } - return gen; -} -/** - * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own - * child SourceMapTrees, until we find the original source map. - */ -function originalPositionFor(source, line, column, name) { - if (!source.map) { - return SegmentObject(source.source, line, column, name, source.content); - } - const segment = traceSegment(source.map, line, column); - // If we couldn't find a segment, then this doesn't exist in the sourcemap. - if (segment == null) - return null; - // 1-length segments only move the current generated column, there's no source information - // to gather from it. - if (segment.length === 1) - return SOURCELESS_MAPPING; - return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name); -} - -function asArray(value) { - if (Array.isArray(value)) - return value; - return [value]; -} -/** - * Recursively builds a tree structure out of sourcemap files, with each node - * being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of - * `OriginalSource`s and `SourceMapTree`s. - * - * Every sourcemap is composed of a collection of source files and mappings - * into locations of those source files. When we generate a `SourceMapTree` for - * the sourcemap, we attempt to load each source file's own sourcemap. If it - * does not have an associated sourcemap, it is considered an original, - * unmodified source file. - */ -function buildSourceMapTree(input, loader) { - const maps = asArray(input).map((m) => new TraceMap(m, '')); - const map = maps.pop(); - for (let i = 0; i < maps.length; i++) { - if (maps[i].sources.length > 1) { - throw new Error(`Transformation map ${i} must have exactly one source file.\n` + - 'Did you specify these with the most recent transformation maps first?'); - } - } - let tree = build(map, loader, '', 0); - for (let i = maps.length - 1; i >= 0; i--) { - tree = MapSource(maps[i], [tree]); - } - return tree; -} -function build(map, loader, importer, importerDepth) { - const { resolvedSources, sourcesContent } = map; - const depth = importerDepth + 1; - const children = resolvedSources.map((sourceFile, i) => { - // The loading context gives the loader more information about why this file is being loaded - // (eg, from which importer). It also allows the loader to override the location of the loaded - // sourcemap/original source, or to override the content in the sourcesContent field if it's - // an unmodified source file. - const ctx = { - importer, - depth, - source: sourceFile || '', - content: undefined, - }; - // Use the provided loader callback to retrieve the file's sourcemap. - // TODO: We should eventually support async loading of sourcemap files. - const sourceMap = loader(ctx.source, ctx); - const { source, content } = ctx; - // If there is a sourcemap, then we need to recurse into it to load its source files. - if (sourceMap) - return build(new TraceMap(sourceMap, source), loader, source, depth); - // Else, it's an an unmodified source file. - // The contents of this unmodified source file can be overridden via the loader context, - // allowing it to be explicitly null or a string. If it remains undefined, we fall back to - // the importing sourcemap's `sourcesContent` field. - const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null; - return OriginalSource(source, sourceContent); - }); - return MapSource(map, children); -} - -/** - * A SourceMap v3 compatible sourcemap, which only includes fields that were - * provided to it. - */ -class SourceMap { - constructor(map, options) { - const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map); - this.version = out.version; // SourceMap spec says this should be first. - this.file = out.file; - this.mappings = out.mappings; - this.names = out.names; - this.sourceRoot = out.sourceRoot; - this.sources = out.sources; - if (!options.excludeContent) { - this.sourcesContent = out.sourcesContent; - } - } - toString() { - return JSON.stringify(this); - } -} - -/** - * Traces through all the mappings in the root sourcemap, through the sources - * (and their sourcemaps), all the way back to the original source location. - * - * `loader` will be called every time we encounter a source file. If it returns - * a sourcemap, we will recurse into that sourcemap to continue the trace. If - * it returns a falsey value, that source file is treated as an original, - * unmodified source file. - * - * Pass `excludeContent` to exclude any self-containing source file content - * from the output sourcemap. - * - * Pass `decodedMappings` to receive a SourceMap with decoded (instead of - * VLQ encoded) mappings. - */ -function remapping(input, loader, options) { - const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false }; - const tree = buildSourceMapTree(input, loader); - return new SourceMap(traceMappings(tree), opts); -} - -export { remapping as default }; -//# sourceMappingURL=remapping.mjs.map diff --git a/node_modules/@ampproject/remapping/dist/remapping.mjs.map b/node_modules/@ampproject/remapping/dist/remapping.mjs.map deleted file mode 100644 index 078a2b73b..000000000 --- a/node_modules/@ampproject/remapping/dist/remapping.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"remapping.mjs","sources":["../src/source-map-tree.ts","../src/build-source-map-tree.ts","../src/source-map.ts","../src/remapping.ts"],"sourcesContent":["import { GenMapping, maybeAddSegment, setSourceContent } from '@jridgewell/gen-mapping';\nimport { traceSegment, decodedMappings } from '@jridgewell/trace-mapping';\n\nimport type { TraceMap } from '@jridgewell/trace-mapping';\n\nexport type SourceMapSegmentObject = {\n column: number;\n line: number;\n name: string;\n source: string;\n content: string | null;\n};\n\nexport type OriginalSource = {\n map: null;\n sources: Sources[];\n source: string;\n content: string | null;\n};\n\nexport type MapSource = {\n map: TraceMap;\n sources: Sources[];\n source: string;\n content: null;\n};\n\nexport type Sources = OriginalSource | MapSource;\n\nconst SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null);\nconst EMPTY_SOURCES: Sources[] = [];\n\nfunction SegmentObject(\n source: string,\n line: number,\n column: number,\n name: string,\n content: string | null\n): SourceMapSegmentObject {\n return { source, line, column, name, content };\n}\n\nfunction Source(map: TraceMap, sources: Sources[], source: '', content: null): MapSource;\nfunction Source(\n map: null,\n sources: Sources[],\n source: string,\n content: string | null\n): OriginalSource;\nfunction Source(\n map: TraceMap | null,\n sources: Sources[],\n source: string | '',\n content: string | null\n): Sources {\n return {\n map,\n sources,\n source,\n content,\n } as any;\n}\n\n/**\n * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes\n * (which may themselves be SourceMapTrees).\n */\nexport function MapSource(map: TraceMap, sources: Sources[]): MapSource {\n return Source(map, sources, '', null);\n}\n\n/**\n * A \"leaf\" node in the sourcemap tree, representing an original, unmodified source file. Recursive\n * segment tracing ends at the `OriginalSource`.\n */\nexport function OriginalSource(source: string, content: string | null): OriginalSource {\n return Source(null, EMPTY_SOURCES, source, content);\n}\n\n/**\n * traceMappings is only called on the root level SourceMapTree, and begins the process of\n * resolving each mapping in terms of the original source files.\n */\nexport function traceMappings(tree: MapSource): GenMapping {\n // TODO: Eventually support sourceRoot, which has to be removed because the sources are already\n // fully resolved. We'll need to make sources relative to the sourceRoot before adding them.\n const gen = new GenMapping({ file: tree.map.file });\n const { sources: rootSources, map } = tree;\n const rootNames = map.names;\n const rootMappings = decodedMappings(map);\n\n for (let i = 0; i < rootMappings.length; i++) {\n const segments = rootMappings[i];\n\n for (let j = 0; j < segments.length; j++) {\n const segment = segments[j];\n const genCol = segment[0];\n let traced: SourceMapSegmentObject | null = SOURCELESS_MAPPING;\n\n // 1-length segments only move the current generated column, there's no source information\n // to gather from it.\n if (segment.length !== 1) {\n const source = rootSources[segment[1]];\n traced = originalPositionFor(\n source,\n segment[2],\n segment[3],\n segment.length === 5 ? rootNames[segment[4]] : ''\n );\n\n // If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a\n // respective segment into an original source.\n if (traced == null) continue;\n }\n\n const { column, line, name, content, source } = traced;\n\n maybeAddSegment(gen, i, genCol, source, line, column, name);\n if (source && content != null) setSourceContent(gen, source, content);\n }\n }\n\n return gen;\n}\n\n/**\n * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own\n * child SourceMapTrees, until we find the original source map.\n */\nexport function originalPositionFor(\n source: Sources,\n line: number,\n column: number,\n name: string\n): SourceMapSegmentObject | null {\n if (!source.map) {\n return SegmentObject(source.source, line, column, name, source.content);\n }\n\n const segment = traceSegment(source.map, line, column);\n\n // If we couldn't find a segment, then this doesn't exist in the sourcemap.\n if (segment == null) return null;\n // 1-length segments only move the current generated column, there's no source information\n // to gather from it.\n if (segment.length === 1) return SOURCELESS_MAPPING;\n\n return originalPositionFor(\n source.sources[segment[1]],\n segment[2],\n segment[3],\n segment.length === 5 ? source.map.names[segment[4]] : name\n );\n}\n","import { TraceMap } from '@jridgewell/trace-mapping';\n\nimport { OriginalSource, MapSource } from './source-map-tree';\n\nimport type { Sources, MapSource as MapSourceType } from './source-map-tree';\nimport type { SourceMapInput, SourceMapLoader, LoaderContext } from './types';\n\nfunction asArray(value: T | T[]): T[] {\n if (Array.isArray(value)) return value;\n return [value];\n}\n\n/**\n * Recursively builds a tree structure out of sourcemap files, with each node\n * being either an `OriginalSource` \"leaf\" or a `SourceMapTree` composed of\n * `OriginalSource`s and `SourceMapTree`s.\n *\n * Every sourcemap is composed of a collection of source files and mappings\n * into locations of those source files. When we generate a `SourceMapTree` for\n * the sourcemap, we attempt to load each source file's own sourcemap. If it\n * does not have an associated sourcemap, it is considered an original,\n * unmodified source file.\n */\nexport default function buildSourceMapTree(\n input: SourceMapInput | SourceMapInput[],\n loader: SourceMapLoader\n): MapSourceType {\n const maps = asArray(input).map((m) => new TraceMap(m, ''));\n const map = maps.pop()!;\n\n for (let i = 0; i < maps.length; i++) {\n if (maps[i].sources.length > 1) {\n throw new Error(\n `Transformation map ${i} must have exactly one source file.\\n` +\n 'Did you specify these with the most recent transformation maps first?'\n );\n }\n }\n\n let tree = build(map, loader, '', 0);\n for (let i = maps.length - 1; i >= 0; i--) {\n tree = MapSource(maps[i], [tree]);\n }\n return tree;\n}\n\nfunction build(\n map: TraceMap,\n loader: SourceMapLoader,\n importer: string,\n importerDepth: number\n): MapSourceType {\n const { resolvedSources, sourcesContent } = map;\n\n const depth = importerDepth + 1;\n const children = resolvedSources.map((sourceFile: string | null, i: number): Sources => {\n // The loading context gives the loader more information about why this file is being loaded\n // (eg, from which importer). It also allows the loader to override the location of the loaded\n // sourcemap/original source, or to override the content in the sourcesContent field if it's\n // an unmodified source file.\n const ctx: LoaderContext = {\n importer,\n depth,\n source: sourceFile || '',\n content: undefined,\n };\n\n // Use the provided loader callback to retrieve the file's sourcemap.\n // TODO: We should eventually support async loading of sourcemap files.\n const sourceMap = loader(ctx.source, ctx);\n\n const { source, content } = ctx;\n\n // If there is a sourcemap, then we need to recurse into it to load its source files.\n if (sourceMap) return build(new TraceMap(sourceMap, source), loader, source, depth);\n\n // Else, it's an an unmodified source file.\n // The contents of this unmodified source file can be overridden via the loader context,\n // allowing it to be explicitly null or a string. If it remains undefined, we fall back to\n // the importing sourcemap's `sourcesContent` field.\n const sourceContent =\n content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;\n return OriginalSource(source, sourceContent);\n });\n\n return MapSource(map, children);\n}\n","import { toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping';\n\nimport type { GenMapping } from '@jridgewell/gen-mapping';\nimport type { DecodedSourceMap, EncodedSourceMap, Options } from './types';\n\n/**\n * A SourceMap v3 compatible sourcemap, which only includes fields that were\n * provided to it.\n */\nexport default class SourceMap {\n declare file?: string | null;\n declare mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings'];\n declare sourceRoot?: string;\n declare names: string[];\n declare sources: (string | null)[];\n declare sourcesContent?: (string | null)[];\n declare version: 3;\n\n constructor(map: GenMapping, options: Options) {\n const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map);\n this.version = out.version; // SourceMap spec says this should be first.\n this.file = out.file;\n this.mappings = out.mappings as SourceMap['mappings'];\n this.names = out.names as SourceMap['names'];\n\n this.sourceRoot = out.sourceRoot;\n\n this.sources = out.sources as SourceMap['sources'];\n if (!options.excludeContent) {\n this.sourcesContent = out.sourcesContent as SourceMap['sourcesContent'];\n }\n }\n\n toString(): string {\n return JSON.stringify(this);\n }\n}\n","import buildSourceMapTree from './build-source-map-tree';\nimport { traceMappings } from './source-map-tree';\nimport SourceMap from './source-map';\n\nimport type { SourceMapInput, SourceMapLoader, Options } from './types';\nexport type {\n SourceMapSegment,\n EncodedSourceMap,\n EncodedSourceMap as RawSourceMap,\n DecodedSourceMap,\n SourceMapInput,\n SourceMapLoader,\n LoaderContext,\n Options,\n} from './types';\n\n/**\n * Traces through all the mappings in the root sourcemap, through the sources\n * (and their sourcemaps), all the way back to the original source location.\n *\n * `loader` will be called every time we encounter a source file. If it returns\n * a sourcemap, we will recurse into that sourcemap to continue the trace. If\n * it returns a falsey value, that source file is treated as an original,\n * unmodified source file.\n *\n * Pass `excludeContent` to exclude any self-containing source file content\n * from the output sourcemap.\n *\n * Pass `decodedMappings` to receive a SourceMap with decoded (instead of\n * VLQ encoded) mappings.\n */\nexport default function remapping(\n input: SourceMapInput | SourceMapInput[],\n loader: SourceMapLoader,\n options?: boolean | Options\n): SourceMap {\n const opts =\n typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };\n const tree = buildSourceMapTree(input, loader);\n return new SourceMap(traceMappings(tree), opts);\n}\n"],"names":[],"mappings":";;;AA6BA,MAAM,kBAAkB,mBAAmB,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AAC/E,MAAM,aAAa,GAAc,EAAE,CAAC;AAEpC,SAAS,aAAa,CACpB,MAAc,EACd,IAAY,EACZ,MAAc,EACd,IAAY,EACZ,OAAsB,EAAA;IAEtB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACjD,CAAC;AASD,SAAS,MAAM,CACb,GAAoB,EACpB,OAAkB,EAClB,MAAmB,EACnB,OAAsB,EAAA;IAEtB,OAAO;QACL,GAAG;QACH,OAAO;QACP,MAAM;QACN,OAAO;KACD,CAAC;AACX,CAAC;AAED;;;AAGG;AACa,SAAA,SAAS,CAAC,GAAa,EAAE,OAAkB,EAAA;IACzD,OAAO,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC;AAED;;;AAGG;AACa,SAAA,cAAc,CAAC,MAAc,EAAE,OAAsB,EAAA;IACnE,OAAO,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAED;;;AAGG;AACG,SAAU,aAAa,CAAC,IAAe,EAAA;;;AAG3C,IAAA,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE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cAA6C,CAAC;AACzE,SAAA;KACF;IAED,QAAQ,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KAC7B;AACF;;ACpBD;;;;;;;;;;;;;;AAcG;AACqB,SAAA,SAAS,CAC/B,KAAwC,EACxC,MAAuB,EACvB,OAA2B,EAAA;IAE3B,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;IAChG,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,IAAI,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;AAClD;;;;"} \ No newline at end of file diff --git a/node_modules/@ampproject/remapping/dist/remapping.umd.js b/node_modules/@ampproject/remapping/dist/remapping.umd.js deleted file mode 100644 index e292d4c37..000000000 --- a/node_modules/@ampproject/remapping/dist/remapping.umd.js +++ /dev/null @@ -1,196 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@jridgewell/trace-mapping'), require('@jridgewell/gen-mapping')) : - typeof define === 'function' && define.amd ? define(['@jridgewell/trace-mapping', '@jridgewell/gen-mapping'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.remapping = factory(global.traceMapping, global.genMapping)); -})(this, (function (traceMapping, genMapping) { 'use strict'; - - const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null); - const EMPTY_SOURCES = []; - function SegmentObject(source, line, column, name, content) { - return { source, line, column, name, content }; - } - function Source(map, sources, source, content) { - return { - map, - sources, - source, - content, - }; - } - /** - * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes - * (which may themselves be SourceMapTrees). - */ - function MapSource(map, sources) { - return Source(map, sources, '', null); - } - /** - * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive - * segment tracing ends at the `OriginalSource`. - */ - function OriginalSource(source, content) { - return Source(null, EMPTY_SOURCES, source, content); - } - /** - * traceMappings is only called on the root level SourceMapTree, and begins the process of - * resolving each mapping in terms of the original source files. - */ - function traceMappings(tree) { - // TODO: Eventually support sourceRoot, which has to be removed because the sources are already - // fully resolved. We'll need to make sources relative to the sourceRoot before adding them. - const gen = new genMapping.GenMapping({ file: tree.map.file }); - const { sources: rootSources, map } = tree; - const rootNames = map.names; - const rootMappings = traceMapping.decodedMappings(map); - for (let i = 0; i < rootMappings.length; i++) { - const segments = rootMappings[i]; - for (let j = 0; j < segments.length; j++) { - const segment = segments[j]; - const genCol = segment[0]; - let traced = SOURCELESS_MAPPING; - // 1-length segments only move the current generated column, there's no source information - // to gather from it. - if (segment.length !== 1) { - const source = rootSources[segment[1]]; - traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : ''); - // If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a - // respective segment into an original source. - if (traced == null) - continue; - } - const { column, line, name, content, source } = traced; - genMapping.maybeAddSegment(gen, i, genCol, source, line, column, name); - if (source && content != null) - genMapping.setSourceContent(gen, source, content); - } - } - return gen; - } - /** - * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own - * child SourceMapTrees, until we find the original source map. - */ - function originalPositionFor(source, line, column, name) { - if (!source.map) { - return SegmentObject(source.source, line, column, name, source.content); - } - const segment = traceMapping.traceSegment(source.map, line, column); - // If we couldn't find a segment, then this doesn't exist in the sourcemap. - if (segment == null) - return null; - // 1-length segments only move the current generated column, there's no source information - // to gather from it. - if (segment.length === 1) - return SOURCELESS_MAPPING; - return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name); - } - - function asArray(value) { - if (Array.isArray(value)) - return value; - return [value]; - } - /** - * Recursively builds a tree structure out of sourcemap files, with each node - * being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of - * `OriginalSource`s and `SourceMapTree`s. - * - * Every sourcemap is composed of a collection of source files and mappings - * into locations of those source files. When we generate a `SourceMapTree` for - * the sourcemap, we attempt to load each source file's own sourcemap. If it - * does not have an associated sourcemap, it is considered an original, - * unmodified source file. - */ - function buildSourceMapTree(input, loader) { - const maps = asArray(input).map((m) => new traceMapping.TraceMap(m, '')); - const map = maps.pop(); - for (let i = 0; i < maps.length; i++) { - if (maps[i].sources.length > 1) { - throw new Error(`Transformation map ${i} must have exactly one source file.\n` + - 'Did you specify these with the most recent transformation maps first?'); - } - } - let tree = build(map, loader, '', 0); - for (let i = maps.length - 1; i >= 0; i--) { - tree = MapSource(maps[i], [tree]); - } - return tree; - } - function build(map, loader, importer, importerDepth) { - const { resolvedSources, sourcesContent } = map; - const depth = importerDepth + 1; - const children = resolvedSources.map((sourceFile, i) => { - // The loading context gives the loader more information about why this file is being loaded - // (eg, from which importer). It also allows the loader to override the location of the loaded - // sourcemap/original source, or to override the content in the sourcesContent field if it's - // an unmodified source file. - const ctx = { - importer, - depth, - source: sourceFile || '', - content: undefined, - }; - // Use the provided loader callback to retrieve the file's sourcemap. - // TODO: We should eventually support async loading of sourcemap files. - const sourceMap = loader(ctx.source, ctx); - const { source, content } = ctx; - // If there is a sourcemap, then we need to recurse into it to load its source files. - if (sourceMap) - return build(new traceMapping.TraceMap(sourceMap, source), loader, source, depth); - // Else, it's an an unmodified source file. - // The contents of this unmodified source file can be overridden via the loader context, - // allowing it to be explicitly null or a string. If it remains undefined, we fall back to - // the importing sourcemap's `sourcesContent` field. - const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null; - return OriginalSource(source, sourceContent); - }); - return MapSource(map, children); - } - - /** - * A SourceMap v3 compatible sourcemap, which only includes fields that were - * provided to it. - */ - class SourceMap { - constructor(map, options) { - const out = options.decodedMappings ? genMapping.toDecodedMap(map) : genMapping.toEncodedMap(map); - this.version = out.version; // SourceMap spec says this should be first. - this.file = out.file; - this.mappings = out.mappings; - this.names = out.names; - this.sourceRoot = out.sourceRoot; - this.sources = out.sources; - if (!options.excludeContent) { - this.sourcesContent = out.sourcesContent; - } - } - toString() { - return JSON.stringify(this); - } - } - - /** - * Traces through all the mappings in the root sourcemap, through the sources - * (and their sourcemaps), all the way back to the original source location. - * - * `loader` will be called every time we encounter a source file. If it returns - * a sourcemap, we will recurse into that sourcemap to continue the trace. If - * it returns a falsey value, that source file is treated as an original, - * unmodified source file. - * - * Pass `excludeContent` to exclude any self-containing source file content - * from the output sourcemap. - * - * Pass `decodedMappings` to receive a SourceMap with decoded (instead of - * VLQ encoded) mappings. - */ - function remapping(input, loader, options) { - const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false }; - const tree = buildSourceMapTree(input, loader); - return new SourceMap(traceMappings(tree), opts); - } - - return remapping; - -})); -//# sourceMappingURL=remapping.umd.js.map diff --git a/node_modules/@ampproject/remapping/dist/remapping.umd.js.map b/node_modules/@ampproject/remapping/dist/remapping.umd.js.map deleted file mode 100644 index 9c898880b..000000000 --- a/node_modules/@ampproject/remapping/dist/remapping.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"remapping.umd.js","sources":["../src/source-map-tree.ts","../src/build-source-map-tree.ts","../src/source-map.ts","../src/remapping.ts"],"sourcesContent":["import { GenMapping, maybeAddSegment, setSourceContent } from '@jridgewell/gen-mapping';\nimport { traceSegment, decodedMappings } from '@jridgewell/trace-mapping';\n\nimport type { TraceMap } from '@jridgewell/trace-mapping';\n\nexport type SourceMapSegmentObject = {\n column: number;\n line: number;\n name: string;\n source: string;\n content: string | null;\n};\n\nexport type OriginalSource = {\n map: null;\n sources: Sources[];\n source: string;\n content: string | null;\n};\n\nexport type MapSource = {\n map: TraceMap;\n sources: Sources[];\n source: string;\n content: null;\n};\n\nexport type Sources = OriginalSource | MapSource;\n\nconst SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null);\nconst EMPTY_SOURCES: Sources[] = [];\n\nfunction SegmentObject(\n source: string,\n line: number,\n column: number,\n name: string,\n content: string | null\n): SourceMapSegmentObject {\n return { source, line, column, name, content };\n}\n\nfunction Source(map: TraceMap, sources: Sources[], source: '', content: null): MapSource;\nfunction Source(\n map: null,\n sources: Sources[],\n source: string,\n content: string | null\n): OriginalSource;\nfunction Source(\n map: TraceMap | null,\n sources: Sources[],\n source: string | '',\n content: string | null\n): Sources {\n return {\n map,\n sources,\n source,\n content,\n } as any;\n}\n\n/**\n * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes\n * (which may themselves be SourceMapTrees).\n */\nexport function MapSource(map: TraceMap, sources: Sources[]): MapSource {\n return Source(map, sources, '', null);\n}\n\n/**\n * A \"leaf\" node in the sourcemap tree, representing an original, unmodified source file. Recursive\n * segment tracing ends at the `OriginalSource`.\n */\nexport function OriginalSource(source: string, content: string | null): OriginalSource {\n return Source(null, EMPTY_SOURCES, source, content);\n}\n\n/**\n * traceMappings is only called on the root level SourceMapTree, and begins the process of\n * resolving each mapping in terms of the original source files.\n */\nexport function traceMappings(tree: MapSource): GenMapping {\n // TODO: Eventually support sourceRoot, which has to be removed because the sources are already\n // fully resolved. We'll need to make sources relative to the sourceRoot before adding them.\n const gen = new GenMapping({ file: tree.map.file });\n const { sources: rootSources, map } = tree;\n const rootNames = map.names;\n const rootMappings = decodedMappings(map);\n\n for (let i = 0; i < rootMappings.length; i++) {\n const segments = rootMappings[i];\n\n for (let j = 0; j < segments.length; j++) {\n const segment = segments[j];\n const genCol = segment[0];\n let traced: SourceMapSegmentObject | null = SOURCELESS_MAPPING;\n\n // 1-length segments only move the current generated column, there's no source information\n // to gather from it.\n if (segment.length !== 1) {\n const source = rootSources[segment[1]];\n traced = originalPositionFor(\n source,\n segment[2],\n segment[3],\n segment.length === 5 ? rootNames[segment[4]] : ''\n );\n\n // If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a\n // respective segment into an original source.\n if (traced == null) continue;\n }\n\n const { column, line, name, content, source } = traced;\n\n maybeAddSegment(gen, i, genCol, source, line, column, name);\n if (source && content != null) setSourceContent(gen, source, content);\n }\n }\n\n return gen;\n}\n\n/**\n * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own\n * child SourceMapTrees, until we find the original source map.\n */\nexport function originalPositionFor(\n source: Sources,\n line: number,\n column: number,\n name: string\n): SourceMapSegmentObject | null {\n if (!source.map) {\n return SegmentObject(source.source, line, column, name, source.content);\n }\n\n const segment = traceSegment(source.map, line, column);\n\n // If we couldn't find a segment, then this doesn't exist in the sourcemap.\n if (segment == null) return null;\n // 1-length segments only move the current generated column, there's no source information\n // to gather from it.\n if (segment.length === 1) return SOURCELESS_MAPPING;\n\n return originalPositionFor(\n source.sources[segment[1]],\n segment[2],\n segment[3],\n segment.length === 5 ? source.map.names[segment[4]] : name\n );\n}\n","import { TraceMap } from '@jridgewell/trace-mapping';\n\nimport { OriginalSource, MapSource } from './source-map-tree';\n\nimport type { Sources, MapSource as MapSourceType } from './source-map-tree';\nimport type { SourceMapInput, SourceMapLoader, LoaderContext } from './types';\n\nfunction asArray(value: T | T[]): T[] {\n if (Array.isArray(value)) return value;\n return [value];\n}\n\n/**\n * Recursively builds a tree structure out of sourcemap files, with each node\n * being either an `OriginalSource` \"leaf\" or a `SourceMapTree` composed of\n * `OriginalSource`s and `SourceMapTree`s.\n *\n * Every sourcemap is composed of a collection of source files and mappings\n * into locations of those source files. When we generate a `SourceMapTree` for\n * the sourcemap, we attempt to load each source file's own sourcemap. If it\n * does not have an associated sourcemap, it is considered an original,\n * unmodified source file.\n */\nexport default function buildSourceMapTree(\n input: SourceMapInput | SourceMapInput[],\n loader: SourceMapLoader\n): MapSourceType {\n const maps = asArray(input).map((m) => new TraceMap(m, ''));\n const map = maps.pop()!;\n\n for (let i = 0; i < maps.length; i++) {\n if (maps[i].sources.length > 1) {\n throw new Error(\n `Transformation map ${i} must have exactly one source file.\\n` +\n 'Did you specify these with the most recent transformation maps first?'\n );\n }\n }\n\n let tree = build(map, loader, '', 0);\n for (let i = maps.length - 1; i >= 0; i--) {\n tree = MapSource(maps[i], [tree]);\n }\n return tree;\n}\n\nfunction build(\n map: TraceMap,\n loader: SourceMapLoader,\n importer: string,\n importerDepth: number\n): MapSourceType {\n const { resolvedSources, sourcesContent } = map;\n\n const depth = importerDepth + 1;\n const children = resolvedSources.map((sourceFile: string | null, i: number): Sources => {\n // The loading context gives the loader more information about why this file is being loaded\n // (eg, from which importer). It also allows the loader to override the location of the loaded\n // sourcemap/original source, or to override the content in the sourcesContent field if it's\n // an unmodified source file.\n const ctx: LoaderContext = {\n importer,\n depth,\n source: sourceFile || '',\n content: undefined,\n };\n\n // Use the provided loader callback to retrieve the file's sourcemap.\n // TODO: We should eventually support async loading of sourcemap files.\n const sourceMap = loader(ctx.source, ctx);\n\n const { source, content } = ctx;\n\n // If there is a sourcemap, then we need to recurse into it to load its source files.\n if (sourceMap) return build(new TraceMap(sourceMap, source), loader, source, depth);\n\n // Else, it's an an unmodified source file.\n // The contents of this unmodified source file can be overridden via the loader context,\n // allowing it to be explicitly null or a string. If it remains undefined, we fall back to\n // the importing sourcemap's `sourcesContent` field.\n const sourceContent =\n content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;\n return OriginalSource(source, sourceContent);\n });\n\n return MapSource(map, children);\n}\n","import { toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping';\n\nimport type { GenMapping } from '@jridgewell/gen-mapping';\nimport type { DecodedSourceMap, EncodedSourceMap, Options } from './types';\n\n/**\n * A SourceMap v3 compatible sourcemap, which only includes fields that were\n * provided to it.\n */\nexport default class SourceMap {\n declare file?: string | null;\n declare mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings'];\n declare sourceRoot?: string;\n declare names: string[];\n declare sources: (string | null)[];\n declare sourcesContent?: (string | null)[];\n declare version: 3;\n\n constructor(map: GenMapping, options: Options) {\n const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map);\n this.version = out.version; // SourceMap spec says this should be first.\n this.file = out.file;\n this.mappings = out.mappings as SourceMap['mappings'];\n this.names = out.names as SourceMap['names'];\n\n this.sourceRoot = out.sourceRoot;\n\n this.sources = out.sources as SourceMap['sources'];\n if (!options.excludeContent) {\n this.sourcesContent = out.sourcesContent as SourceMap['sourcesContent'];\n }\n }\n\n toString(): string {\n return JSON.stringify(this);\n }\n}\n","import buildSourceMapTree from './build-source-map-tree';\nimport { traceMappings } from './source-map-tree';\nimport SourceMap from './source-map';\n\nimport type { SourceMapInput, SourceMapLoader, Options } from './types';\nexport type {\n SourceMapSegment,\n EncodedSourceMap,\n EncodedSourceMap as RawSourceMap,\n DecodedSourceMap,\n SourceMapInput,\n SourceMapLoader,\n LoaderContext,\n Options,\n} from './types';\n\n/**\n * Traces through all the mappings in the root sourcemap, through the sources\n * (and their sourcemaps), all the way back to the original source location.\n *\n * `loader` will be called every time we encounter a source file. If it returns\n * a sourcemap, we will recurse into that sourcemap to continue the trace. If\n * it returns a falsey value, that source file is treated as an original,\n * unmodified source file.\n *\n * Pass `excludeContent` to exclude any self-containing source file content\n * from the output sourcemap.\n *\n * Pass `decodedMappings` to receive a SourceMap with decoded (instead of\n * VLQ encoded) mappings.\n */\nexport default function remapping(\n input: SourceMapInput | SourceMapInput[],\n loader: SourceMapLoader,\n options?: boolean | Options\n): SourceMap {\n const opts =\n typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };\n const tree = buildSourceMapTree(input, loader);\n return new SourceMap(traceMappings(tree), opts);\n}\n"],"names":["GenMapping","decodedMappings","maybeAddSegment","setSourceContent","traceSegment","TraceMap","toDecodedMap","toEncodedMap"],"mappings":";;;;;;IA6BA,MAAM,kBAAkB,mBAAmB,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC/E,MAAM,aAAa,GAAc,EAAE,CAAC;IAEpC,SAAS,aAAa,CACpB,MAAc,EACd,IAAY,EACZ,MAAc,EACd,IAAY,EACZ,OAAsB,EAAA;QA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AAI,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IAClD;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts b/node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts deleted file mode 100644 index f87fceab7..000000000 --- a/node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { MapSource as MapSourceType } from './source-map-tree'; -import type { SourceMapInput, SourceMapLoader } from './types'; -/** - * Recursively builds a tree structure out of sourcemap files, with each node - * being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of - * `OriginalSource`s and `SourceMapTree`s. - * - * Every sourcemap is composed of a collection of source files and mappings - * into locations of those source files. When we generate a `SourceMapTree` for - * the sourcemap, we attempt to load each source file's own sourcemap. If it - * does not have an associated sourcemap, it is considered an original, - * unmodified source file. - */ -export default function buildSourceMapTree(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader): MapSourceType; diff --git a/node_modules/@ampproject/remapping/dist/types/remapping.d.ts b/node_modules/@ampproject/remapping/dist/types/remapping.d.ts deleted file mode 100644 index 0b58ea9ae..000000000 --- a/node_modules/@ampproject/remapping/dist/types/remapping.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import SourceMap from './source-map'; -import type { SourceMapInput, SourceMapLoader, Options } from './types'; -export type { SourceMapSegment, EncodedSourceMap, EncodedSourceMap as RawSourceMap, DecodedSourceMap, SourceMapInput, SourceMapLoader, LoaderContext, Options, } from './types'; -/** - * Traces through all the mappings in the root sourcemap, through the sources - * (and their sourcemaps), all the way back to the original source location. - * - * `loader` will be called every time we encounter a source file. If it returns - * a sourcemap, we will recurse into that sourcemap to continue the trace. If - * it returns a falsey value, that source file is treated as an original, - * unmodified source file. - * - * Pass `excludeContent` to exclude any self-containing source file content - * from the output sourcemap. - * - * Pass `decodedMappings` to receive a SourceMap with decoded (instead of - * VLQ encoded) mappings. - */ -export default function remapping(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader, options?: boolean | Options): SourceMap; diff --git a/node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts b/node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts deleted file mode 100644 index 3a9f7af65..000000000 --- a/node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { GenMapping } from '@jridgewell/gen-mapping'; -import type { TraceMap } from '@jridgewell/trace-mapping'; -export declare type SourceMapSegmentObject = { - column: number; - line: number; - name: string; - source: string; - content: string | null; -}; -export declare type OriginalSource = { - map: null; - sources: Sources[]; - source: string; - content: string | null; -}; -export declare type MapSource = { - map: TraceMap; - sources: Sources[]; - source: string; - content: null; -}; -export declare type Sources = OriginalSource | MapSource; -/** - * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes - * (which may themselves be SourceMapTrees). - */ -export declare function MapSource(map: TraceMap, sources: Sources[]): MapSource; -/** - * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive - * segment tracing ends at the `OriginalSource`. - */ -export declare function OriginalSource(source: string, content: string | null): OriginalSource; -/** - * traceMappings is only called on the root level SourceMapTree, and begins the process of - * resolving each mapping in terms of the original source files. - */ -export declare function traceMappings(tree: MapSource): GenMapping; -/** - * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own - * child SourceMapTrees, until we find the original source map. - */ -export declare function originalPositionFor(source: Sources, line: number, column: number, name: string): SourceMapSegmentObject | null; diff --git a/node_modules/@ampproject/remapping/dist/types/source-map.d.ts b/node_modules/@ampproject/remapping/dist/types/source-map.d.ts deleted file mode 100644 index ef999b757..000000000 --- a/node_modules/@ampproject/remapping/dist/types/source-map.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { GenMapping } from '@jridgewell/gen-mapping'; -import type { DecodedSourceMap, EncodedSourceMap, Options } from './types'; -/** - * A SourceMap v3 compatible sourcemap, which only includes fields that were - * provided to it. - */ -export default class SourceMap { - file?: string | null; - mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings']; - sourceRoot?: string; - names: string[]; - sources: (string | null)[]; - sourcesContent?: (string | null)[]; - version: 3; - constructor(map: GenMapping, options: Options); - toString(): string; -} diff --git a/node_modules/@ampproject/remapping/dist/types/types.d.ts b/node_modules/@ampproject/remapping/dist/types/types.d.ts deleted file mode 100644 index 730a9637e..000000000 --- a/node_modules/@ampproject/remapping/dist/types/types.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { SourceMapInput } from '@jridgewell/trace-mapping'; -export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping'; -export type { SourceMapInput }; -export declare type LoaderContext = { - readonly importer: string; - readonly depth: number; - source: string; - content: string | null | undefined; -}; -export declare type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void; -export declare type Options = { - excludeContent?: boolean; - decodedMappings?: boolean; -}; diff --git a/node_modules/@ampproject/remapping/package.json b/node_modules/@ampproject/remapping/package.json deleted file mode 100644 index bf3dad29b..000000000 --- a/node_modules/@ampproject/remapping/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "@ampproject/remapping", - "version": "2.2.1", - "description": "Remap sequential sourcemaps through transformations to point at the original source code", - "keywords": [ - "source", - "map", - "remap" - ], - "main": "dist/remapping.umd.js", - "module": "dist/remapping.mjs", - "types": "dist/types/remapping.d.ts", - "exports": { - ".": [ - { - "types": "./dist/types/remapping.d.ts", - "browser": "./dist/remapping.umd.js", - "require": "./dist/remapping.umd.js", - "import": "./dist/remapping.mjs" - }, - "./dist/remapping.umd.js" - ], - "./package.json": "./package.json" - }, - "files": [ - "dist" - ], - "author": "Justin Ridgewell ", - "repository": { - "type": "git", - "url": "git+https://github.com/ampproject/remapping.git" - }, - "license": "Apache-2.0", - "engines": { - "node": ">=6.0.0" - }, - "scripts": { - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "prebuild": "rm -rf dist", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build", - "test": "run-s -n test:lint test:only", - "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "jest --coverage", - "test:watch": "jest --coverage --watch" - }, - "devDependencies": { - "@rollup/plugin-typescript": "8.3.2", - "@types/jest": "27.4.1", - "@typescript-eslint/eslint-plugin": "5.20.0", - "@typescript-eslint/parser": "5.20.0", - "eslint": "8.14.0", - "eslint-config-prettier": "8.5.0", - "jest": "27.5.1", - "jest-config": "27.5.1", - "npm-run-all": "4.1.5", - "prettier": "2.6.2", - "rollup": "2.70.2", - "ts-jest": "27.1.4", - "tslib": "2.4.0", - "typescript": "4.6.3" - }, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" - } -} diff --git a/node_modules/@babel/code-frame/LICENSE b/node_modules/@babel/code-frame/LICENSE deleted file mode 100644 index f31575ec7..000000000 --- a/node_modules/@babel/code-frame/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other 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/@babel/code-frame/README.md b/node_modules/@babel/code-frame/README.md deleted file mode 100644 index 08cacb047..000000000 --- a/node_modules/@babel/code-frame/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/code-frame - -> Generate errors that contain a code frame that point to source locations. - -See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/code-frame -``` - -or using yarn: - -```sh -yarn add @babel/code-frame --dev -``` diff --git a/node_modules/@babel/code-frame/lib/index.js b/node_modules/@babel/code-frame/lib/index.js deleted file mode 100644 index cf70a04ea..000000000 --- a/node_modules/@babel/code-frame/lib/index.js +++ /dev/null @@ -1,142 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.codeFrameColumns = codeFrameColumns; -exports.default = _default; -var _highlight = require("@babel/highlight"); -let deprecationWarningShown = false; -function getDefs(chalk) { - return { - gutter: chalk.grey, - marker: chalk.red.bold, - message: chalk.red.bold - }; -} -const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; -function getMarkerLines(loc, source, opts) { - const startLoc = Object.assign({ - column: 0, - line: -1 - }, loc.start); - const endLoc = Object.assign({}, startLoc, loc.end); - const { - linesAbove = 2, - linesBelow = 3 - } = opts || {}; - const startLine = startLoc.line; - const startColumn = startLoc.column; - const endLine = endLoc.line; - const endColumn = endLoc.column; - let start = Math.max(startLine - (linesAbove + 1), 0); - let end = Math.min(source.length, endLine + linesBelow); - if (startLine === -1) { - start = 0; - } - if (endLine === -1) { - end = source.length; - } - const lineDiff = endLine - startLine; - const markerLines = {}; - if (lineDiff) { - for (let i = 0; i <= lineDiff; i++) { - const lineNumber = i + startLine; - if (!startColumn) { - markerLines[lineNumber] = true; - } else if (i === 0) { - const sourceLength = source[lineNumber - 1].length; - markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1]; - } else if (i === lineDiff) { - markerLines[lineNumber] = [0, endColumn]; - } else { - const sourceLength = source[lineNumber - i].length; - markerLines[lineNumber] = [0, sourceLength]; - } - } - } else { - if (startColumn === endColumn) { - if (startColumn) { - markerLines[startLine] = [startColumn, 0]; - } else { - markerLines[startLine] = true; - } - } else { - markerLines[startLine] = [startColumn, endColumn - startColumn]; - } - } - return { - start, - end, - markerLines - }; -} -function codeFrameColumns(rawLines, loc, opts = {}) { - const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts); - const chalk = (0, _highlight.getChalk)(opts); - const defs = getDefs(chalk); - const maybeHighlight = (chalkFn, string) => { - return highlighted ? chalkFn(string) : string; - }; - const lines = rawLines.split(NEWLINE); - const { - start, - end, - markerLines - } = getMarkerLines(loc, lines, opts); - const hasColumns = loc.start && typeof loc.start.column === "number"; - const numberMaxWidth = String(end).length; - const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines; - let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => { - const number = start + 1 + index; - const paddedNumber = ` ${number}`.slice(-numberMaxWidth); - const gutter = ` ${paddedNumber} |`; - const hasMarker = markerLines[number]; - const lastMarkerLine = !markerLines[number + 1]; - if (hasMarker) { - let markerLine = ""; - if (Array.isArray(hasMarker)) { - const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " "); - const numberOfMarkers = hasMarker[1] || 1; - markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join(""); - if (lastMarkerLine && opts.message) { - markerLine += " " + maybeHighlight(defs.message, opts.message); - } - } - return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join(""); - } else { - return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`; - } - }).join("\n"); - if (opts.message && !hasColumns) { - frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`; - } - if (highlighted) { - return chalk.reset(frame); - } else { - return frame; - } -} -function _default(rawLines, lineNumber, colNumber, opts = {}) { - if (!deprecationWarningShown) { - deprecationWarningShown = true; - const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`."; - if (process.emitWarning) { - process.emitWarning(message, "DeprecationWarning"); - } else { - const deprecationError = new Error(message); - deprecationError.name = "DeprecationWarning"; - console.warn(new Error(message)); - } - } - colNumber = Math.max(colNumber, 0); - const location = { - start: { - column: colNumber, - line: lineNumber - } - }; - return codeFrameColumns(rawLines, location, opts); -} - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/code-frame/lib/index.js.map b/node_modules/@babel/code-frame/lib/index.js.map deleted file mode 100644 index 68d399e1c..000000000 --- a/node_modules/@babel/code-frame/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_highlight","require","deprecationWarningShown","getDefs","chalk","gutter","grey","marker","red","bold","message","NEWLINE","getMarkerLines","loc","source","opts","startLoc","Object","assign","column","line","start","endLoc","end","linesAbove","linesBelow","startLine","startColumn","endLine","endColumn","Math","max","min","length","lineDiff","markerLines","i","lineNumber","sourceLength","codeFrameColumns","rawLines","highlighted","highlightCode","forceColor","shouldHighlight","getChalk","defs","maybeHighlight","chalkFn","string","lines","split","hasColumns","numberMaxWidth","String","highlightedLines","highlight","frame","slice","map","index","number","paddedNumber","hasMarker","lastMarkerLine","markerLine","Array","isArray","markerSpacing","replace","numberOfMarkers","repeat","join","reset","_default","colNumber","process","emitWarning","deprecationError","Error","name","console","warn","location"],"sources":["../src/index.ts"],"sourcesContent":["import highlight, { shouldHighlight, getChalk } from \"@babel/highlight\";\n\ntype Chalk = ReturnType;\n\nlet deprecationWarningShown = false;\n\ntype Location = {\n column: number;\n line: number;\n};\n\ntype NodeLocation = {\n end?: Location;\n start: Location;\n};\n\nexport interface Options {\n /** Syntax highlight the code as JavaScript for terminals. default: false */\n highlightCode?: boolean;\n /** The number of lines to show above the error. default: 2 */\n linesAbove?: number;\n /** The number of lines to show below the error. default: 3 */\n linesBelow?: number;\n /**\n * Forcibly syntax highlight the code as JavaScript (for non-terminals);\n * overrides highlightCode.\n * default: false\n */\n forceColor?: boolean;\n /**\n * Pass in a string to be displayed inline (if possible) next to the\n * highlighted location in the code. If it can't be positioned inline,\n * it will be placed above the code frame.\n * default: nothing\n */\n message?: string;\n}\n\n/**\n * Chalk styles for code frame token types.\n */\nfunction getDefs(chalk: Chalk) {\n return {\n gutter: chalk.grey,\n marker: chalk.red.bold,\n message: chalk.red.bold,\n };\n}\n\n/**\n * RegExp to test for newlines in terminal.\n */\n\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/;\n\n/**\n * Extract what lines should be marked and highlighted.\n */\n\ntype MarkerLines = Record;\n\nfunction getMarkerLines(\n loc: NodeLocation,\n source: Array,\n opts: Options,\n): {\n start: number;\n end: number;\n markerLines: MarkerLines;\n} {\n const startLoc: Location = {\n column: 0,\n line: -1,\n ...loc.start,\n };\n const endLoc: Location = {\n ...startLoc,\n ...loc.end,\n };\n const { linesAbove = 2, linesBelow = 3 } = opts || {};\n const startLine = startLoc.line;\n const startColumn = startLoc.column;\n const endLine = endLoc.line;\n const endColumn = endLoc.column;\n\n let start = Math.max(startLine - (linesAbove + 1), 0);\n let end = Math.min(source.length, endLine + linesBelow);\n\n if (startLine === -1) {\n start = 0;\n }\n\n if (endLine === -1) {\n end = source.length;\n }\n\n const lineDiff = endLine - startLine;\n const markerLines: MarkerLines = {};\n\n if (lineDiff) {\n for (let i = 0; i <= lineDiff; i++) {\n const lineNumber = i + startLine;\n\n if (!startColumn) {\n markerLines[lineNumber] = true;\n } else if (i === 0) {\n const sourceLength = source[lineNumber - 1].length;\n\n markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];\n } else if (i === lineDiff) {\n markerLines[lineNumber] = [0, endColumn];\n } else {\n const sourceLength = source[lineNumber - i].length;\n\n markerLines[lineNumber] = [0, sourceLength];\n }\n }\n } else {\n if (startColumn === endColumn) {\n if (startColumn) {\n markerLines[startLine] = [startColumn, 0];\n } else {\n markerLines[startLine] = true;\n }\n } else {\n markerLines[startLine] = [startColumn, endColumn - startColumn];\n }\n }\n\n return { start, end, markerLines };\n}\n\nexport function codeFrameColumns(\n rawLines: string,\n loc: NodeLocation,\n opts: Options = {},\n): string {\n const highlighted =\n (opts.highlightCode || opts.forceColor) && shouldHighlight(opts);\n const chalk = getChalk(opts);\n const defs = getDefs(chalk);\n const maybeHighlight = (chalkFn: Chalk, string: string) => {\n return highlighted ? chalkFn(string) : string;\n };\n const lines = rawLines.split(NEWLINE);\n const { start, end, markerLines } = getMarkerLines(loc, lines, opts);\n const hasColumns = loc.start && typeof loc.start.column === \"number\";\n\n const numberMaxWidth = String(end).length;\n\n const highlightedLines = highlighted ? highlight(rawLines, opts) : rawLines;\n\n let frame = highlightedLines\n .split(NEWLINE, end)\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth);\n const gutter = ` ${paddedNumber} |`;\n const hasMarker = markerLines[number];\n const lastMarkerLine = !markerLines[number + 1];\n if (hasMarker) {\n let markerLine = \"\";\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line\n .slice(0, Math.max(hasMarker[0] - 1, 0))\n .replace(/[^\\t]/g, \" \");\n const numberOfMarkers = hasMarker[1] || 1;\n\n markerLine = [\n \"\\n \",\n maybeHighlight(defs.gutter, gutter.replace(/\\d/g, \" \")),\n \" \",\n markerSpacing,\n maybeHighlight(defs.marker, \"^\").repeat(numberOfMarkers),\n ].join(\"\");\n\n if (lastMarkerLine && opts.message) {\n markerLine += \" \" + maybeHighlight(defs.message, opts.message);\n }\n }\n return [\n maybeHighlight(defs.marker, \">\"),\n maybeHighlight(defs.gutter, gutter),\n line.length > 0 ? ` ${line}` : \"\",\n markerLine,\n ].join(\"\");\n } else {\n return ` ${maybeHighlight(defs.gutter, gutter)}${\n line.length > 0 ? ` ${line}` : \"\"\n }`;\n }\n })\n .join(\"\\n\");\n\n if (opts.message && !hasColumns) {\n frame = `${\" \".repeat(numberMaxWidth + 1)}${opts.message}\\n${frame}`;\n }\n\n if (highlighted) {\n return chalk.reset(frame);\n } else {\n return frame;\n }\n}\n\n/**\n * Create a code frame, adding line numbers, code highlighting, and pointing to a given position.\n */\n\nexport default function (\n rawLines: string,\n lineNumber: number,\n colNumber?: number | null,\n opts: Options = {},\n): string {\n if (!deprecationWarningShown) {\n deprecationWarningShown = true;\n\n const message =\n \"Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.\";\n\n if (process.emitWarning) {\n // A string is directly supplied to emitWarning, because when supplying an\n // Error object node throws in the tests because of different contexts\n process.emitWarning(message, \"DeprecationWarning\");\n } else {\n const deprecationError = new Error(message);\n deprecationError.name = \"DeprecationWarning\";\n console.warn(new Error(message));\n }\n }\n\n colNumber = Math.max(colNumber, 0);\n\n const location: NodeLocation = {\n start: { column: colNumber, line: lineNumber },\n };\n\n return codeFrameColumns(rawLines, location, opts);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAIA,IAAIC,uBAAuB,GAAG,KAAK;AAqCnC,SAASC,OAAOA,CAACC,KAAY,EAAE;EAC7B,OAAO;IACLC,MAAM,EAAED,KAAK,CAACE,IAAI;IAClBC,MAAM,EAAEH,KAAK,CAACI,GAAG,CAACC,IAAI;IACtBC,OAAO,EAAEN,KAAK,CAACI,GAAG,CAACC;EACrB,CAAC;AACH;AAMA,MAAME,OAAO,GAAG,yBAAyB;AAQzC,SAASC,cAAcA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AE;IAC/BK,KAAK,GAAI,GAAE,GAAG,CAACc,MAAM,CAAClB,cAAc,GAAG,CAAC,CAAE,GAAEtC,IAAI,CAACL,OAAQ,KAAI+C,KAAM,EAAC;EACtE;EAEA,IAAIhB,WAAW,EAAE;IACf,OAAOrC,KAAK,CAACqE,KAAK,CAAChB,KAAK,CAAC;EAC3B,CAAC,MAAM;IACL,OAAOA,KAAK;EACd;AACF;AAMe,SAAAiB,SACblC,QAAgB,EAChBH,UAAkB,EAClBsC,SAAyB,EACzB5D,IAAa,GAAG,CAAC,CAAC,EACV;EACR,IAAI,CAACb,uBAAuB,EAAE;IAC5BA,uBAAuB,GAAG,IAAI;IAE9B,MAAMQ,OAAO,GACX,qGAAqG;IAEvG,IAAIkE,OAAO,CAACC,WAAW,EAAE;MAGvBD,OAAO,CAACC,WAAW,CAACnE,OAAO,EAAE,oBAAoB,CAAC;IACpD,CAAC,MAAM;MACL,MAAMoE,gBAAgB,GAAG,IAAIC,KAAK,CAACrE,OAAO,CAAC;MAC3CoE,gBAAgB,CAACE,IAAI,GAAG,oBAAoB;MAC5CC,OAAO,CAACC,IAAI,CAAC,IAAIH,KAAK,CAACrE,OAAO,CAAC,CAAC;IAClC;EACF;EAEAiE,SAAS,GAAG7C,IAAI,CAACC,GAAG,CAAC4C,SAAS,EAAE,CAAC,CAAC;EAElC,MAAMQ,QAAsB,GAAG;IAC7B9D,KAAK,EAAE;MAAEF,MAAM,EAAEwD,SAAS;MAAEvD,IAAI,EAAEiB;IAAW;EAC/C,CAAC;EAED,OAAOE,gBAAgB,CAACC,QAAQ,EAAE2C,QAAQ,EAAEpE,IAAI,CAAC;AACnD"} \ No newline at end of file diff --git a/node_modules/@babel/code-frame/package.json b/node_modules/@babel/code-frame/package.json deleted file mode 100644 index 34b8f5ada..000000000 --- a/node_modules/@babel/code-frame/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@babel/code-frame", - "version": "7.21.4", - "description": "Generate errors that contain a code frame that point to source locations.", - "author": "The Babel Team (https://babel.dev/team)", - "homepage": "https://babel.dev/docs/en/next/babel-code-frame", - "bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-code-frame" - }, - "main": "./lib/index.js", - "dependencies": { - "@babel/highlight": "^7.18.6" - }, - "devDependencies": { - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "type": "commonjs" -} \ No newline at end of file diff --git a/node_modules/@babel/compat-data/LICENSE b/node_modules/@babel/compat-data/LICENSE deleted file mode 100644 index f31575ec7..000000000 --- a/node_modules/@babel/compat-data/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other 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/@babel/compat-data/README.md b/node_modules/@babel/compat-data/README.md deleted file mode 100644 index 9f3abdece..000000000 --- a/node_modules/@babel/compat-data/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/compat-data - -> - -See our website [@babel/compat-data](https://babeljs.io/docs/en/babel-compat-data) for more information. - -## Install - -Using npm: - -```sh -npm install --save @babel/compat-data -``` - -or using yarn: - -```sh -yarn add @babel/compat-data -``` diff --git a/node_modules/@babel/compat-data/corejs2-built-ins.js b/node_modules/@babel/compat-data/corejs2-built-ins.js deleted file mode 100644 index ed19e0b8a..000000000 --- a/node_modules/@babel/compat-data/corejs2-built-ins.js +++ /dev/null @@ -1,2 +0,0 @@ -// Todo (Babel 8): remove this file as Babel 8 drop support of core-js 2 -module.exports = require("./data/corejs2-built-ins.json"); diff --git a/node_modules/@babel/compat-data/corejs3-shipped-proposals.js b/node_modules/@babel/compat-data/corejs3-shipped-proposals.js deleted file mode 100644 index 7909b8c46..000000000 --- a/node_modules/@babel/compat-data/corejs3-shipped-proposals.js +++ /dev/null @@ -1,2 +0,0 @@ -// Todo (Babel 8): remove this file now that it is included in babel-plugin-polyfill-corejs3 -module.exports = require("./data/corejs3-shipped-proposals.json"); diff --git a/node_modules/@babel/compat-data/data/corejs2-built-ins.json b/node_modules/@babel/compat-data/data/corejs2-built-ins.json deleted file mode 100644 index bf3be88e4..000000000 --- a/node_modules/@babel/compat-data/data/corejs2-built-ins.json +++ /dev/null @@ -1,1935 +0,0 @@ -{ - "es6.array.copy-within": { - "chrome": "45", - "opera": "32", - "edge": "12", - "firefox": "32", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "5", - "rhino": "1.7.13", - "electron": "0.31" - }, - "es6.array.every": { - "chrome": "5", - "opera": "10.10", - "edge": "12", - "firefox": "2", - "safari": "3.1", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.array.fill": { - "chrome": "45", - "opera": "32", - "edge": "12", - "firefox": "31", - "safari": "7.1", - "node": "4", - "deno": "1", - "ios": "8", - "samsung": "5", - "rhino": "1.7.13", - "electron": "0.31" - }, - "es6.array.filter": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.array.find": { - "chrome": "45", - "opera": "32", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "4", - "deno": "1", - "ios": "8", - "samsung": "5", - "rhino": "1.7.13", - "electron": "0.31" - }, - "es6.array.find-index": { - "chrome": "45", - "opera": "32", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "4", - "deno": "1", - "ios": "8", - "samsung": "5", - "rhino": "1.7.13", - "electron": "0.31" - }, - "es7.array.flat-map": { - "chrome": "69", - "opera": "56", - "edge": "79", - "firefox": "62", - "safari": "12", - "node": "11", - "deno": "1", - "ios": "12", - "samsung": "10", - "electron": "4.0" - }, - "es6.array.for-each": { - "chrome": "5", - "opera": "10.10", - "edge": "12", - "firefox": "2", - "safari": "3.1", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.array.from": { - "chrome": "51", - "opera": "38", - "edge": "15", - "firefox": "36", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es7.array.includes": { - "chrome": "47", - "opera": "34", - "edge": "14", - "firefox": "102", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.36" - }, - "es6.array.index-of": { - "chrome": "5", - "opera": "10.10", - "edge": "12", - "firefox": "2", - "safari": "3.1", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.array.is-array": { - "chrome": "5", - "opera": "10.50", - "edge": "12", - "firefox": "4", - "safari": "4", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.array.iterator": { - "chrome": "66", - "opera": "53", - "edge": "12", - "firefox": "60", - "safari": "9", - "node": "10", - "deno": "1", - "ios": "9", - "samsung": "9", - "rhino": "1.7.13", - "electron": "3.0" - }, - "es6.array.last-index-of": { - "chrome": "5", - "opera": "10.10", - "edge": "12", - "firefox": "2", - "safari": "3.1", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.array.map": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.array.of": { - "chrome": "45", - "opera": "32", - "edge": "12", - "firefox": "25", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "5", - "rhino": "1.7.13", - "electron": "0.31" - }, - "es6.array.reduce": { - "chrome": "5", - "opera": "10.50", - "edge": "12", - "firefox": "3", - "safari": "4", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.array.reduce-right": { - "chrome": "5", - "opera": "10.50", - "edge": "12", - "firefox": "3", - "safari": "4", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.array.slice": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.array.some": { - "chrome": "5", - "opera": "10.10", - "edge": "12", - "firefox": "2", - "safari": "3.1", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.array.sort": { - "chrome": "63", - "opera": "50", - "edge": "12", - "firefox": "5", - "safari": "12", - "node": "10", - "deno": "1", - "ie": "9", - "ios": "12", - "samsung": "8", - "rhino": "1.7.13", - "electron": "3.0" - }, - "es6.array.species": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.date.now": { - "chrome": "5", - "opera": "10.50", - "edge": "12", - "firefox": "2", - "safari": "4", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.date.to-iso-string": { - "chrome": "5", - "opera": "10.50", - "edge": "12", - "firefox": "3.5", - "safari": "4", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.date.to-json": { - "chrome": "5", - "opera": "12.10", - "edge": "12", - "firefox": "4", - "safari": "10", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "10", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.date.to-primitive": { - "chrome": "47", - "opera": "34", - "edge": "15", - "firefox": "44", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.36" - }, - "es6.date.to-string": { - "chrome": "5", - "opera": "10.50", - "edge": "12", - "firefox": "2", - "safari": "3.1", - "node": "0.4", - "deno": "1", - "ie": "10", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.function.bind": { - "chrome": "7", - "opera": "12", - "edge": "12", - "firefox": "4", - "safari": "5.1", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.function.has-instance": { - "chrome": "51", - "opera": "38", - "edge": "15", - "firefox": "50", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.function.name": { - "chrome": "5", - "opera": "10.50", - "edge": "14", - "firefox": "2", - "safari": "4", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.map": { - "chrome": "51", - "opera": "38", - "edge": "15", - "firefox": "53", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.math.acosh": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.asinh": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.atanh": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.cbrt": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.clz32": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "31", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.cosh": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.expm1": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.fround": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "26", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.hypot": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "27", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.imul": { - "chrome": "30", - "opera": "17", - "edge": "12", - "firefox": "23", - "safari": "7", - "node": "0.12", - "deno": "1", - "android": "4.4", - "ios": "7", - "samsung": "2", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.log1p": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.log10": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.log2": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.sign": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.sinh": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.tanh": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.math.trunc": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "25", - "safari": "7.1", - "node": "0.12", - "deno": "1", - "ios": "8", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.number.constructor": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "36", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.13", - "electron": "0.21" - }, - "es6.number.epsilon": { - "chrome": "34", - "opera": "21", - "edge": "12", - "firefox": "25", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "2", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.number.is-finite": { - "chrome": "19", - "opera": "15", - "edge": "12", - "firefox": "16", - "safari": "9", - "node": "0.8", - "deno": "1", - "android": "4.1", - "ios": "9", - "samsung": "1.5", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.number.is-integer": { - "chrome": "34", - "opera": "21", - "edge": "12", - "firefox": "16", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "2", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.number.is-nan": { - "chrome": "19", - "opera": "15", - "edge": "12", - "firefox": "15", - "safari": "9", - "node": "0.8", - "deno": "1", - "android": "4.1", - "ios": "9", - "samsung": "1.5", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.number.is-safe-integer": { - "chrome": "34", - "opera": "21", - "edge": "12", - "firefox": "32", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "2", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.number.max-safe-integer": { - "chrome": "34", - "opera": "21", - "edge": "12", - "firefox": "31", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "2", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.number.min-safe-integer": { - "chrome": "34", - "opera": "21", - "edge": "12", - "firefox": "31", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "2", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.number.parse-float": { - "chrome": "34", - "opera": "21", - "edge": "12", - "firefox": "25", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "2", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.number.parse-int": { - "chrome": "34", - "opera": "21", - "edge": "12", - "firefox": "25", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "2", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.object.assign": { - "chrome": "49", - "opera": "36", - "edge": "13", - "firefox": "36", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.object.create": { - "chrome": "5", - "opera": "12", - "edge": "12", - "firefox": "4", - "safari": "4", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es7.object.define-getter": { - "chrome": "62", - "opera": "49", - "edge": "16", - "firefox": "48", - "safari": "9", - "node": "8.10", - "deno": "1", - "ios": "9", - "samsung": "8", - "electron": "3.0" - }, - "es7.object.define-setter": { - "chrome": "62", - "opera": "49", - "edge": "16", - "firefox": "48", - "safari": "9", - "node": "8.10", - "deno": "1", - "ios": "9", - "samsung": "8", - "electron": "3.0" - }, - "es6.object.define-property": { - "chrome": "5", - "opera": "12", - "edge": "12", - "firefox": "4", - "safari": "5.1", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.object.define-properties": { - "chrome": "5", - "opera": "12", - "edge": "12", - "firefox": "4", - "safari": "4", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es7.object.entries": { - "chrome": "54", - "opera": "41", - "edge": "14", - "firefox": "47", - "safari": "10.1", - "node": "7", - "deno": "1", - "ios": "10.3", - "samsung": "6", - "rhino": "1.7.14", - "electron": "1.4" - }, - "es6.object.freeze": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "35", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "rhino": "1.7.13", - "electron": "0.30" - }, - "es6.object.get-own-property-descriptor": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "35", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "rhino": "1.7.13", - "electron": "0.30" - }, - "es7.object.get-own-property-descriptors": { - "chrome": "54", - "opera": "41", - "edge": "15", - "firefox": "50", - "safari": "10.1", - "node": "7", - "deno": "1", - "ios": "10.3", - "samsung": "6", - "electron": "1.4" - }, - "es6.object.get-own-property-names": { - "chrome": "40", - "opera": "27", - "edge": "12", - "firefox": "33", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.13", - "electron": "0.21" - }, - "es6.object.get-prototype-of": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "35", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "rhino": "1.7.13", - "electron": "0.30" - }, - "es7.object.lookup-getter": { - "chrome": "62", - "opera": "49", - "edge": "79", - "firefox": "36", - "safari": "9", - "node": "8.10", - "deno": "1", - "ios": "9", - "samsung": "8", - "electron": "3.0" - }, - "es7.object.lookup-setter": { - "chrome": "62", - "opera": "49", - "edge": "79", - "firefox": "36", - "safari": "9", - "node": "8.10", - "deno": "1", - "ios": "9", - "samsung": "8", - "electron": "3.0" - }, - "es6.object.prevent-extensions": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "35", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "rhino": "1.7.13", - "electron": "0.30" - }, - "es6.object.to-string": { - "chrome": "57", - "opera": "44", - "edge": "15", - "firefox": "51", - "safari": "10", - "node": "8", - "deno": "1", - "ios": "10", - "samsung": "7", - "electron": "1.7" - }, - "es6.object.is": { - "chrome": "19", - "opera": "15", - "edge": "12", - "firefox": "22", - "safari": "9", - "node": "0.8", - "deno": "1", - "android": "4.1", - "ios": "9", - "samsung": "1.5", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.object.is-frozen": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "35", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "rhino": "1.7.13", - "electron": "0.30" - }, - "es6.object.is-sealed": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "35", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "rhino": "1.7.13", - "electron": "0.30" - }, - "es6.object.is-extensible": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "35", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "rhino": "1.7.13", - "electron": "0.30" - }, - "es6.object.keys": { - "chrome": "40", - "opera": "27", - "edge": "12", - "firefox": "35", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.13", - "electron": "0.21" - }, - "es6.object.seal": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "35", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "rhino": "1.7.13", - "electron": "0.30" - }, - "es6.object.set-prototype-of": { - "chrome": "34", - "opera": "21", - "edge": "12", - "firefox": "31", - "safari": "9", - "node": "0.12", - "deno": "1", - "ie": "11", - "ios": "9", - "samsung": "2", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es7.object.values": { - "chrome": "54", - "opera": "41", - "edge": "14", - "firefox": "47", - "safari": "10.1", - "node": "7", - "deno": "1", - "ios": "10.3", - "samsung": "6", - "rhino": "1.7.14", - "electron": "1.4" - }, - "es6.promise": { - "chrome": "51", - "opera": "38", - "edge": "14", - "firefox": "45", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es7.promise.finally": { - "chrome": "63", - "opera": "50", - "edge": "18", - "firefox": "58", - "safari": "11.1", - "node": "10", - "deno": "1", - "ios": "11.3", - "samsung": "8", - "electron": "3.0" - }, - "es6.reflect.apply": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.construct": { - "chrome": "49", - "opera": "36", - "edge": "13", - "firefox": "49", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.define-property": { - "chrome": "49", - "opera": "36", - "edge": "13", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.delete-property": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.get": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.get-own-property-descriptor": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.get-prototype-of": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.has": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.is-extensible": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.own-keys": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.prevent-extensions": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.set": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.reflect.set-prototype-of": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "42", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "es6.regexp.constructor": { - "chrome": "50", - "opera": "37", - "edge": "79", - "firefox": "40", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.1" - }, - "es6.regexp.flags": { - "chrome": "49", - "opera": "36", - "edge": "79", - "firefox": "37", - "safari": "9", - "node": "6", - "deno": "1", - "ios": "9", - "samsung": "5", - "electron": "0.37" - }, - "es6.regexp.match": { - "chrome": "50", - "opera": "37", - "edge": "79", - "firefox": "49", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "rhino": "1.7.13", - "electron": "1.1" - }, - "es6.regexp.replace": { - "chrome": "50", - "opera": "37", - "edge": "79", - "firefox": "49", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.1" - }, - "es6.regexp.split": { - "chrome": "50", - "opera": "37", - "edge": "79", - "firefox": "49", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.1" - }, - "es6.regexp.search": { - "chrome": "50", - "opera": "37", - "edge": "79", - "firefox": "49", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "rhino": "1.7.13", - "electron": "1.1" - }, - "es6.regexp.to-string": { - "chrome": "50", - "opera": "37", - "edge": "79", - "firefox": "39", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.1" - }, - "es6.set": { - "chrome": "51", - "opera": "38", - "edge": "15", - "firefox": "53", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.symbol": { - "chrome": "51", - "opera": "38", - "edge": "79", - "firefox": "51", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es7.symbol.async-iterator": { - "chrome": "63", - "opera": "50", - "edge": "79", - "firefox": "57", - "safari": "12", - "node": "10", - "deno": "1", - "ios": "12", - "samsung": "8", - "electron": "3.0" - }, - "es6.string.anchor": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.big": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.blink": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.bold": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.code-point-at": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "29", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.13", - "electron": "0.21" - }, - "es6.string.ends-with": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "29", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.13", - "electron": "0.21" - }, - "es6.string.fixed": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.fontcolor": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.fontsize": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.from-code-point": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "29", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.13", - "electron": "0.21" - }, - "es6.string.includes": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "40", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.13", - "electron": "0.21" - }, - "es6.string.italics": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.iterator": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "36", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.string.link": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es7.string.pad-start": { - "chrome": "57", - "opera": "44", - "edge": "15", - "firefox": "48", - "safari": "10", - "node": "8", - "deno": "1", - "ios": "10", - "samsung": "7", - "rhino": "1.7.13", - "electron": "1.7" - }, - "es7.string.pad-end": { - "chrome": "57", - "opera": "44", - "edge": "15", - "firefox": "48", - "safari": "10", - "node": "8", - "deno": "1", - "ios": "10", - "samsung": "7", - "rhino": "1.7.13", - "electron": "1.7" - }, - "es6.string.raw": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "34", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.14", - "electron": "0.21" - }, - "es6.string.repeat": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "24", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.13", - "electron": "0.21" - }, - "es6.string.small": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.starts-with": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "29", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "rhino": "1.7.13", - "electron": "0.21" - }, - "es6.string.strike": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.sub": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.sup": { - "chrome": "5", - "opera": "15", - "edge": "12", - "firefox": "17", - "safari": "6", - "node": "0.4", - "deno": "1", - "android": "4", - "ios": "7", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.14", - "electron": "0.20" - }, - "es6.string.trim": { - "chrome": "5", - "opera": "10.50", - "edge": "12", - "firefox": "3.5", - "safari": "4", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es7.string.trim-left": { - "chrome": "66", - "opera": "53", - "edge": "79", - "firefox": "61", - "safari": "12", - "node": "10", - "deno": "1", - "ios": "12", - "samsung": "9", - "rhino": "1.7.13", - "electron": "3.0" - }, - "es7.string.trim-right": { - "chrome": "66", - "opera": "53", - "edge": "79", - "firefox": "61", - "safari": "12", - "node": "10", - "deno": "1", - "ios": "12", - "samsung": "9", - "rhino": "1.7.13", - "electron": "3.0" - }, - "es6.typed.array-buffer": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.typed.data-view": { - "chrome": "5", - "opera": "12", - "edge": "12", - "firefox": "15", - "safari": "5.1", - "node": "0.4", - "deno": "1", - "ie": "10", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "es6.typed.int8-array": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.typed.uint8-array": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.typed.uint8-clamped-array": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.typed.int16-array": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.typed.uint16-array": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.typed.int32-array": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.typed.uint32-array": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.typed.float32-array": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.typed.float64-array": { - "chrome": "51", - "opera": "38", - "edge": "13", - "firefox": "48", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "es6.weak-map": { - "chrome": "51", - "opera": "38", - "edge": "15", - "firefox": "53", - "safari": "9", - "node": "6.5", - "deno": "1", - "ios": "9", - "samsung": "5", - "electron": "1.2" - }, - "es6.weak-set": { - "chrome": "51", - "opera": "38", - "edge": "15", - "firefox": "53", - "safari": "9", - "node": "6.5", - "deno": "1", - "ios": "9", - "samsung": "5", - "electron": "1.2" - } -} diff --git a/node_modules/@babel/compat-data/data/corejs3-shipped-proposals.json b/node_modules/@babel/compat-data/data/corejs3-shipped-proposals.json deleted file mode 100644 index d03b698ff..000000000 --- a/node_modules/@babel/compat-data/data/corejs3-shipped-proposals.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "esnext.promise.all-settled", - "esnext.string.match-all", - "esnext.global-this" -] diff --git a/node_modules/@babel/compat-data/data/native-modules.json b/node_modules/@babel/compat-data/data/native-modules.json deleted file mode 100644 index bf634997e..000000000 --- a/node_modules/@babel/compat-data/data/native-modules.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "es6.module": { - "chrome": "61", - "and_chr": "61", - "edge": "16", - "firefox": "60", - "and_ff": "60", - "node": "13.2.0", - "opera": "48", - "op_mob": "48", - "safari": "10.1", - "ios": "10.3", - "samsung": "8.2", - "android": "61", - "electron": "2.0", - "ios_saf": "10.3" - } -} diff --git a/node_modules/@babel/compat-data/data/overlapping-plugins.json b/node_modules/@babel/compat-data/data/overlapping-plugins.json deleted file mode 100644 index 94fda05db..000000000 --- a/node_modules/@babel/compat-data/data/overlapping-plugins.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "transform-async-to-generator": [ - "bugfix/transform-async-arrows-in-class" - ], - "transform-parameters": [ - "bugfix/transform-edge-default-parameters", - "bugfix/transform-safari-id-destructuring-collision-in-function-expression" - ], - "transform-function-name": [ - "bugfix/transform-edge-function-name" - ], - "transform-block-scoping": [ - "bugfix/transform-safari-block-shadowing", - "bugfix/transform-safari-for-shadowing" - ], - "transform-template-literals": [ - "bugfix/transform-tagged-template-caching" - ], - "transform-optional-chaining": [ - "bugfix/transform-v8-spread-parameters-in-optional-chaining" - ], - "proposal-optional-chaining": [ - "bugfix/transform-v8-spread-parameters-in-optional-chaining" - ] -} diff --git a/node_modules/@babel/compat-data/data/plugin-bugfixes.json b/node_modules/@babel/compat-data/data/plugin-bugfixes.json deleted file mode 100644 index 57ab95d8b..000000000 --- a/node_modules/@babel/compat-data/data/plugin-bugfixes.json +++ /dev/null @@ -1,184 +0,0 @@ -{ - "bugfix/transform-async-arrows-in-class": { - "chrome": "55", - "opera": "42", - "edge": "15", - "firefox": "52", - "safari": "11", - "node": "7.6", - "deno": "1", - "ios": "11", - "samsung": "6", - "electron": "1.6" - }, - "bugfix/transform-edge-default-parameters": { - "chrome": "49", - "opera": "36", - "edge": "18", - "firefox": "52", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "bugfix/transform-edge-function-name": { - "chrome": "51", - "opera": "38", - "edge": "79", - "firefox": "53", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "bugfix/transform-safari-block-shadowing": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "44", - "safari": "11", - "node": "6", - "deno": "1", - "ie": "11", - "ios": "11", - "samsung": "5", - "electron": "0.37" - }, - "bugfix/transform-safari-for-shadowing": { - "chrome": "49", - "opera": "36", - "edge": "12", - "firefox": "4", - "safari": "11", - "node": "6", - "deno": "1", - "ie": "11", - "ios": "11", - "samsung": "5", - "rhino": "1.7.13", - "electron": "0.37" - }, - "bugfix/transform-safari-id-destructuring-collision-in-function-expression": { - "chrome": "49", - "opera": "36", - "edge": "14", - "firefox": "2", - "node": "6", - "deno": "1", - "samsung": "5", - "electron": "0.37" - }, - "bugfix/transform-tagged-template-caching": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "34", - "safari": "13", - "node": "4", - "deno": "1", - "ios": "13", - "samsung": "3.4", - "rhino": "1.7.14", - "electron": "0.21" - }, - "bugfix/transform-v8-spread-parameters-in-optional-chaining": { - "chrome": "91", - "opera": "77", - "edge": "91", - "firefox": "74", - "safari": "13.1", - "node": "16.9", - "deno": "1.9", - "ios": "13.4", - "samsung": "16", - "electron": "13.0" - }, - "transform-optional-chaining": { - "chrome": "80", - "opera": "67", - "edge": "80", - "firefox": "74", - "safari": "13.1", - "node": "14", - "deno": "1", - "ios": "13.4", - "samsung": "13", - "electron": "8.0" - }, - "proposal-optional-chaining": { - "chrome": "80", - "opera": "67", - "edge": "80", - "firefox": "74", - "safari": "13.1", - "node": "14", - "deno": "1", - "ios": "13.4", - "samsung": "13", - "electron": "8.0" - }, - "transform-parameters": { - "chrome": "49", - "opera": "36", - "edge": "15", - "firefox": "53", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "transform-async-to-generator": { - "chrome": "55", - "opera": "42", - "edge": "15", - "firefox": "52", - "safari": "10.1", - "node": "7.6", - "deno": "1", - "ios": "10.3", - "samsung": "6", - "electron": "1.6" - }, - "transform-template-literals": { - "chrome": "41", - "opera": "28", - "edge": "13", - "firefox": "34", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "electron": "0.21" - }, - "transform-function-name": { - "chrome": "51", - "opera": "38", - "edge": "14", - "firefox": "53", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "transform-block-scoping": { - "chrome": "49", - "opera": "36", - "edge": "14", - "firefox": "51", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - } -} diff --git a/node_modules/@babel/compat-data/data/plugins.json b/node_modules/@babel/compat-data/data/plugins.json deleted file mode 100644 index 6d69c7984..000000000 --- a/node_modules/@babel/compat-data/data/plugins.json +++ /dev/null @@ -1,691 +0,0 @@ -{ - "transform-class-static-block": { - "chrome": "94", - "opera": "80", - "edge": "94", - "firefox": "93", - "node": "16.11", - "deno": "1.14", - "samsung": "17", - "electron": "15.0" - }, - "proposal-class-static-block": { - "chrome": "94", - "opera": "80", - "edge": "94", - "firefox": "93", - "node": "16.11", - "deno": "1.14", - "samsung": "17", - "electron": "15.0" - }, - "transform-private-property-in-object": { - "chrome": "91", - "opera": "77", - "edge": "91", - "firefox": "90", - "safari": "15", - "node": "16.9", - "deno": "1.9", - "ios": "15", - "samsung": "16", - "electron": "13.0" - }, - "proposal-private-property-in-object": { - "chrome": "91", - "opera": "77", - "edge": "91", - "firefox": "90", - "safari": "15", - "node": "16.9", - "deno": "1.9", - "ios": "15", - "samsung": "16", - "electron": "13.0" - }, - "transform-class-properties": { - "chrome": "74", - "opera": "62", - "edge": "79", - "firefox": "90", - "safari": "14.1", - "node": "12", - "deno": "1", - "ios": "15", - "samsung": "11", - "electron": "6.0" - }, - "proposal-class-properties": { - "chrome": "74", - "opera": "62", - "edge": "79", - "firefox": "90", - "safari": "14.1", - "node": "12", - "deno": "1", - "ios": "15", - "samsung": "11", - "electron": "6.0" - }, - "transform-private-methods": { - "chrome": "84", - "opera": "70", - "edge": "84", - "firefox": "90", - "safari": "15", - "node": "14.6", - "deno": "1", - "ios": "15", - "samsung": "14", - "electron": "10.0" - }, - "proposal-private-methods": { - "chrome": "84", - "opera": "70", - "edge": "84", - "firefox": "90", - "safari": "15", - "node": "14.6", - "deno": "1", - "ios": "15", - "samsung": "14", - "electron": "10.0" - }, - "transform-numeric-separator": { - "chrome": "75", - "opera": "62", - "edge": "79", - "firefox": "70", - "safari": "13", - "node": "12.5", - "deno": "1", - "ios": "13", - "samsung": "11", - "rhino": "1.7.14", - "electron": "6.0" - }, - "proposal-numeric-separator": { - "chrome": "75", - "opera": "62", - "edge": "79", - "firefox": "70", - "safari": "13", - "node": "12.5", - "deno": "1", - "ios": "13", - "samsung": "11", - "rhino": "1.7.14", - "electron": "6.0" - }, - "transform-logical-assignment-operators": { - "chrome": "85", - "opera": "71", - "edge": "85", - "firefox": "79", - "safari": "14", - "node": "15", - "deno": "1.2", - "ios": "14", - "samsung": "14", - "electron": "10.0" - }, - "proposal-logical-assignment-operators": { - "chrome": "85", - "opera": "71", - "edge": "85", - "firefox": "79", - "safari": "14", - "node": "15", - "deno": "1.2", - "ios": "14", - "samsung": "14", - "electron": "10.0" - }, - "transform-nullish-coalescing-operator": { - "chrome": "80", - "opera": "67", - "edge": "80", - "firefox": "72", - "safari": "13.1", - "node": "14", - "deno": "1", - "ios": "13.4", - "samsung": "13", - "electron": "8.0" - }, - "proposal-nullish-coalescing-operator": { - "chrome": "80", - "opera": "67", - "edge": "80", - "firefox": "72", - "safari": "13.1", - "node": "14", - "deno": "1", - "ios": "13.4", - "samsung": "13", - "electron": "8.0" - }, - "transform-optional-chaining": { - "chrome": "91", - "opera": "77", - "edge": "91", - "firefox": "74", - "safari": "13.1", - "node": "16.9", - "deno": "1.9", - "ios": "13.4", - "samsung": "16", - "electron": "13.0" - }, - "proposal-optional-chaining": { - "chrome": "91", - "opera": "77", - "edge": "91", - "firefox": "74", - "safari": "13.1", - "node": "16.9", - "deno": "1.9", - "ios": "13.4", - "samsung": "16", - "electron": "13.0" - }, - "transform-json-strings": { - "chrome": "66", - "opera": "53", - "edge": "79", - "firefox": "62", - "safari": "12", - "node": "10", - "deno": "1", - "ios": "12", - "samsung": "9", - "rhino": "1.7.14", - "electron": "3.0" - }, - "proposal-json-strings": { - "chrome": "66", - "opera": "53", - "edge": "79", - "firefox": "62", - "safari": "12", - "node": "10", - "deno": "1", - "ios": "12", - "samsung": "9", - "rhino": "1.7.14", - "electron": "3.0" - }, - "transform-optional-catch-binding": { - "chrome": "66", - "opera": "53", - "edge": "79", - "firefox": "58", - "safari": "11.1", - "node": "10", - "deno": "1", - "ios": "11.3", - "samsung": "9", - "electron": "3.0" - }, - "proposal-optional-catch-binding": { - "chrome": "66", - "opera": "53", - "edge": "79", - "firefox": "58", - "safari": "11.1", - "node": "10", - "deno": "1", - "ios": "11.3", - "samsung": "9", - "electron": "3.0" - }, - "transform-parameters": { - "chrome": "49", - "opera": "36", - "edge": "18", - "firefox": "53", - "node": "6", - "deno": "1", - "samsung": "5", - "electron": "0.37" - }, - "transform-async-generator-functions": { - "chrome": "63", - "opera": "50", - "edge": "79", - "firefox": "57", - "safari": "12", - "node": "10", - "deno": "1", - "ios": "12", - "samsung": "8", - "electron": "3.0" - }, - "proposal-async-generator-functions": { - "chrome": "63", - "opera": "50", - "edge": "79", - "firefox": "57", - "safari": "12", - "node": "10", - "deno": "1", - "ios": "12", - "samsung": "8", - "electron": "3.0" - }, - "transform-object-rest-spread": { - "chrome": "60", - "opera": "47", - "edge": "79", - "firefox": "55", - "safari": "11.1", - "node": "8.3", - "deno": "1", - "ios": "11.3", - "samsung": "8", - "electron": "2.0" - }, - "proposal-object-rest-spread": { - "chrome": "60", - "opera": "47", - "edge": "79", - "firefox": "55", - "safari": "11.1", - "node": "8.3", - "deno": "1", - "ios": "11.3", - "samsung": "8", - "electron": "2.0" - }, - "transform-dotall-regex": { - "chrome": "62", - "opera": "49", - "edge": "79", - "firefox": "78", - "safari": "11.1", - "node": "8.10", - "deno": "1", - "ios": "11.3", - "samsung": "8", - "electron": "3.0" - }, - "transform-unicode-property-regex": { - "chrome": "64", - "opera": "51", - "edge": "79", - "firefox": "78", - "safari": "11.1", - "node": "10", - "deno": "1", - "ios": "11.3", - "samsung": "9", - "electron": "3.0" - }, - "proposal-unicode-property-regex": { - "chrome": "64", - "opera": "51", - "edge": "79", - "firefox": "78", - "safari": "11.1", - "node": "10", - "deno": "1", - "ios": "11.3", - "samsung": "9", - "electron": "3.0" - }, - "transform-named-capturing-groups-regex": { - "chrome": "64", - "opera": "51", - "edge": "79", - "firefox": "78", - "safari": "11.1", - "node": "10", - "deno": "1", - "ios": "11.3", - "samsung": "9", - "electron": "3.0" - }, - "transform-async-to-generator": { - "chrome": "55", - "opera": "42", - "edge": "15", - "firefox": "52", - "safari": "11", - "node": "7.6", - "deno": "1", - "ios": "11", - "samsung": "6", - "electron": "1.6" - }, - "transform-exponentiation-operator": { - "chrome": "52", - "opera": "39", - "edge": "14", - "firefox": "52", - "safari": "10.1", - "node": "7", - "deno": "1", - "ios": "10.3", - "samsung": "6", - "rhino": "1.7.14", - "electron": "1.3" - }, - "transform-template-literals": { - "chrome": "41", - "opera": "28", - "edge": "13", - "firefox": "34", - "safari": "13", - "node": "4", - "deno": "1", - "ios": "13", - "samsung": "3.4", - "electron": "0.21" - }, - "transform-literals": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "53", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "electron": "0.30" - }, - "transform-function-name": { - "chrome": "51", - "opera": "38", - "edge": "79", - "firefox": "53", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "transform-arrow-functions": { - "chrome": "47", - "opera": "34", - "edge": "13", - "firefox": "43", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "rhino": "1.7.13", - "electron": "0.36" - }, - "transform-block-scoped-functions": { - "chrome": "41", - "opera": "28", - "edge": "12", - "firefox": "46", - "safari": "10", - "node": "4", - "deno": "1", - "ie": "11", - "ios": "10", - "samsung": "3.4", - "electron": "0.21" - }, - "transform-classes": { - "chrome": "46", - "opera": "33", - "edge": "13", - "firefox": "45", - "safari": "10", - "node": "5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.36" - }, - "transform-object-super": { - "chrome": "46", - "opera": "33", - "edge": "13", - "firefox": "45", - "safari": "10", - "node": "5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.36" - }, - "transform-shorthand-properties": { - "chrome": "43", - "opera": "30", - "edge": "12", - "firefox": "33", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "rhino": "1.7.14", - "electron": "0.27" - }, - "transform-duplicate-keys": { - "chrome": "42", - "opera": "29", - "edge": "12", - "firefox": "34", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "3.4", - "electron": "0.25" - }, - "transform-computed-properties": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "34", - "safari": "7.1", - "node": "4", - "deno": "1", - "ios": "8", - "samsung": "4", - "electron": "0.30" - }, - "transform-for-of": { - "chrome": "51", - "opera": "38", - "edge": "15", - "firefox": "53", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "transform-sticky-regex": { - "chrome": "49", - "opera": "36", - "edge": "13", - "firefox": "3", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.37" - }, - "transform-unicode-escapes": { - "chrome": "44", - "opera": "31", - "edge": "12", - "firefox": "53", - "safari": "9", - "node": "4", - "deno": "1", - "ios": "9", - "samsung": "4", - "electron": "0.30" - }, - "transform-unicode-regex": { - "chrome": "50", - "opera": "37", - "edge": "13", - "firefox": "46", - "safari": "12", - "node": "6", - "deno": "1", - "ios": "12", - "samsung": "5", - "electron": "1.1" - }, - "transform-spread": { - "chrome": "46", - "opera": "33", - "edge": "13", - "firefox": "45", - "safari": "10", - "node": "5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.36" - }, - "transform-destructuring": { - "chrome": "51", - "opera": "38", - "edge": "15", - "firefox": "53", - "safari": "10", - "node": "6.5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.2" - }, - "transform-block-scoping": { - "chrome": "49", - "opera": "36", - "edge": "14", - "firefox": "51", - "safari": "11", - "node": "6", - "deno": "1", - "ios": "11", - "samsung": "5", - "electron": "0.37" - }, - "transform-typeof-symbol": { - "chrome": "38", - "opera": "25", - "edge": "12", - "firefox": "36", - "safari": "9", - "node": "0.12", - "deno": "1", - "ios": "9", - "samsung": "3", - "rhino": "1.7.13", - "electron": "0.20" - }, - "transform-new-target": { - "chrome": "46", - "opera": "33", - "edge": "14", - "firefox": "41", - "safari": "10", - "node": "5", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "0.36" - }, - "transform-regenerator": { - "chrome": "50", - "opera": "37", - "edge": "13", - "firefox": "53", - "safari": "10", - "node": "6", - "deno": "1", - "ios": "10", - "samsung": "5", - "electron": "1.1" - }, - "transform-member-expression-literals": { - "chrome": "7", - "opera": "12", - "edge": "12", - "firefox": "2", - "safari": "5.1", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "transform-property-literals": { - "chrome": "7", - "opera": "12", - "edge": "12", - "firefox": "2", - "safari": "5.1", - "node": "0.4", - "deno": "1", - "ie": "9", - "android": "4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "transform-reserved-words": { - "chrome": "13", - "opera": "10.50", - "edge": "12", - "firefox": "2", - "safari": "3.1", - "node": "0.6", - "deno": "1", - "ie": "9", - "android": "4.4", - "ios": "6", - "phantom": "1.9", - "samsung": "1", - "rhino": "1.7.13", - "electron": "0.20" - }, - "transform-export-namespace-from": { - "chrome": "72", - "and_chr": "72", - "edge": "79", - "firefox": "80", - "and_ff": "80", - "node": "13.2", - "opera": "60", - "op_mob": "51", - "samsung": "11.0", - "android": "72", - "electron": "5.0" - }, - "proposal-export-namespace-from": { - "chrome": "72", - "and_chr": "72", - "edge": "79", - "firefox": "80", - "and_ff": "80", - "node": "13.2", - "opera": "60", - "op_mob": "51", - "samsung": "11.0", - "android": "72", - "electron": "5.0" - } -} diff --git a/node_modules/@babel/compat-data/native-modules.js b/node_modules/@babel/compat-data/native-modules.js deleted file mode 100644 index 8e97da4bc..000000000 --- a/node_modules/@babel/compat-data/native-modules.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./data/native-modules.json"); diff --git a/node_modules/@babel/compat-data/overlapping-plugins.js b/node_modules/@babel/compat-data/overlapping-plugins.js deleted file mode 100644 index 88242e467..000000000 --- a/node_modules/@babel/compat-data/overlapping-plugins.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./data/overlapping-plugins.json"); diff --git a/node_modules/@babel/compat-data/package.json b/node_modules/@babel/compat-data/package.json deleted file mode 100644 index 4fcb1ffb3..000000000 --- a/node_modules/@babel/compat-data/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@babel/compat-data", - "version": "7.21.7", - "author": "The Babel Team (https://babel.dev/team)", - "license": "MIT", - "description": "", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-compat-data" - }, - "publishConfig": { - "access": "public" - }, - "exports": { - "./plugins": "./plugins.js", - "./native-modules": "./native-modules.js", - "./corejs2-built-ins": "./corejs2-built-ins.js", - "./corejs3-shipped-proposals": "./corejs3-shipped-proposals.js", - "./overlapping-plugins": "./overlapping-plugins.js", - "./plugin-bugfixes": "./plugin-bugfixes.js" - }, - "scripts": { - "build-data": "./scripts/download-compat-table.sh && node ./scripts/build-data.js && node ./scripts/build-modules-support.js && node ./scripts/build-bugfixes-targets.js" - }, - "keywords": [ - "babel", - "compat-table", - "compat-data" - ], - "devDependencies": { - "@mdn/browser-compat-data": "^4.0.10", - "core-js-compat": "^3.25.1", - "electron-to-chromium": "^1.4.248" - }, - "engines": { - "node": ">=6.9.0" - }, - "type": "commonjs" -} \ No newline at end of file diff --git a/node_modules/@babel/compat-data/plugin-bugfixes.js b/node_modules/@babel/compat-data/plugin-bugfixes.js deleted file mode 100644 index f390181a6..000000000 --- a/node_modules/@babel/compat-data/plugin-bugfixes.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./data/plugin-bugfixes.json"); diff --git a/node_modules/@babel/compat-data/plugins.js b/node_modules/@babel/compat-data/plugins.js deleted file mode 100644 index 42646edce..000000000 --- a/node_modules/@babel/compat-data/plugins.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./data/plugins.json"); diff --git a/node_modules/@babel/core/LICENSE b/node_modules/@babel/core/LICENSE deleted file mode 100644 index f31575ec7..000000000 --- a/node_modules/@babel/core/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other 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/@babel/core/README.md b/node_modules/@babel/core/README.md deleted file mode 100644 index 9b3a95033..000000000 --- a/node_modules/@babel/core/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/core - -> Babel compiler core. - -See our website [@babel/core](https://babeljs.io/docs/en/babel-core) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/core -``` - -or using yarn: - -```sh -yarn add @babel/core --dev -``` diff --git a/node_modules/@babel/core/cjs-proxy.cjs b/node_modules/@babel/core/cjs-proxy.cjs deleted file mode 100644 index a53f616df..000000000 --- a/node_modules/@babel/core/cjs-proxy.cjs +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; - -const babelP = import("./lib/index.js"); -let babel = null; -Object.defineProperty(exports, "__ initialize @babel/core cjs proxy __", { - set(val) { - babel = val; - }, -}); - -const functionNames = [ - "createConfigItem", - "loadPartialConfig", - "loadOptions", - "transform", - "transformFile", - "transformFromAst", - "parse", -]; -const propertyNames = ["types", "tokTypes", "traverse", "template", "version"]; - -for (const name of functionNames) { - exports[name] = function (...args) { - babelP.then(babel => { - babel[name](...args); - }); - }; - exports[`${name}Async`] = function (...args) { - return babelP.then(babel => babel[`${name}Async`](...args)); - }; - exports[`${name}Sync`] = function (...args) { - if (!babel) throw notLoadedError(`${name}Sync`, "callable"); - return babel[`${name}Sync`](...args); - }; -} - -for (const name of propertyNames) { - Object.defineProperty(exports, name, { - get() { - if (!babel) throw notLoadedError(name, "accessible"); - return babel[name]; - }, - }); -} - -function notLoadedError(name, keyword) { - return new Error( - `The \`${name}\` export of @babel/core is only ${keyword}` + - ` from the CommonJS version after that the ESM version is loaded.` - ); -} diff --git a/node_modules/@babel/core/lib/config/cache-contexts.js b/node_modules/@babel/core/lib/config/cache-contexts.js deleted file mode 100644 index d7c091273..000000000 --- a/node_modules/@babel/core/lib/config/cache-contexts.js +++ /dev/null @@ -1,3 +0,0 @@ -0 && 0; - -//# sourceMappingURL=cache-contexts.js.map diff --git a/node_modules/@babel/core/lib/config/cache-contexts.js.map b/node_modules/@babel/core/lib/config/cache-contexts.js.map deleted file mode 100644 index 37fb689e2..000000000 --- a/node_modules/@babel/core/lib/config/cache-contexts.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sources":["../../src/config/cache-contexts.ts"],"sourcesContent":["import type { Targets } from \"@babel/helper-compilation-targets\";\n\nimport type { ConfigContext } from \"./config-chain\";\nimport type { CallerMetadata } from \"./validation/options\";\n\nexport type { ConfigContext as FullConfig };\n\nexport type FullPreset = {\n targets: Targets;\n} & ConfigContext;\nexport type FullPlugin = {\n assumptions: { [name: string]: boolean };\n} & FullPreset;\n\n// Context not including filename since it is used in places that cannot\n// process 'ignore'/'only' and other filename-based logic.\nexport type SimpleConfig = {\n envName: string;\n caller: CallerMetadata | undefined;\n};\nexport type SimplePreset = {\n targets: Targets;\n} & SimpleConfig;\nexport type SimplePlugin = {\n assumptions: {\n [name: string]: boolean;\n };\n} & SimplePreset;\n"],"mappings":""} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/caching.js b/node_modules/@babel/core/lib/config/caching.js deleted file mode 100644 index fac046bd2..000000000 --- a/node_modules/@babel/core/lib/config/caching.js +++ /dev/null @@ -1,261 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.assertSimpleType = assertSimpleType; -exports.makeStrongCache = makeStrongCache; -exports.makeStrongCacheSync = makeStrongCacheSync; -exports.makeWeakCache = makeWeakCache; -exports.makeWeakCacheSync = makeWeakCacheSync; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _async = require("../gensync-utils/async"); -var _util = require("./util"); -const synchronize = gen => { - return _gensync()(gen).sync; -}; -function* genTrue() { - return true; -} -function makeWeakCache(handler) { - return makeCachedFunction(WeakMap, handler); -} -function makeWeakCacheSync(handler) { - return synchronize(makeWeakCache(handler)); -} -function makeStrongCache(handler) { - return makeCachedFunction(Map, handler); -} -function makeStrongCacheSync(handler) { - return synchronize(makeStrongCache(handler)); -} -function makeCachedFunction(CallCache, handler) { - const callCacheSync = new CallCache(); - const callCacheAsync = new CallCache(); - const futureCache = new CallCache(); - return function* cachedFunction(arg, data) { - const asyncContext = yield* (0, _async.isAsync)(); - const callCache = asyncContext ? callCacheAsync : callCacheSync; - const cached = yield* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data); - if (cached.valid) return cached.value; - const cache = new CacheConfigurator(data); - const handlerResult = handler(arg, cache); - let finishLock; - let value; - if ((0, _util.isIterableIterator)(handlerResult)) { - value = yield* (0, _async.onFirstPause)(handlerResult, () => { - finishLock = setupAsyncLocks(cache, futureCache, arg); - }); - } else { - value = handlerResult; - } - updateFunctionCache(callCache, cache, arg, value); - if (finishLock) { - futureCache.delete(arg); - finishLock.release(value); - } - return value; - }; -} -function* getCachedValue(cache, arg, data) { - const cachedValue = cache.get(arg); - if (cachedValue) { - for (const { - value, - valid - } of cachedValue) { - if (yield* valid(data)) return { - valid: true, - value - }; - } - } - return { - valid: false, - value: null - }; -} -function* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data) { - const cached = yield* getCachedValue(callCache, arg, data); - if (cached.valid) { - return cached; - } - if (asyncContext) { - const cached = yield* getCachedValue(futureCache, arg, data); - if (cached.valid) { - const value = yield* (0, _async.waitFor)(cached.value.promise); - return { - valid: true, - value - }; - } - } - return { - valid: false, - value: null - }; -} -function setupAsyncLocks(config, futureCache, arg) { - const finishLock = new Lock(); - updateFunctionCache(futureCache, config, arg, finishLock); - return finishLock; -} -function updateFunctionCache(cache, config, arg, value) { - if (!config.configured()) config.forever(); - let cachedValue = cache.get(arg); - config.deactivate(); - switch (config.mode()) { - case "forever": - cachedValue = [{ - value, - valid: genTrue - }]; - cache.set(arg, cachedValue); - break; - case "invalidate": - cachedValue = [{ - value, - valid: config.validator() - }]; - cache.set(arg, cachedValue); - break; - case "valid": - if (cachedValue) { - cachedValue.push({ - value, - valid: config.validator() - }); - } else { - cachedValue = [{ - value, - valid: config.validator() - }]; - cache.set(arg, cachedValue); - } - } -} -class CacheConfigurator { - constructor(data) { - this._active = true; - this._never = false; - this._forever = false; - this._invalidate = false; - this._configured = false; - this._pairs = []; - this._data = void 0; - this._data = data; - } - simple() { - return makeSimpleConfigurator(this); - } - mode() { - if (this._never) return "never"; - if (this._forever) return "forever"; - if (this._invalidate) return "invalidate"; - return "valid"; - } - forever() { - if (!this._active) { - throw new Error("Cannot change caching after evaluation has completed."); - } - if (this._never) { - throw new Error("Caching has already been configured with .never()"); - } - this._forever = true; - this._configured = true; - } - never() { - if (!this._active) { - throw new Error("Cannot change caching after evaluation has completed."); - } - if (this._forever) { - throw new Error("Caching has already been configured with .forever()"); - } - this._never = true; - this._configured = true; - } - using(handler) { - if (!this._active) { - throw new Error("Cannot change caching after evaluation has completed."); - } - if (this._never || this._forever) { - throw new Error("Caching has already been configured with .never or .forever()"); - } - this._configured = true; - const key = handler(this._data); - const fn = (0, _async.maybeAsync)(handler, `You appear to be using an async cache handler, but Babel has been called synchronously`); - if ((0, _async.isThenable)(key)) { - return key.then(key => { - this._pairs.push([key, fn]); - return key; - }); - } - this._pairs.push([key, fn]); - return key; - } - invalidate(handler) { - this._invalidate = true; - return this.using(handler); - } - validator() { - const pairs = this._pairs; - return function* (data) { - for (const [key, fn] of pairs) { - if (key !== (yield* fn(data))) return false; - } - return true; - }; - } - deactivate() { - this._active = false; - } - configured() { - return this._configured; - } -} -function makeSimpleConfigurator(cache) { - function cacheFn(val) { - if (typeof val === "boolean") { - if (val) cache.forever();else cache.never(); - return; - } - return cache.using(() => assertSimpleType(val())); - } - cacheFn.forever = () => cache.forever(); - cacheFn.never = () => cache.never(); - cacheFn.using = cb => cache.using(() => assertSimpleType(cb())); - cacheFn.invalidate = cb => cache.invalidate(() => assertSimpleType(cb())); - return cacheFn; -} -function assertSimpleType(value) { - if ((0, _async.isThenable)(value)) { - throw new Error(`You appear to be using an async cache handler, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously handle your caching logic.`); - } - if (value != null && typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number") { - throw new Error("Cache keys must be either string, boolean, number, null, or undefined."); - } - return value; -} -class Lock { - constructor() { - this.released = false; - this.promise = void 0; - this._resolve = void 0; - this.promise = new Promise(resolve => { - this._resolve = resolve; - }); - } - release(value) { - this.released = true; - this._resolve(value); - } -} -0 && 0; - -//# sourceMappingURL=caching.js.map diff --git a/node_modules/@babel/core/lib/config/caching.js.map b/node_modules/@babel/core/lib/config/caching.js.map deleted file mode 100644 index 1b78fba07..000000000 --- a/node_modules/@babel/core/lib/config/caching.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","_async","_util","synchronize","gen","gensync","sync","genTrue","makeWeakCache","handler","makeCachedFunction","WeakMap","makeWeakCacheSync","makeStrongCache","Map","makeStrongCacheSync","CallCache","callCacheSync","callCacheAsync","futureCache","cachedFunction","arg","asyncContext","isAsync","callCache","cached","getCachedValueOrWait","valid","value","cache","CacheConfigurator","handlerResult","finishLock","isIterableIterator","onFirstPause","setupAsyncLocks","updateFunctionCache","delete","release","getCachedValue","cachedValue","get","waitFor","promise","config","Lock","configured","forever","deactivate","mode","set","validator","push","constructor","_active","_never","_forever","_invalidate","_configured","_pairs","_data","simple","makeSimpleConfigurator","Error","never","using","key","fn","maybeAsync","isThenable","then","invalidate","pairs","cacheFn","val","assertSimpleType","cb","released","_resolve","Promise","resolve"],"sources":["../../src/config/caching.ts"],"sourcesContent":["import gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport {\n maybeAsync,\n isAsync,\n onFirstPause,\n waitFor,\n isThenable,\n} from \"../gensync-utils/async\";\nimport { isIterableIterator } from \"./util\";\n\nexport type { CacheConfigurator };\n\nexport type SimpleCacheConfigurator = {\n (forever: boolean): void;\n (handler: () => T): T;\n\n forever: () => void;\n never: () => void;\n using: (handler: () => T) => T;\n invalidate: (handler: () => T) => T;\n};\n\nexport type CacheEntry = Array<{\n value: ResultT;\n valid: (channel: SideChannel) => Handler;\n}>;\n\nconst synchronize = (\n gen: (...args: ArgsT) => Handler,\n): ((...args: ArgsT) => ResultT) => {\n return gensync(gen).sync;\n};\n\n// eslint-disable-next-line require-yield\nfunction* genTrue() {\n return true;\n}\n\nexport function makeWeakCache(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator,\n ) => Handler | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler {\n return makeCachedFunction(WeakMap, handler);\n}\n\nexport function makeWeakCacheSync(\n handler: (arg: ArgT, cache?: CacheConfigurator) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeWeakCache(handler),\n );\n}\n\nexport function makeStrongCache(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator,\n ) => Handler | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler {\n return makeCachedFunction(Map, handler);\n}\n\nexport function makeStrongCacheSync(\n handler: (arg: ArgT, cache?: CacheConfigurator) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeStrongCache(handler),\n );\n}\n\n/* NOTE: Part of the logic explained in this comment is explained in the\n * getCachedValueOrWait and setupAsyncLocks functions.\n *\n * > There are only two hard things in Computer Science: cache invalidation and naming things.\n * > -- Phil Karlton\n *\n * I don't know if Phil was also thinking about handling a cache whose invalidation function is\n * defined asynchronously is considered, but it is REALLY hard to do correctly.\n *\n * The implemented logic (only when gensync is run asynchronously) is the following:\n * 1. If there is a valid cache associated to the current \"arg\" parameter,\n * a. RETURN the cached value\n * 3. If there is a FinishLock associated to the current \"arg\" parameter representing a valid cache,\n * a. Wait for that lock to be released\n * b. RETURN the value associated with that lock\n * 5. Start executing the function to be cached\n * a. If it pauses on a promise, then\n * i. Let FinishLock be a new lock\n * ii. Store FinishLock as associated to the current \"arg\" parameter\n * iii. Wait for the function to finish executing\n * iv. Release FinishLock\n * v. Send the function result to anyone waiting on FinishLock\n * 6. Store the result in the cache\n * 7. RETURN the result\n */\nfunction makeCachedFunction(\n CallCache: new () => CacheMap,\n handler: (\n arg: ArgT,\n cache: CacheConfigurator,\n ) => Handler | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler {\n const callCacheSync = new CallCache();\n const callCacheAsync = new CallCache();\n const futureCache = new CallCache>();\n\n return function* cachedFunction(arg: ArgT, data: SideChannel) {\n const asyncContext = yield* isAsync();\n const callCache = asyncContext ? callCacheAsync : callCacheSync;\n\n const cached = yield* getCachedValueOrWait(\n asyncContext,\n callCache,\n futureCache,\n arg,\n data,\n );\n if (cached.valid) return cached.value;\n\n const cache = new CacheConfigurator(data);\n\n const handlerResult: Handler | ResultT = handler(arg, cache);\n\n let finishLock: Lock;\n let value: ResultT;\n\n if (isIterableIterator(handlerResult)) {\n value = yield* onFirstPause(handlerResult, () => {\n finishLock = setupAsyncLocks(cache, futureCache, arg);\n });\n } else {\n value = handlerResult;\n }\n\n updateFunctionCache(callCache, cache, arg, value);\n\n if (finishLock) {\n futureCache.delete(arg);\n finishLock.release(value);\n }\n\n return value;\n };\n}\n\ntype CacheMap =\n | Map>\n // @ts-expect-error todo(flow->ts): add `extends object` constraint to ArgT\n | WeakMap>;\n\nfunction* getCachedValue(\n cache: CacheMap,\n arg: ArgT,\n data: SideChannel,\n): Handler<{ valid: true; value: ResultT } | { valid: false; value: null }> {\n const cachedValue: CacheEntry | void = cache.get(arg);\n\n if (cachedValue) {\n for (const { value, valid } of cachedValue) {\n if (yield* valid(data)) return { valid: true, value };\n }\n }\n\n return { valid: false, value: null };\n}\n\nfunction* getCachedValueOrWait(\n asyncContext: boolean,\n callCache: CacheMap,\n futureCache: CacheMap, SideChannel>,\n arg: ArgT,\n data: SideChannel,\n): Handler<{ valid: true; value: ResultT } | { valid: false; value: null }> {\n const cached = yield* getCachedValue(callCache, arg, data);\n if (cached.valid) {\n return cached;\n }\n\n if (asyncContext) {\n const cached = yield* getCachedValue(futureCache, arg, data);\n if (cached.valid) {\n const value = yield* waitFor(cached.value.promise);\n return { valid: true, value };\n }\n }\n\n return { valid: false, value: null };\n}\n\nfunction setupAsyncLocks(\n config: CacheConfigurator,\n futureCache: CacheMap, SideChannel>,\n arg: ArgT,\n): Lock {\n const finishLock = new Lock();\n\n updateFunctionCache(futureCache, config, arg, finishLock);\n\n return finishLock;\n}\n\nfunction updateFunctionCache<\n ArgT,\n ResultT,\n SideChannel,\n Cache extends CacheMap,\n>(\n cache: Cache,\n config: CacheConfigurator,\n arg: ArgT,\n value: ResultT,\n) {\n if (!config.configured()) config.forever();\n\n let cachedValue: CacheEntry | void = cache.get(arg);\n\n config.deactivate();\n\n switch (config.mode()) {\n case \"forever\":\n cachedValue = [{ value, valid: genTrue }];\n cache.set(arg, cachedValue);\n break;\n case \"invalidate\":\n cachedValue = [{ value, valid: config.validator() }];\n cache.set(arg, cachedValue);\n break;\n case \"valid\":\n if (cachedValue) {\n cachedValue.push({ value, valid: config.validator() });\n } else {\n cachedValue = [{ value, valid: config.validator() }];\n cache.set(arg, cachedValue);\n }\n }\n}\n\nclass CacheConfigurator {\n _active: boolean = true;\n _never: boolean = false;\n _forever: boolean = false;\n _invalidate: boolean = false;\n\n _configured: boolean = false;\n\n _pairs: Array<\n [cachedValue: unknown, handler: (data: SideChannel) => Handler]\n > = [];\n\n _data: SideChannel;\n\n constructor(data: SideChannel) {\n this._data = data;\n }\n\n simple() {\n return makeSimpleConfigurator(this);\n }\n\n mode() {\n if (this._never) return \"never\";\n if (this._forever) return \"forever\";\n if (this._invalidate) return \"invalidate\";\n return \"valid\";\n }\n\n forever() {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._never) {\n throw new Error(\"Caching has already been configured with .never()\");\n }\n this._forever = true;\n this._configured = true;\n }\n\n never() {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._forever) {\n throw new Error(\"Caching has already been configured with .forever()\");\n }\n this._never = true;\n this._configured = true;\n }\n\n using(handler: (data: SideChannel) => T): T {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._never || this._forever) {\n throw new Error(\n \"Caching has already been configured with .never or .forever()\",\n );\n }\n this._configured = true;\n\n const key = handler(this._data);\n\n const fn = maybeAsync(\n handler,\n `You appear to be using an async cache handler, but Babel has been called synchronously`,\n );\n\n if (isThenable(key)) {\n // @ts-expect-error todo(flow->ts): improve function return type annotation\n return key.then((key: unknown) => {\n this._pairs.push([key, fn]);\n return key;\n });\n }\n\n this._pairs.push([key, fn]);\n return key;\n }\n\n invalidate(handler: (data: SideChannel) => T): T {\n this._invalidate = true;\n return this.using(handler);\n }\n\n validator(): (data: SideChannel) => Handler {\n const pairs = this._pairs;\n return function* (data: SideChannel) {\n for (const [key, fn] of pairs) {\n if (key !== (yield* fn(data))) return false;\n }\n return true;\n };\n }\n\n deactivate() {\n this._active = false;\n }\n\n configured() {\n return this._configured;\n }\n}\n\nfunction makeSimpleConfigurator(\n cache: CacheConfigurator,\n): SimpleCacheConfigurator {\n function cacheFn(val: any) {\n if (typeof val === \"boolean\") {\n if (val) cache.forever();\n else cache.never();\n return;\n }\n\n return cache.using(() => assertSimpleType(val()));\n }\n cacheFn.forever = () => cache.forever();\n cacheFn.never = () => cache.never();\n cacheFn.using = (cb: { (): SimpleType }) =>\n cache.using(() => assertSimpleType(cb()));\n cacheFn.invalidate = (cb: { (): SimpleType }) =>\n cache.invalidate(() => assertSimpleType(cb()));\n\n return cacheFn as any;\n}\n\n// Types are limited here so that in the future these values can be used\n// as part of Babel's caching logic.\nexport type SimpleType =\n | string\n | boolean\n | number\n | null\n | void\n | Promise;\nexport function assertSimpleType(value: unknown): SimpleType {\n if (isThenable(value)) {\n throw new Error(\n `You appear to be using an async cache handler, ` +\n `which your current version of Babel does not support. ` +\n `We may add support for this in the future, ` +\n `but if you're on the most recent version of @babel/core and still ` +\n `seeing this error, then you'll need to synchronously handle your caching logic.`,\n );\n }\n\n if (\n value != null &&\n typeof value !== \"string\" &&\n typeof value !== \"boolean\" &&\n typeof value !== \"number\"\n ) {\n throw new Error(\n \"Cache keys must be either string, boolean, number, null, or undefined.\",\n );\n }\n // @ts-expect-error Type 'unknown' is not assignable to type 'SimpleType'. This can be removed\n // when strictNullCheck is enabled\n return value;\n}\n\nclass Lock {\n released: boolean = false;\n promise: Promise;\n _resolve: (value: T) => void;\n\n constructor() {\n this.promise = new Promise(resolve => {\n this._resolve = resolve;\n });\n }\n\n release(value: T) {\n this.released = true;\n this._resolve(value);\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,MAAA,GAAAD,OAAA;AAOA,IAAAE,K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C,wDAAuD,GACvD,6CAA4C,GAC5C,oEAAmE,GACnE,iFAAgF,CACpF;EACH;EAEA,IACEnC,KAAK,IAAI,IAAI,IACb,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAOA,KAAK,KAAK,SAAS,IAC1B,OAAOA,KAAK,KAAK,QAAQ,EACzB;IACA,MAAM,IAAImC,KAAK,CACb,wEAAwE,CACzE;EACH;EAGA,OAAOnC,KAAK;AACd;AAEA,MAAMiB,IAAI,CAAI;EAKZQ,WAAWA,CAAA,EAAG;IAAA,KAJdwB,QAAQ,GAAY,KAAK;IAAA,KACzBlC,OAAO;IAAA,KACPmC,QAAQ;IAGN,IAAI,CAACnC,OAAO,GAAG,IAAIoC,OAAO,CAACC,OAAO,IAAI;MACpC,IAAI,CAACF,QAAQ,GAAGE,OAAO;IACzB,CAAC,CAAC;EACJ;EAEA1C,OAAOA,CAACV,KAAQ,EAAE;IAChB,IAAI,CAACiD,QAAQ,GAAG,IAAI;IACpB,IAAI,CAACC,QAAQ,CAAClD,KAAK,CAAC;EACtB;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/config-chain.js b/node_modules/@babel/core/lib/config/config-chain.js deleted file mode 100644 index c54fdf5ba..000000000 --- a/node_modules/@babel/core/lib/config/config-chain.js +++ /dev/null @@ -1,469 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.buildPresetChain = buildPresetChain; -exports.buildPresetChainWalker = void 0; -exports.buildRootChain = buildRootChain; -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -function _debug() { - const data = require("debug"); - _debug = function () { - return data; - }; - return data; -} -var _options = require("./validation/options"); -var _patternToRegex = require("./pattern-to-regex"); -var _printer = require("./printer"); -var _rewriteStackTrace = require("../errors/rewrite-stack-trace"); -var _configError = require("../errors/config-error"); -var _files = require("./files"); -var _caching = require("./caching"); -var _configDescriptors = require("./config-descriptors"); -const debug = _debug()("babel:config:config-chain"); -function* buildPresetChain(arg, context) { - const chain = yield* buildPresetChainWalker(arg, context); - if (!chain) return null; - return { - plugins: dedupDescriptors(chain.plugins), - presets: dedupDescriptors(chain.presets), - options: chain.options.map(o => normalizeOptions(o)), - files: new Set() - }; -} -const buildPresetChainWalker = makeChainWalker({ - root: preset => loadPresetDescriptors(preset), - env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName), - overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index), - overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName), - createLogger: () => () => {} -}); -exports.buildPresetChainWalker = buildPresetChainWalker; -const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors)); -const loadPresetEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName))); -const loadPresetOverridesDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index))); -const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName)))); -function* buildRootChain(opts, context) { - let configReport, babelRcReport; - const programmaticLogger = new _printer.ConfigPrinter(); - const programmaticChain = yield* loadProgrammaticChain({ - options: opts, - dirname: context.cwd - }, context, undefined, programmaticLogger); - if (!programmaticChain) return null; - const programmaticReport = yield* programmaticLogger.output(); - let configFile; - if (typeof opts.configFile === "string") { - configFile = yield* (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller); - } else if (opts.configFile !== false) { - configFile = yield* (0, _files.findRootConfig)(context.root, context.envName, context.caller); - } - let { - babelrc, - babelrcRoots - } = opts; - let babelrcRootsDirectory = context.cwd; - const configFileChain = emptyChain(); - const configFileLogger = new _printer.ConfigPrinter(); - if (configFile) { - const validatedFile = validateConfigFile(configFile); - const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger); - if (!result) return null; - configReport = yield* configFileLogger.output(); - if (babelrc === undefined) { - babelrc = validatedFile.options.babelrc; - } - if (babelrcRoots === undefined) { - babelrcRootsDirectory = validatedFile.dirname; - babelrcRoots = validatedFile.options.babelrcRoots; - } - mergeChain(configFileChain, result); - } - let ignoreFile, babelrcFile; - let isIgnored = false; - const fileChain = emptyChain(); - if ((babelrc === true || babelrc === undefined) && typeof context.filename === "string") { - const pkgData = yield* (0, _files.findPackageData)(context.filename); - if (pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) { - ({ - ignore: ignoreFile, - config: babelrcFile - } = yield* (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller)); - if (ignoreFile) { - fileChain.files.add(ignoreFile.filepath); - } - if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) { - isIgnored = true; - } - if (babelrcFile && !isIgnored) { - const validatedFile = validateBabelrcFile(babelrcFile); - const babelrcLogger = new _printer.ConfigPrinter(); - const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger); - if (!result) { - isIgnored = true; - } else { - babelRcReport = yield* babelrcLogger.output(); - mergeChain(fileChain, result); - } - } - if (babelrcFile && isIgnored) { - fileChain.files.add(babelrcFile.filepath); - } - } - } - if (context.showConfig) { - console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n") + "\n-----End Babel configs-----"); - } - const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain); - return { - plugins: isIgnored ? [] : dedupDescriptors(chain.plugins), - presets: isIgnored ? [] : dedupDescriptors(chain.presets), - options: isIgnored ? [] : chain.options.map(o => normalizeOptions(o)), - fileHandling: isIgnored ? "ignored" : "transpile", - ignore: ignoreFile || undefined, - babelrc: babelrcFile || undefined, - config: configFile || undefined, - files: chain.files - }; -} -function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) { - if (typeof babelrcRoots === "boolean") return babelrcRoots; - const absoluteRoot = context.root; - if (babelrcRoots === undefined) { - return pkgData.directories.indexOf(absoluteRoot) !== -1; - } - let babelrcPatterns = babelrcRoots; - if (!Array.isArray(babelrcPatterns)) { - babelrcPatterns = [babelrcPatterns]; - } - babelrcPatterns = babelrcPatterns.map(pat => { - return typeof pat === "string" ? _path().resolve(babelrcRootsDirectory, pat) : pat; - }); - if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) { - return pkgData.directories.indexOf(absoluteRoot) !== -1; - } - return babelrcPatterns.some(pat => { - if (typeof pat === "string") { - pat = (0, _patternToRegex.default)(pat, babelrcRootsDirectory); - } - return pkgData.directories.some(directory => { - return matchPattern(pat, babelrcRootsDirectory, directory, context); - }); - }); -} -const validateConfigFile = (0, _caching.makeWeakCacheSync)(file => ({ - filepath: file.filepath, - dirname: file.dirname, - options: (0, _options.validate)("configfile", file.options, file.filepath) -})); -const validateBabelrcFile = (0, _caching.makeWeakCacheSync)(file => ({ - filepath: file.filepath, - dirname: file.dirname, - options: (0, _options.validate)("babelrcfile", file.options, file.filepath) -})); -const validateExtendFile = (0, _caching.makeWeakCacheSync)(file => ({ - filepath: file.filepath, - dirname: file.dirname, - options: (0, _options.validate)("extendsfile", file.options, file.filepath) -})); -const loadProgrammaticChain = makeChainWalker({ - root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors), - env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName), - overrides: (input, index) => buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index), - overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName), - createLogger: (input, context, baseLogger) => buildProgrammaticLogger(input, context, baseLogger) -}); -const loadFileChainWalker = makeChainWalker({ - root: file => loadFileDescriptors(file), - env: (file, envName) => loadFileEnvDescriptors(file)(envName), - overrides: (file, index) => loadFileOverridesDescriptors(file)(index), - overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName), - createLogger: (file, context, baseLogger) => buildFileLogger(file.filepath, context, baseLogger) -}); -function* loadFileChain(input, context, files, baseLogger) { - const chain = yield* loadFileChainWalker(input, context, files, baseLogger); - if (chain) { - chain.files.add(input.filepath); - } - return chain; -} -const loadFileDescriptors = (0, _caching.makeWeakCacheSync)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors)); -const loadFileEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName))); -const loadFileOverridesDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index))); -const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName)))); -function buildFileLogger(filepath, context, baseLogger) { - if (!baseLogger) { - return () => {}; - } - return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Config, { - filepath - }); -} -function buildRootDescriptors({ - dirname, - options -}, alias, descriptors) { - return descriptors(dirname, options, alias); -} -function buildProgrammaticLogger(_, context, baseLogger) { - var _context$caller; - if (!baseLogger) { - return () => {}; - } - return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Programmatic, { - callerName: (_context$caller = context.caller) == null ? void 0 : _context$caller.name - }); -} -function buildEnvDescriptors({ - dirname, - options -}, alias, descriptors, envName) { - const opts = options.env && options.env[envName]; - return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null; -} -function buildOverrideDescriptors({ - dirname, - options -}, alias, descriptors, index) { - const opts = options.overrides && options.overrides[index]; - if (!opts) throw new Error("Assertion failure - missing override"); - return descriptors(dirname, opts, `${alias}.overrides[${index}]`); -} -function buildOverrideEnvDescriptors({ - dirname, - options -}, alias, descriptors, index, envName) { - const override = options.overrides && options.overrides[index]; - if (!override) throw new Error("Assertion failure - missing override"); - const opts = override.env && override.env[envName]; - return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null; -} -function makeChainWalker({ - root, - env, - overrides, - overridesEnv, - createLogger -}) { - return function* chainWalker(input, context, files = new Set(), baseLogger) { - const { - dirname - } = input; - const flattenedConfigs = []; - const rootOpts = root(input); - if (configIsApplicable(rootOpts, dirname, context, input.filepath)) { - flattenedConfigs.push({ - config: rootOpts, - envName: undefined, - index: undefined - }); - const envOpts = env(input, context.envName); - if (envOpts && configIsApplicable(envOpts, dirname, context, input.filepath)) { - flattenedConfigs.push({ - config: envOpts, - envName: context.envName, - index: undefined - }); - } - (rootOpts.options.overrides || []).forEach((_, index) => { - const overrideOps = overrides(input, index); - if (configIsApplicable(overrideOps, dirname, context, input.filepath)) { - flattenedConfigs.push({ - config: overrideOps, - index, - envName: undefined - }); - const overrideEnvOpts = overridesEnv(input, index, context.envName); - if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context, input.filepath)) { - flattenedConfigs.push({ - config: overrideEnvOpts, - index, - envName: context.envName - }); - } - } - }); - } - if (flattenedConfigs.some(({ - config: { - options: { - ignore, - only - } - } - }) => shouldIgnore(context, ignore, only, dirname))) { - return null; - } - const chain = emptyChain(); - const logger = createLogger(input, context, baseLogger); - for (const { - config, - index, - envName - } of flattenedConfigs) { - if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) { - return null; - } - logger(config, index, envName); - yield* mergeChainOpts(chain, config); - } - return chain; - }; -} -function* mergeExtendsChain(chain, opts, dirname, context, files, baseLogger) { - if (opts.extends === undefined) return true; - const file = yield* (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller); - if (files.has(file)) { - throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n")); - } - files.add(file); - const fileChain = yield* loadFileChain(validateExtendFile(file), context, files, baseLogger); - files.delete(file); - if (!fileChain) return false; - mergeChain(chain, fileChain); - return true; -} -function mergeChain(target, source) { - target.options.push(...source.options); - target.plugins.push(...source.plugins); - target.presets.push(...source.presets); - for (const file of source.files) { - target.files.add(file); - } - return target; -} -function* mergeChainOpts(target, { - options, - plugins, - presets -}) { - target.options.push(options); - target.plugins.push(...(yield* plugins())); - target.presets.push(...(yield* presets())); - return target; -} -function emptyChain() { - return { - options: [], - presets: [], - plugins: [], - files: new Set() - }; -} -function normalizeOptions(opts) { - const options = Object.assign({}, opts); - delete options.extends; - delete options.env; - delete options.overrides; - delete options.plugins; - delete options.presets; - delete options.passPerPreset; - delete options.ignore; - delete options.only; - delete options.test; - delete options.include; - delete options.exclude; - if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) { - options.sourceMaps = options.sourceMap; - delete options.sourceMap; - } - return options; -} -function dedupDescriptors(items) { - const map = new Map(); - const descriptors = []; - for (const item of items) { - if (typeof item.value === "function") { - const fnKey = item.value; - let nameMap = map.get(fnKey); - if (!nameMap) { - nameMap = new Map(); - map.set(fnKey, nameMap); - } - let desc = nameMap.get(item.name); - if (!desc) { - desc = { - value: item - }; - descriptors.push(desc); - if (!item.ownPass) nameMap.set(item.name, desc); - } else { - desc.value = item; - } - } else { - descriptors.push({ - value: item - }); - } - } - return descriptors.reduce((acc, desc) => { - acc.push(desc.value); - return acc; - }, []); -} -function configIsApplicable({ - options -}, dirname, context, configName) { - return (options.test === undefined || configFieldIsApplicable(context, options.test, dirname, configName)) && (options.include === undefined || configFieldIsApplicable(context, options.include, dirname, configName)) && (options.exclude === undefined || !configFieldIsApplicable(context, options.exclude, dirname, configName)); -} -function configFieldIsApplicable(context, test, dirname, configName) { - const patterns = Array.isArray(test) ? test : [test]; - return matchesPatterns(context, patterns, dirname, configName); -} -function ignoreListReplacer(_key, value) { - if (value instanceof RegExp) { - return String(value); - } - return value; -} -function shouldIgnore(context, ignore, only, dirname) { - if (ignore && matchesPatterns(context, ignore, dirname)) { - var _context$filename; - const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore, ignoreListReplacer)}\` from "${dirname}"`; - debug(message); - if (context.showConfig) { - console.log(message); - } - return true; - } - if (only && !matchesPatterns(context, only, dirname)) { - var _context$filename2; - const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only, ignoreListReplacer)}\` from "${dirname}"`; - debug(message); - if (context.showConfig) { - console.log(message); - } - return true; - } - return false; -} -function matchesPatterns(context, patterns, dirname, configName) { - return patterns.some(pattern => matchPattern(pattern, dirname, context.filename, context, configName)); -} -function matchPattern(pattern, dirname, pathToTest, context, configName) { - if (typeof pattern === "function") { - return !!(0, _rewriteStackTrace.endHiddenCallStack)(pattern)(pathToTest, { - dirname, - envName: context.envName, - caller: context.caller - }); - } - if (typeof pathToTest !== "string") { - throw new _configError.default(`Configuration contains string/RegExp pattern, but no filename was passed to Babel`, configName); - } - if (typeof pattern === "string") { - pattern = (0, _patternToRegex.default)(pattern, dirname); - } - return pattern.test(pathToTest); -} -0 && 0; - -//# sourceMappingURL=config-chain.js.map diff --git a/node_modules/@babel/core/lib/config/config-chain.js.map b/node_modules/@babel/core/lib/config/config-chain.js.map deleted file mode 100644 index 352dfdd7e..000000000 --- a/node_modules/@babel/core/lib/config/config-chain.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_path","data","require","_debug","_options","_patternToRegex","_printer","_rewriteStackTrace","_configError","_files","_caching","_configDescriptors","debug","buildDebug","buildPresetChain","arg","context","chain","buildPresetChainWalker","plugins","dedupDescriptors","presets","options","map","o","normalizeOptions","files","Set","makeChainWalker","root","preset","loadPresetDescriptors","env","envName","loadPresetEnvDescriptors","overrides","index","loadPresetOverridesDescriptors","overridesEnv","loadPresetOverridesEnvDescriptors","createLogger","exports","makeWeakCacheSync","buildRootDescriptors","alias","createUncachedDescriptors","makeStrongCacheSync","buildEnvDescriptors","buildOverrideDescriptors","buildOverrideEnvDescriptors","buildRootChain","opts","configReport","babelRcReport","programmaticLogger","ConfigPrinter","programmaticChain","loadProgrammaticChain","dirname","cwd","undefined","programmaticReport","output","configFile","loadConfig","caller","findRootConfig","babelrc","babelrcRoots","babelrcRootsDirectory","configFileChain","emptyChain","configFileLogger","validatedFile","validateConfigFile","result","loadFileChain","mergeChain","ignoreFile","babelrcFile","isIgnored","fileChain","filename","pkgData","findPackageData","babelrcLoadEnabled","ignore","config","findRelativeConfig","add","filepath","shouldIgnore","validateBabelrcFile","babelrcLogger","showConfig","console","log","filter","x","join","fileHandling","absoluteRoot","directories","indexOf","babelrcPatterns","Array","isArray","pat","path","resolve","length","some","pathPatternToRegex","directory","matchPattern","file","validate","validateExtendFile","input","createCachedDescriptors","baseLogger","buildProgrammaticLogger","loadFileChainWalker","loadFileDescriptors","loadFileEnvDescriptors","loadFileOverridesDescriptors","loadFileOverridesEnvDescriptors","buildFileLogger","configure","ChainFormatter","Config","descriptors","_","_context$caller","Programmatic","callerName","name","Error","override","chainWalker","flattenedConfigs","rootOpts","configIsApplicable","push","envOpts","forEach","overrideOps","overrideEnvOpts","only","logger","mergeExtendsChain","mergeChainOpts","extends","has","from","delete","target","source","Object","assign","passPerPreset","test","include","exclude","prototype","hasOwnProperty","call","sourceMaps","sourceMap","items","Map","item","value","fnKey","nameMap","get","set","desc","ownPass","reduce","acc","configName","configFieldIsApplicable","patterns","matchesPatterns","ignoreListReplacer","_key","RegExp","String","_context$filename","message","JSON","stringify","_context$filename2","pattern","pathToTest","endHiddenCallStack","ConfigError"],"sources":["../../src/config/config-chain.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\n\nimport path from \"path\";\nimport buildDebug from \"debug\";\nimport type { Handler } from \"gensync\";\nimport { validate } from \"./validation/options\";\nimport type {\n ValidatedOptions,\n IgnoreList,\n ConfigApplicableTest,\n BabelrcSearch,\n CallerMetadata,\n IgnoreItem,\n} from \"./validation/options\";\nimport pathPatternToRegex from \"./pattern-to-regex\";\nimport { ConfigPrinter, ChainFormatter } from \"./printer\";\nimport type { ReadonlyDeepArray } from \"./helpers/deep-array\";\n\nimport { endHiddenCallStack } from \"../errors/rewrite-stack-trace\";\nimport ConfigError from \"../errors/config-error\";\n\nconst debug = buildDebug(\"babel:config:config-chain\");\n\nimport {\n findPackageData,\n findRelativeConfig,\n findRootConfig,\n loadConfig,\n} from \"./files\";\nimport type { ConfigFile, IgnoreFile, FilePackageData } from \"./files\";\n\nimport { makeWeakCacheSync, makeStrongCacheSync } from \"./caching\";\n\nimport {\n createCachedDescriptors,\n createUncachedDescriptors,\n} from \"./config-descriptors\";\nimport type {\n UnloadedDescriptor,\n OptionsAndDescriptors,\n ValidatedFile,\n} from \"./config-descriptors\";\n\nexport type ConfigChain = {\n plugins: Array;\n presets: Array;\n options: Array;\n files: Set;\n};\n\nexport type PresetInstance = {\n options: ValidatedOptions;\n alias: string;\n dirname: string;\n externalDependencies: ReadonlyDeepArray;\n};\n\nexport type ConfigContext = {\n filename: string | undefined;\n cwd: string;\n root: string;\n envName: string;\n caller: CallerMetadata | undefined;\n showConfig: boolean;\n};\n\n/**\n * Build a config chain for a given preset.\n */\nexport function* buildPresetChain(\n arg: PresetInstance,\n context: any,\n): Handler {\n const chain = yield* buildPresetChainWalker(arg, context);\n if (!chain) return null;\n\n return {\n plugins: dedupDescriptors(chain.plugins),\n presets: dedupDescriptors(chain.presets),\n options: chain.options.map(o => normalizeOptions(o)),\n files: new Set(),\n };\n}\n\nexport const buildPresetChainWalker = makeChainWalker({\n root: preset => loadPresetDescriptors(preset),\n env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),\n overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),\n overridesEnv: (preset, index, envName) =>\n loadPresetOverridesEnvDescriptors(preset)(index)(envName),\n createLogger: () => () => {}, // Currently we don't support logging how preset is expanded\n});\nconst loadPresetDescriptors = makeWeakCacheSync((preset: PresetInstance) =>\n buildRootDescriptors(preset, preset.alias, createUncachedDescriptors),\n);\nconst loadPresetEnvDescriptors = makeWeakCacheSync((preset: PresetInstance) =>\n makeStrongCacheSync((envName: string) =>\n buildEnvDescriptors(\n preset,\n preset.alias,\n createUncachedDescriptors,\n envName,\n ),\n ),\n);\nconst loadPresetOverridesDescriptors = makeWeakCacheSync(\n (preset: PresetInstance) =>\n makeStrongCacheSync((index: number) =>\n buildOverrideDescriptors(\n preset,\n preset.alias,\n createUncachedDescriptors,\n index,\n ),\n ),\n);\nconst loadPresetOverridesEnvDescriptors = makeWeakCacheSync(\n (preset: PresetInstance) =>\n makeStrongCacheSync((index: number) =>\n makeStrongCacheSync((envName: string) =>\n buildOverrideEnvDescriptors(\n preset,\n preset.alias,\n createUncachedDescriptors,\n index,\n envName,\n ),\n ),\n ),\n);\n\nexport type FileHandling = \"transpile\" | \"ignored\" | \"unsupported\";\nexport type RootConfigChain = ConfigChain & {\n babelrc: ConfigFile | void;\n config: ConfigFile | void;\n ignore: IgnoreFile | void;\n fileHandling: FileHandling;\n files: Set;\n};\n\n/**\n * Build a config chain for Babel's full root configuration.\n */\nexport function* buildRootChain(\n opts: ValidatedOptions,\n context: ConfigContext,\n): Handler {\n let configReport, babelRcReport;\n const programmaticLogger = new ConfigPrinter();\n const programmaticChain = yield* loadProgrammaticChain(\n {\n options: opts,\n dirname: context.cwd,\n },\n context,\n undefined,\n programmaticLogger,\n );\n if (!programmaticChain) return null;\n const programmaticReport = yield* programmaticLogger.output();\n\n let configFile;\n if (typeof opts.configFile === \"string\") {\n configFile = yield* loadConfig(\n opts.configFile,\n context.cwd,\n context.envName,\n context.caller,\n );\n } else if (opts.configFile !== false) {\n configFile = yield* findRootConfig(\n context.root,\n context.envName,\n context.caller,\n );\n }\n\n let { babelrc, babelrcRoots } = opts;\n let babelrcRootsDirectory = context.cwd;\n\n const configFileChain = emptyChain();\n const configFileLogger = new ConfigPrinter();\n if (configFile) {\n const validatedFile = validateConfigFile(configFile);\n const result = yield* loadFileChain(\n validatedFile,\n context,\n undefined,\n configFileLogger,\n );\n if (!result) return null;\n configReport = yield* configFileLogger.output();\n\n // Allow config files to toggle `.babelrc` resolution on and off and\n // specify where the roots are.\n if (babelrc === undefined) {\n babelrc = validatedFile.options.babelrc;\n }\n if (babelrcRoots === undefined) {\n babelrcRootsDirectory = validatedFile.dirname;\n babelrcRoots = validatedFile.options.babelrcRoots;\n }\n\n mergeChain(configFileChain, result);\n }\n\n let ignoreFile, babelrcFile;\n let isIgnored = false;\n const fileChain = emptyChain();\n // resolve all .babelrc files\n if (\n (babelrc === true || babelrc === undefined) &&\n typeof context.filename === \"string\"\n ) {\n const pkgData = yield* findPackageData(context.filename);\n\n if (\n pkgData &&\n babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)\n ) {\n ({ ignore: ignoreFile, config: babelrcFile } = yield* findRelativeConfig(\n pkgData,\n context.envName,\n context.caller,\n ));\n\n if (ignoreFile) {\n fileChain.files.add(ignoreFile.filepath);\n }\n\n if (\n ignoreFile &&\n shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)\n ) {\n isIgnored = true;\n }\n\n if (babelrcFile && !isIgnored) {\n const validatedFile = validateBabelrcFile(babelrcFile);\n const babelrcLogger = new ConfigPrinter();\n const result = yield* loadFileChain(\n validatedFile,\n context,\n undefined,\n babelrcLogger,\n );\n if (!result) {\n isIgnored = true;\n } else {\n babelRcReport = yield* babelrcLogger.output();\n mergeChain(fileChain, result);\n }\n }\n\n if (babelrcFile && isIgnored) {\n fileChain.files.add(babelrcFile.filepath);\n }\n }\n }\n\n if (context.showConfig) {\n console.log(\n `Babel configs on \"${context.filename}\" (ascending priority):\\n` +\n // print config by the order of ascending priority\n [configReport, babelRcReport, programmaticReport]\n .filter(x => !!x)\n .join(\"\\n\\n\") +\n \"\\n-----End Babel configs-----\",\n );\n }\n // Insert file chain in front so programmatic options have priority\n // over configuration file chain items.\n const chain = mergeChain(\n mergeChain(mergeChain(emptyChain(), configFileChain), fileChain),\n programmaticChain,\n );\n\n return {\n plugins: isIgnored ? [] : dedupDescriptors(chain.plugins),\n presets: isIgnored ? [] : dedupDescriptors(chain.presets),\n options: isIgnored ? [] : chain.options.map(o => normalizeOptions(o)),\n fileHandling: isIgnored ? \"ignored\" : \"transpile\",\n ignore: ignoreFile || undefined,\n babelrc: babelrcFile || undefined,\n config: configFile || undefined,\n files: chain.files,\n };\n}\n\nfunction babelrcLoadEnabled(\n context: ConfigContext,\n pkgData: FilePackageData,\n babelrcRoots: BabelrcSearch | undefined,\n babelrcRootsDirectory: string,\n): boolean {\n if (typeof babelrcRoots === \"boolean\") return babelrcRoots;\n\n const absoluteRoot = context.root;\n\n // Fast path to avoid having to match patterns if the babelrc is just\n // loading in the standard root directory.\n if (babelrcRoots === undefined) {\n return pkgData.directories.indexOf(absoluteRoot) !== -1;\n }\n\n let babelrcPatterns = babelrcRoots;\n if (!Array.isArray(babelrcPatterns)) {\n babelrcPatterns = [babelrcPatterns as IgnoreItem];\n }\n babelrcPatterns = babelrcPatterns.map(pat => {\n return typeof pat === \"string\"\n ? path.resolve(babelrcRootsDirectory, pat)\n : pat;\n });\n\n // Fast path to avoid having to match patterns if the babelrc is just\n // loading in the standard root directory.\n if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {\n return pkgData.directories.indexOf(absoluteRoot) !== -1;\n }\n\n return babelrcPatterns.some(pat => {\n if (typeof pat === \"string\") {\n pat = pathPatternToRegex(pat, babelrcRootsDirectory);\n }\n\n return pkgData.directories.some(directory => {\n return matchPattern(pat, babelrcRootsDirectory, directory, context);\n });\n });\n}\n\nconst validateConfigFile = makeWeakCacheSync(\n (file: ConfigFile): ValidatedFile => ({\n filepath: file.filepath,\n dirname: file.dirname,\n options: validate(\"configfile\", file.options, file.filepath),\n }),\n);\n\nconst validateBabelrcFile = makeWeakCacheSync(\n (file: ConfigFile): ValidatedFile => ({\n filepath: file.filepath,\n dirname: file.dirname,\n options: validate(\"babelrcfile\", file.options, file.filepath),\n }),\n);\n\nconst validateExtendFile = makeWeakCacheSync(\n (file: ConfigFile): ValidatedFile => ({\n filepath: file.filepath,\n dirname: file.dirname,\n options: validate(\"extendsfile\", file.options, file.filepath),\n }),\n);\n\n/**\n * Build a config chain for just the programmatic options passed into Babel.\n */\nconst loadProgrammaticChain = makeChainWalker({\n root: input => buildRootDescriptors(input, \"base\", createCachedDescriptors),\n env: (input, envName) =>\n buildEnvDescriptors(input, \"base\", createCachedDescriptors, envName),\n overrides: (input, index) =>\n buildOverrideDescriptors(input, \"base\", createCachedDescriptors, index),\n overridesEnv: (input, index, envName) =>\n buildOverrideEnvDescriptors(\n input,\n \"base\",\n createCachedDescriptors,\n index,\n envName,\n ),\n createLogger: (input, context, baseLogger) =>\n buildProgrammaticLogger(input, context, baseLogger),\n});\n\n/**\n * Build a config chain for a given file.\n */\nconst loadFileChainWalker = makeChainWalker({\n root: file => loadFileDescriptors(file),\n env: (file, envName) => loadFileEnvDescriptors(file)(envName),\n overrides: (file, index) => loadFileOverridesDescriptors(file)(index),\n overridesEnv: (file, index, envName) =>\n loadFileOverridesEnvDescriptors(file)(index)(envName),\n createLogger: (file, context, baseLogger) =>\n buildFileLogger(file.filepath, context, baseLogger),\n});\n\nfunction* loadFileChain(\n input: ValidatedFile,\n context: ConfigContext,\n files: Set,\n baseLogger: ConfigPrinter,\n) {\n const chain = yield* loadFileChainWalker(input, context, files, baseLogger);\n if (chain) {\n chain.files.add(input.filepath);\n }\n\n return chain;\n}\n\nconst loadFileDescriptors = makeWeakCacheSync((file: ValidatedFile) =>\n buildRootDescriptors(file, file.filepath, createUncachedDescriptors),\n);\nconst loadFileEnvDescriptors = makeWeakCacheSync((file: ValidatedFile) =>\n makeStrongCacheSync((envName: string) =>\n buildEnvDescriptors(\n file,\n file.filepath,\n createUncachedDescriptors,\n envName,\n ),\n ),\n);\nconst loadFileOverridesDescriptors = makeWeakCacheSync((file: ValidatedFile) =>\n makeStrongCacheSync((index: number) =>\n buildOverrideDescriptors(\n file,\n file.filepath,\n createUncachedDescriptors,\n index,\n ),\n ),\n);\nconst loadFileOverridesEnvDescriptors = makeWeakCacheSync(\n (file: ValidatedFile) =>\n makeStrongCacheSync((index: number) =>\n makeStrongCacheSync((envName: string) =>\n buildOverrideEnvDescriptors(\n file,\n file.filepath,\n createUncachedDescriptors,\n index,\n envName,\n ),\n ),\n ),\n);\n\nfunction buildFileLogger(\n filepath: string,\n context: ConfigContext,\n baseLogger: ConfigPrinter | void,\n) {\n if (!baseLogger) {\n return () => {};\n }\n return baseLogger.configure(context.showConfig, ChainFormatter.Config, {\n filepath,\n });\n}\n\nfunction buildRootDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n) {\n return descriptors(dirname, options, alias);\n}\n\nfunction buildProgrammaticLogger(\n _: unknown,\n context: ConfigContext,\n baseLogger: ConfigPrinter | void,\n) {\n if (!baseLogger) {\n return () => {};\n }\n return baseLogger.configure(context.showConfig, ChainFormatter.Programmatic, {\n callerName: context.caller?.name,\n });\n}\n\nfunction buildEnvDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n envName: string,\n) {\n const opts = options.env && options.env[envName];\n return opts ? descriptors(dirname, opts, `${alias}.env[\"${envName}\"]`) : null;\n}\n\nfunction buildOverrideDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n index: number,\n) {\n const opts = options.overrides && options.overrides[index];\n if (!opts) throw new Error(\"Assertion failure - missing override\");\n\n return descriptors(dirname, opts, `${alias}.overrides[${index}]`);\n}\n\nfunction buildOverrideEnvDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n index: number,\n envName: string,\n) {\n const override = options.overrides && options.overrides[index];\n if (!override) throw new Error(\"Assertion failure - missing override\");\n\n const opts = override.env && override.env[envName];\n return opts\n ? descriptors(\n dirname,\n opts,\n `${alias}.overrides[${index}].env[\"${envName}\"]`,\n )\n : null;\n}\n\nfunction makeChainWalker<\n ArgT extends {\n options: ValidatedOptions;\n dirname: string;\n filepath?: string;\n },\n>({\n root,\n env,\n overrides,\n overridesEnv,\n createLogger,\n}: {\n root: (configEntry: ArgT) => OptionsAndDescriptors;\n env: (configEntry: ArgT, env: string) => OptionsAndDescriptors | null;\n overrides: (configEntry: ArgT, index: number) => OptionsAndDescriptors;\n overridesEnv: (\n configEntry: ArgT,\n index: number,\n env: string,\n ) => OptionsAndDescriptors | null;\n createLogger: (\n configEntry: ArgT,\n context: ConfigContext,\n printer: ConfigPrinter | void,\n ) => (\n opts: OptionsAndDescriptors,\n index?: number | null,\n env?: string | null,\n ) => void;\n}): (\n configEntry: ArgT,\n context: ConfigContext,\n files?: Set,\n baseLogger?: ConfigPrinter,\n) => Handler {\n return function* chainWalker(input, context, files = new Set(), baseLogger) {\n const { dirname } = input;\n\n const flattenedConfigs: Array<{\n config: OptionsAndDescriptors;\n index: number | undefined | null;\n envName: string | undefined | null;\n }> = [];\n\n const rootOpts = root(input);\n if (configIsApplicable(rootOpts, dirname, context, input.filepath)) {\n flattenedConfigs.push({\n config: rootOpts,\n envName: undefined,\n index: undefined,\n });\n\n const envOpts = env(input, context.envName);\n if (\n envOpts &&\n configIsApplicable(envOpts, dirname, context, input.filepath)\n ) {\n flattenedConfigs.push({\n config: envOpts,\n envName: context.envName,\n index: undefined,\n });\n }\n\n (rootOpts.options.overrides || []).forEach((_, index) => {\n const overrideOps = overrides(input, index);\n if (configIsApplicable(overrideOps, dirname, context, input.filepath)) {\n flattenedConfigs.push({\n config: overrideOps,\n index,\n envName: undefined,\n });\n\n const overrideEnvOpts = overridesEnv(input, index, context.envName);\n if (\n overrideEnvOpts &&\n configIsApplicable(\n overrideEnvOpts,\n dirname,\n context,\n input.filepath,\n )\n ) {\n flattenedConfigs.push({\n config: overrideEnvOpts,\n index,\n envName: context.envName,\n });\n }\n }\n });\n }\n\n // Process 'ignore' and 'only' before 'extends' items are processed so\n // that we don't do extra work loading extended configs if a file is\n // ignored.\n if (\n flattenedConfigs.some(\n ({\n config: {\n options: { ignore, only },\n },\n }) => shouldIgnore(context, ignore, only, dirname),\n )\n ) {\n return null;\n }\n\n const chain = emptyChain();\n const logger = createLogger(input, context, baseLogger);\n\n for (const { config, index, envName } of flattenedConfigs) {\n if (\n !(yield* mergeExtendsChain(\n chain,\n config.options,\n dirname,\n context,\n files,\n baseLogger,\n ))\n ) {\n return null;\n }\n\n logger(config, index, envName);\n yield* mergeChainOpts(chain, config);\n }\n return chain;\n };\n}\n\nfunction* mergeExtendsChain(\n chain: ConfigChain,\n opts: ValidatedOptions,\n dirname: string,\n context: ConfigContext,\n files: Set,\n baseLogger?: ConfigPrinter,\n): Handler {\n if (opts.extends === undefined) return true;\n\n const file = yield* loadConfig(\n opts.extends,\n dirname,\n context.envName,\n context.caller,\n );\n\n if (files.has(file)) {\n throw new Error(\n `Configuration cycle detected loading ${file.filepath}.\\n` +\n `File already loaded following the config chain:\\n` +\n Array.from(files, file => ` - ${file.filepath}`).join(\"\\n\"),\n );\n }\n\n files.add(file);\n const fileChain = yield* loadFileChain(\n validateExtendFile(file),\n context,\n files,\n baseLogger,\n );\n files.delete(file);\n\n if (!fileChain) return false;\n\n mergeChain(chain, fileChain);\n\n return true;\n}\n\nfunction mergeChain(target: ConfigChain, source: ConfigChain): ConfigChain {\n target.options.push(...source.options);\n target.plugins.push(...source.plugins);\n target.presets.push(...source.presets);\n for (const file of source.files) {\n target.files.add(file);\n }\n\n return target;\n}\n\nfunction* mergeChainOpts(\n target: ConfigChain,\n { options, plugins, presets }: OptionsAndDescriptors,\n): Handler {\n target.options.push(options);\n target.plugins.push(...(yield* plugins()));\n target.presets.push(...(yield* presets()));\n\n return target;\n}\n\nfunction emptyChain(): ConfigChain {\n return {\n options: [],\n presets: [],\n plugins: [],\n files: new Set(),\n };\n}\n\nfunction normalizeOptions(opts: ValidatedOptions): ValidatedOptions {\n const options = {\n ...opts,\n };\n delete options.extends;\n delete options.env;\n delete options.overrides;\n delete options.plugins;\n delete options.presets;\n delete options.passPerPreset;\n delete options.ignore;\n delete options.only;\n delete options.test;\n delete options.include;\n delete options.exclude;\n\n // \"sourceMap\" is just aliased to sourceMap, so copy it over as\n // we merge the options together.\n if (Object.prototype.hasOwnProperty.call(options, \"sourceMap\")) {\n options.sourceMaps = options.sourceMap;\n delete options.sourceMap;\n }\n return options;\n}\n\nfunction dedupDescriptors(\n items: Array,\n): Array {\n const map: Map<\n Function,\n Map\n > = new Map();\n\n const descriptors = [];\n\n for (const item of items) {\n if (typeof item.value === \"function\") {\n const fnKey = item.value;\n let nameMap = map.get(fnKey);\n if (!nameMap) {\n nameMap = new Map();\n map.set(fnKey, nameMap);\n }\n let desc = nameMap.get(item.name);\n if (!desc) {\n desc = { value: item };\n descriptors.push(desc);\n\n // Treat passPerPreset presets as unique, skipping them\n // in the merge processing steps.\n if (!item.ownPass) nameMap.set(item.name, desc);\n } else {\n desc.value = item;\n }\n } else {\n descriptors.push({ value: item });\n }\n }\n\n return descriptors.reduce((acc, desc) => {\n acc.push(desc.value);\n return acc;\n }, []);\n}\n\nfunction configIsApplicable(\n { options }: OptionsAndDescriptors,\n dirname: string,\n context: ConfigContext,\n configName: string,\n): boolean {\n return (\n (options.test === undefined ||\n configFieldIsApplicable(context, options.test, dirname, configName)) &&\n (options.include === undefined ||\n configFieldIsApplicable(context, options.include, dirname, configName)) &&\n (options.exclude === undefined ||\n !configFieldIsApplicable(context, options.exclude, dirname, configName))\n );\n}\n\nfunction configFieldIsApplicable(\n context: ConfigContext,\n test: ConfigApplicableTest,\n dirname: string,\n configName: string,\n): boolean {\n const patterns = Array.isArray(test) ? test : [test];\n\n return matchesPatterns(context, patterns, dirname, configName);\n}\n\n/**\n * Print the ignoreList-values in a more helpful way than the default.\n */\nfunction ignoreListReplacer(\n _key: string,\n value: IgnoreList | IgnoreItem,\n): IgnoreList | IgnoreItem | string {\n if (value instanceof RegExp) {\n return String(value);\n }\n\n return value;\n}\n\n/**\n * Tests if a filename should be ignored based on \"ignore\" and \"only\" options.\n */\nfunction shouldIgnore(\n context: ConfigContext,\n ignore: IgnoreList | undefined | null,\n only: IgnoreList | undefined | null,\n dirname: string,\n): boolean {\n if (ignore && matchesPatterns(context, ignore, dirname)) {\n const message = `No config is applied to \"${\n context.filename ?? \"(unknown)\"\n }\" because it matches one of \\`ignore: ${JSON.stringify(\n ignore,\n ignoreListReplacer,\n )}\\` from \"${dirname}\"`;\n debug(message);\n if (context.showConfig) {\n console.log(message);\n }\n return true;\n }\n\n if (only && !matchesPatterns(context, only, dirname)) {\n const message = `No config is applied to \"${\n context.filename ?? \"(unknown)\"\n }\" because it fails to match one of \\`only: ${JSON.stringify(\n only,\n ignoreListReplacer,\n )}\\` from \"${dirname}\"`;\n debug(message);\n if (context.showConfig) {\n console.log(message);\n }\n return true;\n }\n\n return false;\n}\n\n/**\n * Returns result of calling function with filename if pattern is a function.\n * Otherwise returns result of matching pattern Regex with filename.\n */\nfunction matchesPatterns(\n context: ConfigContext,\n patterns: IgnoreList,\n dirname: string,\n configName?: string,\n): boolean {\n return patterns.some(pattern =>\n matchPattern(pattern, dirname, context.filename, context, configName),\n );\n}\n\nfunction matchPattern(\n pattern: IgnoreItem,\n dirname: string,\n pathToTest: string | undefined,\n context: ConfigContext,\n configName?: string,\n): boolean {\n if (typeof pattern === \"function\") {\n return !!endHiddenCallStack(pattern)(pathToTest, {\n dirname,\n envName: context.envName,\n caller: context.caller,\n });\n }\n\n if (typeof pathToTest !== \"string\") {\n throw new ConfigError(\n `Configuration contains string/RegExp pattern, but no filename was passed to Babel`,\n configName,\n );\n }\n\n if (typeof pattern === \"string\") {\n pattern = pathPatternToRegex(pattern, dirname);\n }\n return pattern.test(pathToTest);\n}\n"],"mappings":";;;;;;;;AAEA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAG,QAAA,GAAAF,OAAA;AASA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAGA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAIA,IAAAO,MAAA,GAAAP,OAAA;AAQA,IAAAQ,QAAA,GAAAR,OAAA;AAEA,IAAAS,kBAAA,GAAAT,OAAA;AAZA,MAAMU,KAAK,GAAGC,QAAU,CAAC,2BAA2B,CAAC;AAgD9C,UAAUC,gBAAgBA,CAC/BC,GAAmB,EACnBC,OAAY,EACiB;EAC7B,MAAMC,KAAK,GAAG,OAAOC,sBAAsB,CAACH,GAAG,EAAEC,OAAO,CAAC;EACzD,IAAI,CAACC,KAAK,EAAE,OAAO,IAAI;EAEvB,OAAO;IACLE,OAAO,EAAEC,gBAAgB,CAACH,KAAK,CAACE,OAAO,CAAC;IACxCE,OAAO,EAAED,gBAAgB,CAACH,KAAK,CAACI,OAAO,CAAC;IACxCC,OAAO,EAAEL,KAAK,CAACK,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIC,gBAAgB,CAACD,CAAC,CAAC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AI,WACrB,8CAA6CF,IAAI,CAACC,SAAS,CAC1D5C,IAAI,EACJqC,kBAAkB,CAClB,YAAW/H,OAAQ,GAAE;IACvB9C,KAAK,CAACkL,OAAO,CAAC;IACd,IAAI9K,OAAO,CAAC8E,UAAU,EAAE;MACtBC,OAAO,CAACC,GAAG,CAAC8F,OAAO,CAAC;IACtB;IACA,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd;AAMA,SAASN,eAAeA,CACtBxK,OAAsB,EACtBuK,QAAoB,EACpB7H,OAAe,EACf2H,UAAmB,EACV;EACT,OAAOE,QAAQ,CAACxE,IAAI,CAACmF,OAAO,IAC1BhF,YAAY,CAACgF,OAAO,EAAExI,OAAO,EAAE1C,OAAO,CAACkE,QAAQ,EAAElE,OAAO,EAAEqK,UAAU,CAAC,CACtE;AACH;AAEA,SAASnE,YAAYA,CACnBgF,OAAmB,EACnBxI,OAAe,EACfyI,UAA8B,EAC9BnL,OAAsB,EACtBqK,UAAmB,EACV;EACT,IAAI,OAAOa,OAAO,KAAK,UAAU,EAAE;IACjC,OAAO,CAAC,CAAC,IAAAE,qCAAkB,EAACF,OAAO,CAAC,CAACC,UAAU,EAAE;MAC/CzI,OAAO;MACPzB,OAAO,EAAEjB,OAAO,CAACiB,OAAO;MACxBgC,MAAM,EAAEjD,OAAO,CAACiD;IAClB,CAAC,CAAC;EACJ;EAEA,IAAI,OAAOkI,UAAU,KAAK,QAAQ,EAAE;IAClC,MAAM,IAAIE,oBAAW,CAClB,mFAAkF,EACnFhB,UAAU,CACX;EACH;EAEA,IAAI,OAAOa,OAAO,KAAK,QAAQ,EAAE;IAC/BA,OAAO,GAAG,IAAAlF,uBAAkB,EAACkF,OAAO,EAAExI,OAAO,CAAC;EAChD;EACA,OAAOwI,OAAO,CAACjC,IAAI,CAACkC,UAAU,CAAC;AACjC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/config-descriptors.js b/node_modules/@babel/core/lib/config/config-descriptors.js deleted file mode 100644 index 4173164a2..000000000 --- a/node_modules/@babel/core/lib/config/config-descriptors.js +++ /dev/null @@ -1,189 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.createCachedDescriptors = createCachedDescriptors; -exports.createDescriptor = createDescriptor; -exports.createUncachedDescriptors = createUncachedDescriptors; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _functional = require("../gensync-utils/functional"); -var _files = require("./files"); -var _item = require("./item"); -var _caching = require("./caching"); -var _resolveTargets = require("./resolve-targets"); -function isEqualDescriptor(a, b) { - return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && (a.file && a.file.request) === (b.file && b.file.request) && (a.file && a.file.resolved) === (b.file && b.file.resolved); -} -function* handlerOf(value) { - return value; -} -function optionsWithResolvedBrowserslistConfigFile(options, dirname) { - if (typeof options.browserslistConfigFile === "string") { - options.browserslistConfigFile = (0, _resolveTargets.resolveBrowserslistConfigFile)(options.browserslistConfigFile, dirname); - } - return options; -} -function createCachedDescriptors(dirname, options, alias) { - const { - plugins, - presets, - passPerPreset - } = options; - return { - options: optionsWithResolvedBrowserslistConfigFile(options, dirname), - plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => handlerOf([]), - presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => handlerOf([]) - }; -} -function createUncachedDescriptors(dirname, options, alias) { - return { - options: optionsWithResolvedBrowserslistConfigFile(options, dirname), - plugins: (0, _functional.once)(() => createPluginDescriptors(options.plugins || [], dirname, alias)), - presets: (0, _functional.once)(() => createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset)) - }; -} -const PRESET_DESCRIPTOR_CACHE = new WeakMap(); -const createCachedPresetDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => { - const dirname = cache.using(dir => dir); - return (0, _caching.makeStrongCacheSync)(alias => (0, _caching.makeStrongCache)(function* (passPerPreset) { - const descriptors = yield* createPresetDescriptors(items, dirname, alias, passPerPreset); - return descriptors.map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc)); - })); -}); -const PLUGIN_DESCRIPTOR_CACHE = new WeakMap(); -const createCachedPluginDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => { - const dirname = cache.using(dir => dir); - return (0, _caching.makeStrongCache)(function* (alias) { - const descriptors = yield* createPluginDescriptors(items, dirname, alias); - return descriptors.map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)); - }); -}); -const DEFAULT_OPTIONS = {}; -function loadCachedDescriptor(cache, desc) { - const { - value, - options = DEFAULT_OPTIONS - } = desc; - if (options === false) return desc; - let cacheByOptions = cache.get(value); - if (!cacheByOptions) { - cacheByOptions = new WeakMap(); - cache.set(value, cacheByOptions); - } - let possibilities = cacheByOptions.get(options); - if (!possibilities) { - possibilities = []; - cacheByOptions.set(options, possibilities); - } - if (possibilities.indexOf(desc) === -1) { - const matches = possibilities.filter(possibility => isEqualDescriptor(possibility, desc)); - if (matches.length > 0) { - return matches[0]; - } - possibilities.push(desc); - } - return desc; -} -function* createPresetDescriptors(items, dirname, alias, passPerPreset) { - return yield* createDescriptors("preset", items, dirname, alias, passPerPreset); -} -function* createPluginDescriptors(items, dirname, alias) { - return yield* createDescriptors("plugin", items, dirname, alias); -} -function* createDescriptors(type, items, dirname, alias, ownPass) { - const descriptors = yield* _gensync().all(items.map((item, index) => createDescriptor(item, dirname, { - type, - alias: `${alias}$${index}`, - ownPass: !!ownPass - }))); - assertNoDuplicates(descriptors); - return descriptors; -} -function* createDescriptor(pair, dirname, { - type, - alias, - ownPass -}) { - const desc = (0, _item.getItemDescriptor)(pair); - if (desc) { - return desc; - } - let name; - let options; - let value = pair; - if (Array.isArray(value)) { - if (value.length === 3) { - [value, options, name] = value; - } else { - [value, options] = value; - } - } - let file = undefined; - let filepath = null; - if (typeof value === "string") { - if (typeof type !== "string") { - throw new Error("To resolve a string-based item, the type of item must be given"); - } - const resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset; - const request = value; - ({ - filepath, - value - } = yield* resolver(value, dirname)); - file = { - request, - resolved: filepath - }; - } - if (!value) { - throw new Error(`Unexpected falsy value: ${String(value)}`); - } - if (typeof value === "object" && value.__esModule) { - if (value.default) { - value = value.default; - } else { - throw new Error("Must export a default export when using ES6 modules."); - } - } - if (typeof value !== "object" && typeof value !== "function") { - throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`); - } - if (filepath !== null && typeof value === "object" && value) { - throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`); - } - return { - name, - alias: filepath || alias, - value, - options, - dirname, - ownPass, - file - }; -} -function assertNoDuplicates(items) { - const map = new Map(); - for (const item of items) { - if (typeof item.value !== "function") continue; - let nameMap = map.get(item.value); - if (!nameMap) { - nameMap = new Set(); - map.set(item.value, nameMap); - } - if (nameMap.has(item.name)) { - const conflicts = items.filter(i => i.value === item.value); - throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`, ``, `Duplicates detected are:`, `${JSON.stringify(conflicts, null, 2)}`].join("\n")); - } - nameMap.add(item.name); - } -} -0 && 0; - -//# sourceMappingURL=config-descriptors.js.map diff --git a/node_modules/@babel/core/lib/config/config-descriptors.js.map b/node_modules/@babel/core/lib/config/config-descriptors.js.map deleted file mode 100644 index fbbe4264a..000000000 --- a/node_modules/@babel/core/lib/config/config-descriptors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","_functional","_files","_item","_caching","_resolveTargets","isEqualDescriptor","a","b","name","value","options","dirname","alias","ownPass","file","request","resolved","handlerOf","optionsWithResolvedBrowserslistConfigFile","browserslistConfigFile","resolveBrowserslistConfigFile","createCachedDescriptors","plugins","presets","passPerPreset","createCachedPluginDescriptors","createCachedPresetDescriptors","createUncachedDescriptors","once","createPluginDescriptors","createPresetDescriptors","PRESET_DESCRIPTOR_CACHE","WeakMap","makeWeakCacheSync","items","cache","using","dir","makeStrongCacheSync","makeStrongCache","descriptors","map","desc","loadCachedDescriptor","PLUGIN_DESCRIPTOR_CACHE","DEFAULT_OPTIONS","cacheByOptions","get","set","possibilities","indexOf","matches","filter","possibility","length","push","createDescriptors","type","gensync","all","item","index","createDescriptor","assertNoDuplicates","pair","getItemDescriptor","Array","isArray","undefined","filepath","Error","resolver","loadPlugin","loadPreset","String","__esModule","default","Map","nameMap","Set","has","conflicts","i","JSON","stringify","join","add"],"sources":["../../src/config/config-descriptors.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\nimport { once } from \"../gensync-utils/functional\";\n\nimport { loadPlugin, loadPreset } from \"./files\";\n\nimport { getItemDescriptor } from \"./item\";\n\nimport {\n makeWeakCacheSync,\n makeStrongCacheSync,\n makeStrongCache,\n} from \"./caching\";\nimport type { CacheConfigurator } from \"./caching\";\n\nimport type {\n ValidatedOptions,\n PluginList,\n PluginItem,\n} from \"./validation/options\";\n\nimport { resolveBrowserslistConfigFile } from \"./resolve-targets\";\n\n// Represents a config object and functions to lazily load the descriptors\n// for the plugins and presets so we don't load the plugins/presets unless\n// the options object actually ends up being applicable.\nexport type OptionsAndDescriptors = {\n options: ValidatedOptions;\n plugins: () => Handler>;\n presets: () => Handler>;\n};\n\n// Represents a plugin or presets at a given location in a config object.\n// At this point these have been resolved to a specific object or function,\n// but have not yet been executed to call functions with options.\nexport type UnloadedDescriptor = {\n name: string | undefined;\n value: any | Function;\n options: {} | undefined | false;\n dirname: string;\n alias: string;\n ownPass?: boolean;\n file?: {\n request: string;\n resolved: string;\n };\n};\n\nfunction isEqualDescriptor(\n a: UnloadedDescriptor,\n b: UnloadedDescriptor,\n): boolean {\n return (\n a.name === b.name &&\n a.value === b.value &&\n a.options === b.options &&\n a.dirname === b.dirname &&\n a.alias === b.alias &&\n a.ownPass === b.ownPass &&\n (a.file && a.file.request) === (b.file && b.file.request) &&\n (a.file && a.file.resolved) === (b.file && b.file.resolved)\n );\n}\n\nexport type ValidatedFile = {\n filepath: string;\n dirname: string;\n options: ValidatedOptions;\n};\n\n// eslint-disable-next-line require-yield\nfunction* handlerOf(value: T): Handler {\n return value;\n}\n\nfunction optionsWithResolvedBrowserslistConfigFile(\n options: ValidatedOptions,\n dirname: string,\n): ValidatedOptions {\n if (typeof options.browserslistConfigFile === \"string\") {\n options.browserslistConfigFile = resolveBrowserslistConfigFile(\n options.browserslistConfigFile,\n dirname,\n );\n }\n return options;\n}\n\n/**\n * Create a set of descriptors from a given options object, preserving\n * descriptor identity based on the identity of the plugin/preset arrays\n * themselves, and potentially on the identity of the plugins/presets + options.\n */\nexport function createCachedDescriptors(\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n): OptionsAndDescriptors {\n const { plugins, presets, passPerPreset } = options;\n return {\n options: optionsWithResolvedBrowserslistConfigFile(options, dirname),\n plugins: plugins\n ? () =>\n // @ts-expect-error todo(flow->ts) ts complains about incorrect arguments\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n createCachedPluginDescriptors(plugins, dirname)(alias)\n : () => handlerOf([]),\n presets: presets\n ? () =>\n // @ts-expect-error todo(flow->ts) ts complains about incorrect arguments\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n createCachedPresetDescriptors(presets, dirname)(alias)(\n !!passPerPreset,\n )\n : () => handlerOf([]),\n };\n}\n\n/**\n * Create a set of descriptors from a given options object, with consistent\n * identity for the descriptors, but not caching based on any specific identity.\n */\nexport function createUncachedDescriptors(\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n): OptionsAndDescriptors {\n return {\n options: optionsWithResolvedBrowserslistConfigFile(options, dirname),\n // The returned result here is cached to represent a config object in\n // memory, so we build and memoize the descriptors to ensure the same\n // values are returned consistently.\n plugins: once(() =>\n createPluginDescriptors(options.plugins || [], dirname, alias),\n ),\n presets: once(() =>\n createPresetDescriptors(\n options.presets || [],\n dirname,\n alias,\n !!options.passPerPreset,\n ),\n ),\n };\n}\n\nconst PRESET_DESCRIPTOR_CACHE = new WeakMap();\nconst createCachedPresetDescriptors = makeWeakCacheSync(\n (items: PluginList, cache: CacheConfigurator) => {\n const dirname = cache.using(dir => dir);\n return makeStrongCacheSync((alias: string) =>\n makeStrongCache(function* (\n passPerPreset: boolean,\n ): Handler> {\n const descriptors = yield* createPresetDescriptors(\n items,\n dirname,\n alias,\n passPerPreset,\n );\n return descriptors.map(\n // Items are cached using the overall preset array identity when\n // possibly, but individual descriptors are also cached if a match\n // can be found in the previously-used descriptor lists.\n desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc),\n );\n }),\n );\n },\n);\n\nconst PLUGIN_DESCRIPTOR_CACHE = new WeakMap();\nconst createCachedPluginDescriptors = makeWeakCacheSync(\n (items: PluginList, cache: CacheConfigurator) => {\n const dirname = cache.using(dir => dir);\n return makeStrongCache(function* (\n alias: string,\n ): Handler> {\n const descriptors = yield* createPluginDescriptors(items, dirname, alias);\n return descriptors.map(\n // Items are cached using the overall plugin array identity when\n // possibly, but individual descriptors are also cached if a match\n // can be found in the previously-used descriptor lists.\n desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc),\n );\n });\n },\n);\n\n/**\n * When no options object is given in a descriptor, this object is used\n * as a WeakMap key in order to have consistent identity.\n */\nconst DEFAULT_OPTIONS = {};\n\n/**\n * Given the cache and a descriptor, returns a matching descriptor from the\n * cache, or else returns the input descriptor and adds it to the cache for\n * next time.\n */\nfunction loadCachedDescriptor(\n cache: WeakMap<{} | Function, WeakMap<{}, Array>>,\n desc: UnloadedDescriptor,\n) {\n const { value, options = DEFAULT_OPTIONS } = desc;\n if (options === false) return desc;\n\n let cacheByOptions = cache.get(value);\n if (!cacheByOptions) {\n cacheByOptions = new WeakMap();\n cache.set(value, cacheByOptions);\n }\n\n let possibilities = cacheByOptions.get(options);\n if (!possibilities) {\n possibilities = [];\n cacheByOptions.set(options, possibilities);\n }\n\n if (possibilities.indexOf(desc) === -1) {\n const matches = possibilities.filter(possibility =>\n isEqualDescriptor(possibility, desc),\n );\n if (matches.length > 0) {\n return matches[0];\n }\n\n possibilities.push(desc);\n }\n\n return desc;\n}\n\nfunction* createPresetDescriptors(\n items: PluginList,\n dirname: string,\n alias: string,\n passPerPreset: boolean,\n): Handler> {\n return yield* createDescriptors(\n \"preset\",\n items,\n dirname,\n alias,\n passPerPreset,\n );\n}\n\nfunction* createPluginDescriptors(\n items: PluginList,\n dirname: string,\n alias: string,\n): Handler> {\n return yield* createDescriptors(\"plugin\", items, dirname, alias);\n}\n\nfunction* createDescriptors(\n type: \"plugin\" | \"preset\",\n items: PluginList,\n dirname: string,\n alias: string,\n ownPass?: boolean,\n): Handler> {\n const descriptors = yield* gensync.all(\n items.map((item, index) =>\n createDescriptor(item, dirname, {\n type,\n alias: `${alias}$${index}`,\n ownPass: !!ownPass,\n }),\n ),\n );\n\n assertNoDuplicates(descriptors);\n\n return descriptors;\n}\n\n/**\n * Given a plugin/preset item, resolve it into a standard format.\n */\nexport function* createDescriptor(\n pair: PluginItem,\n dirname: string,\n {\n type,\n alias,\n ownPass,\n }: {\n type?: \"plugin\" | \"preset\";\n alias: string;\n ownPass?: boolean;\n },\n): Handler {\n const desc = getItemDescriptor(pair);\n if (desc) {\n return desc;\n }\n\n let name;\n let options;\n // todo(flow->ts) better type annotation\n let value: any = pair;\n if (Array.isArray(value)) {\n if (value.length === 3) {\n [value, options, name] = value;\n } else {\n [value, options] = value;\n }\n }\n\n let file = undefined;\n let filepath = null;\n if (typeof value === \"string\") {\n if (typeof type !== \"string\") {\n throw new Error(\n \"To resolve a string-based item, the type of item must be given\",\n );\n }\n const resolver = type === \"plugin\" ? loadPlugin : loadPreset;\n const request = value;\n\n ({ filepath, value } = yield* resolver(value, dirname));\n\n file = {\n request,\n resolved: filepath,\n };\n }\n\n if (!value) {\n throw new Error(`Unexpected falsy value: ${String(value)}`);\n }\n\n if (typeof value === \"object\" && value.__esModule) {\n if (value.default) {\n value = value.default;\n } else {\n throw new Error(\"Must export a default export when using ES6 modules.\");\n }\n }\n\n if (typeof value !== \"object\" && typeof value !== \"function\") {\n throw new Error(\n `Unsupported format: ${typeof value}. Expected an object or a function.`,\n );\n }\n\n if (filepath !== null && typeof value === \"object\" && value) {\n // We allow object values for plugins/presets nested directly within a\n // config object, because it can be useful to define them in nested\n // configuration contexts.\n throw new Error(\n `Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`,\n );\n }\n\n return {\n name,\n alias: filepath || alias,\n value,\n options,\n dirname,\n ownPass,\n file,\n };\n}\n\nfunction assertNoDuplicates(items: Array): void {\n const map = new Map();\n\n for (const item of items) {\n if (typeof item.value !== \"function\") continue;\n\n let nameMap = map.get(item.value);\n if (!nameMap) {\n nameMap = new Set();\n map.set(item.value, nameMap);\n }\n\n if (nameMap.has(item.name)) {\n const conflicts = items.filter(i => i.value === item.value);\n throw new Error(\n [\n `Duplicate plugin/preset detected.`,\n `If you'd like to use two separate instances of a plugin,`,\n `they need separate names, e.g.`,\n ``,\n ` plugins: [`,\n ` ['some-plugin', {}],`,\n ` ['some-plugin', {}, 'some unique name'],`,\n ` ]`,\n ``,\n `Duplicates detected are:`,\n `${JSON.stringify(conflicts, null, 2)}`,\n ].join(\"\\n\"),\n );\n }\n\n nameMap.add(item.name);\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,IAAAE,WAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAaA,IAAAK,eAAA,GAAAL,OAAA;AA2BA,SAASM,iBAAiBA,CACxBC,CAAqB,EACrBC,CAAqB,EACZ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AEAP,OAAO,CAACQ,GAAG,CAAC1B,IAAI,CAACpD,IAAI,CAAC;EACxB;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/configuration.js b/node_modules/@babel/core/lib/config/files/configuration.js deleted file mode 100644 index 414cef79c..000000000 --- a/node_modules/@babel/core/lib/config/files/configuration.js +++ /dev/null @@ -1,284 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ROOT_CONFIG_FILENAMES = void 0; -exports.findConfigUpwards = findConfigUpwards; -exports.findRelativeConfig = findRelativeConfig; -exports.findRootConfig = findRootConfig; -exports.loadConfig = loadConfig; -exports.resolveShowConfigPath = resolveShowConfigPath; -function _debug() { - const data = require("debug"); - _debug = function () { - return data; - }; - return data; -} -function _fs() { - const data = require("fs"); - _fs = function () { - return data; - }; - return data; -} -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -function _json() { - const data = require("json5"); - _json = function () { - return data; - }; - return data; -} -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _caching = require("../caching"); -var _configApi = require("../helpers/config-api"); -var _utils = require("./utils"); -var _moduleTypes = require("./module-types"); -var _patternToRegex = require("../pattern-to-regex"); -var _configError = require("../../errors/config-error"); -var fs = require("../../gensync-utils/fs"); -var _rewriteStackTrace = require("../../errors/rewrite-stack-trace"); -const debug = _debug()("babel:config:loading:files:configuration"); -const ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json", "babel.config.cts"]; -exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES; -const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json", ".babelrc.cts"]; -const BABELIGNORE_FILENAME = ".babelignore"; -const LOADING_CONFIGS = new Set(); -const readConfigCode = (0, _caching.makeStrongCache)(function* readConfigCode(filepath, cache) { - if (!_fs().existsSync(filepath)) { - cache.never(); - return null; - } - if (LOADING_CONFIGS.has(filepath)) { - cache.never(); - debug("Auto-ignoring usage of config %o.", filepath); - return { - filepath, - dirname: _path().dirname(filepath), - options: {} - }; - } - let options; - try { - LOADING_CONFIGS.add(filepath); - options = yield* (0, _moduleTypes.default)(filepath, "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously."); - } finally { - LOADING_CONFIGS.delete(filepath); - } - let assertCache = false; - if (typeof options === "function") { - yield* []; - options = (0, _rewriteStackTrace.endHiddenCallStack)(options)((0, _configApi.makeConfigAPI)(cache)); - assertCache = true; - } - if (!options || typeof options !== "object" || Array.isArray(options)) { - throw new _configError.default(`Configuration should be an exported JavaScript object.`, filepath); - } - if (typeof options.then === "function") { - throw new _configError.default(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`, filepath); - } - if (assertCache && !cache.configured()) throwConfigError(filepath); - return { - filepath, - dirname: _path().dirname(filepath), - options - }; -}); -const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => { - const babel = file.options["babel"]; - if (typeof babel === "undefined") return null; - if (typeof babel !== "object" || Array.isArray(babel) || babel === null) { - throw new _configError.default(`.babel property must be an object`, file.filepath); - } - return { - filepath: file.filepath, - dirname: file.dirname, - options: babel - }; -}); -const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => { - let options; - try { - options = _json().parse(content); - } catch (err) { - throw new _configError.default(`Error while parsing config - ${err.message}`, filepath); - } - if (!options) throw new _configError.default(`No config detected`, filepath); - if (typeof options !== "object") { - throw new _configError.default(`Config returned typeof ${typeof options}`, filepath); - } - if (Array.isArray(options)) { - throw new _configError.default(`Expected config object but found array`, filepath); - } - delete options["$schema"]; - return { - filepath, - dirname: _path().dirname(filepath), - options - }; -}); -const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) => { - const ignoreDir = _path().dirname(filepath); - const ignorePatterns = content.split("\n").map(line => line.replace(/#(.*?)$/, "").trim()).filter(line => !!line); - for (const pattern of ignorePatterns) { - if (pattern[0] === "!") { - throw new _configError.default(`Negation of file paths is not supported.`, filepath); - } - } - return { - filepath, - dirname: _path().dirname(filepath), - ignore: ignorePatterns.map(pattern => (0, _patternToRegex.default)(pattern, ignoreDir)) - }; -}); -function findConfigUpwards(rootDir) { - let dirname = rootDir; - for (;;) { - for (const filename of ROOT_CONFIG_FILENAMES) { - if (_fs().existsSync(_path().join(dirname, filename))) { - return dirname; - } - } - const nextDir = _path().dirname(dirname); - if (dirname === nextDir) break; - dirname = nextDir; - } - return null; -} -function* findRelativeConfig(packageData, envName, caller) { - let config = null; - let ignore = null; - const dirname = _path().dirname(packageData.filepath); - for (const loc of packageData.directories) { - if (!config) { - var _packageData$pkg; - config = yield* loadOneConfig(RELATIVE_CONFIG_FILENAMES, loc, envName, caller, ((_packageData$pkg = packageData.pkg) == null ? void 0 : _packageData$pkg.dirname) === loc ? packageToBabelConfig(packageData.pkg) : null); - } - if (!ignore) { - const ignoreLoc = _path().join(loc, BABELIGNORE_FILENAME); - ignore = yield* readIgnoreConfig(ignoreLoc); - if (ignore) { - debug("Found ignore %o from %o.", ignore.filepath, dirname); - } - } - } - return { - config, - ignore - }; -} -function findRootConfig(dirname, envName, caller) { - return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller); -} -function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) { - const configs = yield* _gensync().all(names.map(filename => readConfig(_path().join(dirname, filename), envName, caller))); - const config = configs.reduce((previousConfig, config) => { - if (config && previousConfig) { - throw new _configError.default(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`); - } - return config || previousConfig; - }, previousConfig); - if (config) { - debug("Found configuration %o from %o.", config.filepath, dirname); - } - return config; -} -function* loadConfig(name, dirname, envName, caller) { - const filepath = (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, { - paths: [b] - }, M = require("module")) => { - let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); - if (f) return f; - f = new Error(`Cannot resolve module '${r}'`); - f.code = "MODULE_NOT_FOUND"; - throw f; - })(name, { - paths: [dirname] - }); - const conf = yield* readConfig(filepath, envName, caller); - if (!conf) { - throw new _configError.default(`Config file contains no configuration data`, filepath); - } - debug("Loaded config %o from %o.", name, dirname); - return conf; -} -function readConfig(filepath, envName, caller) { - const ext = _path().extname(filepath); - switch (ext) { - case ".js": - case ".cjs": - case ".mjs": - case ".cts": - return readConfigCode(filepath, { - envName, - caller - }); - default: - return readConfigJSON5(filepath); - } -} -function* resolveShowConfigPath(dirname) { - const targetPath = process.env.BABEL_SHOW_CONFIG_FOR; - if (targetPath != null) { - const absolutePath = _path().resolve(dirname, targetPath); - const stats = yield* fs.stat(absolutePath); - if (!stats.isFile()) { - throw new Error(`${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`); - } - return absolutePath; - } - return null; -} -function throwConfigError(filepath) { - throw new _configError.default(`\ -Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured -for various types of caching, using the first param of their handler functions: - -module.exports = function(api) { - // The API exposes the following: - - // Cache the returned value forever and don't call this function again. - api.cache(true); - - // Don't cache at all. Not recommended because it will be very slow. - api.cache(false); - - // Cached based on the value of some function. If this function returns a value different from - // a previously-encountered value, the plugins will re-evaluate. - var env = api.cache(() => process.env.NODE_ENV); - - // If testing for a specific env, we recommend specifics to avoid instantiating a plugin for - // any possible NODE_ENV value that might come up during plugin execution. - var isProd = api.cache(() => process.env.NODE_ENV === "production"); - - // .cache(fn) will perform a linear search though instances to find the matching plugin based - // based on previous instantiated plugins. If you want to recreate the plugin and discard the - // previous instance whenever something changes, you may use: - var isProd = api.cache.invalidate(() => process.env.NODE_ENV === "production"); - - // Note, we also expose the following more-verbose versions of the above examples: - api.cache.forever(); // api.cache(true) - api.cache.never(); // api.cache(false) - api.cache.using(fn); // api.cache(fn) - - // Return the value that will be cached. - return { }; -};`, filepath); -} -0 && 0; - -//# sourceMappingURL=configuration.js.map diff --git a/node_modules/@babel/core/lib/config/files/configuration.js.map b/node_modules/@babel/core/lib/config/files/configuration.js.map deleted file mode 100644 index e6a027ac1..000000000 --- a/node_modules/@babel/core/lib/config/files/configuration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_debug","data","require","_fs","_path","_json","_gensync","_caching","_configApi","_utils","_moduleTypes","_patternToRegex","_configError","fs","_rewriteStackTrace","debug","buildDebug","ROOT_CONFIG_FILENAMES","exports","RELATIVE_CONFIG_FILENAMES","BABELIGNORE_FILENAME","LOADING_CONFIGS","Set","readConfigCode","makeStrongCache","filepath","cache","nodeFs","existsSync","never","has","dirname","path","options","add","loadCodeDefault","delete","assertCache","endHiddenCallStack","makeConfigAPI","Array","isArray","ConfigError","then","configured","throwConfigError","packageToBabelConfig","makeWeakCacheSync","file","babel","readConfigJSON5","makeStaticFileCache","content","json5","parse","err","message","readIgnoreConfig","ignoreDir","ignorePatterns","split","map","line","replace","trim","filter","pattern","ignore","pathPatternToRegex","findConfigUpwards","rootDir","filename","join","nextDir","findRelativeConfig","packageData","envName","caller","config","loc","directories","_packageData$pkg","loadOneConfig","pkg","ignoreLoc","findRootConfig","names","previousConfig","configs","gensync","all","readConfig","reduce","basename","loadConfig","name","v","w","process","versions","node","resolve","r","paths","b","M","f","_findPath","_nodeModulePaths","concat","Error","code","conf","ext","extname","resolveShowConfigPath","targetPath","env","BABEL_SHOW_CONFIG_FOR","absolutePath","stats","stat","isFile"],"sources":["../../../src/config/files/configuration.ts"],"sourcesContent":["import buildDebug from \"debug\";\nimport nodeFs from \"fs\";\nimport path from \"path\";\nimport json5 from \"json5\";\nimport gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport { makeStrongCache, makeWeakCacheSync } from \"../caching\";\nimport type { CacheConfigurator } from \"../caching\";\nimport { makeConfigAPI } from \"../helpers/config-api\";\nimport type { ConfigAPI } from \"../helpers/config-api\";\nimport { makeStaticFileCache } from \"./utils\";\nimport loadCodeDefault from \"./module-types\";\nimport pathPatternToRegex from \"../pattern-to-regex\";\nimport type { FilePackageData, RelativeConfig, ConfigFile } from \"./types\";\nimport type { CallerMetadata } from \"../validation/options\";\nimport ConfigError from \"../../errors/config-error\";\n\nimport * as fs from \"../../gensync-utils/fs\";\n\nimport { createRequire } from \"module\";\nimport { endHiddenCallStack } from \"../../errors/rewrite-stack-trace\";\nconst require = createRequire(import.meta.url);\n\nconst debug = buildDebug(\"babel:config:loading:files:configuration\");\n\nexport const ROOT_CONFIG_FILENAMES = [\n \"babel.config.js\",\n \"babel.config.cjs\",\n \"babel.config.mjs\",\n \"babel.config.json\",\n \"babel.config.cts\",\n];\nconst RELATIVE_CONFIG_FILENAMES = [\n \".babelrc\",\n \".babelrc.js\",\n \".babelrc.cjs\",\n \".babelrc.mjs\",\n \".babelrc.json\",\n \".babelrc.cts\",\n];\n\nconst BABELIGNORE_FILENAME = \".babelignore\";\n\nconst LOADING_CONFIGS = new Set();\n\nconst readConfigCode = makeStrongCache(function* readConfigCode(\n filepath: string,\n cache: CacheConfigurator<{\n envName: string;\n caller: CallerMetadata | undefined;\n }>,\n): Handler {\n if (!nodeFs.existsSync(filepath)) {\n cache.never();\n return null;\n }\n\n // The `require()` call below can make this code reentrant if a require hook like @babel/register has been\n // loaded into the system. That would cause Babel to attempt to compile the `.babelrc.js` file as it loads\n // below. To cover this case, we auto-ignore re-entrant config processing.\n if (LOADING_CONFIGS.has(filepath)) {\n cache.never();\n\n debug(\"Auto-ignoring usage of config %o.\", filepath);\n return {\n filepath,\n dirname: path.dirname(filepath),\n options: {},\n };\n }\n\n let options: unknown;\n try {\n LOADING_CONFIGS.add(filepath);\n options = yield* loadCodeDefault(\n filepath,\n \"You appear to be using a native ECMAScript module configuration \" +\n \"file, which is only supported when running Babel asynchronously.\",\n );\n } finally {\n LOADING_CONFIGS.delete(filepath);\n }\n\n let assertCache = false;\n if (typeof options === \"function\") {\n // @ts-expect-error - if we want to make it possible to use async configs\n yield* [];\n\n options = endHiddenCallStack(options as any as (api: ConfigAPI) => {})(\n makeConfigAPI(cache),\n );\n\n assertCache = true;\n }\n\n if (!options || typeof options !== \"object\" || Array.isArray(options)) {\n throw new ConfigError(\n `Configuration should be an exported JavaScript object.`,\n filepath,\n );\n }\n\n // @ts-expect-error todo(flow->ts)\n if (typeof options.then === \"function\") {\n throw new ConfigError(\n `You appear to be using an async configuration, ` +\n `which your current version of Babel does not support. ` +\n `We may add support for this in the future, ` +\n `but if you're on the most recent version of @babel/core and still ` +\n `seeing this error, then you'll need to synchronously return your config.`,\n filepath,\n );\n }\n\n if (assertCache && !cache.configured()) throwConfigError(filepath);\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n});\n\nconst packageToBabelConfig = makeWeakCacheSync(\n (file: ConfigFile): ConfigFile | null => {\n const babel: unknown = file.options[\"babel\"];\n\n if (typeof babel === \"undefined\") return null;\n\n if (typeof babel !== \"object\" || Array.isArray(babel) || babel === null) {\n throw new ConfigError(`.babel property must be an object`, file.filepath);\n }\n\n return {\n filepath: file.filepath,\n dirname: file.dirname,\n options: babel,\n };\n },\n);\n\nconst readConfigJSON5 = makeStaticFileCache((filepath, content): ConfigFile => {\n let options;\n try {\n options = json5.parse(content);\n } catch (err) {\n throw new ConfigError(\n `Error while parsing config - ${err.message}`,\n filepath,\n );\n }\n\n if (!options) throw new ConfigError(`No config detected`, filepath);\n\n if (typeof options !== \"object\") {\n throw new ConfigError(`Config returned typeof ${typeof options}`, filepath);\n }\n if (Array.isArray(options)) {\n throw new ConfigError(`Expected config object but found array`, filepath);\n }\n\n delete options[\"$schema\"];\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n});\n\nconst readIgnoreConfig = makeStaticFileCache((filepath, content) => {\n const ignoreDir = path.dirname(filepath);\n const ignorePatterns = content\n .split(\"\\n\")\n .map(line => line.replace(/#(.*?)$/, \"\").trim())\n .filter(line => !!line);\n\n for (const pattern of ignorePatterns) {\n if (pattern[0] === \"!\") {\n throw new ConfigError(\n `Negation of file paths is not supported.`,\n filepath,\n );\n }\n }\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n ignore: ignorePatterns.map(pattern =>\n pathPatternToRegex(pattern, ignoreDir),\n ),\n };\n});\n\nexport function findConfigUpwards(rootDir: string): string | null {\n let dirname = rootDir;\n for (;;) {\n for (const filename of ROOT_CONFIG_FILENAMES) {\n if (nodeFs.existsSync(path.join(dirname, filename))) {\n return dirname;\n }\n }\n\n const nextDir = path.dirname(dirname);\n if (dirname === nextDir) break;\n dirname = nextDir;\n }\n\n return null;\n}\n\nexport function* findRelativeConfig(\n packageData: FilePackageData,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n let config = null;\n let ignore = null;\n\n const dirname = path.dirname(packageData.filepath);\n\n for (const loc of packageData.directories) {\n if (!config) {\n config = yield* loadOneConfig(\n RELATIVE_CONFIG_FILENAMES,\n loc,\n envName,\n caller,\n packageData.pkg?.dirname === loc\n ? packageToBabelConfig(packageData.pkg)\n : null,\n );\n }\n\n if (!ignore) {\n const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME);\n ignore = yield* readIgnoreConfig(ignoreLoc);\n\n if (ignore) {\n debug(\"Found ignore %o from %o.\", ignore.filepath, dirname);\n }\n }\n }\n\n return { config, ignore };\n}\n\nexport function findRootConfig(\n dirname: string,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);\n}\n\nfunction* loadOneConfig(\n names: string[],\n dirname: string,\n envName: string,\n caller: CallerMetadata | undefined,\n previousConfig: ConfigFile | null = null,\n): Handler {\n const configs = yield* gensync.all(\n names.map(filename =>\n readConfig(path.join(dirname, filename), envName, caller),\n ),\n );\n const config = configs.reduce((previousConfig: ConfigFile | null, config) => {\n if (config && previousConfig) {\n throw new ConfigError(\n `Multiple configuration files found. Please remove one:\\n` +\n ` - ${path.basename(previousConfig.filepath)}\\n` +\n ` - ${config.filepath}\\n` +\n `from ${dirname}`,\n );\n }\n\n return config || previousConfig;\n }, previousConfig);\n\n if (config) {\n debug(\"Found configuration %o from %o.\", config.filepath, dirname);\n }\n return config;\n}\n\nexport function* loadConfig(\n name: string,\n dirname: string,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n const filepath = require.resolve(name, { paths: [dirname] });\n\n const conf = yield* readConfig(filepath, envName, caller);\n if (!conf) {\n throw new ConfigError(\n `Config file contains no configuration data`,\n filepath,\n );\n }\n\n debug(\"Loaded config %o from %o.\", name, dirname);\n return conf;\n}\n\n/**\n * Read the given config file, returning the result. Returns null if no config was found, but will\n * throw if there are parsing errors while loading a config.\n */\nfunction readConfig(\n filepath: string,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n const ext = path.extname(filepath);\n switch (ext) {\n case \".js\":\n case \".cjs\":\n case \".mjs\":\n case \".cts\":\n return readConfigCode(filepath, { envName, caller });\n default:\n return readConfigJSON5(filepath);\n }\n}\n\nexport function* resolveShowConfigPath(\n dirname: string,\n): Handler {\n const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;\n if (targetPath != null) {\n const absolutePath = path.resolve(dirname, targetPath);\n const stats = yield* fs.stat(absolutePath);\n if (!stats.isFile()) {\n throw new Error(\n `${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`,\n );\n }\n return absolutePath;\n }\n return null;\n}\n\nfunction throwConfigError(filepath: string): never {\n throw new ConfigError(\n `\\\nCaching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured\nfor various types of caching, using the first param of their handler functions:\n\nmodule.exports = function(api) {\n // The API exposes the following:\n\n // Cache the returned value forever and don't call this function again.\n api.cache(true);\n\n // Don't cache at all. Not recommended because it will be very slow.\n api.cache(false);\n\n // Cached based on the value of some function. If this function returns a value different from\n // a previously-encountered value, the plugins will re-evaluate.\n var env = api.cache(() => process.env.NODE_ENV);\n\n // If testing for a specific env, we recommend specifics to avoid instantiating a plugin for\n // any possible NODE_ENV value that might come up during plugin execution.\n var isProd = api.cache(() => process.env.NODE_ENV === \"production\");\n\n // .cache(fn) will perform a linear search though instances to find the matching plugin based\n // based on previous instantiated plugins. If you want to recreate the plugin and discard the\n // previous instance whenever something changes, you may use:\n var isProd = api.cache.invalidate(() => process.env.NODE_ENV === \"production\");\n\n // Note, we also expose the following more-verbose versions of the above examples:\n api.cache.forever(); // api.cache(true)\n api.cache.never(); // api.cache(false)\n api.cache.using(fn); // api.cache(fn)\n\n // Return the value that will be cached.\n return { };\n};`,\n filepath,\n );\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,IAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAM,QAAA,GAAAL,OAAA;AAEA,IAAAM,UAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA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 No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/import-meta-resolve.js b/node_modules/@babel/core/lib/config/files/import-meta-resolve.js deleted file mode 100644 index 16eef9cb6..000000000 --- a/node_modules/@babel/core/lib/config/files/import-meta-resolve.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = resolve; -var _importMetaResolve = require("../../vendor/import-meta-resolve"); -let importMetaResolve; -{ - importMetaResolve = _importMetaResolve.resolve; -} -function resolve(specifier, parent) { - return importMetaResolve(specifier, parent); -} -0 && 0; - -//# sourceMappingURL=import-meta-resolve.js.map diff --git a/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map b/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map deleted file mode 100644 index e2b751e71..000000000 --- a/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_importMetaResolve","require","importMetaResolve","polyfill","resolve","specifier","parent"],"sources":["../../../src/config/files/import-meta-resolve.ts"],"sourcesContent":["import { resolve as polyfill } from \"../../vendor/import-meta-resolve\";\n\ndeclare const USE_ESM: boolean;\n\nlet importMetaResolve: (specifier: string, parent: string) => string;\n\nif (USE_ESM) {\n // Node.js < 20, when using the `--experimental-import-meta-resolve` flag,\n // have an asynchronous implementation of import.meta.resolve.\n if (\n typeof import.meta.resolve === \"function\" &&\n typeof import.meta.resolve(import.meta.url) === \"string\"\n ) {\n // @ts-expect-error: TS defines import.meta as returning a promise\n importMetaResolve = import.meta.resolve;\n } else {\n importMetaResolve = polyfill;\n }\n} else {\n importMetaResolve = polyfill;\n}\n\nexport default function resolve(\n specifier: string,\n parent?: string | URL,\n): string {\n // @ts-expect-error: TS defines import.meta.resolve as returning a promises\n return importMetaResolve(specifier, parent);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAIA,IAAIC,iBAAgE;AAc7D;EACLA,iBAAiB,GAAGC,0BAAQ;AAC9B;AAEe,SAASC,OAAOA,CAC7BC,SAAiB,EACjBC,MAAqB,EACb;EAER,OAAOJ,iBAAiB,CAACG,SAAS,EAAEC,MAAM,CAAC;AAC7C;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/import.cjs b/node_modules/@babel/core/lib/config/files/import.cjs deleted file mode 100644 index 46fa5d5cf..000000000 --- a/node_modules/@babel/core/lib/config/files/import.cjs +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = function import_(filepath) { - return import(filepath); -}; -0 && 0; - -//# sourceMappingURL=import.cjs.map diff --git a/node_modules/@babel/core/lib/config/files/import.cjs.map b/node_modules/@babel/core/lib/config/files/import.cjs.map deleted file mode 100644 index 90ec96816..000000000 --- a/node_modules/@babel/core/lib/config/files/import.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["module","exports","import_","filepath"],"sources":["../../../src/config/files/import.cjs"],"sourcesContent":["// We keep this in a separate file so that in older node versions, where\n// import() isn't supported, we can try/catch around the require() call\n// when loading this file.\n\nmodule.exports = function import_(filepath) {\n return import(filepath);\n};\n"],"mappings":"AAIAA,MAAM,CAACC,OAAO,GAAG,SAASC,OAAOA,CAACC,QAAQ,EAAE;EAC1C,OAAO,MAAM,CAACA,QAAQ,CAAC;AACzB,CAAC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/index-browser.js b/node_modules/@babel/core/lib/config/files/index-browser.js deleted file mode 100644 index 903b79573..000000000 --- a/node_modules/@babel/core/lib/config/files/index-browser.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ROOT_CONFIG_FILENAMES = void 0; -exports.findConfigUpwards = findConfigUpwards; -exports.findPackageData = findPackageData; -exports.findRelativeConfig = findRelativeConfig; -exports.findRootConfig = findRootConfig; -exports.loadConfig = loadConfig; -exports.loadPlugin = loadPlugin; -exports.loadPreset = loadPreset; -exports.resolvePlugin = resolvePlugin; -exports.resolvePreset = resolvePreset; -exports.resolveShowConfigPath = resolveShowConfigPath; -function findConfigUpwards(rootDir) { - return null; -} -function* findPackageData(filepath) { - return { - filepath, - directories: [], - pkg: null, - isPackage: false - }; -} -function* findRelativeConfig(pkgData, envName, caller) { - return { - config: null, - ignore: null - }; -} -function* findRootConfig(dirname, envName, caller) { - return null; -} -function* loadConfig(name, dirname, envName, caller) { - throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`); -} -function* resolveShowConfigPath(dirname) { - return null; -} -const ROOT_CONFIG_FILENAMES = []; -exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES; -function resolvePlugin(name, dirname) { - return null; -} -function resolvePreset(name, dirname) { - return null; -} -function loadPlugin(name, dirname) { - throw new Error(`Cannot load plugin ${name} relative to ${dirname} in a browser`); -} -function loadPreset(name, dirname) { - throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`); -} -0 && 0; - -//# sourceMappingURL=index-browser.js.map diff --git a/node_modules/@babel/core/lib/config/files/index-browser.js.map b/node_modules/@babel/core/lib/config/files/index-browser.js.map deleted file mode 100644 index 62e4eca84..000000000 --- a/node_modules/@babel/core/lib/config/files/index-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["findConfigUpwards","rootDir","findPackageData","filepath","directories","pkg","isPackage","findRelativeConfig","pkgData","envName","caller","config","ignore","findRootConfig","dirname","loadConfig","name","Error","resolveShowConfigPath","ROOT_CONFIG_FILENAMES","exports","resolvePlugin","resolvePreset","loadPlugin","loadPreset"],"sources":["../../../src/config/files/index-browser.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types\";\n\nimport type { CallerMetadata } from \"../validation/options\";\n\nexport type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData };\n\nexport function findConfigUpwards(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n rootDir: string,\n): string | null {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* findPackageData(filepath: string): Handler {\n return {\n filepath,\n directories: [],\n pkg: null,\n isPackage: false,\n };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRelativeConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n pkgData: FilePackageData,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler {\n return { config: null, ignore: null };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRootConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* loadConfig(\n name: string,\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler {\n throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);\n}\n\n// eslint-disable-next-line require-yield\nexport function* resolveShowConfigPath(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n): Handler {\n return null;\n}\n\nexport const ROOT_CONFIG_FILENAMES: string[] = [];\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePlugin(name: string, dirname: string): string | null {\n return null;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePreset(name: string, dirname: string): string | null {\n return null;\n}\n\nexport function loadPlugin(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n throw new Error(\n `Cannot load plugin ${name} relative to ${dirname} in a browser`,\n );\n}\n\nexport function loadPreset(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n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ACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/index.js b/node_modules/@babel/core/lib/config/files/index.js deleted file mode 100644 index d11981e06..000000000 --- a/node_modules/@babel/core/lib/config/files/index.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", { - enumerable: true, - get: function () { - return _configuration.ROOT_CONFIG_FILENAMES; - } -}); -Object.defineProperty(exports, "findConfigUpwards", { - enumerable: true, - get: function () { - return _configuration.findConfigUpwards; - } -}); -Object.defineProperty(exports, "findPackageData", { - enumerable: true, - get: function () { - return _package.findPackageData; - } -}); -Object.defineProperty(exports, "findRelativeConfig", { - enumerable: true, - get: function () { - return _configuration.findRelativeConfig; - } -}); -Object.defineProperty(exports, "findRootConfig", { - enumerable: true, - get: function () { - return _configuration.findRootConfig; - } -}); -Object.defineProperty(exports, "loadConfig", { - enumerable: true, - get: function () { - return _configuration.loadConfig; - } -}); -Object.defineProperty(exports, "loadPlugin", { - enumerable: true, - get: function () { - return _plugins.loadPlugin; - } -}); -Object.defineProperty(exports, "loadPreset", { - enumerable: true, - get: function () { - return _plugins.loadPreset; - } -}); -Object.defineProperty(exports, "resolvePlugin", { - enumerable: true, - get: function () { - return _plugins.resolvePlugin; - } -}); -Object.defineProperty(exports, "resolvePreset", { - enumerable: true, - get: function () { - return _plugins.resolvePreset; - } -}); -Object.defineProperty(exports, "resolveShowConfigPath", { - enumerable: true, - get: function () { - return _configuration.resolveShowConfigPath; - } -}); -var _package = require("./package"); -var _configuration = require("./configuration"); -var _plugins = require("./plugins"); -({}); -0 && 0; - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/core/lib/config/files/index.js.map b/node_modules/@babel/core/lib/config/files/index.js.map deleted file mode 100644 index 965cc1884..000000000 --- a/node_modules/@babel/core/lib/config/files/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_package","require","_configuration","_plugins"],"sources":["../../../src/config/files/index.ts"],"sourcesContent":["type indexBrowserType = typeof import(\"./index-browser\");\ntype indexType = typeof import(\"./index\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of index-browser, since this file may be replaced at bundle time with index-browser.\n({}) as any as indexBrowserType as indexType;\n\nexport { findPackageData } from \"./package\";\n\nexport {\n findConfigUpwards,\n findRelativeConfig,\n findRootConfig,\n loadConfig,\n resolveShowConfigPath,\n ROOT_CONFIG_FILENAMES,\n} from \"./configuration\";\nexport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types\";\nexport {\n loadPlugin,\n loadPreset,\n resolvePlugin,\n resolvePreset,\n} from \"./plugins\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAcA,IAAAE,QAAA,GAAAF,OAAA;AAlBA,CAAC,CAAC,CAAC;AAA0C"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/module-types.js b/node_modules/@babel/core/lib/config/files/module-types.js deleted file mode 100644 index 60dda9b70..000000000 --- a/node_modules/@babel/core/lib/config/files/module-types.js +++ /dev/null @@ -1,155 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = loadCodeDefault; -exports.supportsESM = void 0; -var _async = require("../../gensync-utils/async"); -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -function _url() { - const data = require("url"); - _url = function () { - return data; - }; - return data; -} -function _semver() { - const data = require("semver"); - _semver = function () { - return data; - }; - return data; -} -var _rewriteStackTrace = require("../../errors/rewrite-stack-trace"); -var _configError = require("../../errors/config-error"); -var _transformFile = require("../../transform-file"); -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -let import_; -try { - import_ = require("./import.cjs"); -} catch (_unused) {} -const supportsESM = _semver().satisfies(process.versions.node, "^12.17 || >=13.2"); -exports.supportsESM = supportsESM; -function* loadCodeDefault(filepath, asyncError) { - switch (_path().extname(filepath)) { - case ".cjs": - { - return loadCjsDefault(filepath, arguments[2]); - } - case ".mjs": - break; - case ".cts": - return loadCtsDefault(filepath); - default: - try { - { - return loadCjsDefault(filepath, arguments[2]); - } - } catch (e) { - if (e.code !== "ERR_REQUIRE_ESM") throw e; - } - } - if (yield* (0, _async.isAsync)()) { - return yield* (0, _async.waitFor)(loadMjsDefault(filepath)); - } - throw new _configError.default(asyncError, filepath); -} -function loadCtsDefault(filepath) { - const ext = ".cts"; - const hasTsSupport = !!(require.extensions[".ts"] || require.extensions[".cts"] || require.extensions[".mts"]); - let handler; - if (!hasTsSupport) { - const opts = { - babelrc: false, - configFile: false, - sourceType: "unambiguous", - sourceMaps: "inline", - sourceFileName: _path().basename(filepath), - presets: [[getTSPreset(filepath), Object.assign({ - onlyRemoveTypeImports: true, - optimizeConstEnums: true - }, { - allowDeclareFields: true - })]] - }; - handler = function (m, filename) { - if (handler && filename.endsWith(ext)) { - try { - return m._compile((0, _transformFile.transformFileSync)(filename, Object.assign({}, opts, { - filename - })).code, filename); - } catch (error) { - if (!hasTsSupport) { - const packageJson = require("@babel/preset-typescript/package.json"); - if (_semver().lt(packageJson.version, "7.21.4")) { - console.error("`.cts` configuration file failed to load, please try to update `@babel/preset-typescript`."); - } - } - throw error; - } - } - return require.extensions[".js"](m, filename); - }; - require.extensions[ext] = handler; - } - try { - const module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath); - return module != null && module.__esModule ? module.default : module; - } finally { - if (!hasTsSupport) { - if (require.extensions[ext] === handler) delete require.extensions[ext]; - handler = undefined; - } - } -} -function loadCjsDefault(filepath) { - const module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath); - { - return module != null && module.__esModule ? module.default || (arguments[1] ? module : undefined) : module; - } -} -function loadMjsDefault(_x) { - return _loadMjsDefault.apply(this, arguments); -} -function _loadMjsDefault() { - _loadMjsDefault = _asyncToGenerator(function* (filepath) { - if (!import_) { - throw new _configError.default("Internal error: Native ECMAScript modules aren't supported by this platform.\n", filepath); - } - const module = yield (0, _rewriteStackTrace.endHiddenCallStack)(import_)((0, _url().pathToFileURL)(filepath)); - return module.default; - }); - return _loadMjsDefault.apply(this, arguments); -} -function getTSPreset(filepath) { - try { - return require("@babel/preset-typescript"); - } catch (error) { - if (error.code !== "MODULE_NOT_FOUND") throw error; - let message = "You appear to be using a .cts file as Babel configuration, but the `@babel/preset-typescript` package was not found: please install it!"; - { - if (process.versions.pnp) { - message += ` -If you are using Yarn Plug'n'Play, you may also need to add the following configuration to your .yarnrc.yml file: - -packageExtensions: -\t"@babel/core@*": -\t\tpeerDependencies: -\t\t\t"@babel/preset-typescript": "*" -`; - } - } - throw new _configError.default(message, filepath); - } -} -0 && 0; - -//# sourceMappingURL=module-types.js.map diff --git a/node_modules/@babel/core/lib/config/files/module-types.js.map b/node_modules/@babel/core/lib/config/files/module-types.js.map deleted file mode 100644 index 064d37eb7..000000000 --- a/node_modules/@babel/core/lib/config/files/module-types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_async","require","_path","data","_url","_semver","_rewriteStackTrace","_configError","_transformFile","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","import_","_unused","supportsESM","semver","satisfies","process","versions","node","exports","loadCodeDefault","filepath","asyncError","path","extname","loadCjsDefault","loadCtsDefault","e","code","isAsync","waitFor","loadMjsDefault","ConfigError","ext","hasTsSupport","extensions","handler","opts","babelrc","configFile","sourceType","sourceMaps","sourceFileName","basename","presets","getTSPreset","Object","assign","onlyRemoveTypeImports","optimizeConstEnums","allowDeclareFields","m","filename","endsWith","_compile","transformFileSync","packageJson","lt","version","console","module","endHiddenCallStack","__esModule","default","_x","_loadMjsDefault","pathToFileURL","message","pnp"],"sources":["../../../src/config/files/module-types.ts"],"sourcesContent":["import { isAsync, waitFor } from \"../../gensync-utils/async\";\nimport type { Handler } from \"gensync\";\nimport path from \"path\";\nimport { pathToFileURL } from \"url\";\nimport { createRequire } from \"module\";\nimport semver from \"semver\";\n\nimport { endHiddenCallStack } from \"../../errors/rewrite-stack-trace\";\nimport ConfigError from \"../../errors/config-error\";\n\nimport type { InputOptions } from \"..\";\nimport { transformFileSync } from \"../../transform-file\";\n\nconst require = createRequire(import.meta.url);\n\nlet import_: ((specifier: string | URL) => any) | undefined;\ntry {\n // Old Node.js versions don't support import() syntax.\n import_ = require(\"./import.cjs\");\n} catch {}\n\nexport const supportsESM = semver.satisfies(\n process.versions.node,\n // older versions, starting from 10, support the dynamic\n // import syntax but always return a rejected promise.\n \"^12.17 || >=13.2\",\n);\n\nexport default function* loadCodeDefault(\n filepath: string,\n asyncError: string,\n): Handler {\n switch (path.extname(filepath)) {\n case \".cjs\":\n if (process.env.BABEL_8_BREAKING) {\n return loadCjsDefault(filepath);\n } else {\n return loadCjsDefault(\n filepath,\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n /* fallbackToTranspiledModule */ arguments[2],\n );\n }\n case \".mjs\":\n break;\n case \".cts\":\n return loadCtsDefault(filepath);\n default:\n try {\n if (process.env.BABEL_8_BREAKING) {\n return loadCjsDefault(filepath);\n } else {\n return loadCjsDefault(\n filepath,\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n /* fallbackToTranspiledModule */ arguments[2],\n );\n }\n } catch (e) {\n if (e.code !== \"ERR_REQUIRE_ESM\") throw e;\n }\n }\n if (yield* isAsync()) {\n return yield* waitFor(loadMjsDefault(filepath));\n }\n throw new ConfigError(asyncError, filepath);\n}\n\nfunction loadCtsDefault(filepath: string) {\n const ext = \".cts\";\n const hasTsSupport = !!(\n require.extensions[\".ts\"] ||\n require.extensions[\".cts\"] ||\n require.extensions[\".mts\"]\n );\n\n let handler: NodeJS.RequireExtensions[\"\"];\n\n if (!hasTsSupport) {\n const opts: InputOptions = {\n babelrc: false,\n configFile: false,\n sourceType: \"unambiguous\",\n sourceMaps: \"inline\",\n sourceFileName: path.basename(filepath),\n presets: [\n [\n getTSPreset(filepath),\n {\n onlyRemoveTypeImports: true,\n optimizeConstEnums: true,\n ...(process.env.BABEL_8_BREAKING\n ? {}\n : { allowDeclareFields: true }),\n },\n ],\n ],\n };\n\n handler = function (m, filename) {\n // If we want to support `.ts`, `.d.ts` must be handled specially.\n if (handler && filename.endsWith(ext)) {\n try {\n // @ts-expect-error Undocumented API\n return m._compile(\n transformFileSync(filename, {\n ...opts,\n filename,\n }).code,\n filename,\n );\n } catch (error) {\n if (!hasTsSupport) {\n const packageJson = require(\"@babel/preset-typescript/package.json\");\n if (semver.lt(packageJson.version, \"7.21.4\")) {\n console.error(\n \"`.cts` configuration file failed to load, please try to update `@babel/preset-typescript`.\",\n );\n }\n }\n throw error;\n }\n }\n return require.extensions[\".js\"](m, filename);\n };\n require.extensions[ext] = handler;\n }\n try {\n const module = endHiddenCallStack(require)(filepath);\n return module?.__esModule ? module.default : module;\n } finally {\n if (!hasTsSupport) {\n if (require.extensions[ext] === handler) delete require.extensions[ext];\n handler = undefined;\n }\n }\n}\n\nfunction loadCjsDefault(filepath: string) {\n const module = endHiddenCallStack(require)(filepath);\n if (process.env.BABEL_8_BREAKING) {\n return module?.__esModule ? module.default : module;\n } else {\n return module?.__esModule\n ? module.default ||\n /* fallbackToTranspiledModule */ (arguments[1] ? module : undefined)\n : module;\n }\n}\n\nasync function loadMjsDefault(filepath: string) {\n if (!import_) {\n throw new ConfigError(\n \"Internal error: Native ECMAScript modules aren't supported by this platform.\\n\",\n filepath,\n );\n }\n\n // import() expects URLs, not file paths.\n // https://github.com/nodejs/node/issues/31710\n const module = await endHiddenCallStack(import_)(pathToFileURL(filepath));\n return module.default;\n}\n\nfunction getTSPreset(filepath: string) {\n try {\n // eslint-disable-next-line import/no-extraneous-dependencies\n return require(\"@babel/preset-typescript\");\n } catch (error) {\n if (error.code !== \"MODULE_NOT_FOUND\") throw error;\n\n let message =\n \"You appear to be using a .cts file as Babel configuration, but the `@babel/preset-typescript` package was not found: please install it!\";\n\n if (!process.env.BABEL_8_BREAKING) {\n if (process.versions.pnp) {\n // Using Yarn PnP, which doesn't allow requiring packages that are not\n // explicitly specified as dependencies.\n message += `\nIf you are using Yarn Plug'n'Play, you may also need to add the following configuration to your .yarnrc.yml file:\n\npackageExtensions:\n\\t\"@babel/core@*\":\n\\t\\tpeerDependencies:\n\\t\\t\\t\"@babel/preset-typescript\": \"*\"\n`;\n }\n }\n\n throw new ConfigError(message, filepath);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,SAAAC,MAAA;EAAA,MAAAC,IAAA,GAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAC,KAAA;EAAA,MAAAD,IAAA,GAAAF,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAD,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAF,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAG,kBAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAGA,IAAAO,cAAA,GAAAP,OAAA;AAAyD,SAAAQ,mBAAA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AG7C;IACL,OAAOuC,MAAM,YAANA,MAAM,CAAEE,UAAU,GACrBF,MAAM,CAACG,OAAO,KACsBxD,SAAS,CAAC,CAAC,CAAC,GAAGqD,MAAM,GAAGlD,SAAS,CAAC,GACtEkD,MAAM;EACZ;AACF;AAAC,SAEc7B,cAAcA,CAAAiC,EAAA;EAAA,OAAAC,eAAA,CAAAzD,KAAA,OAAAD,SAAA;AAAA;AAAA,SAAA0D,gBAAA;EAAAA,eAAA,GAAA9D,iBAAA,CAA7B,WAA8BkB,QAAgB,EAAE;IAC9C,IAAI,CAACV,OAAO,EAAE;MACZ,MAAM,IAAIqB,oBAAW,CACnB,gFAAgF,EAChFX,QAAQ,CACT;IACH;IAIA,MAAMuC,MAAM,SAAS,IAAAC,qCAAkB,EAAClD,OAAO,CAAC,CAAC,IAAAuD,oBAAa,EAAC7C,QAAQ,CAAC,CAAC;IACzE,OAAOuC,MAAM,CAACG,OAAO;EACvB,CAAC;EAAA,OAAAE,eAAA,CAAAzD,KAAA,OAAAD,SAAA;AAAA;AAED,SAASsC,WAAWA,CAACxB,QAAgB,EAAE;EACrC,IAAI;IAEF,OAAOxC,OAAO,CAAC,0BAA0B,CAAC;EAC5C,CAAC,CAAC,OAAOkB,KAAK,EAAE;IACd,IAAIA,KAAK,CAAC6B,IAAI,KAAK,kBAAkB,EAAE,MAAM7B,KAAK;IAElD,IAAIoE,OAAO,GACT,yIAAyI;IAExG;MACjC,IAAInD,OAAO,CAACC,QAAQ,CAACmD,GAAG,EAAE;QAGxBD,OAAO,IAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;MACK;IACF;IAEA,MAAM,IAAInC,oBAAW,CAACmC,OAAO,EAAE9C,QAAQ,CAAC;EAC1C;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/package.js b/node_modules/@babel/core/lib/config/files/package.js deleted file mode 100644 index 4d2195de7..000000000 --- a/node_modules/@babel/core/lib/config/files/package.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.findPackageData = findPackageData; -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -var _utils = require("./utils"); -var _configError = require("../../errors/config-error"); -const PACKAGE_FILENAME = "package.json"; -const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) => { - let options; - try { - options = JSON.parse(content); - } catch (err) { - throw new _configError.default(`Error while parsing JSON - ${err.message}`, filepath); - } - if (!options) throw new Error(`${filepath}: No config detected`); - if (typeof options !== "object") { - throw new _configError.default(`Config returned typeof ${typeof options}`, filepath); - } - if (Array.isArray(options)) { - throw new _configError.default(`Expected config object but found array`, filepath); - } - return { - filepath, - dirname: _path().dirname(filepath), - options - }; -}); -function* findPackageData(filepath) { - let pkg = null; - const directories = []; - let isPackage = true; - let dirname = _path().dirname(filepath); - while (!pkg && _path().basename(dirname) !== "node_modules") { - directories.push(dirname); - pkg = yield* readConfigPackage(_path().join(dirname, PACKAGE_FILENAME)); - const nextLoc = _path().dirname(dirname); - if (dirname === nextLoc) { - isPackage = false; - break; - } - dirname = nextLoc; - } - return { - filepath, - directories, - pkg, - isPackage - }; -} -0 && 0; - -//# sourceMappingURL=package.js.map diff --git a/node_modules/@babel/core/lib/config/files/package.js.map b/node_modules/@babel/core/lib/config/files/package.js.map deleted file mode 100644 index 770151ecb..000000000 --- a/node_modules/@babel/core/lib/config/files/package.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_path","data","require","_utils","_configError","PACKAGE_FILENAME","readConfigPackage","makeStaticFileCache","filepath","content","options","JSON","parse","err","ConfigError","message","Error","Array","isArray","dirname","path","findPackageData","pkg","directories","isPackage","basename","push","join","nextLoc"],"sources":["../../../src/config/files/package.ts"],"sourcesContent":["import path from \"path\";\nimport type { Handler } from \"gensync\";\nimport { makeStaticFileCache } from \"./utils\";\n\nimport type { ConfigFile, FilePackageData } from \"./types\";\n\nimport ConfigError from \"../../errors/config-error\";\n\nconst PACKAGE_FILENAME = \"package.json\";\n\nconst readConfigPackage = makeStaticFileCache(\n (filepath, content): ConfigFile => {\n let options;\n try {\n options = JSON.parse(content) as unknown;\n } catch (err) {\n throw new ConfigError(\n `Error while parsing JSON - ${err.message}`,\n filepath,\n );\n }\n\n if (!options) throw new Error(`${filepath}: No config detected`);\n\n if (typeof options !== \"object\") {\n throw new ConfigError(\n `Config returned typeof ${typeof options}`,\n filepath,\n );\n }\n if (Array.isArray(options)) {\n throw new ConfigError(`Expected config object but found array`, filepath);\n }\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n },\n);\n\n/**\n * Find metadata about the package that this file is inside of. Resolution\n * of Babel's config requires general package information to decide when to\n * search for .babelrc files\n */\nexport function* findPackageData(filepath: string): Handler {\n let pkg = null;\n const directories = [];\n let isPackage = true;\n\n let dirname = path.dirname(filepath);\n while (!pkg && path.basename(dirname) !== \"node_modules\") {\n directories.push(dirname);\n\n pkg = yield* readConfigPackage(path.join(dirname, PACKAGE_FILENAME));\n\n const nextLoc = path.dirname(dirname);\n if (dirname === nextLoc) {\n isPackage = false;\n break;\n }\n dirname = nextLoc;\n }\n\n return { filepath, directories, pkg, isPackage };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,MAAA,GAAAD,OAAA;AAIA,IAAAE,YAAA,GAAAF,OAAA;AAEA,MAAMG,gBAAgB,GAAG,cAAc;AAEvC,MAAMC,iBAAiB,GAAG,IAAAC,0BAAmB,EAC3C,CAACC,QAAQ,EAAEC,OAAO,KAAiB;EACjC,IAAIC,OAAO;EACX,IAAI;IACFA,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,OAAO,CAAY;EAC1C,CAAC,CAAC,OAAOI,GAAG,EAAE;IACZ,MAAM,IAAIC,oBAAW,CAClB,8BA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ib/config/files/plugins.js b/node_modules/@babel/core/lib/config/files/plugins.js deleted file mode 100644 index 22d6facb4..000000000 --- a/node_modules/@babel/core/lib/config/files/plugins.js +++ /dev/null @@ -1,192 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.loadPlugin = loadPlugin; -exports.loadPreset = loadPreset; -exports.resolvePreset = exports.resolvePlugin = void 0; -function _debug() { - const data = require("debug"); - _debug = function () { - return data; - }; - return data; -} -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -var _async = require("../../gensync-utils/async"); -var _moduleTypes = require("./module-types"); -function _url() { - const data = require("url"); - _url = function () { - return data; - }; - return data; -} -var _importMetaResolve = require("./import-meta-resolve"); -const debug = _debug()("babel:config:loading:files:plugins"); -const EXACT_RE = /^module:/; -const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/; -const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/; -const BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/; -const BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/; -const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-plugin(?:-|\/|$)|[^/]+\/)/; -const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-preset(?:-|\/|$)|[^/]+\/)/; -const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/; -const resolvePlugin = resolveStandardizedName.bind(null, "plugin"); -exports.resolvePlugin = resolvePlugin; -const resolvePreset = resolveStandardizedName.bind(null, "preset"); -exports.resolvePreset = resolvePreset; -function* loadPlugin(name, dirname) { - const filepath = resolvePlugin(name, dirname, yield* (0, _async.isAsync)()); - const value = yield* requireModule("plugin", filepath); - debug("Loaded plugin %o from %o.", name, dirname); - return { - filepath, - value - }; -} -function* loadPreset(name, dirname) { - const filepath = resolvePreset(name, dirname, yield* (0, _async.isAsync)()); - const value = yield* requireModule("preset", filepath); - debug("Loaded preset %o from %o.", name, dirname); - return { - filepath, - value - }; -} -function standardizeName(type, name) { - if (_path().isAbsolute(name)) return name; - const isPreset = type === "preset"; - return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, `babel-${type}-`).replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, `$1${type}-`).replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, `$1babel-${type}-`).replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`).replace(EXACT_RE, ""); -} -function* resolveAlternativesHelper(type, name) { - const standardizedName = standardizeName(type, name); - const { - error, - value - } = yield standardizedName; - if (!error) return value; - if (error.code !== "MODULE_NOT_FOUND") throw error; - if (standardizedName !== name && !(yield name).error) { - error.message += `\n- If you want to resolve "${name}", use "module:${name}"`; - } - if (!(yield standardizeName(type, "@babel/" + name)).error) { - error.message += `\n- Did you mean "@babel/${name}"?`; - } - const oppositeType = type === "preset" ? "plugin" : "preset"; - if (!(yield standardizeName(oppositeType, name)).error) { - error.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`; - } - throw error; -} -function tryRequireResolve(id, dirname) { - try { - if (dirname) { - return { - error: null, - value: (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, { - paths: [b] - }, M = require("module")) => { - let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); - if (f) return f; - f = new Error(`Cannot resolve module '${r}'`); - f.code = "MODULE_NOT_FOUND"; - throw f; - })(id, { - paths: [dirname] - }) - }; - } else { - return { - error: null, - value: require.resolve(id) - }; - } - } catch (error) { - return { - error, - value: null - }; - } -} -function tryImportMetaResolve(id, options) { - try { - return { - error: null, - value: (0, _importMetaResolve.default)(id, options) - }; - } catch (error) { - return { - error, - value: null - }; - } -} -function resolveStandardizedNameForRequire(type, name, dirname) { - const it = resolveAlternativesHelper(type, name); - let res = it.next(); - while (!res.done) { - res = it.next(tryRequireResolve(res.value, dirname)); - } - return res.value; -} -function resolveStandardizedNameForImport(type, name, dirname) { - const parentUrl = (0, _url().pathToFileURL)(_path().join(dirname, "./babel-virtual-resolve-base.js")).href; - const it = resolveAlternativesHelper(type, name); - let res = it.next(); - while (!res.done) { - res = it.next(tryImportMetaResolve(res.value, parentUrl)); - } - return (0, _url().fileURLToPath)(res.value); -} -function resolveStandardizedName(type, name, dirname, resolveESM) { - if (!_moduleTypes.supportsESM || !resolveESM) { - return resolveStandardizedNameForRequire(type, name, dirname); - } - try { - return resolveStandardizedNameForImport(type, name, dirname); - } catch (e) { - try { - return resolveStandardizedNameForRequire(type, name, dirname); - } catch (e2) { - if (e.type === "MODULE_NOT_FOUND") throw e; - if (e2.type === "MODULE_NOT_FOUND") throw e2; - throw e; - } - } -} -{ - var LOADING_MODULES = new Set(); -} -function* requireModule(type, name) { - { - if (!(yield* (0, _async.isAsync)()) && LOADING_MODULES.has(name)) { - throw new Error(`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.'); - } - } - try { - { - LOADING_MODULES.add(name); - } - { - return yield* (0, _moduleTypes.default)(name, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously.", true); - } - } catch (err) { - err.message = `[BABEL]: ${err.message} (While processing: ${name})`; - throw err; - } finally { - { - LOADING_MODULES.delete(name); - } - } -} -0 && 0; - -//# sourceMappingURL=plugins.js.map diff --git a/node_modules/@babel/core/lib/config/files/plugins.js.map b/node_modules/@babel/core/lib/config/files/plugins.js.map deleted file mode 100644 index ad8c1fe24..000000000 --- a/node_modules/@babel/core/lib/config/files/plugins.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_debug","data","require","_path","_async","_moduleTypes","_url","_importMetaResolve","debug","buildDebug","EXACT_RE","BABEL_PLUGIN_PREFIX_RE","BABEL_PRESET_PREFIX_RE","BABEL_PLUGIN_ORG_RE","BABEL_PRESET_ORG_RE","OTHER_PLUGIN_ORG_RE","OTHER_PRESET_ORG_RE","OTHER_ORG_DEFAULT_RE","resolvePlugin","resolveStandardizedName","bind","exports","resolvePreset","loadPlugin","name","dirname","filepath","isAsync","value","requireModule","loadPreset","standardizeName","type","path","isAbsolute","isPreset","replace","resolveAlternativesHelper","standardizedName","error","code","message","oppositeType","tryRequireResolve","id","v","w","split","process","versions","node","resolve","r","paths","b","M","f","_findPath","_nodeModulePaths","concat","Error","tryImportMetaResolve","options","importMetaResolve","resolveStandardizedNameForRequire","it","res","next","done","resolveStandardizedNameForImport","parentUrl","pathToFileURL","join","href","fileURLToPath","resolveESM","supportsESM","e","e2","LOADING_MODULES","Set","has","add","loadCodeDefault","err","delete"],"sources":["../../../src/config/files/plugins.ts"],"sourcesContent":["/**\n * This file handles all logic for converting string-based configuration references into loaded objects.\n */\n\nimport buildDebug from \"debug\";\nimport path from \"path\";\nimport type { Handler } from \"gensync\";\nimport { isAsync } from \"../../gensync-utils/async\";\nimport loadCodeDefault, { supportsESM } from \"./module-types\";\nimport { fileURLToPath, pathToFileURL } from \"url\";\n\nimport importMetaResolve from \"./import-meta-resolve\";\n\nimport { createRequire } from \"module\";\nconst require = createRequire(import.meta.url);\n\nconst debug = buildDebug(\"babel:config:loading:files:plugins\");\n\nconst EXACT_RE = /^module:/;\nconst BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\\/|babel-plugin-)/;\nconst BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\\/|babel-preset-)/;\nconst BABEL_PLUGIN_ORG_RE = /^(@babel\\/)(?!plugin-|[^/]+\\/)/;\nconst BABEL_PRESET_ORG_RE = /^(@babel\\/)(?!preset-|[^/]+\\/)/;\nconst OTHER_PLUGIN_ORG_RE =\n /^(@(?!babel\\/)[^/]+\\/)(?![^/]*babel-plugin(?:-|\\/|$)|[^/]+\\/)/;\nconst OTHER_PRESET_ORG_RE =\n /^(@(?!babel\\/)[^/]+\\/)(?![^/]*babel-preset(?:-|\\/|$)|[^/]+\\/)/;\nconst OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;\n\nexport const resolvePlugin = resolveStandardizedName.bind(null, \"plugin\");\nexport const resolvePreset = resolveStandardizedName.bind(null, \"preset\");\n\nexport function* loadPlugin(\n name: string,\n dirname: string,\n): Handler<{ filepath: string; value: unknown }> {\n const filepath = resolvePlugin(name, dirname, yield* isAsync());\n\n const value = yield* requireModule(\"plugin\", filepath);\n debug(\"Loaded plugin %o from %o.\", name, dirname);\n\n return { filepath, value };\n}\n\nexport function* loadPreset(\n name: string,\n dirname: string,\n): Handler<{ filepath: string; value: unknown }> {\n const filepath = resolvePreset(name, dirname, yield* isAsync());\n\n const value = yield* requireModule(\"preset\", filepath);\n\n debug(\"Loaded preset %o from %o.\", name, dirname);\n\n return { filepath, value };\n}\n\nfunction standardizeName(type: \"plugin\" | \"preset\", name: string) {\n // Let absolute and relative paths through.\n if (path.isAbsolute(name)) return name;\n\n const isPreset = type === \"preset\";\n\n return (\n name\n // foo -> babel-preset-foo\n .replace(\n isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE,\n `babel-${type}-`,\n )\n // @babel/es2015 -> @babel/preset-es2015\n .replace(\n isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE,\n `$1${type}-`,\n )\n // @foo/mypreset -> @foo/babel-preset-mypreset\n .replace(\n isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE,\n `$1babel-${type}-`,\n )\n // @foo -> @foo/babel-preset\n .replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`)\n // module:mypreset -> mypreset\n .replace(EXACT_RE, \"\")\n );\n}\n\ntype Result = { error: Error; value: null } | { error: null; value: T };\n\nfunction* resolveAlternativesHelper(\n type: \"plugin\" | \"preset\",\n name: string,\n): Iterator> {\n const standardizedName = standardizeName(type, name);\n const { error, value } = yield standardizedName;\n if (!error) return value;\n\n // @ts-expect-error code may not index error\n if (error.code !== \"MODULE_NOT_FOUND\") throw error;\n\n if (standardizedName !== name && !(yield name).error) {\n error.message += `\\n- If you want to resolve \"${name}\", use \"module:${name}\"`;\n }\n\n if (!(yield standardizeName(type, \"@babel/\" + name)).error) {\n error.message += `\\n- Did you mean \"@babel/${name}\"?`;\n }\n\n const oppositeType = type === \"preset\" ? \"plugin\" : \"preset\";\n if (!(yield standardizeName(oppositeType, name)).error) {\n error.message += `\\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;\n }\n\n throw error;\n}\n\nfunction tryRequireResolve(\n id: string,\n dirname: string | undefined,\n): Result {\n try {\n if (dirname) {\n return { error: null, value: require.resolve(id, { paths: [dirname] }) };\n } else {\n return { error: null, value: require.resolve(id) };\n }\n } catch (error) {\n return { error, value: null };\n }\n}\n\nfunction tryImportMetaResolve(\n id: Parameters[0],\n options: Parameters[1],\n): Result {\n try {\n return { error: null, value: importMetaResolve(id, options) };\n } catch (error) {\n return { error, value: null };\n }\n}\n\nfunction resolveStandardizedNameForRequire(\n type: \"plugin\" | \"preset\",\n name: string,\n dirname: string,\n) {\n const it = resolveAlternativesHelper(type, name);\n let res = it.next();\n while (!res.done) {\n res = it.next(tryRequireResolve(res.value, dirname));\n }\n return res.value;\n}\nfunction resolveStandardizedNameForImport(\n type: \"plugin\" | \"preset\",\n name: string,\n dirname: string,\n) {\n const parentUrl = pathToFileURL(\n path.join(dirname, \"./babel-virtual-resolve-base.js\"),\n ).href;\n\n const it = resolveAlternativesHelper(type, name);\n let res = it.next();\n while (!res.done) {\n res = it.next(tryImportMetaResolve(res.value, parentUrl));\n }\n return fileURLToPath(res.value);\n}\n\nfunction resolveStandardizedName(\n type: \"plugin\" | \"preset\",\n name: string,\n dirname: string,\n resolveESM: boolean,\n) {\n if (!supportsESM || !resolveESM) {\n return resolveStandardizedNameForRequire(type, name, dirname);\n }\n\n try {\n return resolveStandardizedNameForImport(type, name, dirname);\n } catch (e) {\n try {\n return resolveStandardizedNameForRequire(type, name, dirname);\n } catch (e2) {\n if (e.type === \"MODULE_NOT_FOUND\") throw e;\n if (e2.type === \"MODULE_NOT_FOUND\") throw e2;\n throw e;\n }\n }\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var LOADING_MODULES = new Set();\n}\nfunction* requireModule(type: string, name: string): Handler {\n if (!process.env.BABEL_8_BREAKING) {\n if (!(yield* isAsync()) && LOADING_MODULES.has(name)) {\n throw new Error(\n `Reentrant ${type} detected trying to load \"${name}\". This module is not ignored ` +\n \"and is trying to load itself while compiling itself, leading to a dependency cycle. \" +\n 'We recommend adding it to your \"ignore\" list in your babelrc, or to a .babelignore.',\n );\n }\n }\n\n try {\n if (!process.env.BABEL_8_BREAKING) {\n LOADING_MODULES.add(name);\n }\n\n if (process.env.BABEL_8_BREAKING) {\n return yield* loadCodeDefault(\n name,\n `You appear to be using a native ECMAScript module ${type}, ` +\n \"which is only supported when running Babel asynchronously.\",\n );\n } else {\n return yield* loadCodeDefault(\n name,\n `You appear to be using a native ECMAScript module ${type}, ` +\n \"which is only supported when running Babel asynchronously.\",\n // For backward compatibility, we need to support malformed presets\n // defined as separate named exports rather than a single default\n // export.\n // See packages/babel-core/test/fixtures/option-manager/presets/es2015_named.js\n // @ts-ignore(Babel 7 vs Babel 8) This param has been removed\n true,\n );\n }\n } catch (err) {\n err.message = `[BABEL]: ${err.message} (While processing: ${name})`;\n throw err;\n } finally {\n if (!process.env.BABEL_8_BREAKING) {\n LOADING_MODULES.delete(name);\n }\n }\n}\n"],"mappings":";;;;;;;;AAIA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IA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AK,CACZ,aAAY5B,IAAK,6BAA4BR,IAAK,gCAA+B,GAChF,sFAAsF,GACtF,qFAAqF,CACxF;IACH;EACF;EAEA,IAAI;IACiC;MACjCuD,eAAe,CAACG,GAAG,CAAC1D,IAAI,CAAC;IAC3B;IAQO;MACL,OAAO,OAAO,IAAA2D,oBAAe,EAC3B3D,IAAI,EACH,qDAAoDQ,IAAK,IAAG,GAC3D,4DAA4D,EAM9D,IAAI,CACL;IACH;EACF,CAAC,CAAC,OAAOoD,GAAG,EAAE;IACZA,GAAG,CAAC3C,OAAO,GAAI,YAAW2C,GAAG,CAAC3C,OAAQ,uBAAsBjB,IAAK,GAAE;IACnE,MAAM4D,GAAG;EACX,CAAC,SAAS;IAC2B;MACjCL,eAAe,CAACM,MAAM,CAAC7D,IAAI,CAAC;IAC9B;EACF;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/types.js b/node_modules/@babel/core/lib/config/files/types.js deleted file mode 100644 index c03b5a6fd..000000000 --- a/node_modules/@babel/core/lib/config/files/types.js +++ /dev/null @@ -1,3 +0,0 @@ -0 && 0; - -//# sourceMappingURL=types.js.map diff --git a/node_modules/@babel/core/lib/config/files/types.js.map b/node_modules/@babel/core/lib/config/files/types.js.map deleted file mode 100644 index 107e58ce7..000000000 --- a/node_modules/@babel/core/lib/config/files/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sources":["../../../src/config/files/types.ts"],"sourcesContent":["import type { InputOptions } from \"..\";\n\nexport type ConfigFile = {\n filepath: string;\n dirname: string;\n options: InputOptions & { babel?: unknown };\n};\n\nexport type IgnoreFile = {\n filepath: string;\n dirname: string;\n ignore: Array;\n};\n\nexport type RelativeConfig = {\n // The actual config, either from package.json#babel, .babelrc, or\n // .babelrc.js, if there was one.\n config: ConfigFile | null;\n // The .babelignore, if there was one.\n ignore: IgnoreFile | null;\n};\n\nexport type FilePackageData = {\n // The file in the package.\n filepath: string;\n // Any ancestor directories of the file that are within the package.\n directories: Array;\n // The contents of the package.json. May not be found if the package just\n // terminated at a node_modules folder without finding one.\n pkg: ConfigFile | null;\n // True if a package.json or node_modules folder was found while traversing\n // the directory structure.\n isPackage: boolean;\n};\n"],"mappings":""} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/utils.js b/node_modules/@babel/core/lib/config/files/utils.js deleted file mode 100644 index 1c4ccbf0d..000000000 --- a/node_modules/@babel/core/lib/config/files/utils.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.makeStaticFileCache = makeStaticFileCache; -var _caching = require("../caching"); -var fs = require("../../gensync-utils/fs"); -function _fs2() { - const data = require("fs"); - _fs2 = function () { - return data; - }; - return data; -} -function makeStaticFileCache(fn) { - return (0, _caching.makeStrongCache)(function* (filepath, cache) { - const cached = cache.invalidate(() => fileMtime(filepath)); - if (cached === null) { - return null; - } - return fn(filepath, yield* fs.readFile(filepath, "utf8")); - }); -} -function fileMtime(filepath) { - if (!_fs2().existsSync(filepath)) return null; - try { - return +_fs2().statSync(filepath).mtime; - } catch (e) { - if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e; - } - return null; -} -0 && 0; - -//# sourceMappingURL=utils.js.map diff --git a/node_modules/@babel/core/lib/config/files/utils.js.map b/node_modules/@babel/core/lib/config/files/utils.js.map deleted file mode 100644 index 894d40315..000000000 --- a/node_modules/@babel/core/lib/config/files/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_caching","require","fs","_fs2","data","makeStaticFileCache","fn","makeStrongCache","filepath","cache","cached","invalidate","fileMtime","readFile","nodeFs","existsSync","statSync","mtime","e","code"],"sources":["../../../src/config/files/utils.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport { makeStrongCache } from \"../caching\";\nimport type { CacheConfigurator } from \"../caching\";\nimport * as fs from \"../../gensync-utils/fs\";\nimport nodeFs from \"fs\";\n\nexport function makeStaticFileCache(\n fn: (filepath: string, contents: string) => T,\n) {\n return makeStrongCache(function* (\n filepath: string,\n cache: CacheConfigurator,\n ): Handler {\n const cached = cache.invalidate(() => fileMtime(filepath));\n\n if (cached === null) {\n return null;\n }\n\n return fn(filepath, yield* fs.readFile(filepath, \"utf8\"));\n });\n}\n\nfunction fileMtime(filepath: string): number | null {\n if (!nodeFs.existsSync(filepath)) return null;\n\n try {\n return +nodeFs.statSync(filepath).mtime;\n } catch (e) {\n if (e.code !== \"ENOENT\" && e.code !== \"ENOTDIR\") throw e;\n }\n\n return null;\n}\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,EAAA,GAAAD,OAAA;AACA,SAAAE,KAAA;EAAA,MAAAC,IAAA,GAAAH,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASC,mBAAmBA,CACjCC,EAA6C,EAC7C;EACA,OAAO,IAAAC,wBAAe,EAAC,WACrBC,QAAgB,EAChBC,KAA8B,EACX;IACnB,MAAMC,MAAM,GAAGD,KAAK,CAACE,UAAU,CAAC,MAAMC,SAAS,CAACJ,QAAQ,CAAC,CAAC;IAE1D,IAAIE,MAAM,KAAK,IAAI,EAAE;MACnB,OAAO,IAAI;IACb;IAEA,OAAOJ,EAAE,CAACE,QAAQ,EAAE,OAAON,EAAE,CAACW,QAAQ,CAACL,QAAQ,EAAE,MAAM,CAAC,CAAC;EAC3D,CAAC,CAAC;AACJ;AAEA,SAASI,SAASA,CAACJ,QAAgB,EAAiB;EAClD,IAAI,CAACM,MAAM,CAACC,UAAU,CAACP,QAAQ,CAAC,EAAE,OAAO,IAAI;EAE7C,IAAI;IACF,OAAO,CAACM,MAAM,CAACE,QAAQ,CAACR,QAAQ,CAAC,CAACS,KAAK;EACzC,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,IAAIA,CAAC,CAACC,IAAI,KAAK,QAAQ,IAAID,CAAC,CAACC,IAAI,KAAK,SAAS,EAAE,MAAMD,CAAC;EAC1D;EAEA,OAAO,IAAI;AACb;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/full.js b/node_modules/@babel/core/lib/config/full.js deleted file mode 100644 index 4a570adf9..000000000 --- a/node_modules/@babel/core/lib/config/full.js +++ /dev/null @@ -1,312 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _async = require("../gensync-utils/async"); -var _util = require("./util"); -var context = require("../index"); -var _plugin = require("./plugin"); -var _item = require("./item"); -var _configChain = require("./config-chain"); -var _deepArray = require("./helpers/deep-array"); -function _traverse() { - const data = require("@babel/traverse"); - _traverse = function () { - return data; - }; - return data; -} -var _caching = require("./caching"); -var _options = require("./validation/options"); -var _plugins = require("./validation/plugins"); -var _configApi = require("./helpers/config-api"); -var _partial = require("./partial"); -var _configError = require("../errors/config-error"); -var _default = _gensync()(function* loadFullConfig(inputOpts) { - var _opts$assumptions; - const result = yield* (0, _partial.default)(inputOpts); - if (!result) { - return null; - } - const { - options, - context, - fileHandling - } = result; - if (fileHandling === "ignored") { - return null; - } - const optionDefaults = {}; - const { - plugins, - presets - } = options; - if (!plugins || !presets) { - throw new Error("Assertion failure - plugins and presets exist"); - } - const presetContext = Object.assign({}, context, { - targets: options.targets - }); - const toDescriptor = item => { - const desc = (0, _item.getItemDescriptor)(item); - if (!desc) { - throw new Error("Assertion failure - must be config item"); - } - return desc; - }; - const presetsDescriptors = presets.map(toDescriptor); - const initialPluginsDescriptors = plugins.map(toDescriptor); - const pluginDescriptorsByPass = [[]]; - const passes = []; - const externalDependencies = []; - const ignored = yield* enhanceError(context, function* recursePresetDescriptors(rawPresets, pluginDescriptorsPass) { - const presets = []; - for (let i = 0; i < rawPresets.length; i++) { - const descriptor = rawPresets[i]; - if (descriptor.options !== false) { - try { - var preset = yield* loadPresetDescriptor(descriptor, presetContext); - } catch (e) { - if (e.code === "BABEL_UNKNOWN_OPTION") { - (0, _options.checkNoUnwrappedItemOptionPairs)(rawPresets, i, "preset", e); - } - throw e; - } - externalDependencies.push(preset.externalDependencies); - if (descriptor.ownPass) { - presets.push({ - preset: preset.chain, - pass: [] - }); - } else { - presets.unshift({ - preset: preset.chain, - pass: pluginDescriptorsPass - }); - } - } - } - if (presets.length > 0) { - pluginDescriptorsByPass.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pluginDescriptorsPass)); - for (const { - preset, - pass - } of presets) { - if (!preset) return true; - pass.push(...preset.plugins); - const ignored = yield* recursePresetDescriptors(preset.presets, pass); - if (ignored) return true; - preset.options.forEach(opts => { - (0, _util.mergeOptions)(optionDefaults, opts); - }); - } - } - })(presetsDescriptors, pluginDescriptorsByPass[0]); - if (ignored) return null; - const opts = optionDefaults; - (0, _util.mergeOptions)(opts, options); - const pluginContext = Object.assign({}, presetContext, { - assumptions: (_opts$assumptions = opts.assumptions) != null ? _opts$assumptions : {} - }); - yield* enhanceError(context, function* loadPluginDescriptors() { - pluginDescriptorsByPass[0].unshift(...initialPluginsDescriptors); - for (const descs of pluginDescriptorsByPass) { - const pass = []; - passes.push(pass); - for (let i = 0; i < descs.length; i++) { - const descriptor = descs[i]; - if (descriptor.options !== false) { - try { - var plugin = yield* loadPluginDescriptor(descriptor, pluginContext); - } catch (e) { - if (e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") { - (0, _options.checkNoUnwrappedItemOptionPairs)(descs, i, "plugin", e); - } - throw e; - } - pass.push(plugin); - externalDependencies.push(plugin.externalDependencies); - } - } - } - })(); - opts.plugins = passes[0]; - opts.presets = passes.slice(1).filter(plugins => plugins.length > 0).map(plugins => ({ - plugins - })); - opts.passPerPreset = opts.presets.length > 0; - return { - options: opts, - passes: passes, - externalDependencies: (0, _deepArray.finalize)(externalDependencies) - }; -}); -exports.default = _default; -function enhanceError(context, fn) { - return function* (arg1, arg2) { - try { - return yield* fn(arg1, arg2); - } catch (e) { - if (!/^\[BABEL\]/.test(e.message)) { - var _context$filename; - e.message = `[BABEL] ${(_context$filename = context.filename) != null ? _context$filename : "unknown file"}: ${e.message}`; - } - throw e; - } - }; -} -const makeDescriptorLoader = apiFactory => (0, _caching.makeWeakCache)(function* ({ - value, - options, - dirname, - alias -}, cache) { - if (options === false) throw new Error("Assertion failure"); - options = options || {}; - const externalDependencies = []; - let item = value; - if (typeof value === "function") { - const factory = (0, _async.maybeAsync)(value, `You appear to be using an async plugin/preset, but Babel has been called synchronously`); - const api = Object.assign({}, context, apiFactory(cache, externalDependencies)); - try { - item = yield* factory(api, options, dirname); - } catch (e) { - if (alias) { - e.message += ` (While processing: ${JSON.stringify(alias)})`; - } - throw e; - } - } - if (!item || typeof item !== "object") { - throw new Error("Plugin/Preset did not return an object."); - } - if ((0, _async.isThenable)(item)) { - yield* []; - throw new Error(`You appear to be using a promise as a plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version. ` + `As an alternative, you can prefix the promise with "await". ` + `(While processing: ${JSON.stringify(alias)})`); - } - if (externalDependencies.length > 0 && (!cache.configured() || cache.mode() === "forever")) { - let error = `A plugin/preset has external untracked dependencies ` + `(${externalDependencies[0]}), but the cache `; - if (!cache.configured()) { - error += `has not been configured to be invalidated when the external dependencies change. `; - } else { - error += ` has been configured to never be invalidated. `; - } - error += `Plugins/presets should configure their cache to be invalidated when the external ` + `dependencies change, for example using \`api.cache.invalidate(() => ` + `statSync(filepath).mtimeMs)\` or \`api.cache.never()\`\n` + `(While processing: ${JSON.stringify(alias)})`; - throw new Error(error); - } - return { - value: item, - options, - dirname, - alias, - externalDependencies: (0, _deepArray.finalize)(externalDependencies) - }; -}); -const pluginDescriptorLoader = makeDescriptorLoader(_configApi.makePluginAPI); -const presetDescriptorLoader = makeDescriptorLoader(_configApi.makePresetAPI); -const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({ - value, - options, - dirname, - alias, - externalDependencies -}, cache) { - const pluginObj = (0, _plugins.validatePluginObject)(value); - const plugin = Object.assign({}, pluginObj); - if (plugin.visitor) { - plugin.visitor = _traverse().default.explode(Object.assign({}, plugin.visitor)); - } - if (plugin.inherits) { - const inheritsDescriptor = { - name: undefined, - alias: `${alias}$inherits`, - value: plugin.inherits, - options, - dirname - }; - const inherits = yield* (0, _async.forwardAsync)(loadPluginDescriptor, run => { - return cache.invalidate(data => run(inheritsDescriptor, data)); - }); - plugin.pre = chain(inherits.pre, plugin.pre); - plugin.post = chain(inherits.post, plugin.post); - plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions); - plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]); - if (inherits.externalDependencies.length > 0) { - if (externalDependencies.length === 0) { - externalDependencies = inherits.externalDependencies; - } else { - externalDependencies = (0, _deepArray.finalize)([externalDependencies, inherits.externalDependencies]); - } - } - } - return new _plugin.default(plugin, options, alias, externalDependencies); -}); -function* loadPluginDescriptor(descriptor, context) { - if (descriptor.value instanceof _plugin.default) { - if (descriptor.options) { - throw new Error("Passed options to an existing Plugin instance will not work."); - } - return descriptor.value; - } - return yield* instantiatePlugin(yield* pluginDescriptorLoader(descriptor, context), context); -} -const needsFilename = val => val && typeof val !== "function"; -const validateIfOptionNeedsFilename = (options, descriptor) => { - if (needsFilename(options.test) || needsFilename(options.include) || needsFilename(options.exclude)) { - const formattedPresetName = descriptor.name ? `"${descriptor.name}"` : "/* your preset */"; - throw new _configError.default([`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, `\`\`\``, `babel.transformSync(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, `\`\`\``, `See https://babeljs.io/docs/en/options#filename for more information.`].join("\n")); - } -}; -const validatePreset = (preset, context, descriptor) => { - if (!context.filename) { - const { - options - } = preset; - validateIfOptionNeedsFilename(options, descriptor); - if (options.overrides) { - options.overrides.forEach(overrideOptions => validateIfOptionNeedsFilename(overrideOptions, descriptor)); - } - } -}; -const instantiatePreset = (0, _caching.makeWeakCacheSync)(({ - value, - dirname, - alias, - externalDependencies -}) => { - return { - options: (0, _options.validate)("preset", value), - alias, - dirname, - externalDependencies - }; -}); -function* loadPresetDescriptor(descriptor, context) { - const preset = instantiatePreset(yield* presetDescriptorLoader(descriptor, context)); - validatePreset(preset, context, descriptor); - return { - chain: yield* (0, _configChain.buildPresetChain)(preset, context), - externalDependencies: preset.externalDependencies - }; -} -function chain(a, b) { - const fns = [a, b].filter(Boolean); - if (fns.length <= 1) return fns[0]; - return function (...args) { - for (const fn of fns) { - fn.apply(this, args); - } - }; -} -0 && 0; - -//# sourceMappingURL=full.js.map diff --git a/node_modules/@babel/core/lib/config/full.js.map b/node_modules/@babel/core/lib/config/full.js.map deleted file mode 100644 index 208577580..000000000 --- a/node_modules/@babel/core/lib/config/full.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","_async","_util","context","_plugin","_item","_configChain","_deepArray","_traverse","_caching","_options","_plugins","_configApi","_partial","_configError","_default","gensync","loadFullConfig","inputOpts","_opts$assumptions","result","loadPrivatePartialConfig","options","fileHandling","optionDefaults","plugins","presets","Error","presetContext","Object","assign","targets","toDescriptor","item","desc","getItemDescriptor","presetsDescriptors","map","initialPluginsDescriptors","pluginDescriptorsByPass","passes","externalDependencies","ignored","enhanceError","recursePresetDescriptors","rawPresets","pluginDescriptorsPass","i","length","descriptor","preset","loadPresetDescriptor","e","code","checkNoUnwrappedItemOptionPairs","push","ownPass","chain","pass","unshift","splice","o","filter","p","forEach","opts","mergeOptions","pluginContext","assumptions","loadPluginDescriptors","descs","plugin","loadPluginDescriptor","slice","passPerPreset","freezeDeepArray","exports","default","fn","arg1","arg2","test","message","_context$filename","filename","makeDescriptorLoader","apiFactory","makeWeakCache","value","dirname","alias","cache","factory","maybeAsync","api","JSON","stringify","isThenable","configured","mode","error","pluginDescriptorLoader","makePluginAPI","presetDescriptorLoader","makePresetAPI","instantiatePlugin","pluginObj","validatePluginObject","visitor","traverse","explode","inherits","inheritsDescriptor","name","undefined","forwardAsync","run","invalidate","pre","post","manipulateOptions","visitors","merge","Plugin","needsFilename","val","validateIfOptionNeedsFilename","include","exclude","formattedPresetName","ConfigError","join","validatePreset","overrides","overrideOptions","instantiatePreset","makeWeakCacheSync","validate","buildPresetChain","a","b","fns","Boolean","args","apply"],"sources":["../../src/config/full.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\nimport { forwardAsync, maybeAsync, isThenable } from \"../gensync-utils/async\";\n\nimport { mergeOptions } from \"./util\";\nimport * as context from \"../index\";\nimport Plugin from \"./plugin\";\nimport { getItemDescriptor } from \"./item\";\nimport { buildPresetChain } from \"./config-chain\";\nimport { finalize as freezeDeepArray } from \"./helpers/deep-array\";\nimport type { DeepArray, ReadonlyDeepArray } from \"./helpers/deep-array\";\nimport type {\n ConfigContext,\n ConfigChain,\n PresetInstance,\n} from \"./config-chain\";\nimport type { UnloadedDescriptor } from \"./config-descriptors\";\nimport traverse from \"@babel/traverse\";\nimport { makeWeakCache, makeWeakCacheSync } from \"./caching\";\nimport type { CacheConfigurator } from \"./caching\";\nimport {\n validate,\n checkNoUnwrappedItemOptionPairs,\n} from \"./validation/options\";\nimport type { PluginItem } from \"./validation/options\";\nimport { validatePluginObject } from \"./validation/plugins\";\nimport { makePluginAPI, makePresetAPI } from \"./helpers/config-api\";\nimport type { PluginAPI, PresetAPI } from \"./helpers/config-api\";\n\nimport loadPrivatePartialConfig from \"./partial\";\nimport type { ValidatedOptions } from \"./validation/options\";\n\nimport type * as Context from \"./cache-contexts\";\nimport ConfigError from \"../errors/config-error\";\n\ntype LoadedDescriptor = {\n value: {};\n options: {};\n dirname: string;\n alias: string;\n externalDependencies: ReadonlyDeepArray;\n};\n\nexport type { InputOptions } from \"./validation/options\";\n\nexport type ResolvedConfig = {\n options: any;\n passes: PluginPasses;\n externalDependencies: ReadonlyDeepArray;\n};\n\nexport type { Plugin };\nexport type PluginPassList = Array;\nexport type PluginPasses = Array;\n\nexport default gensync(function* loadFullConfig(\n inputOpts: unknown,\n): Handler {\n const result = yield* loadPrivatePartialConfig(inputOpts);\n if (!result) {\n return null;\n }\n const { options, context, fileHandling } = result;\n\n if (fileHandling === \"ignored\") {\n return null;\n }\n\n const optionDefaults = {};\n\n const { plugins, presets } = options;\n\n if (!plugins || !presets) {\n throw new Error(\"Assertion failure - plugins and presets exist\");\n }\n\n const presetContext: Context.FullPreset = {\n ...context,\n targets: options.targets,\n };\n\n const toDescriptor = (item: PluginItem) => {\n const desc = getItemDescriptor(item);\n if (!desc) {\n throw new Error(\"Assertion failure - must be config item\");\n }\n\n return desc;\n };\n\n const presetsDescriptors = presets.map(toDescriptor);\n const initialPluginsDescriptors = plugins.map(toDescriptor);\n const pluginDescriptorsByPass: Array> = [[]];\n const passes: Array> = [];\n\n const externalDependencies: DeepArray = [];\n\n const ignored = yield* enhanceError(\n context,\n function* recursePresetDescriptors(\n rawPresets: Array,\n pluginDescriptorsPass: Array,\n ): Handler {\n const presets: Array<{\n preset: ConfigChain | null;\n pass: Array;\n }> = [];\n\n for (let i = 0; i < rawPresets.length; i++) {\n const descriptor = rawPresets[i];\n if (descriptor.options !== false) {\n try {\n // eslint-disable-next-line no-var\n var preset = yield* loadPresetDescriptor(descriptor, presetContext);\n } catch (e) {\n if (e.code === \"BABEL_UNKNOWN_OPTION\") {\n checkNoUnwrappedItemOptionPairs(rawPresets, i, \"preset\", e);\n }\n throw e;\n }\n\n externalDependencies.push(preset.externalDependencies);\n\n // Presets normally run in reverse order, but if they\n // have their own pass they run after the presets\n // in the previous pass.\n if (descriptor.ownPass) {\n presets.push({ preset: preset.chain, pass: [] });\n } else {\n presets.unshift({\n preset: preset.chain,\n pass: pluginDescriptorsPass,\n });\n }\n }\n }\n\n // resolve presets\n if (presets.length > 0) {\n // The passes are created in the same order as the preset list, but are inserted before any\n // existing additional passes.\n pluginDescriptorsByPass.splice(\n 1,\n 0,\n ...presets.map(o => o.pass).filter(p => p !== pluginDescriptorsPass),\n );\n\n for (const { preset, pass } of presets) {\n if (!preset) return true;\n\n pass.push(...preset.plugins);\n\n const ignored = yield* recursePresetDescriptors(preset.presets, pass);\n if (ignored) return true;\n\n preset.options.forEach(opts => {\n mergeOptions(optionDefaults, opts);\n });\n }\n }\n },\n )(presetsDescriptors, pluginDescriptorsByPass[0]);\n\n if (ignored) return null;\n\n const opts: any = optionDefaults;\n mergeOptions(opts, options);\n\n const pluginContext: Context.FullPlugin = {\n ...presetContext,\n assumptions: opts.assumptions ?? {},\n };\n\n yield* enhanceError(context, function* loadPluginDescriptors() {\n pluginDescriptorsByPass[0].unshift(...initialPluginsDescriptors);\n\n for (const descs of pluginDescriptorsByPass) {\n const pass: Plugin[] = [];\n passes.push(pass);\n\n for (let i = 0; i < descs.length; i++) {\n const descriptor: UnloadedDescriptor = descs[i];\n if (descriptor.options !== false) {\n try {\n // eslint-disable-next-line no-var\n var plugin = yield* loadPluginDescriptor(descriptor, pluginContext);\n } catch (e) {\n if (e.code === \"BABEL_UNKNOWN_PLUGIN_PROPERTY\") {\n // print special message for `plugins: [\"@babel/foo\", { foo: \"option\" }]`\n checkNoUnwrappedItemOptionPairs(descs, i, \"plugin\", e);\n }\n throw e;\n }\n pass.push(plugin);\n\n externalDependencies.push(plugin.externalDependencies);\n }\n }\n }\n })();\n\n opts.plugins = passes[0];\n opts.presets = passes\n .slice(1)\n .filter(plugins => plugins.length > 0)\n .map(plugins => ({ plugins }));\n opts.passPerPreset = opts.presets.length > 0;\n\n return {\n options: opts,\n passes: passes,\n externalDependencies: freezeDeepArray(externalDependencies),\n };\n});\n\nfunction enhanceError(context: ConfigContext, fn: T): T {\n return function* (arg1: unknown, arg2: unknown) {\n try {\n return yield* fn(arg1, arg2);\n } catch (e) {\n // There are a few case where thrown errors will try to annotate themselves multiple times, so\n // to keep things simple we just bail out if re-wrapping the message.\n if (!/^\\[BABEL\\]/.test(e.message)) {\n e.message = `[BABEL] ${context.filename ?? \"unknown file\"}: ${\n e.message\n }`;\n }\n\n throw e;\n }\n } as any;\n}\n\n/**\n * Load a generic plugin/preset from the given descriptor loaded from the config object.\n */\nconst makeDescriptorLoader = (\n apiFactory: (\n cache: CacheConfigurator,\n externalDependencies: Array,\n ) => API,\n) =>\n makeWeakCache(function* (\n { value, options, dirname, alias }: UnloadedDescriptor,\n cache: CacheConfigurator,\n ): Handler {\n // Disabled presets should already have been filtered out\n if (options === false) throw new Error(\"Assertion failure\");\n\n options = options || {};\n\n const externalDependencies: Array = [];\n\n let item = value;\n if (typeof value === \"function\") {\n const factory = maybeAsync(\n value,\n `You appear to be using an async plugin/preset, but Babel has been called synchronously`,\n );\n\n const api = {\n ...context,\n ...apiFactory(cache, externalDependencies),\n };\n try {\n item = yield* factory(api, options, dirname);\n } catch (e) {\n if (alias) {\n e.message += ` (While processing: ${JSON.stringify(alias)})`;\n }\n throw e;\n }\n }\n\n if (!item || typeof item !== \"object\") {\n throw new Error(\"Plugin/Preset did not return an object.\");\n }\n\n if (isThenable(item)) {\n // @ts-expect-error - if we want to support async plugins\n yield* [];\n\n throw new Error(\n `You appear to be using a promise as a plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, ` +\n `you may need to upgrade your @babel/core version. ` +\n `As an alternative, you can prefix the promise with \"await\". ` +\n `(While processing: ${JSON.stringify(alias)})`,\n );\n }\n\n if (\n externalDependencies.length > 0 &&\n (!cache.configured() || cache.mode() === \"forever\")\n ) {\n let error =\n `A plugin/preset has external untracked dependencies ` +\n `(${externalDependencies[0]}), but the cache `;\n if (!cache.configured()) {\n error += `has not been configured to be invalidated when the external dependencies change. `;\n } else {\n error += ` has been configured to never be invalidated. `;\n }\n error +=\n `Plugins/presets should configure their cache to be invalidated when the external ` +\n `dependencies change, for example using \\`api.cache.invalidate(() => ` +\n `statSync(filepath).mtimeMs)\\` or \\`api.cache.never()\\`\\n` +\n `(While processing: ${JSON.stringify(alias)})`;\n\n throw new Error(error);\n }\n\n return {\n value: item,\n options,\n dirname,\n alias,\n externalDependencies: freezeDeepArray(externalDependencies),\n };\n });\n\nconst pluginDescriptorLoader = makeDescriptorLoader<\n Context.SimplePlugin,\n PluginAPI\n>(makePluginAPI);\nconst presetDescriptorLoader = makeDescriptorLoader<\n Context.SimplePreset,\n PresetAPI\n>(makePresetAPI);\n\nconst instantiatePlugin = makeWeakCache(function* (\n { value, options, dirname, alias, externalDependencies }: LoadedDescriptor,\n cache: CacheConfigurator,\n): Handler {\n const pluginObj = validatePluginObject(value);\n\n const plugin = {\n ...pluginObj,\n };\n if (plugin.visitor) {\n plugin.visitor = traverse.explode({\n ...plugin.visitor,\n });\n }\n\n if (plugin.inherits) {\n const inheritsDescriptor: UnloadedDescriptor = {\n name: undefined,\n alias: `${alias}$inherits`,\n value: plugin.inherits,\n options,\n dirname,\n };\n\n const inherits = yield* forwardAsync(loadPluginDescriptor, run => {\n // If the inherited plugin changes, reinstantiate this plugin.\n return cache.invalidate(data => run(inheritsDescriptor, data));\n });\n\n plugin.pre = chain(inherits.pre, plugin.pre);\n plugin.post = chain(inherits.post, plugin.post);\n plugin.manipulateOptions = chain(\n inherits.manipulateOptions,\n plugin.manipulateOptions,\n );\n plugin.visitor = traverse.visitors.merge([\n inherits.visitor || {},\n plugin.visitor || {},\n ]);\n\n if (inherits.externalDependencies.length > 0) {\n if (externalDependencies.length === 0) {\n externalDependencies = inherits.externalDependencies;\n } else {\n externalDependencies = freezeDeepArray([\n externalDependencies,\n inherits.externalDependencies,\n ]);\n }\n }\n }\n\n return new Plugin(plugin, options, alias, externalDependencies);\n});\n\n/**\n * Instantiate a plugin for the given descriptor, returning the plugin/options pair.\n */\nfunction* loadPluginDescriptor(\n descriptor: UnloadedDescriptor,\n context: Context.SimplePlugin,\n): Handler {\n if (descriptor.value instanceof Plugin) {\n if (descriptor.options) {\n throw new Error(\n \"Passed options to an existing Plugin instance will not work.\",\n );\n }\n\n return descriptor.value;\n }\n\n return yield* instantiatePlugin(\n yield* pluginDescriptorLoader(descriptor, context),\n context,\n );\n}\n\nconst needsFilename = (val: unknown) => val && typeof val !== \"function\";\n\nconst validateIfOptionNeedsFilename = (\n options: ValidatedOptions,\n descriptor: UnloadedDescriptor,\n): void => {\n if (\n needsFilename(options.test) ||\n needsFilename(options.include) ||\n needsFilename(options.exclude)\n ) {\n const formattedPresetName = descriptor.name\n ? `\"${descriptor.name}\"`\n : \"/* your preset */\";\n throw new ConfigError(\n [\n `Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`,\n `\\`\\`\\``,\n `babel.transformSync(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`,\n `\\`\\`\\``,\n `See https://babeljs.io/docs/en/options#filename for more information.`,\n ].join(\"\\n\"),\n );\n }\n};\n\nconst validatePreset = (\n preset: PresetInstance,\n context: ConfigContext,\n descriptor: UnloadedDescriptor,\n): void => {\n if (!context.filename) {\n const { options } = preset;\n validateIfOptionNeedsFilename(options, descriptor);\n if (options.overrides) {\n options.overrides.forEach(overrideOptions =>\n validateIfOptionNeedsFilename(overrideOptions, descriptor),\n );\n }\n }\n};\n\nconst instantiatePreset = makeWeakCacheSync(\n ({\n value,\n dirname,\n alias,\n externalDependencies,\n }: LoadedDescriptor): PresetInstance => {\n return {\n options: validate(\"preset\", value),\n alias,\n dirname,\n externalDependencies,\n };\n },\n);\n\n/**\n * Generate a config object that will act as the root of a new nested config.\n */\nfunction* loadPresetDescriptor(\n descriptor: UnloadedDescriptor,\n context: Context.FullPreset,\n): Handler<{\n chain: ConfigChain | null;\n externalDependencies: ReadonlyDeepArray;\n}> {\n const preset = instantiatePreset(\n yield* presetDescriptorLoader(descriptor, context),\n );\n validatePreset(preset, context, descriptor);\n return {\n chain: yield* buildPresetChain(preset, context),\n externalDependencies: preset.externalDependencies,\n };\n}\n\nfunction chain(\n a: undefined | ((...args: Args) => void),\n b: undefined | ((...args: Args) => void),\n) {\n const fns = [a, b].filter(Boolean);\n if (fns.length <= 1) return fns[0];\n\n return function (this: unknown, ...args: unknown[]) {\n for (const fn of fns) {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AO;IACLnB,OAAO,EAAE,IAAAmH,iBAAQ,EAAC,QAAQ,EAAEjD,KAAK,CAAC;IAClCE,KAAK;IACLD,OAAO;IACPhD;EACF,CAAC;AACH,CAAC,CACF;AAKD,UAAUU,oBAAoBA,CAC5BF,UAA8B,EAC9B9C,OAA2B,EAI1B;EACD,MAAM+C,MAAM,GAAGqF,iBAAiB,CAC9B,OAAOhC,sBAAsB,CAACtD,UAAU,EAAE9C,OAAO,CAAC,CACnD;EACDiI,cAAc,CAAClF,MAAM,EAAE/C,OAAO,EAAE8C,UAAU,CAAC;EAC3C,OAAO;IACLQ,KAAK,EAAE,OAAO,IAAAiF,6BAAgB,EAACxF,MAAM,EAAE/C,OAAO,CAAC;IAC/CsC,oBAAoB,EAAES,MAAM,CAACT;EAC/B,CAAC;AACH;AAEA,SAASgB,KAAKA,CACZkF,CAAwC,EACxCC,CAAwC,EACxC;EACA,MAAMC,GAAG,GAAG,CAACF,CAAC,EAAEC,CAAC,CAAC,CAAC9E,MAAM,CAACgF,OAAO,CAAC;EAClC,IAAID,GAAG,CAAC7F,MAAM,IAAI,CAAC,EAAE,OAAO6F,GAAG,CAAC,CAAC,CAAC;EAElC,OAAO,UAAyB,GAAGE,IAAe,EAAE;IAClD,KAAK,MAAMjE,EAAE,IAAI+D,GAAG,EAAE;MACpB/D,EAAE,CAACkE,KAAK,CAAC,IAAI,EAAED,IAAI,CAAC;IACtB;EACF,CAAC;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/helpers/config-api.js b/node_modules/@babel/core/lib/config/helpers/config-api.js deleted file mode 100644 index 2cb8779f7..000000000 --- a/node_modules/@babel/core/lib/config/helpers/config-api.js +++ /dev/null @@ -1,85 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.makeConfigAPI = makeConfigAPI; -exports.makePluginAPI = makePluginAPI; -exports.makePresetAPI = makePresetAPI; -function _semver() { - const data = require("semver"); - _semver = function () { - return data; - }; - return data; -} -var _ = require("../../"); -var _caching = require("../caching"); -function makeConfigAPI(cache) { - const env = value => cache.using(data => { - if (typeof value === "undefined") return data.envName; - if (typeof value === "function") { - return (0, _caching.assertSimpleType)(value(data.envName)); - } - return (Array.isArray(value) ? value : [value]).some(entry => { - if (typeof entry !== "string") { - throw new Error("Unexpected non-string value"); - } - return entry === data.envName; - }); - }); - const caller = cb => cache.using(data => (0, _caching.assertSimpleType)(cb(data.caller))); - return { - version: _.version, - cache: cache.simple(), - env, - async: () => false, - caller, - assertVersion - }; -} -function makePresetAPI(cache, externalDependencies) { - const targets = () => JSON.parse(cache.using(data => JSON.stringify(data.targets))); - const addExternalDependency = ref => { - externalDependencies.push(ref); - }; - return Object.assign({}, makeConfigAPI(cache), { - targets, - addExternalDependency - }); -} -function makePluginAPI(cache, externalDependencies) { - const assumption = name => cache.using(data => data.assumptions[name]); - return Object.assign({}, makePresetAPI(cache, externalDependencies), { - assumption - }); -} -function assertVersion(range) { - if (typeof range === "number") { - if (!Number.isInteger(range)) { - throw new Error("Expected string or integer value."); - } - range = `^${range}.0.0-0`; - } - if (typeof range !== "string") { - throw new Error("Expected string or integer value."); - } - ; - if (_semver().satisfies(_.version, range)) return; - const limit = Error.stackTraceLimit; - if (typeof limit === "number" && limit < 25) { - Error.stackTraceLimit = 25; - } - const err = new Error(`Requires Babel "${range}", but was loaded with "${_.version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`); - if (typeof limit === "number") { - Error.stackTraceLimit = limit; - } - throw Object.assign(err, { - code: "BABEL_VERSION_UNSUPPORTED", - version: _.version, - range - }); -} -0 && 0; - -//# sourceMappingURL=config-api.js.map diff --git a/node_modules/@babel/core/lib/config/helpers/config-api.js.map b/node_modules/@babel/core/lib/config/helpers/config-api.js.map deleted file mode 100644 index 960eccd51..000000000 --- a/node_modules/@babel/core/lib/config/helpers/config-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_semver","data","require","_","_caching","makeConfigAPI","cache","env","value","using","envName","assertSimpleType","Array","isArray","some","entry","Error","caller","cb","version","coreVersion","simple","async","assertVersion","makePresetAPI","externalDependencies","targets","JSON","parse","stringify","addExternalDependency","ref","push","Object","assign","makePluginAPI","assumption","name","assumptions","range","Number","isInteger","semver","satisfies","limit","stackTraceLimit","err","code"],"sources":["../../../src/config/helpers/config-api.ts"],"sourcesContent":["import semver from \"semver\";\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nimport { version as coreVersion } from \"../../\";\nimport { assertSimpleType } from \"../caching\";\nimport type {\n CacheConfigurator,\n SimpleCacheConfigurator,\n SimpleType,\n} from \"../caching\";\n\nimport type { AssumptionName, CallerMetadata } from \"../validation/options\";\n\nimport type * as Context from \"../cache-contexts\";\n\ntype EnvFunction = {\n (): string;\n (extractor: (babelEnv: string) => T): T;\n (envVar: string): boolean;\n (envVars: Array): boolean;\n};\n\ntype CallerFactory = (\n extractor: (callerMetadata: CallerMetadata | undefined) => unknown,\n) => SimpleType;\ntype TargetsFunction = () => Targets;\ntype AssumptionFunction = (name: AssumptionName) => boolean | undefined;\n\nexport type ConfigAPI = {\n version: string;\n cache: SimpleCacheConfigurator;\n env: EnvFunction;\n async: () => boolean;\n assertVersion: typeof assertVersion;\n caller?: CallerFactory;\n};\n\nexport type PresetAPI = {\n targets: TargetsFunction;\n addExternalDependency: (ref: string) => void;\n} & ConfigAPI;\n\nexport type PluginAPI = {\n assumption: AssumptionFunction;\n} & PresetAPI;\n\nexport function makeConfigAPI(\n cache: CacheConfigurator,\n): ConfigAPI {\n // TODO(@nicolo-ribaudo): If we remove the explicit type from `value`\n // and the `as any` type cast, TypeScript crashes in an infinite\n // recursion. After upgrading to TS4.7 and finishing the noImplicitAny\n // PR, we should check if it still crashes and report it to the TS team.\n const env: EnvFunction = ((\n value: string | string[] | ((babelEnv: string) => T),\n ) =>\n cache.using(data => {\n if (typeof value === \"undefined\") return data.envName;\n if (typeof value === \"function\") {\n return assertSimpleType(value(data.envName));\n }\n return (Array.isArray(value) ? value : [value]).some(entry => {\n if (typeof entry !== \"string\") {\n throw new Error(\"Unexpected non-string value\");\n }\n return entry === data.envName;\n });\n })) as any;\n\n const caller = (cb: {\n (CallerMetadata: CallerMetadata | undefined): SimpleType;\n }) => cache.using(data => assertSimpleType(cb(data.caller)));\n\n return {\n version: coreVersion,\n cache: cache.simple(),\n // Expose \".env()\" so people can easily get the same env that we expose using the \"env\" key.\n env,\n async: () => false,\n caller,\n assertVersion,\n };\n}\n\nexport function makePresetAPI(\n cache: CacheConfigurator,\n externalDependencies: Array,\n): PresetAPI {\n const targets = () =>\n // We are using JSON.parse/JSON.stringify because it's only possible to cache\n // primitive values. We can safely stringify the targets object because it\n // only contains strings as its properties.\n // Please make the Record and Tuple proposal happen!\n JSON.parse(cache.using(data => JSON.stringify(data.targets)));\n\n const addExternalDependency = (ref: string) => {\n externalDependencies.push(ref);\n };\n\n return { ...makeConfigAPI(cache), targets, addExternalDependency };\n}\n\nexport function makePluginAPI(\n cache: CacheConfigurator,\n externalDependencies: Array,\n): PluginAPI {\n const assumption = (name: string) =>\n cache.using(data => data.assumptions[name]);\n\n return { ...makePresetAPI(cache, externalDependencies), assumption };\n}\n\nfunction assertVersion(range: string | number): void {\n if (typeof range === \"number\") {\n if (!Number.isInteger(range)) {\n throw new Error(\"Expected string or integer value.\");\n }\n range = `^${range}.0.0-0`;\n }\n if (typeof range !== \"string\") {\n throw new Error(\"Expected string or integer value.\");\n }\n // TODO(Babel 8): Update all the version checks\n if (process.env.BABEL_8_BREAKING) {\n range += ` || ^8.0.0-0`;\n }\n\n if (semver.satisfies(coreVersion, range)) return;\n\n const limit = Error.stackTraceLimit;\n\n if (typeof limit === \"number\" && limit < 25) {\n // Bump up the limit if needed so that users are more likely\n // to be able to see what is calling Babel.\n Error.stackTraceLimit = 25;\n }\n\n const err = new Error(\n `Requires Babel \"${range}\", but was loaded with \"${coreVersion}\". ` +\n `If you are sure you have a compatible version of @babel/core, ` +\n `it is likely that something in your build process is loading the ` +\n `wrong version. Inspect the stack trace of this error to look for ` +\n `the first entry that doesn't mention \"@babel/core\" or \"babel-core\" ` +\n `to see what is calling Babel.`,\n );\n\n if (typeof limit === \"number\") {\n Error.stackTraceLimit = limit;\n }\n\n throw Object.assign(err, {\n code: \"BABEL_VERSION_UNSUPPORTED\",\n version: coreVersion,\n range,\n });\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,IAAAE,CAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AA0CO,SAASG,aAAaA,CAC3BC,KAAqC,EAC1B;EAKX,MAAMC,GAAgB,GACpBC,KAAuD,IAEvDF,KAAK,CAACG,KAAK,CAACR,IAAI,IAAI;IAClB,IAAI,OAAOO,KAAK,KAAK,WAAW,EAAE,OAAOP,IAAI,CAACS,OAAO;IACrD,IAAI,OAAOF,KAAK,KAAK,UAAU,EAAE;MAC/B,OAAO,IAAAG,yBAAgB,EAACH,KAAK,CAACP,IAAI,CAACS,OAAO,CAAC,CAAC;IAC9C;IACA,OAAO,CAACE,KAAK,CAACC,OAAO,CAACL,KAAK,CAAC,GAAGA,KAAK,GAAG,CAACA,KAAK,CAAC,EAAEM,IAAI,CAACC,KAAK,IAAI;MAC5D,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC7B,MAAM,IAAIC,KAAK,CAAC,6BAA6B,CAAC;MAChD;MACA,OAAOD,KAAK,KAAKd,IAAI,CAACS,OAAO;IAC/B,CAAC,CAAC;EACJ,CAAC,CAAS;EAEZ,MAAMO,MAAM,GAAIC,EAEf,IAAKZ,KAAK,CAACG,KAAK,CAACR,IAAI,IAAI,IAAAU,yBAAgB,E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AM,IAAIvB,KAAK,CAAC,mCAAmC,CAAC;EACtD;EAAC;EAMD,IAAI0B,SAAM,CAACC,SAAS,CAACvB,SAAW,EAAEmB,KAAK,CAAC,EAAE;EAE1C,MAAMK,KAAK,GAAG5B,KAAK,CAAC6B,eAAe;EAEnC,IAAI,OAAOD,KAAK,KAAK,QAAQ,IAAIA,KAAK,GAAG,EAAE,EAAE;IAG3C5B,KAAK,CAAC6B,eAAe,GAAG,EAAE;EAC5B;EAEA,MAAMC,GAAG,GAAG,IAAI9B,KAAK,CAClB,mBAAkBuB,KAAM,2BAA0BnB,SAAY,KAAI,GAChE,gEAA+D,GAC/D,mEAAkE,GAClE,mEAAkE,GAClE,qEAAoE,GACpE,+BAA8B,CAClC;EAED,IAAI,OAAOwB,KAAK,KAAK,QAAQ,EAAE;IAC7B5B,KAAK,CAAC6B,eAAe,GAAGD,KAAK;EAC/B;EAEA,MAAMX,MAAM,CAACC,MAAM,CAACY,GAAG,EAAE;IACvBC,IAAI,EAAE,2BAA2B;IACjC5B,OAAO,EAAEC,SAAW;IACpBmB;EACF,CAAC,CAAC;AACJ;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/helpers/deep-array.js b/node_modules/@babel/core/lib/config/helpers/deep-array.js deleted file mode 100644 index c611db20e..000000000 --- a/node_modules/@babel/core/lib/config/helpers/deep-array.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.finalize = finalize; -exports.flattenToSet = flattenToSet; -function finalize(deepArr) { - return Object.freeze(deepArr); -} -function flattenToSet(arr) { - const result = new Set(); - const stack = [arr]; - while (stack.length > 0) { - for (const el of stack.pop()) { - if (Array.isArray(el)) stack.push(el);else result.add(el); - } - } - return result; -} -0 && 0; - -//# sourceMappingURL=deep-array.js.map diff --git a/node_modules/@babel/core/lib/config/helpers/deep-array.js.map b/node_modules/@babel/core/lib/config/helpers/deep-array.js.map deleted file mode 100644 index b1d521890..000000000 --- a/node_modules/@babel/core/lib/config/helpers/deep-array.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["finalize","deepArr","Object","freeze","flattenToSet","arr","result","Set","stack","length","el","pop","Array","isArray","push","add"],"sources":["../../../src/config/helpers/deep-array.ts"],"sourcesContent":["export type DeepArray = Array>;\n\n// Just to make sure that DeepArray is not assignable to ReadonlyDeepArray\ndeclare const __marker: unique symbol;\nexport type ReadonlyDeepArray = ReadonlyArray> & {\n [__marker]: true;\n};\n\nexport function finalize(deepArr: DeepArray): ReadonlyDeepArray {\n return Object.freeze(deepArr) as ReadonlyDeepArray;\n}\n\nexport function flattenToSet(\n arr: ReadonlyDeepArray,\n): Set {\n const result = new Set();\n const stack = [arr];\n while (stack.length > 0) {\n for (const el of stack.pop()) {\n if (Array.isArray(el)) stack.push(el as ReadonlyDeepArray);\n else result.add(el as T);\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;AAQO,SAASA,QAAQA,CAAIC,OAAqB,EAAwB;EACvE,OAAOC,MAAM,CAACC,MAAM,CAACF,OAAO,CAAC;AAC/B;AAEO,SAASG,YAAYA,CAC1BC,GAAyB,EACjB;EACR,MAAMC,MAAM,GAAG,IAAIC,GAAG,EAAK;EAC3B,MAAMC,KAAK,GAAG,CAACH,GAAG,CAAC;EACnB,OAAOG,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;IACvB,KAAK,MAAMC,EAAE,IAAIF,KAAK,CAACG,GAAG,EAAE,EAAE;MAC5B,IAAIC,KAAK,CAACC,OAAO,CAACH,EAAE,CAAC,EAAEF,KAAK,CAACM,IAAI,CAACJ,EAAE,CAAyB,CAAC,KACzDJ,MAAM,CAACS,GAAG,CAACL,EAAE,CAAM;IAC1B;EACF;EACA,OAAOJ,MAAM;AACf;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/helpers/environment.js b/node_modules/@babel/core/lib/config/helpers/environment.js deleted file mode 100644 index a23b80bec..000000000 --- a/node_modules/@babel/core/lib/config/helpers/environment.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getEnv = getEnv; -function getEnv(defaultValue = "development") { - return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue; -} -0 && 0; - -//# sourceMappingURL=environment.js.map diff --git a/node_modules/@babel/core/lib/config/helpers/environment.js.map b/node_modules/@babel/core/lib/config/helpers/environment.js.map deleted file mode 100644 index e71555c9a..000000000 --- a/node_modules/@babel/core/lib/config/helpers/environment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["getEnv","defaultValue","process","env","BABEL_ENV","NODE_ENV"],"sources":["../../../src/config/helpers/environment.ts"],"sourcesContent":["export function getEnv(defaultValue: string = \"development\"): string {\n return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;\n}\n"],"mappings":";;;;;;AAAO,SAASA,MAAMA,CAACC,YAAoB,GAAG,aAAa,EAAU;EACnE,OAAOC,OAAO,CAACC,GAAG,CAACC,SAAS,IAAIF,OAAO,CAACC,GAAG,CAACE,QAAQ,IAAIJ,YAAY;AACtE;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/index.js b/node_modules/@babel/core/lib/config/index.js deleted file mode 100644 index e250d01a1..000000000 --- a/node_modules/@babel/core/lib/config/index.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.createConfigItem = createConfigItem; -exports.createConfigItemSync = exports.createConfigItemAsync = void 0; -Object.defineProperty(exports, "default", { - enumerable: true, - get: function () { - return _full.default; - } -}); -exports.loadPartialConfigSync = exports.loadPartialConfigAsync = exports.loadPartialConfig = exports.loadOptionsSync = exports.loadOptionsAsync = exports.loadOptions = void 0; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _full = require("./full"); -var _partial = require("./partial"); -var _item = require("./item"); -const loadOptionsRunner = _gensync()(function* (opts) { - var _config$options; - const config = yield* (0, _full.default)(opts); - return (_config$options = config == null ? void 0 : config.options) != null ? _config$options : null; -}); -const createConfigItemRunner = _gensync()(_item.createConfigItem); -const maybeErrback = runner => (argOrCallback, maybeCallback) => { - let arg; - let callback; - if (maybeCallback === undefined && typeof argOrCallback === "function") { - callback = argOrCallback; - arg = undefined; - } else { - callback = maybeCallback; - arg = argOrCallback; - } - if (!callback) { - return runner.sync(arg); - } - runner.errback(arg, callback); -}; -const loadPartialConfig = maybeErrback(_partial.loadPartialConfig); -exports.loadPartialConfig = loadPartialConfig; -const loadPartialConfigSync = _partial.loadPartialConfig.sync; -exports.loadPartialConfigSync = loadPartialConfigSync; -const loadPartialConfigAsync = _partial.loadPartialConfig.async; -exports.loadPartialConfigAsync = loadPartialConfigAsync; -const loadOptions = maybeErrback(loadOptionsRunner); -exports.loadOptions = loadOptions; -const loadOptionsSync = loadOptionsRunner.sync; -exports.loadOptionsSync = loadOptionsSync; -const loadOptionsAsync = loadOptionsRunner.async; -exports.loadOptionsAsync = loadOptionsAsync; -const createConfigItemSync = createConfigItemRunner.sync; -exports.createConfigItemSync = createConfigItemSync; -const createConfigItemAsync = createConfigItemRunner.async; -exports.createConfigItemAsync = createConfigItemAsync; -function createConfigItem(target, options, callback) { - if (callback !== undefined) { - createConfigItemRunner.errback(target, options, callback); - } else if (typeof options === "function") { - createConfigItemRunner.errback(target, undefined, callback); - } else { - return createConfigItemRunner.sync(target, options); - } -} -0 && 0; - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/core/lib/config/index.js.map b/node_modules/@babel/core/lib/config/index.js.map deleted file mode 100644 index d73e278da..000000000 --- a/node_modules/@babel/core/lib/config/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","_full","_partial","_item","loadOptionsRunner","gensync","opts","_config$options","config","loadFullConfig","options","createConfigItemRunner","createConfigItemImpl","maybeErrback","runner","argOrCallback","maybeCallback","arg","callback","undefined","sync","errback","loadPartialConfig","loadPartialConfigRunner","exports","loadPartialConfigSync","loadPartialConfigAsync","async","loadOptions","loadOptionsSync","loadOptionsAsync","createConfigItemSync","createConfigItemAsync","createConfigItem","target"],"sources":["../../src/config/index.ts"],"sourcesContent":["import gensync, { type Handler, type Callback } from \"gensync\";\n\nexport type {\n ResolvedConfig,\n InputOptions,\n PluginPasses,\n Plugin,\n} from \"./full\";\n\nimport type { PluginTarget } from \"./validation/options\";\n\nimport type {\n PluginAPI as basePluginAPI,\n PresetAPI as basePresetAPI,\n} from \"./helpers/config-api\";\nexport type { PluginObject } from \"./validation/plugins\";\ntype PluginAPI = basePluginAPI & typeof import(\"..\");\ntype PresetAPI = basePresetAPI & typeof import(\"..\");\nexport type { PluginAPI, PresetAPI };\n// todo: may need to refine PresetObject to be a subset of ValidatedOptions\nexport type {\n CallerMetadata,\n ValidatedOptions as PresetObject,\n} from \"./validation/options\";\n\nimport loadFullConfig, { type ResolvedConfig } from \"./full\";\nimport { loadPartialConfig as loadPartialConfigRunner } from \"./partial\";\n\nexport { loadFullConfig as default };\nexport type { PartialConfig } from \"./partial\";\n\nimport { createConfigItem as createConfigItemImpl } from \"./item\";\nimport type { ConfigItem } from \"./item\";\n\nconst loadOptionsRunner = gensync(function* (\n opts: unknown,\n): Handler {\n const config = yield* loadFullConfig(opts);\n // NOTE: We want to return \"null\" explicitly, while ?. alone returns undefined\n return config?.options ?? null;\n});\n\nconst createConfigItemRunner = gensync(createConfigItemImpl);\n\nconst maybeErrback =\n (runner: gensync.Gensync<[Arg], Return>) =>\n (argOrCallback: Arg | Callback, maybeCallback?: Callback) => {\n let arg: Arg | undefined;\n let callback: Callback;\n if (maybeCallback === undefined && typeof argOrCallback === \"function\") {\n callback = argOrCallback as Callback;\n arg = undefined;\n } else {\n callback = maybeCallback;\n arg = argOrCallback as Arg;\n }\n if (!callback) {\n return runner.sync(arg);\n }\n runner.errback(arg, callback);\n };\n\nexport const loadPartialConfig = maybeErrback(loadPartialConfigRunner);\nexport const loadPartialConfigSync = loadPartialConfigRunner.sync;\nexport const loadPartialConfigAsync = loadPartialConfigRunner.async;\n\nexport const loadOptions = maybeErrback(loadOptionsRunner);\nexport const loadOptionsSync = loadOptionsRunner.sync;\nexport const loadOptionsAsync = loadOptionsRunner.async;\n\nexport const createConfigItemSync = createConfigItemRunner.sync;\nexport const createConfigItemAsync = createConfigItemRunner.async;\nexport function createConfigItem(\n target: PluginTarget,\n options: Parameters[1],\n callback?: (err: Error, val: ConfigItem | null) => void,\n) {\n if (callback !== undefined) {\n createConfigItemRunner.errback(target, options, callback);\n } else if (typeof options === \"function\") {\n createConfigItemRunner.errback(target, undefined, callback);\n } else {\n return createConfigItemRunner.sync(target, options);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAyBA,IAAAE,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAGA,MAAMI,iBAAiB,GAAGC,UAAO,CAAC,WAChCC,IAAa,EACmB;EAAA,IAAAC,eAAA;EAChC,MAAMC,MAAM,GAAG,OAAO,IAAAC,aAAc,EAACH,IAAI,CAAC;EAE1C,QAAAC,eAAA,GAAOC,MAAM,oBAANA,MAAM,CAAEE,OAAO,YAAAH,eAAA,GAAI,IAAI;AAChC,CAAC,CAAC;AAEF,MAAMI,sBAAsB,GAAGN,UAAO,CAACO,sBAAoB,CAAC;AAE5D,MAAMC,YAAY,GACFC,MAAsC,IACpD,CAACC,aAAqC,EAAEC,aAAgC,KAAK;EAC3E,IAAIC,GAAoB;EACxB,IAAIC,QAA0B;EAC9B,IAAIF,aAAa,KAAKG,SAAS,IAAI,OAAOJ,aAAa,KAAK,UAAU,EAAE;IACtEG,QAAQ,GAAGH,aAAiC;IAC5CE,GAAG,GAAGE,SAAS;EACjB,CAAC,MAAM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CAACa,MAAM,EAAEf,SAAS,EAAED,QAAQ,CAAC;EAC7D,CAAC,MAAM;IACL,OAAOP,sBAAsB,CAACS,IAAI,CAACc,MAAM,EAAExB,OAAO,CAAC;EACrD;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/item.js b/node_modules/@babel/core/lib/config/item.js deleted file mode 100644 index f619287f2..000000000 --- a/node_modules/@babel/core/lib/config/item.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.createConfigItem = createConfigItem; -exports.createItemFromDescriptor = createItemFromDescriptor; -exports.getItemDescriptor = getItemDescriptor; -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -var _configDescriptors = require("./config-descriptors"); -function createItemFromDescriptor(desc) { - return new ConfigItem(desc); -} -function* createConfigItem(value, { - dirname = ".", - type -} = {}) { - const descriptor = yield* (0, _configDescriptors.createDescriptor)(value, _path().resolve(dirname), { - type, - alias: "programmatic item" - }); - return createItemFromDescriptor(descriptor); -} -const CONFIG_ITEM_BRAND = Symbol.for("@babel/core@7 - ConfigItem"); -function getItemDescriptor(item) { - if (item != null && item[CONFIG_ITEM_BRAND]) { - return item._descriptor; - } - return undefined; -} -class ConfigItem { - constructor(descriptor) { - this._descriptor = void 0; - this[CONFIG_ITEM_BRAND] = true; - this.value = void 0; - this.options = void 0; - this.dirname = void 0; - this.name = void 0; - this.file = void 0; - this._descriptor = descriptor; - Object.defineProperty(this, "_descriptor", { - enumerable: false - }); - Object.defineProperty(this, CONFIG_ITEM_BRAND, { - enumerable: false - }); - this.value = this._descriptor.value; - this.options = this._descriptor.options; - this.dirname = this._descriptor.dirname; - this.name = this._descriptor.name; - this.file = this._descriptor.file ? { - request: this._descriptor.file.request, - resolved: this._descriptor.file.resolved - } : undefined; - Object.freeze(this); - } -} -Object.freeze(ConfigItem.prototype); -0 && 0; - -//# sourceMappingURL=item.js.map diff --git a/node_modules/@babel/core/lib/config/item.js.map b/node_modules/@babel/core/lib/config/item.js.map deleted file mode 100644 index 62d841767..000000000 --- a/node_modules/@babel/core/lib/config/item.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_path","data","require","_configDescriptors","createItemFromDescriptor","desc","ConfigItem","createConfigItem","value","dirname","type","descriptor","createDescriptor","path","resolve","alias","CONFIG_ITEM_BRAND","Symbol","for","getItemDescriptor","item","_descriptor","undefined","constructor","options","name","file","Object","defineProperty","enumerable","request","resolved","freeze","prototype"],"sources":["../../src/config/item.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\nimport type { PluginTarget, PluginOptions } from \"./validation/options\";\n\nimport path from \"path\";\nimport { createDescriptor } from \"./config-descriptors\";\n\nimport type { UnloadedDescriptor } from \"./config-descriptors\";\n\nexport function createItemFromDescriptor(desc: UnloadedDescriptor): ConfigItem {\n return new ConfigItem(desc);\n}\n\n/**\n * Create a config item using the same value format used in Babel's config\n * files. Items returned from this function should be cached by the caller\n * ideally, as recreating the config item will mean re-resolving the item\n * and re-evaluating the plugin/preset function.\n */\nexport function* createConfigItem(\n value:\n | PluginTarget\n | [PluginTarget, PluginOptions]\n | [PluginTarget, PluginOptions, string | void],\n {\n dirname = \".\",\n type,\n }: {\n dirname?: string;\n type?: \"preset\" | \"plugin\";\n } = {},\n): Handler {\n const descriptor = yield* createDescriptor(value, path.resolve(dirname), {\n type,\n alias: \"programmatic item\",\n });\n\n return createItemFromDescriptor(descriptor);\n}\n\nconst CONFIG_ITEM_BRAND = Symbol.for(\"@babel/core@7 - ConfigItem\");\n\nexport function getItemDescriptor(item: unknown): UnloadedDescriptor | void {\n if ((item as any)?.[CONFIG_ITEM_BRAND]) {\n return (item as ConfigItem)._descriptor;\n }\n\n return undefined;\n}\n\nexport type { ConfigItem };\n\n/**\n * A public representation of a plugin/preset that will _eventually_ be load.\n * Users can use this to interact with the results of a loaded Babel\n * configuration.\n *\n * Any changes to public properties of this class should be considered a\n * breaking change to Babel's API.\n */\nclass ConfigItem {\n /**\n * The private underlying descriptor that Babel actually cares about.\n * If you access this, you are a bad person.\n */\n _descriptor: UnloadedDescriptor;\n\n // TODO(Babel 9): Check if this symbol needs to be updated\n /**\n * Used to detect ConfigItem instances from other Babel instances.\n */\n [CONFIG_ITEM_BRAND] = true;\n\n /**\n * The resolved value of the item itself.\n */\n value: {} | Function;\n\n /**\n * The options, if any, that were passed to the item.\n * Mutating this will lead to undefined behavior.\n *\n * \"false\" means that this item has been disabled.\n */\n options: {} | void | false;\n\n /**\n * The directory that the options for this item are relative to.\n */\n dirname: string;\n\n /**\n * Get the name of the plugin, if the user gave it one.\n */\n name: string | void;\n\n /**\n * Data about the file that the item was loaded from, if Babel knows it.\n */\n file: {\n // The requested path, e.g. \"@babel/env\".\n request: string;\n // The resolved absolute path of the file.\n resolved: string;\n } | void;\n\n constructor(descriptor: UnloadedDescriptor) {\n // Make people less likely to stumble onto this if they are exploring\n // programmatically, and also make sure that if people happen to\n // pass the item through JSON.stringify, it doesn't show up.\n this._descriptor = descriptor;\n Object.defineProperty(this, \"_descriptor\", { enumerable: false });\n\n Object.defineProperty(this, CONFIG_ITEM_BRAND, { enumerable: false });\n\n this.value = this._descriptor.value;\n this.options = this._descriptor.options;\n this.dirname = this._descriptor.dirname;\n this.name = this._descriptor.name;\n this.file = this._descriptor.file\n ? {\n request: this._descriptor.file.request,\n resolved: this._descriptor.file.resolved,\n }\n : undefined;\n\n // Freeze the object to make it clear that people shouldn't expect mutating\n // this object to do anything. A new item should be created if they want\n // to change something.\n Object.freeze(this);\n }\n}\n\nObject.freeze(ConfigItem.prototype);\n"],"mappings":";;;;;;;;AAGA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,IAAAE,kBAAA,GAAAD,OAAA;AAIO,SAASE,wBAAwBA,CAACC,IAAwB,EAAc;EAC7E,OAAO,IAAIC,UAAU,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AI,GAAG,IAAI,CAACJ,WAAW,CAACI,IAAI;IACjC,IAAI,CAACC,IAAI,GAAG,IAAI,CAACL,WAAW,CAACK,IAAI,GAC7B;MACEI,OAAO,EAAE,IAAI,CAACT,WAAW,CAACK,IAAI,CAACI,OAAO;MACtCC,QAAQ,EAAE,IAAI,CAACV,WAAW,CAACK,IAAI,CAACK;IAClC,CAAC,GACDT,SAAS;IAKbK,MAAM,CAACK,MAAM,CAAC,IAAI,CAAC;EACrB;AACF;AAEAL,MAAM,CAACK,MAAM,CAAC1B,UAAU,CAAC2B,SAAS,CAAC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/partial.js b/node_modules/@babel/core/lib/config/partial.js deleted file mode 100644 index 443458cfb..000000000 --- a/node_modules/@babel/core/lib/config/partial.js +++ /dev/null @@ -1,166 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = loadPrivatePartialConfig; -exports.loadPartialConfig = void 0; -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _plugin = require("./plugin"); -var _util = require("./util"); -var _item = require("./item"); -var _configChain = require("./config-chain"); -var _environment = require("./helpers/environment"); -var _options = require("./validation/options"); -var _files = require("./files"); -var _resolveTargets = require("./resolve-targets"); -const _excluded = ["showIgnoredFiles"]; -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function resolveRootMode(rootDir, rootMode) { - switch (rootMode) { - case "root": - return rootDir; - case "upward-optional": - { - const upwardRootDir = (0, _files.findConfigUpwards)(rootDir); - return upwardRootDir === null ? rootDir : upwardRootDir; - } - case "upward": - { - const upwardRootDir = (0, _files.findConfigUpwards)(rootDir); - if (upwardRootDir !== null) return upwardRootDir; - throw Object.assign(new Error(`Babel was run with rootMode:"upward" but a root could not ` + `be found when searching upward from "${rootDir}".\n` + `One of the following config files must be in the directory tree: ` + `"${_files.ROOT_CONFIG_FILENAMES.join(", ")}".`), { - code: "BABEL_ROOT_NOT_FOUND", - dirname: rootDir - }); - } - default: - throw new Error(`Assertion failure - unknown rootMode value.`); - } -} -function* loadPrivatePartialConfig(inputOpts) { - if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) { - throw new Error("Babel options must be an object, null, or undefined"); - } - const args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {}; - const { - envName = (0, _environment.getEnv)(), - cwd = ".", - root: rootDir = ".", - rootMode = "root", - caller, - cloneInputAst = true - } = args; - const absoluteCwd = _path().resolve(cwd); - const absoluteRootDir = resolveRootMode(_path().resolve(absoluteCwd, rootDir), rootMode); - const filename = typeof args.filename === "string" ? _path().resolve(cwd, args.filename) : undefined; - const showConfigPath = yield* (0, _files.resolveShowConfigPath)(absoluteCwd); - const context = { - filename, - cwd: absoluteCwd, - root: absoluteRootDir, - envName, - caller, - showConfig: showConfigPath === filename - }; - const configChain = yield* (0, _configChain.buildRootChain)(args, context); - if (!configChain) return null; - const merged = { - assumptions: {} - }; - configChain.options.forEach(opts => { - (0, _util.mergeOptions)(merged, opts); - }); - const options = Object.assign({}, merged, { - targets: (0, _resolveTargets.resolveTargets)(merged, absoluteRootDir), - cloneInputAst, - babelrc: false, - configFile: false, - browserslistConfigFile: false, - passPerPreset: false, - envName: context.envName, - cwd: context.cwd, - root: context.root, - rootMode: "root", - filename: typeof context.filename === "string" ? context.filename : undefined, - plugins: configChain.plugins.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor)), - presets: configChain.presets.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor)) - }); - return { - options, - context, - fileHandling: configChain.fileHandling, - ignore: configChain.ignore, - babelrc: configChain.babelrc, - config: configChain.config, - files: configChain.files - }; -} -const loadPartialConfig = _gensync()(function* (opts) { - let showIgnoredFiles = false; - if (typeof opts === "object" && opts !== null && !Array.isArray(opts)) { - var _opts = opts; - ({ - showIgnoredFiles - } = _opts); - opts = _objectWithoutPropertiesLoose(_opts, _excluded); - _opts; - } - const result = yield* loadPrivatePartialConfig(opts); - if (!result) return null; - const { - options, - babelrc, - ignore, - config, - fileHandling, - files - } = result; - if (fileHandling === "ignored" && !showIgnoredFiles) { - return null; - } - (options.plugins || []).forEach(item => { - if (item.value instanceof _plugin.default) { - throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()"); - } - }); - return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined, fileHandling, files); -}); -exports.loadPartialConfig = loadPartialConfig; -class PartialConfig { - constructor(options, babelrc, ignore, config, fileHandling, files) { - this.options = void 0; - this.babelrc = void 0; - this.babelignore = void 0; - this.config = void 0; - this.fileHandling = void 0; - this.files = void 0; - this.options = options; - this.babelignore = ignore; - this.babelrc = babelrc; - this.config = config; - this.fileHandling = fileHandling; - this.files = files; - Object.freeze(this); - } - hasFilesystemConfig() { - return this.babelrc !== undefined || this.config !== undefined; - } -} -Object.freeze(PartialConfig.prototype); -0 && 0; - -//# sourceMappingURL=partial.js.map diff --git a/node_modules/@babel/core/lib/config/partial.js.map b/node_modules/@babel/core/lib/config/partial.js.map deleted file mode 100644 index 58ab444f3..000000000 --- a/node_modules/@babel/core/lib/config/partial.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_path","data","require","_gensync","_plugin","_util","_item","_configChain","_environment","_options","_files","_resolveTargets","_excluded","_objectWithoutPropertiesLoose","source","excluded","target","sourceKeys","Object","keys","key","i","length","indexOf","resolveRootMode","rootDir","rootMode","upwardRootDir","findConfigUpwards","assign","Error","ROOT_CONFIG_FILENAMES","join","code","dirname","loadPrivatePartialConfig","inputOpts","Array","isArray","args","validate","envName","getEnv","cwd","root","caller","cloneInputAst","absoluteCwd","path","resolve","absoluteRootDir","filename","undefined","showConfigPath","resolveShowConfigPath","context","showConfig","configChain","buildRootChain","merged","assumptions","options","forEach","opts","mergeOptions","targets","resolveTargets","babelrc","configFile","browserslistConfigFile","passPerPreset","plugins","map","descriptor","createItemFromDescriptor","presets","fileHandling","ignore","config","files","loadPartialConfig","gensync","showIgnoredFiles","_opts","result","item","value","Plugin","PartialConfig","filepath","exports","constructor","babelignore","freeze","hasFilesystemConfig","prototype"],"sources":["../../src/config/partial.ts"],"sourcesContent":["import path from \"path\";\nimport gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport Plugin from \"./plugin\";\nimport { mergeOptions } from \"./util\";\nimport { createItemFromDescriptor } from \"./item\";\nimport { buildRootChain } from \"./config-chain\";\nimport type { ConfigContext, FileHandling } from \"./config-chain\";\nimport { getEnv } from \"./helpers/environment\";\nimport { validate } from \"./validation/options\";\n\nimport type {\n ValidatedOptions,\n NormalizedOptions,\n RootMode,\n} from \"./validation/options\";\n\nimport {\n findConfigUpwards,\n resolveShowConfigPath,\n ROOT_CONFIG_FILENAMES,\n} from \"./files\";\nimport type { ConfigFile, IgnoreFile } from \"./files\";\nimport { resolveTargets } from \"./resolve-targets\";\n\nfunction resolveRootMode(rootDir: string, rootMode: RootMode): string {\n switch (rootMode) {\n case \"root\":\n return rootDir;\n\n case \"upward-optional\": {\n const upwardRootDir = findConfigUpwards(rootDir);\n return upwardRootDir === null ? rootDir : upwardRootDir;\n }\n\n case \"upward\": {\n const upwardRootDir = findConfigUpwards(rootDir);\n if (upwardRootDir !== null) return upwardRootDir;\n\n throw Object.assign(\n new Error(\n `Babel was run with rootMode:\"upward\" but a root could not ` +\n `be found when searching upward from \"${rootDir}\".\\n` +\n `One of the following config files must be in the directory tree: ` +\n `\"${ROOT_CONFIG_FILENAMES.join(\", \")}\".`,\n ) as any,\n {\n code: \"BABEL_ROOT_NOT_FOUND\",\n dirname: rootDir,\n },\n );\n }\n default:\n throw new Error(`Assertion failure - unknown rootMode value.`);\n }\n}\n\ntype PrivPartialConfig = {\n options: NormalizedOptions;\n context: ConfigContext;\n fileHandling: FileHandling;\n ignore: IgnoreFile | void;\n babelrc: ConfigFile | void;\n config: ConfigFile | void;\n files: Set;\n};\n\nexport default function* loadPrivatePartialConfig(\n inputOpts: unknown,\n): Handler {\n if (\n inputOpts != null &&\n (typeof inputOpts !== \"object\" || Array.isArray(inputOpts))\n ) {\n throw new Error(\"Babel options must be an object, null, or undefined\");\n }\n\n const args = inputOpts ? validate(\"arguments\", inputOpts) : {};\n\n const {\n envName = getEnv(),\n cwd = \".\",\n root: rootDir = \".\",\n rootMode = \"root\",\n caller,\n cloneInputAst = true,\n } = args;\n const absoluteCwd = path.resolve(cwd);\n const absoluteRootDir = resolveRootMode(\n path.resolve(absoluteCwd, rootDir),\n rootMode,\n );\n\n const filename =\n typeof args.filename === \"string\"\n ? path.resolve(cwd, args.filename)\n : undefined;\n\n const showConfigPath = yield* resolveShowConfigPath(absoluteCwd);\n\n const context: ConfigContext = {\n filename,\n cwd: absoluteCwd,\n root: absoluteRootDir,\n envName,\n caller,\n showConfig: showConfigPath === filename,\n };\n\n const configChain = yield* buildRootChain(args, context);\n if (!configChain) return null;\n\n const merged: ValidatedOptions = {\n assumptions: {},\n };\n configChain.options.forEach(opts => {\n mergeOptions(merged as any, opts);\n });\n\n const options: NormalizedOptions = {\n ...merged,\n targets: resolveTargets(merged, absoluteRootDir),\n\n // Tack the passes onto the object itself so that, if this object is\n // passed back to Babel a second time, it will be in the right structure\n // to not change behavior.\n cloneInputAst,\n babelrc: false,\n configFile: false,\n browserslistConfigFile: false,\n passPerPreset: false,\n envName: context.envName,\n cwd: context.cwd,\n root: context.root,\n rootMode: \"root\",\n filename:\n typeof context.filename === \"string\" ? context.filename : undefined,\n\n plugins: configChain.plugins.map(descriptor =>\n createItemFromDescriptor(descriptor),\n ),\n presets: configChain.presets.map(descriptor =>\n createItemFromDescriptor(descriptor),\n ),\n };\n\n return {\n options,\n context,\n fileHandling: configChain.fileHandling,\n ignore: configChain.ignore,\n babelrc: configChain.babelrc,\n config: configChain.config,\n files: configChain.files,\n };\n}\n\ntype LoadPartialConfigOpts = {\n showIgnoredFiles?: boolean;\n};\n\nexport const loadPartialConfig = gensync(function* (\n opts?: LoadPartialConfigOpts,\n): Handler {\n let showIgnoredFiles = false;\n // We only extract showIgnoredFiles if opts is an object, so that\n // loadPrivatePartialConfig can throw the appropriate error if it's not.\n if (typeof opts === \"object\" && opts !== null && !Array.isArray(opts)) {\n ({ showIgnoredFiles, ...opts } = opts);\n }\n\n const result: PrivPartialConfig | undefined | null =\n yield* loadPrivatePartialConfig(opts);\n if (!result) return null;\n\n const { options, babelrc, ignore, config, fileHandling, files } = result;\n\n if (fileHandling === \"ignored\" && !showIgnoredFiles) {\n return null;\n }\n\n (options.plugins || []).forEach(item => {\n // @ts-expect-error todo(flow->ts): better type annotation for `item.value`\n if (item.value instanceof Plugin) {\n throw new Error(\n \"Passing cached plugin instances is not supported in \" +\n \"babel.loadPartialConfig()\",\n );\n }\n });\n\n return new PartialConfig(\n options,\n babelrc ? babelrc.filepath : undefined,\n ignore ? ignore.filepath : undefined,\n config ? config.filepath : undefined,\n fileHandling,\n files,\n );\n});\n\nexport type { PartialConfig };\n\nclass PartialConfig {\n /**\n * These properties are public, so any changes to them should be considered\n * a breaking change to Babel's API.\n */\n options: NormalizedOptions;\n babelrc: string | void;\n babelignore: string | void;\n config: string | void;\n fileHandling: FileHandling;\n files: Set;\n\n constructor(\n options: NormalizedOptions,\n babelrc: string | void,\n ignore: string | void,\n config: string | void,\n fileHandling: FileHandling,\n files: Set,\n ) {\n this.options = options;\n this.babelignore = ignore;\n this.babelrc = babelrc;\n this.config = config;\n this.fileHandling = fileHandling;\n this.files = files;\n\n // Freeze since this is a public API and it should be extremely obvious that\n // reassigning properties on here does nothing.\n Object.freeze(this);\n }\n\n /**\n * Returns true if there is a config file in the filesystem for this config.\n */\n hasFilesystemConfig(): boolean {\n return this.babelrc !== undefined || this.config !== undefined;\n }\n}\nObject.fre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O,GAAGA,OAAO,CAACsB,QAAQ,GAAGrC,SAAS,EACtCyB,MAAM,GAAGA,MAAM,CAACY,QAAQ,GAAGrC,SAAS,EACpC0B,MAAM,GAAGA,MAAM,CAACW,QAAQ,GAAGrC,SAAS,EACpCwB,YAAY,EACZG,KAAK,CACN;AACH,CAAC,CAAC;AAACW,OAAA,CAAAV,iBAAA,GAAAA,iBAAA;AAIH,MAAMQ,aAAa,CAAC;EAYlBG,WAAWA,CACT9B,OAA0B,EAC1BM,OAAsB,EACtBU,MAAqB,EACrBC,MAAqB,EACrBF,YAA0B,EAC1BG,KAAkB,EAClB;IAAA,KAdFlB,OAAO;IAAA,KACPM,OAAO;IAAA,KACPyB,WAAW;IAAA,KACXd,MAAM;IAAA,KACNF,YAAY;IAAA,KACZG,KAAK;IAUH,IAAI,CAAClB,OAAO,GAAGA,OAAO;IACtB,IAAI,CAAC+B,WAAW,GAAGf,MAAM;IACzB,IAAI,CAACV,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACW,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACF,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACG,KAAK,GAAGA,KAAK;IAIlB7D,MAAM,CAAC2E,MAAM,CAAC,IAAI,CAAC;EACrB;EAKAC,mBAAmBA,CAAA,EAAY;IAC7B,OAAO,IAAI,CAAC3B,OAAO,KAAKf,SAAS,IAAI,IAAI,CAAC0B,MAAM,KAAK1B,SAAS;EAChE;AACF;AACAlC,MAAM,CAAC2E,MAAM,CAACL,aAAa,CAACO,SAAS,CAAC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/pattern-to-regex.js b/node_modules/@babel/core/lib/config/pattern-to-regex.js deleted file mode 100644 index e061f7935..000000000 --- a/node_modules/@babel/core/lib/config/pattern-to-regex.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = pathToPattern; -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -const sep = `\\${_path().sep}`; -const endSep = `(?:${sep}|$)`; -const substitution = `[^${sep}]+`; -const starPat = `(?:${substitution}${sep})`; -const starPatLast = `(?:${substitution}${endSep})`; -const starStarPat = `${starPat}*?`; -const starStarPatLast = `${starPat}*?${starPatLast}?`; -function escapeRegExp(string) { - return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); -} -function pathToPattern(pattern, dirname) { - const parts = _path().resolve(dirname, pattern).split(_path().sep); - return new RegExp(["^", ...parts.map((part, i) => { - const last = i === parts.length - 1; - if (part === "**") return last ? starStarPatLast : starStarPat; - if (part === "*") return last ? starPatLast : starPat; - if (part.indexOf("*.") === 0) { - return substitution + escapeRegExp(part.slice(1)) + (last ? endSep : sep); - } - return escapeRegExp(part) + (last ? endSep : sep); - })].join("")); -} -0 && 0; - -//# sourceMappingURL=pattern-to-regex.js.map diff --git a/node_modules/@babel/core/lib/config/pattern-to-regex.js.map b/node_modules/@babel/core/lib/config/pattern-to-regex.js.map deleted file mode 100644 index 4405f5b96..000000000 --- a/node_modules/@babel/core/lib/config/pattern-to-regex.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_path","data","require","sep","path","endSep","substitution","starPat","starPatLast","starStarPat","starStarPatLast","escapeRegExp","string","replace","pathToPattern","pattern","dirname","parts","resolve","split","RegExp","map","part","i","last","length","indexOf","slice","join"],"sources":["../../src/config/pattern-to-regex.ts"],"sourcesContent":["import path from \"path\";\n\nconst sep = `\\\\${path.sep}`;\nconst endSep = `(?:${sep}|$)`;\n\nconst substitution = `[^${sep}]+`;\n\nconst starPat = `(?:${substitution}${sep})`;\nconst starPatLast = `(?:${substitution}${endSep})`;\n\nconst starStarPat = `${starPat}*?`;\nconst starStarPatLast = `${starPat}*?${starPatLast}?`;\n\nfunction escapeRegExp(string: string) {\n return string.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\");\n}\n\n/**\n * Implement basic pattern matching that will allow users to do the simple\n * tests with * and **. If users want full complex pattern matching, then can\n * always use regex matching, or function validation.\n */\nexport default function pathToPattern(\n pattern: string,\n dirname: string,\n): RegExp {\n const parts = path.resolve(dirname, pattern).split(path.sep);\n\n return new RegExp(\n [\n \"^\",\n ...parts.map((part, i) => {\n const last = i === parts.length - 1;\n\n // ** matches 0 or more path parts.\n if (part === \"**\") return last ? starStarPatLast : starStarPat;\n\n // * matches 1 path part.\n if (part === \"*\") return last ? starPatLast : starPat;\n\n // *.ext matches a wildcard with an extension.\n if (part.indexOf(\"*.\") === 0) {\n return (\n substitution + escapeRegExp(part.slice(1)) + (last ? endSep : sep)\n );\n }\n\n // Otherwise match the pattern text.\n return escapeRegExp(part) + (last ? endSep : sep);\n }),\n ].join(\"\"),\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAME,GAAG,GAAI,KAAIC,OAAI,CAACD,GAAI,EAAC;AAC3B,MAAME,MAAM,GAAI,MAAKF,GAAI,KAAI;AAE7B,MAAMG,YAAY,GAAI,KAAIH,GAAI,IAAG;AAEjC,MAAMI,OAAO,GAAI,MAAKD,YAAa,GAAEH,GAAI,GAAE;AAC3C,MAAMK,WAAW,GAAI,MAAKF,YAAa,GAAED,MAAO,GAAE;AAElD,MAAMI,WAAW,GAAI,GAAEF,OAAQ,IAAG;AAClC,MAAMG,eAAe,GAAI,GAAEH,OAAQ,KAAIC,WAAY,GAAE;AAErD,SAASG,YAAYA,CAACC,MAAc,EAAE;EACpC,OAAOA,MAAM,CAACC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC;AACtD;AAOe,SAASC,aAAaA,CACnCC,OAAe,EACfC,OAAe,EACP;EACR,MAAMC,KAAK,GAAGb,OAAI,CAACc,OAAO,CAACF,OAAO,EAAED,OAAO,CAAC,CAACI,KAAK,CAACf,OAAI,CAACD,GAAG,CAAC;EAE5D,OAAO,IAAIiB,MAAM,CACf,CACE,GAAG,EACH,GAAGH,KAAK,CAACI,GAAG,CAAC,CAACC,IAAI,EAAEC,CAAC,KAAK;IACxB,MAAMC,IAAI,GAAGD,CAAC,KAAKN,KAAK,CAACQ,MAAM,GAAG,CAAC;IAGnC,IAAIH,IAAI,KAAK,IAAI,EAAE,OAAOE,IAAI,GAAGd,eAAe,GAAGD,WAAW;IAG9D,IAAIa,IAAI,KAAK,GAAG,EAAE,OAAOE,IAAI,GAAGhB,WAAW,GAAGD,OAAO;IAGrD,IAAIe,IAAI,CAACI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;MAC5B,OACEpB,YAAY,GAAGK,YAAY,CAACW,IAAI,CAACK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAIH,IAAI,GAAGnB,MAAM,GAAGF,GAAG,CAAC;IAEtE;IAGA,OAAOQ,YAAY,CAACW,IAAI,CAAC,IAAIE,IAAI,GAAGnB,MAAM,GAAGF,GAAG,CAAC;EACnD,CAAC,CAAC,CACH,CAACyB,IAAI,CAAC,EAAE,CAAC,CACX;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/plugin.js b/node_modules/@babel/core/lib/config/plugin.js deleted file mode 100644 index 58dcb0340..000000000 --- a/node_modules/@babel/core/lib/config/plugin.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _deepArray = require("./helpers/deep-array"); -class Plugin { - constructor(plugin, options, key, externalDependencies = (0, _deepArray.finalize)([])) { - this.key = void 0; - this.manipulateOptions = void 0; - this.post = void 0; - this.pre = void 0; - this.visitor = void 0; - this.parserOverride = void 0; - this.generatorOverride = void 0; - this.options = void 0; - this.externalDependencies = void 0; - this.key = plugin.name || key; - this.manipulateOptions = plugin.manipulateOptions; - this.post = plugin.post; - this.pre = plugin.pre; - this.visitor = plugin.visitor || {}; - this.parserOverride = plugin.parserOverride; - this.generatorOverride = plugin.generatorOverride; - this.options = options; - this.externalDependencies = externalDependencies; - } -} -exports.default = Plugin; -0 && 0; - -//# sourceMappingURL=plugin.js.map diff --git a/node_modules/@babel/core/lib/config/plugin.js.map b/node_modules/@babel/core/lib/config/plugin.js.map deleted file mode 100644 index 32cd22355..000000000 --- a/node_modules/@babel/core/lib/config/plugin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_deepArray","require","Plugin","constructor","plugin","options","key","externalDependencies","finalize","manipulateOptions","post","pre","visitor","parserOverride","generatorOverride","name","exports","default"],"sources":["../../src/config/plugin.ts"],"sourcesContent":["import { finalize } from \"./helpers/deep-array\";\nimport type { ReadonlyDeepArray } from \"./helpers/deep-array\";\nimport type { PluginObject } from \"./validation/plugins\";\n\nexport default class Plugin {\n key: string | undefined | null;\n manipulateOptions?: (options: unknown, parserOpts: unknown) => void;\n post?: PluginObject[\"post\"];\n pre?: PluginObject[\"pre\"];\n visitor: PluginObject[\"visitor\"];\n\n parserOverride?: Function;\n generatorOverride?: Function;\n\n options: {};\n\n externalDependencies: ReadonlyDeepArray;\n\n constructor(\n plugin: PluginObject,\n options: {},\n key?: string,\n externalDependencies: ReadonlyDeepArray = finalize([]),\n ) {\n this.key = plugin.name || key;\n\n this.manipulateOptions = plugin.manipulateOptions;\n this.post = plugin.post;\n this.pre = plugin.pre;\n this.visitor = plugin.visitor || {};\n this.parserOverride = plugin.parserOverride;\n this.generatorOverride = plugin.generatorOverride;\n\n this.options = options;\n this.externalDependencies = externalDependencies;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAIe,MAAMC,MAAM,CAAC;EAc1BC,WAAWA,CACTC,MAAoB,EACpBC,OAAW,EACXC,GAAY,EACZC,oBAA+C,GAAG,IAAAC,mBAAQ,EAAC,EAAE,CAAC,EAC9D;IAAA,KAlBFF,GAAG;IAAA,KACHG,iBAAiB;IAAA,KACjBC,IAAI;IAAA,KACJC,GAAG;IAAA,KACHC,OAAO;IAAA,KAEPC,cAAc;IAAA,KACdC,iBAAiB;IAAA,KAEjBT,OAAO;IAAA,KAEPE,oBAAoB;IAQlB,IAAI,CAACD,GAAG,GAAGF,MAAM,CAACW,IAAI,IAAIT,GAAG;IAE7B,IAAI,CAACG,iBAAiB,GAAGL,MAAM,CAACK,iBAAiB;IACjD,IAAI,CAACC,IAAI,GAAGN,MAAM,CAACM,IAAI;IACvB,IAAI,CAACC,GAAG,GAAGP,MAAM,CAACO,GAAG;IACrB,IAAI,CAACC,OAAO,GAAGR,MAAM,CAACQ,OAAO,IAAI,CAAC,CAAC;IACnC,IAAI,CAACC,cAAc,GAAGT,MAAM,CAACS,cAAc;IAC3C,IAAI,CAACC,iBAAiB,GAAGV,MAAM,CAACU,iBAAiB;IAEjD,IAAI,CAACT,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACE,oBAAoB,GAAGA,oBAAoB;EAClD;AACF;AAACS,OAAA,CAAAC,OAAA,GAAAf,MAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/printer.js b/node_modules/@babel/core/lib/config/printer.js deleted file mode 100644 index 3fb9ced37..000000000 --- a/node_modules/@babel/core/lib/config/printer.js +++ /dev/null @@ -1,114 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ConfigPrinter = exports.ChainFormatter = void 0; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -const ChainFormatter = { - Programmatic: 0, - Config: 1 -}; -exports.ChainFormatter = ChainFormatter; -const Formatter = { - title(type, callerName, filepath) { - let title = ""; - if (type === ChainFormatter.Programmatic) { - title = "programmatic options"; - if (callerName) { - title += " from " + callerName; - } - } else { - title = "config " + filepath; - } - return title; - }, - loc(index, envName) { - let loc = ""; - if (index != null) { - loc += `.overrides[${index}]`; - } - if (envName != null) { - loc += `.env["${envName}"]`; - } - return loc; - }, - *optionsAndDescriptors(opt) { - const content = Object.assign({}, opt.options); - delete content.overrides; - delete content.env; - const pluginDescriptors = [...(yield* opt.plugins())]; - if (pluginDescriptors.length) { - content.plugins = pluginDescriptors.map(d => descriptorToConfig(d)); - } - const presetDescriptors = [...(yield* opt.presets())]; - if (presetDescriptors.length) { - content.presets = [...presetDescriptors].map(d => descriptorToConfig(d)); - } - return JSON.stringify(content, undefined, 2); - } -}; -function descriptorToConfig(d) { - var _d$file; - let name = (_d$file = d.file) == null ? void 0 : _d$file.request; - if (name == null) { - if (typeof d.value === "object") { - name = d.value; - } else if (typeof d.value === "function") { - name = `[Function: ${d.value.toString().slice(0, 50)} ... ]`; - } - } - if (name == null) { - name = "[Unknown]"; - } - if (d.options === undefined) { - return name; - } else if (d.name == null) { - return [name, d.options]; - } else { - return [name, d.options, d.name]; - } -} -class ConfigPrinter { - constructor() { - this._stack = []; - } - configure(enabled, type, { - callerName, - filepath - }) { - if (!enabled) return () => {}; - return (content, index, envName) => { - this._stack.push({ - type, - callerName, - filepath, - content, - index, - envName - }); - }; - } - static *format(config) { - let title = Formatter.title(config.type, config.callerName, config.filepath); - const loc = Formatter.loc(config.index, config.envName); - if (loc) title += ` ${loc}`; - const content = yield* Formatter.optionsAndDescriptors(config.content); - return `${title}\n${content}`; - } - *output() { - if (this._stack.length === 0) return ""; - const configs = yield* _gensync().all(this._stack.map(s => ConfigPrinter.format(s))); - return configs.join("\n\n"); - } -} -exports.ConfigPrinter = ConfigPrinter; -0 && 0; - -//# sourceMappingURL=printer.js.map diff --git a/node_modules/@babel/core/lib/config/printer.js.map b/node_modules/@babel/core/lib/config/printer.js.map deleted file mode 100644 index 1a823c06d..000000000 --- a/node_modules/@babel/core/lib/config/printer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","ChainFormatter","Programmatic","Config","exports","Formatter","title","type","callerName","filepath","loc","index","envName","optionsAndDescriptors","opt","content","Object","assign","options","overrides","env","pluginDescriptors","plugins","length","map","d","descriptorToConfig","presetDescriptors","presets","JSON","stringify","undefined","_d$file","name","file","request","value","toString","slice","ConfigPrinter","constructor","_stack","configure","enabled","push","format","config","output","configs","gensync","all","s","join"],"sources":["../../src/config/printer.ts"],"sourcesContent":["import gensync from \"gensync\";\n\nimport type { Handler } from \"gensync\";\n\nimport type {\n OptionsAndDescriptors,\n UnloadedDescriptor,\n} from \"./config-descriptors\";\n\n// todo: Use flow enums when @babel/transform-flow-types supports it\nexport const ChainFormatter = {\n Programmatic: 0,\n Config: 1,\n};\n\ntype PrintableConfig = {\n content: OptionsAndDescriptors;\n type: (typeof ChainFormatter)[keyof typeof ChainFormatter];\n callerName: string | undefined | null;\n filepath: string | undefined | null;\n index: number | undefined | null;\n envName: string | undefined | null;\n};\n\nconst Formatter = {\n title(\n type: (typeof ChainFormatter)[keyof typeof ChainFormatter],\n callerName?: string | null,\n filepath?: string | null,\n ): string {\n let title = \"\";\n if (type === ChainFormatter.Programmatic) {\n title = \"programmatic options\";\n if (callerName) {\n title += \" from \" + callerName;\n }\n } else {\n title = \"config \" + filepath;\n }\n return title;\n },\n loc(index?: number | null, envName?: string | null): string {\n let loc = \"\";\n if (index != null) {\n loc += `.overrides[${index}]`;\n }\n if (envName != null) {\n loc += `.env[\"${envName}\"]`;\n }\n return loc;\n },\n\n *optionsAndDescriptors(opt: OptionsAndDescriptors) {\n const content = { ...opt.options };\n // overrides and env will be printed as separated config items\n delete content.overrides;\n delete content.env;\n // resolve to descriptors\n const pluginDescriptors = [...(yield* opt.plugins())];\n if (pluginDescriptors.length) {\n content.plugins = pluginDescriptors.map(d => descriptorToConfig(d));\n }\n const presetDescriptors = [...(yield* opt.presets())];\n if (presetDescriptors.length) {\n content.presets = [...presetDescriptors].map(d => descriptorToConfig(d));\n }\n return JSON.stringify(content, undefined, 2);\n },\n};\n\nfunction descriptorToConfig(\n d: UnloadedDescriptor,\n): string | {} | Array {\n let name = d.file?.request;\n if (name == null) {\n if (typeof d.value === \"object\") {\n name = d.value;\n } else if (typeof d.value === \"function\") {\n // If the unloaded descriptor is a function, i.e. `plugins: [ require(\"my-plugin\") ]`,\n // we print the first 50 characters of the function source code and hopefully we can see\n // `name: 'my-plugin'` in the source\n name = `[Function: ${d.value.toString().slice(0, 50)} ... ]`;\n }\n }\n if (name == null) {\n name = \"[Unknown]\";\n }\n if (d.options === undefined) {\n return name;\n } else if (d.name == null) {\n return [name, d.options];\n } else {\n return [name, d.options, d.name];\n }\n}\n\nexport class ConfigPrinter {\n _stack: Array = [];\n configure(\n enabled: boolean,\n type: (typeof ChainFormatter)[keyof typeof ChainFormatter],\n {\n callerName,\n filepath,\n }: {\n callerName?: string;\n filepath?: string;\n },\n ) {\n if (!enabled) return () => {};\n return (\n content: OptionsAndDescriptors,\n index?: number | null,\n envName?: string | null,\n ) => {\n this._stack.push({\n type,\n callerName,\n filepath,\n content,\n index,\n envName,\n });\n };\n }\n static *format(config: PrintableConfig): Handler {\n let title = Formatter.title(\n config.type,\n config.callerName,\n config.filepath,\n );\n const loc = Formatter.loc(config.index, config.envName);\n if (loc) title += ` ${loc}`;\n const content = yield* Formatter.optionsAndDescriptors(config.content);\n return `${title}\\n${content}`;\n }\n\n *output(): Handler {\n if (this._stack.length === 0) return \"\";\n const configs = yield* gensync.all(\n this._stack.map(s => ConfigPrinter.format(s)),\n );\n return configs.join(\"\\n\\n\");\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUO,MAAME,cAAc,GAAG;EAC5BC,YAAY,EAAE,CAAC;EACfC,MAAM,EAAE;AACV,CAAC;AAACC,OAAA,CAAAH,cAAA,GAAAA,cAAA;AAWF,MAAMI,SAAS,GAAG;EAChBC,KAAKA,CACHC,IAA0D,EAC1DC,UAA0B,EAC1BC,QAAwB,EAChB;IACR,IAAIH,KAAK,GAAG,EAAE;IACd,IAAIC,IAAI,KAAKN,cAAc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;QACLC;MACF,CAAC,CAAC;IACJ,CAAC;EACH;EACA,QAAQiC,MAAMA,CAACC,MAAuB,EAAmB;IACvD,IAAIxC,KAAK,GAAGD,SAAS,CAACC,KAAK,CACzBwC,MAAM,CAACvC,IAAI,EACXuC,MAAM,CAACtC,UAAU,EACjBsC,MAAM,CAACrC,QAAQ,CAChB;IACD,MAAMC,GAAG,GAAGL,SAAS,CAACK,GAAG,CAACoC,MAAM,CAACnC,KAAK,EAAEmC,MAAM,CAAClC,OAAO,CAAC;IACvD,IAAIF,GAAG,EAAEJ,KAAK,IAAK,IAAGI,GAAI,EAAC;IAC3B,MAAMK,OAAO,GAAG,OAAOV,SAAS,CAACQ,qBAAqB,CAACiC,MAAM,CAAC/B,OAAO,CAAC;IACtE,OAAQ,GAAET,KAAM,KAAIS,OAAQ,EAAC;EAC/B;EAEA,CAACgC,MAAMA,CAAA,EAAoB;IACzB,IAAI,IAAI,CAACN,MAAM,CAAClB,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE;IACvC,MAAMyB,OAAO,GAAG,OAAOC,UAAO,CAACC,GAAG,CAChC,IAAI,CAACT,MAAM,CAACjB,GAAG,CAAC2B,CAAC,IAAIZ,aAAa,CAACM,MAAM,CAACM,CAAC,CAAC,CAAC,CAC9C;IACD,OAAOH,OAAO,CAACI,IAAI,CAAC,MAAM,CAAC;EAC7B;AACF;AAAChD,OAAA,CAAAmC,aAAA,GAAAA,aAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/resolve-targets-browser.js b/node_modules/@babel/core/lib/config/resolve-targets-browser.js deleted file mode 100644 index 3fdbd8826..000000000 --- a/node_modules/@babel/core/lib/config/resolve-targets-browser.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.resolveBrowserslistConfigFile = resolveBrowserslistConfigFile; -exports.resolveTargets = resolveTargets; -function _helperCompilationTargets() { - const data = require("@babel/helper-compilation-targets"); - _helperCompilationTargets = function () { - return data; - }; - return data; -} -function resolveBrowserslistConfigFile(browserslistConfigFile, configFilePath) { - return undefined; -} -function resolveTargets(options, root) { - const optTargets = options.targets; - let targets; - if (typeof optTargets === "string" || Array.isArray(optTargets)) { - targets = { - browsers: optTargets - }; - } else if (optTargets) { - if ("esmodules" in optTargets) { - targets = Object.assign({}, optTargets, { - esmodules: "intersect" - }); - } else { - targets = optTargets; - } - } - return (0, _helperCompilationTargets().default)(targets, { - ignoreBrowserslistConfig: true, - browserslistEnv: options.browserslistEnv - }); -} -0 && 0; - -//# sourceMappingURL=resolve-targets-browser.js.map diff --git a/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map b/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map deleted file mode 100644 index bbae8a204..000000000 --- a/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_helperCompilationTargets","data","require","resolveBrowserslistConfigFile","browserslistConfigFile","configFilePath","undefined","resolveTargets","options","root","optTargets","targets","Array","isArray","browsers","Object","assign","esmodules","getTargets","ignoreBrowserslistConfig","browserslistEnv"],"sources":["../../src/config/resolve-targets-browser.ts"],"sourcesContent":["import type { ValidatedOptions } from \"./validation/options\";\nimport getTargets, {\n type InputTargets,\n} from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nexport function resolveBrowserslistConfigFile(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n browserslistConfigFile: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n configFilePath: string,\n): string | void {\n return undefined;\n}\n\nexport function resolveTargets(\n options: ValidatedOptions,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n root: string,\n): Targets {\n const optTargets = options.targets;\n let targets: InputTargets;\n\n if (typeof optTargets === \"string\" || Array.isArray(optTargets)) {\n targets = { browsers: optTargets };\n } else if (optTargets) {\n if (\"esmodules\" in optTargets) {\n targets = { ...optTargets, esmodules: \"intersect\" };\n } else {\n // https://github.com/microsoft/TypeScript/issues/17002\n targets = optTargets as InputTargets;\n }\n }\n\n return getTargets(targets, {\n ignoreBrowserslistConfig: true,\n browserslistEnv: options.browserslistEnv,\n });\n}\n"],"mappings":";;;;;;;AACA,SAAAA,0BAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,yBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMO,SAASE,6BAA6BA,CAE3CC,sBAA8B,EAE9BC,cAAsB,EACP;EACf,OAAOC,SAAS;AAClB;AAEO,SAASC,cAAcA,CAC5BC,OAAyB,EAEzBC,IAAY,EACH;EACT,MAAMC,UAAU,GAAGF,OAAO,CAACG,OAAO;EAClC,IAAIA,OAAqB;EAEzB,IAAI,OAAOD,UAAU,KAAK,QAAQ,IAAIE,KAAK,CAACC,OAAO,CAACH,UAAU,CAAC,EAAE;IAC/DC,OAAO,GAAG;MAAEG,QAAQ,EAAEJ;IAAW,CAAC;EACpC,CAAC,MAAM,IAAIA,UAAU,EAAE;IACrB,IAAI,WAAW,IAAIA,UAAU,EAAE;MAC7BC,OAAO,GAAAI,MAAA,CAAAC,MAAA,KAAQN,UAAU;QAAEO,SAAS,EAAE;MAAW,EAAE;IACrD,CAAC,MAAM;MAELN,OAAO,GAAGD,UAA0B;IACtC;EACF;EAEA,OAAO,IAAAQ,mCAAU,EAACP,OAAO,EAAE;IACzBQ,wBAAwB,EAAE,IAAI;IAC9BC,eAAe,EAAEZ,OAAO,CAACY;EAC3B,CAAC,CAAC;AACJ;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/resolve-targets.js b/node_modules/@babel/core/lib/config/resolve-targets.js deleted file mode 100644 index 1fc539a77..000000000 --- a/node_modules/@babel/core/lib/config/resolve-targets.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.resolveBrowserslistConfigFile = resolveBrowserslistConfigFile; -exports.resolveTargets = resolveTargets; -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -function _helperCompilationTargets() { - const data = require("@babel/helper-compilation-targets"); - _helperCompilationTargets = function () { - return data; - }; - return data; -} -({}); -function resolveBrowserslistConfigFile(browserslistConfigFile, configFileDir) { - return _path().resolve(configFileDir, browserslistConfigFile); -} -function resolveTargets(options, root) { - const optTargets = options.targets; - let targets; - if (typeof optTargets === "string" || Array.isArray(optTargets)) { - targets = { - browsers: optTargets - }; - } else if (optTargets) { - if ("esmodules" in optTargets) { - targets = Object.assign({}, optTargets, { - esmodules: "intersect" - }); - } else { - targets = optTargets; - } - } - const { - browserslistConfigFile - } = options; - let configFile; - let ignoreBrowserslistConfig = false; - if (typeof browserslistConfigFile === "string") { - configFile = browserslistConfigFile; - } else { - ignoreBrowserslistConfig = browserslistConfigFile === false; - } - return (0, _helperCompilationTargets().default)(targets, { - ignoreBrowserslistConfig, - configFile, - configPath: root, - browserslistEnv: options.browserslistEnv - }); -} -0 && 0; - -//# sourceMappingURL=resolve-targets.js.map diff --git a/node_modules/@babel/core/lib/config/resolve-targets.js.map b/node_modules/@babel/core/lib/config/resolve-targets.js.map deleted file mode 100644 index d2dbd8421..000000000 --- a/node_modules/@babel/core/lib/config/resolve-targets.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_path","data","require","_helperCompilationTargets","resolveBrowserslistConfigFile","browserslistConfigFile","configFileDir","path","resolve","resolveTargets","options","root","optTargets","targets","Array","isArray","browsers","Object","assign","esmodules","configFile","ignoreBrowserslistConfig","getTargets","configPath","browserslistEnv"],"sources":["../../src/config/resolve-targets.ts"],"sourcesContent":["type browserType = typeof import(\"./resolve-targets-browser\");\ntype nodeType = typeof import(\"./resolve-targets\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of index-browser, since this file may be replaced at bundle time with index-browser.\n({}) as any as browserType as nodeType;\n\nimport type { ValidatedOptions } from \"./validation/options\";\nimport path from \"path\";\nimport getTargets, {\n type InputTargets,\n} from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nexport function resolveBrowserslistConfigFile(\n browserslistConfigFile: string,\n configFileDir: string,\n): string | undefined {\n return path.resolve(configFileDir, browserslistConfigFile);\n}\n\nexport function resolveTargets(\n options: ValidatedOptions,\n root: string,\n): Targets {\n const optTargets = options.targets;\n let targets: InputTargets;\n\n if (typeof optTargets === \"string\" || Array.isArray(optTargets)) {\n targets = { browsers: optTargets };\n } else if (optTargets) {\n if (\"esmodules\" in optTargets) {\n targets = { ...optTargets, esmodules: \"intersect\" };\n } else {\n // https://github.com/microsoft/TypeScript/issues/17002\n targets = optTargets as InputTargets;\n }\n }\n\n const { browserslistConfigFile } = options;\n let configFile;\n let ignoreBrowserslistConfig = false;\n if (typeof browserslistConfigFile === \"string\") {\n configFile = browserslistConfigFile;\n } else {\n ignoreBrowserslistConfig = browserslistConfigFile === false;\n }\n\n return getTargets(targets, {\n ignoreBrowserslistConfig,\n configFile,\n configPath: root,\n browserslistEnv: options.browserslistEnv,\n });\n}\n"],"mappings":";;;;;;;AAQA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,0BAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,yBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAJA,CAAC,CAAC,CAAC;AAUI,SAASG,6BAA6BA,CAC3CC,sBAA8B,EAC9BC,aAAqB,EACD;EACpB,OAAOC,OAAI,CAACC,OAAO,CAACF,aAAa,EAAED,sBAAsB,CAAC;AAC5D;AAEO,SAASI,cAAcA,CAC5BC,OAAyB,EACzBC,IAAY,EACH;EACT,MAAMC,UAAU,GAAGF,OAAO,CAACG,OAAO;EAClC,IAAIA,OAAqB;EAEzB,IAAI,OAAOD,UAAU,KAAK,QAAQ,IAAIE,KAAK,CAACC,OAAO,CAACH,UAAU,CAAC,EAAE;IAC/DC,OAAO,GAAG;MAAEG,QAAQ,EAAEJ;IAAW,CAAC;EACpC,CAAC,MAAM,IAAIA,UAAU,EAAE;IACrB,IAAI,WAAW,IAAIA,UAAU,EAAE;MAC7BC,OAAO,GAAAI,MAAA,CAAAC,MAAA,KAAQN,UAAU;QAAEO,SAAS,EAAE;MAAW,EAAE;IACrD,CAAC,MAAM;MAELN,OAAO,GAAGD,UAA0B;IACtC;EACF;EAEA,MAAM;IAAEP;EAAuB,CAAC,GAAGK,OAAO;EAC1C,IAAIU,UAAU;EACd,IAAIC,wBAAwB,GAAG,KAAK;EACpC,IAAI,OAAOhB,sBAAsB,KAAK,QAAQ,EAAE;IAC9Ce,UAAU,GAAGf,sBAAsB;EACrC,CAAC,MAAM;IACLgB,wBAAwB,GAAGhB,sBAAsB,KAAK,KAAK;EAC7D;EAEA,OAAO,IAAAiB,mCAAU,EAACT,OAAO,EAAE;IACzBQ,wBAAwB;IACxBD,UAAU;IACVG,UAAU,EAAEZ,IAAI;IAChBa,eAAe,EAAEd,OAAO,CAACc;EAC3B,CAAC,CAAC;AACJ;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/util.js b/node_modules/@babel/core/lib/config/util.js deleted file mode 100644 index 077f1af8c..000000000 --- a/node_modules/@babel/core/lib/config/util.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isIterableIterator = isIterableIterator; -exports.mergeOptions = mergeOptions; -function mergeOptions(target, source) { - for (const k of Object.keys(source)) { - if ((k === "parserOpts" || k === "generatorOpts" || k === "assumptions") && source[k]) { - const parserOpts = source[k]; - const targetObj = target[k] || (target[k] = {}); - mergeDefaultFields(targetObj, parserOpts); - } else { - const val = source[k]; - if (val !== undefined) target[k] = val; - } - } -} -function mergeDefaultFields(target, source) { - for (const k of Object.keys(source)) { - const val = source[k]; - if (val !== undefined) target[k] = val; - } -} -function isIterableIterator(value) { - return !!value && typeof value.next === "function" && typeof value[Symbol.iterator] === "function"; -} -0 && 0; - -//# sourceMappingURL=util.js.map diff --git a/node_modules/@babel/core/lib/config/util.js.map b/node_modules/@babel/core/lib/config/util.js.map deleted file mode 100644 index 63ffa1954..000000000 --- a/node_modules/@babel/core/lib/config/util.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["mergeOptions","target","source","k","Object","keys","parserOpts","targetObj","mergeDefaultFields","val","undefined","isIterableIterator","value","next","Symbol","iterator"],"sources":["../../src/config/util.ts"],"sourcesContent":["import type { ValidatedOptions, NormalizedOptions } from \"./validation/options\";\n\nexport function mergeOptions(\n target: ValidatedOptions,\n source: ValidatedOptions | NormalizedOptions,\n): void {\n for (const k of Object.keys(source)) {\n if (\n (k === \"parserOpts\" || k === \"generatorOpts\" || k === \"assumptions\") &&\n source[k]\n ) {\n const parserOpts = source[k];\n const targetObj = target[k] || (target[k] = {});\n mergeDefaultFields(targetObj, parserOpts);\n } else {\n //@ts-expect-error k must index source\n const val = source[k];\n //@ts-expect-error assigning source to target\n if (val !== undefined) target[k] = val as any;\n }\n }\n}\n\nfunction mergeDefaultFields(target: T, source: T) {\n for (const k of Object.keys(source) as (keyof T)[]) {\n const val = source[k];\n if (val !== undefined) target[k] = val;\n }\n}\n\nexport function isIterableIterator(value: any): value is IterableIterator {\n return (\n !!value &&\n typeof value.next === \"function\" &&\n typeof value[Symbol.iterator] === \"function\"\n );\n}\n"],"mappings":";;;;;;;AAEO,SAASA,YAAYA,CAC1BC,MAAwB,EACxBC,MAA4C,EACtC;EACN,KAAK,MAAMC,CAAC,IAAIC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC,EAAE;IACnC,IACE,CAACC,CAAC,KAAK,YAAY,IAAIA,CAAC,KAAK,eAAe,IAAIA,CAAC,KAAK,aAAa,KACnED,MAAM,CAACC,CAAC,CAAC,EACT;MACA,MAAMG,UAAU,GAAGJ,MAAM,CAACC,CAAC,CAAC;MAC5B,MAAMI,SAAS,GAAGN,MAAM,CAACE,CAAC,CAAC,KAAKF,MAAM,CAACE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;MAC/CK,kBAAkB,CAACD,SAAS,EAAED,UAAU,CAAC;IAC3C,CAAC,MAAM;MAEL,MAAMG,GAAG,GAAGP,MAAM,CAACC,CAAC,CAAC;MAErB,IAAIM,GAAG,KAAKC,SAAS,EAAET,MAAM,CAACE,CAAC,CAAC,GAAGM,GAAU;IAC/C;EACF;AACF;AAEA,SAASD,kBAAkBA,CAAeP,MAAS,EAAEC,MAAS,EAAE;EAC9D,KAAK,MAAMC,CAAC,IAAIC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC,EAAiB;IAClD,MAAMO,GAAG,GAAGP,MAAM,CAACC,CAAC,CAAC;IACrB,IAAIM,GAAG,KAAKC,SAAS,EAAET,MAAM,CAACE,CAAC,CAAC,GAAGM,GAAG;EACxC;AACF;AAEO,SAASE,kBAAkBA,CAACC,KAAU,EAAkC;EAC7E,OACE,CAAC,CAACA,KAAK,IACP,OAAOA,KAAK,CAACC,IAAI,KAAK,UAAU,IAChC,OAAOD,KAAK,CAACE,MAAM,CAACC,QAAQ,CAAC,KAAK,UAAU;AAEhD;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/validation/option-assertions.js b/node_modules/@babel/core/lib/config/validation/option-assertions.js deleted file mode 100644 index 684cddeca..000000000 --- a/node_modules/@babel/core/lib/config/validation/option-assertions.js +++ /dev/null @@ -1,279 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.access = access; -exports.assertArray = assertArray; -exports.assertAssumptions = assertAssumptions; -exports.assertBabelrcSearch = assertBabelrcSearch; -exports.assertBoolean = assertBoolean; -exports.assertCallerMetadata = assertCallerMetadata; -exports.assertCompact = assertCompact; -exports.assertConfigApplicableTest = assertConfigApplicableTest; -exports.assertConfigFileSearch = assertConfigFileSearch; -exports.assertFunction = assertFunction; -exports.assertIgnoreList = assertIgnoreList; -exports.assertInputSourceMap = assertInputSourceMap; -exports.assertObject = assertObject; -exports.assertPluginList = assertPluginList; -exports.assertRootMode = assertRootMode; -exports.assertSourceMaps = assertSourceMaps; -exports.assertSourceType = assertSourceType; -exports.assertString = assertString; -exports.assertTargets = assertTargets; -exports.msg = msg; -function _helperCompilationTargets() { - const data = require("@babel/helper-compilation-targets"); - _helperCompilationTargets = function () { - return data; - }; - return data; -} -var _options = require("./options"); -function msg(loc) { - switch (loc.type) { - case "root": - return ``; - case "env": - return `${msg(loc.parent)}.env["${loc.name}"]`; - case "overrides": - return `${msg(loc.parent)}.overrides[${loc.index}]`; - case "option": - return `${msg(loc.parent)}.${loc.name}`; - case "access": - return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`; - default: - throw new Error(`Assertion failure: Unknown type ${loc.type}`); - } -} -function access(loc, name) { - return { - type: "access", - name, - parent: loc - }; -} -function assertRootMode(loc, value) { - if (value !== undefined && value !== "root" && value !== "upward" && value !== "upward-optional") { - throw new Error(`${msg(loc)} must be a "root", "upward", "upward-optional" or undefined`); - } - return value; -} -function assertSourceMaps(loc, value) { - if (value !== undefined && typeof value !== "boolean" && value !== "inline" && value !== "both") { - throw new Error(`${msg(loc)} must be a boolean, "inline", "both", or undefined`); - } - return value; -} -function assertCompact(loc, value) { - if (value !== undefined && typeof value !== "boolean" && value !== "auto") { - throw new Error(`${msg(loc)} must be a boolean, "auto", or undefined`); - } - return value; -} -function assertSourceType(loc, value) { - if (value !== undefined && value !== "module" && value !== "script" && value !== "unambiguous") { - throw new Error(`${msg(loc)} must be "module", "script", "unambiguous", or undefined`); - } - return value; -} -function assertCallerMetadata(loc, value) { - const obj = assertObject(loc, value); - if (obj) { - if (typeof obj.name !== "string") { - throw new Error(`${msg(loc)} set but does not contain "name" property string`); - } - for (const prop of Object.keys(obj)) { - const propLoc = access(loc, prop); - const value = obj[prop]; - if (value != null && typeof value !== "boolean" && typeof value !== "string" && typeof value !== "number") { - throw new Error(`${msg(propLoc)} must be null, undefined, a boolean, a string, or a number.`); - } - } - } - return value; -} -function assertInputSourceMap(loc, value) { - if (value !== undefined && typeof value !== "boolean" && (typeof value !== "object" || !value)) { - throw new Error(`${msg(loc)} must be a boolean, object, or undefined`); - } - return value; -} -function assertString(loc, value) { - if (value !== undefined && typeof value !== "string") { - throw new Error(`${msg(loc)} must be a string, or undefined`); - } - return value; -} -function assertFunction(loc, value) { - if (value !== undefined && typeof value !== "function") { - throw new Error(`${msg(loc)} must be a function, or undefined`); - } - return value; -} -function assertBoolean(loc, value) { - if (value !== undefined && typeof value !== "boolean") { - throw new Error(`${msg(loc)} must be a boolean, or undefined`); - } - return value; -} -function assertObject(loc, value) { - if (value !== undefined && (typeof value !== "object" || Array.isArray(value) || !value)) { - throw new Error(`${msg(loc)} must be an object, or undefined`); - } - return value; -} -function assertArray(loc, value) { - if (value != null && !Array.isArray(value)) { - throw new Error(`${msg(loc)} must be an array, or undefined`); - } - return value; -} -function assertIgnoreList(loc, value) { - const arr = assertArray(loc, value); - if (arr) { - arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item)); - } - return arr; -} -function assertIgnoreItem(loc, value) { - if (typeof value !== "string" && typeof value !== "function" && !(value instanceof RegExp)) { - throw new Error(`${msg(loc)} must be an array of string/Function/RegExp values, or undefined`); - } - return value; -} -function assertConfigApplicableTest(loc, value) { - if (value === undefined) { - return value; - } - if (Array.isArray(value)) { - value.forEach((item, i) => { - if (!checkValidTest(item)) { - throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`); - } - }); - } else if (!checkValidTest(value)) { - throw new Error(`${msg(loc)} must be a string/Function/RegExp, or an array of those`); - } - return value; -} -function checkValidTest(value) { - return typeof value === "string" || typeof value === "function" || value instanceof RegExp; -} -function assertConfigFileSearch(loc, value) { - if (value !== undefined && typeof value !== "boolean" && typeof value !== "string") { - throw new Error(`${msg(loc)} must be a undefined, a boolean, a string, ` + `got ${JSON.stringify(value)}`); - } - return value; -} -function assertBabelrcSearch(loc, value) { - if (value === undefined || typeof value === "boolean") { - return value; - } - if (Array.isArray(value)) { - value.forEach((item, i) => { - if (!checkValidTest(item)) { - throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`); - } - }); - } else if (!checkValidTest(value)) { - throw new Error(`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` + `or an array of those, got ${JSON.stringify(value)}`); - } - return value; -} -function assertPluginList(loc, value) { - const arr = assertArray(loc, value); - if (arr) { - arr.forEach((item, i) => assertPluginItem(access(loc, i), item)); - } - return arr; -} -function assertPluginItem(loc, value) { - if (Array.isArray(value)) { - if (value.length === 0) { - throw new Error(`${msg(loc)} must include an object`); - } - if (value.length > 3) { - throw new Error(`${msg(loc)} may only be a two-tuple or three-tuple`); - } - assertPluginTarget(access(loc, 0), value[0]); - if (value.length > 1) { - const opts = value[1]; - if (opts !== undefined && opts !== false && (typeof opts !== "object" || Array.isArray(opts) || opts === null)) { - throw new Error(`${msg(access(loc, 1))} must be an object, false, or undefined`); - } - } - if (value.length === 3) { - const name = value[2]; - if (name !== undefined && typeof name !== "string") { - throw new Error(`${msg(access(loc, 2))} must be a string, or undefined`); - } - } - } else { - assertPluginTarget(loc, value); - } - return value; -} -function assertPluginTarget(loc, value) { - if ((typeof value !== "object" || !value) && typeof value !== "string" && typeof value !== "function") { - throw new Error(`${msg(loc)} must be a string, object, function`); - } - return value; -} -function assertTargets(loc, value) { - if ((0, _helperCompilationTargets().isBrowsersQueryValid)(value)) return value; - if (typeof value !== "object" || !value || Array.isArray(value)) { - throw new Error(`${msg(loc)} must be a string, an array of strings or an object`); - } - const browsersLoc = access(loc, "browsers"); - const esmodulesLoc = access(loc, "esmodules"); - assertBrowsersList(browsersLoc, value.browsers); - assertBoolean(esmodulesLoc, value.esmodules); - for (const key of Object.keys(value)) { - const val = value[key]; - const subLoc = access(loc, key); - if (key === "esmodules") assertBoolean(subLoc, val);else if (key === "browsers") assertBrowsersList(subLoc, val);else if (!Object.hasOwnProperty.call(_helperCompilationTargets().TargetNames, key)) { - const validTargets = Object.keys(_helperCompilationTargets().TargetNames).join(", "); - throw new Error(`${msg(subLoc)} is not a valid target. Supported targets are ${validTargets}`); - } else assertBrowserVersion(subLoc, val); - } - return value; -} -function assertBrowsersList(loc, value) { - if (value !== undefined && !(0, _helperCompilationTargets().isBrowsersQueryValid)(value)) { - throw new Error(`${msg(loc)} must be undefined, a string or an array of strings`); - } -} -function assertBrowserVersion(loc, value) { - if (typeof value === "number" && Math.round(value) === value) return; - if (typeof value === "string") return; - throw new Error(`${msg(loc)} must be a string or an integer number`); -} -function assertAssumptions(loc, value) { - if (value === undefined) return; - if (typeof value !== "object" || value === null) { - throw new Error(`${msg(loc)} must be an object or undefined.`); - } - let root = loc; - do { - root = root.parent; - } while (root.type !== "root"); - const inPreset = root.source === "preset"; - for (const name of Object.keys(value)) { - const subLoc = access(loc, name); - if (!_options.assumptionsNames.has(name)) { - throw new Error(`${msg(subLoc)} is not a supported assumption.`); - } - if (typeof value[name] !== "boolean") { - throw new Error(`${msg(subLoc)} must be a boolean.`); - } - if (inPreset && value[name] === false) { - throw new Error(`${msg(subLoc)} cannot be set to 'false' inside presets.`); - } - } - return value; -} -0 && 0; - -//# sourceMappingURL=option-assertions.js.map diff --git a/node_modules/@babel/core/lib/config/validation/option-assertions.js.map b/node_modules/@babel/core/lib/config/validation/option-assertions.js.map deleted file mode 100644 index d86f0025b..000000000 --- a/node_modules/@babel/core/lib/config/validation/option-assertions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_helperCompilationTargets","data","require","_options","msg","loc","type","parent","name","index","JSON","stringify","Error","access","assertRootMode","value","undefined","assertSourceMaps","assertCompact","assertSourceType","assertCallerMetadata","obj","assertObject","prop","Object","keys","propLoc","assertInputSourceMap","assertString","assertFunction","assertBoolean","Array","isArray","assertArray","assertIgnoreList","arr","forEach","item","i","assertIgnoreItem","RegExp","assertConfigApplicableTest","checkValidTest","assertConfigFileSearch","assertBabelrcSearch","assertPluginList","assertPluginItem","length","assertPluginTarget","opts","assertTargets","isBrowsersQueryValid","browsersLoc","esmodulesLoc","assertBrowsersList","browsers","esmodules","key","val","subLoc","hasOwnProperty","call","TargetNames","validTargets","join","assertBrowserVersion","Math","round","assertAssumptions","root","inPreset","source","assumptionsNames","has"],"sources":["../../../src/config/validation/option-assertions.ts"],"sourcesContent":["import {\n isBrowsersQueryValid,\n TargetNames,\n} from \"@babel/helper-compilation-targets\";\n\nimport type {\n ConfigFileSearch,\n BabelrcSearch,\n IgnoreList,\n IgnoreItem,\n PluginList,\n PluginItem,\n PluginTarget,\n ConfigApplicableTest,\n SourceMapsOption,\n SourceTypeOption,\n CompactOption,\n RootInputSourceMapOption,\n NestingPath,\n CallerMetadata,\n RootMode,\n TargetsListOrObject,\n AssumptionName,\n} from \"./options\";\n\nimport { assumptionsNames } from \"./options\";\n\nexport type { RootPath } from \"./options\";\n\nexport type ValidatorSet = {\n [name: string]: Validator;\n};\n\nexport type Validator = (loc: OptionPath, value: unknown) => T;\n\nexport function msg(loc: NestingPath | GeneralPath): string {\n switch (loc.type) {\n case \"root\":\n return ``;\n case \"env\":\n return `${msg(loc.parent)}.env[\"${loc.name}\"]`;\n case \"overrides\":\n return `${msg(loc.parent)}.overrides[${loc.index}]`;\n case \"option\":\n return `${msg(loc.parent)}.${loc.name}`;\n case \"access\":\n return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`;\n default:\n // @ts-expect-error should not happen when code is type checked\n throw new Error(`Assertion failure: Unknown type ${loc.type}`);\n }\n}\n\nexport function access(loc: GeneralPath, name: string | number): AccessPath {\n return {\n type: \"access\",\n name,\n parent: loc,\n };\n}\n\nexport type OptionPath = Readonly<{\n type: \"option\";\n name: string;\n parent: NestingPath;\n}>;\ntype AccessPath = Readonly<{\n type: \"access\";\n name: string | number;\n parent: GeneralPath;\n}>;\ntype GeneralPath = OptionPath | AccessPath;\n\nexport function assertRootMode(\n loc: OptionPath,\n value: unknown,\n): RootMode | void {\n if (\n value !== undefined &&\n value !== \"root\" &&\n value !== \"upward\" &&\n value !== \"upward-optional\"\n ) {\n throw new Error(\n `${msg(loc)} must be a \"root\", \"upward\", \"upward-optional\" or undefined`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertSourceMaps(\n loc: OptionPath,\n value: unknown,\n): SourceMapsOption | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n value !== \"inline\" &&\n value !== \"both\"\n ) {\n throw new Error(\n `${msg(loc)} must be a boolean, \"inline\", \"both\", or undefined`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertCompact(\n loc: OptionPath,\n value: unknown,\n): CompactOption | void {\n if (value !== undefined && typeof value !== \"boolean\" && value !== \"auto\") {\n throw new Error(`${msg(loc)} must be a boolean, \"auto\", or undefined`);\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertSourceType(\n loc: OptionPath,\n value: unknown,\n): SourceTypeOption | void {\n if (\n value !== undefined &&\n value !== \"module\" &&\n value !== \"script\" &&\n value !== \"unambiguous\"\n ) {\n throw new Error(\n `${msg(loc)} must be \"module\", \"script\", \"unambiguous\", or undefined`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertCallerMetadata(\n loc: OptionPath,\n value: unknown,\n): CallerMetadata | undefined {\n const obj = assertObject(loc, value);\n if (obj) {\n if (typeof obj.name !== \"string\") {\n throw new Error(\n `${msg(loc)} set but does not contain \"name\" property string`,\n );\n }\n\n for (const prop of Object.keys(obj)) {\n const propLoc = access(loc, prop);\n const value = obj[prop];\n if (\n value != null &&\n typeof value !== \"boolean\" &&\n typeof value !== \"string\" &&\n typeof value !== \"number\"\n ) {\n // NOTE(logan): I'm limiting the type here so that we can guarantee that\n // the \"caller\" value will serialize to JSON nicely. We can always\n // allow more complex structures later though.\n throw new Error(\n `${msg(\n propLoc,\n )} must be null, undefined, a boolean, a string, or a number.`,\n );\n }\n }\n }\n // @ts-expect-error todo(flow->ts)\n return value;\n}\n\nexport function assertInputSourceMap(\n loc: OptionPath,\n value: unknown,\n): RootInputSourceMapOption | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n (typeof value !== \"object\" || !value)\n ) {\n throw new Error(`${msg(loc)} must be a boolean, object, or undefined`);\n }\n return value;\n}\n\nexport function assertString(loc: GeneralPath, value: unknown): string | void {\n if (value !== undefined && typeof value !== \"string\") {\n throw new Error(`${msg(loc)} must be a string, or undefined`);\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertFunction(\n loc: GeneralPath,\n value: unknown,\n): Function | void {\n if (value !== undefined && typeof value !== \"function\") {\n throw new Error(`${msg(loc)} must be a function, or undefined`);\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertBoolean(\n loc: GeneralPath,\n value: unknown,\n): boolean | void {\n if (value !== undefined && typeof value !== \"boolean\") {\n throw new Error(`${msg(loc)} must be a boolean, or undefined`);\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertObject(\n loc: GeneralPath,\n value: unknown,\n): { readonly [key: string]: unknown } | void {\n if (\n value !== undefined &&\n (typeof value !== \"object\" || Array.isArray(value) || !value)\n ) {\n throw new Error(`${msg(loc)} must be an object, or undefined`);\n }\n // @ts-expect-error todo(flow->ts) value is still typed as unknown, also assert function typically should not return a value\n return value;\n}\n\nexport function assertArray(\n loc: GeneralPath,\n value: Array | undefined | null,\n): ReadonlyArray | undefined | null {\n if (value != null && !Array.isArray(value)) {\n throw new Error(`${msg(loc)} must be an array, or undefined`);\n }\n return value;\n}\n\nexport function assertIgnoreList(\n loc: OptionPath,\n value: unknown[] | undefined,\n): IgnoreList | void {\n const arr = assertArray(loc, value);\n if (arr) {\n arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item));\n }\n // @ts-expect-error todo(flow->ts)\n return arr;\n}\nfunction assertIgnoreItem(loc: GeneralPath, value: unknown): IgnoreItem {\n if (\n typeof value !== \"string\" &&\n typeof value !== \"function\" &&\n !(value instanceof RegExp)\n ) {\n throw new Error(\n `${msg(\n loc,\n )} must be an array of string/Function/RegExp values, or undefined`,\n );\n }\n return value as IgnoreItem;\n}\n\nexport function assertConfigApplicableTest(\n loc: OptionPath,\n value: unknown,\n): ConfigApplicableTest | void {\n if (value === undefined) {\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n }\n\n if (Array.isArray(value)) {\n value.forEach((item, i) => {\n if (!checkValidTest(item)) {\n throw new Error(\n `${msg(access(loc, i))} must be a string/Function/RegExp.`,\n );\n }\n });\n } else if (!checkValidTest(value)) {\n throw new Error(\n `${msg(loc)} must be a string/Function/RegExp, or an array of those`,\n );\n }\n return value as ConfigApplicableTest;\n}\n\nfunction checkValidTest(value: unknown): value is string | Function | RegExp {\n return (\n typeof value === \"string\" ||\n typeof value === \"function\" ||\n value instanceof RegExp\n );\n}\n\nexport function assertConfigFileSearch(\n loc: OptionPath,\n value: unknown,\n): ConfigFileSearch | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n typeof value !== \"string\"\n ) {\n throw new Error(\n `${msg(loc)} must be a undefined, a boolean, a string, ` +\n `got ${JSON.stringify(value)}`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertBabelrcSearch(\n loc: OptionPath,\n value: unknown,\n): BabelrcSearch | void {\n if (value === undefined || typeof value === \"boolean\") {\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n }\n\n if (Array.isArray(value)) {\n value.forEach((item, i) => {\n if (!checkValidTest(item)) {\n throw new Error(\n `${msg(access(loc, i))} must be a string/Function/RegExp.`,\n );\n }\n });\n } else if (!checkValidTest(value)) {\n throw new Error(\n `${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` +\n `or an array of those, got ${JSON.stringify(value as any)}`,\n );\n }\n return value as BabelrcSearch;\n}\n\nexport function assertPluginList(\n loc: OptionPath,\n value: unknown[] | null | undefined,\n): PluginList | void {\n const arr = assertArray(loc, value);\n if (arr) {\n // Loop instead of using `.map` in order to preserve object identity\n // for plugin array for use during config chain processing.\n arr.forEach((item, i) => assertPluginItem(access(loc, i), item));\n }\n return arr as any;\n}\nfunction assertPluginItem(loc: GeneralPath, value: unknown): PluginItem {\n if (Array.isArray(value)) {\n if (value.length === 0) {\n throw new Error(`${msg(loc)} must include an object`);\n }\n\n if (value.length > 3) {\n throw new Error(`${msg(loc)} may only be a two-tuple or three-tuple`);\n }\n\n assertPluginTarget(access(loc, 0), value[0]);\n\n if (value.length > 1) {\n const opts = value[1];\n if (\n opts !== undefined &&\n opts !== false &&\n (typeof opts !== \"object\" || Array.isArray(opts) || opts === null)\n ) {\n throw new Error(\n `${msg(access(loc, 1))} must be an object, false, or undefined`,\n );\n }\n }\n if (value.length === 3) {\n const name = value[2];\n if (name !== undefined && typeof name !== \"string\") {\n throw new Error(\n `${msg(access(loc, 2))} must be a string, or undefined`,\n );\n }\n }\n } else {\n assertPluginTarget(loc, value);\n }\n\n // @ts-expect-error todo(flow->ts)\n return value;\n}\nfunction assertPluginTarget(loc: GeneralPath, value: unknown): PluginTarget {\n if (\n (typeof value !== \"object\" || !value) &&\n typeof value !== \"string\" &&\n typeof value !== \"function\"\n ) {\n throw new Error(`${msg(loc)} must be a string, object, function`);\n }\n return value;\n}\n\nexport function assertTargets(\n loc: GeneralPath,\n value: any,\n): TargetsListOrObject {\n if (isBrowsersQueryValid(value)) return value;\n\n if (typeof value !== \"object\" || !value || Array.isArray(value)) {\n throw new Error(\n `${msg(loc)} must be a string, an array of strings or an object`,\n );\n }\n\n const browsersLoc = access(loc, \"browsers\");\n const esmodulesLoc = access(loc, \"esmodules\");\n\n assertBrowsersList(browsersLoc, value.browsers);\n assertBoolean(esmodulesLoc, value.esmodules);\n\n for (const key of Object.keys(value)) {\n const val = value[key];\n const subLoc = access(loc, key);\n\n if (key === \"esmodules\") assertBoolean(subLoc, val);\n else if (key === \"browsers\") assertBrowsersList(subLoc, val);\n else if (!Object.hasOwnProperty.call(TargetNames, key)) {\n const validTargets = Object.keys(TargetNames).join(\", \");\n throw new Error(\n `${msg(\n subLoc,\n )} is not a valid target. Supported targets are ${validTargets}`,\n );\n } else assertBrowserVersion(subLoc, val);\n }\n\n return value;\n}\n\nfunction assertBrowsersList(loc: GeneralPath, value: unknown) {\n if (value !== undefined && !isBrowsersQueryValid(value)) {\n throw new Error(\n `${msg(loc)} must be undefined, a string or an array of strings`,\n );\n }\n}\n\nfunction assertBrowserVersion(loc: GeneralPath, value: unknown) {\n if (typeof value === \"number\" && Math.round(value) === value) return;\n if (typeof value === \"string\") return;\n\n throw new Error(`${msg(loc)} must be a string or an integer number`);\n}\n\nexport function assertAssumptions(\n loc: GeneralPath,\n value: { [key: string]: unknown },\n): { [name: string]: boolean } | void {\n if (value === undefined) return;\n\n if (typeof value !== \"object\" || value === null) {\n throw new Error(`${msg(loc)} must be an object or undefined.`);\n }\n\n // todo(flow->ts): remove any\n let root: any = loc;\n do {\n root = root.parent;\n } while (root.type !== \"root\");\n const inPreset = root.source === \"preset\";\n\n for (const name of Object.keys(value)) {\n const subLoc = access(loc, name);\n if (!assumptionsNames.has(name as AssumptionName)) {\n throw new Error(`${msg(subLoc)} is not a supported assumption.`);\n }\n if (typeof value[name] !== \"boolean\") {\n throw new Error(`${msg(subLoc)} must be a boolean.`);\n }\n if (inPreset && value[name] === false) {\n throw new Error(\n `${msg(subLoc)} cannot be set to 'false' inside presets.`,\n );\n }\n }\n\n // @ts-expect-error todo(flow->ts)\n return value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA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,SAAS,EAAE;MACpC,MAAM,IAAII,KAAK,CAAE,GAAER,GAAG,CAACuD,MAAM,CAAE,qBAAoB,CAAC;IACtD;IACA,IAAIW,QAAQ,IAAIvD,KAAK,CAACP,IAAI,CAAC,KAAK,KAAK,EAAE;MACrC,MAAM,IAAII,KAAK,CACZ,GAAER,GAAG,CAACuD,MAAM,CAAE,2CAA0C,CAC1D;IACH;EACF;EAGA,OAAO5C,KAAK;AACd;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/validation/options.js b/node_modules/@babel/core/lib/config/validation/options.js deleted file mode 100644 index 1412de1e0..000000000 --- a/node_modules/@babel/core/lib/config/validation/options.js +++ /dev/null @@ -1,193 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.assumptionsNames = void 0; -exports.checkNoUnwrappedItemOptionPairs = checkNoUnwrappedItemOptionPairs; -exports.validate = validate; -var _removed = require("./removed"); -var _optionAssertions = require("./option-assertions"); -var _configError = require("../../errors/config-error"); -const ROOT_VALIDATORS = { - cwd: _optionAssertions.assertString, - root: _optionAssertions.assertString, - rootMode: _optionAssertions.assertRootMode, - configFile: _optionAssertions.assertConfigFileSearch, - caller: _optionAssertions.assertCallerMetadata, - filename: _optionAssertions.assertString, - filenameRelative: _optionAssertions.assertString, - code: _optionAssertions.assertBoolean, - ast: _optionAssertions.assertBoolean, - cloneInputAst: _optionAssertions.assertBoolean, - envName: _optionAssertions.assertString -}; -const BABELRC_VALIDATORS = { - babelrc: _optionAssertions.assertBoolean, - babelrcRoots: _optionAssertions.assertBabelrcSearch -}; -const NONPRESET_VALIDATORS = { - extends: _optionAssertions.assertString, - ignore: _optionAssertions.assertIgnoreList, - only: _optionAssertions.assertIgnoreList, - targets: _optionAssertions.assertTargets, - browserslistConfigFile: _optionAssertions.assertConfigFileSearch, - browserslistEnv: _optionAssertions.assertString -}; -const COMMON_VALIDATORS = { - inputSourceMap: _optionAssertions.assertInputSourceMap, - presets: _optionAssertions.assertPluginList, - plugins: _optionAssertions.assertPluginList, - passPerPreset: _optionAssertions.assertBoolean, - assumptions: _optionAssertions.assertAssumptions, - env: assertEnvSet, - overrides: assertOverridesList, - test: _optionAssertions.assertConfigApplicableTest, - include: _optionAssertions.assertConfigApplicableTest, - exclude: _optionAssertions.assertConfigApplicableTest, - retainLines: _optionAssertions.assertBoolean, - comments: _optionAssertions.assertBoolean, - shouldPrintComment: _optionAssertions.assertFunction, - compact: _optionAssertions.assertCompact, - minified: _optionAssertions.assertBoolean, - auxiliaryCommentBefore: _optionAssertions.assertString, - auxiliaryCommentAfter: _optionAssertions.assertString, - sourceType: _optionAssertions.assertSourceType, - wrapPluginVisitorMethod: _optionAssertions.assertFunction, - highlightCode: _optionAssertions.assertBoolean, - sourceMaps: _optionAssertions.assertSourceMaps, - sourceMap: _optionAssertions.assertSourceMaps, - sourceFileName: _optionAssertions.assertString, - sourceRoot: _optionAssertions.assertString, - parserOpts: _optionAssertions.assertObject, - generatorOpts: _optionAssertions.assertObject -}; -{ - Object.assign(COMMON_VALIDATORS, { - getModuleId: _optionAssertions.assertFunction, - moduleRoot: _optionAssertions.assertString, - moduleIds: _optionAssertions.assertBoolean, - moduleId: _optionAssertions.assertString - }); -} -const knownAssumptions = ["arrayLikeIsIterable", "constantReexports", "constantSuper", "enumerableModuleMeta", "ignoreFunctionLength", "ignoreToPrimitiveHint", "iterableIsArray", "mutableTemplateObject", "noClassCalls", "noDocumentAll", "noIncompleteNsImportDetection", "noNewArrows", "objectRestNoSymbols", "privateFieldsAsSymbols", "privateFieldsAsProperties", "pureGetters", "setClassMethods", "setComputedProperties", "setPublicClassFields", "setSpreadProperties", "skipForOfIteratorClosing", "superIsCallableConstructor"]; -const assumptionsNames = new Set(knownAssumptions); -exports.assumptionsNames = assumptionsNames; -function getSource(loc) { - return loc.type === "root" ? loc.source : getSource(loc.parent); -} -function validate(type, opts, filename) { - try { - return validateNested({ - type: "root", - source: type - }, opts); - } catch (error) { - const configError = new _configError.default(error.message, filename); - if (error.code) configError.code = error.code; - throw configError; - } -} -function validateNested(loc, opts) { - const type = getSource(loc); - assertNoDuplicateSourcemap(opts); - Object.keys(opts).forEach(key => { - const optLoc = { - type: "option", - name: key, - parent: loc - }; - if (type === "preset" && NONPRESET_VALIDATORS[key]) { - throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in preset options`); - } - if (type !== "arguments" && ROOT_VALIDATORS[key]) { - throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options`); - } - if (type !== "arguments" && type !== "configfile" && BABELRC_VALIDATORS[key]) { - if (type === "babelrcfile" || type === "extendsfile") { - throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in .babelrc or "extends"ed files, only in root programmatic options, ` + `or babel.config.js/config file options`); - } - throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options, or babel.config.js/config file options`); - } - const validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || BABELRC_VALIDATORS[key] || ROOT_VALIDATORS[key] || throwUnknownError; - validator(optLoc, opts[key]); - }); - return opts; -} -function throwUnknownError(loc) { - const key = loc.name; - if (_removed.default[key]) { - const { - message, - version = 5 - } = _removed.default[key]; - throw new Error(`Using removed Babel ${version} option: ${(0, _optionAssertions.msg)(loc)} - ${message}`); - } else { - const unknownOptErr = new Error(`Unknown option: ${(0, _optionAssertions.msg)(loc)}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`); - unknownOptErr.code = "BABEL_UNKNOWN_OPTION"; - throw unknownOptErr; - } -} -function has(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} -function assertNoDuplicateSourcemap(opts) { - if (has(opts, "sourceMap") && has(opts, "sourceMaps")) { - throw new Error(".sourceMap is an alias for .sourceMaps, cannot use both"); - } -} -function assertEnvSet(loc, value) { - if (loc.parent.type === "env") { - throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside of another .env block`); - } - const parent = loc.parent; - const obj = (0, _optionAssertions.assertObject)(loc, value); - if (obj) { - for (const envName of Object.keys(obj)) { - const env = (0, _optionAssertions.assertObject)((0, _optionAssertions.access)(loc, envName), obj[envName]); - if (!env) continue; - const envLoc = { - type: "env", - name: envName, - parent - }; - validateNested(envLoc, env); - } - } - return obj; -} -function assertOverridesList(loc, value) { - if (loc.parent.type === "env") { - throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .env block`); - } - if (loc.parent.type === "overrides") { - throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .overrides block`); - } - const parent = loc.parent; - const arr = (0, _optionAssertions.assertArray)(loc, value); - if (arr) { - for (const [index, item] of arr.entries()) { - const objLoc = (0, _optionAssertions.access)(loc, index); - const env = (0, _optionAssertions.assertObject)(objLoc, item); - if (!env) throw new Error(`${(0, _optionAssertions.msg)(objLoc)} must be an object`); - const overridesLoc = { - type: "overrides", - index, - parent - }; - validateNested(overridesLoc, env); - } - } - return arr; -} -function checkNoUnwrappedItemOptionPairs(items, index, type, e) { - if (index === 0) return; - const lastItem = items[index - 1]; - const thisItem = items[index]; - if (lastItem.file && lastItem.options === undefined && typeof thisItem.value === "object") { - e.message += `\n- Maybe you meant to use\n` + `"${type}s": [\n ["${lastItem.file.request}", ${JSON.stringify(thisItem.value, undefined, 2)}]\n]\n` + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`; - } -} -0 && 0; - -//# sourceMappingURL=options.js.map diff --git a/node_modules/@babel/core/lib/config/validation/options.js.map b/node_modules/@babel/core/lib/config/validation/options.js.map deleted file mode 100644 index 25087a8f6..000000000 --- a/node_modules/@babel/core/lib/config/validation/options.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_removed","require","_optionAssertions","_configError","ROOT_VALIDATORS","cwd","assertString","root","rootMode","assertRootMode","configFile","assertConfigFileSearch","caller","assertCallerMetadata","filename","filenameRelative","code","assertBoolean","ast","cloneInputAst","envName","BABELRC_VALIDATORS","babelrc","babelrcRoots","assertBabelrcSearch","NONPRESET_VALIDATORS","extends","ignore","assertIgnoreList","only","targets","assertTargets","browserslistConfigFile","browserslistEnv","COMMON_VALIDATORS","inputSourceMap","assertInputSourceMap","presets","assertPluginList","plugins","passPerPreset","assumptions","assertAssumptions","env","assertEnvSet","overrides","assertOverridesList","test","assertConfigApplicableTest","include","exclude","retainLines","comments","shouldPrintComment","assertFunction","compact","assertCompact","minified","auxiliaryCommentBefore","auxiliaryCommentAfter","sourceType","assertSourceType","wrapPluginVisitorMethod","highlightCode","sourceMaps","assertSourceMaps","sourceMap","sourceFileName","sourceRoot","parserOpts","assertObject","generatorOpts","Object","assign","getModuleId","moduleRoot","moduleIds","moduleId","knownAssumptions","assumptionsNames","Set","exports","getSource","loc","type","source","parent","validate","opts","validateNested","error","configError","ConfigError","message","assertNoDuplicateSourcemap","keys","forEach","key","optLoc","name","Error","msg","validator","throwUnknownError","removed","version","unknownOptErr","has","obj","prototype","hasOwnProperty","call","value","access","envLoc","arr","assertArray","index","item","entries","objLoc","overridesLoc","checkNoUnwrappedItemOptionPairs","items","e","lastItem","thisItem","file","options","undefined","request","JSON","stringify"],"sources":["../../../src/config/validation/options.ts"],"sourcesContent":["import type { InputTargets, Targets } from \"@babel/helper-compilation-targets\";\n\nimport type { ConfigItem } from \"../item\";\nimport type Plugin from \"../plugin\";\n\nimport removed from \"./removed\";\nimport {\n msg,\n access,\n assertString,\n assertBoolean,\n assertObject,\n assertArray,\n assertCallerMetadata,\n assertInputSourceMap,\n assertIgnoreList,\n assertPluginList,\n assertConfigApplicableTest,\n assertConfigFileSearch,\n assertBabelrcSearch,\n assertFunction,\n assertRootMode,\n assertSourceMaps,\n assertCompact,\n assertSourceType,\n assertTargets,\n assertAssumptions,\n} from \"./option-assertions\";\nimport type { ValidatorSet, Validator, OptionPath } from \"./option-assertions\";\nimport type { UnloadedDescriptor } from \"../config-descriptors\";\nimport type { ParserOptions } from \"@babel/parser\";\nimport type { GeneratorOptions } from \"@babel/generator\";\nimport ConfigError from \"../../errors/config-error\";\n\nconst ROOT_VALIDATORS: ValidatorSet = {\n cwd: assertString as Validator,\n root: assertString as Validator,\n rootMode: assertRootMode as Validator,\n configFile: assertConfigFileSearch as Validator<\n ValidatedOptions[\"configFile\"]\n >,\n\n caller: assertCallerMetadata as Validator,\n filename: assertString as Validator,\n filenameRelative: assertString as Validator<\n ValidatedOptions[\"filenameRelative\"]\n >,\n code: assertBoolean as Validator,\n ast: assertBoolean as Validator,\n\n cloneInputAst: assertBoolean as Validator,\n\n envName: assertString as Validator,\n};\n\nconst BABELRC_VALIDATORS: ValidatorSet = {\n babelrc: assertBoolean as Validator,\n babelrcRoots: assertBabelrcSearch as Validator<\n ValidatedOptions[\"babelrcRoots\"]\n >,\n};\n\nconst NONPRESET_VALIDATORS: ValidatorSet = {\n extends: assertString as Validator,\n ignore: assertIgnoreList as Validator,\n only: assertIgnoreList as Validator,\n\n targets: assertTargets as Validator,\n browserslistConfigFile: assertConfigFileSearch as Validator<\n ValidatedOptions[\"browserslistConfigFile\"]\n >,\n browserslistEnv: assertString as Validator<\n ValidatedOptions[\"browserslistEnv\"]\n >,\n};\n\nconst COMMON_VALIDATORS: ValidatorSet = {\n // TODO: Should 'inputSourceMap' be moved to be a root-only option?\n // We may want a boolean-only version to be a common option, with the\n // object only allowed as a root config argument.\n inputSourceMap: assertInputSourceMap as Validator<\n ValidatedOptions[\"inputSourceMap\"]\n >,\n presets: assertPluginList as Validator,\n plugins: assertPluginList as Validator,\n passPerPreset: assertBoolean as Validator,\n assumptions: assertAssumptions as Validator,\n\n env: assertEnvSet as Validator,\n overrides: assertOverridesList as Validator,\n\n // We could limit these to 'overrides' blocks, but it's not clear why we'd\n // bother, when the ability to limit a config to a specific set of files\n // is a fairly general useful feature.\n test: assertConfigApplicableTest as Validator,\n include: assertConfigApplicableTest as Validator,\n exclude: assertConfigApplicableTest as Validator,\n\n retainLines: assertBoolean as Validator,\n comments: assertBoolean as Validator,\n shouldPrintComment: assertFunction as Validator<\n ValidatedOptions[\"shouldPrintComment\"]\n >,\n compact: assertCompact as Validator,\n minified: assertBoolean as Validator,\n auxiliaryCommentBefore: assertString as Validator<\n ValidatedOptions[\"auxiliaryCommentBefore\"]\n >,\n auxiliaryCommentAfter: assertString as Validator<\n ValidatedOptions[\"auxiliaryCommentAfter\"]\n >,\n sourceType: assertSourceType as Validator,\n wrapPluginVisitorMethod: assertFunction as Validator<\n ValidatedOptions[\"wrapPluginVisitorMethod\"]\n >,\n highlightCode: assertBoolean as Validator,\n sourceMaps: assertSourceMaps as Validator,\n sourceMap: assertSourceMaps as Validator,\n sourceFileName: assertString as Validator,\n sourceRoot: assertString as Validator,\n parserOpts: assertObject as Validator,\n generatorOpts: assertObject as Validator,\n};\nif (!process.env.BABEL_8_BREAKING) {\n Object.assign(COMMON_VALIDATORS, {\n getModuleId: assertFunction,\n moduleRoot: assertString,\n moduleIds: assertBoolean,\n moduleId: assertString,\n });\n}\n\nexport type InputOptions = ValidatedOptions;\n\nexport type ValidatedOptions = {\n cwd?: string;\n filename?: string;\n filenameRelative?: string;\n babelrc?: boolean;\n babelrcRoots?: BabelrcSearch;\n configFile?: ConfigFileSearch;\n root?: string;\n rootMode?: RootMode;\n code?: boolean;\n ast?: boolean;\n cloneInputAst?: boolean;\n inputSourceMap?: RootInputSourceMapOption;\n envName?: string;\n caller?: CallerMetadata;\n extends?: string;\n env?: EnvSet;\n ignore?: IgnoreList;\n only?: IgnoreList;\n overrides?: OverridesList;\n // Generally verify if a given config object should be applied to the given file.\n test?: ConfigApplicableTest;\n include?: ConfigApplicableTest;\n exclude?: ConfigApplicableTest;\n presets?: PluginList;\n plugins?: PluginList;\n passPerPreset?: boolean;\n assumptions?: {\n [name: string]: boolean;\n };\n // browserslists-related options\n targets?: TargetsListOrObject;\n browserslistConfigFile?: ConfigFileSearch;\n browserslistEnv?: string;\n // Options for @babel/generator\n retainLines?: boolean;\n comments?: boolean;\n shouldPrintComment?: Function;\n compact?: CompactOption;\n minified?: boolean;\n auxiliaryCommentBefore?: string;\n auxiliaryCommentAfter?: string;\n // Parser\n sourceType?: SourceTypeOption;\n wrapPluginVisitorMethod?: Function;\n highlightCode?: boolean;\n // Sourcemap generation options.\n sourceMaps?: SourceMapsOption;\n sourceMap?: SourceMapsOption;\n sourceFileName?: string;\n sourceRoot?: string;\n // Deprecate top level parserOpts\n parserOpts?: ParserOptions;\n // Deprecate top level generatorOpts\n generatorOpts?: GeneratorOptions;\n};\n\nexport type NormalizedOptions = {\n readonly targets: Targets;\n} & Omit;\n\nexport type CallerMetadata = {\n // If 'caller' is specified, require that the name is given for debugging\n // messages.\n name: string;\n};\nexport type EnvSet = {\n [x: string]: T;\n};\nexport type IgnoreItem =\n | string\n | RegExp\n | ((\n path: string | undefined,\n context: { dirname: string; caller: CallerMetadata; envName: string },\n ) => unknown);\nexport type IgnoreList = ReadonlyArray;\n\nexport type PluginOptions = object | void | false;\nexport type PluginTarget = string | object | Function;\nexport type PluginItem =\n | ConfigItem\n | Plugin\n | PluginTarget\n | [PluginTarget, PluginOptions]\n | [PluginTarget, PluginOptions, string | void];\nexport type PluginList = ReadonlyArray;\n\nexport type OverridesList = Array;\nexport type ConfigApplicableTest = IgnoreItem | Array;\n\nexport type ConfigFileSearch = string | boolean;\nexport type BabelrcSearch = boolean | IgnoreItem | IgnoreList;\nexport type SourceMapsOption = boolean | \"inline\" | \"both\";\nexport type SourceTypeOption = \"module\" | \"script\" | \"unambiguous\";\nexport type CompactOption = boolean | \"auto\";\nexport type RootInputSourceMapOption = {} | boolean;\nexport type RootMode = \"root\" | \"upward\" | \"upward-optional\";\n\nexport type TargetsListOrObject =\n | Targets\n | InputTargets\n | InputTargets[\"browsers\"];\n\nexport type OptionsSource =\n | \"arguments\"\n | \"configfile\"\n | \"babelrcfile\"\n | \"extendsfile\"\n | \"preset\"\n | \"plugin\";\n\nexport type RootPath = Readonly<{\n type: \"root\";\n source: OptionsSource;\n}>;\n\ntype OverridesPath = Readonly<{\n type: \"overrides\";\n index: number;\n parent: RootPath;\n}>;\n\ntype EnvPath = Readonly<{\n type: \"env\";\n name: string;\n parent: RootPath | OverridesPath;\n}>;\n\nexport type NestingPath = RootPath | OverridesPath | EnvPath;\n\nconst knownAssumptions = [\n \"arrayLikeIsIterable\",\n \"constantReexports\",\n \"constantSuper\",\n \"enumerableModuleMeta\",\n \"ignoreFunctionLength\",\n \"ignoreToPrimitiveHint\",\n \"iterableIsArray\",\n \"mutableTemplateObject\",\n \"noClassCalls\",\n \"noDocumentAll\",\n \"noIncompleteNsImportDetection\",\n \"noNewArrows\",\n \"objectRestNoSymbols\",\n \"privateFieldsAsSymbols\",\n \"privateFieldsAsProperties\",\n \"pureGetters\",\n \"setClassMethods\",\n \"setComputedProperties\",\n \"setPublicClassFields\",\n \"setSpreadProperties\",\n \"skipForOfIteratorClosing\",\n \"superIsCallableConstructor\",\n] as const;\nexport type AssumptionName = (typeof knownAssumptions)[number];\nexport const assumptionsNames = new Set(knownAssumptions);\n\nfunction getSource(loc: NestingPath): OptionsSource {\n return loc.type === \"root\" ? loc.source : getSource(loc.parent);\n}\n\nexport function validate(\n type: OptionsSource,\n opts: {},\n filename?: string,\n): ValidatedOptions {\n try {\n return validateNested(\n {\n type: \"root\",\n source: type,\n },\n opts,\n );\n } catch (error) {\n const configError = new ConfigError(error.message, filename);\n // @ts-expect-error TODO: .code is not defined on ConfigError or Error\n if (error.code) configError.code = error.code;\n throw configError;\n }\n}\n\nfunction validateNested(loc: NestingPath, opts: { [key: string]: unknown }) {\n const type = getSource(loc);\n\n assertNoDuplicateSourcemap(opts);\n\n Object.keys(opts).forEach((key: string) => {\n const optLoc = {\n type: \"option\",\n name: key,\n parent: loc,\n } as const;\n\n if (type === \"preset\" && NONPRESET_VALIDATORS[key]) {\n throw new Error(`${msg(optLoc)} is not allowed in preset options`);\n }\n if (type !== \"arguments\" && ROOT_VALIDATORS[key]) {\n throw new Error(\n `${msg(optLoc)} is only allowed in root programmatic options`,\n );\n }\n if (\n type !== \"arguments\" &&\n type !== \"configfile\" &&\n BABELRC_VALIDATORS[key]\n ) {\n if (type === \"babelrcfile\" || type === \"extendsfile\") {\n throw new Error(\n `${msg(\n optLoc,\n )} is not allowed in .babelrc or \"extends\"ed files, only in root programmatic options, ` +\n `or babel.config.js/config file options`,\n );\n }\n\n throw new Error(\n `${msg(\n optLoc,\n )} is only allowed in root programmatic options, or babel.config.js/config file options`,\n );\n }\n\n const validator =\n COMMON_VALIDATORS[key] ||\n NONPRESET_VALIDATORS[key] ||\n BABELRC_VALIDATORS[key] ||\n ROOT_VALIDATORS[key] ||\n (throwUnknownError as Validator);\n\n validator(optLoc, opts[key]);\n });\n\n return opts;\n}\n\nfunction throwUnknownError(loc: OptionPath) {\n const key = loc.name;\n\n if (removed[key]) {\n const { message, version = 5 } = removed[key];\n\n throw new Error(\n `Using removed Babel ${version} option: ${msg(loc)} - ${message}`,\n );\n } else {\n // eslint-disable-next-line max-len\n const unknownOptErr = new Error(\n `Unknown option: ${msg(\n loc,\n )}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`,\n );\n // @ts-expect-error todo(flow->ts): consider creating something like BabelConfigError with code field in it\n unknownOptErr.code = \"BABEL_UNKNOWN_OPTION\";\n\n throw unknownOptErr;\n }\n}\n\nfunction has(obj: {}, key: string) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nfunction assertNoDuplicateSourcemap(opts: {}): void {\n if (has(opts, \"sourceMap\") && has(opts, \"sourceMaps\")) {\n throw new Error(\".sourceMap is an alias for .sourceMaps, cannot use both\");\n }\n}\n\nfunction assertEnvSet(\n loc: OptionPath,\n value: unknown,\n): void | EnvSet {\n if (loc.parent.type === \"env\") {\n throw new Error(`${msg(loc)} is not allowed inside of another .env block`);\n }\n const parent: RootPath | OverridesPath = loc.parent;\n\n const obj = assertObject(loc, value);\n if (obj) {\n // Validate but don't copy the .env object in order to preserve\n // object identity for use during config chain processing.\n for (const envName of Object.keys(obj)) {\n const env = assertObject(access(loc, envName), obj[envName]);\n if (!env) continue;\n\n const envLoc = {\n type: \"env\",\n name: envName,\n parent,\n } as const;\n validateNested(envLoc, env);\n }\n }\n return obj;\n}\n\nfunction assertOverridesList(\n loc: OptionPath,\n value: unknown[],\n): undefined | OverridesList {\n if (loc.parent.type === \"env\") {\n throw new Error(`${msg(loc)} is not allowed inside an .env block`);\n }\n if (loc.parent.type === \"overrides\") {\n throw new Error(`${msg(loc)} is not allowed inside an .overrides block`);\n }\n const parent: RootPath = loc.parent;\n\n const arr = assertArray(loc, value);\n if (arr) {\n for (const [index, item] of arr.entries()) {\n const objLoc = access(loc, index);\n const env = assertObject(objLoc, item);\n if (!env) throw new Error(`${msg(objLoc)} must be an object`);\n\n const overridesLoc = {\n type: \"overrides\",\n index,\n parent,\n } as const;\n validateNested(overridesLoc, env);\n }\n }\n return arr as OverridesList;\n}\n\nexport function checkNoUnwrappedItemOptionPairs(\n items: Array,\n index: number,\n type: \"plugin\" | \"preset\",\n e: Error,\n): void {\n if (index === 0) return;\n\n const lastItem = items[index - 1];\n const thisItem = items[index];\n\n if (\n lastItem.file &&\n lastItem.options === undefined &&\n typeof thisItem.value === \"object\"\n ) {\n e.message +=\n `\\n- Maybe you meant to use\\n` +\n `\"${type}s\": [\\n [\"${lastItem.file.request}\", ${JSON.stringify(\n thisItem.value,\n undefined,\n 2,\n )}]\\n]\\n` +\n `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;\n }\n}\n"],"mappings":";;;;;;;;AAKA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AA0BA,IAAAE,YAAA,GAAAF,OAAA;AAEA,MAAMG,eAA6B,GAAG;EACpCC,GAAG,EAAEC,8BAAkD;EACvDC,IAAI,EAAED,8BAAmD;EACzDE,QAAQ,EAAEC,gCAAyD;EACnEC,UAAU,EAAEC,wCAEX;EAEDC,MAAM,EAAEC,sCAA6D;EACrEC,QAAQ,EAAER,8BAAuD;EACjES,gBAAgB,EAAET,8BAEjB;EACDU,I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,EAAE,MAAM,IAAIyD,KAAK,CAAE,GAAE,IAAAC,qBAAG,EAACmB,MAAM,CAAE,oBAAmB,CAAC;MAE7D,MAAMC,YAAY,GAAG;QACnBrC,IAAI,EAAE,WAAW;QACjBiC,KAAK;QACL/B;MACF,CAAU;MACVG,cAAc,CAACgC,YAAY,EAAE9E,GAAG,CAAC;IACnC;EACF;EACA,OAAOwE,GAAG;AACZ;AAEO,SAASO,+BAA+BA,CAC7CC,KAAgC,EAChCN,KAAa,EACbjC,IAAyB,EACzBwC,CAAQ,EACF;EACN,IAAIP,KAAK,KAAK,CAAC,EAAE;EAEjB,MAAMQ,QAAQ,GAAGF,KAAK,CAACN,KAAK,GAAG,CAAC,CAAC;EACjC,MAAMS,QAAQ,GAAGH,KAAK,CAACN,KAAK,CAAC;EAE7B,IACEQ,QAAQ,CAACE,IAAI,IACbF,QAAQ,CAACG,OAAO,KAAKC,SAAS,IAC9B,OAAOH,QAAQ,CAACd,KAAK,KAAK,QAAQ,EAClC;IACAY,CAAC,CAAC/B,OAAO,IACN,8BAA6B,GAC7B,IAAGT,IAAK,cAAayC,QAAQ,CAACE,IAAI,CAACG,OAAQ,MAAKC,IAAI,CAACC,SAAS,CAC7DN,QAAQ,CAACd,KAAK,EACdiB,SAAS,EACT,CAAC,CACD,QAAO,GACR,iBAAgB7C,IAAK,gEAA+D;EACzF;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/validation/plugins.js b/node_modules/@babel/core/lib/config/validation/plugins.js deleted file mode 100644 index 6ea3a0dc0..000000000 --- a/node_modules/@babel/core/lib/config/validation/plugins.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.validatePluginObject = validatePluginObject; -var _optionAssertions = require("./option-assertions"); -const VALIDATORS = { - name: _optionAssertions.assertString, - manipulateOptions: _optionAssertions.assertFunction, - pre: _optionAssertions.assertFunction, - post: _optionAssertions.assertFunction, - inherits: _optionAssertions.assertFunction, - visitor: assertVisitorMap, - parserOverride: _optionAssertions.assertFunction, - generatorOverride: _optionAssertions.assertFunction -}; -function assertVisitorMap(loc, value) { - const obj = (0, _optionAssertions.assertObject)(loc, value); - if (obj) { - Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop])); - if (obj.enter || obj.exit) { - throw new Error(`${(0, _optionAssertions.msg)(loc)} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`); - } - } - return obj; -} -function assertVisitorHandler(key, value) { - if (value && typeof value === "object") { - Object.keys(value).forEach(handler => { - if (handler !== "enter" && handler !== "exit") { - throw new Error(`.visitor["${key}"] may only have .enter and/or .exit handlers.`); - } - }); - } else if (typeof value !== "function") { - throw new Error(`.visitor["${key}"] must be a function`); - } - return value; -} -function validatePluginObject(obj) { - const rootPath = { - type: "root", - source: "plugin" - }; - Object.keys(obj).forEach(key => { - const validator = VALIDATORS[key]; - if (validator) { - const optLoc = { - type: "option", - name: key, - parent: rootPath - }; - validator(optLoc, obj[key]); - } else { - const invalidPluginPropertyError = new Error(`.${key} is not a valid Plugin property`); - invalidPluginPropertyError.code = "BABEL_UNKNOWN_PLUGIN_PROPERTY"; - throw invalidPluginPropertyError; - } - }); - return obj; -} -0 && 0; - -//# sourceMappingURL=plugins.js.map diff --git a/node_modules/@babel/core/lib/config/validation/plugins.js.map b/node_modules/@babel/core/lib/config/validation/plugins.js.map deleted file mode 100644 index a76abc768..000000000 --- a/node_modules/@babel/core/lib/config/validation/plugins.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_optionAssertions","require","VALIDATORS","name","assertString","manipulateOptions","assertFunction","pre","post","inherits","visitor","assertVisitorMap","parserOverride","generatorOverride","loc","value","obj","assertObject","Object","keys","forEach","prop","assertVisitorHandler","enter","exit","Error","msg","key","handler","validatePluginObject","rootPath","type","source","validator","optLoc","parent","invalidPluginPropertyError","code"],"sources":["../../../src/config/validation/plugins.ts"],"sourcesContent":["import {\n assertString,\n assertFunction,\n assertObject,\n msg,\n} from \"./option-assertions\";\n\nimport type {\n ValidatorSet,\n Validator,\n OptionPath,\n RootPath,\n} from \"./option-assertions\";\nimport type { ParserOptions } from \"@babel/parser\";\nimport type { Visitor } from \"@babel/traverse\";\nimport type { ValidatedOptions } from \"./options\";\nimport type { File, PluginPass } from \"../../index\";\n\n// Note: The casts here are just meant to be static assertions to make sure\n// that the assertion functions actually assert that the value's type matches\n// the declared types.\nconst VALIDATORS: ValidatorSet = {\n name: assertString as Validator,\n manipulateOptions: assertFunction as Validator<\n PluginObject[\"manipulateOptions\"]\n >,\n pre: assertFunction as Validator,\n post: assertFunction as Validator,\n inherits: assertFunction as Validator,\n visitor: assertVisitorMap as Validator,\n\n parserOverride: assertFunction as Validator,\n generatorOverride: assertFunction as Validator<\n PluginObject[\"generatorOverride\"]\n >,\n};\n\nfunction assertVisitorMap(loc: OptionPath, value: unknown): Visitor {\n const obj = assertObject(loc, value);\n if (obj) {\n Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop]));\n\n if (obj.enter || obj.exit) {\n throw new Error(\n `${msg(\n loc,\n )} cannot contain catch-all \"enter\" or \"exit\" handlers. Please target individual nodes.`,\n );\n }\n }\n return obj as Visitor;\n}\n\nfunction assertVisitorHandler(\n key: string,\n value: unknown,\n): VisitorHandler | void {\n if (value && typeof value === \"object\") {\n Object.keys(value).forEach((handler: string) => {\n if (handler !== \"enter\" && handler !== \"exit\") {\n throw new Error(\n `.visitor[\"${key}\"] may only have .enter and/or .exit handlers.`,\n );\n }\n });\n } else if (typeof value !== \"function\") {\n throw new Error(`.visitor[\"${key}\"] must be a function`);\n }\n\n return value as any;\n}\n\ntype VisitorHandler =\n | Function\n | {\n enter?: Function;\n exit?: Function;\n };\n\nexport type PluginObject = {\n name?: string;\n manipulateOptions?: (\n options: ValidatedOptions,\n parserOpts: ParserOptions,\n ) => void;\n pre?: (this: S, file: File) => void;\n post?: (this: S, file: File) => void;\n inherits?: Function;\n visitor?: Visitor;\n parserOverride?: Function;\n generatorOverride?: Function;\n};\n\nexport function validatePluginObject(obj: {\n [key: string]: unknown;\n}): PluginObject {\n const rootPath: RootPath = {\n type: \"root\",\n source: \"plugin\",\n };\n Object.keys(obj).forEach((key: string) => {\n const validator = VALIDATORS[key];\n\n if (validator) {\n const optLoc: OptionPath = {\n type: \"option\",\n name: key,\n parent: rootPath,\n };\n validator(optLoc, obj[key]);\n } else {\n const invalidPluginPropertyError = new Error(\n `.${key} is not a valid Plugin property`,\n );\n // @ts-expect-error todo(flow->ts) consider adding BabelConfigError with code field\n invalidPluginPropertyError.code = \"BABEL_UNKNOWN_PLUGIN_PROPERTY\";\n throw invalidPluginPropertyError;\n }\n });\n\n return obj as any;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAqBA,MAAMC,UAAwB,GAAG;EAC/BC,IAAI,EAAEC,8BAA+C;EACrDC,iBAAiB,EAAEC,gCAElB;EACDC,GAAG,EAAED,gCAAgD;EACrDE,IAAI,EAAEF,gCAAiD;EACvDG,QAAQ,EAAEH,gCAAqD;EAC/DI,OAAO,EAAEC,gBAAsD;EAE/DC,cAAc,EAAEN,gCAA2D;EAC3EO,iBAAiB,EAAEP;AAGrB,CAAC;AAED,SAASK,gBAAgBA,CAACG,GAAe,EAAEC,KAAc,EAAW;EAClE,MAAMC,GAAG,GAAG,IAAAC,8BAAY,EAACH,GAAG,EAAEC,KAAK,CAAC;EACpC,IAAIC,GAAG,EAAE;IACPE,MAAM,CAACC,IAAI,CAACH,GAAG,CAAC,CAACI,OAAO,CAACC,IAAI,IAAIC,oBAAoB,CAACD,IAAI,EAAEL,GAAG,CAACK,IAAI,CAAC,CAAC,CAAC;IAEvE,IAAIL,GAAG,CAACO,KAAK,IAAIP,GAAG,CAACQ,IAAI,EAAE;MACzB,MAAM,IAAIC,KAAK,CACZ,GAAE,IAAAC,qBAAG,EACJZ,GAAG,CACH,uFAAsF,CACzF;IACH;EACF;EACA,OAAOE,GAAG;AACZ;AAEA,SAASM,oBAAoBA,CAC3BK,GAAW,EACXZ,KAAc,EACS;EACvB,IAAIA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACtCG,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,OAAO,CAAEQ,OAAe,IAAK;MAC9C,IAAIA,OAAO,KAAK,OAAO,IAAIA,OAAO,KAAK,MAAM,EAAE;QAC7C,MAAM,IAAIH,KAAK,CACZ,aAAYE,GAAI,gDAA+C,CACjE;MACH;IACF,CAAC,CAAC;EACJ,CAAC,MAAM,IAAI,OAAOZ,KAAK,KAAK,UAAU,EAAE;IACtC,MAAM,IAAIU,KAAK,CAAE,aAAYE,GAAI,uBAAsB,CAAC;EAC1D;EAEA,OAAOZ,KAAK;AACd;AAuBO,SAASc,oBAAoBA,CAACb,GAEpC,EAAgB;EACf,MAAMc,QAAkB,GAAG;IACzBC,IAAI,EAAE,MAAM;IACZC,MAAM,EAAE;EACV,CAAC;EACDd,MAAM,CAACC,IAAI,CAACH,GAAG,CAAC,CAACI,OAAO,CAAEO,GAAW,IAAK;IACxC,MAAMM,SAAS,GAAG/B,UAAU,CAACyB,GAAG,CAAC;IAEjC,IAAIM,SAAS,EAAE;MACb,MAAMC,MAAkB,GAAG;QACzBH,IAAI,EAAE,QAAQ;QACd5B,IAAI,EAAEwB,GAAG;QACTQ,MAAM,EAAEL;MACV,CAAC;MACDG,SAAS,CAACC,MAAM,EAAElB,GAAG,CAACW,GAAG,CAAC,CAAC;IAC7B,CAAC,MAAM;MACL,MAAMS,0BAA0B,GAAG,IAAIX,KAAK,CACzC,IAAGE,GAAI,iCAAgC,CACzC;MAEDS,0BAA0B,CAACC,IAAI,GAAG,+BAA+B;MACjE,MAAMD,0BAA0B;IAClC;EACF,CAAC,CAAC;EAEF,OAAOpB,GAAG;AACZ;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/validation/removed.js b/node_modules/@babel/core/lib/config/validation/removed.js deleted file mode 100644 index 57270ea93..000000000 --- a/node_modules/@babel/core/lib/config/validation/removed.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _default = { - auxiliaryComment: { - message: "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`" - }, - blacklist: { - message: "Put the specific transforms you want in the `plugins` option" - }, - breakConfig: { - message: "This is not a necessary option in Babel 6" - }, - experimental: { - message: "Put the specific transforms you want in the `plugins` option" - }, - externalHelpers: { - message: "Use the `external-helpers` plugin instead. " + "Check out http://babeljs.io/docs/plugins/external-helpers/" - }, - extra: { - message: "" - }, - jsxPragma: { - message: "use the `pragma` option in the `react-jsx` plugin. " + "Check out http://babeljs.io/docs/plugins/transform-react-jsx/" - }, - loose: { - message: "Specify the `loose` option for the relevant plugin you are using " + "or use a preset that sets the option." - }, - metadataUsedHelpers: { - message: "Not required anymore as this is enabled by default" - }, - modules: { - message: "Use the corresponding module transform plugin in the `plugins` option. " + "Check out http://babeljs.io/docs/plugins/#modules" - }, - nonStandard: { - message: "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. " + "Also check out the react preset http://babeljs.io/docs/plugins/preset-react/" - }, - optional: { - message: "Put the specific transforms you want in the `plugins` option" - }, - sourceMapName: { - message: "The `sourceMapName` option has been removed because it makes more sense for the " + "tooling that calls Babel to assign `map.file` themselves." - }, - stage: { - message: "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets" - }, - whitelist: { - message: "Put the specific transforms you want in the `plugins` option" - }, - resolveModuleSource: { - version: 6, - message: "Use `babel-plugin-module-resolver@3`'s 'resolvePath' options" - }, - metadata: { - version: 6, - message: "Generated plugin metadata is always included in the output result" - }, - sourceMapTarget: { - version: 6, - message: "The `sourceMapTarget` option has been removed because it makes more sense for the tooling " + "that calls Babel to assign `map.file` themselves." - } -}; -exports.default = _default; -0 && 0; - -//# sourceMappingURL=removed.js.map diff --git a/node_modules/@babel/core/lib/config/validation/removed.js.map b/node_modules/@babel/core/lib/config/validation/removed.js.map deleted file mode 100644 index 51bffd2e2..000000000 --- a/node_modules/@babel/core/lib/config/validation/removed.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["auxiliaryComment","message","blacklist","breakConfig","experimental","externalHelpers","extra","jsxPragma","loose","metadataUsedHelpers","modules","nonStandard","optional","sourceMapName","stage","whitelist","resolveModuleSource","version","metadata","sourceMapTarget","exports","default","_default"],"sources":["../../../src/config/validation/removed.ts"],"sourcesContent":["export default {\n auxiliaryComment: {\n message: \"Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`\",\n },\n blacklist: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n breakConfig: {\n message: \"This is not a necessary option in Babel 6\",\n },\n experimental: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n externalHelpers: {\n message:\n \"Use the `external-helpers` plugin instead. \" +\n \"Check out http://babeljs.io/docs/plugins/external-helpers/\",\n },\n extra: {\n message: \"\",\n },\n jsxPragma: {\n message:\n \"use the `pragma` option in the `react-jsx` plugin. \" +\n \"Check out http://babeljs.io/docs/plugins/transform-react-jsx/\",\n },\n loose: {\n message:\n \"Specify the `loose` option for the relevant plugin you are using \" +\n \"or use a preset that sets the option.\",\n },\n metadataUsedHelpers: {\n message: \"Not required anymore as this is enabled by default\",\n },\n modules: {\n message:\n \"Use the corresponding module transform plugin in the `plugins` option. \" +\n \"Check out http://babeljs.io/docs/plugins/#modules\",\n },\n nonStandard: {\n message:\n \"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. \" +\n \"Also check out the react preset http://babeljs.io/docs/plugins/preset-react/\",\n },\n optional: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n sourceMapName: {\n message:\n \"The `sourceMapName` option has been removed because it makes more sense for the \" +\n \"tooling that calls Babel to assign `map.file` themselves.\",\n },\n stage: {\n message:\n \"Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets\",\n },\n whitelist: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n\n resolveModuleSource: {\n version: 6,\n message: \"Use `babel-plugin-module-resolver@3`'s 'resolvePath' options\",\n },\n metadata: {\n version: 6,\n message:\n \"Generated plugin metadata is always included in the output result\",\n },\n sourceMapTarget: {\n version: 6,\n message:\n \"The `sourceMapTarget` option has been removed because it makes more sense for the tooling \" +\n \"that calls Babel to assign `map.file` themselves.\",\n },\n} as { [name: string]: { version?: number; message: string } };\n"],"mappings":";;;;;;eAAe;EACbA,gBAAgB,EAAE;IAChBC,OAAO,EAAE;EACX,CAAC;EACDC,SAAS,EAAE;IACTD,OAAO,EAAE;EACX,CAAC;EACDE,WAAW,EAAE;IACXF,OAAO,EAAE;EACX,CAAC;EACDG,YAAY,EAAE;IACZH,OAAO,EAAE;EACX,CAAC;EACDI,eAAe,EAAE;IACfJ,OAAO,EACL,6CAA6C,GAC7C;EACJ,CAAC;EACDK,KAAK,EAAE;IACLL,OAAO,EAAE;EACX,CAAC;EACDM,SAAS,EAAE;IACTN,OAAO,EACL,qDAAqD,GACrD;EACJ,CAAC;EACDO,KAAK,EAAE;IACLP,OAAO,EACL,mEAAmE,GACnE;EACJ,CAAC;EACDQ,mBAAmB,EAAE;IACnBR,OAAO,EAAE;EACX,CAAC;EACDS,OAAO,EAAE;IACPT,OAAO,EACL,yEAAyE,GACzE;EACJ,CAAC;EACDU,WAAW,EAAE;IACXV,OAAO,EACL,8EAA8E,GAC9E;EACJ,CAAC;EACDW,QAAQ,EAAE;IACRX,OAAO,EAAE;EACX,CAAC;EACDY,aAAa,EAAE;IACbZ,OAAO,EACL,kFAAkF,GAClF;EACJ,CAAC;EACDa,KAAK,EAAE;IACLb,OAAO,EACL;EACJ,CAAC;EACDc,SAAS,EAAE;IACTd,OAAO,EAAE;EACX,CAAC;EAEDe,mBAAmB,EAAE;IACnBC,OAAO,EAAE,CAAC;IACVhB,OAAO,EAAE;EACX,CAAC;EACDiB,QAAQ,EAAE;IACRD,OAAO,EAAE,CAAC;IACVhB,OAAO,EACL;EACJ,CAAC;EACDkB,eAAe,EAAE;IACfF,OAAO,EAAE,CAAC;IACVhB,OAAO,EACL,4FAA4F,GAC5F;EACJ;AACF,CAAC;AAAAmB,OAAA,CAAAC,OAAA,GAAAC,QAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/errors/config-error.js b/node_modules/@babel/core/lib/errors/config-error.js deleted file mode 100644 index 7390a06ab..000000000 --- a/node_modules/@babel/core/lib/errors/config-error.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _rewriteStackTrace = require("./rewrite-stack-trace"); -class ConfigError extends Error { - constructor(message, filename) { - super(message); - (0, _rewriteStackTrace.expectedError)(this); - if (filename) (0, _rewriteStackTrace.injectVirtualStackFrame)(this, filename); - } -} -exports.default = ConfigError; -0 && 0; - -//# sourceMappingURL=config-error.js.map diff --git a/node_modules/@babel/core/lib/errors/config-error.js.map b/node_modules/@babel/core/lib/errors/config-error.js.map deleted file mode 100644 index 5d32c4e82..000000000 --- a/node_modules/@babel/core/lib/errors/config-error.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_rewriteStackTrace","require","ConfigError","Error","constructor","message","filename","expectedError","injectVirtualStackFrame","exports","default"],"sources":["../../src/errors/config-error.ts"],"sourcesContent":["import { injectVirtualStackFrame, expectedError } from \"./rewrite-stack-trace\";\n\nexport default class ConfigError extends Error {\n constructor(message: string, filename?: string) {\n super(message);\n expectedError(this);\n if (filename) injectVirtualStackFrame(this, filename);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAEe,MAAMC,WAAW,SAASC,KAAK,CAAC;EAC7CC,WAAWA,CAACC,OAAe,EAAEC,QAAiB,EAAE;IAC9C,KAAK,CAACD,OAAO,CAAC;IACd,IAAAE,gCAAa,EAAC,IAAI,CAAC;IACnB,IAAID,QAAQ,EAAE,IAAAE,0CAAuB,EAAC,IAAI,EAAEF,QAAQ,CAAC;EACvD;AACF;AAACG,OAAA,CAAAC,OAAA,GAAAR,WAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js b/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js deleted file mode 100644 index 9b6ce01e8..000000000 --- a/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js +++ /dev/null @@ -1,97 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.beginHiddenCallStack = beginHiddenCallStack; -exports.endHiddenCallStack = endHiddenCallStack; -exports.expectedError = expectedError; -exports.injectVirtualStackFrame = injectVirtualStackFrame; -const ErrorToString = Function.call.bind(Error.prototype.toString); -const SUPPORTED = !!Error.captureStackTrace; -const START_HIDING = "startHiding - secret - don't use this - v1"; -const STOP_HIDING = "stopHiding - secret - don't use this - v1"; -const expectedErrors = new WeakSet(); -const virtualFrames = new WeakMap(); -function CallSite(filename) { - return Object.create({ - isNative: () => false, - isConstructor: () => false, - isToplevel: () => true, - getFileName: () => filename, - getLineNumber: () => undefined, - getColumnNumber: () => undefined, - getFunctionName: () => undefined, - getMethodName: () => undefined, - getTypeName: () => undefined, - toString: () => filename - }); -} -function injectVirtualStackFrame(error, filename) { - if (!SUPPORTED) return; - let frames = virtualFrames.get(error); - if (!frames) virtualFrames.set(error, frames = []); - frames.push(CallSite(filename)); - return error; -} -function expectedError(error) { - if (!SUPPORTED) return; - expectedErrors.add(error); - return error; -} -function beginHiddenCallStack(fn) { - if (!SUPPORTED) return fn; - return Object.defineProperty(function (...args) { - setupPrepareStackTrace(); - return fn(...args); - }, "name", { - value: STOP_HIDING - }); -} -function endHiddenCallStack(fn) { - if (!SUPPORTED) return fn; - return Object.defineProperty(function (...args) { - return fn(...args); - }, "name", { - value: START_HIDING - }); -} -function setupPrepareStackTrace() { - setupPrepareStackTrace = () => {}; - const { - prepareStackTrace = defaultPrepareStackTrace - } = Error; - const MIN_STACK_TRACE_LIMIT = 50; - Error.stackTraceLimit && (Error.stackTraceLimit = Math.max(Error.stackTraceLimit, MIN_STACK_TRACE_LIMIT)); - Error.prepareStackTrace = function stackTraceRewriter(err, trace) { - let newTrace = []; - const isExpected = expectedErrors.has(err); - let status = isExpected ? "hiding" : "unknown"; - for (let i = 0; i < trace.length; i++) { - const name = trace[i].getFunctionName(); - if (name === START_HIDING) { - status = "hiding"; - } else if (name === STOP_HIDING) { - if (status === "hiding") { - status = "showing"; - if (virtualFrames.has(err)) { - newTrace.unshift(...virtualFrames.get(err)); - } - } else if (status === "unknown") { - newTrace = trace; - break; - } - } else if (status !== "hiding") { - newTrace.push(trace[i]); - } - } - return prepareStackTrace(err, newTrace); - }; -} -function defaultPrepareStackTrace(err, trace) { - if (trace.length === 0) return ErrorToString(err); - return `${ErrorToString(err)}\n at ${trace.join("\n at ")}`; -} -0 && 0; - -//# sourceMappingURL=rewrite-stack-trace.js.map diff --git a/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map b/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map deleted file mode 100644 index fa8adaf9a..000000000 --- a/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["ErrorToString","Function","call","bind","Error","prototype","toString","SUPPORTED","captureStackTrace","START_HIDING","STOP_HIDING","expectedErrors","WeakSet","virtualFrames","WeakMap","CallSite","filename","Object","create","isNative","isConstructor","isToplevel","getFileName","getLineNumber","undefined","getColumnNumber","getFunctionName","getMethodName","getTypeName","injectVirtualStackFrame","error","frames","get","set","push","expectedError","add","beginHiddenCallStack","fn","defineProperty","args","setupPrepareStackTrace","value","endHiddenCallStack","prepareStackTrace","defaultPrepareStackTrace","MIN_STACK_TRACE_LIMIT","stackTraceLimit","Math","max","stackTraceRewriter","err","trace","newTrace","isExpected","has","status","i","length","name","unshift","join"],"sources":["../../src/errors/rewrite-stack-trace.ts"],"sourcesContent":["/**\n * This file uses the internal V8 Stack Trace API (https://v8.dev/docs/stack-trace-api)\n * to provide utilities to rewrite the stack trace.\n * When this API is not present, all the functions in this file become noops.\n *\n * beginHiddenCallStack(fn) and endHiddenCallStack(fn) wrap their parameter to\n * mark an hidden portion of the stack trace. The function passed to\n * beginHiddenCallStack is the first hidden function, while the function passed\n * to endHiddenCallStack is the first shown function.\n *\n * When an error is thrown _outside_ of the hidden zone, everything between\n * beginHiddenCallStack and endHiddenCallStack will not be shown.\n * If an error is thrown _inside_ the hidden zone, then the whole stack trace\n * will be visible: this is to avoid hiding real bugs.\n * However, if an error inside the hidden zone is expected, it can be marked\n * with the expectedError(error) function to keep the hidden frames hidden.\n *\n * Consider this call stack (the outer function is the bottom one):\n *\n * 1. a()\n * 2. endHiddenCallStack(b)()\n * 3. c()\n * 4. beginHiddenCallStack(d)()\n * 5. e()\n * 6. f()\n *\n * - If a() throws an error, then its shown call stack will be \"a, b, e, f\"\n * - If b() throws an error, then its shown call stack will be \"b, e, f\"\n * - If c() throws an expected error, then its shown call stack will be \"e, f\"\n * - If c() throws an unexpected error, then its shown call stack will be \"c, d, e, f\"\n * - If d() throws an expected error, then its shown call stack will be \"e, f\"\n * - If d() throws an unexpected error, then its shown call stack will be \"d, e, f\"\n * - If e() throws an error, then its shown call stack will be \"e, f\"\n *\n * Additionally, an error can inject additional \"virtual\" stack frames using the\n * injectVirtualStackFrame(error, filename) function: those are injected as a\n * replacement of the hidden frames.\n * In the example above, if we called injectVirtualStackFrame(err, \"h\") and\n * injectVirtualStackFrame(err, \"i\") on the expected error thrown by c(), its\n * shown call stack would have been \"h, i, e, f\".\n * This can be useful, for example, to report config validation errors as if they\n * were directly thrown in the config file.\n */\n\nconst ErrorToString = Function.call.bind(Error.prototype.toString);\n\nconst SUPPORTED = !!Error.captureStackTrace;\n\nconst START_HIDING = \"startHiding - secret - don't use this - v1\";\nconst STOP_HIDING = \"stopHiding - secret - don't use this - v1\";\n\ntype CallSite = Parameters[1][number];\n\nconst expectedErrors = new WeakSet();\nconst virtualFrames = new WeakMap();\n\nfunction CallSite(filename: string): CallSite {\n // We need to use a prototype otherwise it breaks source-map-support's internals\n return Object.create({\n isNative: () => false,\n isConstructor: () => false,\n isToplevel: () => true,\n getFileName: () => filename,\n getLineNumber: () => undefined,\n getColumnNumber: () => undefined,\n getFunctionName: () => undefined,\n getMethodName: () => undefined,\n getTypeName: () => undefined,\n toString: () => filename,\n } as CallSite);\n}\n\nexport function injectVirtualStackFrame(error: Error, filename: string) {\n if (!SUPPORTED) return;\n\n let frames = virtualFrames.get(error);\n if (!frames) virtualFrames.set(error, (frames = []));\n frames.push(CallSite(filename));\n\n return error;\n}\n\nexport function expectedError(error: Error) {\n if (!SUPPORTED) return;\n expectedErrors.add(error);\n return error;\n}\n\nexport function beginHiddenCallStack(\n fn: (...args: A) => R,\n) {\n if (!SUPPORTED) return fn;\n\n return Object.defineProperty(\n function (...args: A) {\n setupPrepareStackTrace();\n return fn(...args);\n },\n \"name\",\n { value: STOP_HIDING },\n );\n}\n\nexport function endHiddenCallStack(\n fn: (...args: A) => R,\n) {\n if (!SUPPORTED) return fn;\n\n return Object.defineProperty(\n function (...args: A) {\n return fn(...args);\n },\n \"name\",\n { value: START_HIDING },\n );\n}\n\nfunction setupPrepareStackTrace() {\n // @ts-expect-error This function is a singleton\n // eslint-disable-next-line no-func-assign\n setupPrepareStackTrace = () => {};\n\n const { prepareStackTrace = defaultPrepareStackTrace } = Error;\n\n // We add some extra frames to Error.stackTraceLimit, so that we can\n // always show some useful frames even after deleting ours.\n // STACK_TRACE_LIMIT_DELTA should be around the maximum expected number\n // of internal frames, and not too big because capturing the stack trace\n // is slow (this is why Error.stackTraceLimit does not default to Infinity!).\n // Increase it if needed.\n // However, we only do it if the user did not explicitly set it to 0.\n const MIN_STACK_TRACE_LIMIT = 50;\n Error.stackTraceLimit &&= Math.max(\n Error.stackTraceLimit,\n MIN_STACK_TRACE_LIMIT,\n );\n\n Error.prepareStackTrace = function stackTraceRewriter(err, trace) {\n let newTrace = [];\n\n const isExpected = expectedErrors.has(err);\n let status: \"showing\" | \"hiding\" | \"unknown\" = isExpected\n ? \"hiding\"\n : \"unknown\";\n for (let i = 0; i < trace.length; i++) {\n const name = trace[i].getFunctionName();\n if (name === START_HIDING) {\n status = \"hiding\";\n } else if (name === STOP_HIDING) {\n if (status === \"hiding\") {\n status = \"showing\";\n if (virtualFrames.has(err)) {\n newTrace.unshift(...virtualFrames.get(err));\n }\n } else if (status === \"unknown\") {\n // Unexpected internal error, show the full stack trace\n newTrace = trace;\n break;\n }\n } else if (status !== \"hiding\") {\n newTrace.push(trace[i]);\n }\n }\n\n return prepareStackTrace(err, newTrace);\n };\n}\n\nfunction defaultPrepareStackTrace(err: Error, trace: CallSite[]) {\n if (trace.length === 0) return ErrorToString(err);\n return `${ErrorToString(err)}\\n at ${trace.join(\"\\n at \")}`;\n}\n"],"mappings":";;;;;;;;;AA4CA,MAAMA,aAAa,GAAGC,QAAQ,CAACC,IAAI,CAACC,IAAI,CAACC,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC;AAElE,MAAMC,SAAS,GAAG,CAAC,CAACH,KAAK,CAACI,iBAAiB;AAE3C,MAAMC,YAAY,GAAG,4CAA4C;AACjE,MAAMC,WAAW,GAAG,2CAA2C;AAI/D,MAAMC,cAAc,GAAG,IAAIC,OAAO,EAAS;AAC3C,MAAMC,aAAa,GAAG,IAAIC,OAAO,EAAqB;AAEtD,SAASC,QAAQA,CAACC,QAAgB,EAAY;EAE5C,OAAOC,MAAM,CAACC,MAAM,CAAC;IACnBC,QAAQ,EAAEA,CAAA,KAAM,KAAK;IACrBC,aAAa,EAAEA,CAAA,KAAM,KAAK;IAC1BC,UAAU,EAAEA,CAAA,KAAM,IAAI;IACtBC,WAAW,EAAEA,CAAA,KAAMN,QAAQ;IAC3BO,aAAa,EAAEA,CAAA,KAAMC,SAAS;IAC9BC,eAAe,EAAEA,CAAA,KAAMD,SAAS;IAChCE,eAAe,EAAEA,CAAA,K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;MACzB;IACF;IAEA,OAAOb,iBAAiB,CAACO,GAAG,EAAEE,QAAQ,CAAC;EACzC,CAAC;AACH;AAEA,SAASR,wBAAwBA,CAACM,GAAU,EAAEC,KAAiB,EAAE;EAC/D,IAAIA,KAAK,CAACM,MAAM,KAAK,CAAC,EAAE,OAAO1D,aAAa,CAACmD,GAAG,CAAC;EACjD,OAAQ,GAAEnD,aAAa,CAACmD,GAAG,CAAE,YAAWC,KAAK,CAACS,IAAI,CAAC,WAAW,CAAE,EAAC;AACnE;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/gensync-utils/async.js b/node_modules/@babel/core/lib/gensync-utils/async.js deleted file mode 100644 index 9cbe3dc3e..000000000 --- a/node_modules/@babel/core/lib/gensync-utils/async.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.forwardAsync = forwardAsync; -exports.isAsync = void 0; -exports.isThenable = isThenable; -exports.maybeAsync = maybeAsync; -exports.waitFor = exports.onFirstPause = void 0; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -const runGenerator = _gensync()(function* (item) { - return yield* item; -}); -const isAsync = _gensync()({ - sync: () => false, - errback: cb => cb(null, true) -}); -exports.isAsync = isAsync; -function maybeAsync(fn, message) { - return _gensync()({ - sync(...args) { - const result = fn.apply(this, args); - if (isThenable(result)) throw new Error(message); - return result; - }, - async(...args) { - return Promise.resolve(fn.apply(this, args)); - } - }); -} -const withKind = _gensync()({ - sync: cb => cb("sync"), - async: function () { - var _ref = _asyncToGenerator(function* (cb) { - return cb("async"); - }); - return function async(_x) { - return _ref.apply(this, arguments); - }; - }() -}); -function forwardAsync(action, cb) { - const g = _gensync()(action); - return withKind(kind => { - const adapted = g[kind]; - return cb(adapted); - }); -} -const onFirstPause = _gensync()({ - name: "onFirstPause", - arity: 2, - sync: function (item) { - return runGenerator.sync(item); - }, - errback: function (item, firstPause, cb) { - let completed = false; - runGenerator.errback(item, (err, value) => { - completed = true; - cb(err, value); - }); - if (!completed) { - firstPause(); - } - } -}); -exports.onFirstPause = onFirstPause; -const waitFor = _gensync()({ - sync: x => x, - async: function () { - var _ref2 = _asyncToGenerator(function* (x) { - return x; - }); - return function async(_x2) { - return _ref2.apply(this, arguments); - }; - }() -}); -exports.waitFor = waitFor; -function isThenable(val) { - return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function"; -} -0 && 0; - -//# sourceMappingURL=async.js.map diff --git a/node_modules/@babel/core/lib/gensync-utils/async.js.map b/node_modules/@babel/core/lib/gensync-utils/async.js.map deleted file mode 100644 index 2687bb5cd..000000000 --- a/node_modules/@babel/core/lib/gensync-utils/async.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","runGenerator","gensync","item","isAsync","sync","errback","cb","exports","maybeAsync","message","result","isThenable","Error","async","withKind","_ref","_x","forwardAsync","action","g","kind","adapted","onFirstPause","name","arity","firstPause","completed","waitFor","x","_ref2","_x2","val"],"sources":["../../src/gensync-utils/async.ts"],"sourcesContent":["import gensync, { type Gensync, type Handler, type Callback } from \"gensync\";\n\ntype MaybePromise = T | Promise;\n\nconst runGenerator: {\n sync(gen: Handler): Return;\n async(gen: Handler): Promise;\n errback(gen: Handler, cb: Callback): void;\n} = gensync(function* (item: Handler): Handler {\n return yield* item;\n});\n\n// This Gensync returns true if the current execution context is\n// asynchronous, otherwise it returns false.\nexport const isAsync = gensync({\n sync: () => false,\n errback: cb => cb(null, true),\n});\n\n// This function wraps any functions (which could be either synchronous or\n// asynchronous) with a Gensync. If the wrapped function returns a promise\n// but the current execution context is synchronous, it will throw the\n// provided error.\n// This is used to handle user-provided functions which could be asynchronous.\nexport function maybeAsync(\n fn: (...args: Args) => Return,\n message: string,\n): Gensync {\n return gensync({\n sync(...args) {\n const result = fn.apply(this, args);\n if (isThenable(result)) throw new Error(message);\n return result;\n },\n async(...args) {\n return Promise.resolve(fn.apply(this, args));\n },\n });\n}\n\nconst withKind = gensync({\n sync: cb => cb(\"sync\"),\n async: async cb => cb(\"async\"),\n}) as (cb: (kind: \"sync\" | \"async\") => MaybePromise) => Handler;\n\n// This function wraps a generator (or a Gensync) into another function which,\n// when called, will run the provided generator in a sync or async way, depending\n// on the execution context where this forwardAsync function is called.\n// This is useful, for example, when passing a callback to a function which isn't\n// aware of gensync, but it only knows about synchronous and asynchronous functions.\n// An example is cache.using, which being exposed to the user must be as simple as\n// possible:\n// yield* forwardAsync(gensyncFn, wrappedFn =>\n// cache.using(x => {\n// // Here we don't know about gensync. wrappedFn is a\n// // normal sync or async function\n// return wrappedFn(x);\n// })\n// )\nexport function forwardAsync(\n action: (...args: Args) => Handler,\n cb: (\n adapted: (...args: Args) => MaybePromise,\n ) => MaybePromise,\n): Handler {\n const g = gensync(action);\n return withKind(kind => {\n const adapted = g[kind];\n return cb(adapted);\n });\n}\n\n// If the given generator is executed asynchronously, the first time that it\n// is paused (i.e. When it yields a gensync generator which can't be run\n// synchronously), call the \"firstPause\" callback.\nexport const onFirstPause = gensync<\n [gen: Handler, firstPause: () => void],\n unknown\n>({\n name: \"onFirstPause\",\n arity: 2,\n sync: function (item) {\n return runGenerator.sync(item);\n },\n errback: function (item, firstPause, cb) {\n let completed = false;\n\n runGenerator.errback(item, (err, value) => {\n completed = true;\n cb(err, value);\n });\n\n if (!completed) {\n firstPause();\n }\n },\n}) as (gen: Handler, firstPause: () => void) => Handler;\n\n// Wait for the given promise to be resolved\nexport const waitFor = gensync({\n sync: x => x,\n async: async x => x,\n}) as (p: T | Promise) => Handler;\n\nexport function isThenable(val: any): val is PromiseLike {\n return (\n !!val &&\n (typeof val === \"object\" || typeof val === \"function\") &&\n !!val.then &&\n typeof val.then === \"function\"\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6E,SAAAE,mBAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,GAAA,EAAAC,GAAA,cAAAC,IAAA,GAAAP,GAAA,CAAAK,GAAA,EAAAC,GAAA,OAAAE,KAAA,GAAAD,IAAA,CAAAC,KAAA,WAAAC,KAAA,IAAAP,MAAA,CAAAO,KAAA,iBAAAF,IAAA,CAAAG,IAAA,IAAAT,OAAA,CAAAO,KAAA,YAAAG,OAAA,CAAAV,OAAA,CAAAO,KAAA,EAAAI,IAAA,CAAAT,KAAA,EAAAC,MAAA;AAAA,SAAAS,kBAAAC,EAAA,6BAAAC,IAAA,SAAAC,IAAA,GAAAC,SAAA,aAAAN,OAAA,WAAAV,OAAA,EAAAC,MAAA,QAAAF,GAAA,GAAAc,EAAA,CAAAI,KAAA,CAAAH,IAAA,EAAAC,IAAA,YAAAb,MAAAK,KAAA,IAAAT,kBAAA,CAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,UAAAI,KAAA,cAAAJ,OAAAe,GAAA,IAAApB,kBAAA,CAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,WAAAe,GAAA,KAAAhB,KAAA,CAAAiB,SAAA;AAI7E,MA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AAI,KAAK,UAAU;AAElC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/gensync-utils/fs.js b/node_modules/@babel/core/lib/gensync-utils/fs.js deleted file mode 100644 index db7f3d1d3..000000000 --- a/node_modules/@babel/core/lib/gensync-utils/fs.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.stat = exports.readFile = void 0; -function _fs() { - const data = require("fs"); - _fs = function () { - return data; - }; - return data; -} -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -const readFile = _gensync()({ - sync: _fs().readFileSync, - errback: _fs().readFile -}); -exports.readFile = readFile; -const stat = _gensync()({ - sync: _fs().statSync, - errback: _fs().stat -}); -exports.stat = stat; -0 && 0; - -//# sourceMappingURL=fs.js.map diff --git a/node_modules/@babel/core/lib/gensync-utils/fs.js.map b/node_modules/@babel/core/lib/gensync-utils/fs.js.map deleted file mode 100644 index 656058339..000000000 --- a/node_modules/@babel/core/lib/gensync-utils/fs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_fs","data","require","_gensync","readFile","gensync","sync","fs","readFileSync","errback","exports","stat","statSync"],"sources":["../../src/gensync-utils/fs.ts"],"sourcesContent":["import fs from \"fs\";\nimport gensync from \"gensync\";\n\nexport const readFile = gensync<[filepath: string, encoding: \"utf8\"], string>({\n sync: fs.readFileSync,\n errback: fs.readFile,\n});\n\nexport const stat = gensync({\n sync: fs.statSync,\n errback: fs.stat,\n});\n"],"mappings":";;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,QAAQ,GAAGC,UAAO,CAA+C;EAC5EC,IAAI,EAAEC,KAAE,CAACC,YAAY;EACrBC,OAAO,EAAEF,KAAE,CAACH;AACd,CAAC,CAAC;AAACM,OAAA,CAAAN,QAAA,GAAAA,QAAA;AAEI,MAAMO,IAAI,GAAGN,UAAO,CAAC;EAC1BC,IAAI,EAAEC,KAAE,CAACK,QAAQ;EACjBH,OAAO,EAAEF,KAAE,CAACI;AACd,CAAC,CAAC;AAACD,OAAA,CAAAC,IAAA,GAAAA,IAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/gensync-utils/functional.js b/node_modules/@babel/core/lib/gensync-utils/functional.js deleted file mode 100644 index db849596b..000000000 --- a/node_modules/@babel/core/lib/gensync-utils/functional.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.once = once; -var _async = require("./async"); -function once(fn) { - let result; - let resultP; - return function* () { - if (result) return result; - if (!(yield* (0, _async.isAsync)())) return result = yield* fn(); - if (resultP) return yield* (0, _async.waitFor)(resultP); - let resolve, reject; - resultP = new Promise((res, rej) => { - resolve = res; - reject = rej; - }); - try { - result = yield* fn(); - resultP = null; - resolve(result); - return result; - } catch (error) { - reject(error); - throw error; - } - }; -} -0 && 0; - -//# sourceMappingURL=functional.js.map diff --git a/node_modules/@babel/core/lib/gensync-utils/functional.js.map b/node_modules/@babel/core/lib/gensync-utils/functional.js.map deleted file mode 100644 index df66d16f3..000000000 --- a/node_modules/@babel/core/lib/gensync-utils/functional.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_async","require","once","fn","result","resultP","isAsync","waitFor","resolve","reject","Promise","res","rej","error"],"sources":["../../src/gensync-utils/functional.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport { isAsync, waitFor } from \"./async\";\n\nexport function once(fn: () => Handler): () => Handler {\n let result: R;\n let resultP: Promise;\n return function* () {\n if (result) return result;\n if (!(yield* isAsync())) return (result = yield* fn());\n if (resultP) return yield* waitFor(resultP);\n\n let resolve: (result: R) => void, reject: (error: unknown) => void;\n resultP = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n\n try {\n result = yield* fn();\n // Avoid keeping the promise around\n // now that we have the result.\n resultP = null;\n resolve(result);\n return result;\n } catch (error) {\n reject(error);\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEO,SAASC,IAAIA,CAAIC,EAAoB,EAAoB;EAC9D,IAAIC,MAAS;EACb,IAAIC,OAAmB;EACvB,OAAO,aAAa;IAClB,IAAID,MAAM,EAAE,OAAOA,MAAM;IACzB,IAAI,EAAE,OAAO,IAAAE,cAAO,GAAE,CAAC,EAAE,OAAQF,MAAM,GAAG,OAAOD,EAAE,EAAE;IACrD,IAAIE,OAAO,EAAE,OAAO,OAAO,IAAAE,cAAO,EAACF,OAAO,CAAC;IAE3C,IAAIG,OAA4B,EAAEC,MAAgC;IAClEJ,OAAO,GAAG,IAAIK,OAAO,CAAC,CAACC,GAAG,EAAEC,GAAG,KAAK;MAClCJ,OAAO,GAAGG,GAAG;MACbF,MAAM,GAAGG,GAAG;IACd,CAAC,CAAC;IAEF,IAAI;MACFR,MAAM,GAAG,OAAOD,EAAE,EAAE;MAGpBE,OAAO,GAAG,IAAI;MACdG,OAAO,CAACJ,MAAM,CAAC;MACf,OAAOA,MAAM;IACf,CAAC,CAAC,OAAOS,KAAK,EAAE;MACdJ,MAAM,CAACI,KAAK,CAAC;MACb,MAAMA,KAAK;IACb;EACF,CAAC;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/index.js b/node_modules/@babel/core/lib/index.js deleted file mode 100644 index 303533fdd..000000000 --- a/node_modules/@babel/core/lib/index.js +++ /dev/null @@ -1,245 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.DEFAULT_EXTENSIONS = void 0; -Object.defineProperty(exports, "File", { - enumerable: true, - get: function () { - return _file.default; - } -}); -Object.defineProperty(exports, "buildExternalHelpers", { - enumerable: true, - get: function () { - return _buildExternalHelpers.default; - } -}); -Object.defineProperty(exports, "createConfigItem", { - enumerable: true, - get: function () { - return _config.createConfigItem; - } -}); -Object.defineProperty(exports, "createConfigItemAsync", { - enumerable: true, - get: function () { - return _config.createConfigItemAsync; - } -}); -Object.defineProperty(exports, "createConfigItemSync", { - enumerable: true, - get: function () { - return _config.createConfigItemSync; - } -}); -Object.defineProperty(exports, "getEnv", { - enumerable: true, - get: function () { - return _environment.getEnv; - } -}); -Object.defineProperty(exports, "loadOptions", { - enumerable: true, - get: function () { - return _config.loadOptions; - } -}); -Object.defineProperty(exports, "loadOptionsAsync", { - enumerable: true, - get: function () { - return _config.loadOptionsAsync; - } -}); -Object.defineProperty(exports, "loadOptionsSync", { - enumerable: true, - get: function () { - return _config.loadOptionsSync; - } -}); -Object.defineProperty(exports, "loadPartialConfig", { - enumerable: true, - get: function () { - return _config.loadPartialConfig; - } -}); -Object.defineProperty(exports, "loadPartialConfigAsync", { - enumerable: true, - get: function () { - return _config.loadPartialConfigAsync; - } -}); -Object.defineProperty(exports, "loadPartialConfigSync", { - enumerable: true, - get: function () { - return _config.loadPartialConfigSync; - } -}); -Object.defineProperty(exports, "parse", { - enumerable: true, - get: function () { - return _parse.parse; - } -}); -Object.defineProperty(exports, "parseAsync", { - enumerable: true, - get: function () { - return _parse.parseAsync; - } -}); -Object.defineProperty(exports, "parseSync", { - enumerable: true, - get: function () { - return _parse.parseSync; - } -}); -Object.defineProperty(exports, "resolvePlugin", { - enumerable: true, - get: function () { - return _files.resolvePlugin; - } -}); -Object.defineProperty(exports, "resolvePreset", { - enumerable: true, - get: function () { - return _files.resolvePreset; - } -}); -Object.defineProperty((0, exports), "template", { - enumerable: true, - get: function () { - return _template().default; - } -}); -Object.defineProperty((0, exports), "tokTypes", { - enumerable: true, - get: function () { - return _parser().tokTypes; - } -}); -Object.defineProperty(exports, "transform", { - enumerable: true, - get: function () { - return _transform.transform; - } -}); -Object.defineProperty(exports, "transformAsync", { - enumerable: true, - get: function () { - return _transform.transformAsync; - } -}); -Object.defineProperty(exports, "transformFile", { - enumerable: true, - get: function () { - return _transformFile.transformFile; - } -}); -Object.defineProperty(exports, "transformFileAsync", { - enumerable: true, - get: function () { - return _transformFile.transformFileAsync; - } -}); -Object.defineProperty(exports, "transformFileSync", { - enumerable: true, - get: function () { - return _transformFile.transformFileSync; - } -}); -Object.defineProperty(exports, "transformFromAst", { - enumerable: true, - get: function () { - return _transformAst.transformFromAst; - } -}); -Object.defineProperty(exports, "transformFromAstAsync", { - enumerable: true, - get: function () { - return _transformAst.transformFromAstAsync; - } -}); -Object.defineProperty(exports, "transformFromAstSync", { - enumerable: true, - get: function () { - return _transformAst.transformFromAstSync; - } -}); -Object.defineProperty(exports, "transformSync", { - enumerable: true, - get: function () { - return _transform.transformSync; - } -}); -Object.defineProperty((0, exports), "traverse", { - enumerable: true, - get: function () { - return _traverse().default; - } -}); -exports.version = exports.types = void 0; -var _file = require("./transformation/file/file"); -var _buildExternalHelpers = require("./tools/build-external-helpers"); -var _files = require("./config/files"); -var _environment = require("./config/helpers/environment"); -function _types() { - const data = require("@babel/types"); - _types = function () { - return data; - }; - return data; -} -Object.defineProperty((0, exports), "types", { - enumerable: true, - get: function () { - return _types(); - } -}); -function _parser() { - const data = require("@babel/parser"); - _parser = function () { - return data; - }; - return data; -} -function _traverse() { - const data = require("@babel/traverse"); - _traverse = function () { - return data; - }; - return data; -} -function _template() { - const data = require("@babel/template"); - _template = function () { - return data; - }; - return data; -} -var _config = require("./config"); -var _transform = require("./transform"); -var _transformFile = require("./transform-file"); -var _transformAst = require("./transform-ast"); -var _parse = require("./parse"); -var thisFile = require("./index"); -const version = "7.21.8"; -exports.version = version; -const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]); -exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS; -; -{ - { - exports.OptionManager = class OptionManager { - init(opts) { - return (0, _config.loadOptionsSync)(opts); - } - }; - exports.Plugin = function Plugin(alias) { - throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`); - }; - } -} -0 && (exports.types = exports.traverse = exports.tokTypes = exports.template = 0); - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/core/lib/index.js.map b/node_modules/@babel/core/lib/index.js.map deleted file mode 100644 index 3105dc6b6..000000000 --- a/node_modules/@babel/core/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_file","require","_buildExternalHelpers","_files","_environment","_types","data","Object","defineProperty","exports","enumerable","get","_parser","_traverse","_template","_config","_transform","_transformFile","_transformAst","_parse","thisFile","version","DEFAULT_EXTENSIONS","freeze","OptionManager","init","opts","loadOptionsSync","Plugin","alias","Error","types","traverse","tokTypes","template"],"sources":["../src/index.ts"],"sourcesContent":["declare const PACKAGE_JSON: { name: string; version: string };\ndeclare const USE_ESM: boolean, IS_STANDALONE: boolean;\n\nexport const version = PACKAGE_JSON.version;\n\nexport { default as File } from \"./transformation/file/file\";\nexport type { default as PluginPass } from \"./transformation/plugin-pass\";\nexport { default as buildExternalHelpers } from \"./tools/build-external-helpers\";\nexport { resolvePlugin, resolvePreset } from \"./config/files\";\n\nexport { getEnv } from \"./config/helpers/environment\";\n\n// NOTE: Lazy re-exports aren't detected by the Node.js CJS-ESM interop.\n// These are handled by pluginInjectNodeReexportsHints in our babel.config.js\n// so that they can work well.\nexport * as types from \"@babel/types\";\nexport { tokTypes } from \"@babel/parser\";\nexport { default as traverse } from \"@babel/traverse\";\nexport { default as template } from \"@babel/template\";\n\nexport {\n createConfigItem,\n createConfigItemSync,\n createConfigItemAsync,\n} from \"./config\";\n\nexport {\n loadPartialConfig,\n loadPartialConfigSync,\n loadPartialConfigAsync,\n loadOptions,\n loadOptionsAsync,\n} from \"./config\";\nimport { loadOptionsSync } from \"./config\";\nexport { loadOptionsSync };\n\nexport type {\n CallerMetadata,\n InputOptions,\n PluginAPI,\n PluginObject,\n PresetAPI,\n PresetObject,\n} from \"./config\";\n\nexport {\n transform,\n transformSync,\n transformAsync,\n type FileResult,\n} from \"./transform\";\nexport {\n transformFile,\n transformFileSync,\n transformFileAsync,\n} from \"./transform-file\";\nexport {\n transformFromAst,\n transformFromAstSync,\n transformFromAstAsync,\n} from \"./transform-ast\";\nexport { parse, parseSync, parseAsync } from \"./parse\";\n\n/**\n * Recommended set of compilable extensions. Not used in @babel/core directly, but meant as\n * as an easy source for tooling making use of @babel/core.\n */\nexport const DEFAULT_EXTENSIONS = Object.freeze([\n \".js\",\n \".jsx\",\n \".es6\",\n \".es\",\n \".mjs\",\n \".cjs\",\n] as const);\n\nimport Module from \"module\";\nimport * as thisFile from \"./index\";\nif (USE_ESM) {\n if (!IS_STANDALONE) {\n // Pass this module to the CJS proxy, so that it can be synchronously accessed.\n const cjsProxy = Module.createRequire(import.meta.url)(\"../cjs-proxy.cjs\");\n cjsProxy[\"__ initialize @babel/core cjs proxy __\"] = thisFile;\n }\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n // For easier backward-compatibility, provide an API like the one we exposed in Babel 6.\n if (!USE_ESM) {\n // eslint-disable-next-line no-restricted-globals\n exports.OptionManager = class OptionManager {\n init(opts: {}) {\n return loadOptionsSync(opts);\n }\n };\n\n // eslint-disable-next-line no-restricted-globals\n exports.Plugin = function Plugin(alias: string) {\n throw new Error(\n `The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`,\n );\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAD,OAA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ACC,IAAQ,EAAE;QACb,OAAO,IAAAC,uBAAe,EAACD,IAAI,CAAC;MAC9B;IACF,CAAC;IAGDjB,OAAO,CAACmB,MAAM,GAAG,SAASA,MAAMA,CAACC,KAAa,EAAE;MAC9C,MAAM,IAAIC,KAAK,CACZ,QAAOD,KAAM,kEAAiE,CAChF;IACH,CAAC;EACH;AACF;AAAC,MAAApB,OAAA,CAAAsB,KAAA,GAAAtB,OAAA,CAAAuB,QAAA,GAAAvB,OAAA,CAAAwB,QAAA,GAAAxB,OAAA,CAAAyB,QAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/parse.js b/node_modules/@babel/core/lib/parse.js deleted file mode 100644 index 93bb7d100..000000000 --- a/node_modules/@babel/core/lib/parse.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parse = void 0; -exports.parseAsync = parseAsync; -exports.parseSync = parseSync; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _config = require("./config"); -var _parser = require("./parser"); -var _normalizeOpts = require("./transformation/normalize-opts"); -var _rewriteStackTrace = require("./errors/rewrite-stack-trace"); -const parseRunner = _gensync()(function* parse(code, opts) { - const config = yield* (0, _config.default)(opts); - if (config === null) { - return null; - } - return yield* (0, _parser.default)(config.passes, (0, _normalizeOpts.default)(config), code); -}); -const parse = function parse(code, opts, callback) { - if (typeof opts === "function") { - callback = opts; - opts = undefined; - } - if (callback === undefined) { - { - return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(code, opts); - } - } - (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.errback)(code, opts, callback); -}; -exports.parse = parse; -function parseSync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(...args); -} -function parseAsync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.async)(...args); -} -0 && 0; - -//# sourceMappingURL=parse.js.map diff --git a/node_modules/@babel/core/lib/parse.js.map b/node_modules/@babel/core/lib/parse.js.map deleted file mode 100644 index 9a79b15d5..000000000 --- a/node_modules/@babel/core/lib/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","_config","_parser","_normalizeOpts","_rewriteStackTrace","parseRunner","gensync","parse","code","opts","config","loadConfig","parser","passes","normalizeOptions","callback","undefined","beginHiddenCallStack","sync","errback","exports","parseSync","args","parseAsync","async"],"sources":["../src/parse.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions } from \"./config\";\nimport parser from \"./parser\";\nimport type { ParseResult } from \"./parser\";\nimport normalizeOptions from \"./transformation/normalize-opts\";\nimport type { ValidatedOptions } from \"./config/validation/options\";\n\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace\";\n\ntype FileParseCallback = {\n (err: Error, ast: null): void;\n (err: null, ast: ParseResult | null): void;\n};\n\ntype Parse = {\n (code: string, callback: FileParseCallback): void;\n (\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileParseCallback,\n ): void;\n (code: string, opts?: InputOptions | null): ParseResult | null;\n};\n\nconst parseRunner = gensync(function* parse(\n code: string,\n opts: InputOptions | undefined | null,\n): Handler {\n const config = yield* loadConfig(opts);\n\n if (config === null) {\n return null;\n }\n\n return yield* parser(config.passes, normalizeOptions(config), code);\n});\n\nexport const parse: Parse = function parse(\n code,\n opts?,\n callback?: FileParseCallback,\n) {\n if (typeof opts === \"function\") {\n callback = opts;\n opts = undefined as ValidatedOptions;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'parse' function expects a callback. If you need to call it synchronously, please use 'parseSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'parse' function will expect a callback. If you need to call it synchronously, please use 'parseSync'.\",\n // );\n return beginHiddenCallStack(parseRunner.sync)(code, opts);\n }\n }\n\n beginHiddenCallStack(parseRunner.errback)(code, opts, callback);\n};\n\nexport function parseSync(...args: Parameters) {\n return beginHiddenCallStack(parseRunner.sync)(...args);\n}\nexport function parseAsync(...args: Parameters) {\n return beginHiddenCallStack(parseRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,OAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AAGA,IAAAI,kBAAA,GAAAJ,OAAA;AAiBA,MAAMK,WAAW,GAAGC,UAAO,CAAC,UAAUC,KAAKA,CACzCC,IAAY,EACZC,IAAqC,EACR;EAC7B,MAAMC,MAAM,GAAG,OAAO,IAAAC,eAAU,EAACF,IAAI,CAAC;EAEtC,IAAIC,MAAM,KAAK,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,OAAO,OAAO,IAAAE,eAAM,EAACF,MAAM,CAACG,MAAM,EAAE,IAAAC,sBAAgB,EAACJ,MAAM,CAAC,EAAEF,IAAI,CAAC;AACrE,CAAC,CAAC;AAEK,MAAMD,KAAY,GAAG,SAASA,KAAKA,CACxCC,IAAI,EACJC,IAAK,EACLM,QAA4B,EAC5B;EACA,IAAI,OAAON,IAAI,KAAK,UAAU,EAAE;IAC9BM,QAAQ,GAAGN,IAAI;IACfA,IAAI,GAAGO,SAA6B;EACtC;EAEA,IAAID,QAAQ,KAAKC,SAAS,EAAE;IAKnB;MAIL,OAAO,IAAAC,uCAAoB,EAACZ,WAAW,CAACa,IAAI,CAAC,CAACV,IAAI,EAAEC,IAAI,CAAC;IAC3D;EACF;EAEA,IAAAQ,uCAAoB,EAACZ,WAAW,CAACc,OAAO,CAAC,CAACX,IAAI,EAAEC,IAAI,EAAEM,QAAQ,CAAC;AACjE,CAAC;AAACK,OAAA,CAAAb,KAAA,GAAAA,KAAA;AAEK,SAASc,SAASA,CAAC,GAAGC,IAAyC,EAAE;EACtE,OAAO,IAAAL,uCAAoB,EAACZ,WAAW,CAACa,IAAI,CAAC,CAAC,GAAGI,IAAI,CAAC;AACxD;AACO,SAASC,UAAUA,CAAC,GAAGD,IAA0C,EAAE;EACxE,OAAO,IAAAL,uCAAoB,EAACZ,WAAW,CAACmB,KAAK,CAAC,CAAC,GAAGF,IAAI,CAAC;AACzD;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/parser/index.js b/node_modules/@babel/core/lib/parser/index.js deleted file mode 100644 index b2b05cfef..000000000 --- a/node_modules/@babel/core/lib/parser/index.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = parser; -function _parser() { - const data = require("@babel/parser"); - _parser = function () { - return data; - }; - return data; -} -function _codeFrame() { - const data = require("@babel/code-frame"); - _codeFrame = function () { - return data; - }; - return data; -} -var _missingPluginHelper = require("./util/missing-plugin-helper"); -function* parser(pluginPasses, { - parserOpts, - highlightCode = true, - filename = "unknown" -}, code) { - try { - const results = []; - for (const plugins of pluginPasses) { - for (const plugin of plugins) { - const { - parserOverride - } = plugin; - if (parserOverride) { - const ast = parserOverride(code, parserOpts, _parser().parse); - if (ast !== undefined) results.push(ast); - } - } - } - if (results.length === 0) { - return (0, _parser().parse)(code, parserOpts); - } else if (results.length === 1) { - yield* []; - if (typeof results[0].then === "function") { - throw new Error(`You appear to be using an async parser plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`); - } - return results[0]; - } - throw new Error("More than one plugin attempted to override parsing."); - } catch (err) { - if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") { - err.message += "\nConsider renaming the file to '.mjs', or setting sourceType:module " + "or sourceType:unambiguous in your Babel config for this file."; - } - const { - loc, - missingPlugin - } = err; - if (loc) { - const codeFrame = (0, _codeFrame().codeFrameColumns)(code, { - start: { - line: loc.line, - column: loc.column + 1 - } - }, { - highlightCode - }); - if (missingPlugin) { - err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame); - } else { - err.message = `${filename}: ${err.message}\n\n` + codeFrame; - } - err.code = "BABEL_PARSE_ERROR"; - } - throw err; - } -} -0 && 0; - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/core/lib/parser/index.js.map b/node_modules/@babel/core/lib/parser/index.js.map deleted file mode 100644 index b97ecca08..000000000 --- a/node_modules/@babel/core/lib/parser/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_parser","data","require","_codeFrame","_missingPluginHelper","parser","pluginPasses","parserOpts","highlightCode","filename","code","results","plugins","plugin","parserOverride","ast","parse","undefined","push","length","then","Error","err","message","loc","missingPlugin","codeFrame","codeFrameColumns","start","line","column","generateMissingPluginMessage"],"sources":["../../src/parser/index.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\nimport { parse } from \"@babel/parser\";\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport generateMissingPluginMessage from \"./util/missing-plugin-helper\";\nimport type { PluginPasses } from \"../config\";\n\nexport type ParseResult = ReturnType;\n\nexport default function* parser(\n pluginPasses: PluginPasses,\n { parserOpts, highlightCode = true, filename = \"unknown\" }: any,\n code: string,\n): Handler {\n try {\n const results = [];\n for (const plugins of pluginPasses) {\n for (const plugin of plugins) {\n const { parserOverride } = plugin;\n if (parserOverride) {\n const ast = parserOverride(code, parserOpts, parse);\n\n if (ast !== undefined) results.push(ast);\n }\n }\n }\n\n if (results.length === 0) {\n return parse(code, parserOpts);\n } else if (results.length === 1) {\n // @ts-expect-error - If we want to allow async parsers\n yield* [];\n if (typeof results[0].then === \"function\") {\n throw new Error(\n `You appear to be using an async parser plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n return results[0];\n }\n // TODO: Add an error code\n throw new Error(\"More than one plugin attempted to override parsing.\");\n } catch (err) {\n if (err.code === \"BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED\") {\n err.message +=\n \"\\nConsider renaming the file to '.mjs', or setting sourceType:module \" +\n \"or sourceType:unambiguous in your Babel config for this file.\";\n // err.code will be changed to BABEL_PARSE_ERROR later.\n }\n\n const { loc, missingPlugin } = err;\n if (loc) {\n const codeFrame = codeFrameColumns(\n code,\n {\n start: {\n line: loc.line,\n column: loc.column + 1,\n },\n },\n {\n highlightCode,\n },\n );\n if (missingPlugin) {\n err.message =\n `${filename}: ` +\n generateMissingPluginMessage(missingPlugin[0], loc, codeFrame);\n } else {\n err.message = `${filename}: ${err.message}\\n\\n` + codeFrame;\n }\n err.code = \"BABEL_PARSE_ERROR\";\n }\n throw err;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,IAAAG,oBAAA,GAAAF,OAAA;AAKe,UAAUG,MAAMA,CAC7BC,YAA0B,EAC1B;EAAEC,UAAU;EAAEC,aAAa,GAAG,IAAI;EAAEC,QAAQ,GAAG;AAAe,CAAC,EAC/DC,IAAY,EACU;EACtB,IAAI;IACF,MAAMC,OAAO,GAAG,EAAE;IAClB,KAAK,MAAMC,OAAO,IAAIN,YAAY,EAAE;MAClC,KAAK,MAAMO,MAAM,IAAID,OAAO,EAAE;QAC5B,MAAM;UAAEE;QAAe,CAAC,GAAGD,MAAM;QACjC,IAAIC,cAAc,EAAE;UAClB,MAAMC,GAAG,GAAGD,cAAc,CAACJ,IAAI,EAAEH,UAAU,EAAES,eAAK,CAAC;UA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G,SAAS;MAC7D;MACAJ,GAAG,CAACZ,IAAI,GAAG,mBAAmB;IAChC;IACA,MAAMY,GAAG;EACX;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js b/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js deleted file mode 100644 index fbfb12e5e..000000000 --- a/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js +++ /dev/null @@ -1,323 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = generateMissingPluginMessage; -const pluginNameMap = { - asyncDoExpressions: { - syntax: { - name: "@babel/plugin-syntax-async-do-expressions", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-do-expressions" - } - }, - decimal: { - syntax: { - name: "@babel/plugin-syntax-decimal", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decimal" - } - }, - decorators: { - syntax: { - name: "@babel/plugin-syntax-decorators", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decorators" - }, - transform: { - name: "@babel/plugin-proposal-decorators", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-decorators" - } - }, - doExpressions: { - syntax: { - name: "@babel/plugin-syntax-do-expressions", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-do-expressions" - }, - transform: { - name: "@babel/plugin-proposal-do-expressions", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-do-expressions" - } - }, - exportDefaultFrom: { - syntax: { - name: "@babel/plugin-syntax-export-default-from", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-default-from" - }, - transform: { - name: "@babel/plugin-proposal-export-default-from", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-default-from" - } - }, - flow: { - syntax: { - name: "@babel/plugin-syntax-flow", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-flow" - }, - transform: { - name: "@babel/preset-flow", - url: "https://github.com/babel/babel/tree/main/packages/babel-preset-flow" - } - }, - functionBind: { - syntax: { - name: "@babel/plugin-syntax-function-bind", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-bind" - }, - transform: { - name: "@babel/plugin-proposal-function-bind", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-bind" - } - }, - functionSent: { - syntax: { - name: "@babel/plugin-syntax-function-sent", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-sent" - }, - transform: { - name: "@babel/plugin-proposal-function-sent", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-sent" - } - }, - jsx: { - syntax: { - name: "@babel/plugin-syntax-jsx", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-jsx" - }, - transform: { - name: "@babel/preset-react", - url: "https://github.com/babel/babel/tree/main/packages/babel-preset-react" - } - }, - importAssertions: { - syntax: { - name: "@babel/plugin-syntax-import-assertions", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-assertions" - } - }, - pipelineOperator: { - syntax: { - name: "@babel/plugin-syntax-pipeline-operator", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-pipeline-operator" - }, - transform: { - name: "@babel/plugin-proposal-pipeline-operator", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-pipeline-operator" - } - }, - recordAndTuple: { - syntax: { - name: "@babel/plugin-syntax-record-and-tuple", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-record-and-tuple" - } - }, - regexpUnicodeSets: { - syntax: { - name: "@babel/plugin-syntax-unicode-sets-regex", - url: "https://github.com/babel/babel/blob/main/packages/babel-plugin-syntax-unicode-sets-regex/README.md" - }, - transform: { - name: "@babel/plugin-proposal-unicode-sets-regex", - url: "https://github.com/babel/babel/blob/main/packages/babel-plugin-proposalunicode-sets-regex/README.md" - } - }, - throwExpressions: { - syntax: { - name: "@babel/plugin-syntax-throw-expressions", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-throw-expressions" - }, - transform: { - name: "@babel/plugin-proposal-throw-expressions", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-throw-expressions" - } - }, - typescript: { - syntax: { - name: "@babel/plugin-syntax-typescript", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-typescript" - }, - transform: { - name: "@babel/preset-typescript", - url: "https://github.com/babel/babel/tree/main/packages/babel-preset-typescript" - } - } -}; -{ - Object.assign(pluginNameMap, { - asyncGenerators: { - syntax: { - name: "@babel/plugin-syntax-async-generators", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-generators" - }, - transform: { - name: "@babel/plugin-proposal-async-generator-functions", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-async-generator-functions" - } - }, - classProperties: { - syntax: { - name: "@babel/plugin-syntax-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties" - }, - transform: { - name: "@babel/plugin-proposal-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties" - } - }, - classPrivateProperties: { - syntax: { - name: "@babel/plugin-syntax-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties" - }, - transform: { - name: "@babel/plugin-proposal-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties" - } - }, - classPrivateMethods: { - syntax: { - name: "@babel/plugin-syntax-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties" - }, - transform: { - name: "@babel/plugin-proposal-private-methods", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-methods" - } - }, - classStaticBlock: { - syntax: { - name: "@babel/plugin-syntax-class-static-block", - url: "https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-syntax-class-static-block" - }, - transform: { - name: "@babel/plugin-proposal-class-static-block", - url: "https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-proposal-class-static-block" - } - }, - dynamicImport: { - syntax: { - name: "@babel/plugin-syntax-dynamic-import", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-dynamic-import" - } - }, - exportNamespaceFrom: { - syntax: { - name: "@babel/plugin-syntax-export-namespace-from", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-namespace-from" - }, - transform: { - name: "@babel/plugin-proposal-export-namespace-from", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-namespace-from" - } - }, - importMeta: { - syntax: { - name: "@babel/plugin-syntax-import-meta", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-meta" - } - }, - logicalAssignment: { - syntax: { - name: "@babel/plugin-syntax-logical-assignment-operators", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-logical-assignment-operators" - }, - transform: { - name: "@babel/plugin-proposal-logical-assignment-operators", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-logical-assignment-operators" - } - }, - moduleStringNames: { - syntax: { - name: "@babel/plugin-syntax-module-string-names", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-module-string-names" - } - }, - numericSeparator: { - syntax: { - name: "@babel/plugin-syntax-numeric-separator", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-numeric-separator" - }, - transform: { - name: "@babel/plugin-proposal-numeric-separator", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-numeric-separator" - } - }, - nullishCoalescingOperator: { - syntax: { - name: "@babel/plugin-syntax-nullish-coalescing-operator", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-nullish-coalescing-operator" - }, - transform: { - name: "@babel/plugin-proposal-nullish-coalescing-operator", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-nullish-coalescing-opearator" - } - }, - objectRestSpread: { - syntax: { - name: "@babel/plugin-syntax-object-rest-spread", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-object-rest-spread" - }, - transform: { - name: "@babel/plugin-proposal-object-rest-spread", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-object-rest-spread" - } - }, - optionalCatchBinding: { - syntax: { - name: "@babel/plugin-syntax-optional-catch-binding", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-catch-binding" - }, - transform: { - name: "@babel/plugin-proposal-optional-catch-binding", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-catch-binding" - } - }, - optionalChaining: { - syntax: { - name: "@babel/plugin-syntax-optional-chaining", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-chaining" - }, - transform: { - name: "@babel/plugin-proposal-optional-chaining", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-chaining" - } - }, - privateIn: { - syntax: { - name: "@babel/plugin-syntax-private-property-in-object", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-private-property-in-object" - }, - transform: { - name: "@babel/plugin-proposal-private-property-in-object", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-property-in-object" - } - } - }); -} -const getNameURLCombination = ({ - name, - url -}) => `${name} (${url})`; -function generateMissingPluginMessage(missingPluginName, loc, codeFrame) { - let helpMessage = `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` + `(${loc.line}:${loc.column + 1}):\n\n` + codeFrame; - const pluginInfo = pluginNameMap[missingPluginName]; - if (pluginInfo) { - const { - syntax: syntaxPlugin, - transform: transformPlugin - } = pluginInfo; - if (syntaxPlugin) { - const syntaxPluginInfo = getNameURLCombination(syntaxPlugin); - if (transformPlugin) { - const transformPluginInfo = getNameURLCombination(transformPlugin); - const sectionType = transformPlugin.name.startsWith("@babel/plugin") ? "plugins" : "presets"; - helpMessage += `\n\nAdd ${transformPluginInfo} to the '${sectionType}' section of your Babel config to enable transformation. -If you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section to enable parsing.`; - } else { - helpMessage += `\n\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` + `to enable parsing.`; - } - } - } - return helpMessage; -} -0 && 0; - -//# sourceMappingURL=missing-plugin-helper.js.map diff --git a/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map b/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map deleted file mode 100644 index 99300d4a0..000000000 --- a/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["pluginNameMap","asyncDoExpressions","syntax","name","url","decimal","decorators","transform","doExpressions","exportDefaultFrom","flow","functionBind","functionSent","jsx","importAssertions","pipelineOperator","recordAndTuple","regexpUnicodeSets","throwExpressions","typescript","Object","assign","asyncGenerators","classProperties","classPrivateProperties","classPrivateMethods","classStaticBlock","dynamicImport","exportNamespaceFrom","importMeta","logicalAssignment","moduleStringNames","numericSeparator","nullishCoalescingOperator","objectRestSpread","optionalCatchBinding","optionalChaining","privateIn","getNameURLCombination","generateMissingPluginMessage","missingPluginName","loc","codeFrame","helpMessage","line","column","pluginInfo","syntaxPlugin","transformPlugin","syntaxPluginInfo","transformPluginInfo","sectionType","startsWith"],"sources":["../../../src/parser/util/missing-plugin-helper.ts"],"sourcesContent":["const pluginNameMap: Record<\n string,\n Partial>>\n> = {\n asyncDoExpressions: {\n syntax: {\n name: \"@babel/plugin-syntax-async-do-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-do-expressions\",\n },\n },\n decimal: {\n syntax: {\n name: \"@babel/plugin-syntax-decimal\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decimal\",\n },\n },\n decorators: {\n syntax: {\n name: \"@babel/plugin-syntax-decorators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decorators\",\n },\n transform: {\n name: \"@babel/plugin-proposal-decorators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-decorators\",\n },\n },\n doExpressions: {\n syntax: {\n name: \"@babel/plugin-syntax-do-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-do-expressions\",\n },\n transform: {\n name: \"@babel/plugin-proposal-do-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-do-expressions\",\n },\n },\n exportDefaultFrom: {\n syntax: {\n name: \"@babel/plugin-syntax-export-default-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-default-from\",\n },\n transform: {\n name: \"@babel/plugin-proposal-export-default-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-default-from\",\n },\n },\n flow: {\n syntax: {\n name: \"@babel/plugin-syntax-flow\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-flow\",\n },\n transform: {\n name: \"@babel/preset-flow\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-preset-flow\",\n },\n },\n functionBind: {\n syntax: {\n name: \"@babel/plugin-syntax-function-bind\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-bind\",\n },\n transform: {\n name: \"@babel/plugin-proposal-function-bind\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-bind\",\n },\n },\n functionSent: {\n syntax: {\n name: \"@babel/plugin-syntax-function-sent\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-sent\",\n },\n transform: {\n name: \"@babel/plugin-proposal-function-sent\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-sent\",\n },\n },\n jsx: {\n syntax: {\n name: \"@babel/plugin-syntax-jsx\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-jsx\",\n },\n transform: {\n name: \"@babel/preset-react\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-preset-react\",\n },\n },\n importAssertions: {\n syntax: {\n name: \"@babel/plugin-syntax-import-assertions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-assertions\",\n },\n },\n pipelineOperator: {\n syntax: {\n name: \"@babel/plugin-syntax-pipeline-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-pipeline-operator\",\n },\n transform: {\n name: \"@babel/plugin-proposal-pipeline-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-pipeline-operator\",\n },\n },\n recordAndTuple: {\n syntax: {\n name: \"@babel/plugin-syntax-record-and-tuple\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-record-and-tuple\",\n },\n },\n regexpUnicodeSets: {\n syntax: {\n name: \"@babel/plugin-syntax-unicode-sets-regex\",\n url: \"https://github.com/babel/babel/blob/main/packages/babel-plugin-syntax-unicode-sets-regex/README.md\",\n },\n transform: {\n name: \"@babel/plugin-proposal-unicode-sets-regex\",\n url: \"https://github.com/babel/babel/blob/main/packages/babel-plugin-proposalunicode-sets-regex/README.md\",\n },\n },\n throwExpressions: {\n syntax: {\n name: \"@babel/plugin-syntax-throw-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-throw-expressions\",\n },\n transform: {\n name: \"@babel/plugin-proposal-throw-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-throw-expressions\",\n },\n },\n typescript: {\n syntax: {\n name: \"@babel/plugin-syntax-typescript\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-typescript\",\n },\n transform: {\n name: \"@babel/preset-typescript\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-preset-typescript\",\n },\n },\n};\n\nif (!process.env.BABEL_8_BREAKING) {\n // TODO: This plugins are now supported by default by @babel/parser.\n Object.assign(pluginNameMap, {\n asyncGenerators: {\n syntax: {\n name: \"@babel/plugin-syntax-async-generators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-generators\",\n },\n transform: {\n name: \"@babel/plugin-proposal-async-generator-functions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-async-generator-functions\",\n },\n },\n classProperties: {\n syntax: {\n name: \"@babel/plugin-syntax-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties\",\n },\n transform: {\n name: \"@babel/plugin-proposal-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties\",\n },\n },\n classPrivateProperties: {\n syntax: {\n name: \"@babel/plugin-syntax-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties\",\n },\n transform: {\n name: \"@babel/plugin-proposal-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties\",\n },\n },\n classPrivateMethods: {\n syntax: {\n name: \"@babel/plugin-syntax-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties\",\n },\n transform: {\n name: \"@babel/plugin-proposal-private-methods\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-methods\",\n },\n },\n classStaticBlock: {\n syntax: {\n name: \"@babel/plugin-syntax-class-static-block\",\n url: \"https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-syntax-class-static-block\",\n },\n transform: {\n name: \"@babel/plugin-proposal-class-static-block\",\n url: \"https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-proposal-class-static-block\",\n },\n },\n dynamicImport: {\n syntax: {\n name: \"@babel/plugin-syntax-dynamic-import\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-dynamic-import\",\n },\n },\n exportNamespaceFrom: {\n syntax: {\n name: \"@babel/plugin-syntax-export-namespace-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-namespace-from\",\n },\n transform: {\n name: \"@babel/plugin-proposal-export-namespace-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-namespace-from\",\n },\n },\n importMeta: {\n syntax: {\n name: \"@babel/plugin-syntax-import-meta\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-meta\",\n },\n },\n logicalAssignment: {\n syntax: {\n name: \"@babel/plugin-syntax-logical-assignment-operators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-logical-assignment-operators\",\n },\n transform: {\n name: \"@babel/plugin-proposal-logical-assignment-operators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-logical-assignment-operators\",\n },\n },\n moduleStringNames: {\n syntax: {\n name: \"@babel/plugin-syntax-module-string-names\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-module-string-names\",\n },\n },\n numericSeparator: {\n syntax: {\n name: \"@babel/plugin-syntax-numeric-separator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-numeric-separator\",\n },\n transform: {\n name: \"@babel/plugin-proposal-numeric-separator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-numeric-separator\",\n },\n },\n nullishCoalescingOperator: {\n syntax: {\n name: \"@babel/plugin-syntax-nullish-coalescing-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-nullish-coalescing-operator\",\n },\n transform: {\n name: \"@babel/plugin-proposal-nullish-coalescing-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-nullish-coalescing-opearator\",\n },\n },\n objectRestSpread: {\n syntax: {\n name: \"@babel/plugin-syntax-object-rest-spread\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-object-rest-spread\",\n },\n transform: {\n name: \"@babel/plugin-proposal-object-rest-spread\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-object-rest-spread\",\n },\n },\n optionalCatchBinding: {\n syntax: {\n name: \"@babel/plugin-syntax-optional-catch-binding\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-catch-binding\",\n },\n transform: {\n name: \"@babel/plugin-proposal-optional-catch-binding\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-catch-binding\",\n },\n },\n optionalChaining: {\n syntax: {\n name: \"@babel/plugin-syntax-optional-chaining\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-chaining\",\n },\n transform: {\n name: \"@babel/plugin-proposal-optional-chaining\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-chaining\",\n },\n },\n privateIn: {\n syntax: {\n name: \"@babel/plugin-syntax-private-property-in-object\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-private-property-in-object\",\n },\n transform: {\n name: \"@babel/plugin-proposal-private-property-in-object\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-property-in-object\",\n },\n },\n });\n}\n\nconst getNameURLCombination = ({ name, url }: { name: string; url: string }) =>\n `${name} (${url})`;\n\n/*\nReturns a string of the format:\nSupport for the experimental syntax [@babel/parser plugin name] isn't currently enabled ([loc]):\n\n[code frame]\n\nAdd [npm package name] ([url]) to the 'plugins' section of your Babel config\nto enable [parsing|transformation].\n*/\nexport default function generateMissingPluginMessage(\n missingPluginName: string,\n loc: {\n line: number;\n column: number;\n },\n codeFrame: string,\n): string {\n let helpMessage =\n `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` +\n `(${loc.line}:${loc.column + 1}):\\n\\n` +\n codeFrame;\n const pluginInfo = pluginNameMap[missingPluginName];\n if (pluginInfo) {\n const { syntax: syntaxPlugin, transform: transformPlugin } = pluginInfo;\n if (syntaxPlugin) {\n const syntaxPluginInfo = getNameURLCombination(syntaxPlugin);\n if (transformPlugin) {\n const transformPluginInfo = getNameURLCombination(transformPlugin);\n const sectionType = transformPlugin.name.startsWith(\"@babel/plugin\")\n ? \"plugins\"\n : \"presets\";\n helpMessage += `\\n\\nAdd ${transformPluginInfo} to the '${sectionType}' section of your Babel config to enable transformation.\nIf you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section to enable parsing.`;\n } else {\n helpMessage +=\n `\\n\\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` +\n `to enable parsing.`;\n }\n }\n }\n return helpMessage;\n}\n"],"mappings":";;;;;;AAAA,MAAMA,aAGL,GAAG;EACFC,kBAAkB,EAAE;IAClBC,MAAM,EAAE;MACNC,IAAI,EAAE,2CAA2C;MACjDC,GAAG,EAAE;IACP;EACF,CAAC;EACDC,OAAO,EAAE;IACPH,MAAM,EAAE;MACNC,IAAI,EAAE,8BAA8B;MACpCC,GAAG,EAAE;IACP;EACF,CAAC;EACDE,UAAU,EAAE;IACVJ,MAAM,EAAE;MACNC,IAAI,EAAE,iCAAiC;MACvCC,GAAG,EAAE;IACP,CAAC;IACDG,SAAS,EAAE;MACTJ,IAAI,EAAE,mCAAmC;MACzCC,GAAG,EAAE;IACP;EACF,CAAC;EACDI,aAAa,EAAE;IACbN,MAAM,EAAE;MACNC,IAAI,EAAE,qCAAqC;MAC3CC,GAAG,EAAE;IACP,CAAC;IACDG,SAAS,EAAE;MACTJ,IAAI,EAAE,uCAAuC;MAC7CC,GAAG,EAAE;IACP;EACF,CAAC;EACDK,iBAAiB,EAAE;IACjBP,MAAM,EAAE;MACNC,IAAI,EAAE,0CAA0C;MAChDC,GAAG,EAAE;IACP,CAAC;IACDG,SAAS,EAAE;MACTJ,IAAI,EAAE,4CAA4C;MAClDC,GAAG,EAAE;IACP;EACF,CAAC;EACDM,IAAI,EAAE;IACJR,MAAM,EAAE;MACNC,IAAI,EAAE,2BAA2B;MACjCC,GAAG,EAAE;IACP,CAAC;IACDG,SAAS,EAAE;MACTJ,IAAI,EAAE,oBAAoB;MAC1BC,GAAG,EAAE;IACP;EACF,CAAC;EACDO,YAAY,EAAE;IACZT,MAAM,EAAE;MACNC,IAAI,EAAE,oCAAoC;MAC1CC,GAAG,EAAE;IACP,CAAC;IACDG,SAAS,EAAE;MACTJ,IAAI,EAAE,sCAAsC;MAC5CC,GAAG,EAAE;IACP;EACF,CAAC;EACDQ,YAAY,EAAE;IACZV,MAAM,EAAE;MACNC,IAA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E,0CAA0C;QAChDC,GAAG,EAAE;MACP;IACF,CAAC;IACDiC,SAAS,EAAE;MACTnC,MAAM,EAAE;QACNC,IAAI,EAAE,iDAAiD;QACvDC,GAAG,EAAE;MACP,CAAC;MACDG,SAAS,EAAE;QACTJ,IAAI,EAAE,mDAAmD;QACzDC,GAAG,EAAE;MACP;IACF;EACF,CAAC,CAAC;AACJ;AAEA,MAAMkC,qBAAqB,GAAGA,CAAC;EAAEnC,IAAI;EAAEC;AAAmC,CAAC,KACxE,GAAED,IAAK,KAAIC,GAAI,GAAE;AAWL,SAASmC,4BAA4BA,CAClDC,iBAAyB,EACzBC,GAGC,EACDC,SAAiB,EACT;EACR,IAAIC,WAAW,GACZ,wCAAuCH,iBAAkB,4BAA2B,GACpF,IAAGC,GAAG,CAACG,IAAK,IAAGH,GAAG,CAACI,MAAM,GAAG,CAAE,QAAO,GACtCH,SAAS;EACX,MAAMI,UAAU,GAAG9C,aAAa,CAACwC,iBAAiB,CAAC;EACnD,IAAIM,UAAU,EAAE;IACd,MAAM;MAAE5C,MAAM,EAAE6C,YAAY;MAAExC,SAAS,EAAEyC;IAAgB,CAAC,GAAGF,UAAU;IACvE,IAAIC,YAAY,EAAE;MAChB,MAAME,gBAAgB,GAAGX,qBAAqB,CAACS,YAAY,CAAC;MAC5D,IAAIC,eAAe,EAAE;QACnB,MAAME,mBAAmB,GAAGZ,qBAAqB,CAACU,eAAe,CAAC;QAClE,MAAMG,WAAW,GAAGH,eAAe,CAAC7C,IAAI,CAACiD,UAAU,CAAC,eAAe,CAAC,GAChE,SAAS,GACT,SAAS;QACbT,WAAW,IAAK,WAAUO,mBAAoB,YAAWC,WAAY;AAC7E,qCAAqCF,gBAAiB,8CAA6C;MAC7F,CAAC,MAAM;QACLN,WAAW,IACR,WAAUM,gBAAiB,iDAAgD,GAC3E,oBAAmB;MACxB;IACF;EACF;EACA,OAAON,WAAW;AACpB;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/tools/build-external-helpers.js b/node_modules/@babel/core/lib/tools/build-external-helpers.js deleted file mode 100644 index dc67d4819..000000000 --- a/node_modules/@babel/core/lib/tools/build-external-helpers.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _default; -function helpers() { - const data = require("@babel/helpers"); - helpers = function () { - return data; - }; - return data; -} -function _generator() { - const data = require("@babel/generator"); - _generator = function () { - return data; - }; - return data; -} -function _template() { - const data = require("@babel/template"); - _template = function () { - return data; - }; - return data; -} -function _t() { - const data = require("@babel/types"); - _t = function () { - return data; - }; - return data; -} -var _file = require("../transformation/file/file"); -const { - arrayExpression, - assignmentExpression, - binaryExpression, - blockStatement, - callExpression, - cloneNode, - conditionalExpression, - exportNamedDeclaration, - exportSpecifier, - expressionStatement, - functionExpression, - identifier, - memberExpression, - objectExpression, - program, - stringLiteral, - unaryExpression, - variableDeclaration, - variableDeclarator -} = _t(); -const buildUmdWrapper = replacements => _template().default.statement` - (function (root, factory) { - if (typeof define === "function" && define.amd) { - define(AMD_ARGUMENTS, factory); - } else if (typeof exports === "object") { - factory(COMMON_ARGUMENTS); - } else { - factory(BROWSER_ARGUMENTS); - } - })(UMD_ROOT, function (FACTORY_PARAMETERS) { - FACTORY_BODY - }); - `(replacements); -function buildGlobal(allowlist) { - const namespace = identifier("babelHelpers"); - const body = []; - const container = functionExpression(null, [identifier("global")], blockStatement(body)); - const tree = program([expressionStatement(callExpression(container, [conditionalExpression(binaryExpression("===", unaryExpression("typeof", identifier("global")), stringLiteral("undefined")), identifier("self"), identifier("global"))]))]); - body.push(variableDeclaration("var", [variableDeclarator(namespace, assignmentExpression("=", memberExpression(identifier("global"), namespace), objectExpression([])))])); - buildHelpers(body, namespace, allowlist); - return tree; -} -function buildModule(allowlist) { - const body = []; - const refs = buildHelpers(body, null, allowlist); - body.unshift(exportNamedDeclaration(null, Object.keys(refs).map(name => { - return exportSpecifier(cloneNode(refs[name]), identifier(name)); - }))); - return program(body, [], "module"); -} -function buildUmd(allowlist) { - const namespace = identifier("babelHelpers"); - const body = []; - body.push(variableDeclaration("var", [variableDeclarator(namespace, identifier("global"))])); - buildHelpers(body, namespace, allowlist); - return program([buildUmdWrapper({ - FACTORY_PARAMETERS: identifier("global"), - BROWSER_ARGUMENTS: assignmentExpression("=", memberExpression(identifier("root"), namespace), objectExpression([])), - COMMON_ARGUMENTS: identifier("exports"), - AMD_ARGUMENTS: arrayExpression([stringLiteral("exports")]), - FACTORY_BODY: body, - UMD_ROOT: identifier("this") - })]); -} -function buildVar(allowlist) { - const namespace = identifier("babelHelpers"); - const body = []; - body.push(variableDeclaration("var", [variableDeclarator(namespace, objectExpression([]))])); - const tree = program(body); - buildHelpers(body, namespace, allowlist); - body.push(expressionStatement(namespace)); - return tree; -} -function buildHelpers(body, namespace, allowlist) { - const getHelperReference = name => { - return namespace ? memberExpression(namespace, identifier(name)) : identifier(`_${name}`); - }; - const refs = {}; - helpers().list.forEach(function (name) { - if (allowlist && allowlist.indexOf(name) < 0) return; - const ref = refs[name] = getHelperReference(name); - helpers().ensure(name, _file.default); - const { - nodes - } = helpers().get(name, getHelperReference, ref); - body.push(...nodes); - }); - return refs; -} -function _default(allowlist, outputType = "global") { - let tree; - const build = { - global: buildGlobal, - module: buildModule, - umd: buildUmd, - var: buildVar - }[outputType]; - if (build) { - tree = build(allowlist); - } else { - throw new Error(`Unsupported output type ${outputType}`); - } - return (0, _generator().default)(tree).code; -} -0 && 0; - -//# sourceMappingURL=build-external-helpers.js.map diff --git a/node_modules/@babel/core/lib/tools/build-external-helpers.js.map b/node_modules/@babel/core/lib/tools/build-external-helpers.js.map deleted file mode 100644 index 49f517717..000000000 --- a/node_modules/@babel/core/lib/tools/build-external-helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["helpers","data","require","_generator","_template","_t","_file","arrayExpression","assignmentExpression","binaryExpression","blockStatement","callExpression","cloneNode","conditionalExpression","exportNamedDeclaration","exportSpecifier","expressionStatement","functionExpression","identifier","memberExpression","objectExpression","program","stringLiteral","unaryExpression","variableDeclaration","variableDeclarator","buildUmdWrapper","replacements","template","statement","buildGlobal","allowlist","namespace","body","container","tree","push","buildHelpers","buildModule","refs","unshift","Object","keys","map","name","buildUmd","FACTORY_PARAMETERS","BROWSER_ARGUMENTS","COMMON_ARGUMENTS","AMD_ARGUMENTS","FACTORY_BODY","UMD_ROOT","buildVar","getHelperReference","list","forEach","indexOf","ref","ensure","File","nodes","get","_default","outputType","build","global","module","umd","var","Error","generator","code"],"sources":["../../src/tools/build-external-helpers.ts"],"sourcesContent":["import * as helpers from \"@babel/helpers\";\nimport generator from \"@babel/generator\";\nimport template from \"@babel/template\";\nimport {\n arrayExpression,\n assignmentExpression,\n binaryExpression,\n blockStatement,\n callExpression,\n cloneNode,\n conditionalExpression,\n exportNamedDeclaration,\n exportSpecifier,\n expressionStatement,\n functionExpression,\n identifier,\n memberExpression,\n objectExpression,\n program,\n stringLiteral,\n unaryExpression,\n variableDeclaration,\n variableDeclarator,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport File from \"../transformation/file/file\";\nimport type { PublicReplacements } from \"@babel/template/src/options\";\n\n// Wrapped to avoid wasting time parsing this when almost no-one uses\n// build-external-helpers.\nconst buildUmdWrapper = (replacements: PublicReplacements) =>\n template.statement`\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n `(replacements);\n\nfunction buildGlobal(allowlist?: Array) {\n const namespace = identifier(\"babelHelpers\");\n\n const body: t.Statement[] = [];\n const container = functionExpression(\n null,\n [identifier(\"global\")],\n blockStatement(body),\n );\n const tree = program([\n expressionStatement(\n callExpression(container, [\n // typeof global === \"undefined\" ? self : global\n conditionalExpression(\n binaryExpression(\n \"===\",\n unaryExpression(\"typeof\", identifier(\"global\")),\n stringLiteral(\"undefined\"),\n ),\n identifier(\"self\"),\n identifier(\"global\"),\n ),\n ]),\n ),\n ]);\n\n body.push(\n variableDeclaration(\"var\", [\n variableDeclarator(\n namespace,\n assignmentExpression(\n \"=\",\n memberExpression(identifier(\"global\"), namespace),\n objectExpression([]),\n ),\n ),\n ]),\n );\n\n buildHelpers(body, namespace, allowlist);\n\n return tree;\n}\n\nfunction buildModule(allowlist?: Array) {\n const body: t.Statement[] = [];\n const refs = buildHelpers(body, null, allowlist);\n\n body.unshift(\n exportNamedDeclaration(\n null,\n Object.keys(refs).map(name => {\n return exportSpecifier(cloneNode(refs[name]), identifier(name));\n }),\n ),\n );\n\n return program(body, [], \"module\");\n}\n\nfunction buildUmd(allowlist?: Array) {\n const namespace = identifier(\"babelHelpers\");\n\n const body: t.Statement[] = [];\n body.push(\n variableDeclaration(\"var\", [\n variableDeclarator(namespace, identifier(\"global\")),\n ]),\n );\n\n buildHelpers(body, namespace, allowlist);\n\n return program([\n buildUmdWrapper({\n FACTORY_PARAMETERS: identifier(\"global\"),\n BROWSER_ARGUMENTS: assignmentExpression(\n \"=\",\n memberExpression(identifier(\"root\"), namespace),\n objectExpression([]),\n ),\n COMMON_ARGUMENTS: identifier(\"exports\"),\n AMD_ARGUMENTS: arrayExpression([stringLiteral(\"exports\")]),\n FACTORY_BODY: body,\n UMD_ROOT: identifier(\"this\"),\n }),\n ]);\n}\n\nfunction buildVar(allowlist?: Array) {\n const namespace = identifier(\"babelHelpers\");\n\n const body: t.Statement[] = [];\n body.push(\n variableDeclaration(\"var\", [\n variableDeclarator(namespace, objectExpression([])),\n ]),\n );\n const tree = program(body);\n buildHelpers(body, namespace, allowlist);\n body.push(expressionStatement(namespace));\n return tree;\n}\n\nfunction buildHelpers(\n body: t.Statement[],\n namespace: t.Expression,\n allowlist?: Array,\n): Record;\nfunction buildHelpers(\n body: t.Statement[],\n namespace: null,\n allowlist?: Array,\n): Record;\n\nfunction buildHelpers(\n body: t.Statement[],\n namespace: t.Expression | null,\n allowlist?: Array,\n) {\n const getHelperReference = (name: string) => {\n return namespace\n ? memberExpression(namespace, identifier(name))\n : identifier(`_${name}`);\n };\n\n const refs: { [key: string]: t.Identifier | t.MemberExpression } = {};\n helpers.list.forEach(function (name) {\n if (allowlist && allowlist.indexOf(name) < 0) return;\n\n const ref = (refs[name] = getHelperReference(name));\n\n helpers.ensure(name, File);\n const { nodes } = helpers.get(name, getHelperReference, ref);\n\n body.push(...nodes);\n });\n return refs;\n}\nexport default function (\n allowlist?: Array,\n outputType: \"global\" | \"module\" | \"umd\" | \"var\" = \"global\",\n) {\n let tree: t.Program;\n\n const build = {\n global: buildGlobal,\n module: buildModule,\n umd: buildUmd,\n var: buildVar,\n }[outputType];\n\n if (build) {\n tree = build(allowlist);\n } else {\n throw new Error(`Unsupported output type ${outputType}`);\n }\n\n return generator(tree).code;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,GAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,EAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAsBA,IAAAK,KAAA,GAAAJ,OAAA;AAA+C;EArB7CK,eAAe;EACfC,oBAAoB;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,cAAc;EACdC,SAAS;EACTC,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AG,CAAC;IAE5DxB,IAAI,CAACG,IAAI,CAAC,GAAGwB,KAAK,CAAC;EACrB,CAAC,CAAC;EACF,OAAOrB,IAAI;AACb;AACe,SAAAuB,SACb/B,SAAyB,EACzBgC,UAA+C,GAAG,QAAQ,EAC1D;EACA,IAAI5B,IAAe;EAEnB,MAAM6B,KAAK,GAAG;IACZC,MAAM,EAAEnC,WAAW;IACnBoC,MAAM,EAAE5B,WAAW;IACnB6B,GAAG,EAAEtB,QAAQ;IACbuB,GAAG,EAAEhB;EACP,CAAC,CAACW,UAAU,CAAC;EAEb,IAAIC,KAAK,EAAE;IACT7B,IAAI,GAAG6B,KAAK,CAACjC,SAAS,CAAC;EACzB,CAAC,MAAM;IACL,MAAM,IAAIsC,KAAK,CAAE,2BAA0BN,UAAW,EAAC,CAAC;EAC1D;EAEA,OAAO,IAAAO,oBAAS,EAACnC,IAAI,CAAC,CAACoC,IAAI;AAC7B;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transform-ast.js b/node_modules/@babel/core/lib/transform-ast.js deleted file mode 100644 index ac9819b7a..000000000 --- a/node_modules/@babel/core/lib/transform-ast.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.transformFromAst = void 0; -exports.transformFromAstAsync = transformFromAstAsync; -exports.transformFromAstSync = transformFromAstSync; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _config = require("./config"); -var _transformation = require("./transformation"); -var _rewriteStackTrace = require("./errors/rewrite-stack-trace"); -const transformFromAstRunner = _gensync()(function* (ast, code, opts) { - const config = yield* (0, _config.default)(opts); - if (config === null) return null; - if (!ast) throw new Error("No AST given"); - return yield* (0, _transformation.run)(config, code, ast); -}); -const transformFromAst = function transformFromAst(ast, code, optsOrCallback, maybeCallback) { - let opts; - let callback; - if (typeof optsOrCallback === "function") { - callback = optsOrCallback; - opts = undefined; - } else { - opts = optsOrCallback; - callback = maybeCallback; - } - if (callback === undefined) { - { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(ast, code, opts); - } - } - (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.errback)(ast, code, opts, callback); -}; -exports.transformFromAst = transformFromAst; -function transformFromAstSync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(...args); -} -function transformFromAstAsync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.async)(...args); -} -0 && 0; - -//# sourceMappingURL=transform-ast.js.map diff --git a/node_modules/@babel/core/lib/transform-ast.js.map b/node_modules/@babel/core/lib/transform-ast.js.map deleted file mode 100644 index 09dca7124..000000000 --- a/node_modules/@babel/core/lib/transform-ast.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","_config","_transformation","_rewriteStackTrace","transformFromAstRunner","gensync","ast","code","opts","config","loadConfig","Error","run","transformFromAst","optsOrCallback","maybeCallback","callback","undefined","beginHiddenCallStack","sync","errback","exports","transformFromAstSync","args","transformFromAstAsync","async"],"sources":["../src/transform-ast.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions, ResolvedConfig } from \"./config\";\nimport { run } from \"./transformation\";\nimport type * as t from \"@babel/types\";\n\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace\";\n\nimport type { FileResult, FileResultCallback } from \"./transformation\";\ntype AstRoot = t.File | t.Program;\n\ntype TransformFromAst = {\n (ast: AstRoot, code: string, callback: FileResultCallback): void;\n (\n ast: AstRoot,\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n ): void;\n (ast: AstRoot, code: string, opts?: InputOptions | null): FileResult | null;\n};\n\nconst transformFromAstRunner = gensync(function* (\n ast: AstRoot,\n code: string,\n opts: InputOptions | undefined | null,\n): Handler {\n const config: ResolvedConfig | null = yield* loadConfig(opts);\n if (config === null) return null;\n\n if (!ast) throw new Error(\"No AST given\");\n\n return yield* run(config, code, ast);\n});\n\nexport const transformFromAst: TransformFromAst = function transformFromAst(\n ast,\n code,\n optsOrCallback?: InputOptions | null | undefined | FileResultCallback,\n maybeCallback?: FileResultCallback,\n) {\n let opts: InputOptions | undefined | null;\n let callback: FileResultCallback | undefined;\n if (typeof optsOrCallback === \"function\") {\n callback = optsOrCallback;\n opts = undefined;\n } else {\n opts = optsOrCallback;\n callback = maybeCallback;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'transformFromAst' function expects a callback. If you need to call it synchronously, please use 'transformFromAstSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'transformFromAst' function will expect a callback. If you need to call it synchronously, please use 'transformFromAstSync'.\",\n // );\n return beginHiddenCallStack(transformFromAstRunner.sync)(ast, code, opts);\n }\n }\n\n beginHiddenCallStack(transformFromAstRunner.errback)(\n ast,\n code,\n opts,\n callback,\n );\n};\n\nexport function transformFromAstSync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformFromAstRunner.sync)(...args);\n}\n\nexport function transformFromAstAsync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformFromAstRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,OAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAF,OAAA;AAGA,IAAAG,kBAAA,GAAAH,OAAA;AAgBA,MAAMI,sBAAsB,GAAGC,UAAO,CAAC,WACrCC,GAAY,EACZC,IAAY,EACZC,IAAqC,EACT;EAC5B,MAAMC,MAA6B,GAAG,OAAO,IAAAC,eAAU,EAACF,IAAI,CAAC;EAC7D,IAAIC,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI;EAEhC,IAAI,CAACH,GAAG,EAAE,MAAM,IAAIK,KAAK,CAAC,cAAc,CAAC;EAEzC,OAAO,OAAO,IAAAC,mBAAG,EAACH,MAAM,EAAEF,IAAI,EAAED,GAAG,CAAC;AACtC,CAAC,CAAC;AAEK,MAAMO,gBAAkC,GAAG,SAASA,gBAAgBA,CACzEP,GAAG,EACHC,IAAI,EACJO,cAAqE,EACrEC,aAAkC,EAClC;EACA,IAAIP,IAAqC;EACzC,IAAIQ,QAAwC;EAC5C,IAAI,OAAOF,cAAc,KAAK,UAAU,EAAE;IACxCE,QAAQ,GAAGF,cAAc;IACzBN,IAAI,GAAGS,SAAS;EAClB,CAAC,MAAM;IACLT,IAAI,GAAGM,cAAc;IACrBE,QAAQ,GAAGD,aAAa;EAC1B;EAEA,IAAIC,QAAQ,KAAKC,SAAS,EAAE;IAKnB;MAIL,OAAO,IAAAC,uCAAoB,EAACd,sBAAsB,CAACe,IAAI,CAAC,CAACb,GAAG,EAAEC,IAAI,EAAEC,IAAI,CAAC;IAC3E;EACF;EAEA,IAAAU,uCAAoB,EAACd,sBAAsB,CAACgB,OAAO,CAAC,CAClDd,GAAG,EACHC,IAAI,EACJC,IAAI,EACJQ,QAAQ,CACT;AACH,CAAC;AAACK,OAAA,CAAAR,gBAAA,GAAAA,gBAAA;AAEK,SAASS,oBAAoBA,CAClC,GAAGC,IAAoD,EACvD;EACA,OAAO,IAAAL,uCAAoB,EAACd,sBAAsB,CAACe,IAAI,CAAC,CAAC,GAAGI,IAAI,CAAC;AACnE;AAEO,SAASC,qBAAqBA,CACnC,GAAGD,IAAqD,EACxD;EACA,OAAO,IAAAL,uCAAoB,EAACd,sBAAsB,CAACqB,KAAK,CAAC,CAAC,GAAGF,IAAI,CAAC;AACpE;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transform-file-browser.js b/node_modules/@babel/core/lib/transform-file-browser.js deleted file mode 100644 index f81925ad2..000000000 --- a/node_modules/@babel/core/lib/transform-file-browser.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.transformFile = void 0; -exports.transformFileAsync = transformFileAsync; -exports.transformFileSync = transformFileSync; -const transformFile = function transformFile(filename, opts, callback) { - if (typeof opts === "function") { - callback = opts; - } - callback(new Error("Transforming files is not supported in browsers"), null); -}; -exports.transformFile = transformFile; -function transformFileSync() { - throw new Error("Transforming files is not supported in browsers"); -} -function transformFileAsync() { - return Promise.reject(new Error("Transforming files is not supported in browsers")); -} -0 && 0; - -//# sourceMappingURL=transform-file-browser.js.map diff --git a/node_modules/@babel/core/lib/transform-file-browser.js.map b/node_modules/@babel/core/lib/transform-file-browser.js.map deleted file mode 100644 index e24820f92..000000000 --- a/node_modules/@babel/core/lib/transform-file-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["transformFile","filename","opts","callback","Error","exports","transformFileSync","transformFileAsync","Promise","reject"],"sources":["../src/transform-file-browser.ts"],"sourcesContent":["// duplicated from transform-file so we do not have to import anything here\ntype TransformFile = {\n (filename: string, callback: (error: Error, file: null) => void): void;\n (\n filename: string,\n opts: any,\n callback: (error: Error, file: null) => void,\n ): void;\n};\n\nexport const transformFile: TransformFile = function transformFile(\n filename,\n opts,\n callback?: (error: Error, file: null) => void,\n) {\n if (typeof opts === \"function\") {\n callback = opts;\n }\n\n callback(new Error(\"Transforming files is not supported in browsers\"), null);\n};\n\nexport function transformFileSync(): never {\n throw new Error(\"Transforming files is not supported in browsers\");\n}\n\nexport function transformFileAsync() {\n return Promise.reject(\n new Error(\"Transforming files is not supported in browsers\"),\n );\n}\n"],"mappings":";;;;;;;;AAUO,MAAMA,aAA4B,GAAG,SAASA,aAAaA,CAChEC,QAAQ,EACRC,IAAI,EACJC,QAA6C,EAC7C;EACA,IAAI,OAAOD,IAAI,KAAK,UAAU,EAAE;IAC9BC,QAAQ,GAAGD,IAAI;EACjB;EAEAC,QAAQ,CAAC,IAAIC,KAAK,CAAC,iDAAiD,CAAC,EAAE,IAAI,CAAC;AAC9E,CAAC;AAACC,OAAA,CAAAL,aAAA,GAAAA,aAAA;AAEK,SAASM,iBAAiBA,CAAA,EAAU;EACzC,MAAM,IAAIF,KAAK,CAAC,iDAAiD,CAAC;AACpE;AAEO,SAASG,kBAAkBA,CAAA,EAAG;EACnC,OAAOC,OAAO,CAACC,MAAM,CACnB,IAAIL,KAAK,CAAC,iDAAiD,CAAC,CAC7D;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transform-file.js b/node_modules/@babel/core/lib/transform-file.js deleted file mode 100644 index d08a85f92..000000000 --- a/node_modules/@babel/core/lib/transform-file.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.transformFile = transformFile; -exports.transformFileAsync = transformFileAsync; -exports.transformFileSync = transformFileSync; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _config = require("./config"); -var _transformation = require("./transformation"); -var fs = require("./gensync-utils/fs"); -({}); -const transformFileRunner = _gensync()(function* (filename, opts) { - const options = Object.assign({}, opts, { - filename - }); - const config = yield* (0, _config.default)(options); - if (config === null) return null; - const code = yield* fs.readFile(filename, "utf8"); - return yield* (0, _transformation.run)(config, code); -}); -function transformFile(...args) { - transformFileRunner.errback(...args); -} -function transformFileSync(...args) { - return transformFileRunner.sync(...args); -} -function transformFileAsync(...args) { - return transformFileRunner.async(...args); -} -0 && 0; - -//# sourceMappingURL=transform-file.js.map diff --git a/node_modules/@babel/core/lib/transform-file.js.map b/node_modules/@babel/core/lib/transform-file.js.map deleted file mode 100644 index 4e33b98dd..000000000 --- a/node_modules/@babel/core/lib/transform-file.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","_config","_transformation","fs","transformFileRunner","gensync","filename","opts","options","Object","assign","config","loadConfig","code","readFile","run","transformFile","args","errback","transformFileSync","sync","transformFileAsync","async"],"sources":["../src/transform-file.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions, ResolvedConfig } from \"./config\";\nimport { run } from \"./transformation\";\nimport type { FileResult, FileResultCallback } from \"./transformation\";\nimport * as fs from \"./gensync-utils/fs\";\n\ntype transformFileBrowserType = typeof import(\"./transform-file-browser\");\ntype transformFileType = typeof import(\"./transform-file\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of transform-file-browser, since this file may be replaced at bundle time with\n// transform-file-browser.\n({}) as any as transformFileBrowserType as transformFileType;\n\nconst transformFileRunner = gensync(function* (\n filename: string,\n opts?: InputOptions,\n): Handler {\n const options = { ...opts, filename };\n\n const config: ResolvedConfig | null = yield* loadConfig(options);\n if (config === null) return null;\n\n const code = yield* fs.readFile(filename, \"utf8\");\n return yield* run(config, code);\n});\n\n// @ts-expect-error TS doesn't detect that this signature is compatible\nexport function transformFile(\n filename: string,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n filename: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n ...args: Parameters\n) {\n transformFileRunner.errback(...args);\n}\n\nexport function transformFileSync(\n ...args: Parameters\n) {\n return transformFileRunner.sync(...args);\n}\nexport function transformFileAsync(\n ...args: Parameters\n) {\n return transformFileRunner.async(...args);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,OAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAF,OAAA;AAEA,IAAAG,EAAA,GAAAH,OAAA;AAQA,CAAC,CAAC,CAAC;AAEH,MAAMI,mBAAmB,GAAGC,UAAO,CAAC,WAClCC,QAAgB,EAChBC,IAAmB,EACS;EAC5B,MAAMC,OAAO,GAAAC,MAAA,CAAAC,MAAA,KAAQH,IAAI;IAAED;EAAQ,EAAE;EAErC,MAAMK,MAA6B,GAAG,OAAO,IAAAC,eAAU,EAACJ,OAAO,CAAC;EAChE,IAAIG,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI;EAEhC,MAAME,IAAI,GAAG,OAAOV,EAAE,CAACW,QAAQ,CAACR,QAAQ,EAAE,MAAM,CAAC;EACjD,OAAO,OAAO,IAAAS,mBAAG,EAACJ,MAAM,EAAEE,IAAI,CAAC;AACjC,CAAC,CAAC;AAYK,SAASG,aAAaA,CAC3B,GAAGC,IAAoD,EACvD;EACAb,mBAAmB,CAACc,OAAO,CAAC,GAAGD,IAAI,CAAC;AACtC;AAEO,SAASE,iBAAiBA,CAC/B,GAAGF,IAAiD,EACpD;EACA,OAAOb,mBAAmB,CAACgB,IAAI,CAAC,GAAGH,IAAI,CAAC;AAC1C;AACO,SAASI,kBAAkBA,CAChC,GAAGJ,IAAkD,EACrD;EACA,OAAOb,mBAAmB,CAACkB,KAAK,CAAC,GAAGL,IAAI,CAAC;AAC3C;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transform.js b/node_modules/@babel/core/lib/transform.js deleted file mode 100644 index e523a5337..000000000 --- a/node_modules/@babel/core/lib/transform.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.transform = void 0; -exports.transformAsync = transformAsync; -exports.transformSync = transformSync; -function _gensync() { - const data = require("gensync"); - _gensync = function () { - return data; - }; - return data; -} -var _config = require("./config"); -var _transformation = require("./transformation"); -var _rewriteStackTrace = require("./errors/rewrite-stack-trace"); -const transformRunner = _gensync()(function* transform(code, opts) { - const config = yield* (0, _config.default)(opts); - if (config === null) return null; - return yield* (0, _transformation.run)(config, code); -}); -const transform = function transform(code, optsOrCallback, maybeCallback) { - let opts; - let callback; - if (typeof optsOrCallback === "function") { - callback = optsOrCallback; - opts = undefined; - } else { - opts = optsOrCallback; - callback = maybeCallback; - } - if (callback === undefined) { - { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(code, opts); - } - } - (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.errback)(code, opts, callback); -}; -exports.transform = transform; -function transformSync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(...args); -} -function transformAsync(...args) { - return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.async)(...args); -} -0 && 0; - -//# sourceMappingURL=transform.js.map diff --git a/node_modules/@babel/core/lib/transform.js.map b/node_modules/@babel/core/lib/transform.js.map deleted file mode 100644 index 3d6aadb18..000000000 --- a/node_modules/@babel/core/lib/transform.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_gensync","data","require","_config","_transformation","_rewriteStackTrace","transformRunner","gensync","transform","code","opts","config","loadConfig","run","optsOrCallback","maybeCallback","callback","undefined","beginHiddenCallStack","sync","errback","exports","transformSync","args","transformAsync","async"],"sources":["../src/transform.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions, ResolvedConfig } from \"./config\";\nimport { run } from \"./transformation\";\n\nimport type { FileResult, FileResultCallback } from \"./transformation\";\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace\";\n\nexport type { FileResult } from \"./transformation\";\n\ntype Transform = {\n (code: string, callback: FileResultCallback): void;\n (\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n ): void;\n (code: string, opts?: InputOptions | null): FileResult | null;\n};\n\nconst transformRunner = gensync(function* transform(\n code: string,\n opts?: InputOptions,\n): Handler {\n const config: ResolvedConfig | null = yield* loadConfig(opts);\n if (config === null) return null;\n\n return yield* run(config, code);\n});\n\nexport const transform: Transform = function transform(\n code,\n optsOrCallback?: InputOptions | null | undefined | FileResultCallback,\n maybeCallback?: FileResultCallback,\n) {\n let opts: InputOptions | undefined | null;\n let callback: FileResultCallback | undefined;\n if (typeof optsOrCallback === \"function\") {\n callback = optsOrCallback;\n opts = undefined;\n } else {\n opts = optsOrCallback;\n callback = maybeCallback;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'transform' function expects a callback. If you need to call it synchronously, please use 'transformSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'transform' function will expect a callback. If you need to call it synchronously, please use 'transformSync'.\",\n // );\n return beginHiddenCallStack(transformRunner.sync)(code, opts);\n }\n }\n\n beginHiddenCallStack(transformRunner.errback)(code, opts, callback);\n};\n\nexport function transformSync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformRunner.sync)(...args);\n}\nexport function transformAsync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,OAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAF,OAAA;AAGA,IAAAG,kBAAA,GAAAH,OAAA;AAcA,MAAMI,eAAe,GAAGC,UAAO,CAAC,UAAUC,SAASA,CACjDC,IAAY,EACZC,IAAmB,EACS;EAC5B,MAAMC,MAA6B,GAAG,OAAO,IAAAC,eAAU,EAACF,IAAI,CAAC;EAC7D,IAAIC,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI;EAEhC,OAAO,OAAO,IAAAE,mBAAG,EAACF,MAAM,EAAEF,IAAI,CAAC;AACjC,CAAC,CAAC;AAEK,MAAMD,SAAoB,GAAG,SAASA,SAASA,CACpDC,IAAI,EACJK,cAAqE,EACrEC,aAAkC,EAClC;EACA,IAAIL,IAAqC;EACzC,IAAIM,QAAwC;EAC5C,IAAI,OAAOF,cAAc,KAAK,UAAU,EAAE;IACxCE,QAAQ,GAAGF,cAAc;IACzBJ,IAAI,GAAGO,SAAS;EAClB,CAAC,MAAM;IACLP,IAAI,GAAGI,cAAc;IACrBE,QAAQ,GAAGD,aAAa;EAC1B;EAEA,IAAIC,QAAQ,KAAKC,SAAS,EAAE;IAKnB;MAIL,OAAO,IAAAC,uCAAoB,EAACZ,eAAe,CAACa,IAAI,CAAC,CAACV,IAAI,EAAEC,IAAI,CAAC;IAC/D;EACF;EAEA,IAAAQ,uCAAoB,EAACZ,eAAe,CAACc,OAAO,CAAC,CAACX,IAAI,EAAEC,IAAI,EAAEM,QAAQ,CAAC;AACrE,CAAC;AAACK,OAAA,CAAAb,SAAA,GAAAA,SAAA;AAEK,SAASc,aAAaA,CAC3B,GAAGC,IAA6C,EAChD;EACA,OAAO,IAAAL,uCAAoB,EAACZ,eAAe,CAACa,IAAI,CAAC,CAAC,GAAGI,IAAI,CAAC;AAC5D;AACO,SAASC,cAAcA,CAC5B,GAAGD,IAA8C,EACjD;EACA,OAAO,IAAAL,uCAAoB,EAACZ,eAAe,CAACmB,KAAK,CAAC,CAAC,GAAGF,IAAI,CAAC;AAC7D;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js b/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js deleted file mode 100644 index d0ac93f38..000000000 --- a/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = loadBlockHoistPlugin; -function _traverse() { - const data = require("@babel/traverse"); - _traverse = function () { - return data; - }; - return data; -} -var _plugin = require("../config/plugin"); -let LOADED_PLUGIN; -const blockHoistPlugin = { - name: "internal.blockHoist", - visitor: { - Block: { - exit({ - node - }) { - const { - body - } = node; - let max = Math.pow(2, 30) - 1; - let hasChange = false; - for (let i = 0; i < body.length; i++) { - const n = body[i]; - const p = priority(n); - if (p > max) { - hasChange = true; - break; - } - max = p; - } - if (!hasChange) return; - node.body = stableSort(body.slice()); - } - } - } -}; -function loadBlockHoistPlugin() { - if (!LOADED_PLUGIN) { - LOADED_PLUGIN = new _plugin.default(Object.assign({}, blockHoistPlugin, { - visitor: _traverse().default.explode(blockHoistPlugin.visitor) - }), {}); - } - return LOADED_PLUGIN; -} -function priority(bodyNode) { - const priority = bodyNode == null ? void 0 : bodyNode._blockHoist; - if (priority == null) return 1; - if (priority === true) return 2; - return priority; -} -function stableSort(body) { - const buckets = Object.create(null); - for (let i = 0; i < body.length; i++) { - const n = body[i]; - const p = priority(n); - const bucket = buckets[p] || (buckets[p] = []); - bucket.push(n); - } - const keys = Object.keys(buckets).map(k => +k).sort((a, b) => b - a); - let index = 0; - for (const key of keys) { - const bucket = buckets[key]; - for (const n of bucket) { - body[index++] = n; - } - } - return body; -} -0 && 0; - -//# sourceMappingURL=block-hoist-plugin.js.map diff --git a/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map b/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map deleted file mode 100644 index 178dd7886..000000000 --- a/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_traverse","data","require","_plugin","LOADED_PLUGIN","blockHoistPlugin","name","visitor","Block","exit","node","body","max","Math","pow","hasChange","i","length","n","p","priority","stableSort","slice","loadBlockHoistPlugin","Plugin","Object","assign","traverse","explode","bodyNode","_blockHoist","buckets","create","bucket","push","keys","map","k","sort","a","b","index","key"],"sources":["../../src/transformation/block-hoist-plugin.ts"],"sourcesContent":["import traverse from \"@babel/traverse\";\nimport type { Statement } from \"@babel/types\";\nimport type { PluginObject } from \"../config\";\nimport Plugin from \"../config/plugin\";\n\nlet LOADED_PLUGIN: Plugin | void;\n\nconst blockHoistPlugin: PluginObject = {\n /**\n * [Please add a description.]\n *\n * Priority:\n *\n * - 0 We want this to be at the **very** bottom\n * - 1 Default node position\n * - 2 Priority over normal nodes\n * - 3 We want this to be at the **very** top\n * - 4 Reserved for the helpers used to implement module imports.\n */\n\n name: \"internal.blockHoist\",\n\n visitor: {\n Block: {\n exit({ node }) {\n const { body } = node;\n\n // Largest SMI\n let max = 2 ** 30 - 1;\n let hasChange = false;\n for (let i = 0; i < body.length; i++) {\n const n = body[i];\n const p = priority(n);\n if (p > max) {\n hasChange = true;\n break;\n }\n max = p;\n }\n if (!hasChange) return;\n\n // My kingdom for a stable sort!\n node.body = stableSort(body.slice());\n },\n },\n },\n};\n\nexport default function loadBlockHoistPlugin(): Plugin {\n if (!LOADED_PLUGIN) {\n // cache the loaded blockHoist plugin plugin\n LOADED_PLUGIN = new Plugin(\n {\n ...blockHoistPlugin,\n visitor: traverse.explode(blockHoistPlugin.visitor),\n },\n {},\n );\n }\n\n return LOADED_PLUGIN;\n}\n\nfunction priority(bodyNode: Statement & { _blockHoist?: number | true }) {\n const priority = bodyNode?._blockHoist;\n if (priority == null) return 1;\n if (priority === true) return 2;\n return priority;\n}\n\nfunction stableSort(body: Statement[]) {\n // By default, we use priorities of 0-4.\n const buckets = Object.create(null);\n\n // By collecting into buckets, we can guarantee a stable sort.\n for (let i = 0; i < body.length; i++) {\n const n = body[i];\n const p = priority(n);\n\n // In case some plugin is setting an unexpected priority.\n const bucket = buckets[p] || (buckets[p] = []);\n bucket.push(n);\n }\n\n // Sort our keys in descending order. Keys are unique, so we don't have to\n // worry about stability.\n const keys = Object.keys(buckets)\n .map(k => +k)\n .sort((a, b) => b - a);\n\n let index = 0;\n for (const key of keys) {\n const bucket = buckets[key];\n for (const n of bucket) {\n body[index++] = n;\n }\n }\n return body;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,IAAAE,OAAA,GAAAD,OAAA;AAEA,IAAIE,aAA4B;AAEhC,MAAMC,gBAA8B,GAAG;EAarCC,IAAI,EAAE,qBAAqB;EAE3BC,OAA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AM,CAACO,MAAM,CAAC,IAAI,CAAC;EAGnC,KAAK,IAAIhB,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,IAAI,CAACM,MAAM,EAAED,CAAC,EAAE,EAAE;IACpC,MAAME,CAAC,GAAGP,IAAI,CAACK,CAAC,CAAC;IACjB,MAAMG,CAAC,GAAGC,QAAQ,CAACF,CAAC,CAAC;IAGrB,MAAMe,MAAM,GAAGF,OAAO,CAACZ,CAAC,CAAC,KAAKY,OAAO,CAACZ,CAAC,CAAC,GAAG,EAAE,CAAC;IAC9Cc,MAAM,CAACC,IAAI,CAAChB,CAAC,CAAC;EAChB;EAIA,MAAMiB,IAAI,GAAGV,MAAM,CAACU,IAAI,CAACJ,OAAO,CAAC,CAC9BK,GAAG,CAACC,CAAC,IAAI,CAACA,CAAC,CAAC,CACZC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKA,CAAC,GAAGD,CAAC,CAAC;EAExB,IAAIE,KAAK,GAAG,CAAC;EACb,KAAK,MAAMC,GAAG,IAAIP,IAAI,EAAE;IACtB,MAAMF,MAAM,GAAGF,OAAO,CAACW,GAAG,CAAC;IAC3B,KAAK,MAAMxB,CAAC,IAAIe,MAAM,EAAE;MACtBtB,IAAI,CAAC8B,KAAK,EAAE,CAAC,GAAGvB,CAAC;IACnB;EACF;EACA,OAAOP,IAAI;AACb;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/file/file.js b/node_modules/@babel/core/lib/transformation/file/file.js deleted file mode 100644 index eea4fd4be..000000000 --- a/node_modules/@babel/core/lib/transformation/file/file.js +++ /dev/null @@ -1,211 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -function helpers() { - const data = require("@babel/helpers"); - helpers = function () { - return data; - }; - return data; -} -function _traverse() { - const data = require("@babel/traverse"); - _traverse = function () { - return data; - }; - return data; -} -function _codeFrame() { - const data = require("@babel/code-frame"); - _codeFrame = function () { - return data; - }; - return data; -} -function _t() { - const data = require("@babel/types"); - _t = function () { - return data; - }; - return data; -} -function _helperModuleTransforms() { - const data = require("@babel/helper-module-transforms"); - _helperModuleTransforms = function () { - return data; - }; - return data; -} -function _semver() { - const data = require("semver"); - _semver = function () { - return data; - }; - return data; -} -const { - cloneNode, - interpreterDirective -} = _t(); -const errorVisitor = { - enter(path, state) { - const loc = path.node.loc; - if (loc) { - state.loc = loc; - path.stop(); - } - } -}; -class File { - constructor(options, { - code, - ast, - inputMap - }) { - this._map = new Map(); - this.opts = void 0; - this.declarations = {}; - this.path = void 0; - this.ast = void 0; - this.scope = void 0; - this.metadata = {}; - this.code = ""; - this.inputMap = void 0; - this.hub = { - file: this, - getCode: () => this.code, - getScope: () => this.scope, - addHelper: this.addHelper.bind(this), - buildError: this.buildCodeFrameError.bind(this) - }; - this.opts = options; - this.code = code; - this.ast = ast; - this.inputMap = inputMap; - this.path = _traverse().NodePath.get({ - hub: this.hub, - parentPath: null, - parent: this.ast, - container: this.ast, - key: "program" - }).setContext(); - this.scope = this.path.scope; - } - get shebang() { - const { - interpreter - } = this.path.node; - return interpreter ? interpreter.value : ""; - } - set shebang(value) { - if (value) { - this.path.get("interpreter").replaceWith(interpreterDirective(value)); - } else { - this.path.get("interpreter").remove(); - } - } - set(key, val) { - if (key === "helpersNamespace") { - throw new Error("Babel 7.0.0-beta.56 has dropped support for the 'helpersNamespace' utility." + "If you are using @babel/plugin-external-helpers you will need to use a newer " + "version than the one you currently have installed. " + "If you have your own implementation, you'll want to explore using 'helperGenerator' " + "alongside 'file.availableHelper()'."); - } - this._map.set(key, val); - } - get(key) { - return this._map.get(key); - } - has(key) { - return this._map.has(key); - } - getModuleName() { - return (0, _helperModuleTransforms().getModuleName)(this.opts, this.opts); - } - addImport() { - throw new Error("This API has been removed. If you're looking for this " + "functionality in Babel 7, you should import the " + "'@babel/helper-module-imports' module and use the functions exposed " + " from that module, such as 'addNamed' or 'addDefault'."); - } - availableHelper(name, versionRange) { - let minVersion; - try { - minVersion = helpers().minVersion(name); - } catch (err) { - if (err.code !== "BABEL_HELPER_UNKNOWN") throw err; - return false; - } - if (typeof versionRange !== "string") return true; - if (_semver().valid(versionRange)) versionRange = `^${versionRange}`; - return !_semver().intersects(`<${minVersion}`, versionRange) && !_semver().intersects(`>=8.0.0`, versionRange); - } - addHelper(name) { - const declar = this.declarations[name]; - if (declar) return cloneNode(declar); - const generator = this.get("helperGenerator"); - if (generator) { - const res = generator(name); - if (res) return res; - } - helpers().ensure(name, File); - const uid = this.declarations[name] = this.scope.generateUidIdentifier(name); - const dependencies = {}; - for (const dep of helpers().getDependencies(name)) { - dependencies[dep] = this.addHelper(dep); - } - const { - nodes, - globals - } = helpers().get(name, dep => dependencies[dep], uid, Object.keys(this.scope.getAllBindings())); - globals.forEach(name => { - if (this.path.scope.hasBinding(name, true)) { - this.path.scope.rename(name); - } - }); - nodes.forEach(node => { - node._compact = true; - }); - this.path.unshiftContainer("body", nodes); - this.path.get("body").forEach(path => { - if (nodes.indexOf(path.node) === -1) return; - if (path.isVariableDeclaration()) this.scope.registerDeclaration(path); - }); - return uid; - } - addTemplateObject() { - throw new Error("This function has been moved into the template literal transform itself."); - } - buildCodeFrameError(node, msg, _Error = SyntaxError) { - let loc = node && (node.loc || node._loc); - if (!loc && node) { - const state = { - loc: null - }; - (0, _traverse().default)(node, errorVisitor, this.scope, state); - loc = state.loc; - let txt = "This is an error on an internal node. Probably an internal error."; - if (loc) txt += " Location has been estimated."; - msg += ` (${txt})`; - } - if (loc) { - const { - highlightCode = true - } = this.opts; - msg += "\n" + (0, _codeFrame().codeFrameColumns)(this.code, { - start: { - line: loc.start.line, - column: loc.start.column + 1 - }, - end: loc.end && loc.start.line === loc.end.line ? { - line: loc.end.line, - column: loc.end.column + 1 - } : undefined - }, { - highlightCode - }); - } - return new _Error(msg); - } -} -exports.default = File; -0 && 0; - -//# sourceMappingURL=file.js.map diff --git a/node_modules/@babel/core/lib/transformation/file/file.js.map b/node_modules/@babel/core/lib/transformation/file/file.js.map deleted file mode 100644 index 077c66499..000000000 --- a/node_modules/@babel/core/lib/transformation/file/file.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["helpers","data","require","_traverse","_codeFrame","_t","_helperModuleTransforms","_semver","cloneNode","interpreterDirective","errorVisitor","enter","path","state","loc","node","stop","File","constructor","options","code","ast","inputMap","_map","Map","opts","declarations","scope","metadata","hub","file","getCode","getScope","addHelper","bind","buildError","buildCodeFrameError","NodePath","get","parentPath","parent","container","key","setContext","shebang","interpreter","value","replaceWith","remove","set","val","Error","has","getModuleName","addImport","availableHelper","name","versionRange","minVersion","err","semver","valid","intersects","declar","generator","res","ensure","uid","generateUidIdentifier","dependencies","dep","getDependencies","nodes","globals","Object","keys","getAllBindings","forEach","hasBinding","rename","_compact","unshiftContainer","indexOf","isVariableDeclaration","registerDeclaration","addTemplateObject","msg","_Error","SyntaxError","_loc","traverse","txt","highlightCode","codeFrameColumns","start","line","column","end","undefined","exports","default"],"sources":["../../../src/transformation/file/file.ts"],"sourcesContent":["import * as helpers from \"@babel/helpers\";\nimport { NodePath } from \"@babel/traverse\";\nimport type { HubInterface, Visitor, Scope } from \"@babel/traverse\";\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport traverse from \"@babel/traverse\";\nimport { cloneNode, interpreterDirective } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { getModuleName } from \"@babel/helper-module-transforms\";\nimport semver from \"semver\";\n\nimport type { NormalizedFile } from \"../normalize-file\";\n\nconst errorVisitor: Visitor<{ loc: NodeLocation[\"loc\"] | null }> = {\n enter(path, state) {\n const loc = path.node.loc;\n if (loc) {\n state.loc = loc;\n path.stop();\n }\n },\n};\n\nexport type NodeLocation = {\n loc?: {\n end?: {\n line: number;\n column: number;\n };\n start: {\n line: number;\n column: number;\n };\n };\n _loc?: {\n end?: {\n line: number;\n column: number;\n };\n start: {\n line: number;\n column: number;\n };\n };\n};\n\nexport default class File {\n _map: Map = new Map();\n opts: { [key: string]: any };\n declarations: { [key: string]: t.Identifier } = {};\n path: NodePath;\n ast: t.File;\n scope: Scope;\n metadata: { [key: string]: any } = {};\n code: string = \"\";\n inputMap: any;\n\n hub: HubInterface & { file: File } = {\n // keep it for the usage in babel-core, ex: path.hub.file.opts.filename\n file: this,\n getCode: () => this.code,\n getScope: () => this.scope,\n addHelper: this.addHelper.bind(this),\n buildError: this.buildCodeFrameError.bind(this),\n };\n\n constructor(options: {}, { code, ast, inputMap }: NormalizedFile) {\n this.opts = options;\n this.code = code;\n this.ast = ast;\n this.inputMap = inputMap;\n\n this.path = NodePath.get({\n hub: this.hub,\n parentPath: null,\n parent: this.ast,\n container: this.ast,\n key: \"program\",\n }).setContext() as NodePath;\n this.scope = this.path.scope;\n }\n\n /**\n * Provide backward-compatible access to the interpreter directive handling\n * in Babel 6.x. If you are writing a plugin for Babel 7.x, it would be\n * best to use 'program.interpreter' directly.\n */\n get shebang(): string {\n const { interpreter } = this.path.node;\n return interpreter ? interpreter.value : \"\";\n }\n set shebang(value: string) {\n if (value) {\n this.path.get(\"interpreter\").replaceWith(interpreterDirective(value));\n } else {\n this.path.get(\"interpreter\").remove();\n }\n }\n\n set(key: unknown, val: unknown) {\n if (key === \"helpersNamespace\") {\n throw new Error(\n \"Babel 7.0.0-beta.56 has dropped support for the 'helpersNamespace' utility.\" +\n \"If you are using @babel/plugin-external-helpers you will need to use a newer \" +\n \"version than the one you currently have installed. \" +\n \"If you have your own implementation, you'll want to explore using 'helperGenerator' \" +\n \"alongside 'file.availableHelper()'.\",\n );\n }\n\n this._map.set(key, val);\n }\n\n get(key: unknown): any {\n return this._map.get(key);\n }\n\n has(key: unknown): boolean {\n return this._map.has(key);\n }\n\n getModuleName(): string | undefined | null {\n return getModuleName(this.opts, this.opts);\n }\n\n addImport() {\n throw new Error(\n \"This API has been removed. If you're looking for this \" +\n \"functionality in Babel 7, you should import the \" +\n \"'@babel/helper-module-imports' module and use the functions exposed \" +\n \" from that module, such as 'addNamed' or 'addDefault'.\",\n );\n }\n\n /**\n * Check if a given helper is available in @babel/core's helper list.\n *\n * This _also_ allows you to pass a Babel version specifically. If the\n * helper exists, but was not available for the full given range, it will be\n * considered unavailable.\n */\n availableHelper(name: string, versionRange?: string | null): boolean {\n let minVersion;\n try {\n minVersion = helpers.minVersion(name);\n } catch (err) {\n if (err.code !== \"BABEL_HELPER_UNKNOWN\") throw err;\n\n return false;\n }\n\n if (typeof versionRange !== \"string\") return true;\n\n // semver.intersects() has some surprising behavior with comparing ranges\n // with pre-release versions. We add '^' to ensure that we are always\n // comparing ranges with ranges, which sidesteps this logic.\n // For example:\n //\n // semver.intersects(`<7.0.1`, \"7.0.0-beta.0\") // false - surprising\n // semver.intersects(`<7.0.1`, \"^7.0.0-beta.0\") // true - expected\n //\n // This is because the first falls back to\n //\n // semver.satisfies(\"7.0.0-beta.0\", `<7.0.1`) // false - surprising\n //\n // and this fails because a prerelease version can only satisfy a range\n // if it is a prerelease within the same major/minor/patch range.\n //\n // Note: If this is found to have issues, please also revisit the logic in\n // transform-runtime's definitions.js file.\n if (semver.valid(versionRange)) versionRange = `^${versionRange}`;\n\n return (\n !semver.intersects(`<${minVersion}`, versionRange) &&\n !semver.intersects(`>=8.0.0`, versionRange)\n );\n }\n\n addHelper(name: string): t.Identifier {\n const declar = this.declarations[name];\n if (declar) return cloneNode(declar);\n\n const generator = this.get(\"helperGenerator\");\n if (generator) {\n const res = generator(name);\n if (res) return res;\n }\n\n // make sure that the helper exists\n helpers.ensure(name, File);\n\n const uid = (this.declarations[name] =\n this.scope.generateUidIdentifier(name));\n\n const dependencies: { [key: string]: t.Identifier } = {};\n for (const dep of helpers.getDependencies(name)) {\n dependencies[dep] = this.addHelper(dep);\n }\n\n const { nodes, globals } = helpers.get(\n name,\n dep => dependencies[dep],\n uid,\n Object.keys(this.scope.getAllBindings()),\n );\n\n globals.forEach(name => {\n if (this.path.scope.hasBinding(name, true /* noGlobals */)) {\n this.path.scope.rename(name);\n }\n });\n\n nodes.forEach(node => {\n // @ts-expect-error Fixme: document _compact node property\n node._compact = true;\n });\n\n this.path.unshiftContainer(\"body\", nodes);\n // TODO: NodePath#unshiftContainer should automatically register new\n // bindings.\n this.path.get(\"body\").forEach(path => {\n if (nodes.indexOf(path.node) === -1) return;\n if (path.isVariableDeclaration()) this.scope.registerDeclaration(path);\n });\n\n return uid;\n }\n\n addTemplateObject() {\n throw new Error(\n \"This function has been moved into the template literal transform itself.\",\n );\n }\n\n buildCodeFrameError(\n node: NodeLocation | undefined | null,\n msg: string,\n _Error: typeof Error = SyntaxError,\n ): Error {\n let loc = node && (node.loc || node._loc);\n\n if (!loc && node) {\n const state: { loc?: NodeLocation[\"loc\"] | null } = {\n loc: null,\n };\n traverse(node as t.Node, errorVisitor, this.scope, state);\n loc = state.loc;\n\n let txt =\n \"This is an error on an internal node. Probably an internal error.\";\n if (loc) txt += \" Location has been estimated.\";\n\n msg += ` (${txt})`;\n }\n\n if (loc) {\n const { highlightCode = true } = this.opts;\n\n msg +=\n \"\\n\" +\n codeFrameColumns(\n this.code,\n {\n start: {\n line: loc.start.line,\n column: loc.start.column + 1,\n },\n end:\n loc.end && loc.start.line === loc.end.line\n ? {\n line: loc.end.line,\n column: loc.end.column + 1,\n }\n : undefined,\n },\n { highlightCode },\n );\n }\n\n return new _Error(msg);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,G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C;QACDC,GAAG,EACDnF,GAAG,CAACmF,GAAG,IAAInF,GAAG,CAACgF,KAAK,CAACC,IAAI,KAAKjF,GAAG,CAACmF,GAAG,CAACF,IAAI,GACtC;UACEA,IAAI,EAAEjF,GAAG,CAACmF,GAAG,CAACF,IAAI;UAClBC,MAAM,EAAElF,GAAG,CAACmF,GAAG,CAACD,MAAM,GAAG;QAC3B,CAAC,GACDE;MACR,CAAC,EACD;QAAEN;MAAc,CAAC,CAClB;IACL;IAEA,OAAO,IAAIL,MAAM,CAACD,GAAG,CAAC;EACxB;AACF;AAACa,OAAA,CAAAC,OAAA,GAAAnF,IAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/file/generate.js b/node_modules/@babel/core/lib/transformation/file/generate.js deleted file mode 100644 index 351bc0b28..000000000 --- a/node_modules/@babel/core/lib/transformation/file/generate.js +++ /dev/null @@ -1,84 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = generateCode; -function _convertSourceMap() { - const data = require("convert-source-map"); - _convertSourceMap = function () { - return data; - }; - return data; -} -function _generator() { - const data = require("@babel/generator"); - _generator = function () { - return data; - }; - return data; -} -var _mergeMap = require("./merge-map"); -function generateCode(pluginPasses, file) { - const { - opts, - ast, - code, - inputMap - } = file; - const { - generatorOpts - } = opts; - generatorOpts.inputSourceMap = inputMap == null ? void 0 : inputMap.toObject(); - const results = []; - for (const plugins of pluginPasses) { - for (const plugin of plugins) { - const { - generatorOverride - } = plugin; - if (generatorOverride) { - const result = generatorOverride(ast, generatorOpts, code, _generator().default); - if (result !== undefined) results.push(result); - } - } - } - let result; - if (results.length === 0) { - result = (0, _generator().default)(ast, generatorOpts, code); - } else if (results.length === 1) { - result = results[0]; - if (typeof result.then === "function") { - throw new Error(`You appear to be using an async codegen plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`); - } - } else { - throw new Error("More than one plugin attempted to override codegen."); - } - let { - code: outputCode, - decodedMap: outputMap = result.map - } = result; - if (result.__mergedMap) { - outputMap = Object.assign({}, result.map); - } else { - if (outputMap) { - if (inputMap) { - outputMap = (0, _mergeMap.default)(inputMap.toObject(), outputMap, generatorOpts.sourceFileName); - } else { - outputMap = result.map; - } - } - } - if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") { - outputCode += "\n" + _convertSourceMap().fromObject(outputMap).toComment(); - } - if (opts.sourceMaps === "inline") { - outputMap = null; - } - return { - outputCode, - outputMap - }; -} -0 && 0; - -//# sourceMappingURL=generate.js.map diff --git a/node_modules/@babel/core/lib/transformation/file/generate.js.map b/node_modules/@babel/core/lib/transformation/file/generate.js.map deleted file mode 100644 index a6f6e7a3e..000000000 --- a/node_modules/@babel/core/lib/transformation/file/generate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_convertSourceMap","data","require","_generator","_mergeMap","generateCode","pluginPasses","file","opts","ast","code","inputMap","generatorOpts","inputSourceMap","toObject","results","plugins","plugin","generatorOverride","result","generate","undefined","push","length","then","Error","outputCode","decodedMap","outputMap","map","__mergedMap","Object","assign","mergeSourceMap","sourceFileName","sourceMaps","convertSourceMap","fromObject","toComment"],"sources":["../../../src/transformation/file/generate.ts"],"sourcesContent":["import type { PluginPasses } from \"../../config\";\nimport convertSourceMap from \"convert-source-map\";\ntype SourceMap = any;\nimport generate from \"@babel/generator\";\n\nimport type File from \"./file\";\nimport mergeSourceMap from \"./merge-map\";\n\nexport default function generateCode(\n pluginPasses: PluginPasses,\n file: File,\n): {\n outputCode: string;\n outputMap: SourceMap | null;\n} {\n const { opts, ast, code, inputMap } = file;\n const { generatorOpts } = opts;\n\n generatorOpts.inputSourceMap = inputMap?.toObject();\n\n const results = [];\n for (const plugins of pluginPasses) {\n for (const plugin of plugins) {\n const { generatorOverride } = plugin;\n if (generatorOverride) {\n const result = generatorOverride(ast, generatorOpts, code, generate);\n\n if (result !== undefined) results.push(result);\n }\n }\n }\n\n let result;\n if (results.length === 0) {\n result = generate(ast, generatorOpts, code);\n } else if (results.length === 1) {\n result = results[0];\n\n if (typeof result.then === \"function\") {\n throw new Error(\n `You appear to be using an async codegen plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, ` +\n `you may need to upgrade your @babel/core version.`,\n );\n }\n } else {\n throw new Error(\"More than one plugin attempted to override codegen.\");\n }\n\n // Decoded maps are faster to merge, so we attempt to get use the decodedMap\n // first. But to preserve backwards compat with older Generator, we'll fall\n // back to the encoded map.\n let { code: outputCode, decodedMap: outputMap = result.map } = result;\n\n // For backwards compat.\n if (result.__mergedMap) {\n /**\n * @see mergeSourceMap\n */\n outputMap = { ...result.map };\n } else {\n if (outputMap) {\n if (inputMap) {\n // mergeSourceMap returns an encoded map\n outputMap = mergeSourceMap(\n inputMap.toObject(),\n outputMap,\n generatorOpts.sourceFileName,\n );\n } else {\n // We cannot output a decoded map, so retrieve the encoded form. Because\n // the decoded form is free, it's fine to prioritize decoded first.\n outputMap = result.map;\n }\n }\n }\n\n if (opts.sourceMaps === \"inline\" || opts.sourceMaps === \"both\") {\n outputCode += \"\\n\" + convertSourceMap.fromObject(outputMap).toComment();\n }\n\n if (opts.sourceMaps === \"inline\") {\n outputMap = null;\n }\n\n return { outputCode, outputMap };\n}\n"],"mappings":";;;;;;AACA,SAAAA,kBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,iBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,IAAAG,SAAA,GAAAF,OAAA;AAEe,SAASG,YAAYA,CAClCC,YAA0B,EAC1BC,IAAU,EAIV;EACA,MAAM;IAAEC,IAAI;IAAEC,GAAG;IAAEC,IAAI;IAAEC;EAAS,CAAC,GAAGJ,IAA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IAAID,SAAS,EAAE;MACb,IAAIjB,QAAQ,EAAE;QAEZiB,SAAS,GAAG,IAAAK,iBAAc,EACxBtB,QAAQ,CAACG,QAAQ,EAAE,EACnBc,SAAS,EACThB,aAAa,CAACsB,cAAc,CAC7B;MACH,CAAC,MAAM;QAGLN,SAAS,GAAGT,MAAM,CAACU,GAAG;MACxB;IACF;EACF;EAEA,IAAIrB,IAAI,CAAC2B,UAAU,KAAK,QAAQ,IAAI3B,IAAI,CAAC2B,UAAU,KAAK,MAAM,EAAE;IAC9DT,UAAU,IAAI,IAAI,GAAGU,mBAAgB,CAACC,UAAU,CAACT,SAAS,CAAC,CAACU,SAAS,EAAE;EACzE;EAEA,IAAI9B,IAAI,CAAC2B,UAAU,KAAK,QAAQ,EAAE;IAChCP,SAAS,GAAG,IAAI;EAClB;EAEA,OAAO;IAAEF,UAAU;IAAEE;EAAU,CAAC;AAClC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/file/merge-map.js b/node_modules/@babel/core/lib/transformation/file/merge-map.js deleted file mode 100644 index cf3971b2a..000000000 --- a/node_modules/@babel/core/lib/transformation/file/merge-map.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = mergeSourceMap; -function _remapping() { - const data = require("@ampproject/remapping"); - _remapping = function () { - return data; - }; - return data; -} -function mergeSourceMap(inputMap, map, sourceFileName) { - const source = sourceFileName.replace(/\\/g, "/"); - let found = false; - const result = _remapping()(rootless(map), (s, ctx) => { - if (s === source && !found) { - found = true; - ctx.source = ""; - return rootless(inputMap); - } - return null; - }); - if (typeof inputMap.sourceRoot === "string") { - result.sourceRoot = inputMap.sourceRoot; - } - return Object.assign({}, result); -} -function rootless(map) { - return Object.assign({}, map, { - sourceRoot: null - }); -} -0 && 0; - -//# sourceMappingURL=merge-map.js.map diff --git a/node_modules/@babel/core/lib/transformation/file/merge-map.js.map b/node_modules/@babel/core/lib/transformation/file/merge-map.js.map deleted file mode 100644 index 6eb511f16..000000000 --- a/node_modules/@babel/core/lib/transformation/file/merge-map.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_remapping","data","require","mergeSourceMap","inputMap","map","sourceFileName","source","replace","found","result","remapping","rootless","s","ctx","sourceRoot","Object","assign"],"sources":["../../../src/transformation/file/merge-map.ts"],"sourcesContent":["type SourceMap = any;\nimport remapping from \"@ampproject/remapping\";\n\nexport default function mergeSourceMap(\n inputMap: SourceMap,\n map: SourceMap,\n sourceFileName: string,\n): SourceMap {\n // On win32 machines, the sourceFileName uses backslash paths like\n // `C:\\foo\\bar.js`. But sourcemaps are always posix paths, so we need to\n // normalize to regular slashes before we can merge (else we won't find the\n // source associated with our input map).\n // This mirrors code done while generating the output map at\n // https://github.com/babel/babel/blob/5c2fcadc9ae34fd20dd72b1111d5cf50476d700d/packages/babel-generator/src/source-map.ts#L102\n const source = sourceFileName.replace(/\\\\/g, \"/\");\n\n // Prevent an infinite recursion if one of the input map's sources has the\n // same resolved path as the input map. In the case, it would keep find the\n // input map, then get it's sources which will include a path like the input\n // map, on and on.\n let found = false;\n const result = remapping(rootless(map), (s, ctx) => {\n if (s === source && !found) {\n found = true;\n // We empty the source location, which will prevent the sourcemap from\n // becoming relative to the input's location. Eg, if we're transforming a\n // file 'foo/bar.js', and it is a transformation of a `baz.js` file in the\n // same directory, the expected output is just `baz.js`. Without this step,\n // it would become `foo/baz.js`.\n ctx.source = \"\";\n\n return rootless(inputMap);\n }\n\n return null;\n });\n\n if (typeof inputMap.sourceRoot === \"string\") {\n result.sourceRoot = inputMap.sourceRoot;\n }\n\n // remapping returns a SourceMap class type, but this breaks code downstream in\n // @babel/traverse and @babel/types that relies on data being plain objects.\n // When it encounters the sourcemap type it outputs a \"don't know how to turn\n // this value into a node\" error. As a result, we are converting the merged\n // sourcemap to a plain js object.\n return { ...result };\n}\n\nfunction rootless(map: SourceMap): SourceMap {\n return {\n ...map,\n\n // This is a bit hack. Remapping will create absolute sources in our\n // sourcemap, but we want to maintain sources relative to the sourceRoot.\n // We'll re-add the sourceRoot after remapping.\n sourceRoot: null,\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEe,SAASE,cAAcA,CACpCC,QAAmB,EACnBC,GAAc,EACdC,cAAsB,EACX;EAOX,MAAMC,MAAM,GAAGD,cAAc,CAACE,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;EAMjD,IAAIC,KAAK,GAAG,KAAK;EACjB,MAAMC,MAAM,GAAGC,YAAS,CAACC,QAAQ,CAACP,GAAG,CAAC,EAAE,CAACQ,CAAC,EAAEC,GAAG,KAAK;IAClD,IAAID,CAAC,KAAKN,MAAM,IAAI,CAACE,KAAK,EAAE;MAC1BA,KAAK,GAAG,IAAI;MAMZK,GAAG,CAACP,MAAM,GAAG,EAAE;MAEf,OAAOK,QAAQ,CAACR,QAAQ,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC,CAAC;EAEF,IAAI,OAAOA,QAAQ,CAACW,UAAU,KAAK,QAAQ,EAAE;IAC3CL,MAAM,CAACK,UAAU,GAAGX,QAAQ,CAACW,UAAU;EACzC;EAOA,OAAAC,MAAA,CAAAC,MAAA,KAAYP,MAAM;AACpB;AAEA,SAASE,QAAQA,CAACP,GAAc,EAAa;EAC3C,OAAAW,MAAA,CAAAC,MAAA,KACKZ,GAAG;IAKNU,UAAU,EAAE;EAAI;AAEpB;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/index.js b/node_modules/@babel/core/lib/transformation/index.js deleted file mode 100644 index e748199a4..000000000 --- a/node_modules/@babel/core/lib/transformation/index.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.run = run; -function _traverse() { - const data = require("@babel/traverse"); - _traverse = function () { - return data; - }; - return data; -} -var _pluginPass = require("./plugin-pass"); -var _blockHoistPlugin = require("./block-hoist-plugin"); -var _normalizeOpts = require("./normalize-opts"); -var _normalizeFile = require("./normalize-file"); -var _generate = require("./file/generate"); -var _deepArray = require("../config/helpers/deep-array"); -function* run(config, code, ast) { - const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast); - const opts = file.opts; - try { - yield* transformFile(file, config.passes); - } catch (e) { - var _opts$filename; - e.message = `${(_opts$filename = opts.filename) != null ? _opts$filename : "unknown file"}: ${e.message}`; - if (!e.code) { - e.code = "BABEL_TRANSFORM_ERROR"; - } - throw e; - } - let outputCode, outputMap; - try { - if (opts.code !== false) { - ({ - outputCode, - outputMap - } = (0, _generate.default)(config.passes, file)); - } - } catch (e) { - var _opts$filename2; - e.message = `${(_opts$filename2 = opts.filename) != null ? _opts$filename2 : "unknown file"}: ${e.message}`; - if (!e.code) { - e.code = "BABEL_GENERATE_ERROR"; - } - throw e; - } - return { - metadata: file.metadata, - options: opts, - ast: opts.ast === true ? file.ast : null, - code: outputCode === undefined ? null : outputCode, - map: outputMap === undefined ? null : outputMap, - sourceType: file.ast.program.sourceType, - externalDependencies: (0, _deepArray.flattenToSet)(config.externalDependencies) - }; -} -function* transformFile(file, pluginPasses) { - for (const pluginPairs of pluginPasses) { - const passPairs = []; - const passes = []; - const visitors = []; - for (const plugin of pluginPairs.concat([(0, _blockHoistPlugin.default)()])) { - const pass = new _pluginPass.default(file, plugin.key, plugin.options); - passPairs.push([plugin, pass]); - passes.push(pass); - visitors.push(plugin.visitor); - } - for (const [plugin, pass] of passPairs) { - const fn = plugin.pre; - if (fn) { - const result = fn.call(pass, file); - yield* []; - if (isThenable(result)) { - throw new Error(`You appear to be using an plugin with an async .pre, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`); - } - } - } - const visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod); - (0, _traverse().default)(file.ast, visitor, file.scope); - for (const [plugin, pass] of passPairs) { - const fn = plugin.post; - if (fn) { - const result = fn.call(pass, file); - yield* []; - if (isThenable(result)) { - throw new Error(`You appear to be using an plugin with an async .post, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`); - } - } - } - } -} -function isThenable(val) { - return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function"; -} -0 && 0; - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/core/lib/transformation/index.js.map b/node_modules/@babel/core/lib/transformation/index.js.map deleted file mode 100644 index ba856a709..000000000 --- a/node_modules/@babel/core/lib/transformation/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_traverse","data","require","_pluginPass","_blockHoistPlugin","_normalizeOpts","_normalizeFile","_generate","_deepArray","run","config","code","ast","file","normalizeFile","passes","normalizeOptions","opts","transformFile","e","_opts$filename","message","filename","outputCode","outputMap","generateCode","_opts$filename2","metadata","options","undefined","map","sourceType","program","externalDependencies","flattenToSet","pluginPasses","pluginPairs","passPairs","visitors","plugin","concat","loadBlockHoistPlugin","pass","PluginPass","key","push","visitor","fn","pre","result","call","isThenable","Error","traverse","merge","wrapPluginVisitorMethod","scope","post","val","then"],"sources":["../../src/transformation/index.ts"],"sourcesContent":["import traverse from \"@babel/traverse\";\nimport type * as t from \"@babel/types\";\ntype SourceMap = any;\nimport type { Handler } from \"gensync\";\n\nimport type { ResolvedConfig, Plugin, PluginPasses } from \"../config\";\n\nimport PluginPass from \"./plugin-pass\";\nimport loadBlockHoistPlugin from \"./block-hoist-plugin\";\nimport normalizeOptions from \"./normalize-opts\";\nimport normalizeFile from \"./normalize-file\";\n\nimport generateCode from \"./file/generate\";\nimport type File from \"./file/file\";\n\nimport { flattenToSet } from \"../config/helpers/deep-array\";\n\nexport type FileResultCallback = {\n (err: Error, file: null): void;\n (err: null, file: FileResult | null): void;\n};\n\nexport type FileResult = {\n metadata: { [key: string]: any };\n options: { [key: string]: any };\n ast: t.File | null;\n code: string | null;\n map: SourceMap | null;\n sourceType: \"script\" | \"module\";\n externalDependencies: Set;\n};\n\nexport function* run(\n config: ResolvedConfig,\n code: string,\n ast?: t.File | t.Program | null,\n): Handler {\n const file = yield* normalizeFile(\n config.passes,\n normalizeOptions(config),\n code,\n ast,\n );\n\n const opts = file.opts;\n try {\n yield* transformFile(file, config.passes);\n } catch (e) {\n e.message = `${opts.filename ?? \"unknown file\"}: ${e.message}`;\n if (!e.code) {\n e.code = \"BABEL_TRANSFORM_ERROR\";\n }\n throw e;\n }\n\n let outputCode, outputMap;\n try {\n if (opts.code !== false) {\n ({ outputCode, outputMap } = generateCode(config.passes, file));\n }\n } catch (e) {\n e.message = `${opts.filename ?? \"unknown file\"}: ${e.message}`;\n if (!e.code) {\n e.code = \"BABEL_GENERATE_ERROR\";\n }\n throw e;\n }\n\n return {\n metadata: file.metadata,\n options: opts,\n ast: opts.ast === true ? file.ast : null,\n code: outputCode === undefined ? null : outputCode,\n map: outputMap === undefined ? null : outputMap,\n sourceType: file.ast.program.sourceType,\n externalDependencies: flattenToSet(config.externalDependencies),\n };\n}\n\nfunction* transformFile(file: File, pluginPasses: PluginPasses): Handler {\n for (const pluginPairs of pluginPasses) {\n const passPairs: [Plugin, PluginPass][] = [];\n const passes = [];\n const visitors = [];\n\n for (const plugin of pluginPairs.concat([loadBlockHoistPlugin()])) {\n const pass = new PluginPass(file, plugin.key, plugin.options);\n\n passPairs.push([plugin, pass]);\n passes.push(pass);\n visitors.push(plugin.visitor);\n }\n\n for (const [plugin, pass] of passPairs) {\n const fn = plugin.pre;\n if (fn) {\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result = fn.call(pass, file);\n\n // @ts-expect-error - If we want to support async .pre\n yield* [];\n\n if (isThenable(result)) {\n throw new Error(\n `You appear to be using an plugin with an async .pre, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n }\n }\n\n // merge all plugin visitors into a single visitor\n const visitor = traverse.visitors.merge(\n visitors,\n passes,\n file.opts.wrapPluginVisitorMethod,\n );\n traverse(file.ast, visitor, file.scope);\n\n for (const [plugin, pass] of passPairs) {\n const fn = plugin.post;\n if (fn) {\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result = fn.call(pass, file);\n\n // @ts-expect-error - If we want to support async .post\n yield* [];\n\n if (isThenable(result)) {\n throw new Error(\n `You appear to be using an plugin with an async .post, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n }\n }\n }\n}\n\nfunction isThenable>(val: any): val is T {\n return (\n !!val &&\n (typeof val === \"object\" || typeof val === \"function\") &&\n !!val.then &&\n typeof val.then === \"function\"\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,IAAAE,WAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AAGA,IAAAM,UAAA,GAAAN,OAAA;AAiBO,UAAUO,GAAGA,CAClBC,MAAsB,EACtBC,IAAY,EACZC,GAA+B,EACV;EACrB,MAAMC,IAAI,GAAG,OAAO,IAAAC,sBAAa,EAC/BJ,MAAM,CAACK,MAAM,EACb,IAAAC,sBAAgB,EAACN,MAAM,CAAC,EACxBC,IAAI,EACJC,GAAG,CACJ;EAED,MAAMK,IAAI,GAAGJ,IAAI,CAACI,IAAI;EACtB,IAAI;IACF,OAAOC,aAAa,CAACL,IAAI,EAAEH,MAAM,CAACK,MAAM,CAAC;EAC3C,CAAC,CAAC,OAAOI,CA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I,CAAC,IAAIL,SAAS,EAAE;MACtC,MAAMU,EAAE,GAAGR,MAAM,CAACkB,IAAI;MACtB,IAAIV,EAAE,EAAE;QAEN,MAAME,MAAM,GAAGF,EAAE,CAACG,IAAI,CAACR,IAAI,EAAE7B,IAAI,CAAC;QAGlC,OAAO,EAAE;QAET,IAAIsC,UAAU,CAACF,MAAM,CAAC,EAAE;UACtB,MAAM,IAAIG,KAAK,CACZ,wDAAuD,GACrD,wDAAuD,GACvD,8DAA6D,GAC7D,2BAA0B,CAC9B;QACH;MACF;IACF;EACF;AACF;AAEA,SAASD,UAAUA,CAA6BO,GAAQ,EAAY;EAClE,OACE,CAAC,CAACA,GAAG,KACJ,OAAOA,GAAG,KAAK,QAAQ,IAAI,OAAOA,GAAG,KAAK,UAAU,CAAC,IACtD,CAAC,CAACA,GAAG,CAACC,IAAI,IACV,OAAOD,GAAG,CAACC,IAAI,KAAK,UAAU;AAElC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/normalize-file.js b/node_modules/@babel/core/lib/transformation/normalize-file.js deleted file mode 100644 index a07586f37..000000000 --- a/node_modules/@babel/core/lib/transformation/normalize-file.js +++ /dev/null @@ -1,127 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = normalizeFile; -function _fs() { - const data = require("fs"); - _fs = function () { - return data; - }; - return data; -} -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -function _debug() { - const data = require("debug"); - _debug = function () { - return data; - }; - return data; -} -function _t() { - const data = require("@babel/types"); - _t = function () { - return data; - }; - return data; -} -function _convertSourceMap() { - const data = require("convert-source-map"); - _convertSourceMap = function () { - return data; - }; - return data; -} -var _file = require("./file/file"); -var _parser = require("../parser"); -var _cloneDeep = require("./util/clone-deep"); -const { - file, - traverseFast -} = _t(); -const debug = _debug()("babel:transform:file"); -const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/; -const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/; -function* normalizeFile(pluginPasses, options, code, ast) { - code = `${code || ""}`; - if (ast) { - if (ast.type === "Program") { - ast = file(ast, [], []); - } else if (ast.type !== "File") { - throw new Error("AST root must be a Program or File node"); - } - if (options.cloneInputAst) { - ast = (0, _cloneDeep.default)(ast); - } - } else { - ast = yield* (0, _parser.default)(pluginPasses, options, code); - } - let inputMap = null; - if (options.inputSourceMap !== false) { - if (typeof options.inputSourceMap === "object") { - inputMap = _convertSourceMap().fromObject(options.inputSourceMap); - } - if (!inputMap) { - const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast); - if (lastComment) { - try { - inputMap = _convertSourceMap().fromComment(lastComment); - } catch (err) { - debug("discarding unknown inline input sourcemap", err); - } - } - } - if (!inputMap) { - const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast); - if (typeof options.filename === "string" && lastComment) { - try { - const match = EXTERNAL_SOURCEMAP_REGEX.exec(lastComment); - const inputMapContent = _fs().readFileSync(_path().resolve(_path().dirname(options.filename), match[1]), "utf8"); - inputMap = _convertSourceMap().fromJSON(inputMapContent); - } catch (err) { - debug("discarding unknown file input sourcemap", err); - } - } else if (lastComment) { - debug("discarding un-loadable file input sourcemap"); - } - } - } - return new _file.default(options, { - code, - ast: ast, - inputMap - }); -} -function extractCommentsFromList(regex, comments, lastComment) { - if (comments) { - comments = comments.filter(({ - value - }) => { - if (regex.test(value)) { - lastComment = value; - return false; - } - return true; - }); - } - return [comments, lastComment]; -} -function extractComments(regex, ast) { - let lastComment = null; - traverseFast(ast, node => { - [node.leadingComments, lastComment] = extractCommentsFromList(regex, node.leadingComments, lastComment); - [node.innerComments, lastComment] = extractCommentsFromList(regex, node.innerComments, lastComment); - [node.trailingComments, lastComment] = extractCommentsFromList(regex, node.trailingComments, lastComment); - }); - return lastComment; -} -0 && 0; - -//# sourceMappingURL=normalize-file.js.map diff --git a/node_modules/@babel/core/lib/transformation/normalize-file.js.map b/node_modules/@babel/core/lib/transformation/normalize-file.js.map deleted file mode 100644 index 07259b34b..000000000 --- a/node_modules/@babel/core/lib/transformation/normalize-file.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_fs","data","require","_path","_debug","_t","_convertSourceMap","_file","_parser","_cloneDeep","file","traverseFast","debug","buildDebug","INLINE_SOURCEMAP_REGEX","EXTERNAL_SOURCEMAP_REGEX","normalizeFile","pluginPasses","options","code","ast","type","Error","cloneInputAst","cloneDeep","parser","inputMap","inputSourceMap","convertSourceMap","fromObject","lastComment","extractComments","fromComment","err","filename","match","exec","inputMapContent","fs","readFileSync","path","resolve","dirname","fromJSON","File","extractCommentsFromList","regex","comments","filter","value","test","node","leadingComments","innerComments","trailingComments"],"sources":["../../src/transformation/normalize-file.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport buildDebug from \"debug\";\nimport type { Handler } from \"gensync\";\nimport { file, traverseFast } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { PluginPasses } from \"../config\";\nimport convertSourceMap from \"convert-source-map\";\nimport type { SourceMapConverter as Converter } from \"convert-source-map\";\nimport File from \"./file/file\";\nimport parser from \"../parser\";\nimport cloneDeep from \"./util/clone-deep\";\n\nconst debug = buildDebug(\"babel:transform:file\");\n\n// These regexps are copied from the convert-source-map package,\n// but without // or /* at the beginning of the comment.\n\n// eslint-disable-next-line max-len\nconst INLINE_SOURCEMAP_REGEX =\n /^[@#]\\s+sourceMappingURL=data:(?:application|text)\\/json;(?:charset[:=]\\S+?;)?base64,(?:.*)$/;\nconst EXTERNAL_SOURCEMAP_REGEX =\n /^[@#][ \\t]+sourceMappingURL=([^\\s'\"`]+)[ \\t]*$/;\n\nexport type NormalizedFile = {\n code: string;\n ast: t.File;\n inputMap: Converter | null;\n};\n\nexport default function* normalizeFile(\n pluginPasses: PluginPasses,\n options: { [key: string]: any },\n code: string,\n ast?: t.File | t.Program | null,\n): Handler {\n code = `${code || \"\"}`;\n\n if (ast) {\n if (ast.type === \"Program\") {\n ast = file(ast, [], []);\n } else if (ast.type !== \"File\") {\n throw new Error(\"AST root must be a Program or File node\");\n }\n\n if (options.cloneInputAst) {\n ast = cloneDeep(ast);\n }\n } else {\n // @ts-expect-error todo: use babel-types ast typings in Babel parser\n ast = yield* parser(pluginPasses, options, code);\n }\n\n let inputMap = null;\n if (options.inputSourceMap !== false) {\n // If an explicit object is passed in, it overrides the processing of\n // source maps that may be in the file itself.\n if (typeof options.inputSourceMap === \"object\") {\n inputMap = convertSourceMap.fromObject(options.inputSourceMap);\n }\n\n if (!inputMap) {\n const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast);\n if (lastComment) {\n try {\n inputMap = convertSourceMap.fromComment(lastComment);\n } catch (err) {\n debug(\"discarding unknown inline input sourcemap\", err);\n }\n }\n }\n\n if (!inputMap) {\n const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast);\n if (typeof options.filename === \"string\" && lastComment) {\n try {\n // when `lastComment` is non-null, EXTERNAL_SOURCEMAP_REGEX must have matches\n const match: [string, string] = EXTERNAL_SOURCEMAP_REGEX.exec(\n lastComment,\n ) as any;\n const inputMapContent = fs.readFileSync(\n path.resolve(path.dirname(options.filename), match[1]),\n \"utf8\",\n );\n inputMap = convertSourceMap.fromJSON(inputMapContent);\n } catch (err) {\n debug(\"discarding unknown file input sourcemap\", err);\n }\n } else if (lastComment) {\n debug(\"discarding un-loadable file input sourcemap\");\n }\n }\n }\n\n return new File(options, {\n code,\n ast: ast as t.File,\n inputMap,\n });\n}\n\nfunction extractCommentsFromList(\n regex: RegExp,\n comments: t.Comment[],\n lastComment: string | null,\n): [t.Comment[], string | null] {\n if (comments) {\n comments = comments.filter(({ value }) => {\n if (regex.test(value)) {\n lastComment = value;\n return false;\n }\n return true;\n });\n }\n return [comments, lastComment];\n}\n\nfunction extractComments(regex: RegExp, ast: t.Node) {\n let lastComment: string = null;\n traverseFast(ast, node => {\n [node.leadingComments, lastComment] = extractCommentsFromList(\n regex,\n node.leadingComments,\n lastComment,\n );\n [node.innerComments, lastComment] = extractCommentsFromList(\n regex,\n node.innerComments,\n lastComment,\n );\n [node.trailingComments, lastComment] = extractCommentsFromList(\n regex,\n node.trailingComments,\n lastComment,\n );\n });\n return lastComment;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,GAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,EAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,kBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,iBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAM,KAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAA0C;EAPjCQ,IAAI;EAAEC;AAAY,IAAAN,EAAA;AAS3B,MAAMO,KAAK,GAAGC,QAAU,CAAC,sBAAsB,CAAC;AAMhD,MAAMC,sBAAsB,GAC1B,8FAA8F;AAChG,MAAMC,wBAAwB,GAC5B,gDAAgD;AAQnC,UAAUC,aAAaA,CACpCC,YAA0B,EAC1BC,OAA+B,EAC/BC,IAAY,E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ACD,CAACqB,IAAI,CAACE,aAAa,EAAEvB,WAAW,CAAC,GAAGe,uBAAuB,CACzDC,KAAK,EACLK,IAAI,CAACE,aAAa,EAClBvB,WAAW,CACZ;IACD,CAACqB,IAAI,CAACG,gBAAgB,EAAExB,WAAW,CAAC,GAAGe,uBAAuB,CAC5DC,KAAK,EACLK,IAAI,CAACG,gBAAgB,EACrBxB,WAAW,CACZ;EACH,CAAC,CAAC;EACF,OAAOA,WAAW;AACpB;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/normalize-opts.js b/node_modules/@babel/core/lib/transformation/normalize-opts.js deleted file mode 100644 index 20826fc20..000000000 --- a/node_modules/@babel/core/lib/transformation/normalize-opts.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = normalizeOptions; -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -function normalizeOptions(config) { - const { - filename, - cwd, - filenameRelative = typeof filename === "string" ? _path().relative(cwd, filename) : "unknown", - sourceType = "module", - inputSourceMap, - sourceMaps = !!inputSourceMap, - sourceRoot = config.options.moduleRoot, - sourceFileName = _path().basename(filenameRelative), - comments = true, - compact = "auto" - } = config.options; - const opts = config.options; - const options = Object.assign({}, opts, { - parserOpts: Object.assign({ - sourceType: _path().extname(filenameRelative) === ".mjs" ? "module" : sourceType, - sourceFileName: filename, - plugins: [] - }, opts.parserOpts), - generatorOpts: Object.assign({ - filename, - auxiliaryCommentBefore: opts.auxiliaryCommentBefore, - auxiliaryCommentAfter: opts.auxiliaryCommentAfter, - retainLines: opts.retainLines, - comments, - shouldPrintComment: opts.shouldPrintComment, - compact, - minified: opts.minified, - sourceMaps, - sourceRoot, - sourceFileName - }, opts.generatorOpts) - }); - for (const plugins of config.passes) { - for (const plugin of plugins) { - if (plugin.manipulateOptions) { - plugin.manipulateOptions(options, options.parserOpts); - } - } - } - return options; -} -0 && 0; - -//# sourceMappingURL=normalize-opts.js.map diff --git a/node_modules/@babel/core/lib/transformation/normalize-opts.js.map b/node_modules/@babel/core/lib/transformation/normalize-opts.js.map deleted file mode 100644 index 7cbad00bb..000000000 --- a/node_modules/@babel/core/lib/transformation/normalize-opts.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_path","data","require","normalizeOptions","config","filename","cwd","filenameRelative","path","relative","sourceType","inputSourceMap","sourceMaps","sourceRoot","options","moduleRoot","sourceFileName","basename","comments","compact","opts","Object","assign","parserOpts","extname","plugins","generatorOpts","auxiliaryCommentBefore","auxiliaryCommentAfter","retainLines","shouldPrintComment","minified","passes","plugin","manipulateOptions"],"sources":["../../src/transformation/normalize-opts.ts"],"sourcesContent":["import path from \"path\";\nimport type { ResolvedConfig } from \"../config\";\n\nexport default function normalizeOptions(config: ResolvedConfig): {} {\n const {\n filename,\n cwd,\n filenameRelative = typeof filename === \"string\"\n ? path.relative(cwd, filename)\n : \"unknown\",\n sourceType = \"module\",\n inputSourceMap,\n sourceMaps = !!inputSourceMap,\n sourceRoot = process.env.BABEL_8_BREAKING\n ? undefined\n : config.options.moduleRoot,\n\n sourceFileName = path.basename(filenameRelative),\n\n comments = true,\n compact = \"auto\",\n } = config.options;\n\n const opts = config.options;\n\n const options = {\n ...opts,\n\n parserOpts: {\n sourceType:\n path.extname(filenameRelative) === \".mjs\" ? \"module\" : sourceType,\n\n sourceFileName: filename,\n plugins: [],\n ...opts.parserOpts,\n },\n\n generatorOpts: {\n // General generator flags.\n filename,\n\n auxiliaryCommentBefore: opts.auxiliaryCommentBefore,\n auxiliaryCommentAfter: opts.auxiliaryCommentAfter,\n retainLines: opts.retainLines,\n comments,\n shouldPrintComment: opts.shouldPrintComment,\n compact,\n minified: opts.minified,\n\n // Source-map generation flags.\n sourceMaps,\n\n sourceRoot,\n sourceFileName,\n ...opts.generatorOpts,\n },\n };\n\n for (const plugins of config.passes) {\n for (const plugin of plugins) {\n if (plugin.manipulateOptions) {\n plugin.manipulateOptions(options, options.parserOpts);\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AEX,IAAI,CAACW,QAAQ;MAGvBnB,UAAU;MAEVC,UAAU;MACVG;IAAc,GACXI,IAAI,CAACM,aAAa;EACtB,EACF;EAED,KAAK,MAAMD,OAAO,IAAIrB,MAAM,CAAC4B,MAAM,EAAE;IACnC,KAAK,MAAMC,MAAM,IAAIR,OAAO,EAAE;MAC5B,IAAIQ,MAAM,CAACC,iBAAiB,EAAE;QAC5BD,MAAM,CAACC,iBAAiB,CAACpB,OAAO,EAAEA,OAAO,CAACS,UAAU,CAAC;MACvD;IACF;EACF;EAEA,OAAOT,OAAO;AAChB;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/plugin-pass.js b/node_modules/@babel/core/lib/transformation/plugin-pass.js deleted file mode 100644 index e39c88542..000000000 --- a/node_modules/@babel/core/lib/transformation/plugin-pass.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -class PluginPass { - constructor(file, key, options) { - this._map = new Map(); - this.key = void 0; - this.file = void 0; - this.opts = void 0; - this.cwd = void 0; - this.filename = void 0; - this.key = key; - this.file = file; - this.opts = options || {}; - this.cwd = file.opts.cwd; - this.filename = file.opts.filename; - } - set(key, val) { - this._map.set(key, val); - } - get(key) { - return this._map.get(key); - } - availableHelper(name, versionRange) { - return this.file.availableHelper(name, versionRange); - } - addHelper(name) { - return this.file.addHelper(name); - } - buildCodeFrameError(node, msg, _Error) { - return this.file.buildCodeFrameError(node, msg, _Error); - } -} -exports.default = PluginPass; -{ - PluginPass.prototype.getModuleName = function getModuleName() { - return this.file.getModuleName(); - }; - PluginPass.prototype.addImport = function addImport() { - this.file.addImport(); - }; -} -0 && 0; - -//# sourceMappingURL=plugin-pass.js.map diff --git a/node_modules/@babel/core/lib/transformation/plugin-pass.js.map b/node_modules/@babel/core/lib/transformation/plugin-pass.js.map deleted file mode 100644 index 8a05224d4..000000000 --- a/node_modules/@babel/core/lib/transformation/plugin-pass.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["PluginPass","constructor","file","key","options","_map","Map","opts","cwd","filename","set","val","get","availableHelper","name","versionRange","addHelper","buildCodeFrameError","node","msg","_Error","exports","default","prototype","getModuleName","addImport"],"sources":["../../src/transformation/plugin-pass.ts"],"sourcesContent":["import type File from \"./file/file\";\nimport type { NodeLocation } from \"./file/file\";\n\nexport default class PluginPass {\n _map: Map = new Map();\n key: string | undefined | null;\n file: File;\n opts: any;\n\n // The working directory that Babel's programmatic options are loaded\n // relative to.\n cwd: string;\n\n // The absolute path of the file being compiled.\n filename: string | void;\n\n constructor(file: File, key?: string | null, options?: any | null) {\n this.key = key;\n this.file = file;\n this.opts = options || {};\n this.cwd = file.opts.cwd;\n this.filename = file.opts.filename;\n }\n\n set(key: unknown, val: unknown) {\n this._map.set(key, val);\n }\n\n get(key: unknown): any {\n return this._map.get(key);\n }\n\n availableHelper(name: string, versionRange?: string | null) {\n return this.file.availableHelper(name, versionRange);\n }\n\n addHelper(name: string) {\n return this.file.addHelper(name);\n }\n\n buildCodeFrameError(\n node: NodeLocation | undefined | null,\n msg: string,\n _Error?: typeof Error,\n ) {\n return this.file.buildCodeFrameError(node, msg, _Error);\n }\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n (PluginPass as any).prototype.getModuleName = function getModuleName(\n this: PluginPass,\n ): string | undefined {\n return this.file.getModuleName();\n };\n (PluginPass as any).prototype.addImport = function addImport(\n this: PluginPass,\n ): void {\n this.file.addImport();\n };\n}\n"],"mappings":";;;;;;AAGe,MAAMA,UAAU,CAAC;EAa9BC,WAAWA,CAACC,IAAU,EAAEC,GAAmB,EAAEC,OAAoB,EAAE;IAAA,KAZnEC,IAAI,GAA0B,IAAIC,GAAG,EAAE;IAAA,KACvCH,GAAG;IAAA,KACHD,IAAI;IAAA,KACJK,IAAI;IAAA,KAIJC,GAAG;IAAA,KAGHC,QAAQ;IAGN,IAAI,CAACN,GAAG,GAAGA,GAAG;IACd,IAAI,CAACD,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACK,IAAI,GAAGH,OAAO,IAAI,CAAC,CAAC;IACzB,IAAI,CAACI,GAAG,GAAGN,IAAI,CAACK,IAAI,CAACC,GAAG;IACxB,IAAI,CAACC,QAAQ,GAAGP,IAAI,CAACK,IAAI,CAACE,QAAQ;EACpC;EAEAC,GAAGA,CAACP,GAAY,EAAEQ,GAAY,EAAE;IAC9B,IAAI,CAACN,IAAI,CAACK,GAAG,CAACP,GAAG,EAAEQ,GAAG,CAAC;EACzB;EAEAC,GAAGA,CAACT,GAAY,EAAO;IACrB,OAAO,IAAI,CAACE,IAAI,CAACO,GAAG,CAACT,GAAG,CAAC;EAC3B;EAEAU,eAAeA,CAACC,IAAY,EAAEC,YAA4B,EAAE;IAC1D,OAAO,IAAI,CAACb,IAAI,CAACW,eAAe,CAACC,IAAI,EAAEC,YAAY,CAAC;EACtD;EAEAC,SAASA,CAACF,IAAY,EAAE;IACtB,OAAO,IAAI,CAACZ,IAAI,CAACc,SAAS,CAACF,IAAI,CAAC;EAClC;EAEAG,mBAAmBA,CACjBC,IAAqC,EACrCC,GAAW,EACXC,MAAqB,EACrB;IACA,OAAO,IAAI,CAAClB,IAAI,CAACe,mBAAmB,CAACC,IAAI,EAAEC,GAAG,EAAEC,MAAM,CAAC;EACzD;AACF;AAACC,OAAA,CAAAC,OAAA,GAAAtB,UAAA;AAEkC;EAChCA,UAAU,CAASuB,SAAS,CAACC,aAAa,GAAG,SAASA,aAAaA,CAAA,EAE9C;IACpB,OAAO,IAAI,CAACtB,IAAI,CAACsB,aAAa,EAAE;EAClC,CAAC;EACAxB,UAAU,CAASuB,SAAS,CAACE,SAAS,GAAG,SAASA,SAASA,CAAA,EAEpD;IACN,IAAI,CAACvB,IAAI,CAACuB,SAAS,EAAE;EACvB,CAAC;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/util/clone-deep.js b/node_modules/@babel/core/lib/transformation/util/clone-deep.js deleted file mode 100644 index fc4148fc6..000000000 --- a/node_modules/@babel/core/lib/transformation/util/clone-deep.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _default; -function deepClone(value, cache) { - if (value !== null) { - if (cache.has(value)) return cache.get(value); - let cloned; - if (Array.isArray(value)) { - cloned = new Array(value.length); - cache.set(value, cloned); - for (let i = 0; i < value.length; i++) { - cloned[i] = typeof value[i] !== "object" ? value[i] : deepClone(value[i], cache); - } - } else { - cloned = {}; - cache.set(value, cloned); - const keys = Object.keys(value); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - cloned[key] = typeof value[key] !== "object" ? value[key] : deepClone(value[key], cache); - } - } - return cloned; - } - return value; -} -function _default(value) { - if (typeof value !== "object") return value; - return deepClone(value, new Map()); -} -0 && 0; - -//# sourceMappingURL=clone-deep.js.map diff --git a/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map b/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map deleted file mode 100644 index ecf8953d1..000000000 --- a/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["deepClone","value","cache","has","get","cloned","Array","isArray","length","set","i","keys","Object","key","_default","Map"],"sources":["../../../src/transformation/util/clone-deep.ts"],"sourcesContent":["//https://github.com/babel/babel/pull/14583#discussion_r882828856\nfunction deepClone(value: any, cache: Map): any {\n if (value !== null) {\n if (cache.has(value)) return cache.get(value);\n let cloned: any;\n if (Array.isArray(value)) {\n cloned = new Array(value.length);\n cache.set(value, cloned);\n for (let i = 0; i < value.length; i++) {\n cloned[i] =\n typeof value[i] !== \"object\" ? value[i] : deepClone(value[i], cache);\n }\n } else {\n cloned = {};\n cache.set(value, cloned);\n const keys = Object.keys(value);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n cloned[key] =\n typeof value[key] !== \"object\"\n ? value[key]\n : deepClone(value[key], cache);\n }\n }\n return cloned;\n }\n return value;\n}\n\nexport default function (value: T): T {\n if (typeof value !== \"object\") return value;\n return deepClone(value, new Map());\n}\n"],"mappings":";;;;;;AACA,SAASA,SAASA,CAACC,KAAU,EAAEC,KAAoB,EAAO;EACxD,IAAID,KAAK,KAAK,IAAI,EAAE;IAClB,IAAIC,KAAK,CAACC,GAAG,CAACF,KAAK,CAAC,EAAE,OAAOC,KAAK,CAACE,GAAG,CAACH,KAAK,CAAC;IAC7C,IAAII,MAAW;IACf,IAAIC,KAAK,CAACC,OAAO,CAACN,KAAK,CAAC,EAAE;MACxBI,MAAM,GAAG,IAAIC,KAAK,CAACL,KAAK,CAACO,MAAM,CAAC;MAChCN,KAAK,CAACO,GAAG,CAACR,KAAK,EAAEI,MAAM,CAAC;MACxB,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGT,KAAK,CAACO,MAAM,EAAEE,CAAC,EAAE,EAAE;QACrCL,MAAM,CAACK,CAAC,CAAC,GACP,OAAOT,KAAK,CAACS,CAAC,CAAC,KAAK,QAAQ,GAAGT,KAAK,CAACS,CAAC,CAAC,GAAGV,SAAS,CAACC,KAAK,CAACS,CAAC,CAAC,EAAER,KAAK,CAAC;MACxE;IACF,CAAC,MAAM;MACLG,MAAM,GAAG,CAAC,CAAC;MACXH,KAAK,CAACO,GAAG,CAACR,KAAK,EAAEI,MAAM,CAAC;MACxB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACV,KAAK,CAAC;MAC/B,KAAK,IAAIS,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACH,MAAM,EAAEE,CAAC,EAAE,EAAE;QACpC,MAAMG,GAAG,GAAGF,IAAI,CAACD,CAAC,CAAC;QACnBL,MAAM,CAACQ,GAAG,CAAC,GACT,OAAOZ,KAAK,CAACY,GAAG,CAAC,KAAK,QAAQ,GAC1BZ,KAAK,CAACY,GAAG,CAAC,GACVb,SAAS,CAACC,KAAK,CAACY,GAAG,CAAC,EAAEX,KAAK,CAAC;MACpC;IACF;IACA,OAAOG,MAAM;EACf;EACA,OAAOJ,KAAK;AACd;AAEe,SAAAa,SAAab,KAAQ,EAAK;EACvC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAOA,KAAK;EAC3C,OAAOD,SAAS,CAACC,KAAK,EAAE,IAAIc,GAAG,EAAE,CAAC;AACpC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/vendor/import-meta-resolve.js b/node_modules/@babel/core/lib/vendor/import-meta-resolve.js deleted file mode 100644 index db0237b24..000000000 --- a/node_modules/@babel/core/lib/vendor/import-meta-resolve.js +++ /dev/null @@ -1,1011 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.moduleResolve = moduleResolve; -exports.resolve = resolve; -function _assert() { - const data = require("assert"); - _assert = function () { - return data; - }; - return data; -} -function _fs() { - const data = _interopRequireWildcard(require("fs"), true); - _fs = function () { - return data; - }; - return data; -} -function _process() { - const data = require("process"); - _process = function () { - return data; - }; - return data; -} -function _url() { - const data = require("url"); - _url = function () { - return data; - }; - return data; -} -function _path() { - const data = require("path"); - _path = function () { - return data; - }; - return data; -} -function _module() { - const data = require("module"); - _module = function () { - return data; - }; - return data; -} -function _v() { - const data = require("v8"); - _v = function () { - return data; - }; - return data; -} -function _util() { - const data = require("util"); - _util = function () { - return data; - }; - return data; -} -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -const isWindows = _process().platform === 'win32'; -const own$1 = {}.hasOwnProperty; -const classRegExp = /^([A-Z][a-z\d]*)+$/; -const kTypes = new Set(['string', 'function', 'number', 'object', 'Function', 'Object', 'boolean', 'bigint', 'symbol']); -const codes = {}; -function formatList(array, type = 'and') { - return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(', ')}, ${type} ${array[array.length - 1]}`; -} -const messages = new Map(); -const nodeInternalPrefix = '__node_internal_'; -let userStackTraceLimit; -codes.ERR_INVALID_ARG_TYPE = createError('ERR_INVALID_ARG_TYPE', (name, expected, actual) => { - _assert()(typeof name === 'string', "'name' must be a string"); - if (!Array.isArray(expected)) { - expected = [expected]; - } - let message = 'The '; - if (name.endsWith(' argument')) { - message += `${name} `; - } else { - const type = name.includes('.') ? 'property' : 'argument'; - message += `"${name}" ${type} `; - } - message += 'must be '; - const types = []; - const instances = []; - const other = []; - for (const value of expected) { - _assert()(typeof value === 'string', 'All expected entries have to be of type string'); - if (kTypes.has(value)) { - types.push(value.toLowerCase()); - } else if (classRegExp.exec(value) === null) { - _assert()(value !== 'object', 'The value "object" should be written as "Object"'); - other.push(value); - } else { - instances.push(value); - } - } - if (instances.length > 0) { - const pos = types.indexOf('object'); - if (pos !== -1) { - types.slice(pos, 1); - instances.push('Object'); - } - } - if (types.length > 0) { - message += `${types.length > 1 ? 'one of type' : 'of type'} ${formatList(types, 'or')}`; - if (instances.length > 0 || other.length > 0) message += ' or '; - } - if (instances.length > 0) { - message += `an instance of ${formatList(instances, 'or')}`; - if (other.length > 0) message += ' or '; - } - if (other.length > 0) { - if (other.length > 1) { - message += `one of ${formatList(other, 'or')}`; - } else { - if (other[0].toLowerCase() !== other[0]) message += 'an '; - message += `${other[0]}`; - } - } - message += `. Received ${determineSpecificType(actual)}`; - return message; -}, TypeError); -codes.ERR_INVALID_MODULE_SPECIFIER = createError('ERR_INVALID_MODULE_SPECIFIER', (request, reason, base = undefined) => { - return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ''}`; -}, TypeError); -codes.ERR_INVALID_PACKAGE_CONFIG = createError('ERR_INVALID_PACKAGE_CONFIG', (path, base, message) => { - return `Invalid package config ${path}${base ? ` while importing ${base}` : ''}${message ? `. ${message}` : ''}`; -}, Error); -codes.ERR_INVALID_PACKAGE_TARGET = createError('ERR_INVALID_PACKAGE_TARGET', (pkgPath, key, target, isImport = false, base = undefined) => { - const relError = typeof target === 'string' && !isImport && target.length > 0 && !target.startsWith('./'); - if (key === '.') { - _assert()(isImport === false); - return `Invalid "exports" main target ${JSON.stringify(target)} defined ` + `in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ''}${relError ? '; targets must start with "./"' : ''}`; - } - return `Invalid "${isImport ? 'imports' : 'exports'}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ''}${relError ? '; targets must start with "./"' : ''}`; -}, Error); -codes.ERR_MODULE_NOT_FOUND = createError('ERR_MODULE_NOT_FOUND', (path, base, type = 'package') => { - return `Cannot find ${type} '${path}' imported from ${base}`; -}, Error); -codes.ERR_NETWORK_IMPORT_DISALLOWED = createError('ERR_NETWORK_IMPORT_DISALLOWED', "import of '%s' by %s is not supported: %s", Error); -codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError('ERR_PACKAGE_IMPORT_NOT_DEFINED', (specifier, packagePath, base) => { - return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ''} imported from ${base}`; -}, TypeError); -codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError('ERR_PACKAGE_PATH_NOT_EXPORTED', (pkgPath, subpath, base = undefined) => { - if (subpath === '.') return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ''}`; - return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${base ? ` imported from ${base}` : ''}`; -}, Error); -codes.ERR_UNSUPPORTED_DIR_IMPORT = createError('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " + 'resolving ES modules imported from %s', Error); -codes.ERR_UNKNOWN_FILE_EXTENSION = createError('ERR_UNKNOWN_FILE_EXTENSION', (ext, path) => { - return `Unknown file extension "${ext}" for ${path}`; -}, TypeError); -codes.ERR_INVALID_ARG_VALUE = createError('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => { - let inspected = (0, _util().inspect)(value); - if (inspected.length > 128) { - inspected = `${inspected.slice(0, 128)}...`; - } - const type = name.includes('.') ? 'property' : 'argument'; - return `The ${type} '${name}' ${reason}. Received ${inspected}`; -}, TypeError); -codes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url, supported) => { - let message = `Only URLs with a scheme in: ${formatList(supported)} are supported by the default ESM loader`; - if (isWindows && url.protocol.length === 2) { - message += '. On Windows, absolute paths must be valid file:// URLs'; - } - message += `. Received protocol '${url.protocol}'`; - return message; -}, Error); -function createError(sym, value, def) { - messages.set(sym, value); - return makeNodeErrorWithCode(def, sym); -} -function makeNodeErrorWithCode(Base, key) { - return NodeError; - function NodeError(...args) { - const limit = Error.stackTraceLimit; - if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; - const error = new Base(); - if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit; - const message = getMessage(key, args, error); - Object.defineProperties(error, { - message: { - value: message, - enumerable: false, - writable: true, - configurable: true - }, - toString: { - value() { - return `${this.name} [${key}]: ${this.message}`; - }, - enumerable: false, - writable: true, - configurable: true - } - }); - captureLargerStackTrace(error); - error.code = key; - return error; - } -} -function isErrorStackTraceLimitWritable() { - try { - if (_v().startupSnapshot.isBuildingSnapshot()) { - return false; - } - } catch (_unused) {} - const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit'); - if (desc === undefined) { - return Object.isExtensible(Error); - } - return own$1.call(desc, 'writable') && desc.writable !== undefined ? desc.writable : desc.set !== undefined; -} -function hideStackFrames(fn) { - const hidden = nodeInternalPrefix + fn.name; - Object.defineProperty(fn, 'name', { - value: hidden - }); - return fn; -} -const captureLargerStackTrace = hideStackFrames(function (error) { - const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable(); - if (stackTraceLimitIsWritable) { - userStackTraceLimit = Error.stackTraceLimit; - Error.stackTraceLimit = Number.POSITIVE_INFINITY; - } - Error.captureStackTrace(error); - if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit; - return error; -}); -function getMessage(key, args, self) { - const message = messages.get(key); - _assert()(message !== undefined, 'expected `message` to be found'); - if (typeof message === 'function') { - _assert()(message.length <= args.length, `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${message.length}).`); - return Reflect.apply(message, self, args); - } - const regex = /%[dfijoOs]/g; - let expectedLength = 0; - while (regex.exec(message) !== null) expectedLength++; - _assert()(expectedLength === args.length, `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${expectedLength}).`); - if (args.length === 0) return message; - args.unshift(message); - return Reflect.apply(_util().format, null, args); -} -function determineSpecificType(value) { - if (value === null || value === undefined) { - return String(value); - } - if (typeof value === 'function' && value.name) { - return `function ${value.name}`; - } - if (typeof value === 'object') { - if (value.constructor && value.constructor.name) { - return `an instance of ${value.constructor.name}`; - } - return `${(0, _util().inspect)(value, { - depth: -1 - })}`; - } - let inspected = (0, _util().inspect)(value, { - colors: false - }); - if (inspected.length > 28) { - inspected = `${inspected.slice(0, 25)}...`; - } - return `type ${typeof value} (${inspected})`; -} -const reader = { - read -}; -function read(jsonPath) { - try { - const string = _fs().default.readFileSync(_path().toNamespacedPath(_path().join(_path().dirname(jsonPath), 'package.json')), 'utf8'); - return { - string - }; - } catch (error) { - const exception = error; - if (exception.code === 'ENOENT') { - return { - string: undefined - }; - } - throw exception; - } -} -const { - ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG$1 -} = codes; -const packageJsonCache = new Map(); -function getPackageConfig(path, specifier, base) { - const existing = packageJsonCache.get(path); - if (existing !== undefined) { - return existing; - } - const source = reader.read(path).string; - if (source === undefined) { - const packageConfig = { - pjsonPath: path, - exists: false, - main: undefined, - name: undefined, - type: 'none', - exports: undefined, - imports: undefined - }; - packageJsonCache.set(path, packageConfig); - return packageConfig; - } - let packageJson; - try { - packageJson = JSON.parse(source); - } catch (error) { - const exception = error; - throw new ERR_INVALID_PACKAGE_CONFIG$1(path, (base ? `"${specifier}" from ` : '') + (0, _url().fileURLToPath)(base || specifier), exception.message); - } - const { - exports, - imports, - main, - name, - type - } = packageJson; - const packageConfig = { - pjsonPath: path, - exists: true, - main: typeof main === 'string' ? main : undefined, - name: typeof name === 'string' ? name : undefined, - type: type === 'module' || type === 'commonjs' ? type : 'none', - exports, - imports: imports && typeof imports === 'object' ? imports : undefined - }; - packageJsonCache.set(path, packageConfig); - return packageConfig; -} -function getPackageScopeConfig(resolved) { - let packageJsonUrl = new (_url().URL)('package.json', resolved); - while (true) { - const packageJsonPath = packageJsonUrl.pathname; - if (packageJsonPath.endsWith('node_modules/package.json')) break; - const packageConfig = getPackageConfig((0, _url().fileURLToPath)(packageJsonUrl), resolved); - if (packageConfig.exists) return packageConfig; - const lastPackageJsonUrl = packageJsonUrl; - packageJsonUrl = new (_url().URL)('../package.json', packageJsonUrl); - if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) break; - } - const packageJsonPath = (0, _url().fileURLToPath)(packageJsonUrl); - const packageConfig = { - pjsonPath: packageJsonPath, - exists: false, - main: undefined, - name: undefined, - type: 'none', - exports: undefined, - imports: undefined - }; - packageJsonCache.set(packageJsonPath, packageConfig); - return packageConfig; -} -function getPackageType(url) { - const packageConfig = getPackageScopeConfig(url); - return packageConfig.type; -} -const { - ERR_UNKNOWN_FILE_EXTENSION -} = codes; -const hasOwnProperty = {}.hasOwnProperty; -const extensionFormatMap = { - __proto__: null, - '.cjs': 'commonjs', - '.js': 'module', - '.json': 'json', - '.mjs': 'module' -}; -function mimeToFormat(mime) { - if (mime && /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime)) return 'module'; - if (mime === 'application/json') return 'json'; - return null; -} -const protocolHandlers = { - __proto__: null, - 'data:': getDataProtocolModuleFormat, - 'file:': getFileProtocolModuleFormat, - 'http:': getHttpProtocolModuleFormat, - 'https:': getHttpProtocolModuleFormat, - 'node:'() { - return 'builtin'; - } -}; -function getDataProtocolModuleFormat(parsed) { - const { - 1: mime - } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [null, null, null]; - return mimeToFormat(mime); -} -function extname(url) { - const pathname = url.pathname; - let index = pathname.length; - while (index--) { - const code = pathname.codePointAt(index); - if (code === 47) { - return ''; - } - if (code === 46) { - return pathname.codePointAt(index - 1) === 47 ? '' : pathname.slice(index); - } - } - return ''; -} -function getFileProtocolModuleFormat(url, _context, ignoreErrors) { - const ext = extname(url); - if (ext === '.js') { - return getPackageType(url) === 'module' ? 'module' : 'commonjs'; - } - const format = extensionFormatMap[ext]; - if (format) return format; - if (ignoreErrors) { - return undefined; - } - const filepath = (0, _url().fileURLToPath)(url); - throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath); -} -function getHttpProtocolModuleFormat() {} -function defaultGetFormatWithoutErrors(url, context) { - if (!hasOwnProperty.call(protocolHandlers, url.protocol)) { - return null; - } - return protocolHandlers[url.protocol](url, context, true) || null; -} -const { - ERR_INVALID_ARG_VALUE -} = codes; -const DEFAULT_CONDITIONS = Object.freeze(['node', 'import']); -const DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS); -function getDefaultConditions() { - return DEFAULT_CONDITIONS; -} -function getDefaultConditionsSet() { - return DEFAULT_CONDITIONS_SET; -} -function getConditionsSet(conditions) { - if (conditions !== undefined && conditions !== getDefaultConditions()) { - if (!Array.isArray(conditions)) { - throw new ERR_INVALID_ARG_VALUE('conditions', conditions, 'expected an array'); - } - return new Set(conditions); - } - return getDefaultConditionsSet(); -} -const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace]; -const experimentalNetworkImports = false; -const { - ERR_NETWORK_IMPORT_DISALLOWED, - ERR_INVALID_MODULE_SPECIFIER, - ERR_INVALID_PACKAGE_CONFIG, - ERR_INVALID_PACKAGE_TARGET, - ERR_MODULE_NOT_FOUND, - ERR_PACKAGE_IMPORT_NOT_DEFINED, - ERR_PACKAGE_PATH_NOT_EXPORTED, - ERR_UNSUPPORTED_DIR_IMPORT, - ERR_UNSUPPORTED_ESM_URL_SCHEME -} = codes; -const own = {}.hasOwnProperty; -const invalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i; -const deprecatedInvalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i; -const invalidPackageNameRegEx = /^\.|%|\\/; -const patternRegEx = /\*/g; -const encodedSepRegEx = /%2f|%5c/i; -const emittedPackageWarnings = new Set(); -const doubleSlashRegEx = /[/\\]{2}/; -function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) { - const pjsonPath = (0, _url().fileURLToPath)(packageJsonUrl); - const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null; - _process().emitWarning(`Use of deprecated ${double ? 'double slash' : 'leading or trailing slash matching'} resolving "${target}" for module ` + `request "${request}" ${request === match ? '' : `matched to "${match}" `}in the "${internal ? 'imports' : 'exports'}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${(0, _url().fileURLToPath)(base)}` : ''}.`, 'DeprecationWarning', 'DEP0166'); -} -function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) { - const format = defaultGetFormatWithoutErrors(url, { - parentURL: base.href - }); - if (format !== 'module') return; - const path = (0, _url().fileURLToPath)(url.href); - const pkgPath = (0, _url().fileURLToPath)(new (_url().URL)('.', packageJsonUrl)); - const basePath = (0, _url().fileURLToPath)(base); - if (main) _process().emitWarning(`Package ${pkgPath} has a "main" field set to ${JSON.stringify(main)}, ` + `excluding the full filename and extension to the resolved file at "${path.slice(pkgPath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is` + 'deprecated for ES modules.', 'DeprecationWarning', 'DEP0151');else _process().emitWarning(`No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${path.slice(pkgPath.length)}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, 'DeprecationWarning', 'DEP0151'); -} -function tryStatSync(path) { - try { - return (0, _fs().statSync)(path); - } catch (_unused2) { - return new (_fs().Stats)(); - } -} -function fileExists(url) { - const stats = (0, _fs().statSync)(url, { - throwIfNoEntry: false - }); - const isFile = stats ? stats.isFile() : undefined; - return isFile === null || isFile === undefined ? false : isFile; -} -function legacyMainResolve(packageJsonUrl, packageConfig, base) { - let guess; - if (packageConfig.main !== undefined) { - guess = new (_url().URL)(packageConfig.main, packageJsonUrl); - if (fileExists(guess)) return guess; - const tries = [`./${packageConfig.main}.js`, `./${packageConfig.main}.json`, `./${packageConfig.main}.node`, `./${packageConfig.main}/index.js`, `./${packageConfig.main}/index.json`, `./${packageConfig.main}/index.node`]; - let i = -1; - while (++i < tries.length) { - guess = new (_url().URL)(tries[i], packageJsonUrl); - if (fileExists(guess)) break; - guess = undefined; - } - if (guess) { - emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main); - return guess; - } - } - const tries = ['./index.js', './index.json', './index.node']; - let i = -1; - while (++i < tries.length) { - guess = new (_url().URL)(tries[i], packageJsonUrl); - if (fileExists(guess)) break; - guess = undefined; - } - if (guess) { - emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main); - return guess; - } - throw new ERR_MODULE_NOT_FOUND((0, _url().fileURLToPath)(new (_url().URL)('.', packageJsonUrl)), (0, _url().fileURLToPath)(base)); -} -function finalizeResolution(resolved, base, preserveSymlinks) { - if (encodedSepRegEx.exec(resolved.pathname) !== null) throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, 'must not include encoded "/" or "\\" characters', (0, _url().fileURLToPath)(base)); - const filePath = (0, _url().fileURLToPath)(resolved); - const stats = tryStatSync(filePath.endsWith('/') ? filePath.slice(-1) : filePath); - if (stats.isDirectory()) { - const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, (0, _url().fileURLToPath)(base)); - error.url = String(resolved); - throw error; - } - if (!stats.isFile()) { - throw new ERR_MODULE_NOT_FOUND(filePath || resolved.pathname, base && (0, _url().fileURLToPath)(base), 'module'); - } - if (!preserveSymlinks) { - const real = (0, _fs().realpathSync)(filePath); - const { - search, - hash - } = resolved; - resolved = (0, _url().pathToFileURL)(real + (filePath.endsWith(_path().sep) ? '/' : '')); - resolved.search = search; - resolved.hash = hash; - } - return resolved; -} -function importNotDefined(specifier, packageJsonUrl, base) { - return new ERR_PACKAGE_IMPORT_NOT_DEFINED(specifier, packageJsonUrl && (0, _url().fileURLToPath)(new (_url().URL)('.', packageJsonUrl)), (0, _url().fileURLToPath)(base)); -} -function exportsNotFound(subpath, packageJsonUrl, base) { - return new ERR_PACKAGE_PATH_NOT_EXPORTED((0, _url().fileURLToPath)(new (_url().URL)('.', packageJsonUrl)), subpath, base && (0, _url().fileURLToPath)(base)); -} -function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) { - const reason = `request is not a valid match in pattern "${match}" for the "${internal ? 'imports' : 'exports'}" resolution of ${(0, _url().fileURLToPath)(packageJsonUrl)}`; - throw new ERR_INVALID_MODULE_SPECIFIER(request, reason, base && (0, _url().fileURLToPath)(base)); -} -function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) { - target = typeof target === 'object' && target !== null ? JSON.stringify(target, null, '') : `${target}`; - return new ERR_INVALID_PACKAGE_TARGET((0, _url().fileURLToPath)(new (_url().URL)('.', packageJsonUrl)), subpath, target, internal, base && (0, _url().fileURLToPath)(base)); -} -function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, isPathMap, conditions) { - if (subpath !== '' && !pattern && target[target.length - 1] !== '/') throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); - if (!target.startsWith('./')) { - if (internal && !target.startsWith('../') && !target.startsWith('/')) { - let isURL = false; - try { - new (_url().URL)(target); - isURL = true; - } catch (_unused3) {} - if (!isURL) { - const exportTarget = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target + subpath; - return packageResolve(exportTarget, packageJsonUrl, conditions); - } - } - throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); - } - if (invalidSegmentRegEx.exec(target.slice(2)) !== null) { - if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) { - if (!isPathMap) { - const request = pattern ? match.replace('*', () => subpath) : match + subpath; - const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target; - emitInvalidSegmentDeprecation(resolvedTarget, request, match, packageJsonUrl, internal, base, true); - } - } else { - throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); - } - } - const resolved = new (_url().URL)(target, packageJsonUrl); - const resolvedPath = resolved.pathname; - const packagePath = new (_url().URL)('.', packageJsonUrl).pathname; - if (!resolvedPath.startsWith(packagePath)) throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); - if (subpath === '') return resolved; - if (invalidSegmentRegEx.exec(subpath) !== null) { - const request = pattern ? match.replace('*', () => subpath) : match + subpath; - if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) { - if (!isPathMap) { - const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target; - emitInvalidSegmentDeprecation(resolvedTarget, request, match, packageJsonUrl, internal, base, false); - } - } else { - throwInvalidSubpath(request, match, packageJsonUrl, internal, base); - } - } - if (pattern) { - return new (_url().URL)(RegExpPrototypeSymbolReplace.call(patternRegEx, resolved.href, () => subpath)); - } - return new (_url().URL)(subpath, resolved); -} -function isArrayIndex(key) { - const keyNumber = Number(key); - if (`${keyNumber}` !== key) return false; - return keyNumber >= 0 && keyNumber < 0xffffffff; -} -function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions) { - if (typeof target === 'string') { - return resolvePackageTargetString(target, subpath, packageSubpath, packageJsonUrl, base, pattern, internal, isPathMap, conditions); - } - if (Array.isArray(target)) { - const targetList = target; - if (targetList.length === 0) return null; - let lastException; - let i = -1; - while (++i < targetList.length) { - const targetItem = targetList[i]; - let resolveResult; - try { - resolveResult = resolvePackageTarget(packageJsonUrl, targetItem, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions); - } catch (error) { - const exception = error; - lastException = exception; - if (exception.code === 'ERR_INVALID_PACKAGE_TARGET') continue; - throw error; - } - if (resolveResult === undefined) continue; - if (resolveResult === null) { - lastException = null; - continue; - } - return resolveResult; - } - if (lastException === undefined || lastException === null) { - return null; - } - throw lastException; - } - if (typeof target === 'object' && target !== null) { - const keys = Object.getOwnPropertyNames(target); - let i = -1; - while (++i < keys.length) { - const key = keys[i]; - if (isArrayIndex(key)) { - throw new ERR_INVALID_PACKAGE_CONFIG((0, _url().fileURLToPath)(packageJsonUrl), base, '"exports" cannot contain numeric property keys.'); - } - } - i = -1; - while (++i < keys.length) { - const key = keys[i]; - if (key === 'default' || conditions && conditions.has(key)) { - const conditionalTarget = target[key]; - const resolveResult = resolvePackageTarget(packageJsonUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions); - if (resolveResult === undefined) continue; - return resolveResult; - } - } - return null; - } - if (target === null) { - return null; - } - throw invalidPackageTarget(packageSubpath, target, packageJsonUrl, internal, base); -} -function isConditionalExportsMainSugar(exports, packageJsonUrl, base) { - if (typeof exports === 'string' || Array.isArray(exports)) return true; - if (typeof exports !== 'object' || exports === null) return false; - const keys = Object.getOwnPropertyNames(exports); - let isConditionalSugar = false; - let i = 0; - let j = -1; - while (++j < keys.length) { - const key = keys[j]; - const curIsConditionalSugar = key === '' || key[0] !== '.'; - if (i++ === 0) { - isConditionalSugar = curIsConditionalSugar; - } else if (isConditionalSugar !== curIsConditionalSugar) { - throw new ERR_INVALID_PACKAGE_CONFIG((0, _url().fileURLToPath)(packageJsonUrl), base, '"exports" cannot contain some keys starting with \'.\' and some not.' + ' The exports object must either be an object of package subpath keys' + ' or an object of main entry condition name keys only.'); - } - } - return isConditionalSugar; -} -function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) { - const pjsonPath = (0, _url().fileURLToPath)(pjsonUrl); - if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return; - emittedPackageWarnings.add(pjsonPath + '|' + match); - _process().emitWarning(`Use of deprecated trailing slash pattern mapping "${match}" in the ` + `"exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${(0, _url().fileURLToPath)(base)}` : ''}. Mapping specifiers ending in "/" is no longer supported.`, 'DeprecationWarning', 'DEP0155'); -} -function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) { - let exports = packageConfig.exports; - if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) { - exports = { - '.': exports - }; - } - if (own.call(exports, packageSubpath) && !packageSubpath.includes('*') && !packageSubpath.endsWith('/')) { - const target = exports[packageSubpath]; - const resolveResult = resolvePackageTarget(packageJsonUrl, target, '', packageSubpath, base, false, false, false, conditions); - if (resolveResult === null || resolveResult === undefined) { - throw exportsNotFound(packageSubpath, packageJsonUrl, base); - } - return resolveResult; - } - let bestMatch = ''; - let bestMatchSubpath = ''; - const keys = Object.getOwnPropertyNames(exports); - let i = -1; - while (++i < keys.length) { - const key = keys[i]; - const patternIndex = key.indexOf('*'); - if (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) { - if (packageSubpath.endsWith('/')) { - emitTrailingSlashPatternDeprecation(packageSubpath, packageJsonUrl, base); - } - const patternTrailer = key.slice(patternIndex + 1); - if (packageSubpath.length >= key.length && packageSubpath.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf('*') === patternIndex) { - bestMatch = key; - bestMatchSubpath = packageSubpath.slice(patternIndex, packageSubpath.length - patternTrailer.length); - } - } - } - if (bestMatch) { - const target = exports[bestMatch]; - const resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, false, packageSubpath.endsWith('/'), conditions); - if (resolveResult === null || resolveResult === undefined) { - throw exportsNotFound(packageSubpath, packageJsonUrl, base); - } - return resolveResult; - } - throw exportsNotFound(packageSubpath, packageJsonUrl, base); -} -function patternKeyCompare(a, b) { - const aPatternIndex = a.indexOf('*'); - const bPatternIndex = b.indexOf('*'); - const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1; - const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1; - if (baseLengthA > baseLengthB) return -1; - if (baseLengthB > baseLengthA) return 1; - if (aPatternIndex === -1) return 1; - if (bPatternIndex === -1) return -1; - if (a.length > b.length) return -1; - if (b.length > a.length) return 1; - return 0; -} -function packageImportsResolve(name, base, conditions) { - if (name === '#' || name.startsWith('#/') || name.endsWith('/')) { - const reason = 'is not a valid internal imports specifier name'; - throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, (0, _url().fileURLToPath)(base)); - } - let packageJsonUrl; - const packageConfig = getPackageScopeConfig(base); - if (packageConfig.exists) { - packageJsonUrl = (0, _url().pathToFileURL)(packageConfig.pjsonPath); - const imports = packageConfig.imports; - if (imports) { - if (own.call(imports, name) && !name.includes('*')) { - const resolveResult = resolvePackageTarget(packageJsonUrl, imports[name], '', name, base, false, true, false, conditions); - if (resolveResult !== null && resolveResult !== undefined) { - return resolveResult; - } - } else { - let bestMatch = ''; - let bestMatchSubpath = ''; - const keys = Object.getOwnPropertyNames(imports); - let i = -1; - while (++i < keys.length) { - const key = keys[i]; - const patternIndex = key.indexOf('*'); - if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) { - const patternTrailer = key.slice(patternIndex + 1); - if (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf('*') === patternIndex) { - bestMatch = key; - bestMatchSubpath = name.slice(patternIndex, name.length - patternTrailer.length); - } - } - } - if (bestMatch) { - const target = imports[bestMatch]; - const resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, true, false, conditions); - if (resolveResult !== null && resolveResult !== undefined) { - return resolveResult; - } - } - } - } - } - throw importNotDefined(name, packageJsonUrl, base); -} -function parsePackageName(specifier, base) { - let separatorIndex = specifier.indexOf('/'); - let validPackageName = true; - let isScoped = false; - if (specifier[0] === '@') { - isScoped = true; - if (separatorIndex === -1 || specifier.length === 0) { - validPackageName = false; - } else { - separatorIndex = specifier.indexOf('/', separatorIndex + 1); - } - } - const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex); - if (invalidPackageNameRegEx.exec(packageName) !== null) { - validPackageName = false; - } - if (!validPackageName) { - throw new ERR_INVALID_MODULE_SPECIFIER(specifier, 'is not a valid package name', (0, _url().fileURLToPath)(base)); - } - const packageSubpath = '.' + (separatorIndex === -1 ? '' : specifier.slice(separatorIndex)); - return { - packageName, - packageSubpath, - isScoped - }; -} -function packageResolve(specifier, base, conditions) { - if (_module().builtinModules.includes(specifier)) { - return new (_url().URL)('node:' + specifier); - } - const { - packageName, - packageSubpath, - isScoped - } = parsePackageName(specifier, base); - const packageConfig = getPackageScopeConfig(base); - if (packageConfig.exists) { - const packageJsonUrl = (0, _url().pathToFileURL)(packageConfig.pjsonPath); - if (packageConfig.name === packageName && packageConfig.exports !== undefined && packageConfig.exports !== null) { - return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions); - } - } - let packageJsonUrl = new (_url().URL)('./node_modules/' + packageName + '/package.json', base); - let packageJsonPath = (0, _url().fileURLToPath)(packageJsonUrl); - let lastPath; - do { - const stat = tryStatSync(packageJsonPath.slice(0, -13)); - if (!stat.isDirectory()) { - lastPath = packageJsonPath; - packageJsonUrl = new (_url().URL)((isScoped ? '../../../../node_modules/' : '../../../node_modules/') + packageName + '/package.json', packageJsonUrl); - packageJsonPath = (0, _url().fileURLToPath)(packageJsonUrl); - continue; - } - const packageConfig = getPackageConfig(packageJsonPath, specifier, base); - if (packageConfig.exports !== undefined && packageConfig.exports !== null) { - return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions); - } - if (packageSubpath === '.') { - return legacyMainResolve(packageJsonUrl, packageConfig, base); - } - return new (_url().URL)(packageSubpath, packageJsonUrl); - } while (packageJsonPath.length !== lastPath.length); - throw new ERR_MODULE_NOT_FOUND(packageName, (0, _url().fileURLToPath)(base)); -} -function isRelativeSpecifier(specifier) { - if (specifier[0] === '.') { - if (specifier.length === 1 || specifier[1] === '/') return true; - if (specifier[1] === '.' && (specifier.length === 2 || specifier[2] === '/')) { - return true; - } - } - return false; -} -function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { - if (specifier === '') return false; - if (specifier[0] === '/') return true; - return isRelativeSpecifier(specifier); -} -function moduleResolve(specifier, base, conditions, preserveSymlinks) { - const protocol = base.protocol; - const isRemote = protocol === 'http:' || protocol === 'https:'; - let resolved; - if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { - resolved = new (_url().URL)(specifier, base); - } else if (!isRemote && specifier[0] === '#') { - resolved = packageImportsResolve(specifier, base, conditions); - } else { - try { - resolved = new (_url().URL)(specifier); - } catch (_unused4) { - if (!isRemote) { - resolved = packageResolve(specifier, base, conditions); - } - } - } - _assert()(resolved !== undefined, 'expected to be defined'); - if (resolved.protocol !== 'file:') { - return resolved; - } - return finalizeResolution(resolved, base, preserveSymlinks); -} -function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { - if (parsedParentURL) { - const parentProtocol = parsedParentURL.protocol; - if (parentProtocol === 'http:' || parentProtocol === 'https:') { - if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { - const parsedProtocol = parsed == null ? void 0 : parsed.protocol; - if (parsedProtocol && parsedProtocol !== 'https:' && parsedProtocol !== 'http:') { - throw new ERR_NETWORK_IMPORT_DISALLOWED(specifier, parsedParentURL, 'remote imports cannot import from a local location.'); - } - return { - url: (parsed == null ? void 0 : parsed.href) || '' - }; - } - if (_module().builtinModules.includes(specifier)) { - throw new ERR_NETWORK_IMPORT_DISALLOWED(specifier, parsedParentURL, 'remote imports cannot import from a local location.'); - } - throw new ERR_NETWORK_IMPORT_DISALLOWED(specifier, parsedParentURL, 'only relative and absolute specifiers are supported.'); - } - } -} -function isURL(self) { - return Boolean(self && typeof self === 'object' && 'href' in self && typeof self.href === 'string' && 'protocol' in self && typeof self.protocol === 'string' && self.href && self.protocol); -} -function throwIfInvalidParentURL(parentURL) { - if (parentURL === undefined) { - return; - } - if (typeof parentURL !== 'string' && !isURL(parentURL)) { - throw new codes.ERR_INVALID_ARG_TYPE('parentURL', ['string', 'URL'], parentURL); - } -} -function throwIfUnsupportedURLProtocol(url) { - const protocol = url.protocol; - if (protocol !== 'file:' && protocol !== 'data:' && protocol !== 'node:') { - throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(url); - } -} -function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) { - const protocol = parsed == null ? void 0 : parsed.protocol; - if (protocol && protocol !== 'file:' && protocol !== 'data:' && (!experimentalNetworkImports || protocol !== 'https:' && protocol !== 'http:')) { - throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, ['file', 'data'].concat(experimentalNetworkImports ? ['https', 'http'] : [])); - } -} -function defaultResolve(specifier, context = {}) { - const { - parentURL - } = context; - _assert()(parentURL !== undefined, 'expected `parentURL` to be defined'); - throwIfInvalidParentURL(parentURL); - let parsedParentURL; - if (parentURL) { - try { - parsedParentURL = new (_url().URL)(parentURL); - } catch (_unused5) {} - } - let parsed; - try { - parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier) ? new (_url().URL)(specifier, parsedParentURL) : new (_url().URL)(specifier); - const protocol = parsed.protocol; - if (protocol === 'data:' || experimentalNetworkImports && (protocol === 'https:' || protocol === 'http:')) { - return { - url: parsed.href, - format: null - }; - } - } catch (_unused6) {} - const maybeReturn = checkIfDisallowedImport(specifier, parsed, parsedParentURL); - if (maybeReturn) return maybeReturn; - if (parsed && parsed.protocol === 'node:') return { - url: specifier - }; - throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports); - const conditions = getConditionsSet(context.conditions); - const url = moduleResolve(specifier, new (_url().URL)(parentURL), conditions, false); - throwIfUnsupportedURLProtocol(url); - return { - url: url.href, - format: defaultGetFormatWithoutErrors(url, { - parentURL - }) - }; -} -function resolve(specifier, parent) { - if (!parent) { - throw new Error('Please pass `parent`: `import-meta-resolve` cannot ponyfill that'); - } - try { - return defaultResolve(specifier, { - parentURL: parent - }).url; - } catch (error) { - const exception = error; - if (exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' && typeof exception.url === 'string') { - return exception.url; - } - throw error; - } -} -0 && 0; - -//# sourceMappingURL=import-meta-resolve.js.map diff --git a/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map b/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map deleted file mode 100644 index dd058665f..000000000 --- a/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_assert","data","require","_fs","_interopRequireWildcard","_process","_url","_path","_module","_v","_util","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","isWindows","process","platform","own$1","classRegExp","kTypes","Set","codes","formatList","array","type","length","join","slice","messages","Map","nodeInternalPrefix","userStackTraceLimit","ERR_INVALID_ARG_TYPE","createError","name","expected","actual","assert","Array","isArray","message","endsWith","includes","types","instances","other","value","push","toLowerCase","exec","pos","indexOf","determineSpecificType","TypeError","ERR_INVALID_MODULE_SPECIFIER","request","reason","base","undefined","ERR_INVALID_PACKAGE_CONFIG","path","Error","ERR_INVALID_PACKAGE_TARGET","pkgPath","target","isImport","relError","startsWith","JSON","stringify","ERR_MODULE_NOT_FOUND","ERR_NETWORK_IMPORT_DISALLOWED","ERR_PACKAGE_IMPORT_NOT_DEFINED","specifier","packagePath","ERR_PACKAGE_PATH_NOT_EXPORTED","subpath","ERR_UNSUPPORTED_DIR_IMPORT","ERR_UNKNOWN_FILE_EXTENSION","ext","ERR_INVALID_ARG_VALUE","inspected","inspect","ERR_UNSUPPORTED_ESM_URL_SCHEME","url","supported","protocol","sym","def","makeNodeErrorWithCode","Base","NodeError","args","limit","stackTraceLimit","isErrorStackTraceLimitWritable","error","getMessage","defineProperties","enumerable","writable","configurable","toString","captureLargerStackTrace","code","v8","startupSnapshot","isBuildingSnapshot","_unused","isExtensible","hideStackFrames","fn","hidden","stackTraceLimitIsWritable","Number","POSITIVE_INFINITY","captureStackTrace","self","Reflect","apply","regex","expectedLength","unshift","format","String","constructor","depth","colors","reader","read","jsonPath","string","fs","readFileSync","toNamespacedPath","dirname","exception","ERR_INVALID_PACKAGE_CONFIG$1","packageJsonCache","getPackageConfig","existing","source","packageConfig","pjsonPath","exists","main","exports","imports","packageJson","parse","fileURLToPath","getPackageScopeConfig","resolved","packageJsonUrl","URL","packageJsonPath","pathname","lastPackageJsonUrl","getPackageType","extensionFormatMap","__proto__","mimeToFormat","mime","test","protocolHandlers","getDataProtocolModuleFormat","getFileProtocolModuleFormat","getHttpProtocolModuleFormat","node:","parsed","extname","index","codePointAt","_context","ignoreErrors","filepath","defaultGetFormatWithoutErrors","context","DEFAULT_CONDITIONS","freeze","DEFAULT_CONDITIONS_SET","getDefaultConditions","getDefaultConditionsSet","getConditionsSet","conditions","RegExpPrototypeSymbolReplace","RegExp","Symbol","replace","experimentalNetworkImports","own","invalidSegmentRegEx","deprecatedInvalidSegmentRegEx","invalidPackageNameRegEx","patternRegEx","encodedSepRegEx","emittedPackageWarnings","doubleSlashRegEx","emitInvalidSegmentDeprecation","match","internal","isTarget","double","emitWarning","emitLegacyIndexDeprecation","parentURL","href","basePath","tryStatSync","statSync","_unused2","Stats","fileExists","stats","throwIfNoEntry","isFile","legacyMainResolve","guess","tries","i","finalizeResolution","preserveSymlinks","filePath","isDirectory","real","realpathSync","search","hash","pathToFileURL","sep","importNotDefined","exportsNotFound","throwInvalidSubpath","invalidPackageTarget","resolvePackageTargetString","pattern","isPathMap","isURL","_unused3","exportTarget","packageResolve","resolvedTarget","resolvedPath","isArrayIndex","keyNumber","resolvePackageTarget","packageSubpath","targetList","lastException","targetItem","resolveResult","keys","getOwnPropertyNames","conditionalTarget","isConditionalExportsMainSugar","isConditionalSugar","j","curIsConditionalSugar","emitTrailingSlashPatternDeprecation","pjsonUrl","add","packageExportsResolve","bestMatch","bestMatchSubpath","patternIndex","patternTrailer","patternKeyCompare","lastIndexOf","a","b","aPatternIndex","bPatternIndex","baseLengthA","baseLengthB","packageImportsResolve","parsePackageName","separatorIndex","validPackageName","isScoped","packageName","builtinModules","lastPath","stat","isRelativeSpecifier","shouldBeTreatedAsRelativeOrAbsolutePath","moduleResolve","isRemote","_unused4","checkIfDisallowedImport","parsedParentURL","parentProtocol","parsedProtocol","Boolean","throwIfInvalidParentURL","throwIfUnsupportedURLProtocol","throwIfUnsupportedURLScheme","concat","defaultResolve","_unused5","_unused6","maybeReturn","resolve","parent"],"sources":["../../src/vendor/import-meta-resolve.js"],"sourcesContent":["\n/****************************************************************************\\\n * NOTE FROM BABEL AUTHORS *\n * This file is inlined from https://github.com/wooorm/import-meta-resolve, *\n * because we need to compile it to CommonJS. *\n\\****************************************************************************/\n\n/*\n(The MIT License)\n\nCopyright (c) 2021 Titus Wormer \n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---\n\nThis is a derivative work based on:\n.\nWhich is licensed:\n\n\"\"\"\nCopyright Node.js contributors. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n\nThis license applies to parts of Node.js originating from the\nhttps://github.com/joyent/node repository:\n\n\"\"\"\nCopyright Joyent, Inc. and other Node contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n*/\n\nimport assert from 'assert';\nimport fs, { realpathSync, statSync, Stats } from 'fs';\nimport process from 'process';\nimport { fileURLToPath, URL, pathToFileURL } from 'url';\nimport path from 'path';\nimport { builtinModules } from 'module';\nimport v8 from 'v8';\nimport { format, inspect } from 'util';\n\n/**\n * @typedef ErrnoExceptionFields\n * @property {number | undefined} [errnode]\n * @property {string | undefined} [code]\n * @property {string | undefined} [path]\n * @property {string | undefined} [syscall]\n * @property {string | undefined} [url]\n *\n * @typedef {Error & ErrnoExceptionFields} ErrnoException\n */\n\nconst isWindows = process.platform === 'win32';\n\nconst own$1 = {}.hasOwnProperty;\n\nconst classRegExp = /^([A-Z][a-z\\d]*)+$/;\n// Sorted by a rough estimate on most frequently used entries.\nconst kTypes = new Set([\n 'string',\n 'function',\n 'number',\n 'object',\n // Accept 'Function' and 'Object' as alternative to the lower cased version.\n 'Function',\n 'Object',\n 'boolean',\n 'bigint',\n 'symbol'\n]);\n\nconst codes = {};\n\n/**\n * Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.\n * We cannot use Intl.ListFormat because it's not available in\n * --without-intl builds.\n *\n * @param {Array} array\n * An array of strings.\n * @param {string} [type]\n * The list type to be inserted before the last element.\n * @returns {string}\n */\nfunction formatList(array, type = 'and') {\n return array.length < 3\n ? array.join(` ${type} `)\n : `${array.slice(0, -1).join(', ')}, ${type} ${array[array.length - 1]}`\n}\n\n/** @type {Map} */\nconst messages = new Map();\nconst nodeInternalPrefix = '__node_internal_';\n/** @type {number} */\nlet userStackTraceLimit;\n\ncodes.ERR_INVALID_ARG_TYPE = createError(\n 'ERR_INVALID_ARG_TYPE',\n /**\n * @param {string} name\n * @param {Array | string} expected\n * @param {unknown} actual\n */\n (name, expected, actual) => {\n assert(typeof name === 'string', \"'name' must be a string\");\n if (!Array.isArray(expected)) {\n expected = [expected];\n }\n\n let message = 'The ';\n if (name.endsWith(' argument')) {\n // For cases like 'first argument'\n message += `${name} `;\n } else {\n const type = name.includes('.') ? 'property' : 'argument';\n message += `\"${name}\" ${type} `;\n }\n\n message += 'must be ';\n\n /** @type {Array} */\n const types = [];\n /** @type {Array} */\n const instances = [];\n /** @type {Array} */\n const other = [];\n\n for (const value of expected) {\n assert(\n typeof value === 'string',\n 'All expected entries have to be of type string'\n );\n\n if (kTypes.has(value)) {\n types.push(value.toLowerCase());\n } else if (classRegExp.exec(value) === null) {\n assert(\n value !== 'object',\n 'The value \"object\" should be written as \"Object\"'\n );\n other.push(value);\n } else {\n instances.push(value);\n }\n }\n\n // Special handle `object` in case other instances are allowed to outline\n // the differences between each other.\n if (instances.length > 0) {\n const pos = types.indexOf('object');\n if (pos !== -1) {\n types.slice(pos, 1);\n instances.push('Object');\n }\n }\n\n if (types.length > 0) {\n message += `${types.length > 1 ? 'one of type' : 'of type'} ${formatList(\n types,\n 'or'\n )}`;\n if (instances.length > 0 || other.length > 0) message += ' or ';\n }\n\n if (instances.length > 0) {\n message += `an instance of ${formatList(instances, 'or')}`;\n if (other.length > 0) message += ' or ';\n }\n\n if (other.length > 0) {\n if (other.length > 1) {\n message += `one of ${formatList(other, 'or')}`;\n } else {\n if (other[0].toLowerCase() !== other[0]) message += 'an ';\n message += `${other[0]}`;\n }\n }\n\n message += `. Received ${determineSpecificType(actual)}`;\n\n return message\n },\n TypeError\n);\n\ncodes.ERR_INVALID_MODULE_SPECIFIER = createError(\n 'ERR_INVALID_MODULE_SPECIFIER',\n /**\n * @param {string} request\n * @param {string} reason\n * @param {string} [base]\n */\n (request, reason, base = undefined) => {\n return `Invalid module \"${request}\" ${reason}${\n base ? ` imported from ${base}` : ''\n }`\n },\n TypeError\n);\n\ncodes.ERR_INVALID_PACKAGE_CONFIG = createError(\n 'ERR_INVALID_PACKAGE_CONFIG',\n /**\n * @param {string} path\n * @param {string} [base]\n * @param {string} [message]\n */\n (path, base, message) => {\n return `Invalid package config ${path}${\n base ? ` while importing ${base}` : ''\n }${message ? `. ${message}` : ''}`\n },\n Error\n);\n\ncodes.ERR_INVALID_PACKAGE_TARGET = createError(\n 'ERR_INVALID_PACKAGE_TARGET',\n /**\n * @param {string} pkgPath\n * @param {string} key\n * @param {unknown} target\n * @param {boolean} [isImport=false]\n * @param {string} [base]\n */\n (pkgPath, key, target, isImport = false, base = undefined) => {\n const relError =\n typeof target === 'string' &&\n !isImport &&\n target.length > 0 &&\n !target.startsWith('./');\n if (key === '.') {\n assert(isImport === false);\n return (\n `Invalid \"exports\" main target ${JSON.stringify(target)} defined ` +\n `in the package config ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }${relError ? '; targets must start with \"./\"' : ''}`\n )\n }\n\n return `Invalid \"${\n isImport ? 'imports' : 'exports'\n }\" target ${JSON.stringify(\n target\n )} defined for '${key}' in the package config ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }${relError ? '; targets must start with \"./\"' : ''}`\n },\n Error\n);\n\ncodes.ERR_MODULE_NOT_FOUND = createError(\n 'ERR_MODULE_NOT_FOUND',\n /**\n * @param {string} path\n * @param {string} base\n * @param {string} [type]\n */\n (path, base, type = 'package') => {\n return `Cannot find ${type} '${path}' imported from ${base}`\n },\n Error\n);\n\ncodes.ERR_NETWORK_IMPORT_DISALLOWED = createError(\n 'ERR_NETWORK_IMPORT_DISALLOWED',\n \"import of '%s' by %s is not supported: %s\",\n Error\n);\n\ncodes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(\n 'ERR_PACKAGE_IMPORT_NOT_DEFINED',\n /**\n * @param {string} specifier\n * @param {string} packagePath\n * @param {string} base\n */\n (specifier, packagePath, base) => {\n return `Package import specifier \"${specifier}\" is not defined${\n packagePath ? ` in package ${packagePath}package.json` : ''\n } imported from ${base}`\n },\n TypeError\n);\n\ncodes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(\n 'ERR_PACKAGE_PATH_NOT_EXPORTED',\n /**\n * @param {string} pkgPath\n * @param {string} subpath\n * @param {string} [base]\n */\n (pkgPath, subpath, base = undefined) => {\n if (subpath === '.')\n return `No \"exports\" main defined in ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }`\n return `Package subpath '${subpath}' is not defined by \"exports\" in ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }`\n },\n Error\n);\n\ncodes.ERR_UNSUPPORTED_DIR_IMPORT = createError(\n 'ERR_UNSUPPORTED_DIR_IMPORT',\n \"Directory import '%s' is not supported \" +\n 'resolving ES modules imported from %s',\n Error\n);\n\ncodes.ERR_UNKNOWN_FILE_EXTENSION = createError(\n 'ERR_UNKNOWN_FILE_EXTENSION',\n /**\n * @param {string} ext\n * @param {string} path\n */\n (ext, path) => {\n return `Unknown file extension \"${ext}\" for ${path}`\n },\n TypeError\n);\n\ncodes.ERR_INVALID_ARG_VALUE = createError(\n 'ERR_INVALID_ARG_VALUE',\n /**\n * @param {string} name\n * @param {unknown} value\n * @param {string} [reason='is invalid']\n */\n (name, value, reason = 'is invalid') => {\n let inspected = inspect(value);\n\n if (inspected.length > 128) {\n inspected = `${inspected.slice(0, 128)}...`;\n }\n\n const type = name.includes('.') ? 'property' : 'argument';\n\n return `The ${type} '${name}' ${reason}. Received ${inspected}`\n },\n TypeError\n // Note: extra classes have been shaken out.\n // , RangeError\n);\n\ncodes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError(\n 'ERR_UNSUPPORTED_ESM_URL_SCHEME',\n /**\n * @param {URL} url\n * @param {Array} supported\n */\n (url, supported) => {\n let message = `Only URLs with a scheme in: ${formatList(\n supported\n )} are supported by the default ESM loader`;\n\n if (isWindows && url.protocol.length === 2) {\n message += '. On Windows, absolute paths must be valid file:// URLs';\n }\n\n message += `. Received protocol '${url.protocol}'`;\n return message\n },\n Error\n);\n\n/**\n * Utility function for registering the error codes. Only used here. Exported\n * *only* to allow for testing.\n * @param {string} sym\n * @param {MessageFunction | string} value\n * @param {ErrorConstructor} def\n * @returns {new (...args: Array) => Error}\n */\nfunction createError(sym, value, def) {\n // Special case for SystemError that formats the error message differently\n // The SystemErrors only have SystemError as their base classes.\n messages.set(sym, value);\n\n return makeNodeErrorWithCode(def, sym)\n}\n\n/**\n * @param {ErrorConstructor} Base\n * @param {string} key\n * @returns {ErrorConstructor}\n */\nfunction makeNodeErrorWithCode(Base, key) {\n // @ts-expect-error It’s a Node error.\n return NodeError\n /**\n * @param {Array} args\n */\n function NodeError(...args) {\n const limit = Error.stackTraceLimit;\n if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;\n const error = new Base();\n // Reset the limit and setting the name property.\n if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;\n const message = getMessage(key, args, error);\n Object.defineProperties(error, {\n // Note: no need to implement `kIsNodeError` symbol, would be hard,\n // probably.\n message: {\n value: message,\n enumerable: false,\n writable: true,\n configurable: true\n },\n toString: {\n /** @this {Error} */\n value() {\n return `${this.name} [${key}]: ${this.message}`\n },\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n\n captureLargerStackTrace(error);\n // @ts-expect-error It’s a Node error.\n error.code = key;\n return error\n }\n}\n\n/**\n * @returns {boolean}\n */\nfunction isErrorStackTraceLimitWritable() {\n // Do no touch Error.stackTraceLimit as V8 would attempt to install\n // it again during deserialization.\n try {\n // @ts-expect-error: not in types?\n if (v8.startupSnapshot.isBuildingSnapshot()) {\n return false\n }\n } catch {}\n\n const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit');\n if (desc === undefined) {\n return Object.isExtensible(Error)\n }\n\n return own$1.call(desc, 'writable') && desc.writable !== undefined\n ? desc.writable\n : desc.set !== undefined\n}\n\n/**\n * This function removes unnecessary frames from Node.js core errors.\n * @template {(...args: unknown[]) => unknown} T\n * @param {T} fn\n * @returns {T}\n */\nfunction hideStackFrames(fn) {\n // We rename the functions that will be hidden to cut off the stacktrace\n // at the outermost one\n const hidden = nodeInternalPrefix + fn.name;\n Object.defineProperty(fn, 'name', {value: hidden});\n return fn\n}\n\nconst captureLargerStackTrace = hideStackFrames(\n /**\n * @param {Error} error\n * @returns {Error}\n */\n // @ts-expect-error: fine\n function (error) {\n const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();\n if (stackTraceLimitIsWritable) {\n userStackTraceLimit = Error.stackTraceLimit;\n Error.stackTraceLimit = Number.POSITIVE_INFINITY;\n }\n\n Error.captureStackTrace(error);\n\n // Reset the limit\n if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;\n\n return error\n }\n);\n\n/**\n * @param {string} key\n * @param {Array} args\n * @param {Error} self\n * @returns {string}\n */\nfunction getMessage(key, args, self) {\n const message = messages.get(key);\n assert(message !== undefined, 'expected `message` to be found');\n\n if (typeof message === 'function') {\n assert(\n message.length <= args.length, // Default options do not count.\n `Code: ${key}; The provided arguments length (${args.length}) does not ` +\n `match the required ones (${message.length}).`\n );\n return Reflect.apply(message, self, args)\n }\n\n const regex = /%[dfijoOs]/g;\n let expectedLength = 0;\n while (regex.exec(message) !== null) expectedLength++;\n assert(\n expectedLength === args.length,\n `Code: ${key}; The provided arguments length (${args.length}) does not ` +\n `match the required ones (${expectedLength}).`\n );\n if (args.length === 0) return message\n\n args.unshift(message);\n return Reflect.apply(format, null, args)\n}\n\n/**\n * Determine the specific type of a value for type-mismatch errors.\n * @param {unknown} value\n * @returns {string}\n */\nfunction determineSpecificType(value) {\n if (value === null || value === undefined) {\n return String(value)\n }\n\n if (typeof value === 'function' && value.name) {\n return `function ${value.name}`\n }\n\n if (typeof value === 'object') {\n if (value.constructor && value.constructor.name) {\n return `an instance of ${value.constructor.name}`\n }\n\n return `${inspect(value, {depth: -1})}`\n }\n\n let inspected = inspect(value, {colors: false});\n\n if (inspected.length > 28) {\n inspected = `${inspected.slice(0, 25)}...`;\n }\n\n return `type ${typeof value} (${inspected})`\n}\n\n// Manually “tree shaken” from:\n\nconst reader = {read};\n\n/**\n * @param {string} jsonPath\n * @returns {{string: string | undefined}}\n */\nfunction read(jsonPath) {\n try {\n const string = fs.readFileSync(\n path.toNamespacedPath(path.join(path.dirname(jsonPath), 'package.json')),\n 'utf8'\n );\n return {string}\n } catch (error) {\n const exception = /** @type {ErrnoException} */ (error);\n\n if (exception.code === 'ENOENT') {\n return {string: undefined}\n // Throw all other errors.\n /* c8 ignore next 4 */\n }\n\n throw exception\n }\n}\n\n// Manually “tree shaken” from:\n\nconst {ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG$1} = codes;\n\n/** @type {Map} */\nconst packageJsonCache = new Map();\n\n/**\n * @param {string} path\n * @param {URL | string} specifier Note: `specifier` is actually optional, not base.\n * @param {URL} [base]\n * @returns {PackageConfig}\n */\nfunction getPackageConfig(path, specifier, base) {\n const existing = packageJsonCache.get(path);\n if (existing !== undefined) {\n return existing\n }\n\n const source = reader.read(path).string;\n\n if (source === undefined) {\n /** @type {PackageConfig} */\n const packageConfig = {\n pjsonPath: path,\n exists: false,\n main: undefined,\n name: undefined,\n type: 'none',\n exports: undefined,\n imports: undefined\n };\n packageJsonCache.set(path, packageConfig);\n return packageConfig\n }\n\n /** @type {Record} */\n let packageJson;\n try {\n packageJson = JSON.parse(source);\n } catch (error) {\n const exception = /** @type {ErrnoException} */ (error);\n\n throw new ERR_INVALID_PACKAGE_CONFIG$1(\n path,\n (base ? `\"${specifier}\" from ` : '') + fileURLToPath(base || specifier),\n exception.message\n )\n }\n\n const {exports, imports, main, name, type} = packageJson;\n\n /** @type {PackageConfig} */\n const packageConfig = {\n pjsonPath: path,\n exists: true,\n main: typeof main === 'string' ? main : undefined,\n name: typeof name === 'string' ? name : undefined,\n type: type === 'module' || type === 'commonjs' ? type : 'none',\n // @ts-expect-error Assume `Record`.\n exports,\n // @ts-expect-error Assume `Record`.\n imports: imports && typeof imports === 'object' ? imports : undefined\n };\n packageJsonCache.set(path, packageConfig);\n return packageConfig\n}\n\n/**\n * @param {URL} resolved\n * @returns {PackageConfig}\n */\nfunction getPackageScopeConfig(resolved) {\n let packageJsonUrl = new URL('package.json', resolved);\n\n while (true) {\n const packageJsonPath = packageJsonUrl.pathname;\n\n if (packageJsonPath.endsWith('node_modules/package.json')) break\n\n const packageConfig = getPackageConfig(\n fileURLToPath(packageJsonUrl),\n resolved\n );\n if (packageConfig.exists) return packageConfig\n\n const lastPackageJsonUrl = packageJsonUrl;\n packageJsonUrl = new URL('../package.json', packageJsonUrl);\n\n // Terminates at root where ../package.json equals ../../package.json\n // (can't just check \"/package.json\" for Windows support).\n if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) break\n }\n\n const packageJsonPath = fileURLToPath(packageJsonUrl);\n /** @type {PackageConfig} */\n const packageConfig = {\n pjsonPath: packageJsonPath,\n exists: false,\n main: undefined,\n name: undefined,\n type: 'none',\n exports: undefined,\n imports: undefined\n };\n packageJsonCache.set(packageJsonPath, packageConfig);\n return packageConfig\n}\n\n// Manually “tree shaken” from:\n\n/**\n * @param {URL} url\n * @returns {PackageType}\n */\nfunction getPackageType(url) {\n const packageConfig = getPackageScopeConfig(url);\n return packageConfig.type\n}\n\n// Manually “tree shaken” from:\n\nconst {ERR_UNKNOWN_FILE_EXTENSION} = codes;\n\nconst hasOwnProperty = {}.hasOwnProperty;\n\n/** @type {Record} */\nconst extensionFormatMap = {\n // @ts-expect-error: hush.\n __proto__: null,\n '.cjs': 'commonjs',\n '.js': 'module',\n '.json': 'json',\n '.mjs': 'module'\n};\n\n/**\n * @param {string | null} mime\n * @returns {string | null}\n */\nfunction mimeToFormat(mime) {\n if (\n mime &&\n /\\s*(text|application)\\/javascript\\s*(;\\s*charset=utf-?8\\s*)?/i.test(mime)\n )\n return 'module'\n if (mime === 'application/json') return 'json'\n return null\n}\n\n/**\n * @callback ProtocolHandler\n * @param {URL} parsed\n * @param {{parentURL: string}} context\n * @param {boolean} ignoreErrors\n * @returns {string | null | void}\n */\n\n/**\n * @type {Record}\n */\nconst protocolHandlers = {\n // @ts-expect-error: hush.\n __proto__: null,\n 'data:': getDataProtocolModuleFormat,\n 'file:': getFileProtocolModuleFormat,\n 'http:': getHttpProtocolModuleFormat,\n 'https:': getHttpProtocolModuleFormat,\n 'node:'() {\n return 'builtin'\n }\n};\n\n/**\n * @param {URL} parsed\n */\nfunction getDataProtocolModuleFormat(parsed) {\n const {1: mime} = /^([^/]+\\/[^;,]+)[^,]*?(;base64)?,/.exec(\n parsed.pathname\n ) || [null, null, null];\n return mimeToFormat(mime)\n}\n\n/**\n * Returns the file extension from a URL.\n *\n * Should give similar result to\n * `require('node:path').extname(require('node:url').fileURLToPath(url))`\n * when used with a `file:` URL.\n *\n * @param {URL} url\n * @returns {string}\n */\nfunction extname(url) {\n const pathname = url.pathname;\n let index = pathname.length;\n\n while (index--) {\n const code = pathname.codePointAt(index);\n\n if (code === 47 /* `/` */) {\n return ''\n }\n\n if (code === 46 /* `.` */) {\n return pathname.codePointAt(index - 1) === 47 /* `/` */\n ? ''\n : pathname.slice(index)\n }\n }\n\n return ''\n}\n\n/**\n * @type {ProtocolHandler}\n */\nfunction getFileProtocolModuleFormat(url, _context, ignoreErrors) {\n const ext = extname(url);\n\n if (ext === '.js') {\n return getPackageType(url) === 'module' ? 'module' : 'commonjs'\n }\n\n const format = extensionFormatMap[ext];\n if (format) return format\n\n // Explicit undefined return indicates load hook should rerun format check\n if (ignoreErrors) {\n return undefined\n }\n\n const filepath = fileURLToPath(url);\n throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath)\n}\n\nfunction getHttpProtocolModuleFormat() {\n // To do: HTTPS imports.\n}\n\n/**\n * @param {URL} url\n * @param {{parentURL: string}} context\n * @returns {string | null}\n */\nfunction defaultGetFormatWithoutErrors(url, context) {\n if (!hasOwnProperty.call(protocolHandlers, url.protocol)) {\n return null\n }\n\n return protocolHandlers[url.protocol](url, context, true) || null\n}\n\n// Manually “tree shaken” from:\n\nconst {ERR_INVALID_ARG_VALUE} = codes;\n\n// In Node itself these values are populated from CLI arguments, before any\n// user code runs.\n// Here we just define the defaults.\nconst DEFAULT_CONDITIONS = Object.freeze(['node', 'import']);\nconst DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS);\n\nfunction getDefaultConditions() {\n return DEFAULT_CONDITIONS\n}\n\nfunction getDefaultConditionsSet() {\n return DEFAULT_CONDITIONS_SET\n}\n\n/**\n * @param {Array} [conditions]\n * @returns {Set}\n */\nfunction getConditionsSet(conditions) {\n if (conditions !== undefined && conditions !== getDefaultConditions()) {\n if (!Array.isArray(conditions)) {\n throw new ERR_INVALID_ARG_VALUE(\n 'conditions',\n conditions,\n 'expected an array'\n )\n }\n\n return new Set(conditions)\n }\n\n return getDefaultConditionsSet()\n}\n\n// Manually “tree shaken” from:\n\nconst RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];\n\n// To do: potentially enable?\nconst experimentalNetworkImports = false;\n\nconst {\n ERR_NETWORK_IMPORT_DISALLOWED,\n ERR_INVALID_MODULE_SPECIFIER,\n ERR_INVALID_PACKAGE_CONFIG,\n ERR_INVALID_PACKAGE_TARGET,\n ERR_MODULE_NOT_FOUND,\n ERR_PACKAGE_IMPORT_NOT_DEFINED,\n ERR_PACKAGE_PATH_NOT_EXPORTED,\n ERR_UNSUPPORTED_DIR_IMPORT,\n ERR_UNSUPPORTED_ESM_URL_SCHEME\n} = codes;\n\nconst own = {}.hasOwnProperty;\n\nconst invalidSegmentRegEx =\n /(^|\\\\|\\/)((\\.|%2e)(\\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\\\|\\/|$)/i;\nconst deprecatedInvalidSegmentRegEx =\n /(^|\\\\|\\/)((\\.|%2e)(\\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\\\|\\/|$)/i;\nconst invalidPackageNameRegEx = /^\\.|%|\\\\/;\nconst patternRegEx = /\\*/g;\nconst encodedSepRegEx = /%2f|%5c/i;\n/** @type {Set} */\nconst emittedPackageWarnings = new Set();\n\nconst doubleSlashRegEx = /[/\\\\]{2}/;\n\n/**\n *\n * @param {string} target\n * @param {string} request\n * @param {string} match\n * @param {URL} packageJsonUrl\n * @param {boolean} internal\n * @param {URL} base\n * @param {boolean} isTarget\n */\nfunction emitInvalidSegmentDeprecation(\n target,\n request,\n match,\n packageJsonUrl,\n internal,\n base,\n isTarget\n) {\n const pjsonPath = fileURLToPath(packageJsonUrl);\n const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null;\n process.emitWarning(\n `Use of deprecated ${\n double ? 'double slash' : 'leading or trailing slash matching'\n } resolving \"${target}\" for module ` +\n `request \"${request}\" ${\n request === match ? '' : `matched to \"${match}\" `\n }in the \"${\n internal ? 'imports' : 'exports'\n }\" field module resolution of the package at ${pjsonPath}${\n base ? ` imported from ${fileURLToPath(base)}` : ''\n }.`,\n 'DeprecationWarning',\n 'DEP0166'\n );\n}\n\n/**\n * @param {URL} url\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @param {unknown} [main]\n * @returns {void}\n */\nfunction emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {\n const format = defaultGetFormatWithoutErrors(url, {parentURL: base.href});\n if (format !== 'module') return\n const path = fileURLToPath(url.href);\n const pkgPath = fileURLToPath(new URL('.', packageJsonUrl));\n const basePath = fileURLToPath(base);\n if (main)\n process.emitWarning(\n `Package ${pkgPath} has a \"main\" field set to ${JSON.stringify(main)}, ` +\n `excluding the full filename and extension to the resolved file at \"${path.slice(\n pkgPath.length\n )}\", imported from ${basePath}.\\n Automatic extension resolution of the \"main\" field is` +\n 'deprecated for ES modules.',\n 'DeprecationWarning',\n 'DEP0151'\n );\n else\n process.emitWarning(\n `No \"main\" or \"exports\" field defined in the package.json for ${pkgPath} resolving the main entry point \"${path.slice(\n pkgPath.length\n )}\", imported from ${basePath}.\\nDefault \"index\" lookups for the main are deprecated for ES modules.`,\n 'DeprecationWarning',\n 'DEP0151'\n );\n}\n\n/**\n * @param {string} path\n * @returns {Stats}\n */\nfunction tryStatSync(path) {\n // Note: from Node 15 onwards we can use `throwIfNoEntry: false` instead.\n try {\n return statSync(path)\n } catch {\n return new Stats()\n }\n}\n\n/**\n * Legacy CommonJS main resolution:\n * 1. let M = pkg_url + (json main field)\n * 2. TRY(M, M.js, M.json, M.node)\n * 3. TRY(M/index.js, M/index.json, M/index.node)\n * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node)\n * 5. NOT_FOUND\n *\n * @param {URL} url\n * @returns {boolean}\n */\nfunction fileExists(url) {\n const stats = statSync(url, {throwIfNoEntry: false});\n const isFile = stats ? stats.isFile() : undefined;\n return isFile === null || isFile === undefined ? false : isFile\n}\n\n/**\n * @param {URL} packageJsonUrl\n * @param {PackageConfig} packageConfig\n * @param {URL} base\n * @returns {URL}\n */\nfunction legacyMainResolve(packageJsonUrl, packageConfig, base) {\n /** @type {URL | undefined} */\n let guess;\n if (packageConfig.main !== undefined) {\n guess = new URL(packageConfig.main, packageJsonUrl);\n // Note: fs check redundances will be handled by Descriptor cache here.\n if (fileExists(guess)) return guess\n\n const tries = [\n `./${packageConfig.main}.js`,\n `./${packageConfig.main}.json`,\n `./${packageConfig.main}.node`,\n `./${packageConfig.main}/index.js`,\n `./${packageConfig.main}/index.json`,\n `./${packageConfig.main}/index.node`\n ];\n let i = -1;\n\n while (++i < tries.length) {\n guess = new URL(tries[i], packageJsonUrl);\n if (fileExists(guess)) break\n guess = undefined;\n }\n\n if (guess) {\n emitLegacyIndexDeprecation(\n guess,\n packageJsonUrl,\n base,\n packageConfig.main\n );\n return guess\n }\n // Fallthrough.\n }\n\n const tries = ['./index.js', './index.json', './index.node'];\n let i = -1;\n\n while (++i < tries.length) {\n guess = new URL(tries[i], packageJsonUrl);\n if (fileExists(guess)) break\n guess = undefined;\n }\n\n if (guess) {\n emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);\n return guess\n }\n\n // Not found.\n throw new ERR_MODULE_NOT_FOUND(\n fileURLToPath(new URL('.', packageJsonUrl)),\n fileURLToPath(base)\n )\n}\n\n/**\n * @param {URL} resolved\n * @param {URL} base\n * @param {boolean} [preserveSymlinks]\n * @returns {URL}\n */\nfunction finalizeResolution(resolved, base, preserveSymlinks) {\n if (encodedSepRegEx.exec(resolved.pathname) !== null)\n throw new ERR_INVALID_MODULE_SPECIFIER(\n resolved.pathname,\n 'must not include encoded \"/\" or \"\\\\\" characters',\n fileURLToPath(base)\n )\n\n const filePath = fileURLToPath(resolved);\n\n const stats = tryStatSync(\n filePath.endsWith('/') ? filePath.slice(-1) : filePath\n );\n\n if (stats.isDirectory()) {\n const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath(base));\n // @ts-expect-error Add this for `import.meta.resolve`.\n error.url = String(resolved);\n throw error\n }\n\n if (!stats.isFile()) {\n throw new ERR_MODULE_NOT_FOUND(\n filePath || resolved.pathname,\n base && fileURLToPath(base),\n 'module'\n )\n }\n\n if (!preserveSymlinks) {\n const real = realpathSync(filePath);\n const {search, hash} = resolved;\n resolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? '/' : ''));\n resolved.search = search;\n resolved.hash = hash;\n }\n\n return resolved\n}\n\n/**\n * @param {string} specifier\n * @param {URL | undefined} packageJsonUrl\n * @param {URL} base\n * @returns {Error}\n */\nfunction importNotDefined(specifier, packageJsonUrl, base) {\n return new ERR_PACKAGE_IMPORT_NOT_DEFINED(\n specifier,\n packageJsonUrl && fileURLToPath(new URL('.', packageJsonUrl)),\n fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} subpath\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @returns {Error}\n */\nfunction exportsNotFound(subpath, packageJsonUrl, base) {\n return new ERR_PACKAGE_PATH_NOT_EXPORTED(\n fileURLToPath(new URL('.', packageJsonUrl)),\n subpath,\n base && fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} request\n * @param {string} match\n * @param {URL} packageJsonUrl\n * @param {boolean} internal\n * @param {URL} [base]\n * @returns {never}\n */\nfunction throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {\n const reason = `request is not a valid match in pattern \"${match}\" for the \"${\n internal ? 'imports' : 'exports'\n }\" resolution of ${fileURLToPath(packageJsonUrl)}`;\n throw new ERR_INVALID_MODULE_SPECIFIER(\n request,\n reason,\n base && fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} subpath\n * @param {unknown} target\n * @param {URL} packageJsonUrl\n * @param {boolean} internal\n * @param {URL} [base]\n * @returns {Error}\n */\nfunction invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {\n target =\n typeof target === 'object' && target !== null\n ? JSON.stringify(target, null, '')\n : `${target}`;\n\n return new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(new URL('.', packageJsonUrl)),\n subpath,\n target,\n internal,\n base && fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} target\n * @param {string} subpath\n * @param {string} match\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @param {boolean} pattern\n * @param {boolean} internal\n * @param {boolean} isPathMap\n * @param {Set | undefined} conditions\n * @returns {URL}\n */\nfunction resolvePackageTargetString(\n target,\n subpath,\n match,\n packageJsonUrl,\n base,\n pattern,\n internal,\n isPathMap,\n conditions\n) {\n if (subpath !== '' && !pattern && target[target.length - 1] !== '/')\n throw invalidPackageTarget(match, target, packageJsonUrl, internal, base)\n\n if (!target.startsWith('./')) {\n if (internal && !target.startsWith('../') && !target.startsWith('/')) {\n let isURL = false;\n\n try {\n new URL(target);\n isURL = true;\n } catch {\n // Continue regardless of error.\n }\n\n if (!isURL) {\n const exportTarget = pattern\n ? RegExpPrototypeSymbolReplace.call(\n patternRegEx,\n target,\n () => subpath\n )\n : target + subpath;\n\n return packageResolve(exportTarget, packageJsonUrl, conditions)\n }\n }\n\n throw invalidPackageTarget(match, target, packageJsonUrl, internal, base)\n }\n\n if (invalidSegmentRegEx.exec(target.slice(2)) !== null) {\n if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {\n if (!isPathMap) {\n const request = pattern\n ? match.replace('*', () => subpath)\n : match + subpath;\n const resolvedTarget = pattern\n ? RegExpPrototypeSymbolReplace.call(\n patternRegEx,\n target,\n () => subpath\n )\n : target;\n emitInvalidSegmentDeprecation(\n resolvedTarget,\n request,\n match,\n packageJsonUrl,\n internal,\n base,\n true\n );\n }\n } else {\n throw invalidPackageTarget(match, target, packageJsonUrl, internal, base)\n }\n }\n\n const resolved = new URL(target, packageJsonUrl);\n const resolvedPath = resolved.pathname;\n const packagePath = new URL('.', packageJsonUrl).pathname;\n\n if (!resolvedPath.startsWith(packagePath))\n throw invalidPackageTarget(match, target, packageJsonUrl, internal, base)\n\n if (subpath === '') return resolved\n\n if (invalidSegmentRegEx.exec(subpath) !== null) {\n const request = pattern\n ? match.replace('*', () => subpath)\n : match + subpath;\n if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) {\n if (!isPathMap) {\n const resolvedTarget = pattern\n ? RegExpPrototypeSymbolReplace.call(\n patternRegEx,\n target,\n () => subpath\n )\n : target;\n emitInvalidSegmentDeprecation(\n resolvedTarget,\n request,\n match,\n packageJsonUrl,\n internal,\n base,\n false\n );\n }\n } else {\n throwInvalidSubpath(request, match, packageJsonUrl, internal, base);\n }\n }\n\n if (pattern) {\n return new URL(\n RegExpPrototypeSymbolReplace.call(\n patternRegEx,\n resolved.href,\n () => subpath\n )\n )\n }\n\n return new URL(subpath, resolved)\n}\n\n/**\n * @param {string} key\n * @returns {boolean}\n */\nfunction isArrayIndex(key) {\n const keyNumber = Number(key);\n if (`${keyNumber}` !== key) return false\n return keyNumber >= 0 && keyNumber < 0xff_ff_ff_ff\n}\n\n/**\n * @param {URL} packageJsonUrl\n * @param {unknown} target\n * @param {string} subpath\n * @param {string} packageSubpath\n * @param {URL} base\n * @param {boolean} pattern\n * @param {boolean} internal\n * @param {boolean} isPathMap\n * @param {Set | undefined} conditions\n * @returns {URL | null}\n */\nfunction resolvePackageTarget(\n packageJsonUrl,\n target,\n subpath,\n packageSubpath,\n base,\n pattern,\n internal,\n isPathMap,\n conditions\n) {\n if (typeof target === 'string') {\n return resolvePackageTargetString(\n target,\n subpath,\n packageSubpath,\n packageJsonUrl,\n base,\n pattern,\n internal,\n isPathMap,\n conditions\n )\n }\n\n if (Array.isArray(target)) {\n /** @type {Array} */\n const targetList = target;\n if (targetList.length === 0) return null\n\n /** @type {ErrnoException | null | undefined} */\n let lastException;\n let i = -1;\n\n while (++i < targetList.length) {\n const targetItem = targetList[i];\n /** @type {URL | null} */\n let resolveResult;\n try {\n resolveResult = resolvePackageTarget(\n packageJsonUrl,\n targetItem,\n subpath,\n packageSubpath,\n base,\n pattern,\n internal,\n isPathMap,\n conditions\n );\n } catch (error) {\n const exception = /** @type {ErrnoException} */ (error);\n lastException = exception;\n if (exception.code === 'ERR_INVALID_PACKAGE_TARGET') continue\n throw error\n }\n\n if (resolveResult === undefined) continue\n\n if (resolveResult === null) {\n lastException = null;\n continue\n }\n\n return resolveResult\n }\n\n if (lastException === undefined || lastException === null) {\n return null\n }\n\n throw lastException\n }\n\n if (typeof target === 'object' && target !== null) {\n const keys = Object.getOwnPropertyNames(target);\n let i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n if (isArrayIndex(key)) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n fileURLToPath(packageJsonUrl),\n base,\n '\"exports\" cannot contain numeric property keys.'\n )\n }\n }\n\n i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n if (key === 'default' || (conditions && conditions.has(key))) {\n // @ts-expect-error: indexable.\n const conditionalTarget = /** @type {unknown} */ (target[key]);\n const resolveResult = resolvePackageTarget(\n packageJsonUrl,\n conditionalTarget,\n subpath,\n packageSubpath,\n base,\n pattern,\n internal,\n isPathMap,\n conditions\n );\n if (resolveResult === undefined) continue\n return resolveResult\n }\n }\n\n return null\n }\n\n if (target === null) {\n return null\n }\n\n throw invalidPackageTarget(\n packageSubpath,\n target,\n packageJsonUrl,\n internal,\n base\n )\n}\n\n/**\n * @param {unknown} exports\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @returns {boolean}\n */\nfunction isConditionalExportsMainSugar(exports, packageJsonUrl, base) {\n if (typeof exports === 'string' || Array.isArray(exports)) return true\n if (typeof exports !== 'object' || exports === null) return false\n\n const keys = Object.getOwnPropertyNames(exports);\n let isConditionalSugar = false;\n let i = 0;\n let j = -1;\n while (++j < keys.length) {\n const key = keys[j];\n const curIsConditionalSugar = key === '' || key[0] !== '.';\n if (i++ === 0) {\n isConditionalSugar = curIsConditionalSugar;\n } else if (isConditionalSugar !== curIsConditionalSugar) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n fileURLToPath(packageJsonUrl),\n base,\n '\"exports\" cannot contain some keys starting with \\'.\\' and some not.' +\n ' The exports object must either be an object of package subpath keys' +\n ' or an object of main entry condition name keys only.'\n )\n }\n }\n\n return isConditionalSugar\n}\n\n/**\n * @param {string} match\n * @param {URL} pjsonUrl\n * @param {URL} base\n */\nfunction emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {\n const pjsonPath = fileURLToPath(pjsonUrl);\n if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return\n emittedPackageWarnings.add(pjsonPath + '|' + match);\n process.emitWarning(\n `Use of deprecated trailing slash pattern mapping \"${match}\" in the ` +\n `\"exports\" field module resolution of the package at ${pjsonPath}${\n base ? ` imported from ${fileURLToPath(base)}` : ''\n }. Mapping specifiers ending in \"/\" is no longer supported.`,\n 'DeprecationWarning',\n 'DEP0155'\n );\n}\n\n/**\n * @param {URL} packageJsonUrl\n * @param {string} packageSubpath\n * @param {Record} packageConfig\n * @param {URL} base\n * @param {Set | undefined} conditions\n * @returns {URL}\n */\nfunction packageExportsResolve(\n packageJsonUrl,\n packageSubpath,\n packageConfig,\n base,\n conditions\n) {\n let exports = packageConfig.exports;\n\n if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) {\n exports = {'.': exports};\n }\n\n if (\n own.call(exports, packageSubpath) &&\n !packageSubpath.includes('*') &&\n !packageSubpath.endsWith('/')\n ) {\n // @ts-expect-error: indexable.\n const target = exports[packageSubpath];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl,\n target,\n '',\n packageSubpath,\n base,\n false,\n false,\n false,\n conditions\n );\n if (resolveResult === null || resolveResult === undefined) {\n throw exportsNotFound(packageSubpath, packageJsonUrl, base)\n }\n\n return resolveResult\n }\n\n let bestMatch = '';\n let bestMatchSubpath = '';\n const keys = Object.getOwnPropertyNames(exports);\n let i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n const patternIndex = key.indexOf('*');\n\n if (\n patternIndex !== -1 &&\n packageSubpath.startsWith(key.slice(0, patternIndex))\n ) {\n // When this reaches EOL, this can throw at the top of the whole function:\n //\n // if (StringPrototypeEndsWith(packageSubpath, '/'))\n // throwInvalidSubpath(packageSubpath)\n //\n // To match \"imports\" and the spec.\n if (packageSubpath.endsWith('/')) {\n emitTrailingSlashPatternDeprecation(\n packageSubpath,\n packageJsonUrl,\n base\n );\n }\n\n const patternTrailer = key.slice(patternIndex + 1);\n\n if (\n packageSubpath.length >= key.length &&\n packageSubpath.endsWith(patternTrailer) &&\n patternKeyCompare(bestMatch, key) === 1 &&\n key.lastIndexOf('*') === patternIndex\n ) {\n bestMatch = key;\n bestMatchSubpath = packageSubpath.slice(\n patternIndex,\n packageSubpath.length - patternTrailer.length\n );\n }\n }\n }\n\n if (bestMatch) {\n // @ts-expect-error: indexable.\n const target = /** @type {unknown} */ (exports[bestMatch]);\n const resolveResult = resolvePackageTarget(\n packageJsonUrl,\n target,\n bestMatchSubpath,\n bestMatch,\n base,\n true,\n false,\n packageSubpath.endsWith('/'),\n conditions\n );\n\n if (resolveResult === null || resolveResult === undefined) {\n throw exportsNotFound(packageSubpath, packageJsonUrl, base)\n }\n\n return resolveResult\n }\n\n throw exportsNotFound(packageSubpath, packageJsonUrl, base)\n}\n\n/**\n * @param {string} a\n * @param {string} b\n */\nfunction patternKeyCompare(a, b) {\n const aPatternIndex = a.indexOf('*');\n const bPatternIndex = b.indexOf('*');\n const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;\n const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;\n if (baseLengthA > baseLengthB) return -1\n if (baseLengthB > baseLengthA) return 1\n if (aPatternIndex === -1) return 1\n if (bPatternIndex === -1) return -1\n if (a.length > b.length) return -1\n if (b.length > a.length) return 1\n return 0\n}\n\n/**\n * @param {string} name\n * @param {URL} base\n * @param {Set} [conditions]\n * @returns {URL}\n */\nfunction packageImportsResolve(name, base, conditions) {\n if (name === '#' || name.startsWith('#/') || name.endsWith('/')) {\n const reason = 'is not a valid internal imports specifier name';\n throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base))\n }\n\n /** @type {URL | undefined} */\n let packageJsonUrl;\n\n const packageConfig = getPackageScopeConfig(base);\n\n if (packageConfig.exists) {\n packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n const imports = packageConfig.imports;\n if (imports) {\n if (own.call(imports, name) && !name.includes('*')) {\n const resolveResult = resolvePackageTarget(\n packageJsonUrl,\n imports[name],\n '',\n name,\n base,\n false,\n true,\n false,\n conditions\n );\n if (resolveResult !== null && resolveResult !== undefined) {\n return resolveResult\n }\n } else {\n let bestMatch = '';\n let bestMatchSubpath = '';\n const keys = Object.getOwnPropertyNames(imports);\n let i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n const patternIndex = key.indexOf('*');\n\n if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {\n const patternTrailer = key.slice(patternIndex + 1);\n if (\n name.length >= key.length &&\n name.endsWith(patternTrailer) &&\n patternKeyCompare(bestMatch, key) === 1 &&\n key.lastIndexOf('*') === patternIndex\n ) {\n bestMatch = key;\n bestMatchSubpath = name.slice(\n patternIndex,\n name.length - patternTrailer.length\n );\n }\n }\n }\n\n if (bestMatch) {\n const target = imports[bestMatch];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl,\n target,\n bestMatchSubpath,\n bestMatch,\n base,\n true,\n true,\n false,\n conditions\n );\n\n if (resolveResult !== null && resolveResult !== undefined) {\n return resolveResult\n }\n }\n }\n }\n }\n\n throw importNotDefined(name, packageJsonUrl, base)\n}\n\n// Note: In Node.js, `getPackageType` is here.\n// To prevent a circular dependency, we move it to\n// `resolve-get-package-type.js`.\n\n/**\n * @param {string} specifier\n * @param {URL} base\n */\nfunction parsePackageName(specifier, base) {\n let separatorIndex = specifier.indexOf('/');\n let validPackageName = true;\n let isScoped = false;\n if (specifier[0] === '@') {\n isScoped = true;\n if (separatorIndex === -1 || specifier.length === 0) {\n validPackageName = false;\n } else {\n separatorIndex = specifier.indexOf('/', separatorIndex + 1);\n }\n }\n\n const packageName =\n separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);\n\n // Package name cannot have leading . and cannot have percent-encoding or\n // \\\\ separators.\n if (invalidPackageNameRegEx.exec(packageName) !== null) {\n validPackageName = false;\n }\n\n if (!validPackageName) {\n throw new ERR_INVALID_MODULE_SPECIFIER(\n specifier,\n 'is not a valid package name',\n fileURLToPath(base)\n )\n }\n\n const packageSubpath =\n '.' + (separatorIndex === -1 ? '' : specifier.slice(separatorIndex));\n\n return {packageName, packageSubpath, isScoped}\n}\n\n/**\n * @param {string} specifier\n * @param {URL} base\n * @param {Set | undefined} conditions\n * @returns {URL}\n */\nfunction packageResolve(specifier, base, conditions) {\n if (builtinModules.includes(specifier)) {\n return new URL('node:' + specifier)\n }\n\n const {packageName, packageSubpath, isScoped} = parsePackageName(\n specifier,\n base\n );\n\n // ResolveSelf\n const packageConfig = getPackageScopeConfig(base);\n\n // Can’t test.\n /* c8 ignore next 16 */\n if (packageConfig.exists) {\n const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n if (\n packageConfig.name === packageName &&\n packageConfig.exports !== undefined &&\n packageConfig.exports !== null\n ) {\n return packageExportsResolve(\n packageJsonUrl,\n packageSubpath,\n packageConfig,\n base,\n conditions\n )\n }\n }\n\n let packageJsonUrl = new URL(\n './node_modules/' + packageName + '/package.json',\n base\n );\n let packageJsonPath = fileURLToPath(packageJsonUrl);\n /** @type {string} */\n let lastPath;\n do {\n const stat = tryStatSync(packageJsonPath.slice(0, -13));\n if (!stat.isDirectory()) {\n lastPath = packageJsonPath;\n packageJsonUrl = new URL(\n (isScoped ? '../../../../node_modules/' : '../../../node_modules/') +\n packageName +\n '/package.json',\n packageJsonUrl\n );\n packageJsonPath = fileURLToPath(packageJsonUrl);\n continue\n }\n\n // Package match.\n const packageConfig = getPackageConfig(packageJsonPath, specifier, base);\n if (packageConfig.exports !== undefined && packageConfig.exports !== null) {\n return packageExportsResolve(\n packageJsonUrl,\n packageSubpath,\n packageConfig,\n base,\n conditions\n )\n }\n\n if (packageSubpath === '.') {\n return legacyMainResolve(packageJsonUrl, packageConfig, base)\n }\n\n return new URL(packageSubpath, packageJsonUrl)\n // Cross-platform root check.\n } while (packageJsonPath.length !== lastPath.length)\n\n throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base))\n}\n\n/**\n * @param {string} specifier\n * @returns {boolean}\n */\nfunction isRelativeSpecifier(specifier) {\n if (specifier[0] === '.') {\n if (specifier.length === 1 || specifier[1] === '/') return true\n if (\n specifier[1] === '.' &&\n (specifier.length === 2 || specifier[2] === '/')\n ) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * @param {string} specifier\n * @returns {boolean}\n */\nfunction shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {\n if (specifier === '') return false\n if (specifier[0] === '/') return true\n return isRelativeSpecifier(specifier)\n}\n\n/**\n * The “Resolver Algorithm Specification” as detailed in the Node docs (which is\n * sync and slightly lower-level than `resolve`).\n *\n * @param {string} specifier\n * `/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, etc.\n * @param {URL} base\n * Full URL (to a file) that `specifier` is resolved relative from.\n * @param {Set} [conditions]\n * Conditions.\n * @param {boolean} [preserveSymlinks]\n * Keep symlinks instead of resolving them.\n * @returns {URL}\n * A URL object to the found thing.\n */\nfunction moduleResolve(specifier, base, conditions, preserveSymlinks) {\n const protocol = base.protocol;\n const isRemote = protocol === 'http:' || protocol === 'https:';\n // Order swapped from spec for minor perf gain.\n // Ok since relative URLs cannot parse as URLs.\n /** @type {URL | undefined} */\n let resolved;\n\n if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {\n resolved = new URL(specifier, base);\n } else if (!isRemote && specifier[0] === '#') {\n resolved = packageImportsResolve(specifier, base, conditions);\n } else {\n try {\n resolved = new URL(specifier);\n } catch {\n if (!isRemote) {\n resolved = packageResolve(specifier, base, conditions);\n }\n }\n }\n\n assert(resolved !== undefined, 'expected to be defined');\n\n if (resolved.protocol !== 'file:') {\n return resolved\n }\n\n return finalizeResolution(resolved, base, preserveSymlinks)\n}\n\n/**\n * @param {string} specifier\n * @param {URL | undefined} parsed\n * @param {URL | undefined} parsedParentURL\n */\nfunction checkIfDisallowedImport(specifier, parsed, parsedParentURL) {\n if (parsedParentURL) {\n // Avoid accessing the `protocol` property due to the lazy getters.\n const parentProtocol = parsedParentURL.protocol;\n\n if (parentProtocol === 'http:' || parentProtocol === 'https:') {\n if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {\n // Avoid accessing the `protocol` property due to the lazy getters.\n const parsedProtocol = parsed?.protocol;\n\n // `data:` and `blob:` disallowed due to allowing file: access via\n // indirection\n if (\n parsedProtocol &&\n parsedProtocol !== 'https:' &&\n parsedProtocol !== 'http:'\n ) {\n throw new ERR_NETWORK_IMPORT_DISALLOWED(\n specifier,\n parsedParentURL,\n 'remote imports cannot import from a local location.'\n )\n }\n\n return {url: parsed?.href || ''}\n }\n\n if (builtinModules.includes(specifier)) {\n throw new ERR_NETWORK_IMPORT_DISALLOWED(\n specifier,\n parsedParentURL,\n 'remote imports cannot import from a local location.'\n )\n }\n\n throw new ERR_NETWORK_IMPORT_DISALLOWED(\n specifier,\n parsedParentURL,\n 'only relative and absolute specifiers are supported.'\n )\n }\n }\n}\n\n// Note: this is from:\n// \n/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * @template {unknown} Value\n * @param {Value} self\n * @returns {Value is URL}\n */\nfunction isURL(self) {\n return Boolean(\n self &&\n typeof self === 'object' &&\n 'href' in self &&\n typeof self.href === 'string' &&\n 'protocol' in self &&\n typeof self.protocol === 'string' &&\n self.href &&\n self.protocol\n )\n}\n\n/**\n * Validate user-input in `context` supplied by a custom loader.\n *\n * @param {unknown} parentURL\n * @returns {asserts parentURL is URL | string | undefined}\n */\nfunction throwIfInvalidParentURL(parentURL) {\n if (parentURL === undefined) {\n return // Main entry point, so no parent\n }\n\n if (typeof parentURL !== 'string' && !isURL(parentURL)) {\n throw new codes.ERR_INVALID_ARG_TYPE(\n 'parentURL',\n ['string', 'URL'],\n parentURL\n )\n }\n}\n\n/**\n * @param {URL} url\n */\nfunction throwIfUnsupportedURLProtocol(url) {\n // Avoid accessing the `protocol` property due to the lazy getters.\n const protocol = url.protocol;\n\n if (protocol !== 'file:' && protocol !== 'data:' && protocol !== 'node:') {\n throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(url)\n }\n}\n\n/**\n * @param {URL | undefined} parsed\n * @param {boolean} experimentalNetworkImports\n */\nfunction throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) {\n // Avoid accessing the `protocol` property due to the lazy getters.\n const protocol = parsed?.protocol;\n\n if (\n protocol &&\n protocol !== 'file:' &&\n protocol !== 'data:' &&\n (!experimentalNetworkImports ||\n (protocol !== 'https:' && protocol !== 'http:'))\n ) {\n throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(\n parsed,\n ['file', 'data'].concat(\n experimentalNetworkImports ? ['https', 'http'] : []\n )\n )\n }\n}\n\n/**\n * @param {string} specifier\n * @param {{parentURL?: string, conditions?: Array}} context\n * @returns {{url: string, format?: string | null}}\n */\nfunction defaultResolve(specifier, context = {}) {\n const {parentURL} = context;\n assert(parentURL !== undefined, 'expected `parentURL` to be defined');\n throwIfInvalidParentURL(parentURL);\n\n /** @type {URL | undefined} */\n let parsedParentURL;\n if (parentURL) {\n try {\n parsedParentURL = new URL(parentURL);\n } catch {\n // Ignore exception\n }\n }\n\n /** @type {URL | undefined} */\n let parsed;\n try {\n parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier)\n ? new URL(specifier, parsedParentURL)\n : new URL(specifier);\n\n // Avoid accessing the `protocol` property due to the lazy getters.\n const protocol = parsed.protocol;\n\n if (\n protocol === 'data:' ||\n (experimentalNetworkImports &&\n (protocol === 'https:' || protocol === 'http:'))\n ) {\n return {url: parsed.href, format: null}\n }\n } catch {\n // Ignore exception\n }\n\n // There are multiple deep branches that can either throw or return; instead\n // of duplicating that deeply nested logic for the possible returns, DRY and\n // check for a return. This seems the least gnarly.\n const maybeReturn = checkIfDisallowedImport(\n specifier,\n parsed,\n parsedParentURL\n );\n\n if (maybeReturn) return maybeReturn\n\n // This must come after checkIfDisallowedImport\n if (parsed && parsed.protocol === 'node:') return {url: specifier}\n\n throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports);\n\n const conditions = getConditionsSet(context.conditions);\n\n const url = moduleResolve(specifier, new URL(parentURL), conditions, false);\n\n throwIfUnsupportedURLProtocol(url);\n\n return {\n // Do NOT cast `url` to a string: that will work even when there are real\n // problems, silencing them\n url: url.href,\n format: defaultGetFormatWithoutErrors(url, {parentURL})\n }\n}\n\n/**\n * @typedef {import('./lib/errors.js').ErrnoException} ErrnoException\n */\n\n/**\n * Match `import.meta.resolve` except that `parent` is required (you can pass\n * `import.meta.url`).\n *\n * @param {string} specifier\n * The module specifier to resolve relative to parent\n * (`/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`,\n * etc).\n * @param {string} parent\n * The absolute parent module URL to resolve from.\n * You must pass `import.meta.url` or something else.\n * @returns {string}\n * Returns a string to a full `file:`, `data:`, or `node:` URL\n * to the found thing.\n */\nfunction resolve(specifier, parent) {\n if (!parent) {\n throw new Error(\n 'Please pass `parent`: `import-meta-resolve` cannot ponyfill that'\n )\n }\n\n try {\n return defaultResolve(specifier, {parentURL: parent}).url\n } catch (error) {\n const exception = /** @type {ErrnoException} */ (error);\n\n if (\n exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' &&\n typeof exception.url === 'string'\n ) {\n return exception.url\n }\n\n throw error\n }\n}\n\nexport { moduleResolve, resolve };\n"],"mappings":";;;;;;;AAoFA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,IAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,KAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,IAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,GAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,EAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,MAAA;EAAA,MAAAT,IAAA,GAAAC,OAAA;EAAAQ,KAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAuC,SAAAU,yBAAAC,WAAA,eAAAC,OAA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,IAAI,KAAK,4BAA4B,IAC/C,OAAOgC,SAAS,CAACpD,GAAG,KAAK,QAAQ,EACjC;MACA,OAAOoD,SAAS,CAACpD,GAAG;IACtB;IAEA,MAAMY,KAAK;EACb;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/node_modules/convert-source-map/LICENSE b/node_modules/@babel/core/node_modules/convert-source-map/LICENSE deleted file mode 100644 index 41702c504..000000000 --- a/node_modules/@babel/core/node_modules/convert-source-map/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright 2013 Thorsten Lorenz. -All rights reserved. - -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/@babel/core/node_modules/convert-source-map/README.md b/node_modules/@babel/core/node_modules/convert-source-map/README.md deleted file mode 100644 index 7a3a9452c..000000000 --- a/node_modules/@babel/core/node_modules/convert-source-map/README.md +++ /dev/null @@ -1,123 +0,0 @@ -# convert-source-map [![Build Status][ci-image]][ci-url] - -Converts a source-map from/to different formats and allows adding/changing properties. - -```js -var convert = require('convert-source-map'); - -var json = convert - .fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=') - .toJSON(); - -var modified = convert - .fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=') - .setProperty('sources', [ 'SRC/FOO.JS' ]) - .toJSON(); - -console.log(json); -console.log(modified); -``` - -```json -{"version":3,"file":"build/foo.min.js","sources":["src/foo.js"],"names":[],"mappings":"AAAA","sourceRoot":"/"} -{"version":3,"file":"build/foo.min.js","sources":["SRC/FOO.JS"],"names":[],"mappings":"AAAA","sourceRoot":"/"} -``` - -## API - -### fromObject(obj) - -Returns source map converter from given object. - -### fromJSON(json) - -Returns source map converter from given json string. - -### fromBase64(base64) - -Returns source map converter from given base64 encoded json string. - -### fromComment(comment) - -Returns source map converter from given base64 encoded json string prefixed with `//# sourceMappingURL=...`. - -### fromMapFileComment(comment, mapFileDir) - -Returns source map converter from given `filename` by parsing `//# sourceMappingURL=filename`. - -`filename` must point to a file that is found inside the `mapFileDir`. Most tools store this file right next to the -generated file, i.e. the one containing the source map. - -### fromSource(source) - -Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found. - -### fromMapFileSource(source, mapFileDir) - -Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was -found. - -The sourcemap will be read from the map file found by parsing `# sourceMappingURL=file` comment. For more info see -fromMapFileComment. - -### toObject() - -Returns a copy of the underlying source map. - -### toJSON([space]) - -Converts source map to json string. If `space` is given (optional), this will be passed to -[JSON.stringify](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify) when the -JSON string is generated. - -### toBase64() - -Converts source map to base64 encoded json string. - -### toComment([options]) - -Converts source map to an inline comment that can be appended to the source-file. - -By default, the comment is formatted like: `//# sourceMappingURL=...`, which you would -normally see in a JS source file. - -When `options.multiline == true`, the comment is formatted like: `/*# sourceMappingURL=... */`, which you would find in a CSS source file. - -### addProperty(key, value) - -Adds given property to the source map. Throws an error if property already exists. - -### setProperty(key, value) - -Sets given property to the source map. If property doesn't exist it is added, otherwise its value is updated. - -### getProperty(key) - -Gets given property of the source map. - -### removeComments(src) - -Returns `src` with all source map comments removed - -### removeMapFileComments(src) - -Returns `src` with all source map comments pointing to map files removed. - -### commentRegex - -Provides __a fresh__ RegExp each time it is accessed. Can be used to find source map comments. - -### mapFileCommentRegex - -Provides __a fresh__ RegExp each time it is accessed. Can be used to find source map comments pointing to map files. - -### generateMapFileComment(file, [options]) - -Returns a comment that links to an external source map via `file`. - -By default, the comment is formatted like: `//# sourceMappingURL=...`, which you would normally see in a JS source file. - -When `options.multiline == true`, the comment is formatted like: `/*# sourceMappingURL=... */`, which you would find in a CSS source file. - -[ci-url]: https://github.com/thlorenz/convert-source-map/actions?query=workflow:ci -[ci-image]: https://img.shields.io/github/workflow/status/thlorenz/convert-source-map/CI?style=flat-square diff --git a/node_modules/@babel/core/node_modules/convert-source-map/index.js b/node_modules/@babel/core/node_modules/convert-source-map/index.js deleted file mode 100644 index dc602d7c6..000000000 --- a/node_modules/@babel/core/node_modules/convert-source-map/index.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict'; -var fs = require('fs'); -var path = require('path'); - -Object.defineProperty(exports, 'commentRegex', { - get: function getCommentRegex () { - return /^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/mg; - } -}); - -Object.defineProperty(exports, 'mapFileCommentRegex', { - get: function getMapFileCommentRegex () { - // Matches sourceMappingURL in either // or /* comment styles. - return /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg; - } -}); - -var decodeBase64; -if (typeof Buffer !== 'undefined') { - if (typeof Buffer.from === 'function') { - decodeBase64 = decodeBase64WithBufferFrom; - } else { - decodeBase64 = decodeBase64WithNewBuffer; - } -} else { - decodeBase64 = decodeBase64WithAtob; -} - -function decodeBase64WithBufferFrom(base64) { - return Buffer.from(base64, 'base64').toString(); -} - -function decodeBase64WithNewBuffer(base64) { - if (typeof value === 'number') { - throw new TypeError('The value to decode must not be of type number.'); - } - return new Buffer(base64, 'base64').toString(); -} - -function decodeBase64WithAtob(base64) { - return decodeURIComponent(escape(atob(base64))); -} - -function stripComment(sm) { - return sm.split(',').pop(); -} - -function readFromFileMap(sm, dir) { - // NOTE: this will only work on the server since it attempts to read the map file - - var r = exports.mapFileCommentRegex.exec(sm); - - // for some odd reason //# .. captures in 1 and /* .. */ in 2 - var filename = r[1] || r[2]; - var filepath = path.resolve(dir, filename); - - try { - return fs.readFileSync(filepath, 'utf8'); - } catch (e) { - throw new Error('An error occurred while trying to read the map file at ' + filepath + '\n' + e); - } -} - -function Converter (sm, opts) { - opts = opts || {}; - - if (opts.isFileComment) sm = readFromFileMap(sm, opts.commentFileDir); - if (opts.hasComment) sm = stripComment(sm); - if (opts.isEncoded) sm = decodeBase64(sm); - if (opts.isJSON || opts.isEncoded) sm = JSON.parse(sm); - - this.sourcemap = sm; -} - -Converter.prototype.toJSON = function (space) { - return JSON.stringify(this.sourcemap, null, space); -}; - -if (typeof Buffer !== 'undefined') { - if (typeof Buffer.from === 'function') { - Converter.prototype.toBase64 = encodeBase64WithBufferFrom; - } else { - Converter.prototype.toBase64 = encodeBase64WithNewBuffer; - } -} else { - Converter.prototype.toBase64 = encodeBase64WithBtoa; -} - -function encodeBase64WithBufferFrom() { - var json = this.toJSON(); - return Buffer.from(json, 'utf8').toString('base64'); -} - -function encodeBase64WithNewBuffer() { - var json = this.toJSON(); - if (typeof json === 'number') { - throw new TypeError('The json to encode must not be of type number.'); - } - return new Buffer(json, 'utf8').toString('base64'); -} - -function encodeBase64WithBtoa() { - var json = this.toJSON(); - return btoa(unescape(encodeURIComponent(json))); -} - -Converter.prototype.toComment = function (options) { - var base64 = this.toBase64(); - var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; - return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data; -}; - -// returns copy instead of original -Converter.prototype.toObject = function () { - return JSON.parse(this.toJSON()); -}; - -Converter.prototype.addProperty = function (key, value) { - if (this.sourcemap.hasOwnProperty(key)) throw new Error('property "' + key + '" already exists on the sourcemap, use set property instead'); - return this.setProperty(key, value); -}; - -Converter.prototype.setProperty = function (key, value) { - this.sourcemap[key] = value; - return this; -}; - -Converter.prototype.getProperty = function (key) { - return this.sourcemap[key]; -}; - -exports.fromObject = function (obj) { - return new Converter(obj); -}; - -exports.fromJSON = function (json) { - return new Converter(json, { isJSON: true }); -}; - -exports.fromBase64 = function (base64) { - return new Converter(base64, { isEncoded: true }); -}; - -exports.fromComment = function (comment) { - comment = comment - .replace(/^\/\*/g, '//') - .replace(/\*\/$/g, ''); - - return new Converter(comment, { isEncoded: true, hasComment: true }); -}; - -exports.fromMapFileComment = function (comment, dir) { - return new Converter(comment, { commentFileDir: dir, isFileComment: true, isJSON: true }); -}; - -// Finds last sourcemap comment in file or returns null if none was found -exports.fromSource = function (content) { - var m = content.match(exports.commentRegex); - return m ? exports.fromComment(m.pop()) : null; -}; - -// Finds last sourcemap comment in file or returns null if none was found -exports.fromMapFileSource = function (content, dir) { - var m = content.match(exports.mapFileCommentRegex); - return m ? exports.fromMapFileComment(m.pop(), dir) : null; -}; - -exports.removeComments = function (src) { - return src.replace(exports.commentRegex, ''); -}; - -exports.removeMapFileComments = function (src) { - return src.replace(exports.mapFileCommentRegex, ''); -}; - -exports.generateMapFileComment = function (file, options) { - var data = 'sourceMappingURL=' + file; - return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data; -}; diff --git a/node_modules/@babel/core/node_modules/convert-source-map/package.json b/node_modules/@babel/core/node_modules/convert-source-map/package.json deleted file mode 100644 index 0d796cacd..000000000 --- a/node_modules/@babel/core/node_modules/convert-source-map/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "convert-source-map", - "version": "1.9.0", - "description": "Converts a source-map from/to different formats and allows adding/changing properties.", - "main": "index.js", - "scripts": { - "test": "tap test/*.js --color" - }, - "repository": { - "type": "git", - "url": "git://github.com/thlorenz/convert-source-map.git" - }, - "homepage": "https://github.com/thlorenz/convert-source-map", - "devDependencies": { - "inline-source-map": "~0.6.2", - "tap": "~9.0.0" - }, - "keywords": [ - "convert", - "sourcemap", - "source", - "map", - "browser", - "debug" - ], - "author": { - "name": "Thorsten Lorenz", - "email": "thlorenz@gmx.de", - "url": "http://thlorenz.com" - }, - "license": "MIT", - "engine": { - "node": ">=0.6" - }, - "files": [ - "index.js" - ], - "browser": { - "fs": false - } -} diff --git a/node_modules/@babel/core/package.json b/node_modules/@babel/core/package.json deleted file mode 100644 index 624f9ca20..000000000 --- a/node_modules/@babel/core/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "@babel/core", - "version": "7.21.8", - "description": "Babel compiler core.", - "main": "./lib/index.js", - "author": "The Babel Team (https://babel.dev/team)", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-core" - }, - "homepage": "https://babel.dev/docs/en/next/babel-core", - "bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen", - "keywords": [ - "6to5", - "babel", - "classes", - "const", - "es6", - "harmony", - "let", - "modules", - "transpile", - "transpiler", - "var", - "babel-core", - "compiler" - ], - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - }, - "browser": { - "./lib/config/files/index.js": "./lib/config/files/index-browser.js", - "./lib/config/resolve-targets.js": "./lib/config/resolve-targets-browser.js", - "./lib/transform-file.js": "./lib/transform-file-browser.js", - "./src/config/files/index.ts": "./src/config/files/index-browser.ts", - "./src/config/resolve-targets.ts": "./src/config/resolve-targets-browser.ts", - "./src/transform-file.ts": "./src/transform-file-browser.ts" - }, - "dependencies": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.5", - "@babel/helper-compilation-targets": "^7.21.5", - "@babel/helper-module-transforms": "^7.21.5", - "@babel/helpers": "^7.21.5", - "@babel/parser": "^7.21.8", - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.5", - "@babel/types": "^7.21.5", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.2", - "semver": "^6.3.0" - }, - "devDependencies": { - "@babel/helper-transform-fixture-test-runner": "^7.21.5", - "@babel/plugin-syntax-flow": "^7.21.4", - "@babel/plugin-transform-flow-strip-types": "^7.21.0", - "@babel/plugin-transform-modules-commonjs": "^7.21.5", - "@babel/preset-env": "^7.21.5", - "@babel/preset-typescript": "^7.21.5", - "@jridgewell/trace-mapping": "^0.3.17", - "@types/convert-source-map": "^1.5.1", - "@types/debug": "^4.1.0", - "@types/gensync": "^1.0.0", - "@types/resolve": "^1.3.2", - "@types/semver": "^5.4.0", - "rimraf": "^3.0.0", - "ts-node": "^10.9.1" - }, - "type": "commonjs" -} \ No newline at end of file diff --git a/node_modules/@babel/core/src/config/files/index-browser.ts b/node_modules/@babel/core/src/config/files/index-browser.ts deleted file mode 100644 index 08f91f6a6..000000000 --- a/node_modules/@babel/core/src/config/files/index-browser.ts +++ /dev/null @@ -1,109 +0,0 @@ -import type { Handler } from "gensync"; - -import type { - ConfigFile, - IgnoreFile, - RelativeConfig, - FilePackageData, -} from "./types"; - -import type { CallerMetadata } from "../validation/options"; - -export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData }; - -export function findConfigUpwards( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - rootDir: string, -): string | null { - return null; -} - -// eslint-disable-next-line require-yield -export function* findPackageData(filepath: string): Handler { - return { - filepath, - directories: [], - pkg: null, - isPackage: false, - }; -} - -// eslint-disable-next-line require-yield -export function* findRelativeConfig( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - pkgData: FilePackageData, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - envName: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - caller: CallerMetadata | undefined, -): Handler { - return { config: null, ignore: null }; -} - -// eslint-disable-next-line require-yield -export function* findRootConfig( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - dirname: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - envName: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - caller: CallerMetadata | undefined, -): Handler { - return null; -} - -// eslint-disable-next-line require-yield -export function* loadConfig( - name: string, - dirname: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - envName: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - caller: CallerMetadata | undefined, -): Handler { - throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`); -} - -// eslint-disable-next-line require-yield -export function* resolveShowConfigPath( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - dirname: string, -): Handler { - return null; -} - -export const ROOT_CONFIG_FILENAMES: string[] = []; - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export function resolvePlugin(name: string, dirname: string): string | null { - return null; -} - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export function resolvePreset(name: string, dirname: string): string | null { - return null; -} - -export function loadPlugin( - name: string, - dirname: string, -): Handler<{ - filepath: string; - value: unknown; -}> { - throw new Error( - `Cannot load plugin ${name} relative to ${dirname} in a browser`, - ); -} - -export function loadPreset( - name: string, - dirname: string, -): Handler<{ - filepath: string; - value: unknown; -}> { - throw new Error( - `Cannot load preset ${name} relative to ${dirname} in a browser`, - ); -} diff --git a/node_modules/@babel/core/src/config/files/index.ts b/node_modules/@babel/core/src/config/files/index.ts deleted file mode 100644 index 55f68cb73..000000000 --- a/node_modules/@babel/core/src/config/files/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -type indexBrowserType = typeof import("./index-browser"); -type indexType = typeof import("./index"); - -// Kind of gross, but essentially asserting that the exports of this module are the same as the -// exports of index-browser, since this file may be replaced at bundle time with index-browser. -({}) as any as indexBrowserType as indexType; - -export { findPackageData } from "./package"; - -export { - findConfigUpwards, - findRelativeConfig, - findRootConfig, - loadConfig, - resolveShowConfigPath, - ROOT_CONFIG_FILENAMES, -} from "./configuration"; -export type { - ConfigFile, - IgnoreFile, - RelativeConfig, - FilePackageData, -} from "./types"; -export { - loadPlugin, - loadPreset, - resolvePlugin, - resolvePreset, -} from "./plugins"; diff --git a/node_modules/@babel/core/src/config/resolve-targets-browser.ts b/node_modules/@babel/core/src/config/resolve-targets-browser.ts deleted file mode 100644 index 60745dd7d..000000000 --- a/node_modules/@babel/core/src/config/resolve-targets-browser.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { ValidatedOptions } from "./validation/options"; -import getTargets, { - type InputTargets, -} from "@babel/helper-compilation-targets"; - -import type { Targets } from "@babel/helper-compilation-targets"; - -export function resolveBrowserslistConfigFile( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - browserslistConfigFile: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - configFilePath: string, -): string | void { - return undefined; -} - -export function resolveTargets( - options: ValidatedOptions, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - root: string, -): Targets { - const optTargets = options.targets; - let targets: InputTargets; - - if (typeof optTargets === "string" || Array.isArray(optTargets)) { - targets = { browsers: optTargets }; - } else if (optTargets) { - if ("esmodules" in optTargets) { - targets = { ...optTargets, esmodules: "intersect" }; - } else { - // https://github.com/microsoft/TypeScript/issues/17002 - targets = optTargets as InputTargets; - } - } - - return getTargets(targets, { - ignoreBrowserslistConfig: true, - browserslistEnv: options.browserslistEnv, - }); -} diff --git a/node_modules/@babel/core/src/config/resolve-targets.ts b/node_modules/@babel/core/src/config/resolve-targets.ts deleted file mode 100644 index 04c7fec4d..000000000 --- a/node_modules/@babel/core/src/config/resolve-targets.ts +++ /dev/null @@ -1,56 +0,0 @@ -type browserType = typeof import("./resolve-targets-browser"); -type nodeType = typeof import("./resolve-targets"); - -// Kind of gross, but essentially asserting that the exports of this module are the same as the -// exports of index-browser, since this file may be replaced at bundle time with index-browser. -({}) as any as browserType as nodeType; - -import type { ValidatedOptions } from "./validation/options"; -import path from "path"; -import getTargets, { - type InputTargets, -} from "@babel/helper-compilation-targets"; - -import type { Targets } from "@babel/helper-compilation-targets"; - -export function resolveBrowserslistConfigFile( - browserslistConfigFile: string, - configFileDir: string, -): string | undefined { - return path.resolve(configFileDir, browserslistConfigFile); -} - -export function resolveTargets( - options: ValidatedOptions, - root: string, -): Targets { - const optTargets = options.targets; - let targets: InputTargets; - - if (typeof optTargets === "string" || Array.isArray(optTargets)) { - targets = { browsers: optTargets }; - } else if (optTargets) { - if ("esmodules" in optTargets) { - targets = { ...optTargets, esmodules: "intersect" }; - } else { - // https://github.com/microsoft/TypeScript/issues/17002 - targets = optTargets as InputTargets; - } - } - - const { browserslistConfigFile } = options; - let configFile; - let ignoreBrowserslistConfig = false; - if (typeof browserslistConfigFile === "string") { - configFile = browserslistConfigFile; - } else { - ignoreBrowserslistConfig = browserslistConfigFile === false; - } - - return getTargets(targets, { - ignoreBrowserslistConfig, - configFile, - configPath: root, - browserslistEnv: options.browserslistEnv, - }); -} diff --git a/node_modules/@babel/core/src/transform-file-browser.ts b/node_modules/@babel/core/src/transform-file-browser.ts deleted file mode 100644 index f316cb432..000000000 --- a/node_modules/@babel/core/src/transform-file-browser.ts +++ /dev/null @@ -1,31 +0,0 @@ -// duplicated from transform-file so we do not have to import anything here -type TransformFile = { - (filename: string, callback: (error: Error, file: null) => void): void; - ( - filename: string, - opts: any, - callback: (error: Error, file: null) => void, - ): void; -}; - -export const transformFile: TransformFile = function transformFile( - filename, - opts, - callback?: (error: Error, file: null) => void, -) { - if (typeof opts === "function") { - callback = opts; - } - - callback(new Error("Transforming files is not supported in browsers"), null); -}; - -export function transformFileSync(): never { - throw new Error("Transforming files is not supported in browsers"); -} - -export function transformFileAsync() { - return Promise.reject( - new Error("Transforming files is not supported in browsers"), - ); -} diff --git a/node_modules/@babel/core/src/transform-file.ts b/node_modules/@babel/core/src/transform-file.ts deleted file mode 100644 index 444c10884..000000000 --- a/node_modules/@babel/core/src/transform-file.ts +++ /dev/null @@ -1,55 +0,0 @@ -import gensync, { type Handler } from "gensync"; - -import loadConfig from "./config"; -import type { InputOptions, ResolvedConfig } from "./config"; -import { run } from "./transformation"; -import type { FileResult, FileResultCallback } from "./transformation"; -import * as fs from "./gensync-utils/fs"; - -type transformFileBrowserType = typeof import("./transform-file-browser"); -type transformFileType = typeof import("./transform-file"); - -// Kind of gross, but essentially asserting that the exports of this module are the same as the -// exports of transform-file-browser, since this file may be replaced at bundle time with -// transform-file-browser. -({}) as any as transformFileBrowserType as transformFileType; - -const transformFileRunner = gensync(function* ( - filename: string, - opts?: InputOptions, -): Handler { - const options = { ...opts, filename }; - - const config: ResolvedConfig | null = yield* loadConfig(options); - if (config === null) return null; - - const code = yield* fs.readFile(filename, "utf8"); - return yield* run(config, code); -}); - -// @ts-expect-error TS doesn't detect that this signature is compatible -export function transformFile( - filename: string, - callback: FileResultCallback, -): void; -export function transformFile( - filename: string, - opts: InputOptions | undefined | null, - callback: FileResultCallback, -): void; -export function transformFile( - ...args: Parameters -) { - transformFileRunner.errback(...args); -} - -export function transformFileSync( - ...args: Parameters -) { - return transformFileRunner.sync(...args); -} -export function transformFileAsync( - ...args: Parameters -) { - return transformFileRunner.async(...args); -} diff --git a/node_modules/@babel/generator/LICENSE b/node_modules/@babel/generator/LICENSE deleted file mode 100644 index f31575ec7..000000000 --- a/node_modules/@babel/generator/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other 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/@babel/generator/README.md b/node_modules/@babel/generator/README.md deleted file mode 100644 index b760238eb..000000000 --- a/node_modules/@babel/generator/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/generator - -> Turns an AST into code. - -See our website [@babel/generator](https://babeljs.io/docs/en/babel-generator) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20generator%22+is%3Aopen) associated with this package. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/generator -``` - -or using yarn: - -```sh -yarn add @babel/generator --dev -``` diff --git a/node_modules/@babel/generator/lib/buffer.js b/node_modules/@babel/generator/lib/buffer.js deleted file mode 100644 index def555245..000000000 --- a/node_modules/@babel/generator/lib/buffer.js +++ /dev/null @@ -1,307 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -class Buffer { - constructor(map) { - this._map = null; - this._buf = ""; - this._str = ""; - this._appendCount = 0; - this._last = 0; - this._queue = []; - this._queueCursor = 0; - this._canMarkIdName = true; - this._position = { - line: 1, - column: 0 - }; - this._sourcePosition = { - identifierName: undefined, - identifierNamePos: undefined, - line: undefined, - column: undefined, - filename: undefined - }; - this._map = map; - this._allocQueue(); - } - _allocQueue() { - const queue = this._queue; - for (let i = 0; i < 16; i++) { - queue.push({ - char: 0, - repeat: 1, - line: undefined, - column: undefined, - identifierName: undefined, - identifierNamePos: undefined, - filename: "" - }); - } - } - _pushQueue(char, repeat, line, column, filename) { - const cursor = this._queueCursor; - if (cursor === this._queue.length) { - this._allocQueue(); - } - const item = this._queue[cursor]; - item.char = char; - item.repeat = repeat; - item.line = line; - item.column = column; - item.filename = filename; - this._queueCursor++; - } - _popQueue() { - if (this._queueCursor === 0) { - throw new Error("Cannot pop from empty queue"); - } - return this._queue[--this._queueCursor]; - } - get() { - this._flush(); - const map = this._map; - const result = { - code: (this._buf + this._str).trimRight(), - decodedMap: map == null ? void 0 : map.getDecoded(), - get __mergedMap() { - return this.map; - }, - get map() { - const resultMap = map ? map.get() : null; - result.map = resultMap; - return resultMap; - }, - set map(value) { - Object.defineProperty(result, "map", { - value, - writable: true - }); - }, - get rawMappings() { - const mappings = map == null ? void 0 : map.getRawMappings(); - result.rawMappings = mappings; - return mappings; - }, - set rawMappings(value) { - Object.defineProperty(result, "rawMappings", { - value, - writable: true - }); - } - }; - return result; - } - append(str, maybeNewline) { - this._flush(); - this._append(str, this._sourcePosition, maybeNewline); - } - appendChar(char) { - this._flush(); - this._appendChar(char, 1, this._sourcePosition); - } - queue(char) { - if (char === 10) { - while (this._queueCursor !== 0) { - const char = this._queue[this._queueCursor - 1].char; - if (char !== 32 && char !== 9) { - break; - } - this._queueCursor--; - } - } - const sourcePosition = this._sourcePosition; - this._pushQueue(char, 1, sourcePosition.line, sourcePosition.column, sourcePosition.filename); - } - queueIndentation(char, repeat) { - this._pushQueue(char, repeat, undefined, undefined, undefined); - } - _flush() { - const queueCursor = this._queueCursor; - const queue = this._queue; - for (let i = 0; i < queueCursor; i++) { - const item = queue[i]; - this._appendChar(item.char, item.repeat, item); - } - this._queueCursor = 0; - } - _appendChar(char, repeat, sourcePos) { - this._last = char; - this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char); - if (char !== 10) { - this._mark(sourcePos.line, sourcePos.column, sourcePos.identifierName, sourcePos.identifierNamePos, sourcePos.filename); - this._position.column += repeat; - } else { - this._position.line++; - this._position.column = 0; - } - if (this._canMarkIdName) { - sourcePos.identifierName = undefined; - sourcePos.identifierNamePos = undefined; - } - } - _append(str, sourcePos, maybeNewline) { - const len = str.length; - const position = this._position; - this._last = str.charCodeAt(len - 1); - if (++this._appendCount > 4096) { - +this._str; - this._buf += this._str; - this._str = str; - this._appendCount = 0; - } else { - this._str += str; - } - if (!maybeNewline && !this._map) { - position.column += len; - return; - } - const { - column, - identifierName, - identifierNamePos, - filename - } = sourcePos; - let line = sourcePos.line; - if ((identifierName != null || identifierNamePos != null) && this._canMarkIdName) { - sourcePos.identifierName = undefined; - sourcePos.identifierNamePos = undefined; - } - let i = str.indexOf("\n"); - let last = 0; - if (i !== 0) { - this._mark(line, column, identifierName, identifierNamePos, filename); - } - while (i !== -1) { - position.line++; - position.column = 0; - last = i + 1; - if (last < len && line !== undefined) { - this._mark(++line, 0, null, null, filename); - } - i = str.indexOf("\n", last); - } - position.column += len - last; - } - _mark(line, column, identifierName, identifierNamePos, filename) { - var _this$_map; - (_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position, line, column, identifierName, identifierNamePos, filename); - } - removeTrailingNewline() { - const queueCursor = this._queueCursor; - if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 10) { - this._queueCursor--; - } - } - removeLastSemicolon() { - const queueCursor = this._queueCursor; - if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 59) { - this._queueCursor--; - } - } - getLastChar() { - const queueCursor = this._queueCursor; - return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last; - } - getNewlineCount() { - const queueCursor = this._queueCursor; - let count = 0; - if (queueCursor === 0) return this._last === 10 ? 1 : 0; - for (let i = queueCursor - 1; i >= 0; i--) { - if (this._queue[i].char !== 10) { - break; - } - count++; - } - return count === queueCursor && this._last === 10 ? count + 1 : count; - } - endsWithCharAndNewline() { - const queue = this._queue; - const queueCursor = this._queueCursor; - if (queueCursor !== 0) { - const lastCp = queue[queueCursor - 1].char; - if (lastCp !== 10) return; - if (queueCursor > 1) { - return queue[queueCursor - 2].char; - } else { - return this._last; - } - } - } - hasContent() { - return this._queueCursor !== 0 || !!this._last; - } - exactSource(loc, cb) { - if (!this._map) { - cb(); - return; - } - this.source("start", loc); - const identifierName = loc.identifierName; - const sourcePos = this._sourcePosition; - if (identifierName) { - this._canMarkIdName = false; - sourcePos.identifierName = identifierName; - } - cb(); - if (identifierName) { - this._canMarkIdName = true; - sourcePos.identifierName = undefined; - sourcePos.identifierNamePos = undefined; - } - this.source("end", loc); - } - source(prop, loc) { - if (!this._map) return; - this._normalizePosition(prop, loc, 0, 0); - } - sourceWithOffset(prop, loc, lineOffset, columnOffset) { - if (!this._map) return; - this._normalizePosition(prop, loc, lineOffset, columnOffset); - } - withSource(prop, loc, cb) { - if (this._map) { - this.source(prop, loc); - } - cb(); - } - _normalizePosition(prop, loc, lineOffset, columnOffset) { - const pos = loc[prop]; - const target = this._sourcePosition; - if (pos) { - target.line = pos.line + lineOffset; - target.column = pos.column + columnOffset; - target.filename = loc.filename; - } - } - getCurrentColumn() { - const queue = this._queue; - const queueCursor = this._queueCursor; - let lastIndex = -1; - let len = 0; - for (let i = 0; i < queueCursor; i++) { - const item = queue[i]; - if (item.char === 10) { - lastIndex = len; - } - len += item.repeat; - } - return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex; - } - getCurrentLine() { - let count = 0; - const queue = this._queue; - for (let i = 0; i < this._queueCursor; i++) { - if (queue[i].char === 10) { - count++; - } - } - return this._position.line + count; - } -} -exports.default = Buffer; - -//# sourceMappingURL=buffer.js.map diff --git a/node_modules/@babel/generator/lib/buffer.js.map b/node_modules/@babel/generator/lib/buffer.js.map deleted file mode 100644 index fd712989c..000000000 --- a/node_modules/@babel/generator/lib/buffer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["Buffer","constructor","map","_map","_buf","_str","_appendCount","_last","_queue","_queueCursor","_canMarkIdName","_position","line","column","_sourcePosition","identifierName","undefined","identifierNamePos","filename","_allocQueue","queue","i","push","char","repeat","_pushQueue","cursor","length","item","_popQueue","Error","get","_flush","result","code","trimRight","decodedMap","getDecoded","__mergedMap","resultMap","value","Object","defineProperty","writable","rawMappings","mappings","getRawMappings","append","str","maybeNewline","_append","appendChar","_appendChar","sourcePosition","queueIndentation","queueCursor","sourcePos","String","fromCharCode","_mark","len","position","charCodeAt","indexOf","last","_this$_map","mark","removeTrailingNewline","removeLastSemicolon","getLastChar","getNewlineCount","count","endsWithCharAndNewline","lastCp","hasContent","exactSource","loc","cb","source","prop","_normalizePosition","sourceWithOffset","lineOffset","columnOffset","withSource","pos","target","getCurrentColumn","lastIndex","getCurrentLine","exports","default"],"sources":["../src/buffer.ts"],"sourcesContent":["import type SourceMap from \"./source-map\";\nimport * as charcodes from \"charcodes\";\n\nexport type Pos = {\n line: number;\n column: number;\n};\nexport type Loc = {\n start?: Pos;\n end?: Pos;\n filename?: string;\n};\ntype SourcePos = {\n line: number | undefined;\n column: number | undefined;\n identifierName: string | undefined;\n filename: string | undefined;\n};\ntype InternalSourcePos = SourcePos & { identifierNamePos: Pos };\n\ntype QueueItem = {\n char: number;\n repeat: number;\n line: number | undefined;\n column: number | undefined;\n identifierName: undefined; // Not used, it always undefined.\n identifierNamePos: undefined; // Not used, it always undefined.\n filename: string | undefined;\n};\n\nexport default class Buffer {\n constructor(map?: SourceMap | null) {\n this._map = map;\n\n this._allocQueue();\n }\n\n _map: SourceMap = null;\n _buf = \"\";\n _str = \"\";\n _appendCount = 0;\n _last = 0;\n _queue: QueueItem[] = [];\n _queueCursor = 0;\n _canMarkIdName = true;\n\n _position = {\n line: 1,\n column: 0,\n };\n _sourcePosition: InternalSourcePos = {\n identifierName: undefined,\n identifierNamePos: undefined,\n line: undefined,\n column: undefined,\n filename: undefined,\n };\n\n _allocQueue() {\n const queue = this._queue;\n\n for (let i = 0; i < 16; i++) {\n queue.push({\n char: 0,\n repeat: 1,\n line: undefined,\n column: undefined,\n identifierName: undefined,\n identifierNamePos: undefined,\n filename: \"\",\n });\n }\n }\n\n _pushQueue(\n char: number,\n repeat: number,\n line: number | undefined,\n column: number | undefined,\n filename: string | undefined,\n ) {\n const cursor = this._queueCursor;\n if (cursor === this._queue.length) {\n this._allocQueue();\n }\n const item = this._queue[cursor];\n item.char = char;\n item.repeat = repeat;\n item.line = line;\n item.column = column;\n item.filename = filename;\n\n this._queueCursor++;\n }\n\n _popQueue(): QueueItem {\n if (this._queueCursor === 0) {\n throw new Error(\"Cannot pop from empty queue\");\n }\n return this._queue[--this._queueCursor];\n }\n\n /**\n * Get the final string output from the buffer, along with the sourcemap if one exists.\n */\n\n get() {\n this._flush();\n\n const map = this._map;\n const result = {\n // Whatever trim is used here should not execute a regex against the\n // source string since it may be arbitrarily large after all transformations\n code: (this._buf + this._str).trimRight(),\n // Decoded sourcemap is free to generate.\n decodedMap: map?.getDecoded(),\n // Used as a marker for backwards compatibility. We moved input map merging\n // into the generator. We cannot merge the input map a second time, so the\n // presence of this field tells us we've already done the work.\n get __mergedMap() {\n return this.map;\n },\n // Encoding the sourcemap is moderately CPU expensive.\n get map() {\n const resultMap = map ? map.get() : null;\n result.map = resultMap;\n return resultMap;\n },\n set map(value) {\n Object.defineProperty(result, \"map\", { value, writable: true });\n },\n // Retrieving the raw mappings is very memory intensive.\n get rawMappings() {\n const mappings = map?.getRawMappings();\n result.rawMappings = mappings;\n return mappings;\n },\n set rawMappings(value) {\n Object.defineProperty(result, \"rawMappings\", { value, writable: true });\n },\n };\n\n return result;\n }\n\n /**\n * Add a string to the buffer that cannot be reverted.\n */\n\n append(str: string, maybeNewline: boolean): void {\n this._flush();\n\n this._append(str, this._sourcePosition, maybeNewline);\n }\n\n appendChar(char: number): void {\n this._flush();\n this._appendChar(char, 1, this._sourcePosition);\n }\n\n /**\n * Add a string to the buffer than can be reverted.\n */\n queue(char: number): void {\n // Drop trailing spaces when a newline is inserted.\n if (char === charcodes.lineFeed) {\n while (this._queueCursor !== 0) {\n const char = this._queue[this._queueCursor - 1].char;\n if (char !== charcodes.space && char !== charcodes.tab) {\n break;\n }\n\n this._queueCursor--;\n }\n }\n\n const sourcePosition = this._sourcePosition;\n this._pushQueue(\n char,\n 1,\n sourcePosition.line,\n sourcePosition.column,\n sourcePosition.filename,\n );\n }\n\n /**\n * Same as queue, but this indentation will never have a sourcemap marker.\n */\n queueIndentation(char: number, repeat: number): void {\n this._pushQueue(char, repeat, undefined, undefined, undefined);\n }\n\n _flush(): void {\n const queueCursor = this._queueCursor;\n const queue = this._queue;\n for (let i = 0; i < queueCursor; i++) {\n const item: QueueItem = queue[i];\n this._appendChar(item.char, item.repeat, item);\n }\n this._queueCursor = 0;\n }\n\n _appendChar(\n char: number,\n repeat: number,\n sourcePos: InternalSourcePos,\n ): void {\n this._last = char;\n\n this._str +=\n repeat > 1\n ? String.fromCharCode(char).repeat(repeat)\n : String.fromCharCode(char);\n\n if (char !== charcodes.lineFeed) {\n this._mark(\n sourcePos.line,\n sourcePos.column,\n sourcePos.identifierName,\n sourcePos.identifierNamePos,\n sourcePos.filename,\n );\n this._position.column += repeat;\n } else {\n this._position.line++;\n this._position.column = 0;\n }\n\n if (this._canMarkIdName) {\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n }\n\n _append(\n str: string,\n sourcePos: InternalSourcePos,\n maybeNewline: boolean,\n ): void {\n const len = str.length;\n const position = this._position;\n\n this._last = str.charCodeAt(len - 1);\n\n if (++this._appendCount > 4096) {\n +this._str; // Unexplainable huge performance boost. Ref: https://github.com/davidmarkclements/flatstr License: MIT\n this._buf += this._str;\n this._str = str;\n this._appendCount = 0;\n } else {\n this._str += str;\n }\n\n if (!maybeNewline && !this._map) {\n position.column += len;\n return;\n }\n\n const { column, identifierName, identifierNamePos, filename } = sourcePos;\n let line = sourcePos.line;\n\n if (\n (identifierName != null || identifierNamePos != null) &&\n this._canMarkIdName\n ) {\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n\n // Search for newline chars. We search only for `\\n`, since both `\\r` and\n // `\\r\\n` are normalized to `\\n` during parse. We exclude `\\u2028` and\n // `\\u2029` for performance reasons, they're so uncommon that it's probably\n // ok. It's also unclear how other sourcemap utilities handle them...\n let i = str.indexOf(\"\\n\");\n let last = 0;\n\n // If the string starts with a newline char, then adding a mark is redundant.\n // This catches both \"no newlines\" and \"newline after several chars\".\n if (i !== 0) {\n this._mark(line, column, identifierName, identifierNamePos, filename);\n }\n\n // Now, find each remaining newline char in the string.\n while (i !== -1) {\n position.line++;\n position.column = 0;\n last = i + 1;\n\n // We mark the start of each line, which happens directly after this newline char\n // unless this is the last char.\n // When manually adding multi-line content (such as a comment), `line` will be `undefined`.\n if (last < len && line !== undefined) {\n this._mark(++line, 0, null, null, filename);\n }\n i = str.indexOf(\"\\n\", last);\n }\n position.column += len - last;\n }\n\n _mark(\n line: number | undefined,\n column: number | undefined,\n identifierName: string | undefined,\n identifierNamePos: Pos | undefined,\n filename: string | undefined,\n ): void {\n this._map?.mark(\n this._position,\n line,\n column,\n identifierName,\n identifierNamePos,\n filename,\n );\n }\n\n removeTrailingNewline(): void {\n const queueCursor = this._queueCursor;\n if (\n queueCursor !== 0 &&\n this._queue[queueCursor - 1].char === charcodes.lineFeed\n ) {\n this._queueCursor--;\n }\n }\n\n removeLastSemicolon(): void {\n const queueCursor = this._queueCursor;\n if (\n queueCursor !== 0 &&\n this._queue[queueCursor - 1].char === charcodes.semicolon\n ) {\n this._queueCursor--;\n }\n }\n\n getLastChar(): number {\n const queueCursor = this._queueCursor;\n return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last;\n }\n\n /**\n * This will only detect at most 1 newline after a call to `flush()`,\n * but this has not been found so far, and an accurate count can be achieved if needed later.\n */\n getNewlineCount(): number {\n const queueCursor = this._queueCursor;\n let count = 0;\n if (queueCursor === 0) return this._last === charcodes.lineFeed ? 1 : 0;\n for (let i = queueCursor - 1; i >= 0; i--) {\n if (this._queue[i].char !== charcodes.lineFeed) {\n break;\n }\n count++;\n }\n return count === queueCursor && this._last === charcodes.lineFeed\n ? count + 1\n : count;\n }\n\n /**\n * check if current _last + queue ends with newline, return the character before newline\n *\n * @param {*} ch\n * @memberof Buffer\n */\n endsWithCharAndNewline(): number {\n const queue = this._queue;\n const queueCursor = this._queueCursor;\n if (queueCursor !== 0) {\n // every element in queue is one-length whitespace string\n const lastCp = queue[queueCursor - 1].char;\n if (lastCp !== charcodes.lineFeed) return;\n if (queueCursor > 1) {\n return queue[queueCursor - 2].char;\n } else {\n return this._last;\n }\n }\n // We assume that everything being matched is at most a single token plus some whitespace,\n // which everything currently is, but otherwise we'd have to expand _last or check _buf.\n }\n\n hasContent(): boolean {\n return this._queueCursor !== 0 || !!this._last;\n }\n\n /**\n * Certain sourcemap usecases expect mappings to be more accurate than\n * Babel's generic sourcemap handling allows. For now, we special-case\n * identifiers to allow for the primary cases to work.\n * The goal of this line is to ensure that the map output from Babel will\n * have an exact range on identifiers in the output code. Without this\n * line, Babel would potentially include some number of trailing tokens\n * that are printed after the identifier, but before another location has\n * been assigned.\n * This allows tooling like Rollup and Webpack to more accurately perform\n * their own transformations. Most importantly, this allows the import/export\n * transformations performed by those tools to loose less information when\n * applying their own transformations on top of the code and map results\n * generated by Babel itself.\n *\n * The primary example of this is the snippet:\n *\n * import mod from \"mod\";\n * mod();\n *\n * With this line, there will be one mapping range over \"mod\" and another\n * over \"();\", where previously it would have been a single mapping.\n */\n exactSource(loc: Loc | undefined, cb: () => void) {\n if (!this._map) {\n cb();\n return;\n }\n\n this.source(\"start\", loc);\n // @ts-expect-error identifierName is not defined\n const identifierName = loc.identifierName;\n const sourcePos = this._sourcePosition;\n if (identifierName) {\n this._canMarkIdName = false;\n sourcePos.identifierName = identifierName;\n }\n cb();\n\n if (identifierName) {\n this._canMarkIdName = true;\n sourcePos.identifierName = undefined;\n sourcePos.identifierNamePos = undefined;\n }\n this.source(\"end\", loc);\n }\n\n /**\n * Sets a given position as the current source location so generated code after this call\n * will be given this position in the sourcemap.\n */\n\n source(prop: \"start\" | \"end\", loc: Loc | undefined): void {\n if (!this._map) return;\n\n // Since this is called extremely often, we re-use the same _sourcePosition\n // object for the whole lifetime of the buffer.\n this._normalizePosition(prop, loc, 0, 0);\n }\n\n sourceWithOffset(\n prop: \"start\" | \"end\",\n loc: Loc | undefined,\n lineOffset: number,\n columnOffset: number,\n ): void {\n if (!this._map) return;\n\n this._normalizePosition(prop, loc, lineOffset, columnOffset);\n }\n\n /**\n * Call a callback with a specific source location\n */\n\n withSource(prop: \"start\" | \"end\", loc: Loc, cb: () => void): void {\n if (this._map) {\n this.source(prop, loc);\n }\n\n cb();\n }\n\n _normalizePosition(\n prop: \"start\" | \"end\",\n loc: Loc,\n lineOffset: number,\n columnOffset: number,\n ) {\n const pos = loc[prop];\n const target = this._sourcePosition;\n\n if (pos) {\n target.line = pos.line + lineOffset;\n target.column = pos.column + columnOffset;\n target.filename = loc.filename;\n }\n }\n\n getCurrentColumn(): number {\n const queue = this._queue;\n const queueCursor = this._queueCursor;\n\n let lastIndex = -1;\n let len = 0;\n for (let i = 0; i < queueCursor; i++) {\n const item = queue[i];\n if (item.char === charcodes.lineFeed) {\n lastIndex = len;\n }\n len += item.repeat;\n }\n\n return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex;\n }\n\n getCurrentLine(): number {\n let count = 0;\n\n const queue = this._queue;\n for (let i = 0; i < this._queueCursor; i++) {\n if (queue[i].char === charcodes.lineFeed) {\n count++;\n }\n }\n\n return this._position.line + count;\n }\n}\n"],"mappings":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AAY,EAAEY,CAAC,EAAE,EAAE;MAC1C,IAAID,KAAK,CAACC,CAAC,CAAC,CAACE,IAAI,OAAuB,EAAE;QACxCgD,KAAK,EAAE;MACT;IACF;IAEA,OAAO,IAAI,CAAC5D,SAAS,CAACC,IAAI,GAAG2D,KAAK;EACpC;AACF;AAACmB,OAAA,CAAAC,OAAA,GAAA3F,MAAA"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/base.js b/node_modules/@babel/generator/lib/generators/base.js deleted file mode 100644 index 7dae635da..000000000 --- a/node_modules/@babel/generator/lib/generators/base.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BlockStatement = BlockStatement; -exports.Directive = Directive; -exports.DirectiveLiteral = DirectiveLiteral; -exports.File = File; -exports.InterpreterDirective = InterpreterDirective; -exports.Placeholder = Placeholder; -exports.Program = Program; -function File(node) { - if (node.program) { - this.print(node.program.interpreter, node); - } - this.print(node.program, node); -} -function Program(node) { - var _node$directives; - this.noIndentInnerCommentsHere(); - this.printInnerComments(); - const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length; - if (directivesLen) { - var _node$directives$trai; - const newline = node.body.length ? 2 : 1; - this.printSequence(node.directives, node, { - trailingCommentsLineOffset: newline - }); - if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) { - this.newline(newline); - } - } - this.printSequence(node.body, node); -} -function BlockStatement(node) { - var _node$directives2; - this.tokenChar(123); - const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length; - if (directivesLen) { - var _node$directives$trai2; - const newline = node.body.length ? 2 : 1; - this.printSequence(node.directives, node, { - indent: true, - trailingCommentsLineOffset: newline - }); - if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) { - this.newline(newline); - } - } - this.printSequence(node.body, node, { - indent: true - }); - this.rightBrace(node); -} -function Directive(node) { - this.print(node.value, node); - this.semicolon(); -} -const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/; -const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/; -function DirectiveLiteral(node) { - const raw = this.getPossibleRaw(node); - if (!this.format.minified && raw !== undefined) { - this.token(raw); - return; - } - const { - value - } = node; - if (!unescapedDoubleQuoteRE.test(value)) { - this.token(`"${value}"`); - } else if (!unescapedSingleQuoteRE.test(value)) { - this.token(`'${value}'`); - } else { - throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes."); - } -} -function InterpreterDirective(node) { - this.token(`#!${node.value}`); - this.newline(1, true); -} -function Placeholder(node) { - this.token("%%"); - this.print(node.name); - this.token("%%"); - if (node.expectedNode === "Statement") { - this.semicolon(); - } -} - -//# sourceMappingURL=base.js.map diff --git a/node_modules/@babel/generator/lib/generators/base.js.map b/node_modules/@babel/generator/lib/generators/base.js.map deleted file mode 100644 index 40294ccc6..000000000 --- a/node_modules/@babel/generator/lib/generators/base.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["File","node","program","print","interpreter","Program","_node$directives","noIndentInnerCommentsHere","printInnerComments","directivesLen","directives","length","_node$directives$trai","newline","body","printSequence","trailingCommentsLineOffset","trailingComments","BlockStatement","_node$directives2","token","_node$directives$trai2","indent","rightBrace","Directive","value","semicolon","unescapedSingleQuoteRE","unescapedDoubleQuoteRE","DirectiveLiteral","raw","getPossibleRaw","format","minified","undefined","test","Error","InterpreterDirective","Placeholder","name","expectedNode"],"sources":["../../src/generators/base.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\n\nexport function File(this: Printer, node: t.File) {\n if (node.program) {\n // Print this here to ensure that Program node 'leadingComments' still\n // get printed after the hashbang.\n this.print(node.program.interpreter, node);\n }\n\n this.print(node.program, node);\n}\n\nexport function Program(this: Printer, node: t.Program) {\n // An empty Program doesn't have any inner tokens, so\n // we must explicitly print its inner comments.\n this.noIndentInnerCommentsHere();\n this.printInnerComments();\n\n const directivesLen = node.directives?.length;\n if (directivesLen) {\n const newline = node.body.length ? 2 : 1;\n this.printSequence(node.directives, node, {\n trailingCommentsLineOffset: newline,\n });\n if (!node.directives[directivesLen - 1].trailingComments?.length) {\n this.newline(newline);\n }\n }\n\n this.printSequence(node.body, node);\n}\n\nexport function BlockStatement(this: Printer, node: t.BlockStatement) {\n this.token(\"{\");\n\n const directivesLen = node.directives?.length;\n if (directivesLen) {\n const newline = node.body.length ? 2 : 1;\n this.printSequence(node.directives, node, {\n indent: true,\n trailingCommentsLineOffset: newline,\n });\n if (!node.directives[directivesLen - 1].trailingComments?.length) {\n this.newline(newline);\n }\n }\n\n this.printSequence(node.body, node, { indent: true });\n\n this.rightBrace(node);\n}\n\nexport function Directive(this: Printer, node: t.Directive) {\n this.print(node.value, node);\n this.semicolon();\n}\n\n// These regexes match an even number of \\ followed by a quote\nconst unescapedSingleQuoteRE = /(?:^|[^\\\\])(?:\\\\\\\\)*'/;\nconst unescapedDoubleQuoteRE = /(?:^|[^\\\\])(?:\\\\\\\\)*\"/;\n\nexport function DirectiveLiteral(this: Printer, node: t.DirectiveLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.token(raw);\n return;\n }\n\n const { value } = node;\n\n // NOTE: In directives we can't change escapings,\n // because they change the behavior.\n // e.g. \"us\\x65 strict\" (\\x65 is e) is not a \"use strict\" directive.\n\n if (!unescapedDoubleQuoteRE.test(value)) {\n this.token(`\"${value}\"`);\n } else if (!unescapedSingleQuoteRE.test(value)) {\n this.token(`'${value}'`);\n } else {\n throw new Error(\n \"Malformed AST: it is not possible to print a directive containing\" +\n \" both unescaped single and double quotes.\",\n );\n }\n}\n\nexport function InterpreterDirective(\n this: Printer,\n node: t.InterpreterDirective,\n) {\n this.token(`#!${node.value}`);\n this.newline(1, true);\n}\n\nexport function Placeholder(this: Printer, node: t.Placeholder) {\n this.token(\"%%\");\n this.print(node.name);\n this.token(\"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,MAAM,IAAI,CAACE,sBAAsB,CAACQ,IAAI,CAACV,KAAK,CAAC,EAAE;IAC9C,IAAI,CAACL,KAAK,CAAE,IAAGK,KAAM,GAAE,CAAC;EAC1B,CAAC,MAAM;IACL,MAAM,IAAIW,KAAK,CACb,mEAAmE,GACjE,2CAA2C,CAC9C;EACH;AACF;AAEO,SAASC,oBAAoBA,CAElCpC,IAA4B,EAC5B;EACA,IAAI,CAACmB,KAAK,CAAE,KAAInB,IAAI,CAACwB,KAAM,EAAC,CAAC;EAC7B,IAAI,CAACZ,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC;AACvB;AAEO,SAASyB,WAAWA,CAAgBrC,IAAmB,EAAE;EAC9D,IAAI,CAACmB,KAAK,CAAC,IAAI,CAAC;EAChB,IAAI,CAACjB,KAAK,CAACF,IAAI,CAACsC,IAAI,CAAC;EACrB,IAAI,CAACnB,KAAK,CAAC,IAAI,CAAC;EAEhB,IAAInB,IAAI,CAACuC,YAAY,KAAK,WAAW,EAAE;IACrC,IAAI,CAACd,SAAS,EAAE;EAClB;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/classes.js b/node_modules/@babel/generator/lib/generators/classes.js deleted file mode 100644 index a77bf705d..000000000 --- a/node_modules/@babel/generator/lib/generators/classes.js +++ /dev/null @@ -1,177 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ClassAccessorProperty = ClassAccessorProperty; -exports.ClassBody = ClassBody; -exports.ClassExpression = exports.ClassDeclaration = ClassDeclaration; -exports.ClassMethod = ClassMethod; -exports.ClassPrivateMethod = ClassPrivateMethod; -exports.ClassPrivateProperty = ClassPrivateProperty; -exports.ClassProperty = ClassProperty; -exports.StaticBlock = StaticBlock; -exports._classMethodHead = _classMethodHead; -var _t = require("@babel/types"); -const { - isExportDefaultDeclaration, - isExportNamedDeclaration -} = _t; -function ClassDeclaration(node, parent) { - const inExport = isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent); - if (!inExport || !this._shouldPrintDecoratorsBeforeExport(parent)) { - this.printJoin(node.decorators, node); - } - if (node.declare) { - this.word("declare"); - this.space(); - } - if (node.abstract) { - this.word("abstract"); - this.space(); - } - this.word("class"); - if (node.id) { - this.space(); - this.print(node.id, node); - } - this.print(node.typeParameters, node); - if (node.superClass) { - this.space(); - this.word("extends"); - this.space(); - this.print(node.superClass, node); - this.print(node.superTypeParameters, node); - } - if (node.implements) { - this.space(); - this.word("implements"); - this.space(); - this.printList(node.implements, node); - } - this.space(); - this.print(node.body, node); -} -function ClassBody(node) { - this.tokenChar(123); - if (node.body.length === 0) { - this.tokenChar(125); - } else { - this.newline(); - this.indent(); - this.printSequence(node.body, node); - this.dedent(); - if (!this.endsWith(10)) this.newline(); - this.rightBrace(node); - } -} -function ClassProperty(node) { - var _node$key$loc, _node$key$loc$end; - this.printJoin(node.decorators, node); - const endLine = (_node$key$loc = node.key.loc) == null ? void 0 : (_node$key$loc$end = _node$key$loc.end) == null ? void 0 : _node$key$loc$end.line; - if (endLine) this.catchUp(endLine); - this.tsPrintClassMemberModifiers(node); - if (node.computed) { - this.tokenChar(91); - this.print(node.key, node); - this.tokenChar(93); - } else { - this._variance(node); - this.print(node.key, node); - } - if (node.optional) { - this.tokenChar(63); - } - if (node.definite) { - this.tokenChar(33); - } - this.print(node.typeAnnotation, node); - if (node.value) { - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.value, node); - } - this.semicolon(); -} -function ClassAccessorProperty(node) { - var _node$key$loc2, _node$key$loc2$end; - this.printJoin(node.decorators, node); - const endLine = (_node$key$loc2 = node.key.loc) == null ? void 0 : (_node$key$loc2$end = _node$key$loc2.end) == null ? void 0 : _node$key$loc2$end.line; - if (endLine) this.catchUp(endLine); - this.tsPrintClassMemberModifiers(node); - this.word("accessor", true); - this.space(); - if (node.computed) { - this.tokenChar(91); - this.print(node.key, node); - this.tokenChar(93); - } else { - this._variance(node); - this.print(node.key, node); - } - if (node.optional) { - this.tokenChar(63); - } - if (node.definite) { - this.tokenChar(33); - } - this.print(node.typeAnnotation, node); - if (node.value) { - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.value, node); - } - this.semicolon(); -} -function ClassPrivateProperty(node) { - this.printJoin(node.decorators, node); - if (node.static) { - this.word("static"); - this.space(); - } - this.print(node.key, node); - this.print(node.typeAnnotation, node); - if (node.value) { - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.value, node); - } - this.semicolon(); -} -function ClassMethod(node) { - this._classMethodHead(node); - this.space(); - this.print(node.body, node); -} -function ClassPrivateMethod(node) { - this._classMethodHead(node); - this.space(); - this.print(node.body, node); -} -function _classMethodHead(node) { - var _node$key$loc3, _node$key$loc3$end; - this.printJoin(node.decorators, node); - const endLine = (_node$key$loc3 = node.key.loc) == null ? void 0 : (_node$key$loc3$end = _node$key$loc3.end) == null ? void 0 : _node$key$loc3$end.line; - if (endLine) this.catchUp(endLine); - this.tsPrintClassMemberModifiers(node); - this._methodHead(node); -} -function StaticBlock(node) { - this.word("static"); - this.space(); - this.tokenChar(123); - if (node.body.length === 0) { - this.tokenChar(125); - } else { - this.newline(); - this.printSequence(node.body, node, { - indent: true - }); - this.rightBrace(node); - } -} - -//# sourceMappingURL=classes.js.map diff --git a/node_modules/@babel/generator/lib/generators/classes.js.map b/node_modules/@babel/generator/lib/generators/classes.js.map deleted file mode 100644 index 6849c7e4a..000000000 --- a/node_modules/@babel/generator/lib/generators/classes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_t","require","isExportDefaultDeclaration","isExportNamedDeclaration","ClassDeclaration","node","parent","inExport","_shouldPrintDecoratorsBeforeExport","printJoin","decorators","declare","word","space","abstract","id","print","typeParameters","superClass","superTypeParameters","implements","printList","body","ClassBody","token","length","newline","indent","printSequence","dedent","endsWith","rightBrace","ClassProperty","_node$key$loc","_node$key$loc$end","endLine","key","loc","end","line","catchUp","tsPrintClassMemberModifiers","computed","_variance","optional","definite","typeAnnotation","value","semicolon","ClassAccessorProperty","_node$key$loc2","_node$key$loc2$end","ClassPrivateProperty","static","ClassMethod","_classMethodHead","ClassPrivateMethod","_node$key$loc3","_node$key$loc3$end","_methodHead","StaticBlock"],"sources":["../../src/generators/classes.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isExportDefaultDeclaration,\n isExportNamedDeclaration,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nexport function ClassDeclaration(\n this: Printer,\n node: t.ClassDeclaration,\n parent: t.Node,\n) {\n const inExport =\n isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent);\n\n if (\n !inExport ||\n !this._shouldPrintDecoratorsBeforeExport(\n parent as t.ExportDeclaration & { declaration: t.ClassDeclaration },\n )\n ) {\n this.printJoin(node.decorators, node);\n }\n\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n if (node.abstract) {\n // TS\n this.word(\"abstract\");\n this.space();\n }\n\n this.word(\"class\");\n\n if (node.id) {\n this.space();\n this.print(node.id, node);\n }\n\n this.print(node.typeParameters, node);\n\n if (node.superClass) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.superClass, node);\n this.print(node.superTypeParameters, node);\n }\n\n if (node.implements) {\n this.space();\n this.word(\"implements\");\n this.space();\n this.printList(node.implements, node);\n }\n\n this.space();\n this.print(node.body, node);\n}\n\nexport { ClassDeclaration as ClassExpression };\n\nexport function ClassBody(this: Printer, node: t.ClassBody) {\n this.token(\"{\");\n if (node.body.length === 0) {\n this.token(\"}\");\n } else {\n this.newline();\n\n this.indent();\n this.printSequence(node.body, node);\n this.dedent();\n\n if (!this.endsWith(charCodes.lineFeed)) this.newline();\n\n this.rightBrace(node);\n }\n}\n\nexport function ClassProperty(this: Printer, node: t.ClassProperty) {\n this.printJoin(node.decorators, node);\n\n // catch up to property key, avoid line break\n // between member modifiers and the property key.\n const endLine = node.key.loc?.end?.line;\n if (endLine) this.catchUp(endLine);\n\n this.tsPrintClassMemberModifiers(node);\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key, node);\n this.token(\"]\");\n } else {\n this._variance(node);\n this.print(node.key, node);\n }\n\n // TS\n if (node.optional) {\n this.token(\"?\");\n }\n if (node.definite) {\n this.token(\"!\");\n }\n\n this.print(node.typeAnnotation, node);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value, node);\n }\n this.semicolon();\n}\n\nexport function ClassAccessorProperty(\n this: Printer,\n node: t.ClassAccessorProperty,\n) {\n this.printJoin(node.decorators, node);\n\n // catch up to property key, avoid line break\n // between member modifiers and the property key.\n const endLine = node.key.loc?.end?.line;\n if (endLine) this.catchUp(endLine);\n\n // TS does not support class accessor property yet\n this.tsPrintClassMemberModifiers(node);\n\n this.word(\"accessor\", true);\n this.space();\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key, node);\n this.token(\"]\");\n } else {\n // Todo: Flow does not support class accessor property yet.\n this._variance(node);\n this.print(node.key, node);\n }\n\n // TS\n if (node.optional) {\n this.token(\"?\");\n }\n if (node.definite) {\n this.token(\"!\");\n }\n\n this.print(node.typeAnnotation, node);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value, node);\n }\n this.semicolon();\n}\n\nexport function ClassPrivateProperty(\n this: Printer,\n node: t.ClassPrivateProperty,\n) {\n this.printJoin(node.decorators, node);\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.print(node.key, node);\n this.print(node.typeAnnotation, node);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value, node);\n }\n this.semicolon();\n}\n\nexport function ClassMethod(this: Printer, node: t.ClassMethod) {\n this._classMethodHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function ClassPrivateMethod(this: Printer, node: t.ClassPrivateMethod) {\n this._classMethodHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function _classMethodHead(\n this: Printer,\n node: t.ClassMethod | t.ClassPrivateMethod | t.TSDeclareMethod,\n) {\n this.printJoin(node.decorators, node);\n\n // catch up to method key, avoid line break\n // between member modifiers/method heads and the method key.\n const endLine = node.key.loc?.end?.line;\n if (endLine) this.catchUp(endLine);\n\n this.tsPrintClassMemberModifiers(node);\n this._methodHead(node);\n}\n\nexport function StaticBlock(this: Printer, node: t.StaticBlock) {\n this.word(\"static\");\n this.space();\n this.token(\"{\");\n if (node.body.length === 0) {\n this.token(\"}\");\n } else {\n this.newline();\n this.printSequence(node.body, node, {\n indent: true,\n });\n this.rightBrace(node);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAGsB;EAFpBC,0BAA0B;EAC1BC;AAAwB,IAAAH,EAAA;AAKnB,SAASI,gBAAgBA,CAE9BC,IAAwB,EACxBC,MAAc,EACd;EACA,MAAMC,QAAQ,GACZL,0BAA0B,CAACI,MAAM,CAAC,IAAIH,wBAAwB,CAACG,MAAM,CAAC;EAExE,IACE,CAACC,QAAQ,IACT,CAAC,IAAI,CAACC,kCAAkC,CACtCF,MAAM,CACP,EACD;IACA,IAAI,CAACG,SAAS,CAACJ,IAAI,CAACK,UAAU,EAAEL,IAAI,CAAC;EACvC;EAEA,IAAIA,IAAI,CAACM,OAAO,EAAE;IAEhB,IAAI,CAACC,IAAI,CAAC,SAAS,CAAC;IACpB,IAAI,CAACC,KAAK,EAAE;EACd;EAEA,IAAIR,IAAI,CAACS,QAAQ,EAAE;IAEjB,IAAI,CAACF,IAAI,CAAC,UAAU,CAAC;IACrB,IAAI,CAACC,KAAK,EAAE;EACd;EAEA,IAAI,CAACD,IAAI,CAAC,OAAO,CAAC;EAElB,IAAIP,IAAI,CAACU,EAAE,EAAE;IACX,IAAI,CAACF,KAAK,EAAE;IACZ,IAAI,CAACG,KAAK,CAACX,IAAI,CAACU,EAAE,EAAEV,IAAI,CAAC;EAC3B;EAEA,IAAI,CAACW,KAAK,CAACX,IAAI,CAACY,cAAc,EAAEZ,IAAI,CAAC;EAErC,IAAIA,IAAI,CAAC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CAACM,2BAA2B,CAACpC,IAAI,CAAC;EACtC,IAAI,CAACsD,WAAW,CAACtD,IAAI,CAAC;AACxB;AAEO,SAASuD,WAAWA,CAAgBvD,IAAmB,EAAE;EAC9D,IAAI,CAACO,IAAI,CAAC,QAAQ,CAAC;EACnB,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACW,SAAK,KAAK;EACf,IAAInB,IAAI,CAACiB,IAAI,CAACG,MAAM,KAAK,CAAC,EAAE;IAC1B,IAAI,CAACD,SAAK,KAAK;EACjB,CAAC,MAAM;IACL,IAAI,CAACE,OAAO,EAAE;IACd,IAAI,CAACE,aAAa,CAACvB,IAAI,CAACiB,IAAI,EAAEjB,IAAI,EAAE;MAClCsB,MAAM,EAAE;IACV,CAAC,CAAC;IACF,IAAI,CAACI,UAAU,CAAC1B,IAAI,CAAC;EACvB;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/expressions.js b/node_modules/@babel/generator/lib/generators/expressions.js deleted file mode 100644 index 336e708b1..000000000 --- a/node_modules/@babel/generator/lib/generators/expressions.js +++ /dev/null @@ -1,309 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.LogicalExpression = exports.BinaryExpression = exports.AssignmentExpression = AssignmentExpression; -exports.AssignmentPattern = AssignmentPattern; -exports.AwaitExpression = AwaitExpression; -exports.BindExpression = BindExpression; -exports.CallExpression = CallExpression; -exports.ConditionalExpression = ConditionalExpression; -exports.Decorator = Decorator; -exports.DoExpression = DoExpression; -exports.EmptyStatement = EmptyStatement; -exports.ExpressionStatement = ExpressionStatement; -exports.Import = Import; -exports.MemberExpression = MemberExpression; -exports.MetaProperty = MetaProperty; -exports.ModuleExpression = ModuleExpression; -exports.NewExpression = NewExpression; -exports.OptionalCallExpression = OptionalCallExpression; -exports.OptionalMemberExpression = OptionalMemberExpression; -exports.ParenthesizedExpression = ParenthesizedExpression; -exports.PrivateName = PrivateName; -exports.SequenceExpression = SequenceExpression; -exports.Super = Super; -exports.ThisExpression = ThisExpression; -exports.UnaryExpression = UnaryExpression; -exports.UpdateExpression = UpdateExpression; -exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier; -exports.YieldExpression = YieldExpression; -exports._shouldPrintDecoratorsBeforeExport = _shouldPrintDecoratorsBeforeExport; -var _t = require("@babel/types"); -var n = require("../node"); -const { - isCallExpression, - isLiteral, - isMemberExpression, - isNewExpression -} = _t; -function UnaryExpression(node) { - const { - operator - } = node; - if (operator === "void" || operator === "delete" || operator === "typeof" || operator === "throw") { - this.word(operator); - this.space(); - } else { - this.token(operator); - } - this.print(node.argument, node); -} -function DoExpression(node) { - if (node.async) { - this.word("async", true); - this.space(); - } - this.word("do"); - this.space(); - this.print(node.body, node); -} -function ParenthesizedExpression(node) { - this.tokenChar(40); - this.print(node.expression, node); - this.rightParens(node); -} -function UpdateExpression(node) { - if (node.prefix) { - this.token(node.operator); - this.print(node.argument, node); - } else { - this.printTerminatorless(node.argument, node, true); - this.token(node.operator); - } -} -function ConditionalExpression(node) { - this.print(node.test, node); - this.space(); - this.tokenChar(63); - this.space(); - this.print(node.consequent, node); - this.space(); - this.tokenChar(58); - this.space(); - this.print(node.alternate, node); -} -function NewExpression(node, parent) { - this.word("new"); - this.space(); - this.print(node.callee, node); - if (this.format.minified && node.arguments.length === 0 && !node.optional && !isCallExpression(parent, { - callee: node - }) && !isMemberExpression(parent) && !isNewExpression(parent)) { - return; - } - this.print(node.typeArguments, node); - this.print(node.typeParameters, node); - if (node.optional) { - this.token("?."); - } - this.tokenChar(40); - this.printList(node.arguments, node); - this.rightParens(node); -} -function SequenceExpression(node) { - this.printList(node.expressions, node); -} -function ThisExpression() { - this.word("this"); -} -function Super() { - this.word("super"); -} -function isDecoratorMemberExpression(node) { - switch (node.type) { - case "Identifier": - return true; - case "MemberExpression": - return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object); - default: - return false; - } -} -function shouldParenthesizeDecoratorExpression(node) { - if (node.type === "ParenthesizedExpression") { - return false; - } - return !isDecoratorMemberExpression(node.type === "CallExpression" ? node.callee : node); -} -function _shouldPrintDecoratorsBeforeExport(node) { - if (typeof this.format.decoratorsBeforeExport === "boolean") { - return this.format.decoratorsBeforeExport; - } - return typeof node.start === "number" && node.start === node.declaration.start; -} -function Decorator(node) { - this.tokenChar(64); - const { - expression - } = node; - if (shouldParenthesizeDecoratorExpression(expression)) { - this.tokenChar(40); - this.print(expression, node); - this.tokenChar(41); - } else { - this.print(expression, node); - } - this.newline(); -} -function OptionalMemberExpression(node) { - let { - computed - } = node; - const { - optional, - property - } = node; - this.print(node.object, node); - if (!computed && isMemberExpression(property)) { - throw new TypeError("Got a MemberExpression for MemberExpression property"); - } - if (isLiteral(property) && typeof property.value === "number") { - computed = true; - } - if (optional) { - this.token("?."); - } - if (computed) { - this.tokenChar(91); - this.print(property, node); - this.tokenChar(93); - } else { - if (!optional) { - this.tokenChar(46); - } - this.print(property, node); - } -} -function OptionalCallExpression(node) { - this.print(node.callee, node); - this.print(node.typeParameters, node); - if (node.optional) { - this.token("?."); - } - this.print(node.typeArguments, node); - this.tokenChar(40); - this.printList(node.arguments, node); - this.rightParens(node); -} -function CallExpression(node) { - this.print(node.callee, node); - this.print(node.typeArguments, node); - this.print(node.typeParameters, node); - this.tokenChar(40); - this.printList(node.arguments, node); - this.rightParens(node); -} -function Import() { - this.word("import"); -} -function AwaitExpression(node) { - this.word("await"); - if (node.argument) { - this.space(); - this.printTerminatorless(node.argument, node, false); - } -} -function YieldExpression(node) { - this.word("yield", true); - if (node.delegate) { - this.tokenChar(42); - if (node.argument) { - this.space(); - this.print(node.argument, node); - } - } else { - if (node.argument) { - this.space(); - this.printTerminatorless(node.argument, node, false); - } - } -} -function EmptyStatement() { - this.semicolon(true); -} -function ExpressionStatement(node) { - this.print(node.expression, node); - this.semicolon(); -} -function AssignmentPattern(node) { - this.print(node.left, node); - if (node.left.optional) this.tokenChar(63); - this.print(node.left.typeAnnotation, node); - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.right, node); -} -function AssignmentExpression(node, parent) { - const parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent); - if (parens) { - this.tokenChar(40); - } - this.print(node.left, node); - this.space(); - if (node.operator === "in" || node.operator === "instanceof") { - this.word(node.operator); - } else { - this.token(node.operator); - } - this.space(); - this.print(node.right, node); - if (parens) { - this.tokenChar(41); - } -} -function BindExpression(node) { - this.print(node.object, node); - this.token("::"); - this.print(node.callee, node); -} -function MemberExpression(node) { - this.print(node.object, node); - if (!node.computed && isMemberExpression(node.property)) { - throw new TypeError("Got a MemberExpression for MemberExpression property"); - } - let computed = node.computed; - if (isLiteral(node.property) && typeof node.property.value === "number") { - computed = true; - } - if (computed) { - this.tokenChar(91); - this.print(node.property, node); - this.tokenChar(93); - } else { - this.tokenChar(46); - this.print(node.property, node); - } -} -function MetaProperty(node) { - this.print(node.meta, node); - this.tokenChar(46); - this.print(node.property, node); -} -function PrivateName(node) { - this.tokenChar(35); - this.print(node.id, node); -} -function V8IntrinsicIdentifier(node) { - this.tokenChar(37); - this.word(node.name); -} -function ModuleExpression(node) { - this.word("module", true); - this.space(); - this.tokenChar(123); - this.indent(); - const { - body - } = node; - if (body.body.length || body.directives.length) { - this.newline(); - } - this.print(body, node); - this.dedent(); - this.rightBrace(node); -} - -//# sourceMappingURL=expressions.js.map diff --git a/node_modules/@babel/generator/lib/generators/expressions.js.map b/node_modules/@babel/generator/lib/generators/expressions.js.map deleted file mode 100644 index d3bebcd51..000000000 --- a/node_modules/@babel/generator/lib/generators/expressions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_t","require","n","isCallExpression","isLiteral","isMemberExpression","isNewExpression","UnaryExpression","node","operator","word","space","token","print","argument","DoExpression","async","body","ParenthesizedExpression","expression","rightParens","UpdateExpression","prefix","printTerminatorless","ConditionalExpression","test","consequent","alternate","NewExpression","parent","callee","format","minified","arguments","length","optional","typeArguments","typeParameters","printList","SequenceExpression","expressions","ThisExpression","Super","isDecoratorMemberExpression","type","computed","property","object","shouldParenthesizeDecoratorExpression","_shouldPrintDecoratorsBeforeExport","decoratorsBeforeExport","start","declaration","Decorator","newline","OptionalMemberExpression","TypeError","value","OptionalCallExpression","CallExpression","Import","AwaitExpression","YieldExpression","delegate","EmptyStatement","semicolon","ExpressionStatement","AssignmentPattern","left","typeAnnotation","right","AssignmentExpression","parens","inForStatementInitCounter","needsParens","BindExpression","MemberExpression","MetaProperty","meta","PrivateName","id","V8IntrinsicIdentifier","name","ModuleExpression","indent","directives","dedent","rightBrace"],"sources":["../../src/generators/expressions.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isCallExpression,\n isLiteral,\n isMemberExpression,\n isNewExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as n from \"../node\";\n\nexport function UnaryExpression(this: Printer, node: t.UnaryExpression) {\n const { operator } = node;\n if (\n operator === \"void\" ||\n operator === \"delete\" ||\n operator === \"typeof\" ||\n // throwExpressions\n operator === \"throw\"\n ) {\n this.word(operator);\n this.space();\n } else {\n this.token(operator);\n }\n\n this.print(node.argument, node);\n}\n\nexport function DoExpression(this: Printer, node: t.DoExpression) {\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n this.word(\"do\");\n this.space();\n this.print(node.body, node);\n}\n\nexport function ParenthesizedExpression(\n this: Printer,\n node: t.ParenthesizedExpression,\n) {\n this.token(\"(\");\n this.print(node.expression, node);\n this.rightParens(node);\n}\n\nexport function UpdateExpression(this: Printer, node: t.UpdateExpression) {\n if (node.prefix) {\n this.token(node.operator);\n this.print(node.argument, node);\n } else {\n this.printTerminatorless(node.argument, node, true);\n this.token(node.operator);\n }\n}\n\nexport function ConditionalExpression(\n this: Printer,\n node: t.ConditionalExpression,\n) {\n this.print(node.test, node);\n this.space();\n this.token(\"?\");\n this.space();\n this.print(node.consequent, node);\n this.space();\n this.token(\":\");\n this.space();\n this.print(node.alternate, node);\n}\n\nexport function NewExpression(\n this: Printer,\n node: t.NewExpression,\n parent: t.Node,\n) {\n this.word(\"new\");\n this.space();\n this.print(node.callee, node);\n if (\n this.format.minified &&\n node.arguments.length === 0 &&\n !node.optional &&\n !isCallExpression(parent, { callee: node }) &&\n !isMemberExpression(parent) &&\n !isNewExpression(parent)\n ) {\n return;\n }\n\n this.print(node.typeArguments, node); // Flow\n this.print(node.typeParameters, node); // TS\n\n if (node.optional) {\n // TODO: This can never happen\n this.token(\"?.\");\n }\n this.token(\"(\");\n this.printList(node.arguments, node);\n this.rightParens(node);\n}\n\nexport function SequenceExpression(this: Printer, node: t.SequenceExpression) {\n this.printList(node.expressions, node);\n}\n\nexport function ThisExpression(this: Printer) {\n this.word(\"this\");\n}\n\nexport function Super(this: Printer) {\n this.word(\"super\");\n}\n\nfunction isDecoratorMemberExpression(\n node: t.Expression | t.Super | t.V8IntrinsicIdentifier,\n): boolean {\n switch (node.type) {\n case \"Identifier\":\n return true;\n case \"MemberExpression\":\n return (\n !node.computed &&\n node.property.type === \"Identifier\" &&\n isDecoratorMemberExpression(node.object)\n );\n default:\n return false;\n }\n}\nfunction shouldParenthesizeDecoratorExpression(\n node: t.Expression | t.Super | t.V8IntrinsicIdentifier,\n) {\n if (node.type === \"ParenthesizedExpression\") {\n // We didn't check extra?.parenthesized here because we don't track decorators in needsParen\n return false;\n }\n return !isDecoratorMemberExpression(\n node.type === \"CallExpression\" ? node.callee : node,\n );\n}\n\nexport function _shouldPrintDecoratorsBeforeExport(\n this: Printer,\n node: t.ExportDeclaration & { declaration: t.ClassDeclaration },\n) {\n if (typeof this.format.decoratorsBeforeExport === \"boolean\") {\n return this.format.decoratorsBeforeExport;\n }\n return (\n typeof node.start === \"number\" && node.start === node.declaration.start\n );\n}\n\nexport function Decorator(this: Printer, node: t.Decorator) {\n this.token(\"@\");\n const { expression } = node;\n if (shouldParenthesizeDecoratorExpression(expression)) {\n this.token(\"(\");\n this.print(expression, node);\n this.token(\")\");\n } else {\n this.print(expression, node);\n }\n this.newline();\n}\n\nexport function OptionalMemberExpression(\n this: Printer,\n node: t.OptionalMemberExpression,\n) {\n let { computed } = node;\n const { optional, property } = node;\n\n this.print(node.object, node);\n\n if (!computed && isMemberExpression(property)) {\n throw new TypeError(\"Got a MemberExpression for MemberExpression property\");\n }\n\n // @ts-expect-error todo(flow->ts) maybe instead of typeof check specific literal types?\n if (isLiteral(property) && typeof property.value === \"number\") {\n computed = true;\n }\n if (optional) {\n this.token(\"?.\");\n }\n\n if (computed) {\n this.token(\"[\");\n this.print(property, node);\n this.token(\"]\");\n } else {\n if (!optional) {\n this.token(\".\");\n }\n this.print(property, node);\n }\n}\n\nexport function OptionalCallExpression(\n this: Printer,\n node: t.OptionalCallExpression,\n) {\n this.print(node.callee, node);\n\n this.print(node.typeParameters, node); // TS\n\n if (node.optional) {\n this.token(\"?.\");\n }\n\n this.print(node.typeArguments, node); // Flow\n\n this.token(\"(\");\n this.printList(node.arguments, node);\n this.rightParens(node);\n}\n\nexport function CallExpression(this: Printer, node: t.CallExpression) {\n this.print(node.callee, node);\n\n this.print(node.typeArguments, node); // Flow\n this.print(node.typeParameters, node); // TS\n this.token(\"(\");\n this.printList(node.arguments, node);\n this.rightParens(node);\n}\n\nexport function Import(this: Printer) {\n this.word(\"import\");\n}\n\nexport function AwaitExpression(this: Printer, node: t.AwaitExpression) {\n this.word(\"await\");\n\n if (node.argument) {\n this.space();\n this.printTerminatorless(node.argument, node, false);\n }\n}\n\nexport function YieldExpression(this: Printer, node: t.YieldExpression) {\n this.word(\"yield\", true);\n\n if (node.delegate) {\n this.token(\"*\");\n if (node.argument) {\n this.space();\n // line terminators are allowed after yield*\n this.print(node.argument, node);\n }\n } else {\n if (node.argument) {\n this.space();\n this.printTerminatorless(node.argument, node, false);\n }\n }\n}\n\nexport function EmptyStatement(this: Printer) {\n this.semicolon(true /* force */);\n}\n\nexport function ExpressionStatement(\n this: Printer,\n node: t.ExpressionStatement,\n) {\n this.print(node.expression, node);\n this.semicolon();\n}\n\nexport function AssignmentPattern(this: Printer, node: t.AssignmentPattern) {\n this.print(node.left, node);\n // @ts-expect-error todo(flow->ts) property present on some of the types in union but not all\n if (node.left.optional) this.token(\"?\");\n // @ts-expect-error todo(flow->ts) property present on some of the types in union but not all\n this.print(node.left.typeAnnotation, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.right, node);\n}\n\nexport function AssignmentExpression(\n this: Printer,\n node: t.AssignmentExpression,\n parent: t.Node,\n) {\n // Somewhere inside a for statement `init` node but doesn't usually\n // needs a paren except for `in` expressions: `for (a in b ? a : b;;)`\n const parens =\n this.inForStatementInitCounter &&\n node.operator === \"in\" &&\n !n.needsParens(node, parent);\n\n if (parens) {\n this.token(\"(\");\n }\n\n this.print(node.left, node);\n\n this.space();\n if (node.operator === \"in\" || node.operator === \"instanceof\") {\n this.word(node.operator);\n } else {\n this.token(node.operator);\n }\n this.space();\n\n this.print(node.right, node);\n\n if (parens) {\n this.token(\")\");\n }\n}\n\nexport function BindExpression(this: Printer, node: t.BindExpression) {\n this.print(node.object, node);\n this.token(\"::\");\n this.print(node.callee, node);\n}\n\nexport {\n AssignmentExpression as BinaryExpression,\n AssignmentExpression as LogicalExpression,\n};\n\nexport function MemberExpression(this: Printer, node: t.MemberExpression) {\n this.print(node.object, node);\n\n if (!node.computed && isMemberExpression(node.property)) {\n throw new TypeError(\"Got a MemberExpression for MemberExpression property\");\n }\n\n let computed = node.computed;\n // @ts-expect-error todo(flow->ts) maybe use specific literal types\n if (isLiteral(node.property) && typeof node.property.value === \"number\") {\n computed = true;\n }\n\n if (computed) {\n this.token(\"[\");\n this.print(node.property, node);\n this.token(\"]\");\n } else {\n this.token(\".\");\n this.print(node.property, node);\n }\n}\n\nexport function MetaProperty(this: Printer, node: t.MetaProperty) {\n this.print(node.meta, node);\n this.token(\".\");\n this.print(node.property, node);\n}\n\nexport function PrivateName(this: Printer, node: t.PrivateName) {\n this.token(\"#\");\n this.print(node.id, node);\n}\n\nexport function V8IntrinsicIdentifier(\n this: Printer,\n node: t.V8IntrinsicIdentifier,\n) {\n this.token(\"%\");\n this.word(node.name);\n}\n\nexport function ModuleExpression(this: Printer, node: t.ModuleExpression) {\n this.word(\"module\", true);\n this.space();\n this.token(\"{\");\n this.indent();\n const { body } = node;\n if (body.body.length || body.directives.length) {\n this.newline();\n }\n this.print(body, node);\n this.dedent();\n this.rightBrace(node);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAOA,IAAAC,CAAA,GAAAD,OAAA;AAA6B;EAN3BE,gBAAgB;EAChBC,SAAS;EACTC,kBAAkB;EAClBC;AAAe,IAAAN,EAAA;AAKV,SAASO,eAAeA,CAAgBC,IAAuB,EAAE;EACtE,MAAM;IAAEC;EAAS,CAAC,GAAGD,IAAI;EACzB,IACEC,QAAQ,KAAK,MAAM,IACnBA,QAAQ,KAAK,QAAQ,IACrBA,QAAQ,KAAK,QAAQ,IAErBA,QAAQ,KAAK,OAAO,EACpB;IACA,IAAI,CAACC,IAAI,CAACD,QAAQ,CAAC;IACnB,IAAI,CAACE,KAAK,EAAE;EACd,CAAC,MAAM;IACL,IAAI,CAACC,KAAK,CAACH,QAAQ,CAAC;EACtB;EAEA,IAAI,CAACI,KAAK,CAACL,IAAI,CAACM,QAAQ,EAAEN,IAAI,CAAC;AACjC;AAEO,SAASO,YAAYA,CAAgBP,IAAoB,EAAE;EAChE,IAAIA,IAAI,CAACQ,KAAK,EAAE;IACd,IAAI,CAACN,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;IACxB,IAAI,CAACC,KAAK,EAAE;EACd;EACA,IAAI,CAACD,IAAI,CAAC,IAAI,CAAC;EACf,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACE,KAAK,CAACL,IAAI,CAACS,IAAI,EAAET,IAAI,CAAC;AAC7B;AAEO,SAASU,uBAAuBA,CAErCV,IAA+B,EAC/B;EACA,IAAI,CAACI,SAAK,IAAK;EACf,IAAI,CAACC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,CAAgBvE,IAAmB,EAAE;EAC9D,IAAI,CAACI,SAAK,IAAK;EACf,IAAI,CAACC,KAAK,CAACL,IAAI,CAACwE,EAAE,EAAExE,IAAI,CAAC;AAC3B;AAEO,SAASyE,qBAAqBA,CAEnCzE,IAA6B,EAC7B;EACA,IAAI,CAACI,SAAK,IAAK;EACf,IAAI,CAACF,IAAI,CAACF,IAAI,CAAC0E,IAAI,CAAC;AACtB;AAEO,SAASC,gBAAgBA,CAAgB3E,IAAwB,EAAE;EACxE,IAAI,CAACE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC;EACzB,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACC,SAAK,KAAK;EACf,IAAI,CAACwE,MAAM,EAAE;EACb,MAAM;IAAEnE;EAAK,CAAC,GAAGT,IAAI;EACrB,IAAIS,IAAI,CAACA,IAAI,CAACiB,MAAM,IAAIjB,IAAI,CAACoE,UAAU,CAACnD,MAAM,EAAE;IAC9C,IAAI,CAACoB,OAAO,EAAE;EAChB;EACA,IAAI,CAACzC,KAAK,CAACI,IAAI,EAAET,IAAI,CAAC;EACtB,IAAI,CAAC8E,MAAM,EAAE;EACb,IAAI,CAACC,UAAU,CAAC/E,IAAI,CAAC;AACvB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/flow.js b/node_modules/@babel/generator/lib/generators/flow.js deleted file mode 100644 index e1f95be3e..000000000 --- a/node_modules/@babel/generator/lib/generators/flow.js +++ /dev/null @@ -1,668 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.AnyTypeAnnotation = AnyTypeAnnotation; -exports.ArrayTypeAnnotation = ArrayTypeAnnotation; -exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation; -exports.BooleanTypeAnnotation = BooleanTypeAnnotation; -exports.DeclareClass = DeclareClass; -exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration; -exports.DeclareExportDeclaration = DeclareExportDeclaration; -exports.DeclareFunction = DeclareFunction; -exports.DeclareInterface = DeclareInterface; -exports.DeclareModule = DeclareModule; -exports.DeclareModuleExports = DeclareModuleExports; -exports.DeclareOpaqueType = DeclareOpaqueType; -exports.DeclareTypeAlias = DeclareTypeAlias; -exports.DeclareVariable = DeclareVariable; -exports.DeclaredPredicate = DeclaredPredicate; -exports.EmptyTypeAnnotation = EmptyTypeAnnotation; -exports.EnumBooleanBody = EnumBooleanBody; -exports.EnumBooleanMember = EnumBooleanMember; -exports.EnumDeclaration = EnumDeclaration; -exports.EnumDefaultedMember = EnumDefaultedMember; -exports.EnumNumberBody = EnumNumberBody; -exports.EnumNumberMember = EnumNumberMember; -exports.EnumStringBody = EnumStringBody; -exports.EnumStringMember = EnumStringMember; -exports.EnumSymbolBody = EnumSymbolBody; -exports.ExistsTypeAnnotation = ExistsTypeAnnotation; -exports.FunctionTypeAnnotation = FunctionTypeAnnotation; -exports.FunctionTypeParam = FunctionTypeParam; -exports.IndexedAccessType = IndexedAccessType; -exports.InferredPredicate = InferredPredicate; -exports.InterfaceDeclaration = InterfaceDeclaration; -exports.GenericTypeAnnotation = exports.ClassImplements = exports.InterfaceExtends = InterfaceExtends; -exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation; -exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation; -exports.MixedTypeAnnotation = MixedTypeAnnotation; -exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation; -exports.NullableTypeAnnotation = NullableTypeAnnotation; -Object.defineProperty(exports, "NumberLiteralTypeAnnotation", { - enumerable: true, - get: function () { - return _types2.NumericLiteral; - } -}); -exports.NumberTypeAnnotation = NumberTypeAnnotation; -exports.ObjectTypeAnnotation = ObjectTypeAnnotation; -exports.ObjectTypeCallProperty = ObjectTypeCallProperty; -exports.ObjectTypeIndexer = ObjectTypeIndexer; -exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot; -exports.ObjectTypeProperty = ObjectTypeProperty; -exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty; -exports.OpaqueType = OpaqueType; -exports.OptionalIndexedAccessType = OptionalIndexedAccessType; -exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier; -Object.defineProperty(exports, "StringLiteralTypeAnnotation", { - enumerable: true, - get: function () { - return _types2.StringLiteral; - } -}); -exports.StringTypeAnnotation = StringTypeAnnotation; -exports.SymbolTypeAnnotation = SymbolTypeAnnotation; -exports.ThisTypeAnnotation = ThisTypeAnnotation; -exports.TupleTypeAnnotation = TupleTypeAnnotation; -exports.TypeAlias = TypeAlias; -exports.TypeAnnotation = TypeAnnotation; -exports.TypeCastExpression = TypeCastExpression; -exports.TypeParameter = TypeParameter; -exports.TypeParameterDeclaration = exports.TypeParameterInstantiation = TypeParameterInstantiation; -exports.TypeofTypeAnnotation = TypeofTypeAnnotation; -exports.UnionTypeAnnotation = UnionTypeAnnotation; -exports.Variance = Variance; -exports.VoidTypeAnnotation = VoidTypeAnnotation; -exports._interfaceish = _interfaceish; -exports._variance = _variance; -var _t = require("@babel/types"); -var _modules = require("./modules"); -var _types2 = require("./types"); -const { - isDeclareExportDeclaration, - isStatement -} = _t; -function AnyTypeAnnotation() { - this.word("any"); -} -function ArrayTypeAnnotation(node) { - this.print(node.elementType, node, true); - this.tokenChar(91); - this.tokenChar(93); -} -function BooleanTypeAnnotation() { - this.word("boolean"); -} -function BooleanLiteralTypeAnnotation(node) { - this.word(node.value ? "true" : "false"); -} -function NullLiteralTypeAnnotation() { - this.word("null"); -} -function DeclareClass(node, parent) { - if (!isDeclareExportDeclaration(parent)) { - this.word("declare"); - this.space(); - } - this.word("class"); - this.space(); - this._interfaceish(node); -} -function DeclareFunction(node, parent) { - if (!isDeclareExportDeclaration(parent)) { - this.word("declare"); - this.space(); - } - this.word("function"); - this.space(); - this.print(node.id, node); - this.print(node.id.typeAnnotation.typeAnnotation, node); - if (node.predicate) { - this.space(); - this.print(node.predicate, node); - } - this.semicolon(); -} -function InferredPredicate() { - this.tokenChar(37); - this.word("checks"); -} -function DeclaredPredicate(node) { - this.tokenChar(37); - this.word("checks"); - this.tokenChar(40); - this.print(node.value, node); - this.tokenChar(41); -} -function DeclareInterface(node) { - this.word("declare"); - this.space(); - this.InterfaceDeclaration(node); -} -function DeclareModule(node) { - this.word("declare"); - this.space(); - this.word("module"); - this.space(); - this.print(node.id, node); - this.space(); - this.print(node.body, node); -} -function DeclareModuleExports(node) { - this.word("declare"); - this.space(); - this.word("module"); - this.tokenChar(46); - this.word("exports"); - this.print(node.typeAnnotation, node); -} -function DeclareTypeAlias(node) { - this.word("declare"); - this.space(); - this.TypeAlias(node); -} -function DeclareOpaqueType(node, parent) { - if (!isDeclareExportDeclaration(parent)) { - this.word("declare"); - this.space(); - } - this.OpaqueType(node); -} -function DeclareVariable(node, parent) { - if (!isDeclareExportDeclaration(parent)) { - this.word("declare"); - this.space(); - } - this.word("var"); - this.space(); - this.print(node.id, node); - this.print(node.id.typeAnnotation, node); - this.semicolon(); -} -function DeclareExportDeclaration(node) { - this.word("declare"); - this.space(); - this.word("export"); - this.space(); - if (node.default) { - this.word("default"); - this.space(); - } - FlowExportDeclaration.call(this, node); -} -function DeclareExportAllDeclaration(node) { - this.word("declare"); - this.space(); - _modules.ExportAllDeclaration.call(this, node); -} -function EnumDeclaration(node) { - const { - id, - body - } = node; - this.word("enum"); - this.space(); - this.print(id, node); - this.print(body, node); -} -function enumExplicitType(context, name, hasExplicitType) { - if (hasExplicitType) { - context.space(); - context.word("of"); - context.space(); - context.word(name); - } - context.space(); -} -function enumBody(context, node) { - const { - members - } = node; - context.token("{"); - context.indent(); - context.newline(); - for (const member of members) { - context.print(member, node); - context.newline(); - } - if (node.hasUnknownMembers) { - context.token("..."); - context.newline(); - } - context.dedent(); - context.token("}"); -} -function EnumBooleanBody(node) { - const { - explicitType - } = node; - enumExplicitType(this, "boolean", explicitType); - enumBody(this, node); -} -function EnumNumberBody(node) { - const { - explicitType - } = node; - enumExplicitType(this, "number", explicitType); - enumBody(this, node); -} -function EnumStringBody(node) { - const { - explicitType - } = node; - enumExplicitType(this, "string", explicitType); - enumBody(this, node); -} -function EnumSymbolBody(node) { - enumExplicitType(this, "symbol", true); - enumBody(this, node); -} -function EnumDefaultedMember(node) { - const { - id - } = node; - this.print(id, node); - this.tokenChar(44); -} -function enumInitializedMember(context, node) { - const { - id, - init - } = node; - context.print(id, node); - context.space(); - context.token("="); - context.space(); - context.print(init, node); - context.token(","); -} -function EnumBooleanMember(node) { - enumInitializedMember(this, node); -} -function EnumNumberMember(node) { - enumInitializedMember(this, node); -} -function EnumStringMember(node) { - enumInitializedMember(this, node); -} -function FlowExportDeclaration(node) { - if (node.declaration) { - const declar = node.declaration; - this.print(declar, node); - if (!isStatement(declar)) this.semicolon(); - } else { - this.tokenChar(123); - if (node.specifiers.length) { - this.space(); - this.printList(node.specifiers, node); - this.space(); - } - this.tokenChar(125); - if (node.source) { - this.space(); - this.word("from"); - this.space(); - this.print(node.source, node); - } - this.semicolon(); - } -} -function ExistsTypeAnnotation() { - this.tokenChar(42); -} -function FunctionTypeAnnotation(node, parent) { - this.print(node.typeParameters, node); - this.tokenChar(40); - if (node.this) { - this.word("this"); - this.tokenChar(58); - this.space(); - this.print(node.this.typeAnnotation, node); - if (node.params.length || node.rest) { - this.tokenChar(44); - this.space(); - } - } - this.printList(node.params, node); - if (node.rest) { - if (node.params.length) { - this.tokenChar(44); - this.space(); - } - this.token("..."); - this.print(node.rest, node); - } - this.tokenChar(41); - const type = parent == null ? void 0 : parent.type; - if (type != null && (type === "ObjectTypeCallProperty" || type === "ObjectTypeInternalSlot" || type === "DeclareFunction" || type === "ObjectTypeProperty" && parent.method)) { - this.tokenChar(58); - } else { - this.space(); - this.token("=>"); - } - this.space(); - this.print(node.returnType, node); -} -function FunctionTypeParam(node) { - this.print(node.name, node); - if (node.optional) this.tokenChar(63); - if (node.name) { - this.tokenChar(58); - this.space(); - } - this.print(node.typeAnnotation, node); -} -function InterfaceExtends(node) { - this.print(node.id, node); - this.print(node.typeParameters, node, true); -} -function _interfaceish(node) { - var _node$extends; - this.print(node.id, node); - this.print(node.typeParameters, node); - if ((_node$extends = node.extends) != null && _node$extends.length) { - this.space(); - this.word("extends"); - this.space(); - this.printList(node.extends, node); - } - if (node.type === "DeclareClass") { - var _node$mixins, _node$implements; - if ((_node$mixins = node.mixins) != null && _node$mixins.length) { - this.space(); - this.word("mixins"); - this.space(); - this.printList(node.mixins, node); - } - if ((_node$implements = node.implements) != null && _node$implements.length) { - this.space(); - this.word("implements"); - this.space(); - this.printList(node.implements, node); - } - } - this.space(); - this.print(node.body, node); -} -function _variance(node) { - var _node$variance; - const kind = (_node$variance = node.variance) == null ? void 0 : _node$variance.kind; - if (kind != null) { - if (kind === "plus") { - this.tokenChar(43); - } else if (kind === "minus") { - this.tokenChar(45); - } - } -} -function InterfaceDeclaration(node) { - this.word("interface"); - this.space(); - this._interfaceish(node); -} -function andSeparator() { - this.space(); - this.tokenChar(38); - this.space(); -} -function InterfaceTypeAnnotation(node) { - var _node$extends2; - this.word("interface"); - if ((_node$extends2 = node.extends) != null && _node$extends2.length) { - this.space(); - this.word("extends"); - this.space(); - this.printList(node.extends, node); - } - this.space(); - this.print(node.body, node); -} -function IntersectionTypeAnnotation(node) { - this.printJoin(node.types, node, { - separator: andSeparator - }); -} -function MixedTypeAnnotation() { - this.word("mixed"); -} -function EmptyTypeAnnotation() { - this.word("empty"); -} -function NullableTypeAnnotation(node) { - this.tokenChar(63); - this.print(node.typeAnnotation, node); -} -function NumberTypeAnnotation() { - this.word("number"); -} -function StringTypeAnnotation() { - this.word("string"); -} -function ThisTypeAnnotation() { - this.word("this"); -} -function TupleTypeAnnotation(node) { - this.tokenChar(91); - this.printList(node.types, node); - this.tokenChar(93); -} -function TypeofTypeAnnotation(node) { - this.word("typeof"); - this.space(); - this.print(node.argument, node); -} -function TypeAlias(node) { - this.word("type"); - this.space(); - this.print(node.id, node); - this.print(node.typeParameters, node); - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.right, node); - this.semicolon(); -} -function TypeAnnotation(node) { - this.tokenChar(58); - this.space(); - if (node.optional) this.tokenChar(63); - this.print(node.typeAnnotation, node); -} -function TypeParameterInstantiation(node) { - this.tokenChar(60); - this.printList(node.params, node, {}); - this.tokenChar(62); -} -function TypeParameter(node) { - this._variance(node); - this.word(node.name); - if (node.bound) { - this.print(node.bound, node); - } - if (node.default) { - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.default, node); - } -} -function OpaqueType(node) { - this.word("opaque"); - this.space(); - this.word("type"); - this.space(); - this.print(node.id, node); - this.print(node.typeParameters, node); - if (node.supertype) { - this.tokenChar(58); - this.space(); - this.print(node.supertype, node); - } - if (node.impltype) { - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.impltype, node); - } - this.semicolon(); -} -function ObjectTypeAnnotation(node) { - if (node.exact) { - this.token("{|"); - } else { - this.tokenChar(123); - } - const props = [...node.properties, ...(node.callProperties || []), ...(node.indexers || []), ...(node.internalSlots || [])]; - if (props.length) { - this.newline(); - this.space(); - this.printJoin(props, node, { - addNewlines(leading) { - if (leading && !props[0]) return 1; - }, - indent: true, - statement: true, - iterator: () => { - if (props.length !== 1 || node.inexact) { - this.tokenChar(44); - this.space(); - } - } - }); - this.space(); - } - if (node.inexact) { - this.indent(); - this.token("..."); - if (props.length) { - this.newline(); - } - this.dedent(); - } - if (node.exact) { - this.token("|}"); - } else { - this.tokenChar(125); - } -} -function ObjectTypeInternalSlot(node) { - if (node.static) { - this.word("static"); - this.space(); - } - this.tokenChar(91); - this.tokenChar(91); - this.print(node.id, node); - this.tokenChar(93); - this.tokenChar(93); - if (node.optional) this.tokenChar(63); - if (!node.method) { - this.tokenChar(58); - this.space(); - } - this.print(node.value, node); -} -function ObjectTypeCallProperty(node) { - if (node.static) { - this.word("static"); - this.space(); - } - this.print(node.value, node); -} -function ObjectTypeIndexer(node) { - if (node.static) { - this.word("static"); - this.space(); - } - this._variance(node); - this.tokenChar(91); - if (node.id) { - this.print(node.id, node); - this.tokenChar(58); - this.space(); - } - this.print(node.key, node); - this.tokenChar(93); - this.tokenChar(58); - this.space(); - this.print(node.value, node); -} -function ObjectTypeProperty(node) { - if (node.proto) { - this.word("proto"); - this.space(); - } - if (node.static) { - this.word("static"); - this.space(); - } - if (node.kind === "get" || node.kind === "set") { - this.word(node.kind); - this.space(); - } - this._variance(node); - this.print(node.key, node); - if (node.optional) this.tokenChar(63); - if (!node.method) { - this.tokenChar(58); - this.space(); - } - this.print(node.value, node); -} -function ObjectTypeSpreadProperty(node) { - this.token("..."); - this.print(node.argument, node); -} -function QualifiedTypeIdentifier(node) { - this.print(node.qualification, node); - this.tokenChar(46); - this.print(node.id, node); -} -function SymbolTypeAnnotation() { - this.word("symbol"); -} -function orSeparator() { - this.space(); - this.tokenChar(124); - this.space(); -} -function UnionTypeAnnotation(node) { - this.printJoin(node.types, node, { - separator: orSeparator - }); -} -function TypeCastExpression(node) { - this.tokenChar(40); - this.print(node.expression, node); - this.print(node.typeAnnotation, node); - this.tokenChar(41); -} -function Variance(node) { - if (node.kind === "plus") { - this.tokenChar(43); - } else { - this.tokenChar(45); - } -} -function VoidTypeAnnotation() { - this.word("void"); -} -function IndexedAccessType(node) { - this.print(node.objectType, node, true); - this.tokenChar(91); - this.print(node.indexType, node); - this.tokenChar(93); -} -function OptionalIndexedAccessType(node) { - this.print(node.objectType, node); - if (node.optional) { - this.token("?."); - } - this.tokenChar(91); - this.print(node.indexType, node); - this.tokenChar(93); -} - -//# sourceMappingURL=flow.js.map diff --git a/node_modules/@babel/generator/lib/generators/flow.js.map b/node_modules/@babel/generator/lib/generators/flow.js.map deleted file mode 100644 index e40d5e32a..000000000 --- a/node_modules/@babel/generator/lib/generators/flow.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_t","require","_modules","_types2","isDeclareExportDeclaration","isStatement","AnyTypeAnnotation","word","ArrayTypeAnnotation","node","print","elementType","token","BooleanTypeAnnotation","BooleanLiteralTypeAnnotation","value","NullLiteralTypeAnnotation","DeclareClass","parent","space","_interfaceish","DeclareFunction","id","typeAnnotation","predicate","semicolon","InferredPredicate","DeclaredPredicate","DeclareInterface","InterfaceDeclaration","DeclareModule","body","DeclareModuleExports","DeclareTypeAlias","TypeAlias","DeclareOpaqueType","OpaqueType","DeclareVariable","DeclareExportDeclaration","default","FlowExportDeclaration","call","DeclareExportAllDeclaration","ExportAllDeclaration","EnumDeclaration","enumExplicitType","context","name","hasExplicitType","enumBody","members","indent","newline","member","hasUnknownMembers","dedent","EnumBooleanBody","explicitType","EnumNumberBody","EnumStringBody","EnumSymbolBody","EnumDefaultedMember","enumInitializedMember","init","EnumBooleanMember","EnumNumberMember","EnumStringMember","declaration","declar","specifiers","length","printList","source","ExistsTypeAnnotation","FunctionTypeAnnotation","typeParameters","this","params","rest","type","method","returnType","FunctionTypeParam","optional","InterfaceExtends","_node$extends","extends","_node$mixins","_node$implements","mixins","implements","_variance","_node$variance","kind","variance","andSeparator","InterfaceTypeAnnotation","_node$extends2","IntersectionTypeAnnotation","printJoin","types","separator","MixedTypeAnnotation","EmptyTypeAnnotation","NullableTypeAnnotation","NumberTypeAnnotation","StringTypeAnnotation","ThisTypeAnnotation","TupleTypeAnnotation","TypeofTypeAnnotation","argument","right","TypeAnnotation","TypeParameterInstantiation","TypeParameter","bound","supertype","impltype","ObjectTypeAnnotation","exact","props","properties","callProperties","indexers","internalSlots","addNewlines","leading","statement","iterator","inexact","ObjectTypeInternalSlot","static","ObjectTypeCallProperty","ObjectTypeIndexer","key","ObjectTypeProperty","proto","ObjectTypeSpreadProperty","QualifiedTypeIdentifier","qualification","SymbolTypeAnnotation","orSeparator","UnionTypeAnnotation","TypeCastExpression","expression","Variance","VoidTypeAnnotation","IndexedAccessType","objectType","indexType","OptionalIndexedAccessType"],"sources":["../../src/generators/flow.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport { isDeclareExportDeclaration, isStatement } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { ExportAllDeclaration } from \"./modules\";\n\nexport function AnyTypeAnnotation(this: Printer) {\n this.word(\"any\");\n}\n\nexport function ArrayTypeAnnotation(\n this: Printer,\n node: t.ArrayTypeAnnotation,\n) {\n this.print(node.elementType, node, true);\n this.token(\"[\");\n this.token(\"]\");\n}\n\nexport function BooleanTypeAnnotation(this: Printer) {\n this.word(\"boolean\");\n}\n\nexport function BooleanLiteralTypeAnnotation(\n this: Printer,\n node: t.BooleanLiteralTypeAnnotation,\n) {\n this.word(node.value ? \"true\" : \"false\");\n}\n\nexport function NullLiteralTypeAnnotation(this: Printer) {\n this.word(\"null\");\n}\n\nexport function DeclareClass(\n this: Printer,\n node: t.DeclareClass,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"class\");\n this.space();\n this._interfaceish(node);\n}\n\nexport function DeclareFunction(\n this: Printer,\n node: t.DeclareFunction,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"function\");\n this.space();\n this.print(node.id, node);\n // @ts-ignore(Babel 7 vs Babel 8) TODO(Babel 8) Remove this comment, since we'll remove the Noop node\n this.print(node.id.typeAnnotation.typeAnnotation, node);\n\n if (node.predicate) {\n this.space();\n this.print(node.predicate, node);\n }\n\n this.semicolon();\n}\n\nexport function InferredPredicate(this: Printer) {\n this.token(\"%\");\n this.word(\"checks\");\n}\n\nexport function DeclaredPredicate(this: Printer, node: t.DeclaredPredicate) {\n this.token(\"%\");\n this.word(\"checks\");\n this.token(\"(\");\n this.print(node.value, node);\n this.token(\")\");\n}\n\nexport function DeclareInterface(this: Printer, node: t.DeclareInterface) {\n this.word(\"declare\");\n this.space();\n this.InterfaceDeclaration(node);\n}\n\nexport function DeclareModule(this: Printer, node: t.DeclareModule) {\n this.word(\"declare\");\n this.space();\n this.word(\"module\");\n this.space();\n this.print(node.id, node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function DeclareModuleExports(\n this: Printer,\n node: t.DeclareModuleExports,\n) {\n this.word(\"declare\");\n this.space();\n this.word(\"module\");\n this.token(\".\");\n this.word(\"exports\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function DeclareTypeAlias(this: Printer, node: t.DeclareTypeAlias) {\n this.word(\"declare\");\n this.space();\n this.TypeAlias(node);\n}\n\nexport function DeclareOpaqueType(\n this: Printer,\n node: t.DeclareOpaqueType,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.OpaqueType(node);\n}\n\nexport function DeclareVariable(\n this: Printer,\n node: t.DeclareVariable,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"var\");\n this.space();\n this.print(node.id, node);\n this.print(node.id.typeAnnotation, node);\n this.semicolon();\n}\n\nexport function DeclareExportDeclaration(\n this: Printer,\n node: t.DeclareExportDeclaration,\n) {\n this.word(\"declare\");\n this.space();\n this.word(\"export\");\n this.space();\n if (node.default) {\n this.word(\"default\");\n this.space();\n }\n\n FlowExportDeclaration.call(this, node);\n}\n\nexport function DeclareExportAllDeclaration(\n this: Printer,\n node: t.DeclareExportAllDeclaration,\n) {\n this.word(\"declare\");\n this.space();\n ExportAllDeclaration.call(this, node);\n}\n\nexport function EnumDeclaration(this: Printer, node: t.EnumDeclaration) {\n const { id, body } = node;\n this.word(\"enum\");\n this.space();\n this.print(id, node);\n this.print(body, node);\n}\n\nfunction enumExplicitType(\n context: Printer,\n name: string,\n hasExplicitType: boolean,\n) {\n if (hasExplicitType) {\n context.space();\n context.word(\"of\");\n context.space();\n context.word(name);\n }\n context.space();\n}\n\nfunction enumBody(context: Printer, node: t.EnumBody) {\n const { members } = node;\n context.token(\"{\");\n context.indent();\n context.newline();\n for (const member of members) {\n context.print(member, node);\n context.newline();\n }\n if (node.hasUnknownMembers) {\n context.token(\"...\");\n context.newline();\n }\n context.dedent();\n context.token(\"}\");\n}\n\nexport function EnumBooleanBody(this: Printer, node: t.EnumBooleanBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"boolean\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumNumberBody(this: Printer, node: t.EnumNumberBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"number\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumStringBody(this: Printer, node: t.EnumStringBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"string\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumSymbolBody(this: Printer, node: t.EnumSymbolBody) {\n enumExplicitType(this, \"symbol\", true);\n enumBody(this, node);\n}\n\nexport function EnumDefaultedMember(\n this: Printer,\n node: t.EnumDefaultedMember,\n) {\n const { id } = node;\n this.print(id, node);\n this.token(\",\");\n}\n\nfunction enumInitializedMember(\n context: Printer,\n node: t.EnumBooleanMember | t.EnumNumberMember | t.EnumStringMember,\n) {\n const { id, init } = node;\n context.print(id, node);\n context.space();\n context.token(\"=\");\n context.space();\n context.print(init, node);\n context.token(\",\");\n}\n\nexport function EnumBooleanMember(this: Printer, node: t.EnumBooleanMember) {\n enumInitializedMember(this, node);\n}\n\nexport function EnumNumberMember(this: Printer, node: t.EnumNumberMember) {\n enumInitializedMember(this, node);\n}\n\nexport function EnumStringMember(this: Printer, node: t.EnumStringMember) {\n enumInitializedMember(this, node);\n}\n\nfunction FlowExportDeclaration(\n this: Printer,\n node: t.DeclareExportDeclaration,\n) {\n if (node.declaration) {\n const declar = node.declaration;\n this.print(declar, node);\n if (!isStatement(declar)) this.semicolon();\n } else {\n this.token(\"{\");\n if (node.specifiers.length) {\n this.space();\n this.printList(node.specifiers, node);\n this.space();\n }\n this.token(\"}\");\n\n if (node.source) {\n this.space();\n this.word(\"from\");\n this.space();\n this.print(node.source, node);\n }\n\n this.semicolon();\n }\n}\n\nexport function ExistsTypeAnnotation(this: Printer) {\n this.token(\"*\");\n}\n\nexport function FunctionTypeAnnotation(\n this: Printer,\n node: t.FunctionTypeAnnotation,\n parent?: t.Node,\n) {\n this.print(node.typeParameters, node);\n this.token(\"(\");\n\n if (node.this) {\n this.word(\"this\");\n this.token(\":\");\n this.space();\n this.print(node.this.typeAnnotation, node);\n if (node.params.length || node.rest) {\n this.token(\",\");\n this.space();\n }\n }\n\n this.printList(node.params, node);\n\n if (node.rest) {\n if (node.params.length) {\n this.token(\",\");\n this.space();\n }\n this.token(\"...\");\n this.print(node.rest, node);\n }\n\n this.token(\")\");\n\n // this node type is overloaded, not sure why but it makes it EXTREMELY annoying\n\n const type = parent?.type;\n if (\n type != null &&\n (type === \"ObjectTypeCallProperty\" ||\n type === \"ObjectTypeInternalSlot\" ||\n type === \"DeclareFunction\" ||\n (type === \"ObjectTypeProperty\" && parent.method))\n ) {\n this.token(\":\");\n } else {\n this.space();\n this.token(\"=>\");\n }\n\n this.space();\n this.print(node.returnType, node);\n}\n\nexport function FunctionTypeParam(this: Printer, node: t.FunctionTypeParam) {\n this.print(node.name, node);\n if (node.optional) this.token(\"?\");\n if (node.name) {\n this.token(\":\");\n this.space();\n }\n this.print(node.typeAnnotation, node);\n}\n\nexport function InterfaceExtends(this: Printer, node: t.InterfaceExtends) {\n this.print(node.id, node);\n this.print(node.typeParameters, node, true);\n}\n\nexport {\n InterfaceExtends as ClassImplements,\n InterfaceExtends as GenericTypeAnnotation,\n};\n\nexport function _interfaceish(\n this: Printer,\n node: t.InterfaceDeclaration | t.DeclareInterface | t.DeclareClass,\n) {\n this.print(node.id, node);\n this.print(node.typeParameters, node);\n if (node.extends?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(node.extends, node);\n }\n if (node.type === \"DeclareClass\") {\n if (node.mixins?.length) {\n this.space();\n this.word(\"mixins\");\n this.space();\n this.printList(node.mixins, node);\n }\n if (node.implements?.length) {\n this.space();\n this.word(\"implements\");\n this.space();\n this.printList(node.implements, node);\n }\n }\n this.space();\n this.print(node.body, node);\n}\n\nexport function _variance(\n this: Printer,\n node:\n | t.TypeParameter\n | t.ObjectTypeIndexer\n | t.ObjectTypeProperty\n | t.ClassProperty\n | t.ClassPrivateProperty\n | t.ClassAccessorProperty,\n) {\n const kind = node.variance?.kind;\n if (kind != null) {\n if (kind === \"plus\") {\n this.token(\"+\");\n } else if (kind === \"minus\") {\n this.token(\"-\");\n }\n }\n}\n\nexport function InterfaceDeclaration(\n this: Printer,\n node: t.InterfaceDeclaration | t.DeclareInterface,\n) {\n this.word(\"interface\");\n this.space();\n this._interfaceish(node);\n}\n\nfunction andSeparator(this: Printer) {\n this.space();\n this.token(\"&\");\n this.space();\n}\n\nexport function InterfaceTypeAnnotation(\n this: Printer,\n node: t.InterfaceTypeAnnotation,\n) {\n this.word(\"interface\");\n if (node.extends?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(node.extends, node);\n }\n this.space();\n this.print(node.body, node);\n}\n\nexport function IntersectionTypeAnnotation(\n this: Printer,\n node: t.IntersectionTypeAnnotation,\n) {\n this.printJoin(node.types, node, { separator: andSeparator });\n}\n\nexport function MixedTypeAnnotation(this: Printer) {\n this.word(\"mixed\");\n}\n\nexport function EmptyTypeAnnotation(this: Printer) {\n this.word(\"empty\");\n}\n\nexport function NullableTypeAnnotation(\n this: Printer,\n node: t.NullableTypeAnnotation,\n) {\n this.token(\"?\");\n this.print(node.typeAnnotation, node);\n}\n\nexport {\n NumericLiteral as NumberLiteralTypeAnnotation,\n StringLiteral as StringLiteralTypeAnnotation,\n} from \"./types\";\n\nexport function NumberTypeAnnotation(this: Printer) {\n this.word(\"number\");\n}\n\nexport function StringTypeAnnotation(this: Printer) {\n this.word(\"string\");\n}\n\nexport function ThisTypeAnnotation(this: Printer) {\n this.word(\"this\");\n}\n\nexport function TupleTypeAnnotation(\n this: Printer,\n node: t.TupleTypeAnnotation,\n) {\n this.token(\"[\");\n this.printList(node.types, node);\n this.token(\"]\");\n}\n\nexport function TypeofTypeAnnotation(\n this: Printer,\n node: t.TypeofTypeAnnotation,\n) {\n this.word(\"typeof\");\n this.space();\n this.print(node.argument, node);\n}\n\nexport function TypeAlias(\n this: Printer,\n node: t.TypeAlias | t.DeclareTypeAlias,\n) {\n this.word(\"type\");\n this.space();\n this.print(node.id, node);\n this.print(node.typeParameters, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.right, node);\n this.semicolon();\n}\n\nexport function TypeAnnotation(this: Printer, node: t.TypeAnnotation) {\n this.token(\":\");\n this.space();\n // @ts-expect-error todo(flow->ts) can this be removed? `.optional` looks to be not existing property\n if (node.optional) this.token(\"?\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function TypeParameterInstantiation(\n this: Printer,\n node: t.TypeParameterInstantiation,\n): void {\n this.token(\"<\");\n this.printList(node.params, node, {});\n this.token(\">\");\n}\n\nexport { TypeParameterInstantiation as TypeParameterDeclaration };\n\nexport function TypeParameter(this: Printer, node: t.TypeParameter) {\n this._variance(node);\n\n this.word(node.name);\n\n if (node.bound) {\n this.print(node.bound, node);\n }\n\n if (node.default) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.default, node);\n }\n}\n\nexport function OpaqueType(\n this: Printer,\n node: t.OpaqueType | t.DeclareOpaqueType,\n) {\n this.word(\"opaque\");\n this.space();\n this.word(\"type\");\n this.space();\n this.print(node.id, node);\n this.print(node.typeParameters, node);\n if (node.supertype) {\n this.token(\":\");\n this.space();\n this.print(node.supertype, node);\n }\n\n if (node.impltype) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.impltype, node);\n }\n this.semicolon();\n}\n\nexport function ObjectTypeAnnotation(\n this: Printer,\n node: t.ObjectTypeAnnotation,\n) {\n if (node.exact) {\n this.token(\"{|\");\n } else {\n this.token(\"{\");\n }\n\n // TODO: remove the array fallbacks and instead enforce the types to require an array\n const props = [\n ...node.properties,\n ...(node.callProperties || []),\n ...(node.indexers || []),\n ...(node.internalSlots || []),\n ];\n\n if (props.length) {\n this.newline();\n\n this.space();\n\n this.printJoin(props, node, {\n addNewlines(leading) {\n if (leading && !props[0]) return 1;\n },\n indent: true,\n statement: true,\n iterator: () => {\n if (props.length !== 1 || node.inexact) {\n this.token(\",\");\n this.space();\n }\n },\n });\n\n this.space();\n }\n\n if (node.inexact) {\n this.indent();\n this.token(\"...\");\n if (props.length) {\n this.newline();\n }\n this.dedent();\n }\n\n if (node.exact) {\n this.token(\"|}\");\n } else {\n this.token(\"}\");\n }\n}\n\nexport function ObjectTypeInternalSlot(\n this: Printer,\n node: t.ObjectTypeInternalSlot,\n) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.token(\"[\");\n this.token(\"[\");\n this.print(node.id, node);\n this.token(\"]\");\n this.token(\"]\");\n if (node.optional) this.token(\"?\");\n if (!node.method) {\n this.token(\":\");\n this.space();\n }\n this.print(node.value, node);\n}\n\nexport function ObjectTypeCallProperty(\n this: Printer,\n node: t.ObjectTypeCallProperty,\n) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.print(node.value, node);\n}\n\nexport function ObjectTypeIndexer(this: Printer, node: t.ObjectTypeIndexer) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this._variance(node);\n this.token(\"[\");\n if (node.id) {\n this.print(node.id, node);\n this.token(\":\");\n this.space();\n }\n this.print(node.key, node);\n this.token(\"]\");\n this.token(\":\");\n this.space();\n this.print(node.value, node);\n}\n\nexport function ObjectTypeProperty(this: Printer, node: t.ObjectTypeProperty) {\n if (node.proto) {\n this.word(\"proto\");\n this.space();\n }\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n if (node.kind === \"get\" || node.kind === \"set\") {\n this.word(node.kind);\n this.space();\n }\n this._variance(node);\n this.print(node.key, node);\n if (node.optional) this.token(\"?\");\n if (!node.method) {\n this.token(\":\");\n this.space();\n }\n this.print(node.value, node);\n}\n\nexport function ObjectTypeSpreadProperty(\n this: Printer,\n node: t.ObjectTypeSpreadProperty,\n) {\n this.token(\"...\");\n this.print(node.argument, node);\n}\n\nexport function QualifiedTypeIdentifier(\n this: Printer,\n node: t.QualifiedTypeIdentifier,\n) {\n this.print(node.qualification, node);\n this.token(\".\");\n this.print(node.id, node);\n}\n\nexport function SymbolTypeAnnotation(this: Printer) {\n this.word(\"symbol\");\n}\n\nfunction orSeparator(this: Printer) {\n this.space();\n this.token(\"|\");\n this.space();\n}\n\nexport function UnionTypeAnnotation(\n this: Printer,\n node: t.UnionTypeAnnotation,\n) {\n this.printJoin(node.types, node, { separator: orSeparator });\n}\n\nexport function TypeCastExpression(this: Printer, node: t.TypeCastExpression) {\n this.token(\"(\");\n this.print(node.expression, node);\n this.print(node.typeAnnotation, node);\n this.token(\")\");\n}\n\nexport function Variance(this: Printer, node: t.Variance) {\n if (node.kind === \"plus\") {\n this.token(\"+\");\n } else {\n this.token(\"-\");\n }\n}\n\nexport function VoidTypeAnnotation(this: Printer) {\n this.word(\"void\");\n}\n\nexport function IndexedAccessType(this: Printer, node: t.IndexedAccessType) {\n this.print(node.objectType, node, true);\n this.token(\"[\");\n this.print(node.indexType, node);\n this.token(\"]\");\n}\n\nexport function OptionalIndexedAccessType(\n this: Printer,\n node: t.OptionalIndexedAccessType,\n) {\n this.print(node.objectType, node);\n if (node.optional) {\n this.token(\"?.\");\n }\n this.token(\"[\");\n this.print(node.indexType, node);\n this.token(\"]\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAsdA,IAAAE,OAAA,GAAAF,OAAA;AAGiB;EA3dRG,0BAA0B;EAAEC;AAAW,IAAAL,EAAA;AAIzC,SAASM,iBAAiBA,CAAA,EAAgB;EAC/C,IAAI,CAACC,IAAI,CAAC,KAAK,CAAC;AAClB;AAEO,SAASC,mBAAmBA,CAEjCC,IAA2B,EAC3B;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,WAAW,EAAEF,IAAI,EAAE,IAAI,CAAC;EACxC,IAAI,CAACG,SAAK,IAAK;EACf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I,IAAgB,EAAE;EACxD,IAAIA,IAAI,CAACoF,IAAI,KAAK,MAAM,EAAE;IACxB,IAAI,CAACjF,SAAK,IAAK;EACjB,CAAC,MAAM;IACL,IAAI,CAACA,SAAK,IAAK;EACjB;AACF;AAEO,SAASsI,kBAAkBA,CAAA,EAAgB;EAChD,IAAI,CAAC3I,IAAI,CAAC,MAAM,CAAC;AACnB;AAEO,SAAS4I,iBAAiBA,CAAgB1I,IAAyB,EAAE;EAC1E,IAAI,CAACC,KAAK,CAACD,IAAI,CAAC2I,UAAU,EAAE3I,IAAI,EAAE,IAAI,CAAC;EACvC,IAAI,CAACG,SAAK,IAAK;EACf,IAAI,CAACF,KAAK,CAACD,IAAI,CAAC4I,SAAS,EAAE5I,IAAI,CAAC;EAChC,IAAI,CAACG,SAAK,IAAK;AACjB;AAEO,SAAS0I,yBAAyBA,CAEvC7I,IAAiC,EACjC;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAAC2I,UAAU,EAAE3I,IAAI,CAAC;EACjC,IAAIA,IAAI,CAAC0E,QAAQ,EAAE;IACjB,IAAI,CAACvE,KAAK,CAAC,IAAI,CAAC;EAClB;EACA,IAAI,CAACA,SAAK,IAAK;EACf,IAAI,CAACF,KAAK,CAACD,IAAI,CAAC4I,SAAS,EAAE5I,IAAI,CAAC;EAChC,IAAI,CAACG,SAAK,IAAK;AACjB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/index.js b/node_modules/@babel/generator/lib/generators/index.js deleted file mode 100644 index 25ad36b14..000000000 --- a/node_modules/@babel/generator/lib/generators/index.js +++ /dev/null @@ -1,128 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var _templateLiterals = require("./template-literals"); -Object.keys(_templateLiterals).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _templateLiterals[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _templateLiterals[key]; - } - }); -}); -var _expressions = require("./expressions"); -Object.keys(_expressions).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _expressions[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _expressions[key]; - } - }); -}); -var _statements = require("./statements"); -Object.keys(_statements).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _statements[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _statements[key]; - } - }); -}); -var _classes = require("./classes"); -Object.keys(_classes).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _classes[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _classes[key]; - } - }); -}); -var _methods = require("./methods"); -Object.keys(_methods).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _methods[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _methods[key]; - } - }); -}); -var _modules = require("./modules"); -Object.keys(_modules).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _modules[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _modules[key]; - } - }); -}); -var _types = require("./types"); -Object.keys(_types).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _types[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _types[key]; - } - }); -}); -var _flow = require("./flow"); -Object.keys(_flow).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _flow[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _flow[key]; - } - }); -}); -var _base = require("./base"); -Object.keys(_base).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _base[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _base[key]; - } - }); -}); -var _jsx = require("./jsx"); -Object.keys(_jsx).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _jsx[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _jsx[key]; - } - }); -}); -var _typescript = require("./typescript"); -Object.keys(_typescript).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _typescript[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _typescript[key]; - } - }); -}); - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/generator/lib/generators/index.js.map b/node_modules/@babel/generator/lib/generators/index.js.map deleted file mode 100644 index 3592c3137..000000000 --- a/node_modules/@babel/generator/lib/generators/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_templateLiterals","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_expressions","_statements","_classes","_methods","_modules","_types","_flow","_base","_jsx","_typescript"],"sources":["../../src/generators/index.ts"],"sourcesContent":["export * from \"./template-literals\";\nexport * from \"./expressions\";\nexport * from \"./statements\";\nexport * from \"./classes\";\nexport * from \"./methods\";\nexport * from \"./modules\";\nexport * from \"./types\";\nexport * from \"./flow\";\nexport * from \"./base\";\nexport * from \"./jsx\";\nexport * from \"./typescript\";\n"],"mappings":";;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,iBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,iBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,iBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EA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AAAb,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAY,KAAA,CAAAZ,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAQ,KAAA,CAAAZ,GAAA;IAAA;EAAA;AAAA;AACA,IAAAa,IAAA,GAAAjB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAe,IAAA,EAAAd,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAa,IAAA,CAAAb,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAS,IAAA,CAAAb,GAAA;IAAA;EAAA;AAAA;AACA,IAAAc,WAAA,GAAAlB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAgB,WAAA,EAAAf,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAc,WAAA,CAAAd,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAU,WAAA,CAAAd,GAAA;IAAA;EAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/jsx.js b/node_modules/@babel/generator/lib/generators/jsx.js deleted file mode 100644 index 4b8dd7a76..000000000 --- a/node_modules/@babel/generator/lib/generators/jsx.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.JSXAttribute = JSXAttribute; -exports.JSXClosingElement = JSXClosingElement; -exports.JSXClosingFragment = JSXClosingFragment; -exports.JSXElement = JSXElement; -exports.JSXEmptyExpression = JSXEmptyExpression; -exports.JSXExpressionContainer = JSXExpressionContainer; -exports.JSXFragment = JSXFragment; -exports.JSXIdentifier = JSXIdentifier; -exports.JSXMemberExpression = JSXMemberExpression; -exports.JSXNamespacedName = JSXNamespacedName; -exports.JSXOpeningElement = JSXOpeningElement; -exports.JSXOpeningFragment = JSXOpeningFragment; -exports.JSXSpreadAttribute = JSXSpreadAttribute; -exports.JSXSpreadChild = JSXSpreadChild; -exports.JSXText = JSXText; -function JSXAttribute(node) { - this.print(node.name, node); - if (node.value) { - this.tokenChar(61); - this.print(node.value, node); - } -} -function JSXIdentifier(node) { - this.word(node.name); -} -function JSXNamespacedName(node) { - this.print(node.namespace, node); - this.tokenChar(58); - this.print(node.name, node); -} -function JSXMemberExpression(node) { - this.print(node.object, node); - this.tokenChar(46); - this.print(node.property, node); -} -function JSXSpreadAttribute(node) { - this.tokenChar(123); - this.token("..."); - this.print(node.argument, node); - this.tokenChar(125); -} -function JSXExpressionContainer(node) { - this.tokenChar(123); - this.print(node.expression, node); - this.tokenChar(125); -} -function JSXSpreadChild(node) { - this.tokenChar(123); - this.token("..."); - this.print(node.expression, node); - this.tokenChar(125); -} -function JSXText(node) { - const raw = this.getPossibleRaw(node); - if (raw !== undefined) { - this.token(raw, true); - } else { - this.token(node.value, true); - } -} -function JSXElement(node) { - const open = node.openingElement; - this.print(open, node); - if (open.selfClosing) return; - this.indent(); - for (const child of node.children) { - this.print(child, node); - } - this.dedent(); - this.print(node.closingElement, node); -} -function spaceSeparator() { - this.space(); -} -function JSXOpeningElement(node) { - this.tokenChar(60); - this.print(node.name, node); - this.print(node.typeParameters, node); - if (node.attributes.length > 0) { - this.space(); - this.printJoin(node.attributes, node, { - separator: spaceSeparator - }); - } - if (node.selfClosing) { - this.space(); - this.token("/>"); - } else { - this.tokenChar(62); - } -} -function JSXClosingElement(node) { - this.token(" 0) {\n this.space();\n this.printJoin(node.attributes, node, { separator: spaceSeparator });\n }\n if (node.selfClosing) {\n this.space();\n this.token(\"/>\");\n } else {\n this.token(\">\");\n }\n}\n\nexport function JSXClosingElement(this: Printer, node: t.JSXClosingElement) {\n this.token(\"\");\n}\n\nexport function JSXEmptyExpression(this: Printer) {\n // This node is empty, so forcefully print its inner comments.\n this.printInnerComments();\n}\n\nexport function JSXFragment(this: Printer, node: t.JSXFragment) {\n this.print(node.openingFragment, node);\n\n this.indent();\n for (const child of node.children) {\n this.print(child, node);\n }\n this.dedent();\n\n this.print(node.closingFragment, node);\n}\n\nexport function JSXOpeningFragment(this: Printer) {\n this.token(\"<\");\n this.token(\">\");\n}\n\nexport function JSXClosingFragment(this: Printer) {\n this.token(\"\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAGO,SAASA,YAAYA,CAAgBC,IAAoB,EAAE;EAChE,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,IAAI,EAAEF,IAAI,CAAC;EAC3B,IAAIA,IAAI,CAACG,KAAK,EAAE;IACd,IAAI,CAACC,SAAK,IAAK;IACf,IAAI,CAACH,KAAK,CAACD,IAAI,CAACG,KAAK,EAAEH,IAAI,CAAC;EAC9B;AACF;AAEO,SAASK,aAAaA,CAAgBL,IAAqB,EAAE;EAClE,IAAI,CAACM,IAAI,CAACN,IAAI,CAACE,IAAI,CAAC;AACtB;AAEO,SAASK,iBAAiBA,CAAgBP,IAAyB,EAAE;EAC1E,IAAI,CAACC,KAAK,CAACD,IAAI,CAACQ,SAAS,EAAER,IAAI,CAAC;EAChC,IAAI,CAACI,SAAK,IAAK;EACf,IAAI,CAACH,KAAK,CAACD,IAAI,CAACE,IAAI,EAAEF,IAAI,CAAC;AAC7B;AAEO,SAASS,mBAAmBA,CAEjCT,IAA2B,EAC3B;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACU,MAAM,EAAEV,IAAI,CAAC;EAC7B,I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AK,CAACD,IAAI,CAAC0C,eAAe,EAAE1C,IAAI,CAAC;EAEtC,IAAI,CAACyB,MAAM,EAAE;EACb,KAAK,MAAMC,KAAK,IAAI1B,IAAI,CAAC2B,QAAQ,EAAE;IACjC,IAAI,CAAC1B,KAAK,CAACyB,KAAK,EAAE1B,IAAI,CAAC;EACzB;EACA,IAAI,CAAC4B,MAAM,EAAE;EAEb,IAAI,CAAC3B,KAAK,CAACD,IAAI,CAAC2C,eAAe,EAAE3C,IAAI,CAAC;AACxC;AAEO,SAAS4C,kBAAkBA,CAAA,EAAgB;EAChD,IAAI,CAACxC,SAAK,IAAK;EACf,IAAI,CAACA,SAAK,IAAK;AACjB;AAEO,SAASyC,kBAAkBA,CAAA,EAAgB;EAChD,IAAI,CAACzC,KAAK,CAAC,IAAI,CAAC;EAChB,IAAI,CAACA,SAAK,IAAK;AACjB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/methods.js b/node_modules/@babel/generator/lib/generators/methods.js deleted file mode 100644 index b91cee2bf..000000000 --- a/node_modules/@babel/generator/lib/generators/methods.js +++ /dev/null @@ -1,173 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ArrowFunctionExpression = ArrowFunctionExpression; -exports.FunctionDeclaration = exports.FunctionExpression = FunctionExpression; -exports._functionHead = _functionHead; -exports._methodHead = _methodHead; -exports._param = _param; -exports._parameters = _parameters; -exports._params = _params; -exports._predicate = _predicate; -var _t = require("@babel/types"); -const { - isIdentifier -} = _t; -function _params(node, idNode, parentNode) { - this.print(node.typeParameters, node); - const nameInfo = _getFuncIdName.call(this, idNode, parentNode); - if (nameInfo) { - this.sourceIdentifierName(nameInfo.name, nameInfo.pos); - } - this.tokenChar(40); - this._parameters(node.params, node); - this.tokenChar(41); - const noLineTerminator = node.type === "ArrowFunctionExpression"; - this.print(node.returnType, node, noLineTerminator); - this._noLineTerminator = noLineTerminator; -} -function _parameters(parameters, parent) { - const paramLength = parameters.length; - for (let i = 0; i < paramLength; i++) { - this._param(parameters[i], parent); - if (i < parameters.length - 1) { - this.tokenChar(44); - this.space(); - } - } -} -function _param(parameter, parent) { - this.printJoin(parameter.decorators, parameter); - this.print(parameter, parent); - if (parameter.optional) { - this.tokenChar(63); - } - this.print(parameter.typeAnnotation, parameter); -} -function _methodHead(node) { - const kind = node.kind; - const key = node.key; - if (kind === "get" || kind === "set") { - this.word(kind); - this.space(); - } - if (node.async) { - this.word("async", true); - this.space(); - } - if (kind === "method" || kind === "init") { - if (node.generator) { - this.tokenChar(42); - } - } - if (node.computed) { - this.tokenChar(91); - this.print(key, node); - this.tokenChar(93); - } else { - this.print(key, node); - } - if (node.optional) { - this.tokenChar(63); - } - this._params(node, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key, undefined); -} -function _predicate(node, noLineTerminatorAfter) { - if (node.predicate) { - if (!node.returnType) { - this.tokenChar(58); - } - this.space(); - this.print(node.predicate, node, noLineTerminatorAfter); - } -} -function _functionHead(node, parent) { - if (node.async) { - this.word("async"); - this._endsWithInnerRaw = false; - this.space(); - } - this.word("function"); - if (node.generator) { - this._endsWithInnerRaw = false; - this.tokenChar(42); - } - this.space(); - if (node.id) { - this.print(node.id, node); - } - this._params(node, node.id, parent); - if (node.type !== "TSDeclareFunction") { - this._predicate(node); - } -} -function FunctionExpression(node, parent) { - this._functionHead(node, parent); - this.space(); - this.print(node.body, node); -} -function ArrowFunctionExpression(node, parent) { - if (node.async) { - this.word("async", true); - this.space(); - } - let firstParam; - if (!this.format.retainLines && node.params.length === 1 && isIdentifier(firstParam = node.params[0]) && !hasTypesOrComments(node, firstParam)) { - this.print(firstParam, node, true); - } else { - this._params(node, undefined, parent); - } - this._predicate(node, true); - this.space(); - this.printInnerComments(); - this.token("=>"); - this.space(); - this.print(node.body, node); -} -function hasTypesOrComments(node, param) { - var _param$leadingComment, _param$trailingCommen; - return !!(node.typeParameters || node.returnType || node.predicate || param.typeAnnotation || param.optional || (_param$leadingComment = param.leadingComments) != null && _param$leadingComment.length || (_param$trailingCommen = param.trailingComments) != null && _param$trailingCommen.length); -} -function _getFuncIdName(idNode, parent) { - let id = idNode; - if (!id && parent) { - const parentType = parent.type; - if (parentType === "VariableDeclarator") { - id = parent.id; - } else if (parentType === "AssignmentExpression" || parentType === "AssignmentPattern") { - id = parent.left; - } else if (parentType === "ObjectProperty" || parentType === "ClassProperty") { - if (!parent.computed || parent.key.type === "StringLiteral") { - id = parent.key; - } - } else if (parentType === "ClassPrivateProperty" || parentType === "ClassAccessorProperty") { - id = parent.key; - } - } - if (!id) return; - let nameInfo; - if (id.type === "Identifier") { - var _id$loc, _id$loc2; - nameInfo = { - pos: (_id$loc = id.loc) == null ? void 0 : _id$loc.start, - name: ((_id$loc2 = id.loc) == null ? void 0 : _id$loc2.identifierName) || id.name - }; - } else if (id.type === "PrivateName") { - var _id$loc3; - nameInfo = { - pos: (_id$loc3 = id.loc) == null ? void 0 : _id$loc3.start, - name: "#" + id.id.name - }; - } else if (id.type === "StringLiteral") { - var _id$loc4; - nameInfo = { - pos: (_id$loc4 = id.loc) == null ? void 0 : _id$loc4.start, - name: id.value - }; - } - return nameInfo; -} - -//# sourceMappingURL=methods.js.map diff --git a/node_modules/@babel/generator/lib/generators/methods.js.map b/node_modules/@babel/generator/lib/generators/methods.js.map deleted file mode 100644 index f06bc77f1..000000000 --- a/node_modules/@babel/generator/lib/generators/methods.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_t","require","isIdentifier","_params","node","idNode","parentNode","print","typeParameters","nameInfo","_getFuncIdName","call","sourceIdentifierName","name","pos","token","_parameters","params","noLineTerminator","type","returnType","_noLineTerminator","parameters","parent","paramLength","length","i","_param","space","parameter","printJoin","decorators","optional","typeAnnotation","_methodHead","kind","key","word","async","generator","computed","undefined","_predicate","noLineTerminatorAfter","predicate","_functionHead","_endsWithInnerRaw","id","FunctionExpression","body","ArrowFunctionExpression","firstParam","format","retainLines","hasTypesOrComments","printInnerComments","param","_param$leadingComment","_param$trailingCommen","leadingComments","trailingComments","parentType","left","_id$loc","_id$loc2","loc","start","identifierName","_id$loc3","_id$loc4","value"],"sources":["../../src/generators/methods.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\nimport { isIdentifier } from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\nexport function _params(\n this: Printer,\n node: t.Function | t.TSDeclareMethod | t.TSDeclareFunction,\n idNode: t.Expression | t.PrivateName,\n parentNode: NodePath<\n t.Function | t.TSDeclareMethod | t.TSDeclareFunction\n >[\"parent\"],\n) {\n this.print(node.typeParameters, node);\n\n const nameInfo = _getFuncIdName.call(this, idNode, parentNode);\n if (nameInfo) {\n this.sourceIdentifierName(nameInfo.name, nameInfo.pos);\n }\n\n this.token(\"(\");\n this._parameters(node.params, node);\n this.token(\")\");\n\n const noLineTerminator = node.type === \"ArrowFunctionExpression\";\n this.print(node.returnType, node, noLineTerminator);\n\n this._noLineTerminator = noLineTerminator;\n}\n\nexport function _parameters(\n this: Printer,\n parameters: t.Function[\"params\"],\n parent:\n | t.Function\n | t.TSIndexSignature\n | t.TSDeclareMethod\n | t.TSDeclareFunction\n | t.TSFunctionType\n | t.TSConstructorType,\n) {\n const paramLength = parameters.length;\n for (let i = 0; i < paramLength; i++) {\n this._param(parameters[i], parent);\n\n if (i < parameters.length - 1) {\n this.token(\",\");\n this.space();\n }\n }\n}\n\nexport function _param(\n this: Printer,\n parameter: t.Identifier | t.RestElement | t.Pattern | t.TSParameterProperty,\n parent?:\n | t.Function\n | t.TSIndexSignature\n | t.TSDeclareMethod\n | t.TSDeclareFunction\n | t.TSFunctionType\n | t.TSConstructorType,\n) {\n this.printJoin(parameter.decorators, parameter);\n this.print(parameter, parent);\n if (\n // @ts-expect-error optional is not in TSParameterProperty\n parameter.optional\n ) {\n this.token(\"?\"); // TS / flow\n }\n\n this.print(\n // @ts-expect-error typeAnnotation is not in TSParameterProperty\n parameter.typeAnnotation,\n parameter,\n ); // TS / flow\n}\n\nexport function _methodHead(this: Printer, node: t.Method | t.TSDeclareMethod) {\n const kind = node.kind;\n const key = node.key;\n\n if (kind === \"get\" || kind === \"set\") {\n this.word(kind);\n this.space();\n }\n\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n\n if (\n kind === \"method\" ||\n // @ts-expect-error Fixme: kind: \"init\" is not defined\n kind === \"init\"\n ) {\n if (node.generator) {\n this.token(\"*\");\n }\n }\n\n if (node.computed) {\n this.token(\"[\");\n this.print(key, node);\n this.token(\"]\");\n } else {\n this.print(key, node);\n }\n\n if (\n // @ts-expect-error optional is not in ObjectMethod\n node.optional\n ) {\n // TS\n this.token(\"?\");\n }\n\n this._params(\n node,\n node.computed && node.key.type !== \"StringLiteral\" ? undefined : node.key,\n undefined,\n );\n}\n\nexport function _predicate(\n this: Printer,\n node:\n | t.FunctionDeclaration\n | t.FunctionExpression\n | t.ArrowFunctionExpression,\n noLineTerminatorAfter?: boolean,\n) {\n if (node.predicate) {\n if (!node.returnType) {\n this.token(\":\");\n }\n this.space();\n this.print(node.predicate, node, noLineTerminatorAfter);\n }\n}\n\nexport function _functionHead(\n this: Printer,\n node: t.FunctionDeclaration | t.FunctionExpression | t.TSDeclareFunction,\n parent: NodePath<\n t.FunctionDeclaration | t.FunctionExpression | t.TSDeclareFunction\n >[\"parent\"],\n) {\n if (node.async) {\n this.word(\"async\");\n // We prevent inner comments from being printed here,\n // so that they are always consistently printed in the\n // same place regardless of the function type.\n this._endsWithInnerRaw = false;\n this.space();\n }\n this.word(\"function\");\n if (node.generator) {\n // We prevent inner comments from being printed here,\n // so that they are always consistently printed in the\n // same place regardless of the function type.\n this._endsWithInnerRaw = false;\n this.token(\"*\");\n }\n\n this.space();\n if (node.id) {\n this.print(node.id, node);\n }\n\n this._params(node, node.id, parent);\n if (node.type !== \"TSDeclareFunction\") {\n this._predicate(node);\n }\n}\n\nexport function FunctionExpression(\n this: Printer,\n node: t.FunctionExpression,\n parent: NodePath[\"parent\"],\n) {\n this._functionHead(node, parent);\n this.space();\n this.print(node.body, node);\n}\n\nexport { FunctionExpression as FunctionDeclaration };\n\nexport function ArrowFunctionExpression(\n this: Printer,\n node: t.ArrowFunctionExpression,\n parent: NodePath[\"parent\"],\n) {\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n\n // Try to avoid printing parens in simple cases, but only if we're pretty\n // sure that they aren't needed by type annotations or potential newlines.\n let firstParam;\n if (\n !this.format.retainLines &&\n node.params.length === 1 &&\n isIdentifier((firstParam = node.params[0])) &&\n !hasTypesOrComments(node, firstParam)\n ) {\n this.print(firstParam, node, true);\n } else {\n this._params(node, undefined, parent);\n }\n\n this._predicate(node, true);\n this.space();\n // When printing (x)/*1*/=>{}, we remove the parentheses\n // and thus there aren't two contiguous inner tokens.\n // We forcefully print inner comments here.\n this.printInnerComments();\n this.token(\"=>\");\n\n this.space();\n\n this.print(node.body, node);\n}\n\nfunction hasTypesOrComments(\n node: t.ArrowFunctionExpression,\n param: t.Identifier,\n): boolean {\n return !!(\n node.typeParameters ||\n node.returnType ||\n node.predicate ||\n param.typeAnnotation ||\n param.optional ||\n // Flow does not support `foo /*: string*/ => {};`\n param.leadingComments?.length ||\n param.trailingComments?.length\n );\n}\n\nfunction _getFuncIdName(\n this: Printer,\n idNode: t.Expression | t.PrivateName,\n parent: NodePath<\n t.Function | t.TSDeclareMethod | t.TSDeclareFunction\n >[\"parent\"],\n) {\n let id: t.Expression | t.PrivateName | t.LVal = idNode;\n\n if (!id && parent) {\n const parentType = parent.type;\n\n if (parentType === \"VariableDeclarator\") {\n id = parent.id;\n } else if (\n parentType === \"AssignmentExpression\" ||\n parentType === \"AssignmentPattern\"\n ) {\n id = parent.left;\n } else if (\n parentType === \"ObjectProperty\" ||\n parentType === \"ClassProperty\"\n ) {\n if (!parent.computed || parent.key.type === \"StringLiteral\") {\n id = parent.key;\n }\n } else if (\n parentType === \"ClassPrivateProperty\" ||\n parentType === \"ClassAccessorProperty\"\n ) {\n id = parent.key;\n }\n }\n\n if (!id) return;\n\n let nameInfo;\n\n if (id.type === \"Identifier\") {\n nameInfo = {\n pos: id.loc?.start,\n name:\n // @ts-expect-error Undocumented property identifierName\n id.loc?.identifierName || id.name,\n };\n } else if (id.type === \"PrivateName\") {\n nameInfo = {\n pos: id.loc?.start,\n name: \"#\" + id.id.name,\n };\n } else if (id.type === \"StringLiteral\") {\n nameInfo = {\n pos: id.loc?.start,\n name: id.value,\n };\n }\n\n return nameInfo;\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,IAAAA,EAAA,GAAAC,OAAA;AAA4C;EAAnCC;AAAY,IAAAF,EAAA;AAGd,SAASG,OAAOA,CAErBC,IAA0D,EAC1DC,MAAoC,EACpCC,UAEW,EACX;EACA,IAAI,CAACC,KAAK,CAACH,IAAI,CAACI,cAAc,EAAEJ,IAAI,CAAC;EAErC,MAAMK,QAAQ,GAAGC,cAAc,CAACC,IAAI,CAAC,IAAI,EAAEN,MAAM,EAAEC,UAAU,CAAC;EAC9D,IAAIG,QAAQ,EAAE;IACZ,IAAI,CAACG,oBAAoB,CAACH,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACK,GAAG,CAAC;EACxD;EAEA,IAAI,CAACC,SAAK,IAAK;EACf,IAAI,CAACC,WAAW,CAACZ,IAAI,CAACa,MAAM,EAAEb,IAAI,CAAC;EACnC,IAAI,CAACW,SAAK,IAAK;EAEf,MAAMG,gBAAgB,GAAGd,IAAI,CAACe,IAAI,KAAK,yBAAyB;EAChE,IAAI,CAACZ,KAAK,CAACH,IAAI,CAACgB,UAAU,EAAEhB,IAAI,EAAEc,gBAAgB,CAAC;EAEnD,IAAI,CAACG,iBAAiB,GAAGH,gBAAgB;AAC3C;AAEO,SAASF,WAAWA,CAEzBM,UAAgC,EAChCC,MAMuB,EACvB;EACA,MAAMC,WAAW,GAAGF,UAAU,CAACG,MAAM;EACrC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,WAAW,EAAEE,CAAC,EAAE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EZ,IAAIsC,EAAE,CAAC5B,IAAI,KAAK,YAAY,EAAE;IAAA,IAAA4C,OAAA,EAAAC,QAAA;IAC5BvD,QAAQ,GAAG;MACTK,GAAG,GAAAiD,OAAA,GAAEhB,EAAE,CAACkB,GAAG,qBAANF,OAAA,CAAQG,KAAK;MAClBrD,IAAI,EAEF,EAAAmD,QAAA,GAAAjB,EAAE,CAACkB,GAAG,qBAAND,QAAA,CAAQG,cAAc,KAAIpB,EAAE,CAAClC;IACjC,CAAC;EACH,CAAC,MAAM,IAAIkC,EAAE,CAAC5B,IAAI,KAAK,aAAa,EAAE;IAAA,IAAAiD,QAAA;IACpC3D,QAAQ,GAAG;MACTK,GAAG,GAAAsD,QAAA,GAAErB,EAAE,CAACkB,GAAG,qBAANG,QAAA,CAAQF,KAAK;MAClBrD,IAAI,EAAE,GAAG,GAAGkC,EAAE,CAACA,EAAE,CAAClC;IACpB,CAAC;EACH,CAAC,MAAM,IAAIkC,EAAE,CAAC5B,IAAI,KAAK,eAAe,EAAE;IAAA,IAAAkD,QAAA;IACtC5D,QAAQ,GAAG;MACTK,GAAG,GAAAuD,QAAA,GAAEtB,EAAE,CAACkB,GAAG,qBAANI,QAAA,CAAQH,KAAK;MAClBrD,IAAI,EAAEkC,EAAE,CAACuB;IACX,CAAC;EACH;EAEA,OAAO7D,QAAQ;AACjB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/modules.js b/node_modules/@babel/generator/lib/generators/modules.js deleted file mode 100644 index 8ee280c32..000000000 --- a/node_modules/@babel/generator/lib/generators/modules.js +++ /dev/null @@ -1,240 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ExportAllDeclaration = ExportAllDeclaration; -exports.ExportDefaultDeclaration = ExportDefaultDeclaration; -exports.ExportDefaultSpecifier = ExportDefaultSpecifier; -exports.ExportNamedDeclaration = ExportNamedDeclaration; -exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier; -exports.ExportSpecifier = ExportSpecifier; -exports.ImportAttribute = ImportAttribute; -exports.ImportDeclaration = ImportDeclaration; -exports.ImportDefaultSpecifier = ImportDefaultSpecifier; -exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; -exports.ImportSpecifier = ImportSpecifier; -exports._printAssertions = _printAssertions; -var _t = require("@babel/types"); -const { - isClassDeclaration, - isExportDefaultSpecifier, - isExportNamespaceSpecifier, - isImportDefaultSpecifier, - isImportNamespaceSpecifier, - isStatement -} = _t; -function ImportSpecifier(node) { - if (node.importKind === "type" || node.importKind === "typeof") { - this.word(node.importKind); - this.space(); - } - this.print(node.imported, node); - if (node.local && node.local.name !== node.imported.name) { - this.space(); - this.word("as"); - this.space(); - this.print(node.local, node); - } -} -function ImportDefaultSpecifier(node) { - this.print(node.local, node); -} -function ExportDefaultSpecifier(node) { - this.print(node.exported, node); -} -function ExportSpecifier(node) { - if (node.exportKind === "type") { - this.word("type"); - this.space(); - } - this.print(node.local, node); - if (node.exported && node.local.name !== node.exported.name) { - this.space(); - this.word("as"); - this.space(); - this.print(node.exported, node); - } -} -function ExportNamespaceSpecifier(node) { - this.tokenChar(42); - this.space(); - this.word("as"); - this.space(); - this.print(node.exported, node); -} -function _printAssertions(node) { - this.word("assert"); - this.space(); - this.tokenChar(123); - this.space(); - this.printList(node.assertions, node); - this.space(); - this.tokenChar(125); -} -function ExportAllDeclaration(node) { - var _node$assertions; - this.word("export"); - this.space(); - if (node.exportKind === "type") { - this.word("type"); - this.space(); - } - this.tokenChar(42); - this.space(); - this.word("from"); - this.space(); - if ((_node$assertions = node.assertions) != null && _node$assertions.length) { - this.print(node.source, node, true); - this.space(); - this._printAssertions(node); - } else { - this.print(node.source, node); - } - this.semicolon(); -} -function maybePrintDecoratorsBeforeExport(printer, node) { - if (isClassDeclaration(node.declaration) && printer._shouldPrintDecoratorsBeforeExport(node)) { - printer.printJoin(node.declaration.decorators, node); - } -} -function ExportNamedDeclaration(node) { - maybePrintDecoratorsBeforeExport(this, node); - this.word("export"); - this.space(); - if (node.declaration) { - const declar = node.declaration; - this.print(declar, node); - if (!isStatement(declar)) this.semicolon(); - } else { - if (node.exportKind === "type") { - this.word("type"); - this.space(); - } - const specifiers = node.specifiers.slice(0); - let hasSpecial = false; - for (;;) { - const first = specifiers[0]; - if (isExportDefaultSpecifier(first) || isExportNamespaceSpecifier(first)) { - hasSpecial = true; - this.print(specifiers.shift(), node); - if (specifiers.length) { - this.tokenChar(44); - this.space(); - } - } else { - break; - } - } - if (specifiers.length || !specifiers.length && !hasSpecial) { - this.tokenChar(123); - if (specifiers.length) { - this.space(); - this.printList(specifiers, node); - this.space(); - } - this.tokenChar(125); - } - if (node.source) { - var _node$assertions2; - this.space(); - this.word("from"); - this.space(); - if ((_node$assertions2 = node.assertions) != null && _node$assertions2.length) { - this.print(node.source, node, true); - this.space(); - this._printAssertions(node); - } else { - this.print(node.source, node); - } - } - this.semicolon(); - } -} -function ExportDefaultDeclaration(node) { - maybePrintDecoratorsBeforeExport(this, node); - this.word("export"); - this.noIndentInnerCommentsHere(); - this.space(); - this.word("default"); - this.space(); - const declar = node.declaration; - this.print(declar, node); - if (!isStatement(declar)) this.semicolon(); -} -function ImportDeclaration(node) { - var _node$assertions3; - this.word("import"); - this.space(); - const isTypeKind = node.importKind === "type" || node.importKind === "typeof"; - if (isTypeKind) { - this.noIndentInnerCommentsHere(); - this.word(node.importKind); - this.space(); - } else if (node.module) { - this.noIndentInnerCommentsHere(); - this.word("module"); - this.space(); - } - const specifiers = node.specifiers.slice(0); - const hasSpecifiers = !!specifiers.length; - while (hasSpecifiers) { - const first = specifiers[0]; - if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) { - this.print(specifiers.shift(), node); - if (specifiers.length) { - this.tokenChar(44); - this.space(); - } - } else { - break; - } - } - if (specifiers.length) { - this.tokenChar(123); - this.space(); - this.printList(specifiers, node); - this.space(); - this.tokenChar(125); - } else if (isTypeKind && !hasSpecifiers) { - this.tokenChar(123); - this.tokenChar(125); - } - if (hasSpecifiers || isTypeKind) { - this.space(); - this.word("from"); - this.space(); - } - if ((_node$assertions3 = node.assertions) != null && _node$assertions3.length) { - this.print(node.source, node, true); - this.space(); - this._printAssertions(node); - } else { - this.print(node.source, node); - } - { - var _node$attributes; - if ((_node$attributes = node.attributes) != null && _node$attributes.length) { - this.space(); - this.word("with"); - this.space(); - this.printList(node.attributes, node); - } - } - this.semicolon(); -} -function ImportAttribute(node) { - this.print(node.key); - this.tokenChar(58); - this.space(); - this.print(node.value); -} -function ImportNamespaceSpecifier(node) { - this.tokenChar(42); - this.space(); - this.word("as"); - this.space(); - this.print(node.local, node); -} - -//# sourceMappingURL=modules.js.map diff --git a/node_modules/@babel/generator/lib/generators/modules.js.map b/node_modules/@babel/generator/lib/generators/modules.js.map deleted file mode 100644 index 4df3c9c1f..000000000 --- a/node_modules/@babel/generator/lib/generators/modules.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_t","require","isClassDeclaration","isExportDefaultSpecifier","isExportNamespaceSpecifier","isImportDefaultSpecifier","isImportNamespaceSpecifier","isStatement","ImportSpecifier","node","importKind","word","space","print","imported","local","name","ImportDefaultSpecifier","ExportDefaultSpecifier","exported","ExportSpecifier","exportKind","ExportNamespaceSpecifier","token","_printAssertions","printList","assertions","ExportAllDeclaration","_node$assertions","length","source","semicolon","maybePrintDecoratorsBeforeExport","printer","declaration","_shouldPrintDecoratorsBeforeExport","printJoin","decorators","ExportNamedDeclaration","declar","specifiers","slice","hasSpecial","first","shift","_node$assertions2","ExportDefaultDeclaration","noIndentInnerCommentsHere","ImportDeclaration","_node$assertions3","isTypeKind","module","hasSpecifiers","_node$attributes","attributes","ImportAttribute","key","value","ImportNamespaceSpecifier"],"sources":["../../src/generators/modules.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isClassDeclaration,\n isExportDefaultSpecifier,\n isExportNamespaceSpecifier,\n isImportDefaultSpecifier,\n isImportNamespaceSpecifier,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nexport function ImportSpecifier(this: Printer, node: t.ImportSpecifier) {\n if (node.importKind === \"type\" || node.importKind === \"typeof\") {\n this.word(node.importKind);\n this.space();\n }\n\n this.print(node.imported, node);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.local && node.local.name !== node.imported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.local, node);\n }\n}\n\nexport function ImportDefaultSpecifier(\n this: Printer,\n node: t.ImportDefaultSpecifier,\n) {\n this.print(node.local, node);\n}\n\nexport function ExportDefaultSpecifier(\n this: Printer,\n node: t.ExportDefaultSpecifier,\n) {\n this.print(node.exported, node);\n}\n\nexport function ExportSpecifier(this: Printer, node: t.ExportSpecifier) {\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n\n this.print(node.local, node);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.exported && node.local.name !== node.exported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported, node);\n }\n}\n\nexport function ExportNamespaceSpecifier(\n this: Printer,\n node: t.ExportNamespaceSpecifier,\n) {\n this.token(\"*\");\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported, node);\n}\n\nexport function _printAssertions(\n this: Printer,\n node: Extract,\n) {\n this.word(\"assert\");\n this.space();\n this.token(\"{\");\n this.space();\n this.printList(node.assertions, node);\n this.space();\n this.token(\"}\");\n}\n\nexport function ExportAllDeclaration(\n this: Printer,\n node: t.ExportAllDeclaration | t.DeclareExportAllDeclaration,\n) {\n this.word(\"export\");\n this.space();\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n this.token(\"*\");\n this.space();\n this.word(\"from\");\n this.space();\n // @ts-expect-error Fixme: assertions is not defined in DeclareExportAllDeclaration\n if (node.assertions?.length) {\n this.print(node.source, node, true);\n this.space();\n // @ts-expect-error Fixme: assertions is not defined in DeclareExportAllDeclaration\n this._printAssertions(node);\n } else {\n this.print(node.source, node);\n }\n\n this.semicolon();\n}\n\nfunction maybePrintDecoratorsBeforeExport(\n printer: Printer,\n node: t.ExportNamedDeclaration | t.ExportDefaultDeclaration,\n) {\n if (\n isClassDeclaration(node.declaration) &&\n printer._shouldPrintDecoratorsBeforeExport(\n node as t.ExportNamedDeclaration & { declaration: t.ClassDeclaration },\n )\n ) {\n printer.printJoin(node.declaration.decorators, node);\n }\n}\n\nexport function ExportNamedDeclaration(\n this: Printer,\n node: t.ExportNamedDeclaration,\n) {\n maybePrintDecoratorsBeforeExport(this, node);\n\n this.word(\"export\");\n this.space();\n if (node.declaration) {\n const declar = node.declaration;\n this.print(declar, node);\n if (!isStatement(declar)) this.semicolon();\n } else {\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n\n const specifiers = node.specifiers.slice(0);\n\n // print \"special\" specifiers first\n let hasSpecial = false;\n for (;;) {\n const first = specifiers[0];\n if (\n isExportDefaultSpecifier(first) ||\n isExportNamespaceSpecifier(first)\n ) {\n hasSpecial = true;\n this.print(specifiers.shift(), node);\n if (specifiers.length) {\n this.token(\",\");\n this.space();\n }\n } else {\n break;\n }\n }\n\n if (specifiers.length || (!specifiers.length && !hasSpecial)) {\n this.token(\"{\");\n if (specifiers.length) {\n this.space();\n this.printList(specifiers, node);\n this.space();\n }\n this.token(\"}\");\n }\n\n if (node.source) {\n this.space();\n this.word(\"from\");\n this.space();\n if (node.assertions?.length) {\n this.print(node.source, node, true);\n this.space();\n this._printAssertions(node);\n } else {\n this.print(node.source, node);\n }\n }\n\n this.semicolon();\n }\n}\n\nexport function ExportDefaultDeclaration(\n this: Printer,\n node: t.ExportDefaultDeclaration,\n) {\n maybePrintDecoratorsBeforeExport(this, node);\n\n this.word(\"export\");\n this.noIndentInnerCommentsHere();\n this.space();\n this.word(\"default\");\n this.space();\n const declar = node.declaration;\n this.print(declar, node);\n if (!isStatement(declar)) this.semicolon();\n}\n\nexport function ImportDeclaration(this: Printer, node: t.ImportDeclaration) {\n this.word(\"import\");\n this.space();\n\n const isTypeKind = node.importKind === \"type\" || node.importKind === \"typeof\";\n if (isTypeKind) {\n this.noIndentInnerCommentsHere();\n this.word(node.importKind);\n this.space();\n } else if (node.module) {\n this.noIndentInnerCommentsHere();\n this.word(\"module\");\n this.space();\n }\n\n const specifiers = node.specifiers.slice(0);\n const hasSpecifiers = !!specifiers.length;\n // print \"special\" specifiers first. The loop condition is constant,\n // but there is a \"break\" in the body.\n while (hasSpecifiers) {\n const first = specifiers[0];\n if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) {\n this.print(specifiers.shift(), node);\n if (specifiers.length) {\n this.token(\",\");\n this.space();\n }\n } else {\n break;\n }\n }\n\n if (specifiers.length) {\n this.token(\"{\");\n this.space();\n this.printList(specifiers, node);\n this.space();\n this.token(\"}\");\n } else if (isTypeKind && !hasSpecifiers) {\n this.token(\"{\");\n this.token(\"}\");\n }\n\n if (hasSpecifiers || isTypeKind) {\n this.space();\n this.word(\"from\");\n this.space();\n }\n\n if (node.assertions?.length) {\n this.print(node.source, node, true);\n this.space();\n this._printAssertions(node);\n } else {\n this.print(node.source, node);\n }\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 supports module attributes\n if (node.attributes?.length) {\n this.space();\n this.word(\"with\");\n this.space();\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 supports module attributes\n this.printList(node.attributes, node);\n }\n }\n\n this.semicolon();\n}\n\nexport function ImportAttribute(this: Printer, node: t.ImportAttribute) {\n this.print(node.key);\n this.token(\":\");\n this.space();\n this.print(node.value);\n}\n\nexport function ImportNamespaceSpecifier(\n this: Printer,\n node: t.ImportNamespaceSpecifier,\n) {\n this.token(\"*\");\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.local, node);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAOsB;EANpBC,kBAAkB;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xB,MAAM,EAAE;MAC3B,IAAI,CAACjB,KAAK,EAAE;MACZ,IAAI,CAACD,IAAI,CAAC,MAAM,CAAC;MACjB,IAAI,CAACC,KAAK,EAAE;MAEZ,IAAI,CAACa,SAAS,CAAChB,IAAI,CAAC6C,UAAU,EAAE7C,IAAI,CAAC;IACvC;EACF;EAEA,IAAI,CAACsB,SAAS,EAAE;AAClB;AAEO,SAASwB,eAAeA,CAAgB9C,IAAuB,EAAE;EACtE,IAAI,CAACI,KAAK,CAACJ,IAAI,CAAC+C,GAAG,CAAC;EACpB,IAAI,CAACjC,SAAK,IAAK;EACf,IAAI,CAACX,KAAK,EAAE;EACZ,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACgD,KAAK,CAAC;AACxB;AAEO,SAASC,wBAAwBA,CAEtCjD,IAAgC,EAChC;EACA,IAAI,CAACc,SAAK,IAAK;EACf,IAAI,CAACX,KAAK,EAAE;EACZ,IAAI,CAACD,IAAI,CAAC,IAAI,CAAC;EACf,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACM,KAAK,EAAEN,IAAI,CAAC;AAC9B"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/statements.js b/node_modules/@babel/generator/lib/generators/statements.js deleted file mode 100644 index 93f254f28..000000000 --- a/node_modules/@babel/generator/lib/generators/statements.js +++ /dev/null @@ -1,277 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BreakStatement = BreakStatement; -exports.CatchClause = CatchClause; -exports.ContinueStatement = ContinueStatement; -exports.DebuggerStatement = DebuggerStatement; -exports.DoWhileStatement = DoWhileStatement; -exports.ForOfStatement = exports.ForInStatement = void 0; -exports.ForStatement = ForStatement; -exports.IfStatement = IfStatement; -exports.LabeledStatement = LabeledStatement; -exports.ReturnStatement = ReturnStatement; -exports.SwitchCase = SwitchCase; -exports.SwitchStatement = SwitchStatement; -exports.ThrowStatement = ThrowStatement; -exports.TryStatement = TryStatement; -exports.VariableDeclaration = VariableDeclaration; -exports.VariableDeclarator = VariableDeclarator; -exports.WhileStatement = WhileStatement; -exports.WithStatement = WithStatement; -var _t = require("@babel/types"); -const { - isFor, - isForStatement, - isIfStatement, - isStatement -} = _t; -function WithStatement(node) { - this.word("with"); - this.space(); - this.tokenChar(40); - this.print(node.object, node); - this.tokenChar(41); - this.printBlock(node); -} -function IfStatement(node) { - this.word("if"); - this.space(); - this.tokenChar(40); - this.print(node.test, node); - this.tokenChar(41); - this.space(); - const needsBlock = node.alternate && isIfStatement(getLastStatement(node.consequent)); - if (needsBlock) { - this.tokenChar(123); - this.newline(); - this.indent(); - } - this.printAndIndentOnComments(node.consequent, node); - if (needsBlock) { - this.dedent(); - this.newline(); - this.tokenChar(125); - } - if (node.alternate) { - if (this.endsWith(125)) this.space(); - this.word("else"); - this.space(); - this.printAndIndentOnComments(node.alternate, node); - } -} -function getLastStatement(statement) { - const { - body - } = statement; - if (isStatement(body) === false) { - return statement; - } - return getLastStatement(body); -} -function ForStatement(node) { - this.word("for"); - this.space(); - this.tokenChar(40); - this.inForStatementInitCounter++; - this.print(node.init, node); - this.inForStatementInitCounter--; - this.tokenChar(59); - if (node.test) { - this.space(); - this.print(node.test, node); - } - this.tokenChar(59); - if (node.update) { - this.space(); - this.print(node.update, node); - } - this.tokenChar(41); - this.printBlock(node); -} -function WhileStatement(node) { - this.word("while"); - this.space(); - this.tokenChar(40); - this.print(node.test, node); - this.tokenChar(41); - this.printBlock(node); -} -function ForXStatement(node) { - this.word("for"); - this.space(); - const isForOf = node.type === "ForOfStatement"; - if (isForOf && node.await) { - this.word("await"); - this.space(); - } - this.noIndentInnerCommentsHere(); - this.tokenChar(40); - this.print(node.left, node); - this.space(); - this.word(isForOf ? "of" : "in"); - this.space(); - this.print(node.right, node); - this.tokenChar(41); - this.printBlock(node); -} -const ForInStatement = ForXStatement; -exports.ForInStatement = ForInStatement; -const ForOfStatement = ForXStatement; -exports.ForOfStatement = ForOfStatement; -function DoWhileStatement(node) { - this.word("do"); - this.space(); - this.print(node.body, node); - this.space(); - this.word("while"); - this.space(); - this.tokenChar(40); - this.print(node.test, node); - this.tokenChar(41); - this.semicolon(); -} -function printStatementAfterKeyword(printer, node, parent, isLabel) { - if (node) { - printer.space(); - printer.printTerminatorless(node, parent, isLabel); - } - printer.semicolon(); -} -function BreakStatement(node) { - this.word("break"); - printStatementAfterKeyword(this, node.label, node, true); -} -function ContinueStatement(node) { - this.word("continue"); - printStatementAfterKeyword(this, node.label, node, true); -} -function ReturnStatement(node) { - this.word("return"); - printStatementAfterKeyword(this, node.argument, node, false); -} -function ThrowStatement(node) { - this.word("throw"); - printStatementAfterKeyword(this, node.argument, node, false); -} -function LabeledStatement(node) { - this.print(node.label, node); - this.tokenChar(58); - this.space(); - this.print(node.body, node); -} -function TryStatement(node) { - this.word("try"); - this.space(); - this.print(node.block, node); - this.space(); - if (node.handlers) { - this.print(node.handlers[0], node); - } else { - this.print(node.handler, node); - } - if (node.finalizer) { - this.space(); - this.word("finally"); - this.space(); - this.print(node.finalizer, node); - } -} -function CatchClause(node) { - this.word("catch"); - this.space(); - if (node.param) { - this.tokenChar(40); - this.print(node.param, node); - this.print(node.param.typeAnnotation, node); - this.tokenChar(41); - this.space(); - } - this.print(node.body, node); -} -function SwitchStatement(node) { - this.word("switch"); - this.space(); - this.tokenChar(40); - this.print(node.discriminant, node); - this.tokenChar(41); - this.space(); - this.tokenChar(123); - this.printSequence(node.cases, node, { - indent: true, - addNewlines(leading, cas) { - if (!leading && node.cases[node.cases.length - 1] === cas) return -1; - } - }); - this.rightBrace(node); -} -function SwitchCase(node) { - if (node.test) { - this.word("case"); - this.space(); - this.print(node.test, node); - this.tokenChar(58); - } else { - this.word("default"); - this.tokenChar(58); - } - if (node.consequent.length) { - this.newline(); - this.printSequence(node.consequent, node, { - indent: true - }); - } -} -function DebuggerStatement() { - this.word("debugger"); - this.semicolon(); -} -function VariableDeclaration(node, parent) { - if (node.declare) { - this.word("declare"); - this.space(); - } - const { - kind - } = node; - this.word(kind, kind === "using"); - this.space(); - let hasInits = false; - if (!isFor(parent)) { - for (const declar of node.declarations) { - if (declar.init) { - hasInits = true; - } - } - } - this.printList(node.declarations, node, { - separator: hasInits ? function () { - this.tokenChar(44); - this.newline(); - } : undefined, - indent: node.declarations.length > 1 ? true : false - }); - if (isFor(parent)) { - if (isForStatement(parent)) { - if (parent.init === node) return; - } else { - if (parent.left === node) return; - } - } - this.semicolon(); -} -function VariableDeclarator(node) { - this.print(node.id, node); - if (node.definite) this.tokenChar(33); - this.print(node.id.typeAnnotation, node); - if (node.init) { - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.init, node); - } -} - -//# sourceMappingURL=statements.js.map diff --git a/node_modules/@babel/generator/lib/generators/statements.js.map b/node_modules/@babel/generator/lib/generators/statements.js.map deleted file mode 100644 index f5421a05c..000000000 --- a/node_modules/@babel/generator/lib/generators/statements.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_t","require","isFor","isForStatement","isIfStatement","isStatement","WithStatement","node","word","space","token","print","object","printBlock","IfStatement","test","needsBlock","alternate","getLastStatement","consequent","newline","indent","printAndIndentOnComments","dedent","endsWith","statement","body","ForStatement","inForStatementInitCounter","init","update","WhileStatement","ForXStatement","isForOf","type","await","noIndentInnerCommentsHere","left","right","ForInStatement","exports","ForOfStatement","DoWhileStatement","semicolon","printStatementAfterKeyword","printer","parent","isLabel","printTerminatorless","BreakStatement","label","ContinueStatement","ReturnStatement","argument","ThrowStatement","LabeledStatement","TryStatement","block","handlers","handler","finalizer","CatchClause","param","typeAnnotation","SwitchStatement","discriminant","printSequence","cases","addNewlines","leading","cas","length","rightBrace","SwitchCase","DebuggerStatement","VariableDeclaration","declare","kind","hasInits","declar","declarations","printList","separator","undefined","VariableDeclarator","id","definite"],"sources":["../../src/generators/statements.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isFor,\n isForStatement,\n isIfStatement,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nexport function WithStatement(this: Printer, node: t.WithStatement) {\n this.word(\"with\");\n this.space();\n this.token(\"(\");\n this.print(node.object, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function IfStatement(this: Printer, node: t.IfStatement) {\n this.word(\"if\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.space();\n\n const needsBlock =\n node.alternate && isIfStatement(getLastStatement(node.consequent));\n if (needsBlock) {\n this.token(\"{\");\n this.newline();\n this.indent();\n }\n\n this.printAndIndentOnComments(node.consequent, node);\n\n if (needsBlock) {\n this.dedent();\n this.newline();\n this.token(\"}\");\n }\n\n if (node.alternate) {\n if (this.endsWith(charCodes.rightCurlyBrace)) this.space();\n this.word(\"else\");\n this.space();\n this.printAndIndentOnComments(node.alternate, node);\n }\n}\n\n// Recursively get the last statement.\nfunction getLastStatement(statement: t.Statement): t.Statement {\n // @ts-expect-error: If statement.body is empty or not a Node, isStatement will return false\n const { body } = statement;\n if (isStatement(body) === false) {\n return statement;\n }\n\n return getLastStatement(body);\n}\n\nexport function ForStatement(this: Printer, node: t.ForStatement) {\n this.word(\"for\");\n this.space();\n this.token(\"(\");\n\n this.inForStatementInitCounter++;\n this.print(node.init, node);\n this.inForStatementInitCounter--;\n this.token(\";\");\n\n if (node.test) {\n this.space();\n this.print(node.test, node);\n }\n this.token(\";\");\n\n if (node.update) {\n this.space();\n this.print(node.update, node);\n }\n\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function WhileStatement(this: Printer, node: t.WhileStatement) {\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nfunction ForXStatement(this: Printer, node: t.ForXStatement) {\n this.word(\"for\");\n this.space();\n const isForOf = node.type === \"ForOfStatement\";\n if (isForOf && node.await) {\n this.word(\"await\");\n this.space();\n }\n this.noIndentInnerCommentsHere();\n this.token(\"(\");\n this.print(node.left, node);\n this.space();\n this.word(isForOf ? \"of\" : \"in\");\n this.space();\n this.print(node.right, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport const ForInStatement = ForXStatement;\nexport const ForOfStatement = ForXStatement;\n\nexport function DoWhileStatement(this: Printer, node: t.DoWhileStatement) {\n this.word(\"do\");\n this.space();\n this.print(node.body, node);\n this.space();\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.semicolon();\n}\n\nfunction printStatementAfterKeyword(\n printer: Printer,\n node: t.Node,\n parent: t.Node,\n isLabel: boolean,\n) {\n if (node) {\n printer.space();\n printer.printTerminatorless(node, parent, isLabel);\n }\n\n printer.semicolon();\n}\n\nexport function BreakStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"break\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ContinueStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"continue\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ReturnStatement(this: Printer, node: t.ReturnStatement) {\n this.word(\"return\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function ThrowStatement(this: Printer, node: t.ThrowStatement) {\n this.word(\"throw\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function LabeledStatement(this: Printer, node: t.LabeledStatement) {\n this.print(node.label, node);\n this.token(\":\");\n this.space();\n this.print(node.body, node);\n}\n\nexport function TryStatement(this: Printer, node: t.TryStatement) {\n this.word(\"try\");\n this.space();\n this.print(node.block, node);\n this.space();\n\n // Esprima bug puts the catch clause in a `handlers` array.\n // see https://code.google.com/p/esprima/issues/detail?id=433\n // We run into this from regenerator generated ast.\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n if (node.handlers) {\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n this.print(node.handlers[0], node);\n } else {\n this.print(node.handler, node);\n }\n\n if (node.finalizer) {\n this.space();\n this.word(\"finally\");\n this.space();\n this.print(node.finalizer, node);\n }\n}\n\nexport function CatchClause(this: Printer, node: t.CatchClause) {\n this.word(\"catch\");\n this.space();\n if (node.param) {\n this.token(\"(\");\n this.print(node.param, node);\n this.print(node.param.typeAnnotation, node);\n this.token(\")\");\n this.space();\n }\n this.print(node.body, node);\n}\n\nexport function SwitchStatement(this: Printer, node: t.SwitchStatement) {\n this.word(\"switch\");\n this.space();\n this.token(\"(\");\n this.print(node.discriminant, node);\n this.token(\")\");\n this.space();\n this.token(\"{\");\n\n this.printSequence(node.cases, node, {\n indent: true,\n addNewlines(leading, cas) {\n if (!leading && node.cases[node.cases.length - 1] === cas) return -1;\n },\n });\n\n this.rightBrace(node);\n}\n\nexport function SwitchCase(this: Printer, node: t.SwitchCase) {\n if (node.test) {\n this.word(\"case\");\n this.space();\n this.print(node.test, node);\n this.token(\":\");\n } else {\n this.word(\"default\");\n this.token(\":\");\n }\n\n if (node.consequent.length) {\n this.newline();\n this.printSequence(node.consequent, node, { indent: true });\n }\n}\n\nexport function DebuggerStatement(this: Printer) {\n this.word(\"debugger\");\n this.semicolon();\n}\n\nexport function VariableDeclaration(\n this: Printer,\n node: t.VariableDeclaration,\n parent: t.Node,\n) {\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n const { kind } = node;\n this.word(kind, kind === \"using\");\n this.space();\n\n let hasInits = false;\n // don't add whitespace to loop heads\n if (!isFor(parent)) {\n for (const declar of node.declarations) {\n if (declar.init) {\n // has an init so let's split it up over multiple lines\n hasInits = true;\n }\n }\n }\n\n //\n // use a pretty separator when we aren't in compact mode, have initializers and don't have retainLines on\n // this will format declarations like:\n //\n // let foo = \"bar\", bar = \"foo\";\n //\n // into\n //\n // let foo = \"bar\",\n // bar = \"foo\";\n //\n\n this.printList(node.declarations, node, {\n separator: hasInits\n ? function (this: Printer) {\n this.token(\",\");\n this.newline();\n }\n : undefined,\n indent: node.declarations.length > 1 ? true : false,\n });\n\n if (isFor(parent)) {\n // don't give semicolons to these nodes since they'll be inserted in the parent generator\n if (isForStatement(parent)) {\n if (parent.init === node) return;\n } else {\n if (parent.left === node) return;\n }\n }\n\n this.semicolon();\n}\n\nexport function VariableDeclarator(this: Printer, node: t.VariableDeclarator) {\n this.print(node.id, node);\n if (node.definite) this.token(\"!\"); // TS\n // @ts-expect-error todo(flow-ts) Property 'typeAnnotation' does not exist on type 'MemberExpression'.\n this.print(node.id.typeAnnotation, node);\n if (node.init) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.init, node);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAKsB;EAJpBC,KAAK;EACLC,cAAc;EACdC,aAAa;EACbC;AAAW,IAAAL,EAAA;AAKN,SAASM,aAAaA,CAAgBC,IAAqB,EAAE;EAClE,IAAI,CAACC,IAAI,CAAC,MAAM,CAAC;EACjB,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACC,SAAK,IAAK;EACf,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACK,MAAM,EAAEL,IAAI,CAAC;EAC7B,IAAI,CAACG,SAAK,IAAK;EACf,IAAI,CAACG,UAAU,CAACN,IAAI,CAAC;AACvB;AAEO,SAASO,WAAWA,CAAgBP,IAAmB,EAAE;EAC9D,IAAI,CAACC,IAAI,CAAC,IAAI,CAAC;EACf,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACC,SAAK,IAAK;EACf,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACQ,IAAI,EAAER,IAAI,CAAC;EAC3B,IAAI,CAACG,SAAK,IAAK;EACf,IAAI,CAACD,KAAK,EAAE;EAEZ,MAAMO,UAAU,GACdT,IAAI,CAACU,SAAS,IAAIb,aAAa,CAACc,gBAAgB,CAACX,IAAI,CAACY,UAAU,CAAC,CAAC;EACpE,IAAIH,UAAU,EAAE;IACd,IAAI,CAACN,SAAK,KAAK;IACf,IAAI,CAACU,OAAO,EAAE;IACd,IAAI,C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EAAE;IACtC2E,SAAS,EAAEJ,QAAQ,GACf,YAAyB;MACvB,IAAI,CAACpE,SAAK,IAAK;MACf,IAAI,CAACU,OAAO,EAAE;IAChB,CAAC,GACD+D,SAAS;IACb9D,MAAM,EAAEd,IAAI,CAACyE,YAAY,CAACT,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG;EAChD,CAAC,CAAC;EAEF,IAAIrE,KAAK,CAAC4C,MAAM,CAAC,EAAE;IAEjB,IAAI3C,cAAc,CAAC2C,MAAM,CAAC,EAAE;MAC1B,IAAIA,MAAM,CAACjB,IAAI,KAAKtB,IAAI,EAAE;IAC5B,CAAC,MAAM;MACL,IAAIuC,MAAM,CAACT,IAAI,KAAK9B,IAAI,EAAE;IAC5B;EACF;EAEA,IAAI,CAACoC,SAAS,EAAE;AAClB;AAEO,SAASyC,kBAAkBA,CAAgB7E,IAA0B,EAAE;EAC5E,IAAI,CAACI,KAAK,CAACJ,IAAI,CAAC8E,EAAE,EAAE9E,IAAI,CAAC;EACzB,IAAIA,IAAI,CAAC+E,QAAQ,EAAE,IAAI,CAAC5E,SAAK,IAAK;EAElC,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC8E,EAAE,CAACtB,cAAc,EAAExD,IAAI,CAAC;EACxC,IAAIA,IAAI,CAACsB,IAAI,EAAE;IACb,IAAI,CAACpB,KAAK,EAAE;IACZ,IAAI,CAACC,SAAK,IAAK;IACf,IAAI,CAACD,KAAK,EAAE;IACZ,IAAI,CAACE,KAAK,CAACJ,IAAI,CAACsB,IAAI,EAAEtB,IAAI,CAAC;EAC7B;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/template-literals.js b/node_modules/@babel/generator/lib/generators/template-literals.js deleted file mode 100644 index 737d33c60..000000000 --- a/node_modules/@babel/generator/lib/generators/template-literals.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.TaggedTemplateExpression = TaggedTemplateExpression; -exports.TemplateElement = TemplateElement; -exports.TemplateLiteral = TemplateLiteral; -function TaggedTemplateExpression(node) { - this.print(node.tag, node); - this.print(node.typeParameters, node); - this.print(node.quasi, node); -} -function TemplateElement(node, parent) { - const isFirst = parent.quasis[0] === node; - const isLast = parent.quasis[parent.quasis.length - 1] === node; - const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); - this.token(value, true); -} -function TemplateLiteral(node) { - const quasis = node.quasis; - for (let i = 0; i < quasis.length; i++) { - this.print(quasis[i], node); - if (i + 1 < quasis.length) { - this.print(node.expressions[i], node); - } - } -} - -//# sourceMappingURL=template-literals.js.map diff --git a/node_modules/@babel/generator/lib/generators/template-literals.js.map b/node_modules/@babel/generator/lib/generators/template-literals.js.map deleted file mode 100644 index a056f8715..000000000 --- a/node_modules/@babel/generator/lib/generators/template-literals.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["TaggedTemplateExpression","node","print","tag","typeParameters","quasi","TemplateElement","parent","isFirst","quasis","isLast","length","value","raw","token","TemplateLiteral","i","expressions"],"sources":["../../src/generators/template-literals.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\n\nexport function TaggedTemplateExpression(\n this: Printer,\n node: t.TaggedTemplateExpression,\n) {\n this.print(node.tag, node);\n this.print(node.typeParameters, node); // TS\n this.print(node.quasi, node);\n}\n\nexport function TemplateElement(\n this: Printer,\n node: t.TemplateElement,\n parent: t.TemplateLiteral,\n) {\n const isFirst = parent.quasis[0] === node;\n const isLast = parent.quasis[parent.quasis.length - 1] === node;\n\n const value = (isFirst ? \"`\" : \"}\") + node.value.raw + (isLast ? \"`\" : \"${\");\n\n this.token(value, true);\n}\n\nexport function TemplateLiteral(this: Printer, node: t.TemplateLiteral) {\n const quasis = node.quasis;\n\n for (let i = 0; i < quasis.length; i++) {\n this.print(quasis[i], node);\n\n if (i + 1 < quasis.length) {\n this.print(node.expressions[i], node);\n }\n }\n}\n"],"mappings":";;;;;;;;AAGO,SAASA,wBAAwBA,CAEtCC,IAAgC,EAChC;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,GAAG,EAAEF,IAAI,CAAC;EAC1B,IAAI,CAACC,KAAK,CAACD,IAAI,CAACG,cAAc,EAAEH,IAAI,CAAC;EACrC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACI,KAAK,EAAEJ,IAAI,CAAC;AAC9B;AAEO,SAASK,eAAeA,CAE7BL,IAAuB,EACvBM,MAAyB,EACzB;EACA,MAAMC,OAAO,GAAGD,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,KAAKR,IAAI;EACzC,MAAMS,MAAM,GAAGH,MAAM,CAACE,MAAM,CAACF,MAAM,CAACE,MAAM,CAACE,MAAM,GAAG,CAAC,CAAC,KAAKV,IAAI;EAE/D,MAAMW,KAAK,GAAG,CAACJ,OAAO,GAAG,GAAG,GAAG,GAAG,IAAIP,IAAI,CAACW,KAAK,CAACC,GAAG,IAAIH,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC;EAE5E,IAAI,CAACI,KAAK,CAACF,KAAK,EAAE,IAAI,CAAC;AACzB;AAEO,SAASG,eAAeA,CAAgBd,IAAuB,EAAE;EACtE,MAAMQ,MAAM,GAAGR,IAAI,CAACQ,MAAM;EAE1B,KAAK,IAAIO,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGP,MAAM,CAACE,MAAM,EAAEK,CAAC,EAAE,EAAE;IACtC,IAAI,CAACd,KAAK,CAACO,MAAM,CAACO,CAAC,CAAC,EAAEf,IAAI,CAAC;IAE3B,IAAIe,CAAC,GAAG,CAAC,GAAGP,MAAM,CAACE,MAAM,EAAE;MACzB,IAAI,CAACT,KAAK,CAACD,IAAI,CAACgB,WAAW,CAACD,CAAC,CAAC,EAAEf,IAAI,CAAC;IACvC;EACF;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/types.js b/node_modules/@babel/generator/lib/generators/types.js deleted file mode 100644 index e02aa9814..000000000 --- a/node_modules/@babel/generator/lib/generators/types.js +++ /dev/null @@ -1,220 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ArgumentPlaceholder = ArgumentPlaceholder; -exports.ArrayPattern = exports.ArrayExpression = ArrayExpression; -exports.BigIntLiteral = BigIntLiteral; -exports.BooleanLiteral = BooleanLiteral; -exports.DecimalLiteral = DecimalLiteral; -exports.Identifier = Identifier; -exports.NullLiteral = NullLiteral; -exports.NumericLiteral = NumericLiteral; -exports.ObjectPattern = exports.ObjectExpression = ObjectExpression; -exports.ObjectMethod = ObjectMethod; -exports.ObjectProperty = ObjectProperty; -exports.PipelineBareFunction = PipelineBareFunction; -exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference; -exports.PipelineTopicExpression = PipelineTopicExpression; -exports.RecordExpression = RecordExpression; -exports.RegExpLiteral = RegExpLiteral; -exports.SpreadElement = exports.RestElement = RestElement; -exports.StringLiteral = StringLiteral; -exports.TopicReference = TopicReference; -exports.TupleExpression = TupleExpression; -var _t = require("@babel/types"); -var _jsesc = require("jsesc"); -const { - isAssignmentPattern, - isIdentifier -} = _t; -function Identifier(node) { - var _node$loc; - this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name); - this.word(node.name); -} -function ArgumentPlaceholder() { - this.tokenChar(63); -} -function RestElement(node) { - this.token("..."); - this.print(node.argument, node); -} -function ObjectExpression(node) { - const props = node.properties; - this.tokenChar(123); - if (props.length) { - this.space(); - this.printList(props, node, { - indent: true, - statement: true - }); - this.space(); - } - this.sourceWithOffset("end", node.loc, 0, -1); - this.tokenChar(125); -} -function ObjectMethod(node) { - this.printJoin(node.decorators, node); - this._methodHead(node); - this.space(); - this.print(node.body, node); -} -function ObjectProperty(node) { - this.printJoin(node.decorators, node); - if (node.computed) { - this.tokenChar(91); - this.print(node.key, node); - this.tokenChar(93); - } else { - if (isAssignmentPattern(node.value) && isIdentifier(node.key) && node.key.name === node.value.left.name) { - this.print(node.value, node); - return; - } - this.print(node.key, node); - if (node.shorthand && isIdentifier(node.key) && isIdentifier(node.value) && node.key.name === node.value.name) { - return; - } - } - this.tokenChar(58); - this.space(); - this.print(node.value, node); -} -function ArrayExpression(node) { - const elems = node.elements; - const len = elems.length; - this.tokenChar(91); - for (let i = 0; i < elems.length; i++) { - const elem = elems[i]; - if (elem) { - if (i > 0) this.space(); - this.print(elem, node); - if (i < len - 1) this.tokenChar(44); - } else { - this.tokenChar(44); - } - } - this.tokenChar(93); -} -function RecordExpression(node) { - const props = node.properties; - let startToken; - let endToken; - if (this.format.recordAndTupleSyntaxType === "bar") { - startToken = "{|"; - endToken = "|}"; - } else if (this.format.recordAndTupleSyntaxType !== "hash" && this.format.recordAndTupleSyntaxType != null) { - throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`); - } else { - startToken = "#{"; - endToken = "}"; - } - this.token(startToken); - if (props.length) { - this.space(); - this.printList(props, node, { - indent: true, - statement: true - }); - this.space(); - } - this.token(endToken); -} -function TupleExpression(node) { - const elems = node.elements; - const len = elems.length; - let startToken; - let endToken; - if (this.format.recordAndTupleSyntaxType === "bar") { - startToken = "[|"; - endToken = "|]"; - } else if (this.format.recordAndTupleSyntaxType === "hash") { - startToken = "#["; - endToken = "]"; - } else { - throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`); - } - this.token(startToken); - for (let i = 0; i < elems.length; i++) { - const elem = elems[i]; - if (elem) { - if (i > 0) this.space(); - this.print(elem, node); - if (i < len - 1) this.tokenChar(44); - } - } - this.token(endToken); -} -function RegExpLiteral(node) { - this.word(`/${node.pattern}/${node.flags}`); -} -function BooleanLiteral(node) { - this.word(node.value ? "true" : "false"); -} -function NullLiteral() { - this.word("null"); -} -function NumericLiteral(node) { - const raw = this.getPossibleRaw(node); - const opts = this.format.jsescOption; - const value = node.value + ""; - if (opts.numbers) { - this.number(_jsesc(node.value, opts)); - } else if (raw == null) { - this.number(value); - } else if (this.format.minified) { - this.number(raw.length < value.length ? raw : value); - } else { - this.number(raw); - } -} -function StringLiteral(node) { - const raw = this.getPossibleRaw(node); - if (!this.format.minified && raw !== undefined) { - this.token(raw); - return; - } - const val = _jsesc(node.value, this.format.jsescOption); - this.token(val); -} -function BigIntLiteral(node) { - const raw = this.getPossibleRaw(node); - if (!this.format.minified && raw !== undefined) { - this.word(raw); - return; - } - this.word(node.value + "n"); -} -function DecimalLiteral(node) { - const raw = this.getPossibleRaw(node); - if (!this.format.minified && raw !== undefined) { - this.word(raw); - return; - } - this.word(node.value + "m"); -} -const validTopicTokenSet = new Set(["^^", "@@", "^", "%", "#"]); -function TopicReference() { - const { - topicToken - } = this.format; - if (validTopicTokenSet.has(topicToken)) { - this.token(topicToken); - } else { - const givenTopicTokenJSON = JSON.stringify(topicToken); - const validTopics = Array.from(validTopicTokenSet, v => JSON.stringify(v)); - throw new Error(`The "topicToken" generator option must be one of ` + `${validTopics.join(", ")} (${givenTopicTokenJSON} received instead).`); - } -} -function PipelineTopicExpression(node) { - this.print(node.expression, node); -} -function PipelineBareFunction(node) { - this.print(node.callee, node); -} -function PipelinePrimaryTopicReference() { - this.tokenChar(35); -} - -//# sourceMappingURL=types.js.map diff --git a/node_modules/@babel/generator/lib/generators/types.js.map b/node_modules/@babel/generator/lib/generators/types.js.map deleted file mode 100644 index 9af2a163a..000000000 --- a/node_modules/@babel/generator/lib/generators/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_t","require","_jsesc","isAssignmentPattern","isIdentifier","Identifier","node","_node$loc","sourceIdentifierName","loc","identifierName","name","word","ArgumentPlaceholder","token","RestElement","print","argument","ObjectExpression","props","properties","length","space","printList","indent","statement","sourceWithOffset","ObjectMethod","printJoin","decorators","_methodHead","body","ObjectProperty","computed","key","value","left","shorthand","ArrayExpression","elems","elements","len","i","elem","RecordExpression","startToken","endToken","format","recordAndTupleSyntaxType","Error","JSON","stringify","TupleExpression","RegExpLiteral","pattern","flags","BooleanLiteral","NullLiteral","NumericLiteral","raw","getPossibleRaw","opts","jsescOption","numbers","number","jsesc","minified","StringLiteral","undefined","val","BigIntLiteral","DecimalLiteral","validTopicTokenSet","Set","TopicReference","topicToken","has","givenTopicTokenJSON","validTopics","Array","from","v","join","PipelineTopicExpression","expression","PipelineBareFunction","callee","PipelinePrimaryTopicReference"],"sources":["../../src/generators/types.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport { isAssignmentPattern, isIdentifier } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport jsesc from \"jsesc\";\n\nexport function Identifier(this: Printer, node: t.Identifier) {\n this.sourceIdentifierName(\n // @ts-expect-error Undocumented property identifierName\n node.loc?.identifierName || node.name,\n );\n this.word(node.name);\n}\n\nexport function ArgumentPlaceholder(this: Printer) {\n this.token(\"?\");\n}\n\nexport function RestElement(this: Printer, node: t.RestElement) {\n this.token(\"...\");\n this.print(node.argument, node);\n}\n\nexport { RestElement as SpreadElement };\n\nexport function ObjectExpression(this: Printer, node: t.ObjectExpression) {\n const props = node.properties;\n\n this.token(\"{\");\n\n if (props.length) {\n this.space();\n this.printList(props, node, { indent: true, statement: true });\n this.space();\n }\n\n this.sourceWithOffset(\"end\", node.loc, 0, -1);\n\n this.token(\"}\");\n}\n\nexport { ObjectExpression as ObjectPattern };\n\nexport function ObjectMethod(this: Printer, node: t.ObjectMethod) {\n this.printJoin(node.decorators, node);\n this._methodHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function ObjectProperty(this: Printer, node: t.ObjectProperty) {\n this.printJoin(node.decorators, node);\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key, node);\n this.token(\"]\");\n } else {\n // print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});`\n if (\n isAssignmentPattern(node.value) &&\n isIdentifier(node.key) &&\n // @ts-expect-error todo(flow->ts) `.name` does not exist on some types in union\n node.key.name === node.value.left.name\n ) {\n this.print(node.value, node);\n return;\n }\n\n this.print(node.key, node);\n\n // shorthand!\n if (\n node.shorthand &&\n isIdentifier(node.key) &&\n isIdentifier(node.value) &&\n node.key.name === node.value.name\n ) {\n return;\n }\n }\n\n this.token(\":\");\n this.space();\n this.print(node.value, node);\n}\n\nexport function ArrayExpression(this: Printer, node: t.ArrayExpression) {\n const elems = node.elements;\n const len = elems.length;\n\n this.token(\"[\");\n\n for (let i = 0; i < elems.length; i++) {\n const elem = elems[i];\n if (elem) {\n if (i > 0) this.space();\n this.print(elem, node);\n if (i < len - 1) this.token(\",\");\n } else {\n // If the array expression ends with a hole, that hole\n // will be ignored by the interpreter, but if it ends with\n // two (or more) holes, we need to write out two (or more)\n // commas so that the resulting code is interpreted with\n // both (all) of the holes.\n this.token(\",\");\n }\n }\n\n this.token(\"]\");\n}\n\nexport { ArrayExpression as ArrayPattern };\n\nexport function RecordExpression(this: Printer, node: t.RecordExpression) {\n const props = node.properties;\n\n let startToken;\n let endToken;\n if (this.format.recordAndTupleSyntaxType === \"bar\") {\n startToken = \"{|\";\n endToken = \"|}\";\n } else if (\n this.format.recordAndTupleSyntaxType !== \"hash\" &&\n this.format.recordAndTupleSyntaxType != null\n ) {\n throw new Error(\n `The \"recordAndTupleSyntaxType\" generator option must be \"bar\" or \"hash\" (${JSON.stringify(\n this.format.recordAndTupleSyntaxType,\n )} received).`,\n );\n } else {\n startToken = \"#{\";\n endToken = \"}\";\n }\n\n this.token(startToken);\n\n if (props.length) {\n this.space();\n this.printList(props, node, { indent: true, statement: true });\n this.space();\n }\n this.token(endToken);\n}\n\nexport function TupleExpression(this: Printer, node: t.TupleExpression) {\n const elems = node.elements;\n const len = elems.length;\n\n let startToken;\n let endToken;\n if (this.format.recordAndTupleSyntaxType === \"bar\") {\n startToken = \"[|\";\n endToken = \"|]\";\n } else if (this.format.recordAndTupleSyntaxType === \"hash\") {\n startToken = \"#[\";\n endToken = \"]\";\n } else {\n throw new Error(\n `${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`,\n );\n }\n\n this.token(startToken);\n\n for (let i = 0; i < elems.length; i++) {\n const elem = elems[i];\n if (elem) {\n if (i > 0) this.space();\n this.print(elem, node);\n if (i < len - 1) this.token(\",\");\n }\n }\n\n this.token(endToken);\n}\n\nexport function RegExpLiteral(this: Printer, node: t.RegExpLiteral) {\n this.word(`/${node.pattern}/${node.flags}`);\n}\n\nexport function BooleanLiteral(this: Printer, node: t.BooleanLiteral) {\n this.word(node.value ? \"true\" : \"false\");\n}\n\nexport function NullLiteral(this: Printer) {\n this.word(\"null\");\n}\n\nexport function NumericLiteral(this: Printer, node: t.NumericLiteral) {\n const raw = this.getPossibleRaw(node);\n const opts = this.format.jsescOption;\n const value = node.value + \"\";\n if (opts.numbers) {\n this.number(jsesc(node.value, opts));\n } else if (raw == null) {\n this.number(value); // normalize\n } else if (this.format.minified) {\n this.number(raw.length < value.length ? raw : value);\n } else {\n this.number(raw);\n }\n}\n\nexport function StringLiteral(this: Printer, node: t.StringLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.token(raw);\n return;\n }\n\n const val = jsesc(node.value, this.format.jsescOption);\n\n this.token(val);\n}\n\nexport function BigIntLiteral(this: Printer, node: t.BigIntLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.word(raw);\n return;\n }\n this.word(node.value + \"n\");\n}\n\nexport function DecimalLiteral(this: Printer, node: t.DecimalLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.word(raw);\n return;\n }\n this.word(node.value + \"m\");\n}\n\n// Hack pipe operator\nconst validTopicTokenSet = new Set([\"^^\", \"@@\", \"^\", \"%\", \"#\"]);\nexport function TopicReference(this: Printer) {\n const { topicToken } = this.format;\n\n if (validTopicTokenSet.has(topicToken)) {\n this.token(topicToken);\n } else {\n const givenTopicTokenJSON = JSON.stringify(topicToken);\n const validTopics = Array.from(validTopicTokenSet, v => JSON.stringify(v));\n throw new Error(\n `The \"topicToken\" generator option must be one of ` +\n `${validTopics.join(\", \")} (${givenTopicTokenJSON} received instead).`,\n );\n }\n}\n\n// Smart-mix pipe operator\nexport function PipelineTopicExpression(\n this: Printer,\n node: t.PipelineTopicExpression,\n) {\n this.print(node.expression, node);\n}\n\nexport function PipelineBareFunction(\n this: Printer,\n node: t.PipelineBareFunction,\n) {\n this.print(node.callee, node);\n}\n\nexport function PipelinePrimaryTopicReference(this: Printer) {\n this.token(\"#\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,EAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAA0B;EAFjBE,mBAAmB;EAAEC;AAAY,IAAAJ,EAAA;AAInC,SAASK,UAAUA,CAAgBC,IAAkB,EAAE;EAAA,IAAAC,SAAA;EAC5D,IAAI,CAACC,oBAAoB,CAEvB,EAAAD,SAAA,GAAAD,IAAI,CAACG,GAAG,qBAARF,SAAA,CAAUG,cAAc,KAAIJ,IAAI,CAACK,IAAI,CACtC;EACD,IAAI,CAACC,IAAI,CAACN,IAAI,CAACK,IAAI,CAAC;AACtB;AAEO,SAASE,mBAAmBA,CAAA,EAAgB;EACjD,IAAI,CAACC,SAAK,IAAK;AACjB;AAEO,SAASC,WAAWA,CAAgBT,IAAmB,EAAE;EAC9D,IAAI,CAACQ,KAAK,CAAC,KAAK,CAAC;EACjB,IAAI,CAACE,KAAK,CAACV,IAAI,CAACW,QAAQ,EAAEX,IAAI,CAAC;AACjC;AAIO,SAASY,gBAAgBA,CAAgBZ,IAAwB,EAAE;EACxE,MAAMa,KAAK,GAAGb,IAAI,CAACc,UAAU;EAE7B,IAAI,CAACN,SAAK,KAAK;EAEf,IAAIK,KAAK,CAACE,MAAM,EAAE;IAChB,IAAI,CAACC,KAAK,EAAE;IACZ,IAAI,CAACC,SAAS,CAACJ,KAAK,EAAEb,IAAI,EAAE;MAAEkB,MAAM,EAAE,IAAI;MAAEC,SAAS,EA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kB,GAAG,IAAIC,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,SAASC,cAAcA,CAAA,EAAgB;EAC5C,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAI,CAAC5B,MAAM;EAElC,IAAIyB,kBAAkB,CAACI,GAAG,CAACD,UAAU,CAAC,EAAE;IACtC,IAAI,CAAC7D,KAAK,CAAC6D,UAAU,CAAC;EACxB,CAAC,MAAM;IACL,MAAME,mBAAmB,GAAG3B,IAAI,CAACC,SAAS,CAACwB,UAAU,CAAC;IACtD,MAAMG,WAAW,GAAGC,KAAK,CAACC,IAAI,CAACR,kBAAkB,EAAES,CAAC,IAAI/B,IAAI,CAACC,SAAS,CAAC8B,CAAC,CAAC,CAAC;IAC1E,MAAM,IAAIhC,KAAK,CACZ,mDAAkD,GAChD,GAAE6B,WAAW,CAACI,IAAI,CAAC,IAAI,CAAE,KAAIL,mBAAoB,qBAAoB,CACzE;EACH;AACF;AAGO,SAASM,uBAAuBA,CAErC7E,IAA+B,EAC/B;EACA,IAAI,CAACU,KAAK,CAACV,IAAI,CAAC8E,UAAU,EAAE9E,IAAI,CAAC;AACnC;AAEO,SAAS+E,oBAAoBA,CAElC/E,IAA4B,EAC5B;EACA,IAAI,CAACU,KAAK,CAACV,IAAI,CAACgF,MAAM,EAAEhF,IAAI,CAAC;AAC/B;AAEO,SAASiF,6BAA6BA,CAAA,EAAgB;EAC3D,IAAI,CAACzE,SAAK,IAAK;AACjB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/typescript.js b/node_modules/@babel/generator/lib/generators/typescript.js deleted file mode 100644 index 9d621d231..000000000 --- a/node_modules/@babel/generator/lib/generators/typescript.js +++ /dev/null @@ -1,694 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.TSAnyKeyword = TSAnyKeyword; -exports.TSArrayType = TSArrayType; -exports.TSSatisfiesExpression = exports.TSAsExpression = TSTypeExpression; -exports.TSBigIntKeyword = TSBigIntKeyword; -exports.TSBooleanKeyword = TSBooleanKeyword; -exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration; -exports.TSConditionalType = TSConditionalType; -exports.TSConstructSignatureDeclaration = TSConstructSignatureDeclaration; -exports.TSConstructorType = TSConstructorType; -exports.TSDeclareFunction = TSDeclareFunction; -exports.TSDeclareMethod = TSDeclareMethod; -exports.TSEnumDeclaration = TSEnumDeclaration; -exports.TSEnumMember = TSEnumMember; -exports.TSExportAssignment = TSExportAssignment; -exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments; -exports.TSExternalModuleReference = TSExternalModuleReference; -exports.TSFunctionType = TSFunctionType; -exports.TSImportEqualsDeclaration = TSImportEqualsDeclaration; -exports.TSImportType = TSImportType; -exports.TSIndexSignature = TSIndexSignature; -exports.TSIndexedAccessType = TSIndexedAccessType; -exports.TSInferType = TSInferType; -exports.TSInstantiationExpression = TSInstantiationExpression; -exports.TSInterfaceBody = TSInterfaceBody; -exports.TSInterfaceDeclaration = TSInterfaceDeclaration; -exports.TSIntersectionType = TSIntersectionType; -exports.TSIntrinsicKeyword = TSIntrinsicKeyword; -exports.TSLiteralType = TSLiteralType; -exports.TSMappedType = TSMappedType; -exports.TSMethodSignature = TSMethodSignature; -exports.TSModuleBlock = TSModuleBlock; -exports.TSModuleDeclaration = TSModuleDeclaration; -exports.TSNamedTupleMember = TSNamedTupleMember; -exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration; -exports.TSNeverKeyword = TSNeverKeyword; -exports.TSNonNullExpression = TSNonNullExpression; -exports.TSNullKeyword = TSNullKeyword; -exports.TSNumberKeyword = TSNumberKeyword; -exports.TSObjectKeyword = TSObjectKeyword; -exports.TSOptionalType = TSOptionalType; -exports.TSParameterProperty = TSParameterProperty; -exports.TSParenthesizedType = TSParenthesizedType; -exports.TSPropertySignature = TSPropertySignature; -exports.TSQualifiedName = TSQualifiedName; -exports.TSRestType = TSRestType; -exports.TSStringKeyword = TSStringKeyword; -exports.TSSymbolKeyword = TSSymbolKeyword; -exports.TSThisType = TSThisType; -exports.TSTupleType = TSTupleType; -exports.TSTypeAliasDeclaration = TSTypeAliasDeclaration; -exports.TSTypeAnnotation = TSTypeAnnotation; -exports.TSTypeAssertion = TSTypeAssertion; -exports.TSTypeLiteral = TSTypeLiteral; -exports.TSTypeOperator = TSTypeOperator; -exports.TSTypeParameter = TSTypeParameter; -exports.TSTypeParameterDeclaration = exports.TSTypeParameterInstantiation = TSTypeParameterInstantiation; -exports.TSTypePredicate = TSTypePredicate; -exports.TSTypeQuery = TSTypeQuery; -exports.TSTypeReference = TSTypeReference; -exports.TSUndefinedKeyword = TSUndefinedKeyword; -exports.TSUnionType = TSUnionType; -exports.TSUnknownKeyword = TSUnknownKeyword; -exports.TSVoidKeyword = TSVoidKeyword; -exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers; -exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType; -exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName; -exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase; -exports.tsPrintTypeLiteralOrInterfaceBody = tsPrintTypeLiteralOrInterfaceBody; -function TSTypeAnnotation(node) { - this.tokenChar(58); - this.space(); - if (node.optional) this.tokenChar(63); - this.print(node.typeAnnotation, node); -} -function TSTypeParameterInstantiation(node, parent) { - this.tokenChar(60); - this.printList(node.params, node, {}); - if (parent.type === "ArrowFunctionExpression" && node.params.length === 1) { - this.tokenChar(44); - } - this.tokenChar(62); -} -function TSTypeParameter(node) { - if (node.in) { - this.word("in"); - this.space(); - } - if (node.out) { - this.word("out"); - this.space(); - } - this.word(node.name); - if (node.constraint) { - this.space(); - this.word("extends"); - this.space(); - this.print(node.constraint, node); - } - if (node.default) { - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.default, node); - } -} -function TSParameterProperty(node) { - if (node.accessibility) { - this.word(node.accessibility); - this.space(); - } - if (node.readonly) { - this.word("readonly"); - this.space(); - } - this._param(node.parameter); -} -function TSDeclareFunction(node, parent) { - if (node.declare) { - this.word("declare"); - this.space(); - } - this._functionHead(node, parent); - this.tokenChar(59); -} -function TSDeclareMethod(node) { - this._classMethodHead(node); - this.tokenChar(59); -} -function TSQualifiedName(node) { - this.print(node.left, node); - this.tokenChar(46); - this.print(node.right, node); -} -function TSCallSignatureDeclaration(node) { - this.tsPrintSignatureDeclarationBase(node); - this.tokenChar(59); -} -function TSConstructSignatureDeclaration(node) { - this.word("new"); - this.space(); - this.tsPrintSignatureDeclarationBase(node); - this.tokenChar(59); -} -function TSPropertySignature(node) { - const { - readonly, - initializer - } = node; - if (readonly) { - this.word("readonly"); - this.space(); - } - this.tsPrintPropertyOrMethodName(node); - this.print(node.typeAnnotation, node); - if (initializer) { - this.space(); - this.tokenChar(61); - this.space(); - this.print(initializer, node); - } - this.tokenChar(59); -} -function tsPrintPropertyOrMethodName(node) { - if (node.computed) { - this.tokenChar(91); - } - this.print(node.key, node); - if (node.computed) { - this.tokenChar(93); - } - if (node.optional) { - this.tokenChar(63); - } -} -function TSMethodSignature(node) { - const { - kind - } = node; - if (kind === "set" || kind === "get") { - this.word(kind); - this.space(); - } - this.tsPrintPropertyOrMethodName(node); - this.tsPrintSignatureDeclarationBase(node); - this.tokenChar(59); -} -function TSIndexSignature(node) { - const { - readonly, - static: isStatic - } = node; - if (isStatic) { - this.word("static"); - this.space(); - } - if (readonly) { - this.word("readonly"); - this.space(); - } - this.tokenChar(91); - this._parameters(node.parameters, node); - this.tokenChar(93); - this.print(node.typeAnnotation, node); - this.tokenChar(59); -} -function TSAnyKeyword() { - this.word("any"); -} -function TSBigIntKeyword() { - this.word("bigint"); -} -function TSUnknownKeyword() { - this.word("unknown"); -} -function TSNumberKeyword() { - this.word("number"); -} -function TSObjectKeyword() { - this.word("object"); -} -function TSBooleanKeyword() { - this.word("boolean"); -} -function TSStringKeyword() { - this.word("string"); -} -function TSSymbolKeyword() { - this.word("symbol"); -} -function TSVoidKeyword() { - this.word("void"); -} -function TSUndefinedKeyword() { - this.word("undefined"); -} -function TSNullKeyword() { - this.word("null"); -} -function TSNeverKeyword() { - this.word("never"); -} -function TSIntrinsicKeyword() { - this.word("intrinsic"); -} -function TSThisType() { - this.word("this"); -} -function TSFunctionType(node) { - this.tsPrintFunctionOrConstructorType(node); -} -function TSConstructorType(node) { - if (node.abstract) { - this.word("abstract"); - this.space(); - } - this.word("new"); - this.space(); - this.tsPrintFunctionOrConstructorType(node); -} -function tsPrintFunctionOrConstructorType(node) { - const { - typeParameters - } = node; - const parameters = node.parameters; - this.print(typeParameters, node); - this.tokenChar(40); - this._parameters(parameters, node); - this.tokenChar(41); - this.space(); - this.token("=>"); - this.space(); - const returnType = node.typeAnnotation; - this.print(returnType.typeAnnotation, node); -} -function TSTypeReference(node) { - this.print(node.typeName, node, true); - this.print(node.typeParameters, node, true); -} -function TSTypePredicate(node) { - if (node.asserts) { - this.word("asserts"); - this.space(); - } - this.print(node.parameterName); - if (node.typeAnnotation) { - this.space(); - this.word("is"); - this.space(); - this.print(node.typeAnnotation.typeAnnotation); - } -} -function TSTypeQuery(node) { - this.word("typeof"); - this.space(); - this.print(node.exprName); - if (node.typeParameters) { - this.print(node.typeParameters, node); - } -} -function TSTypeLiteral(node) { - this.tsPrintTypeLiteralOrInterfaceBody(node.members, node); -} -function tsPrintTypeLiteralOrInterfaceBody(members, node) { - tsPrintBraced(this, members, node); -} -function tsPrintBraced(printer, members, node) { - printer.token("{"); - if (members.length) { - printer.indent(); - printer.newline(); - for (const member of members) { - printer.print(member, node); - printer.newline(); - } - printer.dedent(); - } - printer.rightBrace(node); -} -function TSArrayType(node) { - this.print(node.elementType, node, true); - this.token("[]"); -} -function TSTupleType(node) { - this.tokenChar(91); - this.printList(node.elementTypes, node); - this.tokenChar(93); -} -function TSOptionalType(node) { - this.print(node.typeAnnotation, node); - this.tokenChar(63); -} -function TSRestType(node) { - this.token("..."); - this.print(node.typeAnnotation, node); -} -function TSNamedTupleMember(node) { - this.print(node.label, node); - if (node.optional) this.tokenChar(63); - this.tokenChar(58); - this.space(); - this.print(node.elementType, node); -} -function TSUnionType(node) { - tsPrintUnionOrIntersectionType(this, node, "|"); -} -function TSIntersectionType(node) { - tsPrintUnionOrIntersectionType(this, node, "&"); -} -function tsPrintUnionOrIntersectionType(printer, node, sep) { - printer.printJoin(node.types, node, { - separator() { - this.space(); - this.token(sep); - this.space(); - } - }); -} -function TSConditionalType(node) { - this.print(node.checkType); - this.space(); - this.word("extends"); - this.space(); - this.print(node.extendsType); - this.space(); - this.tokenChar(63); - this.space(); - this.print(node.trueType); - this.space(); - this.tokenChar(58); - this.space(); - this.print(node.falseType); -} -function TSInferType(node) { - this.token("infer"); - this.space(); - this.print(node.typeParameter); -} -function TSParenthesizedType(node) { - this.tokenChar(40); - this.print(node.typeAnnotation, node); - this.tokenChar(41); -} -function TSTypeOperator(node) { - this.word(node.operator); - this.space(); - this.print(node.typeAnnotation, node); -} -function TSIndexedAccessType(node) { - this.print(node.objectType, node, true); - this.tokenChar(91); - this.print(node.indexType, node); - this.tokenChar(93); -} -function TSMappedType(node) { - const { - nameType, - optional, - readonly, - typeParameter - } = node; - this.tokenChar(123); - this.space(); - if (readonly) { - tokenIfPlusMinus(this, readonly); - this.word("readonly"); - this.space(); - } - this.tokenChar(91); - this.word(typeParameter.name); - this.space(); - this.word("in"); - this.space(); - this.print(typeParameter.constraint, typeParameter); - if (nameType) { - this.space(); - this.word("as"); - this.space(); - this.print(nameType, node); - } - this.tokenChar(93); - if (optional) { - tokenIfPlusMinus(this, optional); - this.tokenChar(63); - } - this.tokenChar(58); - this.space(); - this.print(node.typeAnnotation, node); - this.space(); - this.tokenChar(125); -} -function tokenIfPlusMinus(self, tok) { - if (tok !== true) { - self.token(tok); - } -} -function TSLiteralType(node) { - this.print(node.literal, node); -} -function TSExpressionWithTypeArguments(node) { - this.print(node.expression, node); - this.print(node.typeParameters, node); -} -function TSInterfaceDeclaration(node) { - const { - declare, - id, - typeParameters, - extends: extendz, - body - } = node; - if (declare) { - this.word("declare"); - this.space(); - } - this.word("interface"); - this.space(); - this.print(id, node); - this.print(typeParameters, node); - if (extendz != null && extendz.length) { - this.space(); - this.word("extends"); - this.space(); - this.printList(extendz, node); - } - this.space(); - this.print(body, node); -} -function TSInterfaceBody(node) { - this.tsPrintTypeLiteralOrInterfaceBody(node.body, node); -} -function TSTypeAliasDeclaration(node) { - const { - declare, - id, - typeParameters, - typeAnnotation - } = node; - if (declare) { - this.word("declare"); - this.space(); - } - this.word("type"); - this.space(); - this.print(id, node); - this.print(typeParameters, node); - this.space(); - this.tokenChar(61); - this.space(); - this.print(typeAnnotation, node); - this.tokenChar(59); -} -function TSTypeExpression(node) { - var _expression$trailingC; - const { - type, - expression, - typeAnnotation - } = node; - const forceParens = !!((_expression$trailingC = expression.trailingComments) != null && _expression$trailingC.length); - this.print(expression, node, true, undefined, forceParens); - this.space(); - this.word(type === "TSAsExpression" ? "as" : "satisfies"); - this.space(); - this.print(typeAnnotation, node); -} -function TSTypeAssertion(node) { - const { - typeAnnotation, - expression - } = node; - this.tokenChar(60); - this.print(typeAnnotation, node); - this.tokenChar(62); - this.space(); - this.print(expression, node); -} -function TSInstantiationExpression(node) { - this.print(node.expression, node); - this.print(node.typeParameters, node); -} -function TSEnumDeclaration(node) { - const { - declare, - const: isConst, - id, - members - } = node; - if (declare) { - this.word("declare"); - this.space(); - } - if (isConst) { - this.word("const"); - this.space(); - } - this.word("enum"); - this.space(); - this.print(id, node); - this.space(); - tsPrintBraced(this, members, node); -} -function TSEnumMember(node) { - const { - id, - initializer - } = node; - this.print(id, node); - if (initializer) { - this.space(); - this.tokenChar(61); - this.space(); - this.print(initializer, node); - } - this.tokenChar(44); -} -function TSModuleDeclaration(node) { - const { - declare, - id - } = node; - if (declare) { - this.word("declare"); - this.space(); - } - if (!node.global) { - this.word(id.type === "Identifier" ? "namespace" : "module"); - this.space(); - } - this.print(id, node); - if (!node.body) { - this.tokenChar(59); - return; - } - let body = node.body; - while (body.type === "TSModuleDeclaration") { - this.tokenChar(46); - this.print(body.id, body); - body = body.body; - } - this.space(); - this.print(body, node); -} -function TSModuleBlock(node) { - tsPrintBraced(this, node.body, node); -} -function TSImportType(node) { - const { - argument, - qualifier, - typeParameters - } = node; - this.word("import"); - this.tokenChar(40); - this.print(argument, node); - this.tokenChar(41); - if (qualifier) { - this.tokenChar(46); - this.print(qualifier, node); - } - if (typeParameters) { - this.print(typeParameters, node); - } -} -function TSImportEqualsDeclaration(node) { - const { - isExport, - id, - moduleReference - } = node; - if (isExport) { - this.word("export"); - this.space(); - } - this.word("import"); - this.space(); - this.print(id, node); - this.space(); - this.tokenChar(61); - this.space(); - this.print(moduleReference, node); - this.tokenChar(59); -} -function TSExternalModuleReference(node) { - this.token("require("); - this.print(node.expression, node); - this.tokenChar(41); -} -function TSNonNullExpression(node) { - this.print(node.expression, node); - this.tokenChar(33); -} -function TSExportAssignment(node) { - this.word("export"); - this.space(); - this.tokenChar(61); - this.space(); - this.print(node.expression, node); - this.tokenChar(59); -} -function TSNamespaceExportDeclaration(node) { - this.word("export"); - this.space(); - this.word("as"); - this.space(); - this.word("namespace"); - this.space(); - this.print(node.id, node); -} -function tsPrintSignatureDeclarationBase(node) { - const { - typeParameters - } = node; - const parameters = node.parameters; - this.print(typeParameters, node); - this.tokenChar(40); - this._parameters(parameters, node); - this.tokenChar(41); - const returnType = node.typeAnnotation; - this.print(returnType, node); -} -function tsPrintClassMemberModifiers(node) { - const isField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty"; - if (isField && node.declare) { - this.word("declare"); - this.space(); - } - if (node.accessibility) { - this.word(node.accessibility); - this.space(); - } - if (node.static) { - this.word("static"); - this.space(); - } - if (node.override) { - this.word("override"); - this.space(); - } - if (node.abstract) { - this.word("abstract"); - this.space(); - } - if (isField && node.readonly) { - this.word("readonly"); - this.space(); - } -} - -//# sourceMappingURL=typescript.js.map diff --git a/node_modules/@babel/generator/lib/generators/typescript.js.map b/node_modules/@babel/generator/lib/generators/typescript.js.map deleted file mode 100644 index d89344c34..000000000 --- a/node_modules/@babel/generator/lib/generators/typescript.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["TSTypeAnnotation","node","token","space","optional","print","typeAnnotation","TSTypeParameterInstantiation","parent","printList","params","type","length","TSTypeParameter","in","word","out","name","constraint","default","TSParameterProperty","accessibility","readonly","_param","parameter","TSDeclareFunction","declare","_functionHead","TSDeclareMethod","_classMethodHead","TSQualifiedName","left","right","TSCallSignatureDeclaration","tsPrintSignatureDeclarationBase","TSConstructSignatureDeclaration","TSPropertySignature","initializer","tsPrintPropertyOrMethodName","computed","key","TSMethodSignature","kind","TSIndexSignature","static","isStatic","_parameters","parameters","TSAnyKeyword","TSBigIntKeyword","TSUnknownKeyword","TSNumberKeyword","TSObjectKeyword","TSBooleanKeyword","TSStringKeyword","TSSymbolKeyword","TSVoidKeyword","TSUndefinedKeyword","TSNullKeyword","TSNeverKeyword","TSIntrinsicKeyword","TSThisType","TSFunctionType","tsPrintFunctionOrConstructorType","TSConstructorType","abstract","typeParameters","returnType","TSTypeReference","typeName","TSTypePredicate","asserts","parameterName","TSTypeQuery","exprName","TSTypeLiteral","tsPrintTypeLiteralOrInterfaceBody","members","tsPrintBraced","printer","indent","newline","member","dedent","rightBrace","TSArrayType","elementType","TSTupleType","elementTypes","TSOptionalType","TSRestType","TSNamedTupleMember","label","TSUnionType","tsPrintUnionOrIntersectionType","TSIntersectionType","sep","printJoin","types","separator","TSConditionalType","checkType","extendsType","trueType","falseType","TSInferType","typeParameter","TSParenthesizedType","TSTypeOperator","operator","TSIndexedAccessType","objectType","indexType","TSMappedType","nameType","tokenIfPlusMinus","self","tok","TSLiteralType","literal","TSExpressionWithTypeArguments","expression","TSInterfaceDeclaration","id","extends","extendz","body","TSInterfaceBody","TSTypeAliasDeclaration","TSTypeExpression","_expression$trailingC","forceParens","trailingComments","undefined","TSTypeAssertion","TSInstantiationExpression","TSEnumDeclaration","const","isConst","TSEnumMember","TSModuleDeclaration","global","TSModuleBlock","TSImportType","argument","qualifier","TSImportEqualsDeclaration","isExport","moduleReference","TSExternalModuleReference","TSNonNullExpression","TSExportAssignment","TSNamespaceExportDeclaration","tsPrintClassMemberModifiers","isField","override"],"sources":["../../src/generators/typescript.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\nexport function TSTypeAnnotation(this: Printer, node: t.TSTypeAnnotation) {\n this.token(\":\");\n this.space();\n // @ts-expect-error todo(flow->ts) can this be removed? `.optional` looks to be not existing property\n if (node.optional) this.token(\"?\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function TSTypeParameterInstantiation(\n this: Printer,\n node: t.TSTypeParameterInstantiation,\n parent: t.Node,\n): void {\n this.token(\"<\");\n this.printList(node.params, node, {});\n if (parent.type === \"ArrowFunctionExpression\" && node.params.length === 1) {\n this.token(\",\");\n }\n this.token(\">\");\n}\n\nexport { TSTypeParameterInstantiation as TSTypeParameterDeclaration };\n\nexport function TSTypeParameter(this: Printer, node: t.TSTypeParameter) {\n if (node.in) {\n this.word(\"in\");\n this.space();\n }\n\n if (node.out) {\n this.word(\"out\");\n this.space();\n }\n\n this.word(\n !process.env.BABEL_8_BREAKING\n ? (node.name as unknown as string)\n : (node.name as unknown as t.Identifier).name,\n );\n\n if (node.constraint) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.constraint, node);\n }\n\n if (node.default) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.default, node);\n }\n}\n\nexport function TSParameterProperty(\n this: Printer,\n node: t.TSParameterProperty,\n) {\n if (node.accessibility) {\n this.word(node.accessibility);\n this.space();\n }\n\n if (node.readonly) {\n this.word(\"readonly\");\n this.space();\n }\n\n this._param(node.parameter);\n}\n\nexport function TSDeclareFunction(\n this: Printer,\n node: t.TSDeclareFunction,\n parent: NodePath[\"parent\"],\n) {\n if (node.declare) {\n this.word(\"declare\");\n this.space();\n }\n this._functionHead(node, parent);\n this.token(\";\");\n}\n\nexport function TSDeclareMethod(this: Printer, node: t.TSDeclareMethod) {\n this._classMethodHead(node);\n this.token(\";\");\n}\n\nexport function TSQualifiedName(this: Printer, node: t.TSQualifiedName) {\n this.print(node.left, node);\n this.token(\".\");\n this.print(node.right, node);\n}\n\nexport function TSCallSignatureDeclaration(\n this: Printer,\n node: t.TSCallSignatureDeclaration,\n) {\n this.tsPrintSignatureDeclarationBase(node);\n this.token(\";\");\n}\n\nexport function TSConstructSignatureDeclaration(\n this: Printer,\n node: t.TSConstructSignatureDeclaration,\n) {\n this.word(\"new\");\n this.space();\n this.tsPrintSignatureDeclarationBase(node);\n this.token(\";\");\n}\n\nexport function TSPropertySignature(\n this: Printer,\n node: t.TSPropertySignature,\n) {\n const { readonly, initializer } = node;\n if (readonly) {\n this.word(\"readonly\");\n this.space();\n }\n this.tsPrintPropertyOrMethodName(node);\n this.print(node.typeAnnotation, node);\n if (initializer) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(initializer, node);\n }\n this.token(\";\");\n}\n\nexport function tsPrintPropertyOrMethodName(\n this: Printer,\n node: t.TSPropertySignature | t.TSMethodSignature,\n) {\n if (node.computed) {\n this.token(\"[\");\n }\n this.print(node.key, node);\n if (node.computed) {\n this.token(\"]\");\n }\n if (node.optional) {\n this.token(\"?\");\n }\n}\n\nexport function TSMethodSignature(this: Printer, node: t.TSMethodSignature) {\n const { kind } = node;\n if (kind === \"set\" || kind === \"get\") {\n this.word(kind);\n this.space();\n }\n this.tsPrintPropertyOrMethodName(node);\n this.tsPrintSignatureDeclarationBase(node);\n this.token(\";\");\n}\n\nexport function TSIndexSignature(this: Printer, node: t.TSIndexSignature) {\n const { readonly, static: isStatic } = node;\n if (isStatic) {\n this.word(\"static\");\n this.space();\n }\n if (readonly) {\n this.word(\"readonly\");\n this.space();\n }\n this.token(\"[\");\n this._parameters(node.parameters, node);\n this.token(\"]\");\n this.print(node.typeAnnotation, node);\n this.token(\";\");\n}\n\nexport function TSAnyKeyword(this: Printer) {\n this.word(\"any\");\n}\nexport function TSBigIntKeyword(this: Printer) {\n this.word(\"bigint\");\n}\nexport function TSUnknownKeyword(this: Printer) {\n this.word(\"unknown\");\n}\nexport function TSNumberKeyword(this: Printer) {\n this.word(\"number\");\n}\nexport function TSObjectKeyword(this: Printer) {\n this.word(\"object\");\n}\nexport function TSBooleanKeyword(this: Printer) {\n this.word(\"boolean\");\n}\nexport function TSStringKeyword(this: Printer) {\n this.word(\"string\");\n}\nexport function TSSymbolKeyword(this: Printer) {\n this.word(\"symbol\");\n}\nexport function TSVoidKeyword(this: Printer) {\n this.word(\"void\");\n}\nexport function TSUndefinedKeyword(this: Printer) {\n this.word(\"undefined\");\n}\nexport function TSNullKeyword(this: Printer) {\n this.word(\"null\");\n}\nexport function TSNeverKeyword(this: Printer) {\n this.word(\"never\");\n}\nexport function TSIntrinsicKeyword(this: Printer) {\n this.word(\"intrinsic\");\n}\n\nexport function TSThisType(this: Printer) {\n this.word(\"this\");\n}\n\nexport function TSFunctionType(this: Printer, node: t.TSFunctionType) {\n this.tsPrintFunctionOrConstructorType(node);\n}\n\nexport function TSConstructorType(this: Printer, node: t.TSConstructorType) {\n if (node.abstract) {\n this.word(\"abstract\");\n this.space();\n }\n this.word(\"new\");\n this.space();\n this.tsPrintFunctionOrConstructorType(node);\n}\n\nexport function tsPrintFunctionOrConstructorType(\n this: Printer,\n node: t.TSFunctionType | t.TSConstructorType,\n) {\n const { typeParameters } = node;\n const parameters = process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n node.params\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n node.parameters;\n this.print(typeParameters, node);\n this.token(\"(\");\n this._parameters(parameters, node);\n this.token(\")\");\n this.space();\n this.token(\"=>\");\n this.space();\n const returnType = process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n node.returnType\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n node.typeAnnotation;\n this.print(returnType.typeAnnotation, node);\n}\n\nexport function TSTypeReference(this: Printer, node: t.TSTypeReference) {\n this.print(node.typeName, node, true);\n this.print(node.typeParameters, node, true);\n}\n\nexport function TSTypePredicate(this: Printer, node: t.TSTypePredicate) {\n if (node.asserts) {\n this.word(\"asserts\");\n this.space();\n }\n this.print(node.parameterName);\n if (node.typeAnnotation) {\n this.space();\n this.word(\"is\");\n this.space();\n this.print(node.typeAnnotation.typeAnnotation);\n }\n}\n\nexport function TSTypeQuery(this: Printer, node: t.TSTypeQuery) {\n this.word(\"typeof\");\n this.space();\n this.print(node.exprName);\n\n if (node.typeParameters) {\n this.print(node.typeParameters, node);\n }\n}\n\nexport function TSTypeLiteral(this: Printer, node: t.TSTypeLiteral) {\n this.tsPrintTypeLiteralOrInterfaceBody(node.members, node);\n}\n\nexport function tsPrintTypeLiteralOrInterfaceBody(\n this: Printer,\n members: t.TSTypeElement[],\n node: t.TSType | t.TSInterfaceBody,\n) {\n tsPrintBraced(this, members, node);\n}\n\nfunction tsPrintBraced(printer: Printer, members: t.Node[], node: t.Node) {\n printer.token(\"{\");\n if (members.length) {\n printer.indent();\n printer.newline();\n for (const member of members) {\n printer.print(member, node);\n //this.token(sep);\n printer.newline();\n }\n printer.dedent();\n }\n\n printer.rightBrace(node);\n}\n\nexport function TSArrayType(this: Printer, node: t.TSArrayType) {\n this.print(node.elementType, node, true);\n\n this.token(\"[]\");\n}\n\nexport function TSTupleType(this: Printer, node: t.TSTupleType) {\n this.token(\"[\");\n this.printList(node.elementTypes, node);\n this.token(\"]\");\n}\n\nexport function TSOptionalType(this: Printer, node: t.TSOptionalType) {\n this.print(node.typeAnnotation, node);\n this.token(\"?\");\n}\n\nexport function TSRestType(this: Printer, node: t.TSRestType) {\n this.token(\"...\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function TSNamedTupleMember(this: Printer, node: t.TSNamedTupleMember) {\n this.print(node.label, node);\n if (node.optional) this.token(\"?\");\n this.token(\":\");\n this.space();\n this.print(node.elementType, node);\n}\n\nexport function TSUnionType(this: Printer, node: t.TSUnionType) {\n tsPrintUnionOrIntersectionType(this, node, \"|\");\n}\n\nexport function TSIntersectionType(this: Printer, node: t.TSIntersectionType) {\n tsPrintUnionOrIntersectionType(this, node, \"&\");\n}\n\nfunction tsPrintUnionOrIntersectionType(\n printer: Printer,\n node: t.TSUnionType | t.TSIntersectionType,\n sep: \"|\" | \"&\",\n) {\n printer.printJoin(node.types, node, {\n separator() {\n this.space();\n this.token(sep);\n this.space();\n },\n });\n}\n\nexport function TSConditionalType(this: Printer, node: t.TSConditionalType) {\n this.print(node.checkType);\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.extendsType);\n this.space();\n this.token(\"?\");\n this.space();\n this.print(node.trueType);\n this.space();\n this.token(\":\");\n this.space();\n this.print(node.falseType);\n}\n\nexport function TSInferType(this: Printer, node: t.TSInferType) {\n this.token(\"infer\");\n this.space();\n this.print(node.typeParameter);\n}\n\nexport function TSParenthesizedType(\n this: Printer,\n node: t.TSParenthesizedType,\n) {\n this.token(\"(\");\n this.print(node.typeAnnotation, node);\n this.token(\")\");\n}\n\nexport function TSTypeOperator(this: Printer, node: t.TSTypeOperator) {\n this.word(node.operator);\n this.space();\n this.print(node.typeAnnotation, node);\n}\n\nexport function TSIndexedAccessType(\n this: Printer,\n node: t.TSIndexedAccessType,\n) {\n this.print(node.objectType, node, true);\n this.token(\"[\");\n this.print(node.indexType, node);\n this.token(\"]\");\n}\n\nexport function TSMappedType(this: Printer, node: t.TSMappedType) {\n const { nameType, optional, readonly, typeParameter } = node;\n this.token(\"{\");\n this.space();\n if (readonly) {\n tokenIfPlusMinus(this, readonly);\n this.word(\"readonly\");\n this.space();\n }\n\n this.token(\"[\");\n this.word(\n !process.env.BABEL_8_BREAKING\n ? (typeParameter.name as unknown as string)\n : (typeParameter.name as unknown as t.Identifier).name,\n );\n this.space();\n this.word(\"in\");\n this.space();\n this.print(typeParameter.constraint, typeParameter);\n\n if (nameType) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(nameType, node);\n }\n\n this.token(\"]\");\n\n if (optional) {\n tokenIfPlusMinus(this, optional);\n this.token(\"?\");\n }\n this.token(\":\");\n this.space();\n this.print(node.typeAnnotation, node);\n this.space();\n this.token(\"}\");\n}\n\nfunction tokenIfPlusMinus(self: Printer, tok: true | \"+\" | \"-\") {\n if (tok !== true) {\n self.token(tok);\n }\n}\n\nexport function TSLiteralType(this: Printer, node: t.TSLiteralType) {\n this.print(node.literal, node);\n}\n\nexport function TSExpressionWithTypeArguments(\n this: Printer,\n node: t.TSExpressionWithTypeArguments,\n) {\n this.print(node.expression, node);\n this.print(node.typeParameters, node);\n}\n\nexport function TSInterfaceDeclaration(\n this: Printer,\n node: t.TSInterfaceDeclaration,\n) {\n const { declare, id, typeParameters, extends: extendz, body } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"interface\");\n this.space();\n this.print(id, node);\n this.print(typeParameters, node);\n if (extendz?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(extendz, node);\n }\n this.space();\n this.print(body, node);\n}\n\nexport function TSInterfaceBody(this: Printer, node: t.TSInterfaceBody) {\n this.tsPrintTypeLiteralOrInterfaceBody(node.body, node);\n}\n\nexport function TSTypeAliasDeclaration(\n this: Printer,\n node: t.TSTypeAliasDeclaration,\n) {\n const { declare, id, typeParameters, typeAnnotation } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"type\");\n this.space();\n this.print(id, node);\n this.print(typeParameters, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(typeAnnotation, node);\n this.token(\";\");\n}\n\nfunction TSTypeExpression(\n this: Printer,\n node: t.TSAsExpression | t.TSSatisfiesExpression,\n) {\n const { type, expression, typeAnnotation } = node;\n const forceParens = !!expression.trailingComments?.length;\n this.print(expression, node, true, undefined, forceParens);\n this.space();\n this.word(type === \"TSAsExpression\" ? \"as\" : \"satisfies\");\n this.space();\n this.print(typeAnnotation, node);\n}\n\nexport {\n TSTypeExpression as TSAsExpression,\n TSTypeExpression as TSSatisfiesExpression,\n};\n\nexport function TSTypeAssertion(this: Printer, node: t.TSTypeAssertion) {\n const { typeAnnotation, expression } = node;\n this.token(\"<\");\n this.print(typeAnnotation, node);\n this.token(\">\");\n this.space();\n this.print(expression, node);\n}\n\nexport function TSInstantiationExpression(\n this: Printer,\n node: t.TSInstantiationExpression,\n) {\n this.print(node.expression, node);\n this.print(node.typeParameters, node);\n}\n\nexport function TSEnumDeclaration(this: Printer, node: t.TSEnumDeclaration) {\n const { declare, const: isConst, id, members } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n if (isConst) {\n this.word(\"const\");\n this.space();\n }\n this.word(\"enum\");\n this.space();\n this.print(id, node);\n this.space();\n tsPrintBraced(this, members, node);\n}\n\nexport function TSEnumMember(this: Printer, node: t.TSEnumMember) {\n const { id, initializer } = node;\n this.print(id, node);\n if (initializer) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(initializer, node);\n }\n this.token(\",\");\n}\n\nexport function TSModuleDeclaration(\n this: Printer,\n node: t.TSModuleDeclaration,\n) {\n const { declare, id } = node;\n\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n\n if (!node.global) {\n this.word(id.type === \"Identifier\" ? \"namespace\" : \"module\");\n this.space();\n }\n this.print(id, node);\n\n if (!node.body) {\n this.token(\";\");\n return;\n }\n\n let body = node.body;\n while (body.type === \"TSModuleDeclaration\") {\n this.token(\".\");\n this.print(body.id, body);\n body = body.body;\n }\n\n this.space();\n this.print(body, node);\n}\n\nexport function TSModuleBlock(this: Printer, node: t.TSModuleBlock) {\n tsPrintBraced(this, node.body, node);\n}\n\nexport function TSImportType(this: Printer, node: t.TSImportType) {\n const { argument, qualifier, typeParameters } = node;\n this.word(\"import\");\n this.token(\"(\");\n this.print(argument, node);\n this.token(\")\");\n if (qualifier) {\n this.token(\".\");\n this.print(qualifier, node);\n }\n if (typeParameters) {\n this.print(typeParameters, node);\n }\n}\n\nexport function TSImportEqualsDeclaration(\n this: Printer,\n node: t.TSImportEqualsDeclaration,\n) {\n const { isExport, id, moduleReference } = node;\n if (isExport) {\n this.word(\"export\");\n this.space();\n }\n this.word(\"import\");\n this.space();\n this.print(id, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(moduleReference, node);\n this.token(\";\");\n}\n\nexport function TSExternalModuleReference(\n this: Printer,\n node: t.TSExternalModuleReference,\n) {\n this.token(\"require(\");\n this.print(node.expression, node);\n this.token(\")\");\n}\n\nexport function TSNonNullExpression(\n this: Printer,\n node: t.TSNonNullExpression,\n) {\n this.print(node.expression, node);\n this.token(\"!\");\n}\n\nexport function TSExportAssignment(this: Printer, node: t.TSExportAssignment) {\n this.word(\"export\");\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.expression, node);\n this.token(\";\");\n}\n\nexport function TSNamespaceExportDeclaration(\n this: Printer,\n node: t.TSNamespaceExportDeclaration,\n) {\n this.word(\"export\");\n this.space();\n this.word(\"as\");\n this.space();\n this.word(\"namespace\");\n this.space();\n this.print(node.id, node);\n}\n\nexport function tsPrintSignatureDeclarationBase(this: Printer, node: any) {\n const { typeParameters } = node;\n const parameters = process.env.BABEL_8_BREAKING\n ? node.params\n : node.parameters;\n this.print(typeParameters, node);\n this.token(\"(\");\n this._parameters(parameters, node);\n this.token(\")\");\n const returnType = process.env.BABEL_8_BREAKING\n ? node.returnType\n : node.typeAnnotation;\n this.print(returnType, node);\n}\n\nexport function tsPrintClassMemberModifiers(\n this: Printer,\n node:\n | t.ClassProperty\n | t.ClassAccessorProperty\n | t.ClassMethod\n | t.ClassPrivateMethod\n | t.TSDeclareMethod,\n) {\n const isField =\n node.type === \"ClassAccessorProperty\" || node.type === \"ClassProperty\";\n if (isField && node.declare) {\n this.word(\"declare\");\n this.space();\n }\n if (node.accessibility) {\n this.word(node.accessibility);\n this.space();\n }\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n if (node.override) {\n this.word(\"override\");\n this.space();\n }\n if (node.abstract) {\n this.word(\"abstract\");\n this.space();\n }\n if (isField && node.readonly) {\n this.word(\"readonly\");\n this.space();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAASA,gBAAgBA,CAAgBC,IAAwB,EAAE;EACxE,IAAI,CAACC,SAAK,IAAK;EACf,IAAI,CAACC,KAAK,EAAE;EAEZ,IAAIF,IAAI,CAACG,QAAQ,EAAE,IAAI,CAACF,SAAK,IAAK;EAClC,IAAI,CAACG,KAAK,CAACJ,IAAI,CAACK,cAAc,EAAEL,IAAI,CAAC;AACvC;AAEO,SAASM,4BAA4BA,CAE1CN,IAAoC,EACpCO,MAAc,EACR;EACN,IAAI,CAACN,SAAK,IAAK;EACf,IAAI,CAACO,SAAS,CAACR,IAAI,CAACS,MAAM,EAAET,IAAI,EAAE,CAAC,CAAC,CAAC;EACrC,IAAIO,MAAM,CAACG,IAAI,KAAK,yBAAyB,IAAIV,IAAI,CAACS,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACzE,IAAI,CAACV,SAAK,IAAK;EACjB;EACA,IAAI,CAACA,SAAK,IAAK;AACjB;AAIO,SAASW,eAAeA,CAAgBZ,IAAuB,EAAE;EACtE,IAAIA,IAAI,CAACa,EAAE,EAAE;IACX,IAAI,CAACC,IAAI,CAAC,IAAI,CAAC;IACf,IAAI,CAACZ,KAAK,EAAE;EACd;EAEA,IAAIF,IAAI,CAACe,GAAG,EAAE;IACZ,IAAI,CAACD,IAAI,CAAC,KAAK,CAAC;IAChB,IAAI,CAACZ,KAAK,EAAE;EACd;EAEA,IAAI,CAACY,IAAI,CAEFd,IAAI,CAACgB,IAAI,CAEf;EAED,IAAIhB,IAAI,CAACiB,UAAU,EAAE;IACnB,IAAI,CAACf,KA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,UAAU,CAAC;IACrB,IAAI,CAACZ,KAAK,EAAE;EACd;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/index.js b/node_modules/@babel/generator/lib/index.js deleted file mode 100644 index d0ef98628..000000000 --- a/node_modules/@babel/generator/lib/index.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.CodeGenerator = void 0; -exports.default = generate; -var _sourceMap = require("./source-map"); -var _printer = require("./printer"); -class Generator extends _printer.default { - constructor(ast, opts = {}, code) { - const format = normalizeOptions(code, opts); - const map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null; - super(format, map); - this.ast = void 0; - this.ast = ast; - } - generate() { - return super.generate(this.ast); - } -} -function normalizeOptions(code, opts) { - const format = { - auxiliaryCommentBefore: opts.auxiliaryCommentBefore, - auxiliaryCommentAfter: opts.auxiliaryCommentAfter, - shouldPrintComment: opts.shouldPrintComment, - retainLines: opts.retainLines, - retainFunctionParens: opts.retainFunctionParens, - comments: opts.comments == null || opts.comments, - compact: opts.compact, - minified: opts.minified, - concise: opts.concise, - indent: { - adjustMultilineComment: true, - style: " " - }, - jsescOption: Object.assign({ - quotes: "double", - wrap: true, - minimal: false - }, opts.jsescOption), - recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType, - topicToken: opts.topicToken - }; - { - format.decoratorsBeforeExport = opts.decoratorsBeforeExport; - format.jsescOption.json = opts.jsonCompatibleStrings; - } - if (format.minified) { - format.compact = true; - format.shouldPrintComment = format.shouldPrintComment || (() => format.comments); - } else { - format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.includes("@license") || value.includes("@preserve")); - } - if (format.compact === "auto") { - format.compact = typeof code === "string" && code.length > 500000; - if (format.compact) { - console.error("[BABEL] Note: The code generator has deoptimised the styling of " + `${opts.filename} as it exceeds the max of ${"500KB"}.`); - } - } - if (format.compact) { - format.indent.adjustMultilineComment = false; - } - const { - auxiliaryCommentBefore, - auxiliaryCommentAfter, - shouldPrintComment - } = format; - if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) { - format.auxiliaryCommentBefore = undefined; - } - if (auxiliaryCommentAfter && !shouldPrintComment(auxiliaryCommentAfter)) { - format.auxiliaryCommentAfter = undefined; - } - return format; -} -class CodeGenerator { - constructor(ast, opts, code) { - this._generator = void 0; - this._generator = new Generator(ast, opts, code); - } - generate() { - return this._generator.generate(); - } -} -exports.CodeGenerator = CodeGenerator; -function generate(ast, opts, code) { - const gen = new Generator(ast, opts, code); - return gen.generate(); -} - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/generator/lib/index.js.map b/node_modules/@babel/generator/lib/index.js.map deleted file mode 100644 index 7e186c860..000000000 --- a/node_modules/@babel/generator/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_sourceMap","require","_printer","Generator","Printer","constructor","ast","opts","code","format","normalizeOptions","map","sourceMaps","SourceMap","generate","auxiliaryCommentBefore","auxiliaryCommentAfter","shouldPrintComment","retainLines","retainFunctionParens","comments","compact","minified","concise","indent","adjustMultilineComment","style","jsescOption","Object","assign","quotes","wrap","minimal","recordAndTupleSyntaxType","topicToken","decoratorsBeforeExport","json","jsonCompatibleStrings","value","includes","length","console","error","filename","undefined","CodeGenerator","_generator","exports","gen"],"sources":["../src/index.ts"],"sourcesContent":["import SourceMap from \"./source-map\";\nimport Printer from \"./printer\";\nimport type * as t from \"@babel/types\";\nimport type { Opts as jsescOptions } from \"jsesc\";\nimport type { Format } from \"./printer\";\nimport type {\n RecordAndTuplePluginOptions,\n PipelineOperatorPluginOptions,\n} from \"@babel/parser\";\nimport type { DecodedSourceMap, Mapping } from \"@jridgewell/gen-mapping\";\n\n/**\n * Babel's code generator, turns an ast into code, maintaining sourcemaps,\n * user preferences, and valid output.\n */\n\nclass Generator extends Printer {\n constructor(\n ast: t.Node,\n opts: GeneratorOptions = {},\n code: string | { [filename: string]: string },\n ) {\n const format = normalizeOptions(code, opts);\n const map = opts.sourceMaps ? new SourceMap(opts, code) : null;\n super(format, map);\n\n this.ast = ast;\n }\n\n ast: t.Node;\n\n /**\n * Generate code and sourcemap from ast.\n *\n * Appends comments that weren't attached to any node to the end of the generated output.\n */\n\n generate() {\n return super.generate(this.ast);\n }\n}\n\n/**\n * Normalize generator options, setting defaults.\n *\n * - Detects code indentation.\n * - If `opts.compact = \"auto\"` and the code is over 500KB, `compact` will be set to `true`.\n */\n\nfunction normalizeOptions(\n code: string | { [filename: string]: string },\n opts: GeneratorOptions,\n): Format {\n const format: Format = {\n auxiliaryCommentBefore: opts.auxiliaryCommentBefore,\n auxiliaryCommentAfter: opts.auxiliaryCommentAfter,\n shouldPrintComment: opts.shouldPrintComment,\n retainLines: opts.retainLines,\n retainFunctionParens: opts.retainFunctionParens,\n comments: opts.comments == null || opts.comments,\n compact: opts.compact,\n minified: opts.minified,\n concise: opts.concise,\n indent: {\n adjustMultilineComment: true,\n style: \" \",\n },\n jsescOption: {\n quotes: \"double\",\n wrap: true,\n minimal: process.env.BABEL_8_BREAKING ? true : false,\n ...opts.jsescOption,\n },\n recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType,\n topicToken: opts.topicToken,\n };\n\n if (!process.env.BABEL_8_BREAKING) {\n format.decoratorsBeforeExport = opts.decoratorsBeforeExport;\n format.jsescOption.json = opts.jsonCompatibleStrings;\n }\n\n if (format.minified) {\n format.compact = true;\n\n format.shouldPrintComment =\n format.shouldPrintComment || (() => format.comments);\n } else {\n format.shouldPrintComment =\n format.shouldPrintComment ||\n (value =>\n format.comments ||\n value.includes(\"@license\") ||\n value.includes(\"@preserve\"));\n }\n\n if (format.compact === \"auto\") {\n format.compact = typeof code === \"string\" && code.length > 500_000; // 500KB\n\n if (format.compact) {\n console.error(\n \"[BABEL] Note: The code generator has deoptimised the styling of \" +\n `${opts.filename} as it exceeds the max of ${\"500KB\"}.`,\n );\n }\n }\n\n if (format.compact) {\n format.indent.adjustMultilineComment = false;\n }\n\n const { auxiliaryCommentBefore, auxiliaryCommentAfter, shouldPrintComment } =\n format;\n\n if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) {\n format.auxiliaryCommentBefore = undefined;\n }\n if (auxiliaryCommentAfter && !shouldPrintComment(auxiliaryCommentAfter)) {\n format.auxiliaryCommentAfter = undefined;\n }\n\n return format;\n}\n\nexport interface GeneratorOptions {\n /**\n * Optional string to add as a block comment at the start of the output file.\n */\n auxiliaryCommentBefore?: string;\n\n /**\n * Optional string to add as a block comment at the end of the output file.\n */\n auxiliaryCommentAfter?: string;\n\n /**\n * Function that takes a comment (as a string) and returns true if the comment should be included in the output.\n * By default, comments are included if `opts.comments` is `true` or if `opts.minified` is `false` and the comment\n * contains `@preserve` or `@license`.\n */\n shouldPrintComment?(comment: string): boolean;\n\n /**\n * Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces).\n * Defaults to `false`.\n */\n retainLines?: boolean;\n\n /**\n * Retain parens around function expressions (could be used to change engine parsing behavior)\n * Defaults to `false`.\n */\n retainFunctionParens?: boolean;\n\n /**\n * Should comments be included in output? Defaults to `true`.\n */\n comments?: boolean;\n\n /**\n * Set to true to avoid adding whitespace for formatting. Defaults to the value of `opts.minified`.\n */\n compact?: boolean | \"auto\";\n\n /**\n * Should the output be minified. Defaults to `false`.\n */\n minified?: boolean;\n\n /**\n * Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`.\n */\n concise?: boolean;\n\n /**\n * Used in warning messages\n */\n filename?: string;\n\n /**\n * Enable generating source maps. Defaults to `false`.\n */\n sourceMaps?: boolean;\n\n inputSourceMap?: any;\n\n /**\n * A root for all relative URLs in the source map.\n */\n sourceRoot?: string;\n\n /**\n * The filename for the source code (i.e. the code in the `code` argument).\n * This will only be used if `code` is a string.\n */\n sourceFileName?: string;\n\n /**\n * Set to true to run jsesc with \"json\": true to print \"\\u00A9\" vs. \"©\";\n * @deprecated use `jsescOptions: { json: true }` instead\n */\n jsonCompatibleStrings?: boolean;\n\n /**\n * Set to true to enable support for experimental decorators syntax before\n * module exports. If not specified, decorators will be printed in the same\n * position as they were in the input source code.\n * @deprecated Removed in Babel 8\n */\n decoratorsBeforeExport?: boolean;\n\n /**\n * Options for outputting jsesc representation.\n */\n jsescOption?: jsescOptions;\n\n /**\n * For use with the recordAndTuple token.\n */\n recordAndTupleSyntaxType?: RecordAndTuplePluginOptions[\"syntaxType\"];\n /**\n * For use with the Hack-style pipe operator.\n * Changes what token is used for pipe bodies’ topic references.\n */\n topicToken?: PipelineOperatorPluginOptions[\"topicToken\"];\n}\n\nexport interface GeneratorResult {\n code: string;\n map: {\n version: number;\n sources: readonly string[];\n names: readonly string[];\n sourceRoot?: string;\n sourcesContent?: readonly string[];\n mappings: string;\n file?: string;\n } | null;\n decodedMap: DecodedSourceMap | undefined;\n rawMappings: Mapping[] | undefined;\n}\n\n/**\n * We originally exported the Generator class above, but to make it extra clear that it is a private API,\n * we have moved that to an internal class instance and simplified the interface to the two public methods\n * that we wish to support.\n */\n\nexport class CodeGenerator {\n private _generator: Generator;\n constructor(ast: t.Node, opts?: GeneratorOptions, code?: string) {\n this._generator = new Generator(ast, opts, code);\n }\n generate(): GeneratorResult {\n return this._generator.generate();\n }\n}\n\n/**\n * Turns an AST into code, maintaining sourcemaps, user preferences, and valid output.\n * @param ast - the abstract syntax tree from which to generate output code.\n * @param opts - used for specifying options for code generation.\n * @param code - the original source code, used for source maps.\n * @returns - an object containing the output code and source map.\n */\nexport default function generate(\n ast: t.Node,\n opts?: GeneratorOptions,\n code?: string | { [filename: string]: string },\n) {\n const gen = new Generator(ast, opts, code);\n return gen.generate();\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAeA,MAAME,SAAS,SAASC,gBAAO,CAAC;EAC9BC,WAAWA,CACTC,GAAW,EACXC,IAAsB,GAAG,CAAC,CAAC,EAC3BC,IAA6C,EAC7C;IACA,MAAMC,MAAM,GAAGC,gBAAgB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;EAEzBxC,WAAWA,CAACC,GAAW,EAAEC,IAAuB,EAAEC,IAAa,EAAE;IAAA,KADzDsC,UAAU;IAEhB,IAAI,CAACA,UAAU,GAAG,IAAI3C,SAAS,CAACG,GAAG,EAAEC,IAAI,EAAEC,IAAI,CAAC;EAClD;EACAM,QAAQA,CAAA,EAAoB;IAC1B,OAAO,IAAI,CAACgC,UAAU,CAAChC,QAAQ,EAAE;EACnC;AACF;AAACiC,OAAA,CAAAF,aAAA,GAAAA,aAAA;AASc,SAAS/B,QAAQA,CAC9BR,GAAW,EACXC,IAAuB,EACvBC,IAA8C,EAC9C;EACA,MAAMwC,GAAG,GAAG,IAAI7C,SAAS,CAACG,GAAG,EAAEC,IAAI,EAAEC,IAAI,CAAC;EAC1C,OAAOwC,GAAG,CAAClC,QAAQ,EAAE;AACvB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/node/index.js b/node_modules/@babel/generator/lib/node/index.js deleted file mode 100644 index 43d60ee84..000000000 --- a/node_modules/@babel/generator/lib/node/index.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.needsParens = needsParens; -exports.needsWhitespace = needsWhitespace; -exports.needsWhitespaceAfter = needsWhitespaceAfter; -exports.needsWhitespaceBefore = needsWhitespaceBefore; -var whitespace = require("./whitespace"); -var parens = require("./parentheses"); -var _t = require("@babel/types"); -const { - FLIPPED_ALIAS_KEYS, - isCallExpression, - isExpressionStatement, - isMemberExpression, - isNewExpression -} = _t; -function expandAliases(obj) { - const newObj = {}; - function add(type, func) { - const fn = newObj[type]; - newObj[type] = fn ? function (node, parent, stack) { - const result = fn(node, parent, stack); - return result == null ? func(node, parent, stack) : result; - } : func; - } - for (const type of Object.keys(obj)) { - const aliases = FLIPPED_ALIAS_KEYS[type]; - if (aliases) { - for (const alias of aliases) { - add(alias, obj[type]); - } - } else { - add(type, obj[type]); - } - } - return newObj; -} -const expandedParens = expandAliases(parens); -const expandedWhitespaceNodes = expandAliases(whitespace.nodes); -function find(obj, node, parent, printStack) { - const fn = obj[node.type]; - return fn ? fn(node, parent, printStack) : null; -} -function isOrHasCallExpression(node) { - if (isCallExpression(node)) { - return true; - } - return isMemberExpression(node) && isOrHasCallExpression(node.object); -} -function needsWhitespace(node, parent, type) { - if (!node) return false; - if (isExpressionStatement(node)) { - node = node.expression; - } - const flag = find(expandedWhitespaceNodes, node, parent); - if (typeof flag === "number") { - return (flag & type) !== 0; - } - return false; -} -function needsWhitespaceBefore(node, parent) { - return needsWhitespace(node, parent, 1); -} -function needsWhitespaceAfter(node, parent) { - return needsWhitespace(node, parent, 2); -} -function needsParens(node, parent, printStack) { - if (!parent) return false; - if (isNewExpression(parent) && parent.callee === node) { - if (isOrHasCallExpression(node)) return true; - } - return find(expandedParens, node, parent, printStack); -} - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/generator/lib/node/index.js.map b/node_modules/@babel/generator/lib/node/index.js.map deleted file mode 100644 index 84984d566..000000000 --- a/node_modules/@babel/generator/lib/node/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["whitespace","require","parens","_t","FLIPPED_ALIAS_KEYS","isCallExpression","isExpressionStatement","isMemberExpression","isNewExpression","expandAliases","obj","newObj","add","type","func","fn","node","parent","stack","result","Object","keys","aliases","alias","expandedParens","expandedWhitespaceNodes","nodes","find","printStack","isOrHasCallExpression","object","needsWhitespace","expression","flag","needsWhitespaceBefore","needsWhitespaceAfter","needsParens","callee"],"sources":["../../src/node/index.ts"],"sourcesContent":["import * as whitespace from \"./whitespace\";\nimport * as parens from \"./parentheses\";\nimport {\n FLIPPED_ALIAS_KEYS,\n isCallExpression,\n isExpressionStatement,\n isMemberExpression,\n isNewExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nimport type { WhitespaceFlag } from \"./whitespace\";\n\nexport type NodeHandlers = {\n [K in string]?: (\n node: K extends t.Node[\"type\"] ? Extract : t.Node,\n // todo:\n // node: K extends keyof typeof t\n // ? Extract\n // : t.Node,\n parent: t.Node,\n stack: t.Node[],\n ) => R;\n};\n\nfunction expandAliases(obj: NodeHandlers) {\n const newObj: NodeHandlers = {};\n\n function add(\n type: string,\n func: (node: t.Node, parent: t.Node, stack: t.Node[]) => R,\n ) {\n const fn = newObj[type];\n newObj[type] = fn\n ? function (node, parent, stack) {\n const result = fn(node, parent, stack);\n\n return result == null ? func(node, parent, stack) : result;\n }\n : func;\n }\n\n for (const type of Object.keys(obj)) {\n const aliases = FLIPPED_ALIAS_KEYS[type];\n if (aliases) {\n for (const alias of aliases) {\n add(alias, obj[type]);\n }\n } else {\n add(type, obj[type]);\n }\n }\n\n return newObj;\n}\n\n// Rather than using `t.is` on each object property, we pre-expand any type aliases\n// into concrete types so that the 'find' call below can be as fast as possible.\nconst expandedParens = expandAliases(parens);\nconst expandedWhitespaceNodes = expandAliases(whitespace.nodes);\n\nfunction find(\n obj: NodeHandlers,\n node: t.Node,\n parent: t.Node,\n printStack?: t.Node[],\n): R | null {\n const fn = obj[node.type];\n return fn ? fn(node, parent, printStack) : null;\n}\n\nfunction isOrHasCallExpression(node: t.Node): boolean {\n if (isCallExpression(node)) {\n return true;\n }\n\n return isMemberExpression(node) && isOrHasCallExpression(node.object);\n}\n\nexport function needsWhitespace(\n node: t.Node,\n parent: t.Node,\n type: WhitespaceFlag,\n): boolean {\n if (!node) return false;\n\n if (isExpressionStatement(node)) {\n node = node.expression;\n }\n\n const flag = find(expandedWhitespaceNodes, node, parent);\n\n if (typeof flag === \"number\") {\n return (flag & type) !== 0;\n }\n\n return false;\n}\n\nexport function needsWhitespaceBefore(node: t.Node, parent: t.Node) {\n return needsWhitespace(node, parent, 1);\n}\n\nexport function needsWhitespaceAfter(node: t.Node, parent: t.Node) {\n return needsWhitespace(node, parent, 2);\n}\n\nexport function needsParens(\n node: t.Node,\n parent: t.Node,\n printStack?: t.Node[],\n) {\n if (!parent) return false;\n\n if (isNewExpression(parent) && parent.callee === node) {\n if (isOrHasCallExpression(node)) return true;\n }\n\n return find(expandedParens, node, parent, printStack);\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,EAAA,GAAAF,OAAA;AAMsB;EALpBG,kBAAkB;EAClBC,gBAAgB;EAChBC,qBAAqB;EACrBC,kBAAkB;EAClBC;AAAe,IAAAL,EAAA;AAkBjB,SAASM,aAAaA,CAAIC,GAAoB,EAAE;EAC9C,MAAMC,MAAuB,GAAG,CAAC,CAAC;EAElC,SAASC,GAAGA,CACVC,IAAY,EACZC,IAA0D,EAC1D;IACA,MAAMC,EAAE,GAAGJ,MAAM,CAACE,IAAI,CAAC;IACvBF,MAAM,CAACE,IAAI,CAAC,GAAGE,EAAE,GACb,UAAUC,IAAI,EAAEC,MAAM,EAAEC,KAAK,EAAE;MAC7B,MAAMC,MAAM,GAAGJ,EAAE,CAACC,IAAI,EAAEC,MAAM,EAAEC,KAAK,CAAC;MAEtC,OAAOC,MAAM,IAAI,IAAI,GAAGL,IAAI,CAACE,IAAI,EAAEC,MAAM,EAAEC,KAAK,CAAC,GAAGC,MAAM;IAC5D,CAAC,GACDL,IAAI;EACV;EAEA,KAAK,MAAMD,IAAI,IAAIO,MAAM,CAACC,IAAI,CAACX,GAAG,CAAC,EAAE;IACnC,MAAMY,OAAO,GAAGlB,kBAAkB,CAACS,IAAI,CAAC;IACxC,IAAIS,OAAO,EAAE;MACX,KAAK,MAAMC,KAAK,IAAID,OAAO,EAAE;QAC3BV,GAAG,CAACW,KAAK,EAAEb,GAAG,CAACG,IAAI,CAAC,CAAC;MACvB;IACF,CAAC,MAAM;MACLD,GAAG,CAACC,IAAI,EAAEH,GAAG,CAACG,IAAI,CAAC,CAAC;IACtB;EACF;EAEA,OAAOF,MAAM;AACf;AAIA,MAAMa,cAAc,GAAGf,aAAa,CAACP,MAAM,CAAC;AAC5C,MAAMuB,uBAAuB,GAAGhB,aAAa,CAACT,UA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IT,eAAe,CAACS,MAAM,CAAC,IAAIA,MAAM,CAACoB,MAAM,KAAKrB,IAAI,EAAE;IACrD,IAAIa,qBAAqB,CAACb,IAAI,CAAC,EAAE,OAAO,IAAI;EAC9C;EAEA,OAAOW,IAAI,CAACH,cAAc,EAAER,IAAI,EAAEC,MAAM,EAAEW,UAAU,CAAC;AACvD"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/node/parentheses.js b/node_modules/@babel/generator/lib/node/parentheses.js deleted file mode 100644 index 4656a67ce..000000000 --- a/node_modules/@babel/generator/lib/node/parentheses.js +++ /dev/null @@ -1,305 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ArrowFunctionExpression = ArrowFunctionExpression; -exports.AssignmentExpression = AssignmentExpression; -exports.Binary = Binary; -exports.BinaryExpression = BinaryExpression; -exports.ClassExpression = ClassExpression; -exports.ConditionalExpression = ConditionalExpression; -exports.DoExpression = DoExpression; -exports.FunctionExpression = FunctionExpression; -exports.FunctionTypeAnnotation = FunctionTypeAnnotation; -exports.Identifier = Identifier; -exports.LogicalExpression = LogicalExpression; -exports.NullableTypeAnnotation = NullableTypeAnnotation; -exports.ObjectExpression = ObjectExpression; -exports.OptionalIndexedAccessType = OptionalIndexedAccessType; -exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression; -exports.SequenceExpression = SequenceExpression; -exports.TSTypeAssertion = exports.TSSatisfiesExpression = exports.TSAsExpression = TSAsExpression; -exports.TSInferType = TSInferType; -exports.TSInstantiationExpression = TSInstantiationExpression; -exports.TSIntersectionType = exports.TSUnionType = TSUnionType; -exports.UnaryLike = UnaryLike; -exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation; -exports.UpdateExpression = UpdateExpression; -exports.AwaitExpression = exports.YieldExpression = YieldExpression; -var _t = require("@babel/types"); -const { - isArrayTypeAnnotation, - isArrowFunctionExpression, - isAssignmentExpression, - isAwaitExpression, - isBinary, - isBinaryExpression, - isUpdateExpression, - isCallExpression, - isClass, - isClassExpression, - isConditional, - isConditionalExpression, - isExportDeclaration, - isExportDefaultDeclaration, - isExpressionStatement, - isFor, - isForInStatement, - isForOfStatement, - isForStatement, - isFunctionExpression, - isIfStatement, - isIndexedAccessType, - isIntersectionTypeAnnotation, - isLogicalExpression, - isMemberExpression, - isNewExpression, - isNullableTypeAnnotation, - isObjectPattern, - isOptionalCallExpression, - isOptionalMemberExpression, - isReturnStatement, - isSequenceExpression, - isSwitchStatement, - isTSArrayType, - isTSAsExpression, - isTSInstantiationExpression, - isTSIntersectionType, - isTSNonNullExpression, - isTSOptionalType, - isTSRestType, - isTSTypeAssertion, - isTSUnionType, - isTaggedTemplateExpression, - isThrowStatement, - isTypeAnnotation, - isUnaryLike, - isUnionTypeAnnotation, - isVariableDeclarator, - isWhileStatement, - isYieldExpression, - isTSSatisfiesExpression -} = _t; -const PRECEDENCE = { - "||": 0, - "??": 0, - "|>": 0, - "&&": 1, - "|": 2, - "^": 3, - "&": 4, - "==": 5, - "===": 5, - "!=": 5, - "!==": 5, - "<": 6, - ">": 6, - "<=": 6, - ">=": 6, - in: 6, - instanceof: 6, - ">>": 7, - "<<": 7, - ">>>": 7, - "+": 8, - "-": 8, - "*": 9, - "/": 9, - "%": 9, - "**": 10 -}; -function isTSTypeExpression(node) { - return isTSAsExpression(node) || isTSSatisfiesExpression(node) || isTSTypeAssertion(node); -} -const isClassExtendsClause = (node, parent) => isClass(parent, { - superClass: node -}); -const hasPostfixPart = (node, parent) => (isMemberExpression(parent) || isOptionalMemberExpression(parent)) && parent.object === node || (isCallExpression(parent) || isOptionalCallExpression(parent) || isNewExpression(parent)) && parent.callee === node || isTaggedTemplateExpression(parent) && parent.tag === node || isTSNonNullExpression(parent); -function NullableTypeAnnotation(node, parent) { - return isArrayTypeAnnotation(parent); -} -function FunctionTypeAnnotation(node, parent, printStack) { - if (printStack.length < 3) return; - return isUnionTypeAnnotation(parent) || isIntersectionTypeAnnotation(parent) || isArrayTypeAnnotation(parent) || isTypeAnnotation(parent) && isArrowFunctionExpression(printStack[printStack.length - 3]); -} -function UpdateExpression(node, parent) { - return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent); -} -function ObjectExpression(node, parent, printStack) { - return isFirstInContext(printStack, 1 | 2); -} -function DoExpression(node, parent, printStack) { - return !node.async && isFirstInContext(printStack, 1); -} -function Binary(node, parent) { - if (node.operator === "**" && isBinaryExpression(parent, { - operator: "**" - })) { - return parent.left === node; - } - if (isClassExtendsClause(node, parent)) { - return true; - } - if (hasPostfixPart(node, parent) || isUnaryLike(parent) || isAwaitExpression(parent)) { - return true; - } - if (isBinary(parent)) { - const parentOp = parent.operator; - const parentPos = PRECEDENCE[parentOp]; - const nodeOp = node.operator; - const nodePos = PRECEDENCE[nodeOp]; - if (parentPos === nodePos && parent.right === node && !isLogicalExpression(parent) || parentPos > nodePos) { - return true; - } - } -} -function UnionTypeAnnotation(node, parent) { - return isArrayTypeAnnotation(parent) || isNullableTypeAnnotation(parent) || isIntersectionTypeAnnotation(parent) || isUnionTypeAnnotation(parent); -} -function OptionalIndexedAccessType(node, parent) { - return isIndexedAccessType(parent, { - objectType: node - }); -} -function TSAsExpression() { - return true; -} -function TSUnionType(node, parent) { - return isTSArrayType(parent) || isTSOptionalType(parent) || isTSIntersectionType(parent) || isTSUnionType(parent) || isTSRestType(parent); -} -function TSInferType(node, parent) { - return isTSArrayType(parent) || isTSOptionalType(parent); -} -function TSInstantiationExpression(node, parent) { - return (isCallExpression(parent) || isOptionalCallExpression(parent) || isNewExpression(parent) || isTSInstantiationExpression(parent)) && !!parent.typeParameters; -} -function BinaryExpression(node, parent) { - return node.operator === "in" && (isVariableDeclarator(parent) || isFor(parent)); -} -function SequenceExpression(node, parent) { - if (isForStatement(parent) || isThrowStatement(parent) || isReturnStatement(parent) || isIfStatement(parent) && parent.test === node || isWhileStatement(parent) && parent.test === node || isForInStatement(parent) && parent.right === node || isSwitchStatement(parent) && parent.discriminant === node || isExpressionStatement(parent) && parent.expression === node) { - return false; - } - return true; -} -function YieldExpression(node, parent) { - return isBinary(parent) || isUnaryLike(parent) || hasPostfixPart(node, parent) || isAwaitExpression(parent) && isYieldExpression(node) || isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent); -} -function ClassExpression(node, parent, printStack) { - return isFirstInContext(printStack, 1 | 4); -} -function UnaryLike(node, parent) { - return hasPostfixPart(node, parent) || isBinaryExpression(parent, { - operator: "**", - left: node - }) || isClassExtendsClause(node, parent); -} -function FunctionExpression(node, parent, printStack) { - return isFirstInContext(printStack, 1 | 4); -} -function ArrowFunctionExpression(node, parent) { - return isExportDeclaration(parent) || ConditionalExpression(node, parent); -} -function ConditionalExpression(node, parent) { - if (isUnaryLike(parent) || isBinary(parent) || isConditionalExpression(parent, { - test: node - }) || isAwaitExpression(parent) || isTSTypeExpression(parent)) { - return true; - } - return UnaryLike(node, parent); -} -function OptionalMemberExpression(node, parent) { - return isCallExpression(parent, { - callee: node - }) || isMemberExpression(parent, { - object: node - }); -} -function AssignmentExpression(node, parent) { - if (isObjectPattern(node.left)) { - return true; - } else { - return ConditionalExpression(node, parent); - } -} -function LogicalExpression(node, parent) { - if (isTSTypeExpression(parent)) return true; - switch (node.operator) { - case "||": - if (!isLogicalExpression(parent)) return false; - return parent.operator === "??" || parent.operator === "&&"; - case "&&": - return isLogicalExpression(parent, { - operator: "??" - }); - case "??": - return isLogicalExpression(parent) && parent.operator !== "??"; - } -} -function Identifier(node, parent, printStack) { - var _node$extra; - if ((_node$extra = node.extra) != null && _node$extra.parenthesized && isAssignmentExpression(parent, { - left: node - }) && (isFunctionExpression(parent.right) || isClassExpression(parent.right)) && parent.right.id == null) { - return true; - } - if (node.name === "let") { - const isFollowedByBracket = isMemberExpression(parent, { - object: node, - computed: true - }) || isOptionalMemberExpression(parent, { - object: node, - computed: true, - optional: false - }); - return isFirstInContext(printStack, isFollowedByBracket ? 1 | 8 | 16 | 32 : 32); - } - return node.name === "async" && isForOfStatement(parent) && node === parent.left; -} -function isFirstInContext(printStack, checkParam) { - const expressionStatement = checkParam & 1; - const arrowBody = checkParam & 2; - const exportDefault = checkParam & 4; - const forHead = checkParam & 8; - const forInHead = checkParam & 16; - const forOfHead = checkParam & 32; - let i = printStack.length - 1; - if (i <= 0) return; - let node = printStack[i]; - i--; - let parent = printStack[i]; - while (i >= 0) { - if (expressionStatement && isExpressionStatement(parent, { - expression: node - }) || exportDefault && isExportDefaultDeclaration(parent, { - declaration: node - }) || arrowBody && isArrowFunctionExpression(parent, { - body: node - }) || forHead && isForStatement(parent, { - init: node - }) || forInHead && isForInStatement(parent, { - left: node - }) || forOfHead && isForOfStatement(parent, { - left: node - })) { - return true; - } - if (i > 0 && (hasPostfixPart(node, parent) && !isNewExpression(parent) || isSequenceExpression(parent) && parent.expressions[0] === node || isUpdateExpression(parent) && !parent.prefix || isConditional(parent, { - test: node - }) || isBinary(parent, { - left: node - }) || isAssignmentExpression(parent, { - left: node - }))) { - node = parent; - i--; - parent = printStack[i]; - } else { - return false; - } - } - return false; -} - -//# sourceMappingURL=parentheses.js.map diff --git a/node_modules/@babel/generator/lib/node/parentheses.js.map b/node_modules/@babel/generator/lib/node/parentheses.js.map deleted file mode 100644 index 92cc7788e..000000000 --- a/node_modules/@babel/generator/lib/node/parentheses.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_t","require","isArrayTypeAnnotation","isArrowFunctionExpression","isAssignmentExpression","isAwaitExpression","isBinary","isBinaryExpression","isUpdateExpression","isCallExpression","isClass","isClassExpression","isConditional","isConditionalExpression","isExportDeclaration","isExportDefaultDeclaration","isExpressionStatement","isFor","isForInStatement","isForOfStatement","isForStatement","isFunctionExpression","isIfStatement","isIndexedAccessType","isIntersectionTypeAnnotation","isLogicalExpression","isMemberExpression","isNewExpression","isNullableTypeAnnotation","isObjectPattern","isOptionalCallExpression","isOptionalMemberExpression","isReturnStatement","isSequenceExpression","isSwitchStatement","isTSArrayType","isTSAsExpression","isTSInstantiationExpression","isTSIntersectionType","isTSNonNullExpression","isTSOptionalType","isTSRestType","isTSTypeAssertion","isTSUnionType","isTaggedTemplateExpression","isThrowStatement","isTypeAnnotation","isUnaryLike","isUnionTypeAnnotation","isVariableDeclarator","isWhileStatement","isYieldExpression","isTSSatisfiesExpression","PRECEDENCE","in","instanceof","isTSTypeExpression","node","isClassExtendsClause","parent","superClass","hasPostfixPart","object","callee","tag","NullableTypeAnnotation","FunctionTypeAnnotation","printStack","length","UpdateExpression","ObjectExpression","isFirstInContext","DoExpression","async","Binary","operator","left","parentOp","parentPos","nodeOp","nodePos","right","UnionTypeAnnotation","OptionalIndexedAccessType","objectType","TSAsExpression","TSUnionType","TSInferType","TSInstantiationExpression","typeParameters","BinaryExpression","SequenceExpression","test","discriminant","expression","YieldExpression","ClassExpression","UnaryLike","FunctionExpression","ArrowFunctionExpression","ConditionalExpression","OptionalMemberExpression","AssignmentExpression","LogicalExpression","Identifier","_node$extra","extra","parenthesized","id","name","isFollowedByBracket","computed","optional","checkParam","expressionStatement","arrowBody","exportDefault","forHead","forInHead","forOfHead","i","declaration","body","init","expressions","prefix"],"sources":["../../src/node/parentheses.ts"],"sourcesContent":["import {\n isArrayTypeAnnotation,\n isArrowFunctionExpression,\n isAssignmentExpression,\n isAwaitExpression,\n isBinary,\n isBinaryExpression,\n isUpdateExpression,\n isCallExpression,\n isClass,\n isClassExpression,\n isConditional,\n isConditionalExpression,\n isExportDeclaration,\n isExportDefaultDeclaration,\n isExpressionStatement,\n isFor,\n isForInStatement,\n isForOfStatement,\n isForStatement,\n isFunctionExpression,\n isIfStatement,\n isIndexedAccessType,\n isIntersectionTypeAnnotation,\n isLogicalExpression,\n isMemberExpression,\n isNewExpression,\n isNullableTypeAnnotation,\n isObjectPattern,\n isOptionalCallExpression,\n isOptionalMemberExpression,\n isReturnStatement,\n isSequenceExpression,\n isSwitchStatement,\n isTSArrayType,\n isTSAsExpression,\n isTSInstantiationExpression,\n isTSIntersectionType,\n isTSNonNullExpression,\n isTSOptionalType,\n isTSRestType,\n isTSTypeAssertion,\n isTSUnionType,\n isTaggedTemplateExpression,\n isThrowStatement,\n isTypeAnnotation,\n isUnaryLike,\n isUnionTypeAnnotation,\n isVariableDeclarator,\n isWhileStatement,\n isYieldExpression,\n isTSSatisfiesExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nconst PRECEDENCE = {\n \"||\": 0,\n \"??\": 0,\n \"|>\": 0,\n \"&&\": 1,\n \"|\": 2,\n \"^\": 3,\n \"&\": 4,\n \"==\": 5,\n \"===\": 5,\n \"!=\": 5,\n \"!==\": 5,\n \"<\": 6,\n \">\": 6,\n \"<=\": 6,\n \">=\": 6,\n in: 6,\n instanceof: 6,\n \">>\": 7,\n \"<<\": 7,\n \">>>\": 7,\n \"+\": 8,\n \"-\": 8,\n \"*\": 9,\n \"/\": 9,\n \"%\": 9,\n \"**\": 10,\n};\n\nconst enum CheckParam {\n expressionStatement = 1 << 0,\n arrowBody = 1 << 1,\n exportDefault = 1 << 2,\n forHead = 1 << 3,\n forInHead = 1 << 4,\n forOfHead = 1 << 5,\n}\n\nfunction isTSTypeExpression(node: t.Node) {\n return (\n isTSAsExpression(node) ||\n isTSSatisfiesExpression(node) ||\n isTSTypeAssertion(node)\n );\n}\n\nconst isClassExtendsClause = (\n node: t.Node,\n parent: t.Node,\n): parent is t.Class => isClass(parent, { superClass: node });\n\nconst hasPostfixPart = (node: t.Node, parent: t.Node) =>\n ((isMemberExpression(parent) || isOptionalMemberExpression(parent)) &&\n parent.object === node) ||\n ((isCallExpression(parent) ||\n isOptionalCallExpression(parent) ||\n isNewExpression(parent)) &&\n parent.callee === node) ||\n (isTaggedTemplateExpression(parent) && parent.tag === node) ||\n isTSNonNullExpression(parent);\n\nexport function NullableTypeAnnotation(\n node: t.NullableTypeAnnotation,\n parent: t.Node,\n): boolean {\n return isArrayTypeAnnotation(parent);\n}\n\nexport function FunctionTypeAnnotation(\n node: t.FunctionTypeAnnotation,\n parent: t.Node,\n printStack: Array,\n): boolean {\n if (printStack.length < 3) return;\n\n return (\n // (() => A) | (() => B)\n isUnionTypeAnnotation(parent) ||\n // (() => A) & (() => B)\n isIntersectionTypeAnnotation(parent) ||\n // (() => A)[]\n isArrayTypeAnnotation(parent) ||\n // (A: T): (T => T[]) => B => [A, B]\n (isTypeAnnotation(parent) &&\n // Check grandparent\n isArrowFunctionExpression(printStack[printStack.length - 3]))\n );\n}\n\nexport function UpdateExpression(\n node: t.UpdateExpression,\n parent: t.Node,\n): boolean {\n return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);\n}\n\nexport function ObjectExpression(\n node: t.ObjectExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n return isFirstInContext(\n printStack,\n CheckParam.expressionStatement | CheckParam.arrowBody,\n );\n}\n\nexport function DoExpression(\n node: t.DoExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n // `async do` can start an expression statement\n return (\n !node.async && isFirstInContext(printStack, CheckParam.expressionStatement)\n );\n}\n\nexport function Binary(node: t.BinaryExpression, parent: t.Node): boolean {\n if (\n node.operator === \"**\" &&\n isBinaryExpression(parent, { operator: \"**\" })\n ) {\n return parent.left === node;\n }\n\n if (isClassExtendsClause(node, parent)) {\n return true;\n }\n\n if (\n hasPostfixPart(node, parent) ||\n isUnaryLike(parent) ||\n isAwaitExpression(parent)\n ) {\n return true;\n }\n\n if (isBinary(parent)) {\n const parentOp = parent.operator;\n const parentPos = PRECEDENCE[parentOp];\n\n const nodeOp = node.operator;\n const nodePos = PRECEDENCE[nodeOp];\n\n if (\n // Logical expressions with the same precedence don't need parens.\n (parentPos === nodePos &&\n parent.right === node &&\n !isLogicalExpression(parent)) ||\n parentPos > nodePos\n ) {\n return true;\n }\n }\n}\n\nexport function UnionTypeAnnotation(\n node: t.UnionTypeAnnotation,\n parent: t.Node,\n): boolean {\n return (\n isArrayTypeAnnotation(parent) ||\n isNullableTypeAnnotation(parent) ||\n isIntersectionTypeAnnotation(parent) ||\n isUnionTypeAnnotation(parent)\n );\n}\n\nexport { UnionTypeAnnotation as IntersectionTypeAnnotation };\n\nexport function OptionalIndexedAccessType(\n node: t.OptionalIndexedAccessType,\n parent: t.Node,\n): boolean {\n return isIndexedAccessType(parent, { objectType: node });\n}\n\nexport function TSAsExpression() {\n return true;\n}\n\nexport {\n TSAsExpression as TSSatisfiesExpression,\n TSAsExpression as TSTypeAssertion,\n};\n\nexport function TSUnionType(node: t.TSUnionType, parent: t.Node): boolean {\n return (\n isTSArrayType(parent) ||\n isTSOptionalType(parent) ||\n isTSIntersectionType(parent) ||\n isTSUnionType(parent) ||\n isTSRestType(parent)\n );\n}\n\nexport { TSUnionType as TSIntersectionType };\n\nexport function TSInferType(node: t.TSInferType, parent: t.Node): boolean {\n return isTSArrayType(parent) || isTSOptionalType(parent);\n}\n\nexport function TSInstantiationExpression(\n node: t.TSInstantiationExpression,\n parent: t.Node,\n) {\n return (\n (isCallExpression(parent) ||\n isOptionalCallExpression(parent) ||\n isNewExpression(parent) ||\n isTSInstantiationExpression(parent)) &&\n !!parent.typeParameters\n );\n}\n\nexport function BinaryExpression(\n node: t.BinaryExpression,\n parent: t.Node,\n): boolean {\n // let i = (1 in []);\n // for ((1 in []);;);\n return (\n node.operator === \"in\" && (isVariableDeclarator(parent) || isFor(parent))\n );\n}\n\nexport function SequenceExpression(\n node: t.SequenceExpression,\n parent: t.Node,\n): boolean {\n if (\n // Although parentheses wouldn't hurt around sequence\n // expressions in the head of for loops, traditional style\n // dictates that e.g. i++, j++ should not be wrapped with\n // parentheses.\n isForStatement(parent) ||\n isThrowStatement(parent) ||\n isReturnStatement(parent) ||\n (isIfStatement(parent) && parent.test === node) ||\n (isWhileStatement(parent) && parent.test === node) ||\n (isForInStatement(parent) && parent.right === node) ||\n (isSwitchStatement(parent) && parent.discriminant === node) ||\n (isExpressionStatement(parent) && parent.expression === node)\n ) {\n return false;\n }\n\n // Otherwise err on the side of overparenthesization, adding\n // explicit exceptions above if this proves overzealous.\n return true;\n}\n\nexport function YieldExpression(\n node: t.YieldExpression,\n parent: t.Node,\n): boolean {\n return (\n isBinary(parent) ||\n isUnaryLike(parent) ||\n hasPostfixPart(node, parent) ||\n (isAwaitExpression(parent) && isYieldExpression(node)) ||\n (isConditionalExpression(parent) && node === parent.test) ||\n isClassExtendsClause(node, parent)\n );\n}\n\nexport { YieldExpression as AwaitExpression };\n\nexport function ClassExpression(\n node: t.ClassExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n return isFirstInContext(\n printStack,\n CheckParam.expressionStatement | CheckParam.exportDefault,\n );\n}\n\nexport function UnaryLike(\n node:\n | t.UnaryLike\n | t.ArrowFunctionExpression\n | t.ConditionalExpression\n | t.AssignmentExpression,\n parent: t.Node,\n): boolean {\n return (\n hasPostfixPart(node, parent) ||\n isBinaryExpression(parent, { operator: \"**\", left: node }) ||\n isClassExtendsClause(node, parent)\n );\n}\n\nexport function FunctionExpression(\n node: t.FunctionExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n return isFirstInContext(\n printStack,\n CheckParam.expressionStatement | CheckParam.exportDefault,\n );\n}\n\nexport function ArrowFunctionExpression(\n node: t.ArrowFunctionExpression,\n parent: t.Node,\n): boolean {\n return isExportDeclaration(parent) || ConditionalExpression(node, parent);\n}\n\nexport function ConditionalExpression(\n node:\n | t.ConditionalExpression\n | t.ArrowFunctionExpression\n | t.AssignmentExpression,\n parent?: t.Node,\n): boolean {\n if (\n isUnaryLike(parent) ||\n isBinary(parent) ||\n isConditionalExpression(parent, { test: node }) ||\n isAwaitExpression(parent) ||\n isTSTypeExpression(parent)\n ) {\n return true;\n }\n\n return UnaryLike(node, parent);\n}\n\nexport function OptionalMemberExpression(\n node: t.OptionalMemberExpression,\n parent: t.Node,\n): boolean {\n return (\n isCallExpression(parent, { callee: node }) ||\n isMemberExpression(parent, { object: node })\n );\n}\n\nexport { OptionalMemberExpression as OptionalCallExpression };\n\nexport function AssignmentExpression(\n node: t.AssignmentExpression,\n parent: t.Node,\n): boolean {\n if (isObjectPattern(node.left)) {\n return true;\n } else {\n return ConditionalExpression(node, parent);\n }\n}\n\nexport function LogicalExpression(\n node: t.LogicalExpression,\n parent: t.Node,\n): boolean {\n if (isTSTypeExpression(parent)) return true;\n switch (node.operator) {\n case \"||\":\n if (!isLogicalExpression(parent)) return false;\n return parent.operator === \"??\" || parent.operator === \"&&\";\n case \"&&\":\n return isLogicalExpression(parent, { operator: \"??\" });\n case \"??\":\n return isLogicalExpression(parent) && parent.operator !== \"??\";\n }\n}\n\nexport function Identifier(\n node: t.Identifier,\n parent: t.Node,\n printStack: Array,\n): boolean {\n // 13.15.2 AssignmentExpression RS: Evaluation\n // (fn) = function () {};\n if (\n node.extra?.parenthesized &&\n isAssignmentExpression(parent, { left: node }) &&\n (isFunctionExpression(parent.right) || isClassExpression(parent.right)) &&\n parent.right.id == null\n ) {\n return true;\n }\n // Non-strict code allows the identifier `let`, but it cannot occur as-is in\n // certain contexts to avoid ambiguity with contextual keyword `let`.\n if (node.name === \"let\") {\n // Some contexts only forbid `let [`, so check if the next token would\n // be the left bracket of a computed member expression.\n const isFollowedByBracket =\n isMemberExpression(parent, {\n object: node,\n computed: true,\n }) ||\n isOptionalMemberExpression(parent, {\n object: node,\n computed: true,\n optional: false,\n });\n return isFirstInContext(\n printStack,\n isFollowedByBracket\n ? CheckParam.expressionStatement |\n CheckParam.forHead |\n CheckParam.forInHead |\n CheckParam.forOfHead\n : CheckParam.forOfHead,\n );\n }\n\n // ECMAScript specifically forbids a for-of loop from starting with the\n // token sequence `for (async of`, because it would be ambiguous with\n // `for (async of => {};;)`, so we need to add extra parentheses.\n //\n // If the parent is a for-await-of loop (i.e. parent.await === true), the\n // parentheses aren't strictly needed, but we add them anyway because\n // some tools (including earlier Babel versions) can't parse\n // `for await (async of [])` without them.\n return (\n node.name === \"async\" && isForOfStatement(parent) && node === parent.left\n );\n}\n\n// Walk up the print stack to determine if our node can come first\n// in a particular context.\nfunction isFirstInContext(\n printStack: Array,\n checkParam: CheckParam,\n): boolean {\n const expressionStatement = checkParam & CheckParam.expressionStatement;\n const arrowBody = checkParam & CheckParam.arrowBody;\n const exportDefault = checkParam & CheckParam.exportDefault;\n const forHead = checkParam & CheckParam.forHead;\n const forInHead = checkParam & CheckParam.forInHead;\n const forOfHead = checkParam & CheckParam.forOfHead;\n\n let i = printStack.length - 1;\n if (i <= 0) return;\n let node = printStack[i];\n i--;\n let parent = printStack[i];\n while (i >= 0) {\n if (\n (expressionStatement &&\n isExpressionStatement(parent, { expression: node })) ||\n (exportDefault &&\n isExportDefaultDeclaration(parent, { declaration: node })) ||\n (arrowBody && isArrowFunctionExpression(parent, { body: node })) ||\n (forHead && isForStatement(parent, { init: node })) ||\n (forInHead && isForInStatement(parent, { left: node })) ||\n (forOfHead && isForOfStatement(parent, { left: node }))\n ) {\n return true;\n }\n\n if (\n i > 0 &&\n ((hasPostfixPart(node, parent) && !isNewExpression(parent)) ||\n (isSequenceExpression(parent) && parent.expressions[0] === node) ||\n (isUpdateExpression(parent) && !parent.prefix) ||\n isConditional(parent, { test: node }) ||\n isBinary(parent, { left: node }) ||\n isAssignmentExpression(parent, { left: node }))\n ) {\n node = parent;\n i--;\n parent = printStack[i];\n } else {\n return false;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAoDsB;EAnDpBC,qBAAqB;EACrBC,yBAAyB;EACzBC,sBAAsB;EACtBC,iBAAiB;EACjBC,QAAQ;EACRC,kBAAkB;EAClBC,kBAAkB;EAClBC,gBAAgB;EAChBC,OAAO;EACPC,iBAAiB;EACjBC,aAAa;EACbC,uBAAuB;EACvBC,mBAAmB;EACnBC,0BAA0B;EAC1BC,qBAAqB;EACrBC,KAAK;EACLC,gBAAgB;EAChBC,gBAAgB;EAChBC,cAAc;EACdC,oBAAoB;EACpBC,aAAa;EACbC,mBAAmB;EACnBC,4BAA4B;EAC5BC,mBAAmB;EACnBC,kBAA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I;IACb;IAEA,IACE+D,CAAC,GAAG,CAAC,KACH3D,cAAc,CAACJ,IAAI,EAAEE,MAAM,CAAC,IAAI,CAAChC,eAAe,CAACgC,MAAM,CAAC,IACvD1B,oBAAoB,CAAC0B,MAAM,CAAC,IAAIA,MAAM,CAACiE,WAAW,CAAC,CAAC,CAAC,KAAKnE,IAAK,IAC/DjD,kBAAkB,CAACmD,MAAM,CAAC,IAAI,CAACA,MAAM,CAACkE,MAAO,IAC9CjH,aAAa,CAAC+C,MAAM,EAAE;MAAEiC,IAAI,EAAEnC;IAAK,CAAC,CAAC,IACrCnD,QAAQ,CAACqD,MAAM,EAAE;MAAEiB,IAAI,EAAEnB;IAAK,CAAC,CAAC,IAChCrD,sBAAsB,CAACuD,MAAM,EAAE;MAAEiB,IAAI,EAAEnB;IAAK,CAAC,CAAC,CAAC,EACjD;MACAA,IAAI,GAAGE,MAAM;MACb6D,CAAC,EAAE;MACH7D,MAAM,GAAGQ,UAAU,CAACqD,CAAC,CAAC;IACxB,CAAC,MAAM;MACL,OAAO,KAAK;IACd;EACF;EAEA,OAAO,KAAK;AACd"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/node/whitespace.js b/node_modules/@babel/generator/lib/node/whitespace.js deleted file mode 100644 index 17daf359e..000000000 --- a/node_modules/@babel/generator/lib/node/whitespace.js +++ /dev/null @@ -1,146 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.nodes = void 0; -var _t = require("@babel/types"); -const { - FLIPPED_ALIAS_KEYS, - isArrayExpression, - isAssignmentExpression, - isBinary, - isBlockStatement, - isCallExpression, - isFunction, - isIdentifier, - isLiteral, - isMemberExpression, - isObjectExpression, - isOptionalCallExpression, - isOptionalMemberExpression, - isStringLiteral -} = _t; -function crawlInternal(node, state) { - if (!node) return state; - if (isMemberExpression(node) || isOptionalMemberExpression(node)) { - crawlInternal(node.object, state); - if (node.computed) crawlInternal(node.property, state); - } else if (isBinary(node) || isAssignmentExpression(node)) { - crawlInternal(node.left, state); - crawlInternal(node.right, state); - } else if (isCallExpression(node) || isOptionalCallExpression(node)) { - state.hasCall = true; - crawlInternal(node.callee, state); - } else if (isFunction(node)) { - state.hasFunction = true; - } else if (isIdentifier(node)) { - state.hasHelper = state.hasHelper || node.callee && isHelper(node.callee); - } - return state; -} -function crawl(node) { - return crawlInternal(node, { - hasCall: false, - hasFunction: false, - hasHelper: false - }); -} -function isHelper(node) { - if (!node) return false; - if (isMemberExpression(node)) { - return isHelper(node.object) || isHelper(node.property); - } else if (isIdentifier(node)) { - return node.name === "require" || node.name.charCodeAt(0) === 95; - } else if (isCallExpression(node)) { - return isHelper(node.callee); - } else if (isBinary(node) || isAssignmentExpression(node)) { - return isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right); - } else { - return false; - } -} -function isType(node) { - return isLiteral(node) || isObjectExpression(node) || isArrayExpression(node) || isIdentifier(node) || isMemberExpression(node); -} -const nodes = { - AssignmentExpression(node) { - const state = crawl(node.right); - if (state.hasCall && state.hasHelper || state.hasFunction) { - return state.hasFunction ? 1 | 2 : 2; - } - }, - SwitchCase(node, parent) { - return (!!node.consequent.length || parent.cases[0] === node ? 1 : 0) | (!node.consequent.length && parent.cases[parent.cases.length - 1] === node ? 2 : 0); - }, - LogicalExpression(node) { - if (isFunction(node.left) || isFunction(node.right)) { - return 2; - } - }, - Literal(node) { - if (isStringLiteral(node) && node.value === "use strict") { - return 2; - } - }, - CallExpression(node) { - if (isFunction(node.callee) || isHelper(node)) { - return 1 | 2; - } - }, - OptionalCallExpression(node) { - if (isFunction(node.callee)) { - return 1 | 2; - } - }, - VariableDeclaration(node) { - for (let i = 0; i < node.declarations.length; i++) { - const declar = node.declarations[i]; - let enabled = isHelper(declar.id) && !isType(declar.init); - if (!enabled && declar.init) { - const state = crawl(declar.init); - enabled = isHelper(declar.init) && state.hasCall || state.hasFunction; - } - if (enabled) { - return 1 | 2; - } - } - }, - IfStatement(node) { - if (isBlockStatement(node.consequent)) { - return 1 | 2; - } - } -}; -exports.nodes = nodes; -nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node, parent) { - if (parent.properties[0] === node) { - return 1; - } -}; -nodes.ObjectTypeCallProperty = function (node, parent) { - var _parent$properties; - if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) != null && _parent$properties.length)) { - return 1; - } -}; -nodes.ObjectTypeIndexer = function (node, parent) { - var _parent$properties2, _parent$callPropertie; - if (parent.indexers[0] === node && !((_parent$properties2 = parent.properties) != null && _parent$properties2.length) && !((_parent$callPropertie = parent.callProperties) != null && _parent$callPropertie.length)) { - return 1; - } -}; -nodes.ObjectTypeInternalSlot = function (node, parent) { - var _parent$properties3, _parent$callPropertie2, _parent$indexers; - if (parent.internalSlots[0] === node && !((_parent$properties3 = parent.properties) != null && _parent$properties3.length) && !((_parent$callPropertie2 = parent.callProperties) != null && _parent$callPropertie2.length) && !((_parent$indexers = parent.indexers) != null && _parent$indexers.length)) { - return 1; - } -}; -[["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function ([type, amounts]) { - [type].concat(FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { - const ret = amounts ? 1 | 2 : 0; - nodes[type] = () => ret; - }); -}); - -//# sourceMappingURL=whitespace.js.map diff --git a/node_modules/@babel/generator/lib/node/whitespace.js.map b/node_modules/@babel/generator/lib/node/whitespace.js.map deleted file mode 100644 index 249c40beb..000000000 --- a/node_modules/@babel/generator/lib/node/whitespace.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_t","require","FLIPPED_ALIAS_KEYS","isArrayExpression","isAssignmentExpression","isBinary","isBlockStatement","isCallExpression","isFunction","isIdentifier","isLiteral","isMemberExpression","isObjectExpression","isOptionalCallExpression","isOptionalMemberExpression","isStringLiteral","crawlInternal","node","state","object","computed","property","left","right","hasCall","callee","hasFunction","hasHelper","isHelper","crawl","name","charCodeAt","isType","nodes","AssignmentExpression","SwitchCase","parent","consequent","length","cases","LogicalExpression","Literal","value","CallExpression","OptionalCallExpression","VariableDeclaration","i","declarations","declar","enabled","id","init","IfStatement","exports","ObjectProperty","ObjectTypeProperty","ObjectMethod","properties","ObjectTypeCallProperty","_parent$properties","callProperties","ObjectTypeIndexer","_parent$properties2","_parent$callPropertie","indexers","ObjectTypeInternalSlot","_parent$properties3","_parent$callPropertie2","_parent$indexers","internalSlots","forEach","type","amounts","concat","ret"],"sources":["../../src/node/whitespace.ts"],"sourcesContent":["import {\n FLIPPED_ALIAS_KEYS,\n isArrayExpression,\n isAssignmentExpression,\n isBinary,\n isBlockStatement,\n isCallExpression,\n isFunction,\n isIdentifier,\n isLiteral,\n isMemberExpression,\n isObjectExpression,\n isOptionalCallExpression,\n isOptionalMemberExpression,\n isStringLiteral,\n} from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nimport type { NodeHandlers } from \"./index\";\n\nimport type * as t from \"@babel/types\";\n\nconst enum WhitespaceFlag {\n before = 1 << 0,\n after = 1 << 1,\n}\n\nexport type { WhitespaceFlag };\n\nfunction crawlInternal(\n node: t.Node,\n state: { hasCall: boolean; hasFunction: boolean; hasHelper: boolean },\n) {\n if (!node) return state;\n\n if (isMemberExpression(node) || isOptionalMemberExpression(node)) {\n crawlInternal(node.object, state);\n if (node.computed) crawlInternal(node.property, state);\n } else if (isBinary(node) || isAssignmentExpression(node)) {\n crawlInternal(node.left, state);\n crawlInternal(node.right, state);\n } else if (isCallExpression(node) || isOptionalCallExpression(node)) {\n state.hasCall = true;\n crawlInternal(node.callee, state);\n } else if (isFunction(node)) {\n state.hasFunction = true;\n } else if (isIdentifier(node)) {\n state.hasHelper =\n // @ts-expect-error todo(flow->ts): node.callee is not really expected here…\n state.hasHelper || (node.callee && isHelper(node.callee));\n }\n\n return state;\n}\n\n/**\n * Crawl a node to test if it contains a CallExpression, a Function, or a Helper.\n *\n * @example\n * crawl(node)\n * // { hasCall: false, hasFunction: true, hasHelper: false }\n */\n\nfunction crawl(node: t.Node) {\n return crawlInternal(node, {\n hasCall: false,\n hasFunction: false,\n hasHelper: false,\n });\n}\n\n/**\n * Test if a node is or has a helper.\n */\n\nfunction isHelper(node: t.Node): boolean {\n if (!node) return false;\n\n if (isMemberExpression(node)) {\n return isHelper(node.object) || isHelper(node.property);\n } else if (isIdentifier(node)) {\n return (\n node.name === \"require\" ||\n node.name.charCodeAt(0) === charCodes.underscore\n );\n } else if (isCallExpression(node)) {\n return isHelper(node.callee);\n } else if (isBinary(node) || isAssignmentExpression(node)) {\n return (\n (isIdentifier(node.left) && isHelper(node.left)) || isHelper(node.right)\n );\n } else {\n return false;\n }\n}\n\nfunction isType(node: t.Node) {\n return (\n isLiteral(node) ||\n isObjectExpression(node) ||\n isArrayExpression(node) ||\n isIdentifier(node) ||\n isMemberExpression(node)\n );\n}\n\n/**\n * Tests for node types that need whitespace.\n */\n\nexport const nodes: NodeHandlers = {\n /**\n * Test if AssignmentExpression needs whitespace.\n */\n\n AssignmentExpression(node: t.AssignmentExpression): WhitespaceFlag {\n const state = crawl(node.right);\n if ((state.hasCall && state.hasHelper) || state.hasFunction) {\n return state.hasFunction\n ? WhitespaceFlag.before | WhitespaceFlag.after\n : WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if SwitchCase needs whitespace.\n */\n\n SwitchCase(node: t.SwitchCase, parent: t.SwitchStatement): WhitespaceFlag {\n return (\n (!!node.consequent.length || parent.cases[0] === node\n ? WhitespaceFlag.before\n : 0) |\n (!node.consequent.length && parent.cases[parent.cases.length - 1] === node\n ? WhitespaceFlag.after\n : 0)\n );\n },\n\n /**\n * Test if LogicalExpression needs whitespace.\n */\n\n LogicalExpression(node: t.LogicalExpression): WhitespaceFlag {\n if (isFunction(node.left) || isFunction(node.right)) {\n return WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if Literal needs whitespace.\n */\n\n Literal(node: t.Literal): WhitespaceFlag {\n if (isStringLiteral(node) && node.value === \"use strict\") {\n return WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if CallExpressionish needs whitespace.\n */\n\n CallExpression(node: t.CallExpression): WhitespaceFlag {\n if (isFunction(node.callee) || isHelper(node)) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n },\n\n OptionalCallExpression(node: t.OptionalCallExpression): WhitespaceFlag {\n if (isFunction(node.callee)) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if VariableDeclaration needs whitespace.\n */\n\n VariableDeclaration(node: t.VariableDeclaration): WhitespaceFlag {\n for (let i = 0; i < node.declarations.length; i++) {\n const declar = node.declarations[i];\n\n let enabled = isHelper(declar.id) && !isType(declar.init);\n if (!enabled && declar.init) {\n const state = crawl(declar.init);\n enabled = (isHelper(declar.init) && state.hasCall) || state.hasFunction;\n }\n\n if (enabled) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n }\n },\n\n /**\n * Test if IfStatement needs whitespace.\n */\n\n IfStatement(node: t.IfStatement): WhitespaceFlag {\n if (isBlockStatement(node.consequent)) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n },\n};\n\n/**\n * Test if Property needs whitespace.\n */\n\nnodes.ObjectProperty =\n nodes.ObjectTypeProperty =\n nodes.ObjectMethod =\n function (\n node: t.ObjectProperty | t.ObjectTypeProperty | t.ObjectMethod,\n parent: t.ObjectExpression,\n ): WhitespaceFlag {\n if (parent.properties[0] === node) {\n return WhitespaceFlag.before;\n }\n };\n\nnodes.ObjectTypeCallProperty = function (\n node: t.ObjectTypeCallProperty,\n parent: t.ObjectTypeAnnotation,\n): WhitespaceFlag {\n if (parent.callProperties[0] === node && !parent.properties?.length) {\n return WhitespaceFlag.before;\n }\n};\n\nnodes.ObjectTypeIndexer = function (\n node: t.ObjectTypeIndexer,\n parent: t.ObjectTypeAnnotation,\n): WhitespaceFlag {\n if (\n parent.indexers[0] === node &&\n !parent.properties?.length &&\n !parent.callProperties?.length\n ) {\n return WhitespaceFlag.before;\n }\n};\n\nnodes.ObjectTypeInternalSlot = function (\n node: t.ObjectTypeInternalSlot,\n parent: t.ObjectTypeAnnotation,\n): WhitespaceFlag {\n if (\n parent.internalSlots[0] === node &&\n !parent.properties?.length &&\n !parent.callProperties?.length &&\n !parent.indexers?.length\n ) {\n return WhitespaceFlag.before;\n }\n};\n\n/**\n * Add whitespace tests for nodes and their aliases.\n */\n\n(\n [\n [\"Function\", true],\n [\"Class\", true],\n [\"Loop\", true],\n [\"LabeledStatement\", true],\n [\"SwitchStatement\", true],\n [\"TryStatement\", true],\n ] as const\n).forEach(function ([type, amounts]) {\n [type as string]\n .concat(FLIPPED_ALIAS_KEYS[type] || [])\n .forEach(function (type) {\n const ret = amounts ? WhitespaceFlag.before | WhitespaceFlag.after : 0;\n nodes[type] = () => ret;\n });\n});\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAesB;EAdpBC,kBAAkB;EAClBC,iBAAiB;EACjBC,sBAAsB;EACtBC,QAAQ;EACRC,gBAAgB;EAChBC,gBAAgB;EAChBC,UAAU;EACVC,YAAY;EACZC,SAAS;EACTC,kBAAkB;EAClBC,kBAAkB;EAClBC,wBAAwB;EACxBC,0BAA0B;EAC1BC;AAAe,IAAAf,EAAA;AAejB,SAASgB,aAAaA,CACpBC,IAAY,EACZC,KAAqE,EACrE;EACA,IAAI,CAACD,IAAI,EAAE,OAAOC,KAAK;EAEvB,IAAIP,kBAAkB,CAACM,IAAI,CAAC,IAAIH,0BAA0B,CAACG,IAAI,CAAC,EAAE;IAChED,aAAa,CAACC,IAAI,CAACE,MAAM,EAAED,KAAK,CAAC;IACjC,IAAID,IAAI,CAACG,QAAQ,EAAEJ,aAAa,CAACC,IAAI,CAACI,QAAQ,EAAEH,KAAK,CAAC;EACxD,CAAC,MAAM,IAAIb,QAAQ,CAACY,IAAI,CAAC,IAAIb,sBAAsB,CAACa,IAAI,CAAC,EAAE;IACzDD,aAAa,CAACC,IAAI,CAACK,IAAI,EAAEJ,KAAK,CAAC;IA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C/B,MAAM,CAACwB,cAAc,aAArBO,sBAAA,CAAuB7B,MAAM,KAC9B,GAAA8B,gBAAA,GAAChC,MAAM,CAAC4B,QAAQ,aAAfI,gBAAA,CAAiB9B,MAAM,GACxB;IACA;EACF;AACF,CAAC;AAOC,CACE,CAAC,UAAU,EAAE,IAAI,CAAC,EAClB,CAAC,OAAO,EAAE,IAAI,CAAC,EACf,CAAC,MAAM,EAAE,IAAI,CAAC,EACd,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAC1B,CAAC,iBAAiB,EAAE,IAAI,CAAC,EACzB,CAAC,cAAc,EAAE,IAAI,CAAC,CACvB,CACDgC,OAAO,CAAC,UAAU,CAACC,IAAI,EAAEC,OAAO,CAAC,EAAE;EACnC,CAACD,IAAI,CAAW,CACbE,MAAM,CAACvE,kBAAkB,CAACqE,IAAI,CAAC,IAAI,EAAE,CAAC,CACtCD,OAAO,CAAC,UAAUC,IAAI,EAAE;IACvB,MAAMG,GAAG,GAAGF,OAAO,GAAG,KAA4C,GAAG,CAAC;IACtEvC,KAAK,CAACsC,IAAI,CAAC,GAAG,MAAMG,GAAG;EACzB,CAAC,CAAC;AACN,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/printer.js b/node_modules/@babel/generator/lib/printer.js deleted file mode 100644 index 58a2954f7..000000000 --- a/node_modules/@babel/generator/lib/printer.js +++ /dev/null @@ -1,640 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _buffer = require("./buffer"); -var n = require("./node"); -var _t = require("@babel/types"); -var generatorFunctions = require("./generators"); -require("@jridgewell/trace-mapping"); -const { - isFunction, - isStatement, - isClassBody, - isTSInterfaceBody, - isTSEnumDeclaration -} = _t; -const SCIENTIFIC_NOTATION = /e/i; -const ZERO_DECIMAL_INTEGER = /\.0+$/; -const NON_DECIMAL_LITERAL = /^0[box]/; -const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/; -const HAS_NEWLINE = /[\n\r\u2028\u2029]/; -const HAS_BlOCK_COMMENT_END = /\*\//; -const { - needsParens -} = n; -class Printer { - constructor(format, map) { - this.inForStatementInitCounter = 0; - this._printStack = []; - this._indent = 0; - this._indentChar = 0; - this._indentRepeat = 0; - this._insideAux = false; - this._parenPushNewlineState = null; - this._noLineTerminator = false; - this._printAuxAfterOnNextUserNode = false; - this._printedComments = new Set(); - this._endsWithInteger = false; - this._endsWithWord = false; - this._lastCommentLine = 0; - this._endsWithInnerRaw = false; - this._indentInnerComments = true; - this.format = format; - this._buf = new _buffer.default(map); - this._indentChar = format.indent.style.charCodeAt(0); - this._indentRepeat = format.indent.style.length; - this._inputMap = map == null ? void 0 : map._inputMap; - } - generate(ast) { - this.print(ast); - this._maybeAddAuxComment(); - return this._buf.get(); - } - indent() { - if (this.format.compact || this.format.concise) return; - this._indent++; - } - dedent() { - if (this.format.compact || this.format.concise) return; - this._indent--; - } - semicolon(force = false) { - this._maybeAddAuxComment(); - if (force) { - this._appendChar(59); - } else { - this._queue(59); - } - this._noLineTerminator = false; - } - rightBrace(node) { - if (this.format.minified) { - this._buf.removeLastSemicolon(); - } - this.sourceWithOffset("end", node.loc, 0, -1); - this.tokenChar(125); - } - rightParens(node) { - this.sourceWithOffset("end", node.loc, 0, -1); - this.tokenChar(41); - } - space(force = false) { - if (this.format.compact) return; - if (force) { - this._space(); - } else if (this._buf.hasContent()) { - const lastCp = this.getLastChar(); - if (lastCp !== 32 && lastCp !== 10) { - this._space(); - } - } - } - word(str, noLineTerminatorAfter = false) { - this._maybePrintInnerComments(); - if (this._endsWithWord || str.charCodeAt(0) === 47 && this.endsWith(47)) { - this._space(); - } - this._maybeAddAuxComment(); - this._append(str, false); - this._endsWithWord = true; - this._noLineTerminator = noLineTerminatorAfter; - } - number(str) { - this.word(str); - this._endsWithInteger = Number.isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46; - } - token(str, maybeNewline = false) { - this._maybePrintInnerComments(); - const lastChar = this.getLastChar(); - const strFirst = str.charCodeAt(0); - if (lastChar === 33 && (str === "--" || strFirst === 61) || strFirst === 43 && lastChar === 43 || strFirst === 45 && lastChar === 45 || strFirst === 46 && this._endsWithInteger) { - this._space(); - } - this._maybeAddAuxComment(); - this._append(str, maybeNewline); - this._noLineTerminator = false; - } - tokenChar(char) { - this._maybePrintInnerComments(); - const lastChar = this.getLastChar(); - if (char === 43 && lastChar === 43 || char === 45 && lastChar === 45 || char === 46 && this._endsWithInteger) { - this._space(); - } - this._maybeAddAuxComment(); - this._appendChar(char); - this._noLineTerminator = false; - } - newline(i = 1, force) { - if (i <= 0) return; - if (!force) { - if (this.format.retainLines || this.format.compact) return; - if (this.format.concise) { - this.space(); - return; - } - } - if (i > 2) i = 2; - i -= this._buf.getNewlineCount(); - for (let j = 0; j < i; j++) { - this._newline(); - } - return; - } - endsWith(char) { - return this.getLastChar() === char; - } - getLastChar() { - return this._buf.getLastChar(); - } - endsWithCharAndNewline() { - return this._buf.endsWithCharAndNewline(); - } - removeTrailingNewline() { - this._buf.removeTrailingNewline(); - } - exactSource(loc, cb) { - if (!loc) { - cb(); - return; - } - this._catchUp("start", loc); - this._buf.exactSource(loc, cb); - } - source(prop, loc) { - if (!loc) return; - this._catchUp(prop, loc); - this._buf.source(prop, loc); - } - sourceWithOffset(prop, loc, lineOffset, columnOffset) { - if (!loc) return; - this._catchUp(prop, loc); - this._buf.sourceWithOffset(prop, loc, lineOffset, columnOffset); - } - withSource(prop, loc, cb) { - if (!loc) { - cb(); - return; - } - this._catchUp(prop, loc); - this._buf.withSource(prop, loc, cb); - } - sourceIdentifierName(identifierName, pos) { - if (!this._buf._canMarkIdName) return; - const sourcePosition = this._buf._sourcePosition; - sourcePosition.identifierNamePos = pos; - sourcePosition.identifierName = identifierName; - } - _space() { - this._queue(32); - } - _newline() { - this._queue(10); - } - _append(str, maybeNewline) { - this._maybeAddParen(str); - this._maybeIndent(str.charCodeAt(0)); - this._buf.append(str, maybeNewline); - this._endsWithWord = false; - this._endsWithInteger = false; - } - _appendChar(char) { - this._maybeAddParenChar(char); - this._maybeIndent(char); - this._buf.appendChar(char); - this._endsWithWord = false; - this._endsWithInteger = false; - } - _queue(char) { - this._maybeAddParenChar(char); - this._maybeIndent(char); - this._buf.queue(char); - this._endsWithWord = false; - this._endsWithInteger = false; - } - _maybeIndent(firstChar) { - if (this._indent && firstChar !== 10 && this.endsWith(10)) { - this._buf.queueIndentation(this._indentChar, this._getIndent()); - } - } - _shouldIndent(firstChar) { - if (this._indent && firstChar !== 10 && this.endsWith(10)) { - return true; - } - } - _maybeAddParenChar(char) { - const parenPushNewlineState = this._parenPushNewlineState; - if (!parenPushNewlineState) return; - if (char === 32) { - return; - } - if (char !== 10) { - this._parenPushNewlineState = null; - return; - } - this.tokenChar(40); - this.indent(); - parenPushNewlineState.printed = true; - } - _maybeAddParen(str) { - const parenPushNewlineState = this._parenPushNewlineState; - if (!parenPushNewlineState) return; - const len = str.length; - let i; - for (i = 0; i < len && str.charCodeAt(i) === 32; i++) continue; - if (i === len) { - return; - } - const cha = str.charCodeAt(i); - if (cha !== 10) { - if (cha !== 47 || i + 1 === len) { - this._parenPushNewlineState = null; - return; - } - const chaPost = str.charCodeAt(i + 1); - if (chaPost === 42) { - if (PURE_ANNOTATION_RE.test(str.slice(i + 2, len - 2))) { - return; - } - } else if (chaPost !== 47) { - this._parenPushNewlineState = null; - return; - } - } - this.tokenChar(40); - this.indent(); - parenPushNewlineState.printed = true; - } - catchUp(line) { - if (!this.format.retainLines) return; - const count = line - this._buf.getCurrentLine(); - for (let i = 0; i < count; i++) { - this._newline(); - } - } - _catchUp(prop, loc) { - var _loc$prop; - if (!this.format.retainLines) return; - const line = loc == null ? void 0 : (_loc$prop = loc[prop]) == null ? void 0 : _loc$prop.line; - if (line != null) { - const count = line - this._buf.getCurrentLine(); - for (let i = 0; i < count; i++) { - this._newline(); - } - } - } - _getIndent() { - return this._indentRepeat * this._indent; - } - printTerminatorless(node, parent, isLabel) { - if (isLabel) { - this._noLineTerminator = true; - this.print(node, parent); - } else { - const terminatorState = { - printed: false - }; - this._parenPushNewlineState = terminatorState; - this.print(node, parent); - if (terminatorState.printed) { - this.dedent(); - this.newline(); - this.tokenChar(41); - } - } - } - print(node, parent, noLineTerminatorAfter, trailingCommentsLineOffset, forceParens) { - var _node$extra; - if (!node) return; - this._endsWithInnerRaw = false; - const nodeType = node.type; - const format = this.format; - const oldConcise = format.concise; - if (node._compact) { - format.concise = true; - } - const printMethod = this[nodeType]; - if (printMethod === undefined) { - throw new ReferenceError(`unknown node of type ${JSON.stringify(nodeType)} with constructor ${JSON.stringify(node.constructor.name)}`); - } - this._printStack.push(node); - const oldInAux = this._insideAux; - this._insideAux = node.loc == undefined; - this._maybeAddAuxComment(this._insideAux && !oldInAux); - const shouldPrintParens = forceParens || format.retainFunctionParens && nodeType === "FunctionExpression" && ((_node$extra = node.extra) == null ? void 0 : _node$extra.parenthesized) || needsParens(node, parent, this._printStack); - if (shouldPrintParens) { - this.tokenChar(40); - this._endsWithInnerRaw = false; - } - this._lastCommentLine = 0; - this._printLeadingComments(node, parent); - const loc = nodeType === "Program" || nodeType === "File" ? null : node.loc; - this.exactSource(loc, printMethod.bind(this, node, parent)); - if (shouldPrintParens) { - this._printTrailingComments(node, parent); - this.tokenChar(41); - this._noLineTerminator = noLineTerminatorAfter; - } else if (noLineTerminatorAfter && !this._noLineTerminator) { - this._noLineTerminator = true; - this._printTrailingComments(node, parent); - } else { - this._printTrailingComments(node, parent, trailingCommentsLineOffset); - } - this._printStack.pop(); - format.concise = oldConcise; - this._insideAux = oldInAux; - this._endsWithInnerRaw = false; - } - _maybeAddAuxComment(enteredPositionlessNode) { - if (enteredPositionlessNode) this._printAuxBeforeComment(); - if (!this._insideAux) this._printAuxAfterComment(); - } - _printAuxBeforeComment() { - if (this._printAuxAfterOnNextUserNode) return; - this._printAuxAfterOnNextUserNode = true; - const comment = this.format.auxiliaryCommentBefore; - if (comment) { - this._printComment({ - type: "CommentBlock", - value: comment - }, 0); - } - } - _printAuxAfterComment() { - if (!this._printAuxAfterOnNextUserNode) return; - this._printAuxAfterOnNextUserNode = false; - const comment = this.format.auxiliaryCommentAfter; - if (comment) { - this._printComment({ - type: "CommentBlock", - value: comment - }, 0); - } - } - getPossibleRaw(node) { - const extra = node.extra; - if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) { - return extra.raw; - } - } - printJoin(nodes, parent, opts = {}) { - if (!(nodes != null && nodes.length)) return; - if (opts.indent) this.indent(); - const newlineOpts = { - addNewlines: opts.addNewlines, - nextNodeStartLine: 0 - }; - const separator = opts.separator ? opts.separator.bind(this) : null; - const len = nodes.length; - for (let i = 0; i < len; i++) { - const node = nodes[i]; - if (!node) continue; - if (opts.statement) this._printNewline(i === 0, newlineOpts); - this.print(node, parent, undefined, opts.trailingCommentsLineOffset || 0); - opts.iterator == null ? void 0 : opts.iterator(node, i); - if (i < len - 1) separator == null ? void 0 : separator(); - if (opts.statement) { - if (i + 1 === len) { - this.newline(1); - } else { - var _nextNode$loc; - const nextNode = nodes[i + 1]; - newlineOpts.nextNodeStartLine = ((_nextNode$loc = nextNode.loc) == null ? void 0 : _nextNode$loc.start.line) || 0; - this._printNewline(true, newlineOpts); - } - } - } - if (opts.indent) this.dedent(); - } - printAndIndentOnComments(node, parent) { - const indent = node.leadingComments && node.leadingComments.length > 0; - if (indent) this.indent(); - this.print(node, parent); - if (indent) this.dedent(); - } - printBlock(parent) { - const node = parent.body; - if (node.type !== "EmptyStatement") { - this.space(); - } - this.print(node, parent); - } - _printTrailingComments(node, parent, lineOffset) { - const { - innerComments, - trailingComments - } = node; - if (innerComments != null && innerComments.length) { - this._printComments(2, innerComments, node, parent, lineOffset); - } - if (trailingComments != null && trailingComments.length) { - this._printComments(2, trailingComments, node, parent, lineOffset); - } - } - _printLeadingComments(node, parent) { - const comments = node.leadingComments; - if (!(comments != null && comments.length)) return; - this._printComments(0, comments, node, parent); - } - _maybePrintInnerComments() { - if (this._endsWithInnerRaw) this.printInnerComments(); - this._endsWithInnerRaw = true; - this._indentInnerComments = true; - } - printInnerComments() { - const node = this._printStack[this._printStack.length - 1]; - const comments = node.innerComments; - if (!(comments != null && comments.length)) return; - const hasSpace = this.endsWith(32); - const indent = this._indentInnerComments; - const printedCommentsCount = this._printedComments.size; - if (indent) this.indent(); - this._printComments(1, comments, node); - if (hasSpace && printedCommentsCount !== this._printedComments.size) { - this.space(); - } - if (indent) this.dedent(); - } - noIndentInnerCommentsHere() { - this._indentInnerComments = false; - } - printSequence(nodes, parent, opts = {}) { - opts.statement = true; - this.printJoin(nodes, parent, opts); - } - printList(items, parent, opts = {}) { - if (opts.separator == null) { - opts.separator = commaSeparator; - } - this.printJoin(items, parent, opts); - } - _printNewline(newLine, opts) { - const format = this.format; - if (format.retainLines || format.compact) return; - if (format.concise) { - this.space(); - return; - } - if (!newLine) { - return; - } - const startLine = opts.nextNodeStartLine; - const lastCommentLine = this._lastCommentLine; - if (startLine > 0 && lastCommentLine > 0) { - const offset = startLine - lastCommentLine; - if (offset >= 0) { - this.newline(offset || 1); - return; - } - } - if (this._buf.hasContent()) { - this.newline(1); - } - } - _shouldPrintComment(comment) { - if (comment.ignore) return 0; - if (this._printedComments.has(comment)) return 0; - if (this._noLineTerminator && (HAS_NEWLINE.test(comment.value) || HAS_BlOCK_COMMENT_END.test(comment.value))) { - return 2; - } - this._printedComments.add(comment); - if (!this.format.shouldPrintComment(comment.value)) { - return 0; - } - return 1; - } - _printComment(comment, skipNewLines) { - const noLineTerminator = this._noLineTerminator; - const isBlockComment = comment.type === "CommentBlock"; - const printNewLines = isBlockComment && skipNewLines !== 1 && !this._noLineTerminator; - if (printNewLines && this._buf.hasContent() && skipNewLines !== 2) { - this.newline(1); - } - const lastCharCode = this.getLastChar(); - if (lastCharCode !== 91 && lastCharCode !== 123) { - this.space(); - } - let val; - if (isBlockComment) { - val = `/*${comment.value}*/`; - if (this.format.indent.adjustMultilineComment) { - var _comment$loc; - const offset = (_comment$loc = comment.loc) == null ? void 0 : _comment$loc.start.column; - if (offset) { - const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); - val = val.replace(newlineRegex, "\n"); - } - let indentSize = this.format.retainLines ? 0 : this._buf.getCurrentColumn(); - if (this._shouldIndent(47) || this.format.retainLines) { - indentSize += this._getIndent(); - } - val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`); - } - } else if (!noLineTerminator) { - val = `//${comment.value}`; - } else { - val = `/*${comment.value}*/`; - } - if (this.endsWith(47)) this._space(); - this.source("start", comment.loc); - this._append(val, isBlockComment); - if (!isBlockComment && !noLineTerminator) { - this.newline(1, true); - } - if (printNewLines && skipNewLines !== 3) { - this.newline(1); - } - } - _printComments(type, comments, node, parent, lineOffset = 0) { - const nodeLoc = node.loc; - const len = comments.length; - let hasLoc = !!nodeLoc; - const nodeStartLine = hasLoc ? nodeLoc.start.line : 0; - const nodeEndLine = hasLoc ? nodeLoc.end.line : 0; - let lastLine = 0; - let leadingCommentNewline = 0; - const maybeNewline = this._noLineTerminator ? function () {} : this.newline.bind(this); - for (let i = 0; i < len; i++) { - const comment = comments[i]; - const shouldPrint = this._shouldPrintComment(comment); - if (shouldPrint === 2) { - hasLoc = false; - break; - } - if (hasLoc && comment.loc && shouldPrint === 1) { - const commentStartLine = comment.loc.start.line; - const commentEndLine = comment.loc.end.line; - if (type === 0) { - let offset = 0; - if (i === 0) { - if (this._buf.hasContent() && (comment.type === "CommentLine" || commentStartLine != commentEndLine)) { - offset = leadingCommentNewline = 1; - } - } else { - offset = commentStartLine - lastLine; - } - lastLine = commentEndLine; - maybeNewline(offset); - this._printComment(comment, 1); - if (i + 1 === len) { - maybeNewline(Math.max(nodeStartLine - lastLine, leadingCommentNewline)); - lastLine = nodeStartLine; - } - } else if (type === 1) { - const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine); - lastLine = commentEndLine; - maybeNewline(offset); - this._printComment(comment, 1); - if (i + 1 === len) { - maybeNewline(Math.min(1, nodeEndLine - lastLine)); - lastLine = nodeEndLine; - } - } else { - const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine); - lastLine = commentEndLine; - maybeNewline(offset); - this._printComment(comment, 1); - } - } else { - hasLoc = false; - if (shouldPrint !== 1) { - continue; - } - if (len === 1) { - const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value); - const shouldSkipNewline = singleLine && !isStatement(node) && !isClassBody(parent) && !isTSInterfaceBody(parent) && !isTSEnumDeclaration(parent); - if (type === 0) { - this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent, { - body: node - }) ? 1 : 0); - } else if (shouldSkipNewline && type === 2) { - this._printComment(comment, 1); - } else { - this._printComment(comment, 0); - } - } else if (type === 1 && !(node.type === "ObjectExpression" && node.properties.length > 1) && node.type !== "ClassBody" && node.type !== "TSInterfaceBody") { - this._printComment(comment, i === 0 ? 2 : i === len - 1 ? 3 : 0); - } else { - this._printComment(comment, 0); - } - } - } - if (type === 2 && hasLoc && lastLine) { - this._lastCommentLine = lastLine; - } - } -} -Object.assign(Printer.prototype, generatorFunctions); -{ - Printer.prototype.Noop = function Noop() {}; -} -var _default = Printer; -exports.default = _default; -function commaSeparator() { - this.tokenChar(44); - this.space(); -} - -//# sourceMappingURL=printer.js.map diff --git a/node_modules/@babel/generator/lib/printer.js.map b/node_modules/@babel/generator/lib/printer.js.map deleted file mode 100644 index 1fe63386c..000000000 --- a/node_modules/@babel/generator/lib/printer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_buffer","require","n","_t","generatorFunctions","isFunction","isStatement","isClassBody","isTSInterfaceBody","isTSEnumDeclaration","SCIENTIFIC_NOTATION","ZERO_DECIMAL_INTEGER","NON_DECIMAL_LITERAL","PURE_ANNOTATION_RE","HAS_NEWLINE","HAS_BlOCK_COMMENT_END","needsParens","Printer","constructor","format","map","inForStatementInitCounter","_printStack","_indent","_indentChar","_indentRepeat","_insideAux","_parenPushNewlineState","_noLineTerminator","_printAuxAfterOnNextUserNode","_printedComments","Set","_endsWithInteger","_endsWithWord","_lastCommentLine","_endsWithInnerRaw","_indentInnerComments","_buf","Buffer","indent","style","charCodeAt","length","_inputMap","generate","ast","print","_maybeAddAuxComment","get","compact","concise","dedent","semicolon","force","_appendChar","_queue","rightBrace","node","minified","removeLastSemicolon","sourceWithOffset","loc","token","rightParens","space","_space","hasContent","lastCp","getLastChar","word","str","noLineTerminatorAfter","_maybePrintInnerComments","endsWith","_append","number","Number","isInteger","test","maybeNewline","lastChar","strFirst","tokenChar","char","newline","i","retainLines","getNewlineCount","j","_newline","endsWithCharAndNewline","removeTrailingNewline","exactSource","cb","_catchUp","source","prop","lineOffset","columnOffset","withSource","sourceIdentifierName","identifierName","pos","_canMarkIdName","sourcePosition","_sourcePosition","identifierNamePos","_maybeAddParen","_maybeIndent","append","_maybeAddParenChar","appendChar","queue","firstChar","queueIndentation","_getIndent","_shouldIndent","parenPushNewlineState","printed","len","cha","chaPost","slice","catchUp","line","count","getCurrentLine","_loc$prop","printTerminatorless","parent","isLabel","terminatorState","trailingCommentsLineOffset","forceParens","_node$extra","nodeType","type","oldConcise","_compact","printMethod","undefined","ReferenceError","JSON","stringify","name","push","oldInAux","shouldPrintParens","retainFunctionParens","extra","parenthesized","_printLeadingComments","bind","_printTrailingComments","pop","enteredPositionlessNode","_printAuxBeforeComment","_printAuxAfterComment","comment","auxiliaryCommentBefore","_printComment","value","auxiliaryCommentAfter","getPossibleRaw","raw","rawValue","printJoin","nodes","opts","newlineOpts","addNewlines","nextNodeStartLine","separator","statement","_printNewline","iterator","_nextNode$loc","nextNode","start","printAndIndentOnComments","leadingComments","printBlock","body","innerComments","trailingComments","_printComments","comments","printInnerComments","hasSpace","printedCommentsCount","size","noIndentInnerCommentsHere","printSequence","printList","items","commaSeparator","newLine","startLine","lastCommentLine","offset","_shouldPrintComment","ignore","has","add","shouldPrintComment","skipNewLines","noLineTerminator","isBlockComment","printNewLines","lastCharCode","val","adjustMultilineComment","_comment$loc","column","newlineRegex","RegExp","replace","indentSize","getCurrentColumn","repeat","nodeLoc","hasLoc","nodeStartLine","nodeEndLine","end","lastLine","leadingCommentNewline","shouldPrint","commentStartLine","commentEndLine","Math","max","min","singleLine","shouldSkipNewline","properties","Object","assign","prototype","Noop","_default","exports","default"],"sources":["../src/printer.ts"],"sourcesContent":["import Buffer, { type Pos } from \"./buffer\";\nimport type { Loc } from \"./buffer\";\nimport * as n from \"./node\";\nimport type * as t from \"@babel/types\";\nimport {\n isFunction,\n isStatement,\n isClassBody,\n isTSInterfaceBody,\n isTSEnumDeclaration,\n} from \"@babel/types\";\nimport type {\n RecordAndTuplePluginOptions,\n PipelineOperatorPluginOptions,\n} from \"@babel/parser\";\nimport type { Opts as jsescOptions } from \"jsesc\";\n\nimport * as generatorFunctions from \"./generators\";\nimport type SourceMap from \"./source-map\";\nimport * as charCodes from \"charcodes\";\nimport { type TraceMap } from \"@jridgewell/trace-mapping\";\n\nconst SCIENTIFIC_NOTATION = /e/i;\nconst ZERO_DECIMAL_INTEGER = /\\.0+$/;\nconst NON_DECIMAL_LITERAL = /^0[box]/;\nconst PURE_ANNOTATION_RE = /^\\s*[@#]__PURE__\\s*$/;\nconst HAS_NEWLINE = /[\\n\\r\\u2028\\u2029]/;\nconst HAS_BlOCK_COMMENT_END = /\\*\\//;\n\nconst { needsParens } = n;\n\nconst enum COMMENT_TYPE {\n LEADING,\n INNER,\n TRAILING,\n}\n\nconst enum COMMENT_SKIP_NEWLINE {\n DEFAULT,\n ALL,\n LEADING,\n TRAILING,\n}\n\nconst enum PRINT_COMMENT_HINT {\n SKIP,\n ALLOW,\n DEFER,\n}\n\nexport type Format = {\n shouldPrintComment: (comment: string) => boolean;\n retainLines: boolean;\n retainFunctionParens: boolean;\n comments: boolean;\n auxiliaryCommentBefore: string;\n auxiliaryCommentAfter: string;\n compact: boolean | \"auto\";\n minified: boolean;\n concise: boolean;\n indent: {\n adjustMultilineComment: boolean;\n style: string;\n };\n recordAndTupleSyntaxType: RecordAndTuplePluginOptions[\"syntaxType\"];\n jsescOption: jsescOptions;\n /**\n * @deprecated Removed in Babel 8, use `jsescOption` instead\n */\n jsonCompatibleStrings?: boolean;\n /**\n * For use with the Hack-style pipe operator.\n * Changes what token is used for pipe bodies’ topic references.\n */\n topicToken?: PipelineOperatorPluginOptions[\"topicToken\"];\n /**\n * @deprecated Removed in Babel 8\n */\n decoratorsBeforeExport?: boolean;\n};\n\ninterface AddNewlinesOptions {\n addNewlines(leading: boolean, node: t.Node): number;\n nextNodeStartLine: number;\n}\n\ninterface PrintSequenceOptions extends Partial {\n statement?: boolean;\n indent?: boolean;\n trailingCommentsLineOffset?: number;\n}\n\ninterface PrintListOptions {\n separator?: (this: Printer) => void;\n iterator?: (node: t.Node, index: number) => void;\n statement?: boolean;\n indent?: boolean;\n}\n\nexport type PrintJoinOptions = PrintListOptions & PrintSequenceOptions;\nclass Printer {\n constructor(format: Format, map: SourceMap) {\n this.format = format;\n this._buf = new Buffer(map);\n\n this._indentChar = format.indent.style.charCodeAt(0);\n this._indentRepeat = format.indent.style.length;\n\n this._inputMap = map?._inputMap;\n }\n declare _inputMap: TraceMap;\n\n declare format: Format;\n inForStatementInitCounter: number = 0;\n\n declare _buf: Buffer;\n _printStack: Array = [];\n _indent: number = 0;\n _indentChar: number = 0;\n _indentRepeat: number = 0;\n _insideAux: boolean = false;\n _parenPushNewlineState: { printed: boolean } | null = null;\n _noLineTerminator: boolean = false;\n _printAuxAfterOnNextUserNode: boolean = false;\n _printedComments = new Set();\n _endsWithInteger = false;\n _endsWithWord = false;\n _lastCommentLine = 0;\n _endsWithInnerRaw: boolean = false;\n _indentInnerComments: boolean = true;\n\n generate(ast: t.Node) {\n this.print(ast);\n this._maybeAddAuxComment();\n\n return this._buf.get();\n }\n\n /**\n * Increment indent size.\n */\n\n indent(): void {\n if (this.format.compact || this.format.concise) return;\n\n this._indent++;\n }\n\n /**\n * Decrement indent size.\n */\n\n dedent(): void {\n if (this.format.compact || this.format.concise) return;\n\n this._indent--;\n }\n\n /**\n * Add a semicolon to the buffer.\n */\n\n semicolon(force: boolean = false): void {\n this._maybeAddAuxComment();\n if (force) {\n this._appendChar(charCodes.semicolon);\n } else {\n this._queue(charCodes.semicolon);\n }\n this._noLineTerminator = false;\n }\n\n /**\n * Add a right brace to the buffer.\n */\n\n rightBrace(node: t.Node): void {\n if (this.format.minified) {\n this._buf.removeLastSemicolon();\n }\n this.sourceWithOffset(\"end\", node.loc, 0, -1);\n this.token(\"}\");\n }\n\n rightParens(node: t.Node): void {\n this.sourceWithOffset(\"end\", node.loc, 0, -1);\n this.token(\")\");\n }\n\n /**\n * Add a space to the buffer unless it is compact.\n */\n\n space(force: boolean = false): void {\n if (this.format.compact) return;\n\n if (force) {\n this._space();\n } else if (this._buf.hasContent()) {\n const lastCp = this.getLastChar();\n if (lastCp !== charCodes.space && lastCp !== charCodes.lineFeed) {\n this._space();\n }\n }\n }\n\n /**\n * Writes a token that can't be safely parsed without taking whitespace into account.\n */\n\n word(str: string, noLineTerminatorAfter: boolean = false): void {\n this._maybePrintInnerComments();\n\n // prevent concatenating words and creating // comment out of division and regex\n if (\n this._endsWithWord ||\n (str.charCodeAt(0) === charCodes.slash && this.endsWith(charCodes.slash))\n ) {\n this._space();\n }\n\n this._maybeAddAuxComment();\n this._append(str, false);\n\n this._endsWithWord = true;\n this._noLineTerminator = noLineTerminatorAfter;\n }\n\n /**\n * Writes a number token so that we can validate if it is an integer.\n */\n\n number(str: string): void {\n this.word(str);\n\n // Integer tokens need special handling because they cannot have '.'s inserted\n // immediately after them.\n this._endsWithInteger =\n Number.isInteger(+str) &&\n !NON_DECIMAL_LITERAL.test(str) &&\n !SCIENTIFIC_NOTATION.test(str) &&\n !ZERO_DECIMAL_INTEGER.test(str) &&\n str.charCodeAt(str.length - 1) !== charCodes.dot;\n }\n\n /**\n * Writes a simple token.\n */\n token(str: string, maybeNewline = false): void {\n this._maybePrintInnerComments();\n\n const lastChar = this.getLastChar();\n const strFirst = str.charCodeAt(0);\n if (\n (lastChar === charCodes.exclamationMark &&\n // space is mandatory to avoid outputting ` line comment\n const comment = this.skipLineComment(3);\n if (comment !== undefined) {\n this.addComment(comment);\n if (this.options.attachComment) comments.push(comment);\n }\n } else {\n break loop;\n }\n } else if (\n ch === charCodes.lessThan &&\n !this.inModule &&\n this.options.annexB\n ) {\n const pos = this.state.pos;\n if (\n this.input.charCodeAt(pos + 1) === charCodes.exclamationMark &&\n this.input.charCodeAt(pos + 2) === charCodes.dash &&\n this.input.charCodeAt(pos + 3) === charCodes.dash\n ) {\n // ` - - - -``` - -Browser support was done mostly for the online demo. If you find any errors - feel -free to send pull requests with fixes. Also note, that IE and other old browsers -needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate. - -Notes: - -1. We have no resources to support browserified version. Don't expect it to be - well tested. Don't expect fast fixes if something goes wrong there. -2. `!!js/function` in browser bundle will not work by default. If you really need - it - load `esprima` parser first (via amd or directly). -3. `!!bin` in browser will return `Array`, because browsers do not support - node.js `Buffer` and adding Buffer shims is completely useless on practice. - - -API ---- - -Here we cover the most 'useful' methods. If you need advanced details (creating -your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and -[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more -info. - -``` javascript -const yaml = require('js-yaml'); -const fs = require('fs'); - -// Get document, or throw exception on error -try { - const doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8')); - console.log(doc); -} catch (e) { - console.log(e); -} -``` - - -### safeLoad (string [ , options ]) - -**Recommended loading way.** Parses `string` as single YAML document. Returns either a -plain object, a string or `undefined`, or throws `YAMLException` on error. By default, does -not support regexps, functions and undefined. This method is safe for untrusted data. - -options: - -- `filename` _(default: null)_ - string to be used as a file path in - error/warning messages. -- `onWarning` _(default: null)_ - function to call on warning messages. - Loader will call this function with an instance of `YAMLException` for each warning. -- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use. - - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects: - http://www.yaml.org/spec/1.2/spec.html#id2802346 - - `JSON_SCHEMA` - all JSON-supported types: - http://www.yaml.org/spec/1.2/spec.html#id2803231 - - `CORE_SCHEMA` - same as `JSON_SCHEMA`: - http://www.yaml.org/spec/1.2/spec.html#id2804923 - - `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones - (`!!js/undefined`, `!!js/regexp` and `!!js/function`): - http://yaml.org/type/ - - `DEFAULT_FULL_SCHEMA` - all supported YAML types. -- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error. - -NOTE: This function **does not** understand multi-document sources, it throws -exception on those. - -NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions. -So, the JSON schema is not as strictly defined in the YAML specification. -It allows numbers in any notation, use `Null` and `NULL` as `null`, etc. -The core schema also has no such restrictions. It allows binary notation for integers. - - -### load (string [ , options ]) - -**Use with care with untrusted sources**. The same as `safeLoad()` but uses -`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types: -`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources, you -must additionally validate object structure to avoid injections: - -``` javascript -const untrusted_code = '"toString": ! "function (){very_evil_thing();}"'; - -// I'm just converting that string, what could possibly go wrong? -require('js-yaml').load(untrusted_code) + '' -``` - - -### safeLoadAll (string [, iterator] [, options ]) - -Same as `safeLoad()`, but understands multi-document sources. Applies -`iterator` to each document if specified, or returns array of documents. - -``` javascript -const yaml = require('js-yaml'); - -yaml.safeLoadAll(data, function (doc) { - console.log(doc); -}); -``` - - -### loadAll (string [, iterator] [ , options ]) - -Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default. - - -### safeDump (object [ , options ]) - -Serializes `object` as a YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will -throw an exception if you try to dump regexps or functions. However, you can -disable exceptions by setting the `skipInvalid` option to `true`. - -options: - -- `indent` _(default: 2)_ - indentation width to use (in spaces). -- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements -- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function - in the safe schema) and skip pairs and single values with such types. -- `flowLevel` (default: -1) - specifies level of nesting, when to switch from - block to flow style for collections. -1 means block style everwhere -- `styles` - "tag" => "style" map. Each tag may have own set of styles. -- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use. -- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a - function, use the function to sort the keys. -- `lineWidth` _(default: `80`)_ - set max line width. -- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references -- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older - yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 -- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded. - -The following table show availlable styles (e.g. "canonical", -"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml -output is shown on the right side after `=>` (default setting) or `->`: - -``` none -!!null - "canonical" -> "~" - "lowercase" => "null" - "uppercase" -> "NULL" - "camelcase" -> "Null" - -!!int - "binary" -> "0b1", "0b101010", "0b1110001111010" - "octal" -> "01", "052", "016172" - "decimal" => "1", "42", "7290" - "hexadecimal" -> "0x1", "0x2A", "0x1C7A" - -!!bool - "lowercase" => "true", "false" - "uppercase" -> "TRUE", "FALSE" - "camelcase" -> "True", "False" - -!!float - "lowercase" => ".nan", '.inf' - "uppercase" -> ".NAN", '.INF' - "camelcase" -> ".NaN", '.Inf' -``` - -Example: - -``` javascript -safeDump (object, { - 'styles': { - '!!null': 'canonical' // dump null as ~ - }, - 'sortKeys': true // sort object keys -}); -``` - -### dump (object [ , options ]) - -Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default). - - -Supported YAML types --------------------- - -The list of standard YAML tags and corresponding JavaScipt types. See also -[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and -[YAML types repository](http://yaml.org/type/). - -``` -!!null '' # null -!!bool 'yes' # bool -!!int '3...' # number -!!float '3.14...' # number -!!binary '...base64...' # buffer -!!timestamp 'YYYY-...' # date -!!omap [ ... ] # array of key-value pairs -!!pairs [ ... ] # array or array pairs -!!set { ... } # array of objects with given keys and null values -!!str '...' # string -!!seq [ ... ] # array -!!map { ... } # object -``` - -**JavaScript-specific tags** - -``` -!!js/regexp /pattern/gim # RegExp -!!js/undefined '' # Undefined -!!js/function 'function () {...}' # Function -``` - -Caveats -------- - -Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects -or arrays as keys, and stringifies (by calling `toString()` method) them at the -moment of adding them. - -``` yaml ---- -? [ foo, bar ] -: - baz -? { foo: bar } -: - baz - - baz -``` - -``` javascript -{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] } -``` - -Also, reading of properties on implicit block mapping keys is not supported yet. -So, the following YAML document cannot be loaded. - -``` yaml -&anchor foo: - foo: bar - *anchor: duplicate key - baz: bat - *anchor: duplicate key -``` - - -js-yaml for enterprise ----------------------- - -Available as part of the Tidelift Subscription - -The maintainers of js-yaml and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-js-yaml?utm_source=npm-js-yaml&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/bin/js-yaml.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/bin/js-yaml.js deleted file mode 100755 index e79186be6..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/bin/js-yaml.js +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/env node - - -'use strict'; - -/*eslint-disable no-console*/ - - -// stdlib -var fs = require('fs'); - - -// 3rd-party -var argparse = require('argparse'); - - -// internal -var yaml = require('..'); - - -//////////////////////////////////////////////////////////////////////////////// - - -var cli = new argparse.ArgumentParser({ - prog: 'js-yaml', - version: require('../package.json').version, - addHelp: true -}); - - -cli.addArgument([ '-c', '--compact' ], { - help: 'Display errors in compact mode', - action: 'storeTrue' -}); - - -// deprecated (not needed after we removed output colors) -// option suppressed, but not completely removed for compatibility -cli.addArgument([ '-j', '--to-json' ], { - help: argparse.Const.SUPPRESS, - dest: 'json', - action: 'storeTrue' -}); - - -cli.addArgument([ '-t', '--trace' ], { - help: 'Show stack trace on error', - action: 'storeTrue' -}); - -cli.addArgument([ 'file' ], { - help: 'File to read, utf-8 encoded without BOM', - nargs: '?', - defaultValue: '-' -}); - - -//////////////////////////////////////////////////////////////////////////////// - - -var options = cli.parseArgs(); - - -//////////////////////////////////////////////////////////////////////////////// - -function readFile(filename, encoding, callback) { - if (options.file === '-') { - // read from stdin - - var chunks = []; - - process.stdin.on('data', function (chunk) { - chunks.push(chunk); - }); - - process.stdin.on('end', function () { - return callback(null, Buffer.concat(chunks).toString(encoding)); - }); - } else { - fs.readFile(filename, encoding, callback); - } -} - -readFile(options.file, 'utf8', function (error, input) { - var output, isYaml; - - if (error) { - if (error.code === 'ENOENT') { - console.error('File not found: ' + options.file); - process.exit(2); - } - - console.error( - options.trace && error.stack || - error.message || - String(error)); - - process.exit(1); - } - - try { - output = JSON.parse(input); - isYaml = false; - } catch (err) { - if (err instanceof SyntaxError) { - try { - output = []; - yaml.loadAll(input, function (doc) { output.push(doc); }, {}); - isYaml = true; - - if (output.length === 0) output = null; - else if (output.length === 1) output = output[0]; - - } catch (e) { - if (options.trace && err.stack) console.error(e.stack); - else console.error(e.toString(options.compact)); - - process.exit(1); - } - } else { - console.error( - options.trace && err.stack || - err.message || - String(err)); - - process.exit(1); - } - } - - if (isYaml) console.log(JSON.stringify(output, null, ' ')); - else console.log(yaml.dump(output)); -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/dist/js-yaml.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/dist/js-yaml.js deleted file mode 100644 index 787832074..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/dist/js-yaml.js +++ /dev/null @@ -1,3989 +0,0 @@ -/*! js-yaml 3.14.1 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - -var ESCAPE_SEQUENCES = {}; - -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; - -var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; - -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; - - if (map === null) return {}; - - result = {}; - keys = Object.keys(map); - - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); - - if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); - } - type = schema.compiledTypeMap['fallback'][tag]; - - if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; - } - - result[tag] = style; - } - - return result; -} - -function encodeHex(character) { - var string, handle, length; - - string = character.toString(16).toUpperCase(); - - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); - } - - return '\\' + handle + common.repeat('0', length - string.length) + string; -} - -function State(options) { - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.indent = Math.max(1, (options['indent'] || 2)); - this.noArrayIndent = options['noArrayIndent'] || false; - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; - this.condenseFlow = options['condenseFlow'] || false; - - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; - - this.tag = null; - this.result = ''; - - this.duplicates = []; - this.usedDuplicates = null; -} - -// Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; - - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; - } - - if (line.length && line !== '\n') result += ind; - - result += line; - } - - return result; -} - -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); -} - -function testImplicitResolving(state, str) { - var index, length, type; - - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; - - if (type.resolve(str)) { - return true; - } - } - - return false; -} - -// [33] s-white ::= s-space | s-tab -function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; -} - -// Returns true if the character can be printed without escaping. -// From YAML 1.2: "any allowed characters known to be non-printable -// should also be escaped. [However,] This isn’t mandatory" -// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) - || (0x10000 <= c && c <= 0x10FFFF); -} - -// [34] ns-char ::= nb-char - s-white -// [27] nb-char ::= c-printable - b-char - c-byte-order-mark -// [26] b-char ::= b-line-feed | b-carriage-return -// [24] b-line-feed ::= #xA /* LF */ -// [25] b-carriage-return ::= #xD /* CR */ -// [3] c-byte-order-mark ::= #xFEFF -function isNsChar(c) { - return isPrintable(c) && !isWhitespace(c) - // byte-order-mark - && c !== 0xFEFF - // b-char - && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED; -} - -// Simplified test for values allowed after the first character in plain style. -function isPlainSafe(c, prev) { - // Uses a subset of nb-char - c-flow-indicator - ":" - "#" - // where nb-char ::= c-printable - b-char - c-byte-order-mark. - return isPrintable(c) && c !== 0xFEFF - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // - ":" - "#" - // /* An ns-char preceding */ "#" - && c !== CHAR_COLON - && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); -} - -// Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c) { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - return isPrintable(c) && c !== 0xFEFF - && !isWhitespace(c) // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS - && c !== CHAR_QUESTION - && c !== CHAR_COLON - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” - && c !== CHAR_SHARP - && c !== CHAR_AMPERSAND - && c !== CHAR_ASTERISK - && c !== CHAR_EXCLAMATION - && c !== CHAR_VERTICAL_LINE - && c !== CHAR_EQUALS - && c !== CHAR_GREATER_THAN - && c !== CHAR_SINGLE_QUOTE - && c !== CHAR_DOUBLE_QUOTE - // | “%” | “@” | “`”) - && c !== CHAR_PERCENT - && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT; -} - -// Determines whether block indentation indicator is required. -function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); -} - -var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; - -// Determines which scalar styles are possible and returns the preferred style. -// lineWidth = -1 => no limit. -// Pre-conditions: str.length > 0. -// Post-conditions: -// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. -// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). -// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { - var i; - var char, prev_char; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst(string.charCodeAt(0)) - && !isWhitespace(string.charCodeAt(string.length - 1)); - - if (singleLineOnly) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe(char, prev_char); - } - } else { - // Case: block styles permitted. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' '); - previousLineBreak = i; - } - } else if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe(char, prev_char); - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || (shouldTrackWidth && - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); - } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - return plain && !testAmbiguousType(string) - ? STYLE_PLAIN : STYLE_SINGLE; - } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; - } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; -} - -// Note: line breaking/folding is implemented for only the folded style. -// NB. We drop the last trailing newline (if any) of a returned block scalar -// since the dumper adds its own newline. This always works: -// • No ending newline => unaffected; already using strip "-" chomping. -// • Ending newline => removed then restored. -// Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar(state, string, level, iskey) { - state.dump = (function () { - if (string.length === 0) { - return "''"; - } - if (!state.noCompatMode && - DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { - return "'" + string + "'"; - } - - var indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower bound. - // This behaves better than a constant minimum width which disallows narrower options, - // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); - - // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey - // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); - } - - switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { - case STYLE_PLAIN: - return string; - case STYLE_SINGLE: - return "'" + string.replace(/'/g, "''") + "'"; - case STYLE_LITERAL: - return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)); - case STYLE_FOLDED: - return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); - case STYLE_DOUBLE: - return '"' + escapeString(string, lineWidth) + '"'; - default: - throw new YAMLException('impossible error: invalid scalar style'); - } - }()); -} - -// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; - - // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); - - return indentIndicator + chomp + '\n'; -} - -// (See the note for writeScalar.) -function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; -} - -// Note: a long line without a suitable break point will exceed the width limit. -// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string, width) { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; - - // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); - // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; - - // rest of the lines - var match; - while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2]; - moreIndented = (line[0] === ' '); - result += prefix - + (!prevMoreIndented && !moreIndented && line !== '' - ? '\n' : '') - + foldLine(line, width); - prevMoreIndented = moreIndented; - } - - return result; -} - -// Greedy line breaking. -// Picks the longest line under the limit each time, -// otherwise settles for the shortest line over the limit. -// NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine(line, width) { - if (line === '' || line[0] === ' ') return line; - - // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - var match; - // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0; - var result = ''; - - // Invariants: 0 <= start <= length-1. - // 0 <= curr <= next <= max(0, length-2). curr - start <= width. - // Inside the loop: - // A match implies length >= 2, so curr and next are <= length-2. - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 - } - curr = next; - } - - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += '\n'; - // Insert a break if the remainder is too long and there is a break available. - if (line.length - start > width && curr > start) { - result += line.slice(start, curr) + '\n' + line.slice(curr + 1); - } else { - result += line.slice(start); - } - - return result.slice(1); // drop extra \n joiner -} - -// Escapes a double-quoted string. -function escapeString(string) { - var result = ''; - var char, nextChar; - var escapeSeq; - - for (var i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). - if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { - nextChar = string.charCodeAt(i + 1); - if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { - // Combine the surrogate pair and store it escaped. - result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); - // Advance index one extra since we already used that char here. - i++; continue; - } - } - escapeSeq = ESCAPE_SEQUENCES[char]; - result += !escapeSeq && isPrintable(char) - ? string[i] - : escapeSeq || encodeHex(char); - } - - return result; -} - -function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length; - - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level, object[index], false, false)) { - if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = '[' + _result + ']'; -} - -function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length; - - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level + 1, object[index], true, true)) { - if (!compact || index !== 0) { - _result += generateNextLine(state, level); - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; - } else { - _result += '- '; - } - - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. -} - -function writeFlowMapping(state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer; - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - - pairBuffer = ''; - if (index !== 0) pairBuffer += ', '; - - if (state.condenseFlow) pairBuffer += '"'; - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } - - if (state.dump.length > 1024) pairBuffer += '? '; - - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); - - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = '{' + _result + '}'; -} - -function writeBlockMapping(state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer; - - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new YAMLException('sortKeys must be a boolean or a function'); - } - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; - - if (!compact || index !== 0) { - pairBuffer += generateNextLine(state, level); - } - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } - - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); - - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; - } - } - - pairBuffer += state.dump; - - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } - - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; - } else { - pairBuffer += ': '; - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. -} - -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; - - typeList = explicit ? state.explicitTypes : state.implicitTypes; - - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; - - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { - - state.tag = explicit ? type.tag : '?'; - - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; - - if (_toString.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); - } else if (_hasOwnProperty.call(type.represent, style)) { - _result = type.represent[style](object, style); - } else { - throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); - } - - state.dump = _result; - } - - return true; - } - } - - return false; -} - -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode(state, level, object, block, compact, iskey) { - state.tag = null; - state.dump = object; - - if (!detectType(state, object, false)) { - detectType(state, object, true); - } - - var type = _toString.call(state.dump); - - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); - } - - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; - - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } - - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } - - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === '[object Object]') { - if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object Array]') { - var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; - if (block && (state.dump.length !== 0)) { - writeBlockSequence(state, arrayLevel, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowSequence(state, arrayLevel, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object String]') { - if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey); - } - } else { - if (state.skipInvalid) return false; - throw new YAMLException('unacceptable kind of an object to dump ' + type); - } - - if (state.tag !== null && state.tag !== '?') { - state.dump = '!<' + state.tag + '> ' + state.dump; - } - } - - return true; -} - -function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; - - inspectNode(object, objects, duplicatesIndexes); - - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); -} - -function inspectNode(object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length; - - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); - - if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); - } - } else { - objectKeyList = Object.keys(object); - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); - } - } - } - } -} - -function dump(input, options) { - options = options || {}; - - var state = new State(options); - - if (!state.noRefs) getDuplicateReferences(input, state); - - if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; - - return ''; -} - -function safeDump(input, options) { - return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} - -module.exports.dump = dump; -module.exports.safeDump = safeDump; - -},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(require,module,exports){ -// YAML error class. http://stackoverflow.com/questions/8458984 -// -'use strict'; - -function YAMLException(reason, mark) { - // Super constructor - Error.call(this); - - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); - - // Include stack trace in error object - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; - } -} - - -// Inherit from Error -YAMLException.prototype = Object.create(Error.prototype); -YAMLException.prototype.constructor = YAMLException; - - -YAMLException.prototype.toString = function toString(compact) { - var result = this.name + ': '; - - result += this.reason || '(unknown reason)'; - - if (!compact && this.mark) { - result += ' ' + this.mark.toString(); - } - - return result; -}; - - -module.exports = YAMLException; - -},{}],5:[function(require,module,exports){ -'use strict'; - -/*eslint-disable max-len,no-use-before-define*/ - -var common = require('./common'); -var YAMLException = require('./exception'); -var Mark = require('./mark'); -var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); -var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); - - -var _hasOwnProperty = Object.prototype.hasOwnProperty; - - -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; - - -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; - - -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - - -function _class(obj) { return Object.prototype.toString.call(obj); } - -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); -} - -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); -} - -function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); -} - -function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; -} - -function fromHexCode(c) { - var lc; - - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - /*eslint-disable no-bitwise*/ - lc = c | 0x20; - - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; - } - - return -1; -} - -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; -} - -function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - return -1; -} - -function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; -} - -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode( - ((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00 - ); -} - -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); -} - - -function State(input, options) { - this.input = input; - - this.filename = options['filename'] || null; - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.onWarning = options['onWarning'] || null; - this.legacy = options['legacy'] || false; - this.json = options['json'] || false; - this.listener = options['listener'] || null; - - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; - - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; - - this.documents = []; - - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ - -} - - -function generateError(state, message) { - return new YAMLException( - message, - new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); -} - -function throwError(state, message) { - throw generateError(state, message); -} - -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); - } -} - - -var directiveHandlers = { - - YAML: function handleYamlDirective(state, name, args) { - - var match, major, minor; - - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } - - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); - } - - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); - - if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); - } - - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); - - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } - - state.version = args[0]; - state.checkLineBreaks = (minor < 2); - - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); - } - }, - - TAG: function handleTagDirective(state, name, args) { - - var handle, prefix; - - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } - - handle = args[0]; - prefix = args[1]; - - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); - } - - if (_hasOwnProperty.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); - } - - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } - - state.tagMap[handle] = prefix; - } -}; - - -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; - - if (start < end) { - _result = state.input.slice(start, end); - - if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); - if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } - - state.result += _result; - } -} - -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; - - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } - - sourceKeys = Object.keys(source); - - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; - - if (!_hasOwnProperty.call(destination, key)) { - destination[key] = source[key]; - overridableKeys[key] = true; - } - } -} - -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { - var index, quantity; - - // The output is a plain object here, so keys can only be strings. - // We need to convert keyNode to a string, but doing so can hang the process - // (deeply nested arrays that explode exponentially using aliases). - if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); - - for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { - if (Array.isArray(keyNode[index])) { - throwError(state, 'nested arrays are not supported inside keys'); - } - - if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { - keyNode[index] = '[object Object]'; - } - } - } - - // Avoid code execution in load() via toString property - // (still use its own toString for arrays, timestamps, - // and whatever user schema extensions happen to have @@toStringTag) - if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; - } - - - keyNode = String(keyNode); - - if (_result === null) { - _result = {}; - } - - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); - } - } else { - if (!state.json && - !_hasOwnProperty.call(overridableKeys, keyNode) && - _hasOwnProperty.call(_result, keyNode)) { - state.line = startLine || state.line; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); - } - _result[keyNode] = valueNode; - delete overridableKeys[keyNode]; - } - - return _result; -} - -function readLineBreak(state) { - var ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); - } - - state.line += 1; - state.lineStart = state.position; -} - -function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); - } - - if (is_EOL(ch)) { - readLineBreak(state); - - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; - - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } - - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } - - return lineBreaks; -} - -function testDocumentSeparator(state) { - var _position = state.position, - ch; - - ch = state.input.charCodeAt(_position); - - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { - - _position += 3; - - ch = state.input.charCodeAt(_position); - - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } - - return false; -} - -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); - } -} - - -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; - - ch = state.input.charCodeAt(state.position); - - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; - } - - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } - } - - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; - - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } - - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); - - if (is_WS_OR_EOL(preceding)) { - break; - } - - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; - - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); - - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; - } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; - } - } - - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } - - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; - } - - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, captureEnd, false); - - if (state.result) { - return true; - } - - state.kind = _kind; - state.result = _result; - return false; -} - -function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x27/* ' */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a single quoted scalar'); -} - -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x22/* " */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; - - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); - - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; - - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; - - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); - - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; - - } else { - throwError(state, 'expected hexadecimal character'); - } - } - - state.result += charFromCodepoint(hexResult); - - state.position++; - - } else { - throwError(state, 'unknown escape sequence'); - } - - captureStart = captureEnd = state.position; - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a double quoted scalar'); -} - -function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = {}, - keyNode, - keyTag, - valueNode, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(++state.position); - - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } - - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; - - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; - } - - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); - } else { - _result.push(keyNode); - } - - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } - - throwError(state, 'unexpected end of the stream within a flow collection'); -} - -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } - - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } - - } else { - break; - } - } - - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); - } - } - - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; - - ch = state.input.charCodeAt(state.position); - - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } - - if (is_EOL(ch)) { - emptyLines++; - continue; - } - - // End of the scalar. - if (state.lineIndent < textIndent) { - - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; - } - } - - // Break this `while` cycle and go to the funciton's epilogue. - break; - } - - // Folded style: use fancy rules to handle line breaks. - if (folding) { - - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); - - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; - } - - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } - - // Literal style: just add exact number of line breaks between content lines. - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } - - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; - - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, state.position, false); - } - - return true; -} - -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - - if (ch !== 0x2D/* - */) { - break; - } - - following = state.input.charCodeAt(state.position + 1); - - if (!is_WS_OR_EOL(following)) { - break; - } - - detected = true; - state.position++; - - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; -} - -function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _pos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = {}, - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - _pos = state.position; - - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { - - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = true; - allowCompact = true; - - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; - - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); - } - - state.position += 1; - ch = following; - - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { - - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); - - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); - - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } - - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; - - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - - } else { - break; // Reading is done. Go to the epilogue. - } - - // - // Common reading code for both explicit and implicit notations. - // - if (state.line === _line || state.lineIndent > nodeIndent) { - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; - } else { - valueNode = state.result; - } - } - - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); - keyTag = keyNode = valueNode = null; - } - - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); - } - - if (state.lineIndent > nodeIndent && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - // - // Epilogue. - // - - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - } - - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; - } - - return detected; -} - -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x21/* ! */) return false; - - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } - - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); - - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); - - } else { - tagHandle = '!'; - } - - _position = state.position; - - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); - - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); - } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); - - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } - - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } - - ch = state.input.charCodeAt(++state.position); - } - - tagName = state.input.slice(_position, state.position); - - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); - } - } - - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } - - if (isVerbatim) { - state.tag = tagName; - - } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; - - } else if (tagHandle === '!') { - state.tag = '!' + tagName; - - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; - - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); - } - - return true; -} - -function readAnchorProperty(state) { - var _position, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x26/* & */) return false; - - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); - } - - state.anchor = state.input.slice(_position, state.position); - return true; -} - -function readAlias(state) { - var _position, alias, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x2A/* * */) return false; - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); - } - - alias = state.input.slice(_position, state.position); - - if (!_hasOwnProperty.call(state.anchorMap, alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } - - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; -} - -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } - - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; - - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } - - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } - - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } - - blockIndent = state.position - state.lineStart; - - if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || - readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || - readSingleQuotedScalar(state, flowIndent) || - readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; - - } else if (readAlias(state)) { - hasContent = true; - - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } - - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; - - if (state.tag === null) { - state.tag = '?'; - } - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } - - if (state.tag !== null && state.tag !== '!') { - if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "! [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); - } - - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; - - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; - - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } - - if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - } - - if (state.listener !== null) { - state.listener('close', state); - } - return state.tag !== null || state.anchor !== null || hasContent; -} - -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; - - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = {}; - state.anchorMap = {}; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } - - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; - - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } - - if (is_EOL(ch)) break; - - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveArgs.push(state.input.slice(_position, state.position)); - } - - if (ch !== 0) readLineBreak(state); - - if (_hasOwnProperty.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); - } - } - - skipSeparationSpace(state, true, -1); - - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); - } - - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); - - if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); - } - - state.documents.push(state.result); - - if (state.position === state.lineStart && testDocumentSeparator(state)) { - - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - return; - } - - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } -} - - -function loadDocuments(input, options) { - input = String(input); - options = options || {}; - - if (input.length !== 0) { - - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; - } - - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } - - var state = new State(input, options); - - var nullpos = input.indexOf('\0'); - - if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); - } - - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; - - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } - - while (state.position < (state.length - 1)) { - readDocument(state); - } - - return state.documents; -} - - -function loadAll(input, iterator, options) { - if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; - } - - var documents = loadDocuments(input, options); - - if (typeof iterator !== 'function') { - return documents; - } - - for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); - } -} - - -function load(input, options) { - var documents = loadDocuments(input, options); - - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - throw new YAMLException('expected a single document in the stream, but found more'); -} - - -function safeLoadAll(input, iterator, options) { - if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { - options = iterator; - iterator = null; - } - - return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} - - -function safeLoad(input, options) { - return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} - - -module.exports.loadAll = loadAll; -module.exports.load = load; -module.exports.safeLoadAll = safeLoadAll; -module.exports.safeLoad = safeLoad; - -},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(require,module,exports){ -'use strict'; - - -var common = require('./common'); - - -function Mark(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; -} - - -Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; - - if (!this.buffer) return null; - - indent = indent || 4; - maxLength = maxLength || 75; - - head = ''; - start = this.position; - - while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { - start -= 1; - if (this.position - start > (maxLength / 2 - 1)) { - head = ' ... '; - start += 5; - break; - } - } - - tail = ''; - end = this.position; - - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - if (end - this.position > (maxLength / 2 - 1)) { - tail = ' ... '; - end -= 5; - break; - } - } - - snippet = this.buffer.slice(start, end); - - return common.repeat(' ', indent) + head + snippet + tail + '\n' + - common.repeat(' ', indent + this.position - start + head.length) + '^'; -}; - - -Mark.prototype.toString = function toString(compact) { - var snippet, where = ''; - - if (this.name) { - where += 'in "' + this.name + '" '; - } - - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); - - if (!compact) { - snippet = this.getSnippet(); - - if (snippet) { - where += ':\n' + snippet; - } - } - - return where; -}; - - -module.exports = Mark; - -},{"./common":2}],7:[function(require,module,exports){ -'use strict'; - -/*eslint-disable max-len*/ - -var common = require('./common'); -var YAMLException = require('./exception'); -var Type = require('./type'); - - -function compileList(schema, name, result) { - var exclude = []; - - schema.include.forEach(function (includedSchema) { - result = compileList(includedSchema, name, result); - }); - - schema[name].forEach(function (currentType) { - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { - exclude.push(previousIndex); - } - }); - - result.push(currentType); - }); - - return result.filter(function (type, index) { - return exclude.indexOf(index) === -1; - }); -} - - -function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {} - }, index, length; - - function collectType(type) { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; - } - - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); - } - return result; -} - - -function Schema(definition) { - this.include = definition.include || []; - this.implicit = definition.implicit || []; - this.explicit = definition.explicit || []; - - this.implicit.forEach(function (type) { - if (type.loadKind && type.loadKind !== 'scalar') { - throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); - } - }); - - this.compiledImplicit = compileList(this, 'implicit', []); - this.compiledExplicit = compileList(this, 'explicit', []); - this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); -} - - -Schema.DEFAULT = null; - - -Schema.create = function createSchema() { - var schemas, types; - - switch (arguments.length) { - case 1: - schemas = Schema.DEFAULT; - types = arguments[0]; - break; - - case 2: - schemas = arguments[0]; - types = arguments[1]; - break; - - default: - throw new YAMLException('Wrong number of arguments for Schema.create function'); - } - - schemas = common.toArray(schemas); - types = common.toArray(types); - - if (!schemas.every(function (schema) { return schema instanceof Schema; })) { - throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); - } - - if (!types.every(function (type) { return type instanceof Type; })) { - throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } - - return new Schema({ - include: schemas, - explicit: types - }); -}; - - -module.exports = Schema; - -},{"./common":2,"./exception":4,"./type":13}],8:[function(require,module,exports){ -// Standard YAML's Core schema. -// http://www.yaml.org/spec/1.2/spec.html#id2804923 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, Core schema has no distinctions from JSON schema is JS-YAML. - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = new Schema({ - include: [ - require('./json') - ] -}); - -},{"../schema":7,"./json":12}],9:[function(require,module,exports){ -// JS-YAML's default schema for `load` function. -// It is not described in the YAML specification. -// -// This schema is based on JS-YAML's default safe schema and includes -// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. -// -// Also this schema is used as default base schema at `Schema.create` function. - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = Schema.DEFAULT = new Schema({ - include: [ - require('./default_safe') - ], - explicit: [ - require('../type/js/undefined'), - require('../type/js/regexp'), - require('../type/js/function') - ] -}); - -},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(require,module,exports){ -// JS-YAML's default schema for `safeLoad` function. -// It is not described in the YAML specification. -// -// This schema is based on standard YAML's Core schema and includes most of -// extra types described at YAML tag repository. (http://yaml.org/type/) - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = new Schema({ - include: [ - require('./core') - ], - implicit: [ - require('../type/timestamp'), - require('../type/merge') - ], - explicit: [ - require('../type/binary'), - require('../type/omap'), - require('../type/pairs'), - require('../type/set') - ] -}); - -},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(require,module,exports){ -// Standard YAML's Failsafe schema. -// http://www.yaml.org/spec/1.2/spec.html#id2802346 - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = new Schema({ - explicit: [ - require('../type/str'), - require('../type/seq'), - require('../type/map') - ] -}); - -},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(require,module,exports){ -// Standard YAML's JSON schema. -// http://www.yaml.org/spec/1.2/spec.html#id2803231 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, this schema is not such strict as defined in the YAML specification. -// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = new Schema({ - include: [ - require('./failsafe') - ], - implicit: [ - require('../type/null'), - require('../type/bool'), - require('../type/int'), - require('../type/float') - ] -}); - -},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(require,module,exports){ -'use strict'; - -var YAMLException = require('./exception'); - -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'defaultStyle', - 'styleAliases' -]; - -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; - -function compileStyleAliases(map) { - var result = {}; - - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } - - return result; -} - -function Type(tag, options) { - options = options || {}; - - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); - } - }); - - // TODO: Add tag format check. - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); - } -} - -module.exports = Type; - -},{"./exception":4}],14:[function(require,module,exports){ -'use strict'; - -/*eslint-disable no-bitwise*/ - -var NodeBuffer; - -try { - // A trick for browserified version, to not include `Buffer` shim - var _require = require; - NodeBuffer = _require('buffer').Buffer; -} catch (__) {} - -var Type = require('../type'); - - -// [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - - -function resolveYamlBinary(data) { - if (data === null) return false; - - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; - - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); - - // Skip CR/LF - if (code > 64) continue; - - // Fail on illegal characters - if (code < 0) return false; - - bitlen += 6; - } - - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; -} - -function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; - - // Collect by 6*4 bits (3 bytes) - - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } - - bits = (bits << 6) | map.indexOf(input.charAt(idx)); - } - - // Dump tail - - tailbits = (max % 4) * 6; - - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } - - // Wrap into Buffer for NodeJS and leave Array for browser - if (NodeBuffer) { - // Support node 6.+ Buffer API when available - return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); - } - - return result; -} - -function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; - - // Convert every three bytes to 4 ASCII characters. - - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } - - bits = (bits << 8) + object[idx]; - } - - // Dump tail - - tail = max % 3; - - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; - } - - return result; -} - -function isBinary(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); -} - -module.exports = new Type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); - -},{"../type":13}],15:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -function resolveYamlBoolean(data) { - if (data === null) return false; - - var max = data.length; - - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); -} - -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; -} - -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} - -module.exports = new Type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' -}); - -},{"../type":13}],16:[function(require,module,exports){ -'use strict'; - -var common = require('../common'); -var Type = require('../type'); - -var YAML_FLOAT_PATTERN = new RegExp( - // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + - // .2e4, .2 - // special case, seems not from spec - '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // 20:59 - '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + - // .inf - '|[-+]?\\.(?:inf|Inf|INF)' + - // .nan - '|\\.(?:nan|NaN|NAN))$'); - -function resolveYamlFloat(data) { - if (data === null) return false; - - if (!YAML_FLOAT_PATTERN.test(data) || - // Quick hack to not allow integers end with `_` - // Probably should update regexp & check speed - data[data.length - 1] === '_') { - return false; - } - - return true; -} - -function constructYamlFloat(data) { - var value, sign, base, digits; - - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - digits = []; - - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); - } - - if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - - } else if (value === '.nan') { - return NaN; - - } else if (value.indexOf(':') >= 0) { - value.split(':').forEach(function (v) { - digits.unshift(parseFloat(v, 10)); - }); - - value = 0.0; - base = 1; - - digits.forEach(function (d) { - value += d * base; - base *= 60; - }); - - return sign * value; - - } - return sign * parseFloat(value, 10); -} - - -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; - -function representYamlFloat(object, style) { - var res; - - if (isNaN(object)) { - switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; - } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; - } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; - } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } - - res = object.toString(10); - - // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack - - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; -} - -function isFloat(object) { - return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); -} - -module.exports = new Type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' -}); - -},{"../common":2,"../type":13}],17:[function(require,module,exports){ -'use strict'; - -var common = require('../common'); -var Type = require('../type'); - -function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); -} - -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); -} - -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); -} - -function resolveYamlInteger(data) { - if (data === null) return false; - - var max = data.length, - index = 0, - hasDigits = false, - ch; - - if (!max) return false; - - ch = data[index]; - - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; - } - - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; - - // base 2, base 8, base 16 - - if (ch === 'b') { - // base 2 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - - if (ch === 'x') { - // base 16 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - // base 8 - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - // base 10 (except 0) or base 60 - - // value should not start with `_`; - if (ch === '_') return false; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch === ':') break; - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - hasDigits = true; - } - - // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; - - // if !base60 - done; - if (ch !== ':') return true; - - // base60 almost not used, no needs to optimize - return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); -} - -function constructYamlInteger(data) { - var value = data, sign = 1, ch, base, digits = []; - - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); - } - - ch = value[0]; - - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; - } - - if (value === '0') return 0; - - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value, 16); - return sign * parseInt(value, 8); - } - - if (value.indexOf(':') !== -1) { - value.split(':').forEach(function (v) { - digits.unshift(parseInt(v, 10)); - }); - - value = 0; - base = 1; - - digits.forEach(function (d) { - value += (d * base); - base *= 60; - }); - - return sign * value; - - } - - return sign * parseInt(value, 10); -} - -function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); -} - -module.exports = new Type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } -}); - -},{"../common":2,"../type":13}],18:[function(require,module,exports){ -'use strict'; - -var esprima; - -// Browserified version does not have esprima -// -// 1. For node.js just require module as deps -// 2. For browser try to require mudule via external AMD system. -// If not found - try to fallback to window.esprima. If not -// found too - then fail to parse. -// -try { - // workaround to exclude package from browserify list. - var _require = require; - esprima = _require('esprima'); -} catch (_) { - /* eslint-disable no-redeclare */ - /* global window */ - if (typeof window !== 'undefined') esprima = window.esprima; -} - -var Type = require('../../type'); - -function resolveJavascriptFunction(data) { - if (data === null) return false; - - try { - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }); - - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - return false; - } - - return true; - } catch (err) { - return false; - } -} - -function constructJavascriptFunction(data) { - /*jslint evil:true*/ - - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }), - params = [], - body; - - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - throw new Error('Failed to resolve function'); - } - - ast.body[0].expression.params.forEach(function (param) { - params.push(param.name); - }); - - body = ast.body[0].expression.body.range; - - // Esprima's ranges include the first '{' and the last '}' characters on - // function expressions. So cut them out. - if (ast.body[0].expression.body.type === 'BlockStatement') { - /*eslint-disable no-new-func*/ - return new Function(params, source.slice(body[0] + 1, body[1] - 1)); - } - // ES6 arrow functions can omit the BlockStatement. In that case, just return - // the body. - /*eslint-disable no-new-func*/ - return new Function(params, 'return ' + source.slice(body[0], body[1])); -} - -function representJavascriptFunction(object /*, style*/) { - return object.toString(); -} - -function isFunction(object) { - return Object.prototype.toString.call(object) === '[object Function]'; -} - -module.exports = new Type('tag:yaml.org,2002:js/function', { - kind: 'scalar', - resolve: resolveJavascriptFunction, - construct: constructJavascriptFunction, - predicate: isFunction, - represent: representJavascriptFunction -}); - -},{"../../type":13}],19:[function(require,module,exports){ -'use strict'; - -var Type = require('../../type'); - -function resolveJavascriptRegExp(data) { - if (data === null) return false; - if (data.length === 0) return false; - - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // if regexp starts with '/' it can have modifiers and must be properly closed - // `/foo/gim` - modifiers tail can be maximum 3 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - - if (modifiers.length > 3) return false; - // if expression starts with /, is should be properly terminated - if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; - } - - return true; -} - -function constructJavascriptRegExp(data) { - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // `/foo/gim` - tail can be maximum 4 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - regexp = regexp.slice(1, regexp.length - modifiers.length - 1); - } - - return new RegExp(regexp, modifiers); -} - -function representJavascriptRegExp(object /*, style*/) { - var result = '/' + object.source + '/'; - - if (object.global) result += 'g'; - if (object.multiline) result += 'm'; - if (object.ignoreCase) result += 'i'; - - return result; -} - -function isRegExp(object) { - return Object.prototype.toString.call(object) === '[object RegExp]'; -} - -module.exports = new Type('tag:yaml.org,2002:js/regexp', { - kind: 'scalar', - resolve: resolveJavascriptRegExp, - construct: constructJavascriptRegExp, - predicate: isRegExp, - represent: representJavascriptRegExp -}); - -},{"../../type":13}],20:[function(require,module,exports){ -'use strict'; - -var Type = require('../../type'); - -function resolveJavascriptUndefined() { - return true; -} - -function constructJavascriptUndefined() { - /*eslint-disable no-undefined*/ - return undefined; -} - -function representJavascriptUndefined() { - return ''; -} - -function isUndefined(object) { - return typeof object === 'undefined'; -} - -module.exports = new Type('tag:yaml.org,2002:js/undefined', { - kind: 'scalar', - resolve: resolveJavascriptUndefined, - construct: constructJavascriptUndefined, - predicate: isUndefined, - represent: representJavascriptUndefined -}); - -},{"../../type":13}],21:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -module.exports = new Type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } -}); - -},{"../type":13}],22:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -function resolveYamlMerge(data) { - return data === '<<' || data === null; -} - -module.exports = new Type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge -}); - -},{"../type":13}],23:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -function resolveYamlNull(data) { - if (data === null) return true; - - var max = data.length; - - return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); -} - -function constructYamlNull() { - return null; -} - -function isNull(object) { - return object === null; -} - -module.exports = new Type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; } - }, - defaultStyle: 'lowercase' -}); - -},{"../type":13}],24:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -var _hasOwnProperty = Object.prototype.hasOwnProperty; -var _toString = Object.prototype.toString; - -function resolveYamlOmap(data) { - if (data === null) return true; - - var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; - - if (_toString.call(pair) !== '[object Object]') return false; - - for (pairKey in pair) { - if (_hasOwnProperty.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; - } - } - - if (!pairHasKey) return false; - - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; - } - - return true; -} - -function constructYamlOmap(data) { - return data !== null ? data : []; -} - -module.exports = new Type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap -}); - -},{"../type":13}],25:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -var _toString = Object.prototype.toString; - -function resolveYamlPairs(data) { - if (data === null) return true; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - if (_toString.call(pair) !== '[object Object]') return false; - - keys = Object.keys(pair); - - if (keys.length !== 1) return false; - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return true; -} - -function constructYamlPairs(data) { - if (data === null) return []; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - keys = Object.keys(pair); - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return result; -} - -module.exports = new Type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs -}); - -},{"../type":13}],26:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -module.exports = new Type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } -}); - -},{"../type":13}],27:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -var _hasOwnProperty = Object.prototype.hasOwnProperty; - -function resolveYamlSet(data) { - if (data === null) return true; - - var key, object = data; - - for (key in object) { - if (_hasOwnProperty.call(object, key)) { - if (object[key] !== null) return false; - } - } - - return true; -} - -function constructYamlSet(data) { - return data !== null ? data : {}; -} - -module.exports = new Type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); - -},{"../type":13}],28:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -module.exports = new Type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } -}); - -},{"../type":13}],29:[function(require,module,exports){ -'use strict'; - -var Type = require('../type'); - -var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day - -var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute - -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; -} - -function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - - if (match === null) throw new Error('Date resolve error'); - - // match: [1] year [2] month [3] day - - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); - - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); - } - - // match: [4] hour [5] minute [6] second [7] fraction - - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); - - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; - } - fraction = +fraction; - } - - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute - - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; - } - - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - - if (delta) date.setTime(date.getTime() - delta); - - return date; -} - -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); -} - -module.exports = new Type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); - -},{"../type":13}],"/":[function(require,module,exports){ -'use strict'; - - -var yaml = require('./lib/js-yaml.js'); - - -module.exports = yaml; - -},{"./lib/js-yaml.js":1}]},{},[])("/") -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/dist/js-yaml.min.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/dist/js-yaml.min.js deleted file mode 100644 index 1b6ecc16b..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/dist/js-yaml.min.js +++ /dev/null @@ -1 +0,0 @@ -/*! js-yaml 3.14.1 https://github.com/nodeca/js-yaml */!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsyaml=e()}(function(){return function i(r,o,a){function s(t,e){if(!o[t]){if(!r[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=o[t]={exports:{}},r[t][0].call(n.exports,function(e){return s(r[t][1][e]||e)},n,n.exports,i,r,o,a)}return o[t].exports}for(var c="function"==typeof require&&require,e=0;e=i.flowLevel;switch(V(r,n,i.indent,t,function(e){return function(e,t){for(var n=0,i=e.implicitTypes.length;n"+z(r,i.indent)+J(U(function(t,n){var e,i=/(\n+)([^\n]*)/g,r=function(){var e=-1!==(e=t.indexOf("\n"))?e:t.length;return i.lastIndex=e,Q(t.slice(0,e),n)}(),o="\n"===t[0]||" "===t[0];for(;e=i.exec(t);){var a=e[1],s=e[2];e=" "===s[0],r+=a+(o||e||""===s?"":"\n")+Q(s,n),o=e}return r}(r,t),e));case G:return'"'+function(e){for(var t,n,i,r="",o=0;ot&&o tag resolver accepts not "'+o+'" style');i=r.represent[o](t,o)}e.dump=i}return 1}}function ee(e,t,n,i,r,o){e.tag=null,e.dump=n,X(e,n,!1)||X(e,n,!0);var a=l.call(e.dump);i=i&&(e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(c=-1!==(s=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&0 "+e.dump)}return 1}function te(e,t){var n,i,r=[],o=[];for(!function e(t,n,i){var r,o,a;if(null!==t&&"object"==typeof t)if(-1!==(o=n.indexOf(t)))-1===i.indexOf(o)&&i.push(o);else if(n.push(t),Array.isArray(t))for(o=0,a=t.length;o>10),56320+(c-65536&1023)),e.position++}else N(e,"unknown escape sequence");n=i=e.position}else S(u)?(L(e,n,i,!0),B(e,Y(e,!1,t)),n=i=e.position):e.position===e.lineStart&&R(e)?N(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}N(e,"unexpected end of the stream within a double quoted scalar")}}function K(e,t){var n,i,r=e.tag,o=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&45===i&&O(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,Y(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,P(e,t,x,!1,!0),a.push(e.result),Y(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)N(e,"bad indentation of a sequence entry");else if(e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt)&&(P(e,t,A,!0,r)&&(m?d=e.result:h=e.result),m||(U(e,l,p,f,d,h,o,a),f=d=h=null),Y(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)N(e,"bad indentation of a mapping entry");else if(e.lineIndentc&&(c=e.lineIndent),S(p))u++;else{if(e.lineIndent=t){a=!0,f=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=c,e.lineIndent=u;break}}a&&(L(e,r,o,!1),B(e,e.line-s),r=o=e.position,a=!1),I(f)||(o=e.position+1),f=e.input.charCodeAt(++e.position)}if(L(e,r,o,!1),e.result)return 1;e.kind=l,e.result=p}}(e,i,g===n)&&(d=!0,null===e.tag&&(e.tag="?")):(d=!0,null===e.tag&&null===e.anchor||N(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===p&&(d=s&&K(e,r))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&N(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,u=e.implicitTypes.length;c tag; it should be "'+l.kind+'", not "'+e.kind+'"'),l.resolve(e.result)?(e.result=l.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):N(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):N(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||d}function $(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new F(e,t),e=e.indexOf("\0");for(-1!==e&&(n.position=e,N(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.positiont/2-1){n=" ... ",i+=5;break}for(r="",o=this.position;ot/2-1){r=" ... ",o-=5;break}return a=this.buffer.slice(i,o),s.repeat(" ",e)+n+a+r+"\n"+s.repeat(" ",e+this.position-i+n.length)+"^"},i.prototype.toString=function(e){var t="";return this.name&&(t+='in "'+this.name+'" '),t+="at line "+(this.line+1)+", column "+(this.column+1),e||(e=this.getSnippet())&&(t+=":\n"+e),t},t.exports=i},{"./common":2}],7:[function(e,t,n){"use strict";var r=e("./common"),o=e("./exception"),a=e("./type");function s(e,t,i){var r=[];return e.include.forEach(function(e){i=s(e,t,i)}),e[t].forEach(function(n){i.forEach(function(e,t){e.tag===n.tag&&e.kind===n.kind&&r.push(t)}),i.push(n)}),i.filter(function(e,t){return-1===r.indexOf(t)})}function c(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=s(this,"implicit",[]),this.compiledExplicit=s(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{}};function i(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e>16&255),o.push(r>>8&255),o.push(255&r)),r=r<<6|i.indexOf(t.charAt(a));return 0==(e=n%4*6)?(o.push(r>>16&255),o.push(r>>8&255),o.push(255&r)):18==e?(o.push(r>>10&255),o.push(r>>2&255)):12==e&&o.push(r>>4&255),s?s.from?s.from(o):new s(o):o},predicate:function(e){return s&&s.isBuffer(e)},represent:function(e){for(var t,n="",i=0,r=e.length,o=c,a=0;a>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]),i=(i<<8)+e[a];return 0==(t=r%3)?(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]):2==t?(n+=o[i>>10&63],n+=o[i>>4&63],n+=o[i<<2&63],n+=o[64]):1==t&&(n+=o[i>>2&63],n+=o[i<<4&63],n+=o[64],n+=o[64]),n}})},{"../type":13}],15:[function(e,t,n){"use strict";e=e("../type");t.exports=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(e,t,n){"use strict";var i=e("../common"),e=e("../type"),r=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var o=/^[-+]?[0-9]+e/;t.exports=new e("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!r.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n=e.replace(/_/g,"").toLowerCase(),e="-"===n[0]?-1:1,i=[];return 0<="+-".indexOf(n[0])&&(n=n.slice(1)),".inf"===n?1==e?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===n?NaN:0<=n.indexOf(":")?(n.split(":").forEach(function(e){i.unshift(parseFloat(e,10))}),n=0,t=1,i.forEach(function(e){n+=e*t,t*=60}),e*n):e*parseFloat(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||i.isNegativeZero(e))},represent:function(e,t){if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(e))return"-0.0";return e=e.toString(10),o.test(e)?e.replace("e",".e"):e},defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(e,t,n){"use strict";var i=e("../common"),e=e("../type");t.exports=new e("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i,r,o=e.length,a=0,s=!1;if(!o)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===o)return!0;if("b"===(t=e[++a])){for(a++;a */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - -var ESCAPE_SEQUENCES = {}; - -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; - -var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; - -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; - - if (map === null) return {}; - - result = {}; - keys = Object.keys(map); - - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); - - if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); - } - type = schema.compiledTypeMap['fallback'][tag]; - - if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; - } - - result[tag] = style; - } - - return result; -} - -function encodeHex(character) { - var string, handle, length; - - string = character.toString(16).toUpperCase(); - - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); - } - - return '\\' + handle + common.repeat('0', length - string.length) + string; -} - -function State(options) { - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.indent = Math.max(1, (options['indent'] || 2)); - this.noArrayIndent = options['noArrayIndent'] || false; - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; - this.condenseFlow = options['condenseFlow'] || false; - - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; - - this.tag = null; - this.result = ''; - - this.duplicates = []; - this.usedDuplicates = null; -} - -// Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; - - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; - } - - if (line.length && line !== '\n') result += ind; - - result += line; - } - - return result; -} - -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); -} - -function testImplicitResolving(state, str) { - var index, length, type; - - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; - - if (type.resolve(str)) { - return true; - } - } - - return false; -} - -// [33] s-white ::= s-space | s-tab -function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; -} - -// Returns true if the character can be printed without escaping. -// From YAML 1.2: "any allowed characters known to be non-printable -// should also be escaped. [However,] This isn’t mandatory" -// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) - || (0x10000 <= c && c <= 0x10FFFF); -} - -// [34] ns-char ::= nb-char - s-white -// [27] nb-char ::= c-printable - b-char - c-byte-order-mark -// [26] b-char ::= b-line-feed | b-carriage-return -// [24] b-line-feed ::= #xA /* LF */ -// [25] b-carriage-return ::= #xD /* CR */ -// [3] c-byte-order-mark ::= #xFEFF -function isNsChar(c) { - return isPrintable(c) && !isWhitespace(c) - // byte-order-mark - && c !== 0xFEFF - // b-char - && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED; -} - -// Simplified test for values allowed after the first character in plain style. -function isPlainSafe(c, prev) { - // Uses a subset of nb-char - c-flow-indicator - ":" - "#" - // where nb-char ::= c-printable - b-char - c-byte-order-mark. - return isPrintable(c) && c !== 0xFEFF - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // - ":" - "#" - // /* An ns-char preceding */ "#" - && c !== CHAR_COLON - && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); -} - -// Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c) { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - return isPrintable(c) && c !== 0xFEFF - && !isWhitespace(c) // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS - && c !== CHAR_QUESTION - && c !== CHAR_COLON - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” - && c !== CHAR_SHARP - && c !== CHAR_AMPERSAND - && c !== CHAR_ASTERISK - && c !== CHAR_EXCLAMATION - && c !== CHAR_VERTICAL_LINE - && c !== CHAR_EQUALS - && c !== CHAR_GREATER_THAN - && c !== CHAR_SINGLE_QUOTE - && c !== CHAR_DOUBLE_QUOTE - // | “%” | “@” | “`”) - && c !== CHAR_PERCENT - && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT; -} - -// Determines whether block indentation indicator is required. -function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); -} - -var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; - -// Determines which scalar styles are possible and returns the preferred style. -// lineWidth = -1 => no limit. -// Pre-conditions: str.length > 0. -// Post-conditions: -// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. -// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). -// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { - var i; - var char, prev_char; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst(string.charCodeAt(0)) - && !isWhitespace(string.charCodeAt(string.length - 1)); - - if (singleLineOnly) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe(char, prev_char); - } - } else { - // Case: block styles permitted. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' '); - previousLineBreak = i; - } - } else if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe(char, prev_char); - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || (shouldTrackWidth && - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); - } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - return plain && !testAmbiguousType(string) - ? STYLE_PLAIN : STYLE_SINGLE; - } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; - } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; -} - -// Note: line breaking/folding is implemented for only the folded style. -// NB. We drop the last trailing newline (if any) of a returned block scalar -// since the dumper adds its own newline. This always works: -// • No ending newline => unaffected; already using strip "-" chomping. -// • Ending newline => removed then restored. -// Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar(state, string, level, iskey) { - state.dump = (function () { - if (string.length === 0) { - return "''"; - } - if (!state.noCompatMode && - DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { - return "'" + string + "'"; - } - - var indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower bound. - // This behaves better than a constant minimum width which disallows narrower options, - // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); - - // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey - // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); - } - - switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { - case STYLE_PLAIN: - return string; - case STYLE_SINGLE: - return "'" + string.replace(/'/g, "''") + "'"; - case STYLE_LITERAL: - return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)); - case STYLE_FOLDED: - return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); - case STYLE_DOUBLE: - return '"' + escapeString(string, lineWidth) + '"'; - default: - throw new YAMLException('impossible error: invalid scalar style'); - } - }()); -} - -// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; - - // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); - - return indentIndicator + chomp + '\n'; -} - -// (See the note for writeScalar.) -function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; -} - -// Note: a long line without a suitable break point will exceed the width limit. -// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string, width) { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; - - // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); - // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; - - // rest of the lines - var match; - while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2]; - moreIndented = (line[0] === ' '); - result += prefix - + (!prevMoreIndented && !moreIndented && line !== '' - ? '\n' : '') - + foldLine(line, width); - prevMoreIndented = moreIndented; - } - - return result; -} - -// Greedy line breaking. -// Picks the longest line under the limit each time, -// otherwise settles for the shortest line over the limit. -// NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine(line, width) { - if (line === '' || line[0] === ' ') return line; - - // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - var match; - // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0; - var result = ''; - - // Invariants: 0 <= start <= length-1. - // 0 <= curr <= next <= max(0, length-2). curr - start <= width. - // Inside the loop: - // A match implies length >= 2, so curr and next are <= length-2. - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 - } - curr = next; - } - - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += '\n'; - // Insert a break if the remainder is too long and there is a break available. - if (line.length - start > width && curr > start) { - result += line.slice(start, curr) + '\n' + line.slice(curr + 1); - } else { - result += line.slice(start); - } - - return result.slice(1); // drop extra \n joiner -} - -// Escapes a double-quoted string. -function escapeString(string) { - var result = ''; - var char, nextChar; - var escapeSeq; - - for (var i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). - if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { - nextChar = string.charCodeAt(i + 1); - if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { - // Combine the surrogate pair and store it escaped. - result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); - // Advance index one extra since we already used that char here. - i++; continue; - } - } - escapeSeq = ESCAPE_SEQUENCES[char]; - result += !escapeSeq && isPrintable(char) - ? string[i] - : escapeSeq || encodeHex(char); - } - - return result; -} - -function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length; - - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level, object[index], false, false)) { - if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = '[' + _result + ']'; -} - -function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length; - - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level + 1, object[index], true, true)) { - if (!compact || index !== 0) { - _result += generateNextLine(state, level); - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; - } else { - _result += '- '; - } - - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. -} - -function writeFlowMapping(state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer; - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - - pairBuffer = ''; - if (index !== 0) pairBuffer += ', '; - - if (state.condenseFlow) pairBuffer += '"'; - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } - - if (state.dump.length > 1024) pairBuffer += '? '; - - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); - - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = '{' + _result + '}'; -} - -function writeBlockMapping(state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer; - - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new YAMLException('sortKeys must be a boolean or a function'); - } - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; - - if (!compact || index !== 0) { - pairBuffer += generateNextLine(state, level); - } - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } - - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); - - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; - } - } - - pairBuffer += state.dump; - - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } - - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; - } else { - pairBuffer += ': '; - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. -} - -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; - - typeList = explicit ? state.explicitTypes : state.implicitTypes; - - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; - - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { - - state.tag = explicit ? type.tag : '?'; - - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; - - if (_toString.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); - } else if (_hasOwnProperty.call(type.represent, style)) { - _result = type.represent[style](object, style); - } else { - throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); - } - - state.dump = _result; - } - - return true; - } - } - - return false; -} - -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode(state, level, object, block, compact, iskey) { - state.tag = null; - state.dump = object; - - if (!detectType(state, object, false)) { - detectType(state, object, true); - } - - var type = _toString.call(state.dump); - - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); - } - - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; - - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } - - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } - - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === '[object Object]') { - if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object Array]') { - var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; - if (block && (state.dump.length !== 0)) { - writeBlockSequence(state, arrayLevel, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowSequence(state, arrayLevel, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object String]') { - if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey); - } - } else { - if (state.skipInvalid) return false; - throw new YAMLException('unacceptable kind of an object to dump ' + type); - } - - if (state.tag !== null && state.tag !== '?') { - state.dump = '!<' + state.tag + '> ' + state.dump; - } - } - - return true; -} - -function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; - - inspectNode(object, objects, duplicatesIndexes); - - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); -} - -function inspectNode(object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length; - - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); - - if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); - } - } else { - objectKeyList = Object.keys(object); - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); - } - } - } - } -} - -function dump(input, options) { - options = options || {}; - - var state = new State(options); - - if (!state.noRefs) getDuplicateReferences(input, state); - - if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; - - return ''; -} - -function safeDump(input, options) { - return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} - -module.exports.dump = dump; -module.exports.safeDump = safeDump; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/exception.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/exception.js deleted file mode 100644 index b744a1ee4..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/exception.js +++ /dev/null @@ -1,43 +0,0 @@ -// YAML error class. http://stackoverflow.com/questions/8458984 -// -'use strict'; - -function YAMLException(reason, mark) { - // Super constructor - Error.call(this); - - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); - - // Include stack trace in error object - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; - } -} - - -// Inherit from Error -YAMLException.prototype = Object.create(Error.prototype); -YAMLException.prototype.constructor = YAMLException; - - -YAMLException.prototype.toString = function toString(compact) { - var result = this.name + ': '; - - result += this.reason || '(unknown reason)'; - - if (!compact && this.mark) { - result += ' ' + this.mark.toString(); - } - - return result; -}; - - -module.exports = YAMLException; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/loader.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/loader.js deleted file mode 100644 index d7484a591..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/loader.js +++ /dev/null @@ -1,1644 +0,0 @@ -'use strict'; - -/*eslint-disable max-len,no-use-before-define*/ - -var common = require('./common'); -var YAMLException = require('./exception'); -var Mark = require('./mark'); -var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); -var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); - - -var _hasOwnProperty = Object.prototype.hasOwnProperty; - - -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; - - -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; - - -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - - -function _class(obj) { return Object.prototype.toString.call(obj); } - -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); -} - -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); -} - -function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); -} - -function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; -} - -function fromHexCode(c) { - var lc; - - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - /*eslint-disable no-bitwise*/ - lc = c | 0x20; - - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; - } - - return -1; -} - -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; -} - -function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - return -1; -} - -function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; -} - -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode( - ((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00 - ); -} - -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); -} - - -function State(input, options) { - this.input = input; - - this.filename = options['filename'] || null; - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.onWarning = options['onWarning'] || null; - this.legacy = options['legacy'] || false; - this.json = options['json'] || false; - this.listener = options['listener'] || null; - - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; - - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; - - this.documents = []; - - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ - -} - - -function generateError(state, message) { - return new YAMLException( - message, - new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); -} - -function throwError(state, message) { - throw generateError(state, message); -} - -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); - } -} - - -var directiveHandlers = { - - YAML: function handleYamlDirective(state, name, args) { - - var match, major, minor; - - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } - - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); - } - - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); - - if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); - } - - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); - - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } - - state.version = args[0]; - state.checkLineBreaks = (minor < 2); - - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); - } - }, - - TAG: function handleTagDirective(state, name, args) { - - var handle, prefix; - - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } - - handle = args[0]; - prefix = args[1]; - - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); - } - - if (_hasOwnProperty.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); - } - - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } - - state.tagMap[handle] = prefix; - } -}; - - -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; - - if (start < end) { - _result = state.input.slice(start, end); - - if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); - if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } - - state.result += _result; - } -} - -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; - - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } - - sourceKeys = Object.keys(source); - - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; - - if (!_hasOwnProperty.call(destination, key)) { - destination[key] = source[key]; - overridableKeys[key] = true; - } - } -} - -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { - var index, quantity; - - // The output is a plain object here, so keys can only be strings. - // We need to convert keyNode to a string, but doing so can hang the process - // (deeply nested arrays that explode exponentially using aliases). - if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); - - for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { - if (Array.isArray(keyNode[index])) { - throwError(state, 'nested arrays are not supported inside keys'); - } - - if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { - keyNode[index] = '[object Object]'; - } - } - } - - // Avoid code execution in load() via toString property - // (still use its own toString for arrays, timestamps, - // and whatever user schema extensions happen to have @@toStringTag) - if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; - } - - - keyNode = String(keyNode); - - if (_result === null) { - _result = {}; - } - - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); - } - } else { - if (!state.json && - !_hasOwnProperty.call(overridableKeys, keyNode) && - _hasOwnProperty.call(_result, keyNode)) { - state.line = startLine || state.line; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); - } - _result[keyNode] = valueNode; - delete overridableKeys[keyNode]; - } - - return _result; -} - -function readLineBreak(state) { - var ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); - } - - state.line += 1; - state.lineStart = state.position; -} - -function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); - } - - if (is_EOL(ch)) { - readLineBreak(state); - - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; - - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } - - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } - - return lineBreaks; -} - -function testDocumentSeparator(state) { - var _position = state.position, - ch; - - ch = state.input.charCodeAt(_position); - - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { - - _position += 3; - - ch = state.input.charCodeAt(_position); - - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } - - return false; -} - -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); - } -} - - -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; - - ch = state.input.charCodeAt(state.position); - - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; - } - - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } - } - - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; - - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } - - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); - - if (is_WS_OR_EOL(preceding)) { - break; - } - - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; - - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); - - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; - } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; - } - } - - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } - - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; - } - - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, captureEnd, false); - - if (state.result) { - return true; - } - - state.kind = _kind; - state.result = _result; - return false; -} - -function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x27/* ' */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a single quoted scalar'); -} - -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x22/* " */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; - - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); - - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; - - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; - - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); - - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; - - } else { - throwError(state, 'expected hexadecimal character'); - } - } - - state.result += charFromCodepoint(hexResult); - - state.position++; - - } else { - throwError(state, 'unknown escape sequence'); - } - - captureStart = captureEnd = state.position; - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a double quoted scalar'); -} - -function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = {}, - keyNode, - keyTag, - valueNode, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(++state.position); - - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } - - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; - - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; - } - - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); - } else { - _result.push(keyNode); - } - - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } - - throwError(state, 'unexpected end of the stream within a flow collection'); -} - -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } - - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } - - } else { - break; - } - } - - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); - } - } - - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; - - ch = state.input.charCodeAt(state.position); - - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } - - if (is_EOL(ch)) { - emptyLines++; - continue; - } - - // End of the scalar. - if (state.lineIndent < textIndent) { - - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; - } - } - - // Break this `while` cycle and go to the funciton's epilogue. - break; - } - - // Folded style: use fancy rules to handle line breaks. - if (folding) { - - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); - - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; - } - - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } - - // Literal style: just add exact number of line breaks between content lines. - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } - - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; - - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, state.position, false); - } - - return true; -} - -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - - if (ch !== 0x2D/* - */) { - break; - } - - following = state.input.charCodeAt(state.position + 1); - - if (!is_WS_OR_EOL(following)) { - break; - } - - detected = true; - state.position++; - - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; -} - -function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _pos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = {}, - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - _pos = state.position; - - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { - - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = true; - allowCompact = true; - - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; - - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); - } - - state.position += 1; - ch = following; - - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { - - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); - - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); - - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } - - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; - - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - - } else { - break; // Reading is done. Go to the epilogue. - } - - // - // Common reading code for both explicit and implicit notations. - // - if (state.line === _line || state.lineIndent > nodeIndent) { - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; - } else { - valueNode = state.result; - } - } - - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); - keyTag = keyNode = valueNode = null; - } - - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); - } - - if (state.lineIndent > nodeIndent && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - // - // Epilogue. - // - - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - } - - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; - } - - return detected; -} - -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x21/* ! */) return false; - - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } - - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); - - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); - - } else { - tagHandle = '!'; - } - - _position = state.position; - - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); - - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); - } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); - - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } - - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } - - ch = state.input.charCodeAt(++state.position); - } - - tagName = state.input.slice(_position, state.position); - - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); - } - } - - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } - - if (isVerbatim) { - state.tag = tagName; - - } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; - - } else if (tagHandle === '!') { - state.tag = '!' + tagName; - - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; - - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); - } - - return true; -} - -function readAnchorProperty(state) { - var _position, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x26/* & */) return false; - - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); - } - - state.anchor = state.input.slice(_position, state.position); - return true; -} - -function readAlias(state) { - var _position, alias, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x2A/* * */) return false; - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); - } - - alias = state.input.slice(_position, state.position); - - if (!_hasOwnProperty.call(state.anchorMap, alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } - - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; -} - -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } - - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; - - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } - - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } - - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } - - blockIndent = state.position - state.lineStart; - - if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || - readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || - readSingleQuotedScalar(state, flowIndent) || - readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; - - } else if (readAlias(state)) { - hasContent = true; - - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } - - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; - - if (state.tag === null) { - state.tag = '?'; - } - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } - - if (state.tag !== null && state.tag !== '!') { - if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "! [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); - } - - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; - - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; - - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } - - if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - } - - if (state.listener !== null) { - state.listener('close', state); - } - return state.tag !== null || state.anchor !== null || hasContent; -} - -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; - - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = {}; - state.anchorMap = {}; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } - - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; - - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } - - if (is_EOL(ch)) break; - - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveArgs.push(state.input.slice(_position, state.position)); - } - - if (ch !== 0) readLineBreak(state); - - if (_hasOwnProperty.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); - } - } - - skipSeparationSpace(state, true, -1); - - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); - } - - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); - - if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); - } - - state.documents.push(state.result); - - if (state.position === state.lineStart && testDocumentSeparator(state)) { - - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - return; - } - - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } -} - - -function loadDocuments(input, options) { - input = String(input); - options = options || {}; - - if (input.length !== 0) { - - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; - } - - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } - - var state = new State(input, options); - - var nullpos = input.indexOf('\0'); - - if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); - } - - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; - - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } - - while (state.position < (state.length - 1)) { - readDocument(state); - } - - return state.documents; -} - - -function loadAll(input, iterator, options) { - if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; - } - - var documents = loadDocuments(input, options); - - if (typeof iterator !== 'function') { - return documents; - } - - for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); - } -} - - -function load(input, options) { - var documents = loadDocuments(input, options); - - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - throw new YAMLException('expected a single document in the stream, but found more'); -} - - -function safeLoadAll(input, iterator, options) { - if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { - options = iterator; - iterator = null; - } - - return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} - - -function safeLoad(input, options) { - return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} - - -module.exports.loadAll = loadAll; -module.exports.load = load; -module.exports.safeLoadAll = safeLoadAll; -module.exports.safeLoad = safeLoad; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/mark.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/mark.js deleted file mode 100644 index 47b265c20..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/mark.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - - -var common = require('./common'); - - -function Mark(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; -} - - -Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; - - if (!this.buffer) return null; - - indent = indent || 4; - maxLength = maxLength || 75; - - head = ''; - start = this.position; - - while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { - start -= 1; - if (this.position - start > (maxLength / 2 - 1)) { - head = ' ... '; - start += 5; - break; - } - } - - tail = ''; - end = this.position; - - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - if (end - this.position > (maxLength / 2 - 1)) { - tail = ' ... '; - end -= 5; - break; - } - } - - snippet = this.buffer.slice(start, end); - - return common.repeat(' ', indent) + head + snippet + tail + '\n' + - common.repeat(' ', indent + this.position - start + head.length) + '^'; -}; - - -Mark.prototype.toString = function toString(compact) { - var snippet, where = ''; - - if (this.name) { - where += 'in "' + this.name + '" '; - } - - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); - - if (!compact) { - snippet = this.getSnippet(); - - if (snippet) { - where += ':\n' + snippet; - } - } - - return where; -}; - - -module.exports = Mark; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema.js deleted file mode 100644 index ca7cf47e7..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema.js +++ /dev/null @@ -1,108 +0,0 @@ -'use strict'; - -/*eslint-disable max-len*/ - -var common = require('./common'); -var YAMLException = require('./exception'); -var Type = require('./type'); - - -function compileList(schema, name, result) { - var exclude = []; - - schema.include.forEach(function (includedSchema) { - result = compileList(includedSchema, name, result); - }); - - schema[name].forEach(function (currentType) { - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { - exclude.push(previousIndex); - } - }); - - result.push(currentType); - }); - - return result.filter(function (type, index) { - return exclude.indexOf(index) === -1; - }); -} - - -function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {} - }, index, length; - - function collectType(type) { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; - } - - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); - } - return result; -} - - -function Schema(definition) { - this.include = definition.include || []; - this.implicit = definition.implicit || []; - this.explicit = definition.explicit || []; - - this.implicit.forEach(function (type) { - if (type.loadKind && type.loadKind !== 'scalar') { - throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); - } - }); - - this.compiledImplicit = compileList(this, 'implicit', []); - this.compiledExplicit = compileList(this, 'explicit', []); - this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); -} - - -Schema.DEFAULT = null; - - -Schema.create = function createSchema() { - var schemas, types; - - switch (arguments.length) { - case 1: - schemas = Schema.DEFAULT; - types = arguments[0]; - break; - - case 2: - schemas = arguments[0]; - types = arguments[1]; - break; - - default: - throw new YAMLException('Wrong number of arguments for Schema.create function'); - } - - schemas = common.toArray(schemas); - types = common.toArray(types); - - if (!schemas.every(function (schema) { return schema instanceof Schema; })) { - throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); - } - - if (!types.every(function (type) { return type instanceof Type; })) { - throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } - - return new Schema({ - include: schemas, - explicit: types - }); -}; - - -module.exports = Schema; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/core.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/core.js deleted file mode 100644 index 206daab56..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/core.js +++ /dev/null @@ -1,18 +0,0 @@ -// Standard YAML's Core schema. -// http://www.yaml.org/spec/1.2/spec.html#id2804923 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, Core schema has no distinctions from JSON schema is JS-YAML. - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = new Schema({ - include: [ - require('./json') - ] -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/default_full.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/default_full.js deleted file mode 100644 index a55ef42ac..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +++ /dev/null @@ -1,25 +0,0 @@ -// JS-YAML's default schema for `load` function. -// It is not described in the YAML specification. -// -// This schema is based on JS-YAML's default safe schema and includes -// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. -// -// Also this schema is used as default base schema at `Schema.create` function. - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = Schema.DEFAULT = new Schema({ - include: [ - require('./default_safe') - ], - explicit: [ - require('../type/js/undefined'), - require('../type/js/regexp'), - require('../type/js/function') - ] -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js deleted file mode 100644 index 11d89bbfb..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +++ /dev/null @@ -1,28 +0,0 @@ -// JS-YAML's default schema for `safeLoad` function. -// It is not described in the YAML specification. -// -// This schema is based on standard YAML's Core schema and includes most of -// extra types described at YAML tag repository. (http://yaml.org/type/) - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = new Schema({ - include: [ - require('./core') - ], - implicit: [ - require('../type/timestamp'), - require('../type/merge') - ], - explicit: [ - require('../type/binary'), - require('../type/omap'), - require('../type/pairs'), - require('../type/set') - ] -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js deleted file mode 100644 index b7a33eb7a..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +++ /dev/null @@ -1,17 +0,0 @@ -// Standard YAML's Failsafe schema. -// http://www.yaml.org/spec/1.2/spec.html#id2802346 - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = new Schema({ - explicit: [ - require('../type/str'), - require('../type/seq'), - require('../type/map') - ] -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/json.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/json.js deleted file mode 100644 index 5be3dbf80..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/schema/json.js +++ /dev/null @@ -1,25 +0,0 @@ -// Standard YAML's JSON schema. -// http://www.yaml.org/spec/1.2/spec.html#id2803231 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, this schema is not such strict as defined in the YAML specification. -// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. - - -'use strict'; - - -var Schema = require('../schema'); - - -module.exports = new Schema({ - include: [ - require('./failsafe') - ], - implicit: [ - require('../type/null'), - require('../type/bool'), - require('../type/int'), - require('../type/float') - ] -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type.js deleted file mode 100644 index 90b702ac0..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -var YAMLException = require('./exception'); - -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'defaultStyle', - 'styleAliases' -]; - -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; - -function compileStyleAliases(map) { - var result = {}; - - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } - - return result; -} - -function Type(tag, options) { - options = options || {}; - - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); - } - }); - - // TODO: Add tag format check. - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); - } -} - -module.exports = Type; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/binary.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/binary.js deleted file mode 100644 index 10b187559..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/binary.js +++ /dev/null @@ -1,138 +0,0 @@ -'use strict'; - -/*eslint-disable no-bitwise*/ - -var NodeBuffer; - -try { - // A trick for browserified version, to not include `Buffer` shim - var _require = require; - NodeBuffer = _require('buffer').Buffer; -} catch (__) {} - -var Type = require('../type'); - - -// [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - - -function resolveYamlBinary(data) { - if (data === null) return false; - - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; - - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); - - // Skip CR/LF - if (code > 64) continue; - - // Fail on illegal characters - if (code < 0) return false; - - bitlen += 6; - } - - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; -} - -function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; - - // Collect by 6*4 bits (3 bytes) - - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } - - bits = (bits << 6) | map.indexOf(input.charAt(idx)); - } - - // Dump tail - - tailbits = (max % 4) * 6; - - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } - - // Wrap into Buffer for NodeJS and leave Array for browser - if (NodeBuffer) { - // Support node 6.+ Buffer API when available - return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); - } - - return result; -} - -function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; - - // Convert every three bytes to 4 ASCII characters. - - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } - - bits = (bits << 8) + object[idx]; - } - - // Dump tail - - tail = max % 3; - - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; - } - - return result; -} - -function isBinary(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); -} - -module.exports = new Type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/bool.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/bool.js deleted file mode 100644 index cb7745930..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/bool.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -function resolveYamlBoolean(data) { - if (data === null) return false; - - var max = data.length; - - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); -} - -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; -} - -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} - -module.exports = new Type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/float.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/float.js deleted file mode 100644 index 127671b21..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/float.js +++ /dev/null @@ -1,116 +0,0 @@ -'use strict'; - -var common = require('../common'); -var Type = require('../type'); - -var YAML_FLOAT_PATTERN = new RegExp( - // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + - // .2e4, .2 - // special case, seems not from spec - '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // 20:59 - '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + - // .inf - '|[-+]?\\.(?:inf|Inf|INF)' + - // .nan - '|\\.(?:nan|NaN|NAN))$'); - -function resolveYamlFloat(data) { - if (data === null) return false; - - if (!YAML_FLOAT_PATTERN.test(data) || - // Quick hack to not allow integers end with `_` - // Probably should update regexp & check speed - data[data.length - 1] === '_') { - return false; - } - - return true; -} - -function constructYamlFloat(data) { - var value, sign, base, digits; - - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - digits = []; - - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); - } - - if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - - } else if (value === '.nan') { - return NaN; - - } else if (value.indexOf(':') >= 0) { - value.split(':').forEach(function (v) { - digits.unshift(parseFloat(v, 10)); - }); - - value = 0.0; - base = 1; - - digits.forEach(function (d) { - value += d * base; - base *= 60; - }); - - return sign * value; - - } - return sign * parseFloat(value, 10); -} - - -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; - -function representYamlFloat(object, style) { - var res; - - if (isNaN(object)) { - switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; - } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; - } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; - } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } - - res = object.toString(10); - - // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack - - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; -} - -function isFloat(object) { - return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); -} - -module.exports = new Type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/int.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/int.js deleted file mode 100644 index ba61c5f95..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/int.js +++ /dev/null @@ -1,173 +0,0 @@ -'use strict'; - -var common = require('../common'); -var Type = require('../type'); - -function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); -} - -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); -} - -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); -} - -function resolveYamlInteger(data) { - if (data === null) return false; - - var max = data.length, - index = 0, - hasDigits = false, - ch; - - if (!max) return false; - - ch = data[index]; - - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; - } - - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; - - // base 2, base 8, base 16 - - if (ch === 'b') { - // base 2 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - - if (ch === 'x') { - // base 16 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - // base 8 - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - // base 10 (except 0) or base 60 - - // value should not start with `_`; - if (ch === '_') return false; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch === ':') break; - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - hasDigits = true; - } - - // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; - - // if !base60 - done; - if (ch !== ':') return true; - - // base60 almost not used, no needs to optimize - return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); -} - -function constructYamlInteger(data) { - var value = data, sign = 1, ch, base, digits = []; - - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); - } - - ch = value[0]; - - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; - } - - if (value === '0') return 0; - - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value, 16); - return sign * parseInt(value, 8); - } - - if (value.indexOf(':') !== -1) { - value.split(':').forEach(function (v) { - digits.unshift(parseInt(v, 10)); - }); - - value = 0; - base = 1; - - digits.forEach(function (d) { - value += (d * base); - base *= 60; - }); - - return sign * value; - - } - - return sign * parseInt(value, 10); -} - -function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); -} - -module.exports = new Type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/js/function.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/js/function.js deleted file mode 100644 index 8fab8c430..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/js/function.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -var esprima; - -// Browserified version does not have esprima -// -// 1. For node.js just require module as deps -// 2. For browser try to require mudule via external AMD system. -// If not found - try to fallback to window.esprima. If not -// found too - then fail to parse. -// -try { - // workaround to exclude package from browserify list. - var _require = require; - esprima = _require('esprima'); -} catch (_) { - /* eslint-disable no-redeclare */ - /* global window */ - if (typeof window !== 'undefined') esprima = window.esprima; -} - -var Type = require('../../type'); - -function resolveJavascriptFunction(data) { - if (data === null) return false; - - try { - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }); - - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - return false; - } - - return true; - } catch (err) { - return false; - } -} - -function constructJavascriptFunction(data) { - /*jslint evil:true*/ - - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }), - params = [], - body; - - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - throw new Error('Failed to resolve function'); - } - - ast.body[0].expression.params.forEach(function (param) { - params.push(param.name); - }); - - body = ast.body[0].expression.body.range; - - // Esprima's ranges include the first '{' and the last '}' characters on - // function expressions. So cut them out. - if (ast.body[0].expression.body.type === 'BlockStatement') { - /*eslint-disable no-new-func*/ - return new Function(params, source.slice(body[0] + 1, body[1] - 1)); - } - // ES6 arrow functions can omit the BlockStatement. In that case, just return - // the body. - /*eslint-disable no-new-func*/ - return new Function(params, 'return ' + source.slice(body[0], body[1])); -} - -function representJavascriptFunction(object /*, style*/) { - return object.toString(); -} - -function isFunction(object) { - return Object.prototype.toString.call(object) === '[object Function]'; -} - -module.exports = new Type('tag:yaml.org,2002:js/function', { - kind: 'scalar', - resolve: resolveJavascriptFunction, - construct: constructJavascriptFunction, - predicate: isFunction, - represent: representJavascriptFunction -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js deleted file mode 100644 index 43fa47017..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -var Type = require('../../type'); - -function resolveJavascriptRegExp(data) { - if (data === null) return false; - if (data.length === 0) return false; - - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // if regexp starts with '/' it can have modifiers and must be properly closed - // `/foo/gim` - modifiers tail can be maximum 3 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - - if (modifiers.length > 3) return false; - // if expression starts with /, is should be properly terminated - if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; - } - - return true; -} - -function constructJavascriptRegExp(data) { - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // `/foo/gim` - tail can be maximum 4 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - regexp = regexp.slice(1, regexp.length - modifiers.length - 1); - } - - return new RegExp(regexp, modifiers); -} - -function representJavascriptRegExp(object /*, style*/) { - var result = '/' + object.source + '/'; - - if (object.global) result += 'g'; - if (object.multiline) result += 'm'; - if (object.ignoreCase) result += 'i'; - - return result; -} - -function isRegExp(object) { - return Object.prototype.toString.call(object) === '[object RegExp]'; -} - -module.exports = new Type('tag:yaml.org,2002:js/regexp', { - kind: 'scalar', - resolve: resolveJavascriptRegExp, - construct: constructJavascriptRegExp, - predicate: isRegExp, - represent: representJavascriptRegExp -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js deleted file mode 100644 index 95b5569fd..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -var Type = require('../../type'); - -function resolveJavascriptUndefined() { - return true; -} - -function constructJavascriptUndefined() { - /*eslint-disable no-undefined*/ - return undefined; -} - -function representJavascriptUndefined() { - return ''; -} - -function isUndefined(object) { - return typeof object === 'undefined'; -} - -module.exports = new Type('tag:yaml.org,2002:js/undefined', { - kind: 'scalar', - resolve: resolveJavascriptUndefined, - construct: constructJavascriptUndefined, - predicate: isUndefined, - represent: representJavascriptUndefined -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/map.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/map.js deleted file mode 100644 index f327beebd..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/map.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -module.exports = new Type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/merge.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/merge.js deleted file mode 100644 index ae08a8644..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/merge.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -function resolveYamlMerge(data) { - return data === '<<' || data === null; -} - -module.exports = new Type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/null.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/null.js deleted file mode 100644 index 6874daa64..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/null.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -function resolveYamlNull(data) { - if (data === null) return true; - - var max = data.length; - - return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); -} - -function constructYamlNull() { - return null; -} - -function isNull(object) { - return object === null; -} - -module.exports = new Type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; } - }, - defaultStyle: 'lowercase' -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/omap.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/omap.js deleted file mode 100644 index b2b5323bd..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/omap.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -var _hasOwnProperty = Object.prototype.hasOwnProperty; -var _toString = Object.prototype.toString; - -function resolveYamlOmap(data) { - if (data === null) return true; - - var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; - - if (_toString.call(pair) !== '[object Object]') return false; - - for (pairKey in pair) { - if (_hasOwnProperty.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; - } - } - - if (!pairHasKey) return false; - - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; - } - - return true; -} - -function constructYamlOmap(data) { - return data !== null ? data : []; -} - -module.exports = new Type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/pairs.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/pairs.js deleted file mode 100644 index 74b52403f..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/pairs.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -var _toString = Object.prototype.toString; - -function resolveYamlPairs(data) { - if (data === null) return true; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - if (_toString.call(pair) !== '[object Object]') return false; - - keys = Object.keys(pair); - - if (keys.length !== 1) return false; - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return true; -} - -function constructYamlPairs(data) { - if (data === null) return []; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - keys = Object.keys(pair); - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return result; -} - -module.exports = new Type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/seq.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/seq.js deleted file mode 100644 index be8f77f28..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/seq.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -module.exports = new Type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/set.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/set.js deleted file mode 100644 index f885a329c..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/set.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -var _hasOwnProperty = Object.prototype.hasOwnProperty; - -function resolveYamlSet(data) { - if (data === null) return true; - - var key, object = data; - - for (key in object) { - if (_hasOwnProperty.call(object, key)) { - if (object[key] !== null) return false; - } - } - - return true; -} - -function constructYamlSet(data) { - return data !== null ? data : {}; -} - -module.exports = new Type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/str.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/str.js deleted file mode 100644 index 27acc106c..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/str.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -module.exports = new Type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/timestamp.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/timestamp.js deleted file mode 100644 index 8fa9c5865..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict'; - -var Type = require('../type'); - -var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day - -var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute - -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; -} - -function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - - if (match === null) throw new Error('Date resolve error'); - - // match: [1] year [2] month [3] day - - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); - - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); - } - - // match: [4] hour [5] minute [6] second [7] fraction - - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); - - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; - } - fraction = +fraction; - } - - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute - - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; - } - - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - - if (delta) date.setTime(date.getTime() - delta); - - return date; -} - -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); -} - -module.exports = new Type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/package.json deleted file mode 100644 index 0d2366762..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "js-yaml", - "version": "3.14.1", - "description": "YAML 1.2 parser and serializer", - "keywords": [ - "yaml", - "parser", - "serializer", - "pyyaml" - ], - "homepage": "https://github.com/nodeca/js-yaml", - "author": "Vladimir Zapparov ", - "contributors": [ - "Aleksey V Zapparov (http://www.ixti.net/)", - "Vitaly Puzrin (https://github.com/puzrin)", - "Martin Grenfell (http://got-ravings.blogspot.com)" - ], - "license": "MIT", - "repository": "nodeca/js-yaml", - "files": [ - "index.js", - "lib/", - "bin/", - "dist/" - ], - "bin": { - "js-yaml": "bin/js-yaml.js" - }, - "unpkg": "dist/js-yaml.min.js", - "jsdelivr": "dist/js-yaml.min.js", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "devDependencies": { - "ansi": "^0.3.1", - "benchmark": "^2.1.4", - "browserify": "^16.2.2", - "codemirror": "^5.13.4", - "eslint": "^7.0.0", - "fast-check": "^1.24.2", - "istanbul": "^0.4.5", - "mocha": "^7.1.2", - "uglify-js": "^3.0.1" - }, - "scripts": { - "test": "make test" - } -} diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/index.d.ts b/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/index.d.ts deleted file mode 100644 index fbde526c0..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/index.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -declare namespace locatePath { - interface Options { - /** - Current working directory. - - @default process.cwd() - */ - readonly cwd?: string; - - /** - Type of path to match. - - @default 'file' - */ - readonly type?: 'file' | 'directory'; - - /** - Allow symbolic links to match if they point to the requested path type. - - @default true - */ - readonly allowSymlinks?: boolean; - } - - interface AsyncOptions extends Options { - /** - Number of concurrently pending promises. Minimum: `1`. - - @default Infinity - */ - readonly concurrency?: number; - - /** - Preserve `paths` order when searching. - - Disable this to improve performance if you don't care about the order. - - @default true - */ - readonly preserveOrder?: boolean; - } -} - -declare const locatePath: { - /** - Get the first path that exists on disk of multiple paths. - - @param paths - Paths to check. - @returns The first path that exists or `undefined` if none exists. - - @example - ``` - import locatePath = require('locate-path'); - - const files = [ - 'unicorn.png', - 'rainbow.png', // Only this one actually exists on disk - 'pony.png' - ]; - - (async () => { - console(await locatePath(files)); - //=> 'rainbow' - })(); - ``` - */ - (paths: Iterable, options?: locatePath.AsyncOptions): Promise< - string | undefined - >; - - /** - Synchronously get the first path that exists on disk of multiple paths. - - @param paths - Paths to check. - @returns The first path that exists or `undefined` if none exists. - */ - sync( - paths: Iterable, - options?: locatePath.Options - ): string | undefined; -}; - -export = locatePath; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/index.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/index.js deleted file mode 100644 index 4604bbf40..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/index.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; -const path = require('path'); -const fs = require('fs'); -const {promisify} = require('util'); -const pLocate = require('p-locate'); - -const fsStat = promisify(fs.stat); -const fsLStat = promisify(fs.lstat); - -const typeMappings = { - directory: 'isDirectory', - file: 'isFile' -}; - -function checkType({type}) { - if (type in typeMappings) { - return; - } - - throw new Error(`Invalid type specified: ${type}`); -} - -const matchType = (type, stat) => type === undefined || stat[typeMappings[type]](); - -module.exports = async (paths, options) => { - options = { - cwd: process.cwd(), - type: 'file', - allowSymlinks: true, - ...options - }; - checkType(options); - const statFn = options.allowSymlinks ? fsStat : fsLStat; - - return pLocate(paths, async path_ => { - try { - const stat = await statFn(path.resolve(options.cwd, path_)); - return matchType(options.type, stat); - } catch (_) { - return false; - } - }, options); -}; - -module.exports.sync = (paths, options) => { - options = { - cwd: process.cwd(), - allowSymlinks: true, - type: 'file', - ...options - }; - checkType(options); - const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync; - - for (const path_ of paths) { - try { - const stat = statFn(path.resolve(options.cwd, path_)); - - if (matchType(options.type, stat)) { - return path_; - } - } catch (_) { - } - } -}; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/license b/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -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/@istanbuljs/load-nyc-config/node_modules/locate-path/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/package.json deleted file mode 100644 index 063b29025..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "locate-path", - "version": "5.0.0", - "description": "Get the first path that exists on disk of multiple paths", - "license": "MIT", - "repository": "sindresorhus/locate-path", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "locate", - "path", - "paths", - "file", - "files", - "exists", - "find", - "finder", - "search", - "searcher", - "array", - "iterable", - "iterator" - ], - "dependencies": { - "p-locate": "^4.1.0" - }, - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/readme.md b/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/readme.md deleted file mode 100644 index 2184c6f30..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path/readme.md +++ /dev/null @@ -1,122 +0,0 @@ -# locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path) - -> Get the first path that exists on disk of multiple paths - - -## Install - -``` -$ npm install locate-path -``` - - -## Usage - -Here we find the first file that exists on disk, in array order. - -```js -const locatePath = require('locate-path'); - -const files = [ - 'unicorn.png', - 'rainbow.png', // Only this one actually exists on disk - 'pony.png' -]; - -(async () => { - console(await locatePath(files)); - //=> 'rainbow' -})(); -``` - - -## API - -### locatePath(paths, [options]) - -Returns a `Promise` for the first path that exists or `undefined` if none exists. - -#### paths - -Type: `Iterable` - -Paths to check. - -#### options - -Type: `Object` - -##### concurrency - -Type: `number`
-Default: `Infinity`
-Minimum: `1` - -Number of concurrently pending promises. - -##### preserveOrder - -Type: `boolean`
-Default: `true` - -Preserve `paths` order when searching. - -Disable this to improve performance if you don't care about the order. - -##### cwd - -Type: `string`
-Default: `process.cwd()` - -Current working directory. - -##### type - -Type: `string`
-Default: `file`
-Values: `file` `directory` - -The type of paths that can match. - -##### allowSymlinks - -Type: `boolean`
-Default: `true` - -Allow symbolic links to match if they point to the chosen path type. - -### locatePath.sync(paths, [options]) - -Returns the first path that exists or `undefined` if none exists. - -#### paths - -Type: `Iterable` - -Paths to check. - -#### options - -Type: `Object` - -##### cwd - -Same as above. - -##### type - -Same as above. - -##### allowSymlinks - -Same as above. - - -## Related - -- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/index.d.ts b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/index.d.ts deleted file mode 100644 index 6bbfad4ac..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -export interface Limit { - /** - @param fn - Promise-returning/async function. - @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. - @returns The promise returned by calling `fn(...arguments)`. - */ - ( - fn: (...arguments: Arguments) => PromiseLike | ReturnType, - ...arguments: Arguments - ): Promise; - - /** - The number of promises that are currently running. - */ - readonly activeCount: number; - - /** - The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - */ - readonly pendingCount: number; - - /** - Discard pending promises that are waiting to run. - - This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. - - Note: This does not cancel promises that are already running. - */ - clearQueue(): void; -} - -/** -Run multiple promise-returning & async functions with limited concurrency. - -@param concurrency - Concurrency limit. Minimum: `1`. -@returns A `limit` function. -*/ -export default function pLimit(concurrency: number): Limit; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/index.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/index.js deleted file mode 100644 index 6a72a4c4f..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/index.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; -const pTry = require('p-try'); - -const pLimit = concurrency => { - if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) { - return Promise.reject(new TypeError('Expected `concurrency` to be a number from 1 and up')); - } - - const queue = []; - let activeCount = 0; - - const next = () => { - activeCount--; - - if (queue.length > 0) { - queue.shift()(); - } - }; - - const run = (fn, resolve, ...args) => { - activeCount++; - - const result = pTry(fn, ...args); - - resolve(result); - - result.then(next, next); - }; - - const enqueue = (fn, resolve, ...args) => { - if (activeCount < concurrency) { - run(fn, resolve, ...args); - } else { - queue.push(run.bind(null, fn, resolve, ...args)); - } - }; - - const generator = (fn, ...args) => new Promise(resolve => enqueue(fn, resolve, ...args)); - Object.defineProperties(generator, { - activeCount: { - get: () => activeCount - }, - pendingCount: { - get: () => queue.length - }, - clearQueue: { - value: () => { - queue.length = 0; - } - } - }); - - return generator; -}; - -module.exports = pLimit; -module.exports.default = pLimit; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/license b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -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/@istanbuljs/load-nyc-config/node_modules/p-limit/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/package.json deleted file mode 100644 index 99a814f6e..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "p-limit", - "version": "2.3.0", - "description": "Run multiple promise-returning & async functions with limited concurrency", - "license": "MIT", - "repository": "sindresorhus/p-limit", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava && tsd-check" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "promise", - "limit", - "limited", - "concurrency", - "throttle", - "throat", - "rate", - "batch", - "ratelimit", - "task", - "queue", - "async", - "await", - "promises", - "bluebird" - ], - "dependencies": { - "p-try": "^2.0.0" - }, - "devDependencies": { - "ava": "^1.2.1", - "delay": "^4.1.0", - "in-range": "^1.0.0", - "random-int": "^1.0.0", - "time-span": "^2.0.0", - "tsd-check": "^0.3.0", - "xo": "^0.24.0" - } -} diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/readme.md b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/readme.md deleted file mode 100644 index 64aa476e2..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit/readme.md +++ /dev/null @@ -1,101 +0,0 @@ -# p-limit [![Build Status](https://travis-ci.org/sindresorhus/p-limit.svg?branch=master)](https://travis-ci.org/sindresorhus/p-limit) - -> Run multiple promise-returning & async functions with limited concurrency - -## Install - -``` -$ npm install p-limit -``` - -## Usage - -```js -const pLimit = require('p-limit'); - -const limit = pLimit(1); - -const input = [ - limit(() => fetchSomething('foo')), - limit(() => fetchSomething('bar')), - limit(() => doSomething()) -]; - -(async () => { - // Only one promise is run at once - const result = await Promise.all(input); - console.log(result); -})(); -``` - -## API - -### pLimit(concurrency) - -Returns a `limit` function. - -#### concurrency - -Type: `number`\ -Minimum: `1`\ -Default: `Infinity` - -Concurrency limit. - -### limit(fn, ...args) - -Returns the promise returned by calling `fn(...args)`. - -#### fn - -Type: `Function` - -Promise-returning/async function. - -#### args - -Any arguments to pass through to `fn`. - -Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions. - -### limit.activeCount - -The number of promises that are currently running. - -### limit.pendingCount - -The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - -### limit.clearQueue() - -Discard pending promises that are waiting to run. - -This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. - -Note: This does not cancel promises that are already running. - -## FAQ - -### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package? - -This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue. - -## Related - -- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control -- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions -- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions -- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency -- [More…](https://github.com/sindresorhus/promise-fun) - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/index.d.ts b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/index.d.ts deleted file mode 100644 index 14115e16b..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/index.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -declare namespace pLocate { - interface Options { - /** - Number of concurrently pending promises returned by `tester`. Minimum: `1`. - - @default Infinity - */ - readonly concurrency?: number; - - /** - Preserve `input` order when searching. - - Disable this to improve performance if you don't care about the order. - - @default true - */ - readonly preserveOrder?: boolean; - } -} - -declare const pLocate: { - /** - Get the first fulfilled promise that satisfies the provided testing function. - - @param input - An iterable of promises/values to test. - @param tester - This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. - @returns A `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. - - @example - ``` - import pathExists = require('path-exists'); - import pLocate = require('p-locate'); - - const files = [ - 'unicorn.png', - 'rainbow.png', // Only this one actually exists on disk - 'pony.png' - ]; - - (async () => { - const foundPath = await pLocate(files, file => pathExists(file)); - - console.log(foundPath); - //=> 'rainbow' - })(); - ``` - */ - ( - input: Iterable | ValueType>, - tester: (element: ValueType) => PromiseLike | boolean, - options?: pLocate.Options - ): Promise; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function pLocate( - // input: Iterable | ValueType>, - // tester: (element: ValueType) => PromiseLike | boolean, - // options?: pLocate.Options - // ): Promise; - // export = pLocate; - default: typeof pLocate; -}; - -export = pLocate; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/index.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/index.js deleted file mode 100644 index e13ce1531..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/index.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; -const pLimit = require('p-limit'); - -class EndError extends Error { - constructor(value) { - super(); - this.value = value; - } -} - -// The input can also be a promise, so we await it -const testElement = async (element, tester) => tester(await element); - -// The input can also be a promise, so we `Promise.all()` them both -const finder = async element => { - const values = await Promise.all(element); - if (values[1] === true) { - throw new EndError(values[0]); - } - - return false; -}; - -const pLocate = async (iterable, tester, options) => { - options = { - concurrency: Infinity, - preserveOrder: true, - ...options - }; - - const limit = pLimit(options.concurrency); - - // Start all the promises concurrently with optional limit - const items = [...iterable].map(element => [element, limit(testElement, element, tester)]); - - // Check the promises either serially or concurrently - const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity); - - try { - await Promise.all(items.map(element => checkLimit(finder, element))); - } catch (error) { - if (error instanceof EndError) { - return error.value; - } - - throw error; - } -}; - -module.exports = pLocate; -// TODO: Remove this for the next major release -module.exports.default = pLocate; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/license b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -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/@istanbuljs/load-nyc-config/node_modules/p-locate/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/package.json deleted file mode 100644 index e3de27562..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "p-locate", - "version": "4.1.0", - "description": "Get the first fulfilled promise that satisfies the provided testing function", - "license": "MIT", - "repository": "sindresorhus/p-locate", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "promise", - "locate", - "find", - "finder", - "search", - "searcher", - "test", - "array", - "collection", - "iterable", - "iterator", - "race", - "fulfilled", - "fastest", - "async", - "await", - "promises", - "bluebird" - ], - "dependencies": { - "p-limit": "^2.2.0" - }, - "devDependencies": { - "ava": "^1.4.1", - "delay": "^4.1.0", - "in-range": "^1.0.0", - "time-span": "^3.0.0", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/readme.md b/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/readme.md deleted file mode 100644 index f8e2c2eaf..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate/readme.md +++ /dev/null @@ -1,90 +0,0 @@ -# p-locate [![Build Status](https://travis-ci.org/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.org/sindresorhus/p-locate) - -> Get the first fulfilled promise that satisfies the provided testing function - -Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find). - - -## Install - -``` -$ npm install p-locate -``` - - -## Usage - -Here we find the first file that exists on disk, in array order. - -```js -const pathExists = require('path-exists'); -const pLocate = require('p-locate'); - -const files = [ - 'unicorn.png', - 'rainbow.png', // Only this one actually exists on disk - 'pony.png' -]; - -(async () => { - const foundPath = await pLocate(files, file => pathExists(file)); - - console.log(foundPath); - //=> 'rainbow' -})(); -``` - -*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.* - - -## API - -### pLocate(input, tester, [options]) - -Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. - -#### input - -Type: `Iterable` - -An iterable of promises/values to test. - -#### tester(element) - -Type: `Function` - -This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. - -#### options - -Type: `Object` - -##### concurrency - -Type: `number`
-Default: `Infinity`
-Minimum: `1` - -Number of concurrently pending promises returned by `tester`. - -##### preserveOrder - -Type: `boolean`
-Default: `true` - -Preserve `input` order when searching. - -Disable this to improve performance if you don't care about the order. - - -## Related - -- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently -- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently -- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled -- [More…](https://github.com/sindresorhus/promise-fun) - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/index.d.ts b/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/index.d.ts deleted file mode 100644 index dd5f5ef61..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -declare const resolveFrom: { - /** - Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path. - - @param fromDirectory - Directory to resolve from. - @param moduleId - What you would use in `require()`. - @returns Resolved module path. Throws when the module can't be found. - - @example - ``` - import resolveFrom = require('resolve-from'); - - // There is a file at `./foo/bar.js` - - resolveFrom('foo', './bar'); - //=> '/Users/sindresorhus/dev/test/foo/bar.js' - ``` - */ - (fromDirectory: string, moduleId: string): string; - - /** - Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path. - - @param fromDirectory - Directory to resolve from. - @param moduleId - What you would use in `require()`. - @returns Resolved module path or `undefined` when the module can't be found. - */ - silent(fromDirectory: string, moduleId: string): string | undefined; -}; - -export = resolveFrom; diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/index.js b/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/index.js deleted file mode 100644 index 44f291c1f..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; -const path = require('path'); -const Module = require('module'); -const fs = require('fs'); - -const resolveFrom = (fromDirectory, moduleId, silent) => { - if (typeof fromDirectory !== 'string') { - throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``); - } - - if (typeof moduleId !== 'string') { - throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); - } - - try { - fromDirectory = fs.realpathSync(fromDirectory); - } catch (error) { - if (error.code === 'ENOENT') { - fromDirectory = path.resolve(fromDirectory); - } else if (silent) { - return; - } else { - throw error; - } - } - - const fromFile = path.join(fromDirectory, 'noop.js'); - - const resolveFileName = () => Module._resolveFilename(moduleId, { - id: fromFile, - filename: fromFile, - paths: Module._nodeModulePaths(fromDirectory) - }); - - if (silent) { - try { - return resolveFileName(); - } catch (error) { - return; - } - } - - return resolveFileName(); -}; - -module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId); -module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true); diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/license b/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -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/@istanbuljs/load-nyc-config/node_modules/resolve-from/package.json b/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/package.json deleted file mode 100644 index 733df1627..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "resolve-from", - "version": "5.0.0", - "description": "Resolve the path of a module like `require.resolve()` but from a given path", - "license": "MIT", - "repository": "sindresorhus/resolve-from", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "require", - "resolve", - "path", - "module", - "from", - "like", - "import" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/readme.md b/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/readme.md deleted file mode 100644 index fd4f46f94..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from/readme.md +++ /dev/null @@ -1,72 +0,0 @@ -# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) - -> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path - - -## Install - -``` -$ npm install resolve-from -``` - - -## Usage - -```js -const resolveFrom = require('resolve-from'); - -// There is a file at `./foo/bar.js` - -resolveFrom('foo', './bar'); -//=> '/Users/sindresorhus/dev/test/foo/bar.js' -``` - - -## API - -### resolveFrom(fromDirectory, moduleId) - -Like `require()`, throws when the module can't be found. - -### resolveFrom.silent(fromDirectory, moduleId) - -Returns `undefined` instead of throwing when the module can't be found. - -#### fromDirectory - -Type: `string` - -Directory to resolve from. - -#### moduleId - -Type: `string` - -What you would use in `require()`. - - -## Tip - -Create a partial using a bound function if you want to resolve from the same `fromDirectory` multiple times: - -```js -const resolveFromFoo = resolveFrom.bind(null, 'foo'); - -resolveFromFoo('./bar'); -resolveFromFoo('./baz'); -``` - - -## Related - -- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory -- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path -- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory -- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point -- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily -- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/@istanbuljs/load-nyc-config/package.json b/node_modules/@istanbuljs/load-nyc-config/package.json deleted file mode 100644 index 53207ef34..000000000 --- a/node_modules/@istanbuljs/load-nyc-config/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "@istanbuljs/load-nyc-config", - "version": "1.1.0", - "description": "Utility function to load nyc configuration", - "main": "index.js", - "scripts": { - "pretest": "xo", - "test": "tap", - "snap": "npm test -- --snapshot", - "release": "standard-version" - }, - "engines": { - "node": ">=8" - }, - "license": "ISC", - "repository": { - "type": "git", - "url": "git+https://github.com/istanbuljs/load-nyc-config.git" - }, - "bugs": { - "url": "https://github.com/istanbuljs/load-nyc-config/issues" - }, - "homepage": "https://github.com/istanbuljs/load-nyc-config#readme", - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "devDependencies": { - "semver": "^6.3.0", - "standard-version": "^7.0.0", - "tap": "^14.10.5", - "xo": "^0.25.3" - }, - "xo": { - "ignores": [ - "test/fixtures/extends/invalid.*" - ], - "rules": { - "require-atomic-updates": 0, - "capitalized-comments": 0, - "unicorn/import-index": 0, - "import/extensions": 0, - "import/no-useless-path-segments": 0 - } - } -} diff --git a/node_modules/@istanbuljs/schema/CHANGELOG.md b/node_modules/@istanbuljs/schema/CHANGELOG.md deleted file mode 100644 index afdc8350f..000000000 --- a/node_modules/@istanbuljs/schema/CHANGELOG.md +++ /dev/null @@ -1,44 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -### [0.1.3](https://github.com/istanbuljs/schema/compare/v0.1.2...v0.1.3) (2021-02-13) - - -### Features - -* Add `classPrivateMethods` and `topLevelAwait` default support ([#17](https://github.com/istanbuljs/schema/issues/17)) ([e732889](https://github.com/istanbuljs/schema/commit/e7328894ddeb61da256c1f13c2c2cc2e04f181df)), closes [#16](https://github.com/istanbuljs/schema/issues/16) -* Add `numericSeparator` to default `parserPlugins` ([#12](https://github.com/istanbuljs/schema/issues/12)) ([fe32f00](https://github.com/istanbuljs/schema/commit/fe32f002f54c61467b1c1a487081f51c85ec8d10)), closes [#5](https://github.com/istanbuljs/schema/issues/5) -* Add babel.config.mjs to default exclude ([#10](https://github.com/istanbuljs/schema/issues/10)) ([a4dbeaa](https://github.com/istanbuljs/schema/commit/a4dbeaa7045490a4d46754801ac71f5d99c9bd79)) - - -### Bug Fixes - -* Exclude tests with `tsx` or `jsx` extensions ([#13](https://github.com/istanbuljs/schema/issues/13)) ([c7747f7](https://github.com/istanbuljs/schema/commit/c7747f7a7df8a2b770036834af77dfd0ee445733)), closes [#11](https://github.com/istanbuljs/schema/issues/11) - -### [0.1.2](https://github.com/istanbuljs/schema/compare/v0.1.1...v0.1.2) (2019-12-05) - - -### Features - -* Ignore *.d.ts ([#6](https://github.com/istanbuljs/schema/issues/6)) ([d867eaf](https://github.com/istanbuljs/schema/commit/d867eaff6ca4abcd4301990e2bdcdf53e438e9c4)) -* Update default exclude of dev tool configurations ([#7](https://github.com/istanbuljs/schema/issues/7)) ([c89f818](https://github.com/istanbuljs/schema/commit/c89f8185f30879bcdf8d2f1c3b7aba0ac7056fa9)) - -## [0.1.1](https://github.com/istanbuljs/schema/compare/v0.1.0...v0.1.1) (2019-10-07) - - -### Bug Fixes - -* Add missing `instrument` option ([#3](https://github.com/istanbuljs/schema/issues/3)) ([bf1217d](https://github.com/istanbuljs/schema/commit/bf1217d)) - - -### Features - -* Add `use-spawn-wrap` nyc option ([#4](https://github.com/istanbuljs/schema/issues/4)) ([b2ce2e8](https://github.com/istanbuljs/schema/commit/b2ce2e8)) - -## 0.1.0 (2019-10-05) - - -### Features - -* Initial implementation ([99bd3a5](https://github.com/istanbuljs/schema/commit/99bd3a5)) diff --git a/node_modules/@istanbuljs/schema/LICENSE b/node_modules/@istanbuljs/schema/LICENSE deleted file mode 100644 index 807a18bdb..000000000 --- a/node_modules/@istanbuljs/schema/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 CFWare, LLC - -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/@istanbuljs/schema/README.md b/node_modules/@istanbuljs/schema/README.md deleted file mode 100644 index 9cac02882..000000000 --- a/node_modules/@istanbuljs/schema/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# @istanbuljs/schema - -[![Travis CI][travis-image]][travis-url] -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![MIT][license-image]](LICENSE) - -Schemas describing various structures used by nyc and istanbuljs - -## Usage - -```js -const {nyc} = require('@istanbuljs/schema').defaults; - -console.log(`Default exclude list:\n\t* ${nyc.exclude.join('\n\t* ')}`); -``` - -## `@istanbuljs/schema` for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of `@istanbuljs/schema` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-istanbuljs-schema?utm_source=npm-istanbuljs-schema&utm_medium=referral&utm_campaign=enterprise) - -[npm-image]: https://img.shields.io/npm/v/@istanbuljs/schema.svg -[npm-url]: https://npmjs.org/package/@istanbuljs/schema -[travis-image]: https://travis-ci.org/istanbuljs/schema.svg?branch=master -[travis-url]: https://travis-ci.org/istanbuljs/schema -[downloads-image]: https://img.shields.io/npm/dm/@istanbuljs/schema.svg -[downloads-url]: https://npmjs.org/package/@istanbuljs/schema -[license-image]: https://img.shields.io/npm/l/@istanbuljs/schema.svg diff --git a/node_modules/@istanbuljs/schema/default-exclude.js b/node_modules/@istanbuljs/schema/default-exclude.js deleted file mode 100644 index c6bb52644..000000000 --- a/node_modules/@istanbuljs/schema/default-exclude.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -const defaultExtension = require('./default-extension.js'); -const testFileExtensions = defaultExtension - .map(extension => extension.slice(1)) - .join(','); - -module.exports = [ - 'coverage/**', - 'packages/*/test{,s}/**', - '**/*.d.ts', - 'test{,s}/**', - `test{,-*}.{${testFileExtensions}}`, - `**/*{.,-}test.{${testFileExtensions}}`, - '**/__tests__/**', - - /* Exclude common development tool configuration files */ - '**/{ava,babel,nyc}.config.{js,cjs,mjs}', - '**/jest.config.{js,cjs,mjs,ts}', - '**/{karma,rollup,webpack}.config.js', - '**/.{eslint,mocha}rc.{js,cjs}' -]; diff --git a/node_modules/@istanbuljs/schema/default-extension.js b/node_modules/@istanbuljs/schema/default-extension.js deleted file mode 100644 index 46ebadca5..000000000 --- a/node_modules/@istanbuljs/schema/default-extension.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = [ - '.js', - '.cjs', - '.mjs', - '.ts', - '.tsx', - '.jsx' -]; diff --git a/node_modules/@istanbuljs/schema/index.js b/node_modules/@istanbuljs/schema/index.js deleted file mode 100644 index b35f6101a..000000000 --- a/node_modules/@istanbuljs/schema/index.js +++ /dev/null @@ -1,466 +0,0 @@ -'use strict'; - -const defaultExclude = require('./default-exclude.js'); -const defaultExtension = require('./default-extension.js'); - -const nycCommands = { - all: [null, 'check-coverage', 'instrument', 'merge', 'report'], - testExclude: [null, 'instrument', 'report', 'check-coverage'], - instrument: [null, 'instrument'], - checkCoverage: [null, 'report', 'check-coverage'], - report: [null, 'report'], - main: [null], - instrumentOnly: ['instrument'] -}; - -const cwd = { - description: 'working directory used when resolving paths', - type: 'string', - get default() { - return process.cwd(); - }, - nycCommands: nycCommands.all -}; - -const nycrcPath = { - description: 'specify an explicit path to find nyc configuration', - nycCommands: nycCommands.all -}; - -const tempDir = { - description: 'directory to output raw coverage information to', - type: 'string', - default: './.nyc_output', - nycAlias: 't', - nycHiddenAlias: 'temp-directory', - nycCommands: [null, 'check-coverage', 'merge', 'report'] -}; - -const testExclude = { - exclude: { - description: 'a list of specific files and directories that should be excluded from coverage, glob patterns are supported', - type: 'array', - items: { - type: 'string' - }, - default: defaultExclude, - nycCommands: nycCommands.testExclude, - nycAlias: 'x' - }, - excludeNodeModules: { - description: 'whether or not to exclude all node_module folders (i.e. **/node_modules/**) by default', - type: 'boolean', - default: true, - nycCommands: nycCommands.testExclude - }, - include: { - description: 'a list of specific files that should be covered, glob patterns are supported', - type: 'array', - items: { - type: 'string' - }, - default: [], - nycCommands: nycCommands.testExclude, - nycAlias: 'n' - }, - extension: { - description: 'a list of extensions that nyc should handle in addition to .js', - type: 'array', - items: { - type: 'string' - }, - default: defaultExtension, - nycCommands: nycCommands.testExclude, - nycAlias: 'e' - } -}; - -const instrumentVisitor = { - coverageVariable: { - description: 'variable to store coverage', - type: 'string', - default: '__coverage__', - nycCommands: nycCommands.instrument - }, - coverageGlobalScope: { - description: 'scope to store the coverage variable', - type: 'string', - default: 'this', - nycCommands: nycCommands.instrument - }, - coverageGlobalScopeFunc: { - description: 'avoid potentially replaced `Function` when finding global scope', - type: 'boolean', - default: true, - nycCommands: nycCommands.instrument - }, - ignoreClassMethods: { - description: 'class method names to ignore for coverage', - type: 'array', - items: { - type: 'string' - }, - default: [], - nycCommands: nycCommands.instrument - } -}; - -const instrumentParseGen = { - autoWrap: { - description: 'allow `return` statements outside of functions', - type: 'boolean', - default: true, - nycCommands: nycCommands.instrument - }, - esModules: { - description: 'should files be treated as ES Modules', - type: 'boolean', - default: true, - nycCommands: nycCommands.instrument - }, - parserPlugins: { - description: 'babel parser plugins to use when parsing the source', - type: 'array', - items: { - type: 'string' - }, - /* Babel parser plugins are to be enabled when the feature is stage 3 and - * implemented in a released version of node.js. */ - default: [ - 'asyncGenerators', - 'bigInt', - 'classProperties', - 'classPrivateProperties', - 'classPrivateMethods', - 'dynamicImport', - 'importMeta', - 'numericSeparator', - 'objectRestSpread', - 'optionalCatchBinding', - 'topLevelAwait' - ], - nycCommands: nycCommands.instrument - }, - compact: { - description: 'should the output be compacted?', - type: 'boolean', - default: true, - nycCommands: nycCommands.instrument - }, - preserveComments: { - description: 'should comments be preserved in the output?', - type: 'boolean', - default: true, - nycCommands: nycCommands.instrument - }, - produceSourceMap: { - description: 'should source maps be produced?', - type: 'boolean', - default: true, - nycCommands: nycCommands.instrument - } -}; - -const checkCoverage = { - excludeAfterRemap: { - description: 'should exclude logic be performed after the source-map remaps filenames?', - type: 'boolean', - default: true, - nycCommands: nycCommands.checkCoverage - }, - branches: { - description: 'what % of branches must be covered?', - type: 'number', - default: 0, - minimum: 0, - maximum: 100, - nycCommands: nycCommands.checkCoverage - }, - functions: { - description: 'what % of functions must be covered?', - type: 'number', - default: 0, - minimum: 0, - maximum: 100, - nycCommands: nycCommands.checkCoverage - }, - lines: { - description: 'what % of lines must be covered?', - type: 'number', - default: 90, - minimum: 0, - maximum: 100, - nycCommands: nycCommands.checkCoverage - }, - statements: { - description: 'what % of statements must be covered?', - type: 'number', - default: 0, - minimum: 0, - maximum: 100, - nycCommands: nycCommands.checkCoverage - }, - perFile: { - description: 'check thresholds per file', - type: 'boolean', - default: false, - nycCommands: nycCommands.checkCoverage - } -}; - -const report = { - checkCoverage: { - description: 'check whether coverage is within thresholds provided', - type: 'boolean', - default: false, - nycCommands: nycCommands.report - }, - reporter: { - description: 'coverage reporter(s) to use', - type: 'array', - items: { - type: 'string' - }, - default: ['text'], - nycCommands: nycCommands.report, - nycAlias: 'r' - }, - reportDir: { - description: 'directory to output coverage reports in', - type: 'string', - default: 'coverage', - nycCommands: nycCommands.report - }, - showProcessTree: { - description: 'display the tree of spawned processes', - type: 'boolean', - default: false, - nycCommands: nycCommands.report - }, - skipEmpty: { - description: 'don\'t show empty files (no lines of code) in report', - type: 'boolean', - default: false, - nycCommands: nycCommands.report - }, - skipFull: { - description: 'don\'t show files with 100% statement, branch, and function coverage', - type: 'boolean', - default: false, - nycCommands: nycCommands.report - } -}; - -const nycMain = { - silent: { - description: 'don\'t output a report after tests finish running', - type: 'boolean', - default: false, - nycCommands: nycCommands.main, - nycAlias: 's' - }, - all: { - description: 'whether or not to instrument all files of the project (not just the ones touched by your test suite)', - type: 'boolean', - default: false, - nycCommands: nycCommands.main, - nycAlias: 'a' - }, - eager: { - description: 'instantiate the instrumenter at startup (see https://git.io/vMKZ9)', - type: 'boolean', - default: false, - nycCommands: nycCommands.main - }, - cache: { - description: 'cache instrumentation results for improved performance', - type: 'boolean', - default: true, - nycCommands: nycCommands.main, - nycAlias: 'c' - }, - cacheDir: { - description: 'explicitly set location for instrumentation cache', - type: 'string', - nycCommands: nycCommands.main - }, - babelCache: { - description: 'cache babel transpilation results for improved performance', - type: 'boolean', - default: false, - nycCommands: nycCommands.main - }, - useSpawnWrap: { - description: 'use spawn-wrap instead of setting process.env.NODE_OPTIONS', - type: 'boolean', - default: false, - nycCommands: nycCommands.main - }, - hookRequire: { - description: 'should nyc wrap require?', - type: 'boolean', - default: true, - nycCommands: nycCommands.main - }, - hookRunInContext: { - description: 'should nyc wrap vm.runInContext?', - type: 'boolean', - default: false, - nycCommands: nycCommands.main - }, - hookRunInThisContext: { - description: 'should nyc wrap vm.runInThisContext?', - type: 'boolean', - default: false, - nycCommands: nycCommands.main - }, - clean: { - description: 'should the .nyc_output folder be cleaned before executing tests', - type: 'boolean', - default: true, - nycCommands: nycCommands.main - } -}; - -const instrumentOnly = { - inPlace: { - description: 'should nyc run the instrumentation in place?', - type: 'boolean', - default: false, - nycCommands: nycCommands.instrumentOnly - }, - exitOnError: { - description: 'should nyc exit when an instrumentation failure occurs?', - type: 'boolean', - default: false, - nycCommands: nycCommands.instrumentOnly - }, - delete: { - description: 'should the output folder be deleted before instrumenting files?', - type: 'boolean', - default: false, - nycCommands: nycCommands.instrumentOnly - }, - completeCopy: { - description: 'should nyc copy all files from input to output as well as instrumented files?', - type: 'boolean', - default: false, - nycCommands: nycCommands.instrumentOnly - } -}; - -const nyc = { - description: 'nyc configuration options', - type: 'object', - properties: { - cwd, - nycrcPath, - tempDir, - - /* Test Exclude */ - ...testExclude, - - /* Instrumentation settings */ - ...instrumentVisitor, - - /* Instrumentation parser/generator settings */ - ...instrumentParseGen, - sourceMap: { - description: 'should nyc detect and handle source maps?', - type: 'boolean', - default: true, - nycCommands: nycCommands.instrument - }, - require: { - description: 'a list of additional modules that nyc should attempt to require in its subprocess, e.g., @babel/register, @babel/polyfill', - type: 'array', - items: { - type: 'string' - }, - default: [], - nycCommands: nycCommands.instrument, - nycAlias: 'i' - }, - instrument: { - description: 'should nyc handle instrumentation?', - type: 'boolean', - default: true, - nycCommands: nycCommands.instrument - }, - - /* Check coverage */ - ...checkCoverage, - - /* Report options */ - ...report, - - /* Main command options */ - ...nycMain, - - /* Instrument command options */ - ...instrumentOnly - } -}; - -const configs = { - nyc, - testExclude: { - description: 'test-exclude options', - type: 'object', - properties: { - cwd, - ...testExclude - } - }, - babelPluginIstanbul: { - description: 'babel-plugin-istanbul options', - type: 'object', - properties: { - cwd, - ...testExclude, - ...instrumentVisitor - } - }, - instrumentVisitor: { - description: 'instrument visitor options', - type: 'object', - properties: instrumentVisitor - }, - instrumenter: { - description: 'stand-alone instrumenter options', - type: 'object', - properties: { - ...instrumentVisitor, - ...instrumentParseGen - } - } -}; - -function defaultsReducer(defaults, [name, {default: value}]) { - /* Modifying arrays in defaults is safe, does not change schema. */ - if (Array.isArray(value)) { - value = [...value]; - } - - return Object.assign(defaults, {[name]: value}); -} - -module.exports = { - ...configs, - defaults: Object.keys(configs).reduce( - (defaults, id) => { - Object.defineProperty(defaults, id, { - enumerable: true, - get() { - /* This defers `process.cwd()` until defaults are requested. */ - return Object.entries(configs[id].properties) - .filter(([, info]) => 'default' in info) - .reduce(defaultsReducer, {}); - } - }); - - return defaults; - }, - {} - ) -}; diff --git a/node_modules/@istanbuljs/schema/package.json b/node_modules/@istanbuljs/schema/package.json deleted file mode 100644 index 1d22cde96..000000000 --- a/node_modules/@istanbuljs/schema/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@istanbuljs/schema", - "version": "0.1.3", - "description": "Schemas describing various structures used by nyc and istanbuljs", - "main": "index.js", - "scripts": { - "release": "standard-version --sign", - "pretest": "xo", - "test": "tap", - "snap": "npm test -- --snapshot" - }, - "engines": { - "node": ">=8" - }, - "author": "Corey Farrell", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/istanbuljs/schema.git" - }, - "bugs": { - "url": "https://github.com/istanbuljs/schema/issues" - }, - "homepage": "https://github.com/istanbuljs/schema#readme", - "devDependencies": { - "standard-version": "^7.0.0", - "tap": "^14.6.7", - "xo": "^0.25.3" - } -} diff --git a/node_modules/@jest/console/LICENSE b/node_modules/@jest/console/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/console/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/console/build/BufferedConsole.js b/node_modules/@jest/console/build/BufferedConsole.js deleted file mode 100644 index 0cb9a0549..000000000 --- a/node_modules/@jest/console/build/BufferedConsole.js +++ /dev/null @@ -1,202 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _assert() { - const data = require('assert'); - _assert = function () { - return data; - }; - return data; -} -function _console() { - const data = require('console'); - _console = function () { - return data; - }; - return data; -} -function _util() { - const data = require('util'); - _util = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class BufferedConsole extends _console().Console { - _buffer = []; - _counters = {}; - _timers = {}; - _groupDepth = 0; - Console = _console().Console; - constructor() { - super({ - write: message => { - BufferedConsole.write(this._buffer, 'log', message, null); - return true; - } - }); - } - static write(buffer, type, message, level) { - const stackLevel = level != null ? level : 2; - const rawStack = new (_jestUtil().ErrorWithStack)( - undefined, - BufferedConsole.write - ).stack; - invariant(rawStack != null, 'always have a stack trace'); - const origin = rawStack - .split('\n') - .slice(stackLevel) - .filter(Boolean) - .join('\n'); - buffer.push({ - message, - origin, - type - }); - return buffer; - } - _log(type, message) { - BufferedConsole.write( - this._buffer, - type, - ' '.repeat(this._groupDepth) + message, - 3 - ); - } - assert(value, message) { - try { - (0, _assert().strict)(value, message); - } catch (error) { - if (!(error instanceof _assert().AssertionError)) { - throw error; - } - // https://github.com/facebook/jest/pull/13422#issuecomment-1273396392 - this._log('assert', error.toString().replace(/:\n\n.*\n/gs, '')); - } - } - count(label = 'default') { - if (!this._counters[label]) { - this._counters[label] = 0; - } - this._log( - 'count', - (0, _util().format)(`${label}: ${++this._counters[label]}`) - ); - } - countReset(label = 'default') { - this._counters[label] = 0; - } - debug(firstArg, ...rest) { - this._log('debug', (0, _util().format)(firstArg, ...rest)); - } - dir(firstArg, options = {}) { - const representation = (0, _util().inspect)(firstArg, options); - this._log('dir', (0, _util().formatWithOptions)(options, representation)); - } - dirxml(firstArg, ...rest) { - this._log('dirxml', (0, _util().format)(firstArg, ...rest)); - } - error(firstArg, ...rest) { - this._log('error', (0, _util().format)(firstArg, ...rest)); - } - group(title, ...rest) { - this._groupDepth++; - if (title != null || rest.length > 0) { - this._log( - 'group', - _chalk().default.bold((0, _util().format)(title, ...rest)) - ); - } - } - groupCollapsed(title, ...rest) { - this._groupDepth++; - if (title != null || rest.length > 0) { - this._log( - 'groupCollapsed', - _chalk().default.bold((0, _util().format)(title, ...rest)) - ); - } - } - groupEnd() { - if (this._groupDepth > 0) { - this._groupDepth--; - } - } - info(firstArg, ...rest) { - this._log('info', (0, _util().format)(firstArg, ...rest)); - } - log(firstArg, ...rest) { - this._log('log', (0, _util().format)(firstArg, ...rest)); - } - time(label = 'default') { - if (this._timers[label] != null) { - return; - } - this._timers[label] = new Date(); - } - timeEnd(label = 'default') { - const startTime = this._timers[label]; - if (startTime != null) { - const endTime = new Date(); - const time = endTime.getTime() - startTime.getTime(); - this._log( - 'time', - (0, _util().format)(`${label}: ${(0, _jestUtil().formatTime)(time)}`) - ); - delete this._timers[label]; - } - } - timeLog(label = 'default', ...data) { - const startTime = this._timers[label]; - if (startTime != null) { - const endTime = new Date(); - const time = endTime.getTime() - startTime.getTime(); - this._log( - 'time', - (0, _util().format)( - `${label}: ${(0, _jestUtil().formatTime)(time)}`, - ...data - ) - ); - } - } - warn(firstArg, ...rest) { - this._log('warn', (0, _util().format)(firstArg, ...rest)); - } - getBuffer() { - return this._buffer.length ? this._buffer : undefined; - } -} -exports.default = BufferedConsole; -function invariant(condition, message) { - if (!condition) { - throw new Error(message); - } -} diff --git a/node_modules/@jest/console/build/CustomConsole.js b/node_modules/@jest/console/build/CustomConsole.js deleted file mode 100644 index e309be228..000000000 --- a/node_modules/@jest/console/build/CustomConsole.js +++ /dev/null @@ -1,182 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _assert() { - const data = require('assert'); - _assert = function () { - return data; - }; - return data; -} -function _console() { - const data = require('console'); - _console = function () { - return data; - }; - return data; -} -function _util() { - const data = require('util'); - _util = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class CustomConsole extends _console().Console { - _stdout; - _stderr; - _formatBuffer; - _counters = {}; - _timers = {}; - _groupDepth = 0; - Console = _console().Console; - constructor(stdout, stderr, formatBuffer = (_type, message) => message) { - super(stdout, stderr); - this._stdout = stdout; - this._stderr = stderr; - this._formatBuffer = formatBuffer; - } - _log(type, message) { - (0, _jestUtil().clearLine)(this._stdout); - super.log( - this._formatBuffer(type, ' '.repeat(this._groupDepth) + message) - ); - } - _logError(type, message) { - (0, _jestUtil().clearLine)(this._stderr); - super.error( - this._formatBuffer(type, ' '.repeat(this._groupDepth) + message) - ); - } - assert(value, message) { - try { - (0, _assert().strict)(value, message); - } catch (error) { - if (!(error instanceof _assert().AssertionError)) { - throw error; - } - // https://github.com/facebook/jest/pull/13422#issuecomment-1273396392 - this._logError('assert', error.toString().replace(/:\n\n.*\n/gs, '')); - } - } - count(label = 'default') { - if (!this._counters[label]) { - this._counters[label] = 0; - } - this._log( - 'count', - (0, _util().format)(`${label}: ${++this._counters[label]}`) - ); - } - countReset(label = 'default') { - this._counters[label] = 0; - } - debug(firstArg, ...args) { - this._log('debug', (0, _util().format)(firstArg, ...args)); - } - dir(firstArg, options = {}) { - const representation = (0, _util().inspect)(firstArg, options); - this._log('dir', (0, _util().formatWithOptions)(options, representation)); - } - dirxml(firstArg, ...args) { - this._log('dirxml', (0, _util().format)(firstArg, ...args)); - } - error(firstArg, ...args) { - this._logError('error', (0, _util().format)(firstArg, ...args)); - } - group(title, ...args) { - this._groupDepth++; - if (title != null || args.length > 0) { - this._log( - 'group', - _chalk().default.bold((0, _util().format)(title, ...args)) - ); - } - } - groupCollapsed(title, ...args) { - this._groupDepth++; - if (title != null || args.length > 0) { - this._log( - 'groupCollapsed', - _chalk().default.bold((0, _util().format)(title, ...args)) - ); - } - } - groupEnd() { - if (this._groupDepth > 0) { - this._groupDepth--; - } - } - info(firstArg, ...args) { - this._log('info', (0, _util().format)(firstArg, ...args)); - } - log(firstArg, ...args) { - this._log('log', (0, _util().format)(firstArg, ...args)); - } - time(label = 'default') { - if (this._timers[label] != null) { - return; - } - this._timers[label] = new Date(); - } - timeEnd(label = 'default') { - const startTime = this._timers[label]; - if (startTime != null) { - const endTime = new Date().getTime(); - const time = endTime - startTime.getTime(); - this._log( - 'time', - (0, _util().format)(`${label}: ${(0, _jestUtil().formatTime)(time)}`) - ); - delete this._timers[label]; - } - } - timeLog(label = 'default', ...data) { - const startTime = this._timers[label]; - if (startTime != null) { - const endTime = new Date(); - const time = endTime.getTime() - startTime.getTime(); - this._log( - 'time', - (0, _util().format)( - `${label}: ${(0, _jestUtil().formatTime)(time)}`, - ...data - ) - ); - } - } - warn(firstArg, ...args) { - this._logError('warn', (0, _util().format)(firstArg, ...args)); - } - getBuffer() { - return undefined; - } -} -exports.default = CustomConsole; diff --git a/node_modules/@jest/console/build/NullConsole.js b/node_modules/@jest/console/build/NullConsole.js deleted file mode 100644 index 3a396a2d5..000000000 --- a/node_modules/@jest/console/build/NullConsole.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -var _CustomConsole = _interopRequireDefault(require('./CustomConsole')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/* eslint-disable @typescript-eslint/no-empty-function */ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class NullConsole extends _CustomConsole.default { - assert() {} - debug() {} - dir() {} - error() {} - info() {} - log() {} - time() {} - timeEnd() {} - timeLog() {} - trace() {} - warn() {} - group() {} - groupCollapsed() {} - groupEnd() {} -} -exports.default = NullConsole; diff --git a/node_modules/@jest/console/build/getConsoleOutput.js b/node_modules/@jest/console/build/getConsoleOutput.js deleted file mode 100644 index a38f85c67..000000000 --- a/node_modules/@jest/console/build/getConsoleOutput.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getConsoleOutput; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestMessageUtil() { - const data = require('jest-message-util'); - _jestMessageUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getConsoleOutput(buffer, config, globalConfig) { - const TITLE_INDENT = - globalConfig.verbose === true ? ' '.repeat(2) : ' '.repeat(4); - const CONSOLE_INDENT = TITLE_INDENT + ' '.repeat(2); - const logEntries = buffer.reduce((output, {type, message, origin}) => { - message = message - .split(/\n/) - .map(line => CONSOLE_INDENT + line) - .join('\n'); - let typeMessage = `console.${type}`; - let noStackTrace = true; - let noCodeFrame = true; - if (type === 'warn') { - message = _chalk().default.yellow(message); - typeMessage = _chalk().default.yellow(typeMessage); - noStackTrace = globalConfig?.noStackTrace ?? false; - noCodeFrame = false; - } else if (type === 'error') { - message = _chalk().default.red(message); - typeMessage = _chalk().default.red(typeMessage); - noStackTrace = globalConfig?.noStackTrace ?? false; - noCodeFrame = false; - } - const options = { - noCodeFrame, - noStackTrace - }; - const formattedStackTrace = (0, _jestMessageUtil().formatStackTrace)( - origin, - config, - options - ); - return `${ - output + TITLE_INDENT + _chalk().default.dim(typeMessage) - }\n${message.trimRight()}\n${_chalk().default.dim( - formattedStackTrace.trimRight() - )}\n\n`; - }, ''); - return `${logEntries.trimRight()}\n`; -} diff --git a/node_modules/@jest/console/build/index.d.ts b/node_modules/@jest/console/build/index.d.ts deleted file mode 100644 index d4dcd2eb4..000000000 --- a/node_modules/@jest/console/build/index.d.ts +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// - -import type {Config} from '@jest/types'; -import {Console as Console_2} from 'console'; -import {InspectOptions} from 'util'; -import {StackTraceConfig} from 'jest-message-util'; - -export declare class BufferedConsole extends Console_2 { - private readonly _buffer; - private _counters; - private _timers; - private _groupDepth; - Console: typeof Console_2; - constructor(); - static write( - this: void, - buffer: ConsoleBuffer, - type: LogType, - message: LogMessage, - level?: number | null, - ): ConsoleBuffer; - private _log; - assert(value: unknown, message?: string | Error): void; - count(label?: string): void; - countReset(label?: string): void; - debug(firstArg: unknown, ...rest: Array): void; - dir(firstArg: unknown, options?: InspectOptions): void; - dirxml(firstArg: unknown, ...rest: Array): void; - error(firstArg: unknown, ...rest: Array): void; - group(title?: string, ...rest: Array): void; - groupCollapsed(title?: string, ...rest: Array): void; - groupEnd(): void; - info(firstArg: unknown, ...rest: Array): void; - log(firstArg: unknown, ...rest: Array): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: Array): void; - warn(firstArg: unknown, ...rest: Array): void; - getBuffer(): ConsoleBuffer | undefined; -} - -export declare type ConsoleBuffer = Array; - -export declare class CustomConsole extends Console_2 { - private readonly _stdout; - private readonly _stderr; - private readonly _formatBuffer; - private _counters; - private _timers; - private _groupDepth; - Console: typeof Console_2; - constructor( - stdout: NodeJS.WriteStream, - stderr: NodeJS.WriteStream, - formatBuffer?: Formatter, - ); - private _log; - private _logError; - assert(value: unknown, message?: string | Error): asserts value; - count(label?: string): void; - countReset(label?: string): void; - debug(firstArg: unknown, ...args: Array): void; - dir(firstArg: unknown, options?: InspectOptions): void; - dirxml(firstArg: unknown, ...args: Array): void; - error(firstArg: unknown, ...args: Array): void; - group(title?: string, ...args: Array): void; - groupCollapsed(title?: string, ...args: Array): void; - groupEnd(): void; - info(firstArg: unknown, ...args: Array): void; - log(firstArg: unknown, ...args: Array): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: Array): void; - warn(firstArg: unknown, ...args: Array): void; - getBuffer(): undefined; -} - -declare type Formatter = (type: LogType, message: LogMessage) => string; - -export declare function getConsoleOutput( - buffer: ConsoleBuffer, - config: StackTraceConfig, - globalConfig: Config.GlobalConfig, -): string; - -export declare type LogEntry = { - message: LogMessage; - origin: string; - type: LogType; -}; - -export declare type LogMessage = string; - -export declare type LogType = - | 'assert' - | 'count' - | 'debug' - | 'dir' - | 'dirxml' - | 'error' - | 'group' - | 'groupCollapsed' - | 'info' - | 'log' - | 'time' - | 'warn'; - -export declare class NullConsole extends CustomConsole { - assert(): void; - debug(): void; - dir(): void; - error(): void; - info(): void; - log(): void; - time(): void; - timeEnd(): void; - timeLog(): void; - trace(): void; - warn(): void; - group(): void; - groupCollapsed(): void; - groupEnd(): void; -} - -export {}; diff --git a/node_modules/@jest/console/build/index.js b/node_modules/@jest/console/build/index.js deleted file mode 100644 index 6383b61d5..000000000 --- a/node_modules/@jest/console/build/index.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'BufferedConsole', { - enumerable: true, - get: function () { - return _BufferedConsole.default; - } -}); -Object.defineProperty(exports, 'CustomConsole', { - enumerable: true, - get: function () { - return _CustomConsole.default; - } -}); -Object.defineProperty(exports, 'NullConsole', { - enumerable: true, - get: function () { - return _NullConsole.default; - } -}); -Object.defineProperty(exports, 'getConsoleOutput', { - enumerable: true, - get: function () { - return _getConsoleOutput.default; - } -}); -var _BufferedConsole = _interopRequireDefault(require('./BufferedConsole')); -var _CustomConsole = _interopRequireDefault(require('./CustomConsole')); -var _NullConsole = _interopRequireDefault(require('./NullConsole')); -var _getConsoleOutput = _interopRequireDefault(require('./getConsoleOutput')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/console/build/types.js b/node_modules/@jest/console/build/types.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/console/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/console/package.json b/node_modules/@jest/console/package.json deleted file mode 100644 index 0c1e74f70..000000000 --- a/node_modules/@jest/console/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@jest/console", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-console" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0", - "slash": "^3.0.0" - }, - "devDependencies": { - "@jest/test-utils": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/core/LICENSE b/node_modules/@jest/core/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/core/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/core/README.md b/node_modules/@jest/core/README.md deleted file mode 100644 index e5852b602..000000000 --- a/node_modules/@jest/core/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @jest/core - -Jest is currently working on providing a programmatic API. This is under development, and usage of this package directly is currently not supported. diff --git a/node_modules/@jest/core/build/FailedTestsCache.js b/node_modules/@jest/core/build/FailedTestsCache.js deleted file mode 100644 index 2e3046a39..000000000 --- a/node_modules/@jest/core/build/FailedTestsCache.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class FailedTestsCache { - _enabledTestsMap; - filterTests(tests) { - const enabledTestsMap = this._enabledTestsMap; - if (!enabledTestsMap) { - return tests; - } - return tests.filter(testResult => enabledTestsMap[testResult.path]); - } - setTestResults(testResults) { - this._enabledTestsMap = (testResults || []) - .filter(testResult => testResult.numFailingTests) - .reduce((suiteMap, testResult) => { - suiteMap[testResult.testFilePath] = testResult.testResults - .filter(test => test.status === 'failed') - .reduce((testMap, test) => { - testMap[test.fullName] = true; - return testMap; - }, {}); - return suiteMap; - }, {}); - this._enabledTestsMap = Object.freeze(this._enabledTestsMap); - } -} -exports.default = FailedTestsCache; diff --git a/node_modules/@jest/core/build/FailedTestsInteractiveMode.js b/node_modules/@jest/core/build/FailedTestsInteractiveMode.js deleted file mode 100644 index d64177fb0..000000000 --- a/node_modules/@jest/core/build/FailedTestsInteractiveMode.js +++ /dev/null @@ -1,195 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _ansiEscapes() { - const data = _interopRequireDefault(require('ansi-escapes')); - _ansiEscapes = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const {ARROW, CLEAR} = _jestUtil().specialChars; -function describeKey(key, description) { - return `${_chalk().default.dim( - `${ARROW}Press` - )} ${key} ${_chalk().default.dim(description)}`; -} -const TestProgressLabel = _chalk().default.bold('Interactive Test Progress'); -class FailedTestsInteractiveMode { - _isActive = false; - _countPaths = 0; - _skippedNum = 0; - _testAssertions = []; - _updateTestRunnerConfig; - constructor(_pipe) { - this._pipe = _pipe; - } - isActive() { - return this._isActive; - } - put(key) { - switch (key) { - case 's': - if (this._skippedNum === this._testAssertions.length) { - break; - } - this._skippedNum += 1; - // move skipped test to the end - this._testAssertions.push(this._testAssertions.shift()); - if (this._testAssertions.length - this._skippedNum > 0) { - this._run(); - } else { - this._drawUIDoneWithSkipped(); - } - break; - case 'q': - case _jestWatcher().KEYS.ESCAPE: - this.abort(); - break; - case 'r': - this.restart(); - break; - case _jestWatcher().KEYS.ENTER: - if (this._testAssertions.length === 0) { - this.abort(); - } else { - this._run(); - } - break; - default: - } - } - run(failedTestAssertions, updateConfig) { - if (failedTestAssertions.length === 0) return; - this._testAssertions = [...failedTestAssertions]; - this._countPaths = this._testAssertions.length; - this._updateTestRunnerConfig = updateConfig; - this._isActive = true; - this._run(); - } - updateWithResults(results) { - if (!results.snapshot.failure && results.numFailedTests > 0) { - return this._drawUIOverlay(); - } - this._testAssertions.shift(); - if (this._testAssertions.length === 0) { - return this._drawUIOverlay(); - } - - // Go to the next test - return this._run(); - } - _clearTestSummary() { - this._pipe.write(_ansiEscapes().default.cursorUp(6)); - this._pipe.write(_ansiEscapes().default.eraseDown); - } - _drawUIDone() { - this._pipe.write(CLEAR); - const messages = [ - _chalk().default.bold('Watch Usage'), - describeKey('Enter', 'to return to watch mode.') - ]; - this._pipe.write(`${messages.join('\n')}\n`); - } - _drawUIDoneWithSkipped() { - this._pipe.write(CLEAR); - let stats = `${(0, _jestUtil().pluralize)( - 'test', - this._countPaths - )} reviewed`; - if (this._skippedNum > 0) { - const skippedText = _chalk().default.bold.yellow( - `${(0, _jestUtil().pluralize)('test', this._skippedNum)} skipped` - ); - stats = `${stats}, ${skippedText}`; - } - const message = [ - TestProgressLabel, - `${ARROW}${stats}`, - '\n', - _chalk().default.bold('Watch Usage'), - describeKey('r', 'to restart Interactive Mode.'), - describeKey('q', 'to quit Interactive Mode.'), - describeKey('Enter', 'to return to watch mode.') - ]; - this._pipe.write(`\n${message.join('\n')}`); - } - _drawUIProgress() { - this._clearTestSummary(); - const numPass = this._countPaths - this._testAssertions.length; - const numRemaining = this._countPaths - numPass - this._skippedNum; - let stats = `${(0, _jestUtil().pluralize)('test', numRemaining)} remaining`; - if (this._skippedNum > 0) { - const skippedText = _chalk().default.bold.yellow( - `${(0, _jestUtil().pluralize)('test', this._skippedNum)} skipped` - ); - stats = `${stats}, ${skippedText}`; - } - const message = [ - TestProgressLabel, - `${ARROW}${stats}`, - '\n', - _chalk().default.bold('Watch Usage'), - describeKey('s', 'to skip the current test.'), - describeKey('q', 'to quit Interactive Mode.'), - describeKey('Enter', 'to return to watch mode.') - ]; - this._pipe.write(`\n${message.join('\n')}`); - } - _drawUIOverlay() { - if (this._testAssertions.length === 0) return this._drawUIDone(); - return this._drawUIProgress(); - } - _run() { - if (this._updateTestRunnerConfig) { - this._updateTestRunnerConfig(this._testAssertions[0]); - } - } - abort() { - this._isActive = false; - this._skippedNum = 0; - if (this._updateTestRunnerConfig) { - this._updateTestRunnerConfig(); - } - } - restart() { - this._skippedNum = 0; - this._countPaths = this._testAssertions.length; - this._run(); - } -} -exports.default = FailedTestsInteractiveMode; diff --git a/node_modules/@jest/core/build/ReporterDispatcher.js b/node_modules/@jest/core/build/ReporterDispatcher.js deleted file mode 100644 index 5d29e91cf..000000000 --- a/node_modules/@jest/core/build/ReporterDispatcher.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class ReporterDispatcher { - _reporters; - constructor() { - this._reporters = []; - } - register(reporter) { - this._reporters.push(reporter); - } - unregister(reporterConstructor) { - this._reporters = this._reporters.filter( - reporter => !(reporter instanceof reporterConstructor) - ); - } - async onTestFileResult(test, testResult, results) { - for (const reporter of this._reporters) { - if (reporter.onTestFileResult) { - await reporter.onTestFileResult(test, testResult, results); - } else if (reporter.onTestResult) { - await reporter.onTestResult(test, testResult, results); - } - } - - // Release memory if unused later. - testResult.coverage = undefined; - testResult.console = undefined; - } - async onTestFileStart(test) { - for (const reporter of this._reporters) { - if (reporter.onTestFileStart) { - await reporter.onTestFileStart(test); - } else if (reporter.onTestStart) { - await reporter.onTestStart(test); - } - } - } - async onRunStart(results, options) { - for (const reporter of this._reporters) { - reporter.onRunStart && (await reporter.onRunStart(results, options)); - } - } - async onTestCaseResult(test, testCaseResult) { - for (const reporter of this._reporters) { - if (reporter.onTestCaseResult) { - await reporter.onTestCaseResult(test, testCaseResult); - } - } - } - async onRunComplete(testContexts, results) { - for (const reporter of this._reporters) { - if (reporter.onRunComplete) { - await reporter.onRunComplete(testContexts, results); - } - } - } - - // Return a list of last errors for every reporter - getErrors() { - return this._reporters.reduce((list, reporter) => { - const error = reporter.getLastError && reporter.getLastError(); - return error ? list.concat(error) : list; - }, []); - } - hasErrors() { - return this.getErrors().length !== 0; - } -} -exports.default = ReporterDispatcher; diff --git a/node_modules/@jest/core/build/SearchSource.js b/node_modules/@jest/core/build/SearchSource.js deleted file mode 100644 index a81ef96af..000000000 --- a/node_modules/@jest/core/build/SearchSource.js +++ /dev/null @@ -1,408 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function os() { - const data = _interopRequireWildcard(require('os')); - os = function () { - return data; - }; - return data; -} -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function _micromatch() { - const data = _interopRequireDefault(require('micromatch')); - _micromatch = function () { - return data; - }; - return data; -} -function _jestConfig() { - const data = require('jest-config'); - _jestConfig = function () { - return data; - }; - return data; -} -function _jestRegexUtil() { - const data = require('jest-regex-util'); - _jestRegexUtil = function () { - return data; - }; - return data; -} -function _jestResolveDependencies() { - const data = require('jest-resolve-dependencies'); - _jestResolveDependencies = function () { - return data; - }; - return data; -} -function _jestSnapshot() { - const data = require('jest-snapshot'); - _jestSnapshot = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const regexToMatcher = testRegex => { - const regexes = testRegex.map(testRegex => new RegExp(testRegex)); - return path => - regexes.some(regex => { - const result = regex.test(path); - - // prevent stateful regexes from breaking, just in case - regex.lastIndex = 0; - return result; - }); -}; -const toTests = (context, tests) => - tests.map(path => ({ - context, - duration: undefined, - path - })); -const hasSCM = changedFilesInfo => { - const {repos} = changedFilesInfo; - // no SCM (git/hg/...) is found in any of the roots. - const noSCM = Object.values(repos).every(scm => scm.size === 0); - return !noSCM; -}; -class SearchSource { - _context; - _dependencyResolver; - _testPathCases = []; - constructor(context) { - const {config} = context; - this._context = context; - this._dependencyResolver = null; - const rootPattern = new RegExp( - config.roots - .map(dir => (0, _jestRegexUtil().escapePathForRegex)(dir + path().sep)) - .join('|') - ); - this._testPathCases.push({ - isMatch: path => rootPattern.test(path), - stat: 'roots' - }); - if (config.testMatch.length) { - this._testPathCases.push({ - isMatch: (0, _jestUtil().globsToMatcher)(config.testMatch), - stat: 'testMatch' - }); - } - if (config.testPathIgnorePatterns.length) { - const testIgnorePatternsRegex = new RegExp( - config.testPathIgnorePatterns.join('|') - ); - this._testPathCases.push({ - isMatch: path => !testIgnorePatternsRegex.test(path), - stat: 'testPathIgnorePatterns' - }); - } - if (config.testRegex.length) { - this._testPathCases.push({ - isMatch: regexToMatcher(config.testRegex), - stat: 'testRegex' - }); - } - } - async _getOrBuildDependencyResolver() { - if (!this._dependencyResolver) { - this._dependencyResolver = - new (_jestResolveDependencies().DependencyResolver)( - this._context.resolver, - this._context.hasteFS, - await (0, _jestSnapshot().buildSnapshotResolver)(this._context.config) - ); - } - return this._dependencyResolver; - } - _filterTestPathsWithStats(allPaths, testPathPattern) { - const data = { - stats: { - roots: 0, - testMatch: 0, - testPathIgnorePatterns: 0, - testRegex: 0 - }, - tests: [], - total: allPaths.length - }; - const testCases = Array.from(this._testPathCases); // clone - if (testPathPattern) { - const regex = (0, _jestUtil().testPathPatternToRegExp)(testPathPattern); - testCases.push({ - isMatch: path => regex.test(path), - stat: 'testPathPattern' - }); - data.stats.testPathPattern = 0; - } - data.tests = allPaths.filter(test => { - let filterResult = true; - for (const {isMatch, stat} of testCases) { - if (isMatch(test.path)) { - data.stats[stat]++; - } else { - filterResult = false; - } - } - return filterResult; - }); - return data; - } - _getAllTestPaths(testPathPattern) { - return this._filterTestPathsWithStats( - toTests(this._context, this._context.hasteFS.getAllFiles()), - testPathPattern - ); - } - isTestFilePath(path) { - return this._testPathCases.every(testCase => testCase.isMatch(path)); - } - findMatchingTests(testPathPattern) { - return this._getAllTestPaths(testPathPattern); - } - async findRelatedTests(allPaths, collectCoverage) { - const dependencyResolver = await this._getOrBuildDependencyResolver(); - if (!collectCoverage) { - return { - tests: toTests( - this._context, - dependencyResolver.resolveInverse( - allPaths, - this.isTestFilePath.bind(this), - { - skipNodeResolution: this._context.config.skipNodeResolution - } - ) - ) - }; - } - const testModulesMap = dependencyResolver.resolveInverseModuleMap( - allPaths, - this.isTestFilePath.bind(this), - { - skipNodeResolution: this._context.config.skipNodeResolution - } - ); - const allPathsAbsolute = Array.from(allPaths).map(p => path().resolve(p)); - const collectCoverageFrom = new Set(); - testModulesMap.forEach(testModule => { - if (!testModule.dependencies) { - return; - } - testModule.dependencies.forEach(p => { - if (!allPathsAbsolute.includes(p)) { - return; - } - const filename = (0, _jestConfig().replaceRootDirInPath)( - this._context.config.rootDir, - p - ); - collectCoverageFrom.add( - path().isAbsolute(filename) - ? path().relative(this._context.config.rootDir, filename) - : filename - ); - }); - }); - return { - collectCoverageFrom, - tests: toTests( - this._context, - testModulesMap.map(testModule => testModule.file) - ) - }; - } - findTestsByPaths(paths) { - return { - tests: toTests( - this._context, - paths - .map(p => path().resolve(this._context.config.cwd, p)) - .filter(this.isTestFilePath.bind(this)) - ) - }; - } - async findRelatedTestsFromPattern(paths, collectCoverage) { - if (Array.isArray(paths) && paths.length) { - const resolvedPaths = paths.map(p => - path().resolve(this._context.config.cwd, p) - ); - return this.findRelatedTests(new Set(resolvedPaths), collectCoverage); - } - return { - tests: [] - }; - } - async findTestRelatedToChangedFiles(changedFilesInfo, collectCoverage) { - if (!hasSCM(changedFilesInfo)) { - return { - noSCM: true, - tests: [] - }; - } - const {changedFiles} = changedFilesInfo; - return this.findRelatedTests(changedFiles, collectCoverage); - } - async _getTestPaths(globalConfig, changedFiles) { - if (globalConfig.onlyChanged) { - if (!changedFiles) { - throw new Error('Changed files must be set when running with -o.'); - } - return this.findTestRelatedToChangedFiles( - changedFiles, - globalConfig.collectCoverage - ); - } - let paths = globalConfig.nonFlagArgs; - if (globalConfig.findRelatedTests && 'win32' === os().platform()) { - paths = this.filterPathsWin32(paths); - } - if (globalConfig.runTestsByPath && paths && paths.length) { - return this.findTestsByPaths(paths); - } else if (globalConfig.findRelatedTests && paths && paths.length) { - return this.findRelatedTestsFromPattern( - paths, - globalConfig.collectCoverage - ); - } else if (globalConfig.testPathPattern != null) { - return this.findMatchingTests(globalConfig.testPathPattern); - } else { - return { - tests: [] - }; - } - } - filterPathsWin32(paths) { - const allFiles = this._context.hasteFS.getAllFiles(); - const options = { - nocase: true, - windows: false - }; - function normalizePosix(filePath) { - return filePath.replace(/\\/g, '/'); - } - paths = paths - .map(p => { - // micromatch works with forward slashes: https://github.com/micromatch/micromatch#backslashes - const normalizedPath = normalizePosix( - path().resolve(this._context.config.cwd, p) - ); - const match = (0, _micromatch().default)( - allFiles.map(normalizePosix), - normalizedPath, - options - ); - return match[0]; - }) - .filter(Boolean) - .map(p => path().resolve(p)); - return paths; - } - async getTestPaths(globalConfig, changedFiles, filter) { - const searchResult = await this._getTestPaths(globalConfig, changedFiles); - const filterPath = globalConfig.filter; - if (filter) { - const tests = searchResult.tests; - const filterResult = await filter(tests.map(test => test.path)); - if (!Array.isArray(filterResult.filtered)) { - throw new Error( - `Filter ${filterPath} did not return a valid test list` - ); - } - const filteredSet = new Set( - filterResult.filtered.map(result => result.test) - ); - return { - ...searchResult, - tests: tests.filter(test => filteredSet.has(test.path)) - }; - } - return searchResult; - } - async findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo) { - if (!hasSCM(changedFilesInfo)) { - return []; - } - const {changedFiles} = changedFilesInfo; - const dependencyResolver = await this._getOrBuildDependencyResolver(); - const relatedSourcesSet = new Set(); - changedFiles.forEach(filePath => { - if (this.isTestFilePath(filePath)) { - const sourcePaths = dependencyResolver.resolve(filePath, { - skipNodeResolution: this._context.config.skipNodeResolution - }); - sourcePaths.forEach(sourcePath => relatedSourcesSet.add(sourcePath)); - } - }); - return Array.from(relatedSourcesSet); - } -} -exports.default = SearchSource; diff --git a/node_modules/@jest/core/build/SnapshotInteractiveMode.js b/node_modules/@jest/core/build/SnapshotInteractiveMode.js deleted file mode 100644 index 40a4b547d..000000000 --- a/node_modules/@jest/core/build/SnapshotInteractiveMode.js +++ /dev/null @@ -1,238 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _ansiEscapes() { - const data = _interopRequireDefault(require('ansi-escapes')); - _ansiEscapes = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const {ARROW, CLEAR} = _jestUtil().specialChars; -class SnapshotInteractiveMode { - _pipe; - _isActive; - _updateTestRunnerConfig; - _testAssertions; - _countPaths; - _skippedNum; - constructor(pipe) { - this._pipe = pipe; - this._isActive = false; - this._skippedNum = 0; - } - isActive() { - return this._isActive; - } - getSkippedNum() { - return this._skippedNum; - } - _clearTestSummary() { - this._pipe.write(_ansiEscapes().default.cursorUp(6)); - this._pipe.write(_ansiEscapes().default.eraseDown); - } - _drawUIProgress() { - this._clearTestSummary(); - const numPass = this._countPaths - this._testAssertions.length; - const numRemaining = this._countPaths - numPass - this._skippedNum; - let stats = _chalk().default.bold.dim( - `${(0, _jestUtil().pluralize)('snapshot', numRemaining)} remaining` - ); - if (numPass) { - stats += `, ${_chalk().default.bold.green( - `${(0, _jestUtil().pluralize)('snapshot', numPass)} updated` - )}`; - } - if (this._skippedNum) { - stats += `, ${_chalk().default.bold.yellow( - `${(0, _jestUtil().pluralize)('snapshot', this._skippedNum)} skipped` - )}`; - } - const messages = [ - `\n${_chalk().default.bold('Interactive Snapshot Progress')}`, - ARROW + stats, - `\n${_chalk().default.bold('Watch Usage')}`, - `${_chalk().default.dim(`${ARROW}Press `)}u${_chalk().default.dim( - ' to update failing snapshots for this test.' - )}`, - `${_chalk().default.dim(`${ARROW}Press `)}s${_chalk().default.dim( - ' to skip the current test.' - )}`, - `${_chalk().default.dim(`${ARROW}Press `)}q${_chalk().default.dim( - ' to quit Interactive Snapshot Mode.' - )}`, - `${_chalk().default.dim(`${ARROW}Press `)}Enter${_chalk().default.dim( - ' to trigger a test run.' - )}` - ]; - this._pipe.write(`${messages.filter(Boolean).join('\n')}\n`); - } - _drawUIDoneWithSkipped() { - this._pipe.write(CLEAR); - const numPass = this._countPaths - this._testAssertions.length; - let stats = _chalk().default.bold.dim( - `${(0, _jestUtil().pluralize)('snapshot', this._countPaths)} reviewed` - ); - if (numPass) { - stats += `, ${_chalk().default.bold.green( - `${(0, _jestUtil().pluralize)('snapshot', numPass)} updated` - )}`; - } - if (this._skippedNum) { - stats += `, ${_chalk().default.bold.yellow( - `${(0, _jestUtil().pluralize)('snapshot', this._skippedNum)} skipped` - )}`; - } - const messages = [ - `\n${_chalk().default.bold('Interactive Snapshot Result')}`, - ARROW + stats, - `\n${_chalk().default.bold('Watch Usage')}`, - `${_chalk().default.dim(`${ARROW}Press `)}r${_chalk().default.dim( - ' to restart Interactive Snapshot Mode.' - )}`, - `${_chalk().default.dim(`${ARROW}Press `)}q${_chalk().default.dim( - ' to quit Interactive Snapshot Mode.' - )}` - ]; - this._pipe.write(`${messages.filter(Boolean).join('\n')}\n`); - } - _drawUIDone() { - this._pipe.write(CLEAR); - const numPass = this._countPaths - this._testAssertions.length; - let stats = _chalk().default.bold.dim( - `${(0, _jestUtil().pluralize)('snapshot', this._countPaths)} reviewed` - ); - if (numPass) { - stats += `, ${_chalk().default.bold.green( - `${(0, _jestUtil().pluralize)('snapshot', numPass)} updated` - )}`; - } - const messages = [ - `\n${_chalk().default.bold('Interactive Snapshot Result')}`, - ARROW + stats, - `\n${_chalk().default.bold('Watch Usage')}`, - `${_chalk().default.dim(`${ARROW}Press `)}Enter${_chalk().default.dim( - ' to return to watch mode.' - )}` - ]; - this._pipe.write(`${messages.filter(Boolean).join('\n')}\n`); - } - _drawUIOverlay() { - if (this._testAssertions.length === 0) { - return this._drawUIDone(); - } - if (this._testAssertions.length - this._skippedNum === 0) { - return this._drawUIDoneWithSkipped(); - } - return this._drawUIProgress(); - } - put(key) { - switch (key) { - case 's': - if (this._skippedNum === this._testAssertions.length) break; - this._skippedNum += 1; - - // move skipped test to the end - this._testAssertions.push(this._testAssertions.shift()); - if (this._testAssertions.length - this._skippedNum > 0) { - this._run(false); - } else { - this._drawUIDoneWithSkipped(); - } - break; - case 'u': - this._run(true); - break; - case 'q': - case _jestWatcher().KEYS.ESCAPE: - this.abort(); - break; - case 'r': - this.restart(); - break; - case _jestWatcher().KEYS.ENTER: - if (this._testAssertions.length === 0) { - this.abort(); - } else { - this._run(false); - } - break; - default: - break; - } - } - abort() { - this._isActive = false; - this._skippedNum = 0; - this._updateTestRunnerConfig(null, false); - } - restart() { - this._skippedNum = 0; - this._countPaths = this._testAssertions.length; - this._run(false); - } - updateWithResults(results) { - const hasSnapshotFailure = !!results.snapshot.failure; - if (hasSnapshotFailure) { - this._drawUIOverlay(); - return; - } - this._testAssertions.shift(); - if (this._testAssertions.length - this._skippedNum === 0) { - this._drawUIOverlay(); - return; - } - - // Go to the next test - this._run(false); - } - _run(shouldUpdateSnapshot) { - const testAssertion = this._testAssertions[0]; - this._updateTestRunnerConfig(testAssertion, shouldUpdateSnapshot); - } - run(failedSnapshotTestAssertions, onConfigChange) { - if (!failedSnapshotTestAssertions.length) { - return; - } - this._testAssertions = [...failedSnapshotTestAssertions]; - this._countPaths = this._testAssertions.length; - this._updateTestRunnerConfig = onConfigChange; - this._isActive = true; - this._run(false); - } -} -exports.default = SnapshotInteractiveMode; diff --git a/node_modules/@jest/core/build/TestNamePatternPrompt.js b/node_modules/@jest/core/build/TestNamePatternPrompt.js deleted file mode 100644 index be495ad6f..000000000 --- a/node_modules/@jest/core/build/TestNamePatternPrompt.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class TestNamePatternPrompt extends _jestWatcher().PatternPrompt { - constructor(pipe, prompt) { - super(pipe, prompt, 'tests'); - } - _onChange(pattern, options) { - super._onChange(pattern, options); - this._printPrompt(pattern); - } - _printPrompt(pattern) { - const pipe = this._pipe; - (0, _jestWatcher().printPatternCaret)(pattern, pipe); - (0, _jestWatcher().printRestoredPatternCaret)( - pattern, - this._currentUsageRows, - pipe - ); - } -} -exports.default = TestNamePatternPrompt; diff --git a/node_modules/@jest/core/build/TestPathPatternPrompt.js b/node_modules/@jest/core/build/TestPathPatternPrompt.js deleted file mode 100644 index 648cef0a0..000000000 --- a/node_modules/@jest/core/build/TestPathPatternPrompt.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class TestPathPatternPrompt extends _jestWatcher().PatternPrompt { - constructor(pipe, prompt) { - super(pipe, prompt, 'filenames'); - } - _onChange(pattern, options) { - super._onChange(pattern, options); - this._printPrompt(pattern); - } - _printPrompt(pattern) { - const pipe = this._pipe; - (0, _jestWatcher().printPatternCaret)(pattern, pipe); - (0, _jestWatcher().printRestoredPatternCaret)( - pattern, - this._currentUsageRows, - pipe - ); - } -} -exports.default = TestPathPatternPrompt; diff --git a/node_modules/@jest/core/build/TestScheduler.js b/node_modules/@jest/core/build/TestScheduler.js deleted file mode 100644 index ef7310d0c..000000000 --- a/node_modules/@jest/core/build/TestScheduler.js +++ /dev/null @@ -1,458 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.createTestScheduler = createTestScheduler; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _ciInfo() { - const data = require('ci-info'); - _ciInfo = function () { - return data; - }; - return data; -} -function _exit() { - const data = _interopRequireDefault(require('exit')); - _exit = function () { - return data; - }; - return data; -} -function _reporters() { - const data = require('@jest/reporters'); - _reporters = function () { - return data; - }; - return data; -} -function _testResult() { - const data = require('@jest/test-result'); - _testResult = function () { - return data; - }; - return data; -} -function _transform() { - const data = require('@jest/transform'); - _transform = function () { - return data; - }; - return data; -} -function _jestMessageUtil() { - const data = require('jest-message-util'); - _jestMessageUtil = function () { - return data; - }; - return data; -} -function _jestSnapshot() { - const data = require('jest-snapshot'); - _jestSnapshot = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -var _ReporterDispatcher = _interopRequireDefault( - require('./ReporterDispatcher') -); -var _testSchedulerHelper = require('./testSchedulerHelper'); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -async function createTestScheduler(globalConfig, context) { - const scheduler = new TestScheduler(globalConfig, context); - await scheduler._setupReporters(); - return scheduler; -} -class TestScheduler { - _context; - _dispatcher; - _globalConfig; - constructor(globalConfig, context) { - this._context = context; - this._dispatcher = new _ReporterDispatcher.default(); - this._globalConfig = globalConfig; - } - addReporter(reporter) { - this._dispatcher.register(reporter); - } - removeReporter(reporterConstructor) { - this._dispatcher.unregister(reporterConstructor); - } - async scheduleTests(tests, watcher) { - const onTestFileStart = this._dispatcher.onTestFileStart.bind( - this._dispatcher - ); - const timings = []; - const testContexts = new Set(); - tests.forEach(test => { - testContexts.add(test.context); - if (test.duration) { - timings.push(test.duration); - } - }); - const aggregatedResults = createAggregatedResults(tests.length); - const estimatedTime = Math.ceil( - getEstimatedTime(timings, this._globalConfig.maxWorkers) / 1000 - ); - const runInBand = (0, _testSchedulerHelper.shouldRunInBand)( - tests, - timings, - this._globalConfig - ); - const onResult = async (test, testResult) => { - if (watcher.isInterrupted()) { - return Promise.resolve(); - } - if (testResult.testResults.length === 0) { - const message = 'Your test suite must contain at least one test.'; - return onFailure(test, { - message, - stack: new Error(message).stack - }); - } - - // Throws when the context is leaked after executing a test. - if (testResult.leaks) { - const message = - `${_chalk().default.red.bold( - 'EXPERIMENTAL FEATURE!\n' - )}Your test suite is leaking memory. Please ensure all references are cleaned.\n` + - '\n' + - 'There is a number of things that can leak memory:\n' + - ' - Async operations that have not finished (e.g. fs.readFile).\n' + - ' - Timers not properly mocked (e.g. setInterval, setTimeout).\n' + - ' - Keeping references to the global scope.'; - return onFailure(test, { - message, - stack: new Error(message).stack - }); - } - (0, _testResult().addResult)(aggregatedResults, testResult); - await this._dispatcher.onTestFileResult( - test, - testResult, - aggregatedResults - ); - return this._bailIfNeeded(testContexts, aggregatedResults, watcher); - }; - const onFailure = async (test, error) => { - if (watcher.isInterrupted()) { - return; - } - const testResult = (0, _testResult().buildFailureTestResult)( - test.path, - error - ); - testResult.failureMessage = (0, _jestMessageUtil().formatExecError)( - testResult.testExecError, - test.context.config, - this._globalConfig, - test.path - ); - (0, _testResult().addResult)(aggregatedResults, testResult); - await this._dispatcher.onTestFileResult( - test, - testResult, - aggregatedResults - ); - }; - const updateSnapshotState = async () => { - const contextsWithSnapshotResolvers = await Promise.all( - Array.from(testContexts).map(async context => [ - context, - await (0, _jestSnapshot().buildSnapshotResolver)(context.config) - ]) - ); - contextsWithSnapshotResolvers.forEach(([context, snapshotResolver]) => { - const status = (0, _jestSnapshot().cleanup)( - context.hasteFS, - this._globalConfig.updateSnapshot, - snapshotResolver, - context.config.testPathIgnorePatterns - ); - aggregatedResults.snapshot.filesRemoved += status.filesRemoved; - aggregatedResults.snapshot.filesRemovedList = ( - aggregatedResults.snapshot.filesRemovedList || [] - ).concat(status.filesRemovedList); - }); - const updateAll = this._globalConfig.updateSnapshot === 'all'; - aggregatedResults.snapshot.didUpdate = updateAll; - aggregatedResults.snapshot.failure = !!( - !updateAll && - (aggregatedResults.snapshot.unchecked || - aggregatedResults.snapshot.unmatched || - aggregatedResults.snapshot.filesRemoved) - ); - }; - await this._dispatcher.onRunStart(aggregatedResults, { - estimatedTime, - showStatus: !runInBand - }); - const testRunners = Object.create(null); - const contextsByTestRunner = new WeakMap(); - try { - await Promise.all( - Array.from(testContexts).map(async context => { - const {config} = context; - if (!testRunners[config.runner]) { - const transformer = await (0, _transform().createScriptTransformer)( - config - ); - const Runner = await transformer.requireAndTranspileModule( - config.runner - ); - const runner = new Runner(this._globalConfig, { - changedFiles: this._context.changedFiles, - sourcesRelatedToTestsInChangedFiles: - this._context.sourcesRelatedToTestsInChangedFiles - }); - testRunners[config.runner] = runner; - contextsByTestRunner.set(runner, context); - } - }) - ); - const testsByRunner = this._partitionTests(testRunners, tests); - if (testsByRunner) { - try { - for (const runner of Object.keys(testRunners)) { - const testRunner = testRunners[runner]; - const context = contextsByTestRunner.get(testRunner); - invariant(context); - const tests = testsByRunner[runner]; - const testRunnerOptions = { - serial: runInBand || Boolean(testRunner.isSerial) - }; - if (testRunner.supportsEventEmitters) { - const unsubscribes = [ - testRunner.on('test-file-start', ([test]) => - onTestFileStart(test) - ), - testRunner.on('test-file-success', ([test, testResult]) => - onResult(test, testResult) - ), - testRunner.on('test-file-failure', ([test, error]) => - onFailure(test, error) - ), - testRunner.on( - 'test-case-result', - ([testPath, testCaseResult]) => { - const test = { - context, - path: testPath - }; - this._dispatcher.onTestCaseResult(test, testCaseResult); - } - ) - ]; - await testRunner.runTests(tests, watcher, testRunnerOptions); - unsubscribes.forEach(sub => sub()); - } else { - await testRunner.runTests( - tests, - watcher, - onTestFileStart, - onResult, - onFailure, - testRunnerOptions - ); - } - } - } catch (error) { - if (!watcher.isInterrupted()) { - throw error; - } - } - } - } catch (error) { - aggregatedResults.runExecError = buildExecError(error); - await this._dispatcher.onRunComplete(testContexts, aggregatedResults); - throw error; - } - await updateSnapshotState(); - aggregatedResults.wasInterrupted = watcher.isInterrupted(); - await this._dispatcher.onRunComplete(testContexts, aggregatedResults); - const anyTestFailures = !( - aggregatedResults.numFailedTests === 0 && - aggregatedResults.numRuntimeErrorTestSuites === 0 - ); - const anyReporterErrors = this._dispatcher.hasErrors(); - aggregatedResults.success = !( - anyTestFailures || - aggregatedResults.snapshot.failure || - anyReporterErrors - ); - return aggregatedResults; - } - _partitionTests(testRunners, tests) { - if (Object.keys(testRunners).length > 1) { - return tests.reduce((testRuns, test) => { - const runner = test.context.config.runner; - if (!testRuns[runner]) { - testRuns[runner] = []; - } - testRuns[runner].push(test); - return testRuns; - }, Object.create(null)); - } else if (tests.length > 0 && tests[0] != null) { - // If there is only one runner, don't partition the tests. - return Object.assign(Object.create(null), { - [tests[0].context.config.runner]: tests - }); - } else { - return null; - } - } - async _setupReporters() { - const {collectCoverage: coverage, notify, verbose} = this._globalConfig; - const reporters = this._globalConfig.reporters || [['default', {}]]; - let summaryOptions = null; - for (const [reporter, options] of reporters) { - switch (reporter) { - case 'default': - summaryOptions = options; - verbose - ? this.addReporter( - new (_reporters().VerboseReporter)(this._globalConfig) - ) - : this.addReporter( - new (_reporters().DefaultReporter)(this._globalConfig) - ); - break; - case 'github-actions': - _ciInfo().GITHUB_ACTIONS && - this.addReporter( - new (_reporters().GitHubActionsReporter)( - this._globalConfig, - options - ) - ); - break; - case 'summary': - summaryOptions = options; - break; - default: - await this._addCustomReporter(reporter, options); - } - } - if (notify) { - this.addReporter( - new (_reporters().NotifyReporter)(this._globalConfig, this._context) - ); - } - if (coverage) { - this.addReporter( - new (_reporters().CoverageReporter)(this._globalConfig, this._context) - ); - } - if (summaryOptions != null) { - this.addReporter( - new (_reporters().SummaryReporter)(this._globalConfig, summaryOptions) - ); - } - } - async _addCustomReporter(reporter, options) { - try { - const Reporter = await (0, _jestUtil().requireOrImportModule)(reporter); - this.addReporter( - new Reporter(this._globalConfig, options, this._context) - ); - } catch (error) { - error.message = `An error occurred while adding the reporter at path "${_chalk().default.bold( - reporter - )}".\n${error instanceof Error ? error.message : ''}`; - throw error; - } - } - async _bailIfNeeded(testContexts, aggregatedResults, watcher) { - if ( - this._globalConfig.bail !== 0 && - aggregatedResults.numFailedTests >= this._globalConfig.bail - ) { - if (watcher.isWatchMode()) { - await watcher.setState({ - interrupted: true - }); - return; - } - try { - await this._dispatcher.onRunComplete(testContexts, aggregatedResults); - } finally { - const exitCode = this._globalConfig.testFailureExitCode; - (0, _exit().default)(exitCode); - } - } - } -} -function invariant(condition, message) { - if (!condition) { - throw new Error(message); - } -} -const createAggregatedResults = numTotalTestSuites => { - const result = (0, _testResult().makeEmptyAggregatedTestResult)(); - result.numTotalTestSuites = numTotalTestSuites; - result.startTime = Date.now(); - result.success = false; - return result; -}; -const getEstimatedTime = (timings, workers) => { - if (timings.length === 0) { - return 0; - } - const max = Math.max(...timings); - return timings.length <= workers - ? max - : Math.max(timings.reduce((sum, time) => sum + time) / workers, max); -}; -const strToError = errString => { - const {message, stack} = (0, _jestMessageUtil().separateMessageFromStack)( - errString - ); - if (stack.length > 0) { - return { - message, - stack - }; - } - const error = new (_jestUtil().ErrorWithStack)(message, buildExecError); - return { - message, - stack: error.stack || '' - }; -}; -const buildExecError = err => { - if (typeof err === 'string' || err == null) { - return strToError(err || 'Error'); - } - const anyErr = err; - if (typeof anyErr.message === 'string') { - if (typeof anyErr.stack === 'string' && anyErr.stack.length > 0) { - return anyErr; - } - return strToError(anyErr.message); - } - return strToError(JSON.stringify(err)); -}; diff --git a/node_modules/@jest/core/build/cli/index.js b/node_modules/@jest/core/build/cli/index.js deleted file mode 100644 index 446beb8c3..000000000 --- a/node_modules/@jest/core/build/cli/index.js +++ /dev/null @@ -1,418 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.runCLI = runCLI; -function _perf_hooks() { - const data = require('perf_hooks'); - _perf_hooks = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _exit() { - const data = _interopRequireDefault(require('exit')); - _exit = function () { - return data; - }; - return data; -} -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - fs = function () { - return data; - }; - return data; -} -function _console() { - const data = require('@jest/console'); - _console = function () { - return data; - }; - return data; -} -function _jestConfig() { - const data = require('jest-config'); - _jestConfig = function () { - return data; - }; - return data; -} -function _jestRuntime() { - const data = _interopRequireDefault(require('jest-runtime')); - _jestRuntime = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -var _collectHandles = require('../collectHandles'); -var _getChangedFilesPromise = _interopRequireDefault( - require('../getChangedFilesPromise') -); -var _getConfigsOfProjectsToRun = _interopRequireDefault( - require('../getConfigsOfProjectsToRun') -); -var _getProjectNamesMissingWarning = _interopRequireDefault( - require('../getProjectNamesMissingWarning') -); -var _getSelectProjectsMessage = _interopRequireDefault( - require('../getSelectProjectsMessage') -); -var _createContext = _interopRequireDefault(require('../lib/createContext')); -var _handleDeprecationWarnings = _interopRequireDefault( - require('../lib/handleDeprecationWarnings') -); -var _logDebugMessages = _interopRequireDefault( - require('../lib/logDebugMessages') -); -var _pluralize = _interopRequireDefault(require('../pluralize')); -var _runJest = _interopRequireDefault(require('../runJest')); -var _watch = _interopRequireDefault(require('../watch')); -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const {print: preRunMessagePrint} = _jestUtil().preRunMessage; -async function runCLI(argv, projects) { - _perf_hooks().performance.mark('jest/runCLI:start'); - let results; - - // If we output a JSON object, we can't write anything to stdout, since - // it'll break the JSON structure and it won't be valid. - const outputStream = - argv.json || argv.useStderr ? process.stderr : process.stdout; - const {globalConfig, configs, hasDeprecationWarnings} = await (0, - _jestConfig().readConfigs)(argv, projects); - if (argv.debug) { - (0, _logDebugMessages.default)(globalConfig, configs, outputStream); - } - if (argv.showConfig) { - (0, _logDebugMessages.default)(globalConfig, configs, process.stdout); - (0, _exit().default)(0); - } - if (argv.clearCache) { - // stick in a Set to dedupe the deletions - new Set(configs.map(config => config.cacheDirectory)).forEach( - cacheDirectory => { - fs().rmSync(cacheDirectory, { - force: true, - recursive: true - }); - process.stdout.write(`Cleared ${cacheDirectory}\n`); - } - ); - (0, _exit().default)(0); - } - const configsOfProjectsToRun = (0, _getConfigsOfProjectsToRun.default)( - configs, - { - ignoreProjects: argv.ignoreProjects, - selectProjects: argv.selectProjects - } - ); - if (argv.selectProjects || argv.ignoreProjects) { - const namesMissingWarning = (0, _getProjectNamesMissingWarning.default)( - configs, - { - ignoreProjects: argv.ignoreProjects, - selectProjects: argv.selectProjects - } - ); - if (namesMissingWarning) { - outputStream.write(namesMissingWarning); - } - outputStream.write( - (0, _getSelectProjectsMessage.default)(configsOfProjectsToRun, { - ignoreProjects: argv.ignoreProjects, - selectProjects: argv.selectProjects - }) - ); - } - await _run10000( - globalConfig, - configsOfProjectsToRun, - hasDeprecationWarnings, - outputStream, - r => { - results = r; - } - ); - if (argv.watch || argv.watchAll) { - // If in watch mode, return the promise that will never resolve. - // If the watch mode is interrupted, watch should handle the process - // shutdown. - // eslint-disable-next-line @typescript-eslint/no-empty-function - return new Promise(() => {}); - } - if (!results) { - throw new Error( - 'AggregatedResult must be present after test run is complete' - ); - } - const {openHandles} = results; - if (openHandles && openHandles.length) { - const formatted = (0, _collectHandles.formatHandleErrors)( - openHandles, - configs[0] - ); - const openHandlesString = (0, _pluralize.default)( - 'open handle', - formatted.length, - 's' - ); - const message = - _chalk().default.red( - `\nJest has detected the following ${openHandlesString} potentially keeping Jest from exiting:\n\n` - ) + formatted.join('\n\n'); - console.error(message); - } - _perf_hooks().performance.mark('jest/runCLI:end'); - return { - globalConfig, - results - }; -} -const buildContextsAndHasteMaps = async ( - configs, - globalConfig, - outputStream -) => { - const hasteMapInstances = Array(configs.length); - const contexts = await Promise.all( - configs.map(async (config, index) => { - (0, _jestUtil().createDirectory)(config.cacheDirectory); - const hasteMapInstance = await _jestRuntime().default.createHasteMap( - config, - { - console: new (_console().CustomConsole)(outputStream, outputStream), - maxWorkers: Math.max( - 1, - Math.floor(globalConfig.maxWorkers / configs.length) - ), - resetCache: !config.cache, - watch: globalConfig.watch || globalConfig.watchAll, - watchman: globalConfig.watchman, - workerThreads: globalConfig.workerThreads - } - ); - hasteMapInstances[index] = hasteMapInstance; - return (0, _createContext.default)( - config, - await hasteMapInstance.build() - ); - }) - ); - return { - contexts, - hasteMapInstances - }; -}; -const _run10000 = async ( - globalConfig, - configs, - hasDeprecationWarnings, - outputStream, - onComplete -) => { - // Queries to hg/git can take a while, so we need to start the process - // as soon as possible, so by the time we need the result it's already there. - const changedFilesPromise = (0, _getChangedFilesPromise.default)( - globalConfig, - configs - ); - if (changedFilesPromise) { - _perf_hooks().performance.mark('jest/getChangedFiles:start'); - changedFilesPromise.finally(() => { - _perf_hooks().performance.mark('jest/getChangedFiles:end'); - }); - } - - // Filter may need to do an HTTP call or something similar to setup. - // We will wait on an async response from this before using the filter. - let filter; - if (globalConfig.filter && !globalConfig.skipFilter) { - const rawFilter = require(globalConfig.filter); - let filterSetupPromise; - if (rawFilter.setup) { - // Wrap filter setup Promise to avoid "uncaught Promise" error. - // If an error is returned, we surface it in the return value. - filterSetupPromise = (async () => { - try { - await rawFilter.setup(); - } catch (err) { - return err; - } - return undefined; - })(); - } - filter = async testPaths => { - if (filterSetupPromise) { - // Expect an undefined return value unless there was an error. - const err = await filterSetupPromise; - if (err) { - throw err; - } - } - return rawFilter(testPaths); - }; - } - _perf_hooks().performance.mark('jest/buildContextsAndHasteMaps:start'); - const {contexts, hasteMapInstances} = await buildContextsAndHasteMaps( - configs, - globalConfig, - outputStream - ); - _perf_hooks().performance.mark('jest/buildContextsAndHasteMaps:end'); - globalConfig.watch || globalConfig.watchAll - ? await runWatch( - contexts, - configs, - hasDeprecationWarnings, - globalConfig, - outputStream, - hasteMapInstances, - filter - ) - : await runWithoutWatch( - globalConfig, - contexts, - outputStream, - onComplete, - changedFilesPromise, - filter - ); -}; -const runWatch = async ( - contexts, - _configs, - hasDeprecationWarnings, - globalConfig, - outputStream, - hasteMapInstances, - filter -) => { - if (hasDeprecationWarnings) { - try { - await (0, _handleDeprecationWarnings.default)( - outputStream, - process.stdin - ); - return await (0, _watch.default)( - globalConfig, - contexts, - outputStream, - hasteMapInstances, - undefined, - undefined, - filter - ); - } catch { - (0, _exit().default)(0); - } - } - return (0, _watch.default)( - globalConfig, - contexts, - outputStream, - hasteMapInstances, - undefined, - undefined, - filter - ); -}; -const runWithoutWatch = async ( - globalConfig, - contexts, - outputStream, - onComplete, - changedFilesPromise, - filter -) => { - const startRun = async () => { - if (!globalConfig.listTests) { - preRunMessagePrint(outputStream); - } - return (0, _runJest.default)({ - changedFilesPromise, - contexts, - failedTestsCache: undefined, - filter, - globalConfig, - onComplete, - outputStream, - startRun, - testWatcher: new (_jestWatcher().TestWatcher)({ - isWatchMode: false - }) - }); - }; - return startRun(); -}; diff --git a/node_modules/@jest/core/build/collectHandles.js b/node_modules/@jest/core/build/collectHandles.js deleted file mode 100644 index e223ef5f2..000000000 --- a/node_modules/@jest/core/build/collectHandles.js +++ /dev/null @@ -1,266 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = collectHandles; -exports.formatHandleErrors = formatHandleErrors; -function asyncHooks() { - const data = _interopRequireWildcard(require('async_hooks')); - asyncHooks = function () { - return data; - }; - return data; -} -function _util() { - const data = require('util'); - _util = function () { - return data; - }; - return data; -} -function v8() { - const data = _interopRequireWildcard(require('v8')); - v8 = function () { - return data; - }; - return data; -} -function vm() { - const data = _interopRequireWildcard(require('vm')); - vm = function () { - return data; - }; - return data; -} -function _stripAnsi() { - const data = _interopRequireDefault(require('strip-ansi')); - _stripAnsi = function () { - return data; - }; - return data; -} -function _jestMessageUtil() { - const data = require('jest-message-util'); - _jestMessageUtil = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* eslint-disable local/ban-types-eventually */ - -function stackIsFromUser(stack) { - // Either the test file, or something required by it - if (stack.includes('Runtime.requireModule')) { - return true; - } - - // jest-jasmine it or describe call - if (stack.includes('asyncJestTest') || stack.includes('asyncJestLifecycle')) { - return true; - } - - // An async function call from within circus - if (stack.includes('callAsyncCircusFn')) { - // jest-circus it or describe call - return ( - stack.includes('_callCircusTest') || stack.includes('_callCircusHook') - ); - } - return false; -} -const alwaysActive = () => true; - -// @ts-expect-error: doesn't exist in v12 typings -const hasWeakRef = typeof WeakRef === 'function'; -const asyncSleep = (0, _util().promisify)(setTimeout); -let gcFunc = globalThis.gc; -function runGC() { - if (!gcFunc) { - v8().setFlagsFromString('--expose-gc'); - gcFunc = vm().runInNewContext('gc'); - v8().setFlagsFromString('--no-expose-gc'); - if (!gcFunc) { - throw new Error( - 'Cannot find `global.gc` function. Please run node with `--expose-gc` and report this issue in jest repo.' - ); - } - } - gcFunc(); -} - -// Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js -// Extracted as we want to format the result ourselves -function collectHandles() { - const activeHandles = new Map(); - const hook = asyncHooks().createHook({ - destroy(asyncId) { - activeHandles.delete(asyncId); - }, - init: function initHook(asyncId, type, triggerAsyncId, resource) { - // Skip resources that should not generally prevent the process from - // exiting, not last a meaningfully long time, or otherwise shouldn't be - // tracked. - if ( - type === 'PROMISE' || - type === 'TIMERWRAP' || - type === 'ELDHISTOGRAM' || - type === 'PerformanceObserver' || - type === 'RANDOMBYTESREQUEST' || - type === 'DNSCHANNEL' || - type === 'ZLIB' || - type === 'SIGNREQUEST' - ) { - return; - } - const error = new (_jestUtil().ErrorWithStack)(type, initHook, 100); - let fromUser = stackIsFromUser(error.stack || ''); - - // If the async resource was not directly created by user code, but was - // triggered by another async resource from user code, track it and use - // the original triggering resource's stack. - if (!fromUser) { - const triggeringHandle = activeHandles.get(triggerAsyncId); - if (triggeringHandle) { - fromUser = true; - error.stack = triggeringHandle.error.stack; - } - } - if (fromUser) { - let isActive; - - // Handle that supports hasRef - if ('hasRef' in resource) { - if (hasWeakRef) { - // @ts-expect-error: doesn't exist in v12 typings - const ref = new WeakRef(resource); - isActive = () => { - return ref.deref()?.hasRef() ?? false; - }; - } else { - isActive = resource.hasRef.bind(resource); - } - } else { - // Handle that doesn't support hasRef - isActive = alwaysActive; - } - activeHandles.set(asyncId, { - error, - isActive - }); - } - } - }); - hook.enable(); - return async () => { - // Wait briefly for any async resources that have been queued for - // destruction to actually be destroyed. - // For example, Node.js TCP Servers are not destroyed until *after* their - // `close` callback runs. If someone finishes a test from the `close` - // callback, we will not yet have seen the resource be destroyed here. - await asyncSleep(100); - if (activeHandles.size > 0) { - // For some special objects such as `TLSWRAP`. - // Ref: https://github.com/facebook/jest/issues/11665 - runGC(); - await asyncSleep(0); - } - hook.disable(); - - // Get errors for every async resource still referenced at this moment - const result = Array.from(activeHandles.values()) - .filter(({isActive}) => isActive()) - .map(({error}) => error); - activeHandles.clear(); - return result; - }; -} -function formatHandleErrors(errors, config) { - const stacks = new Set(); - return ( - errors - .map(err => - (0, _jestMessageUtil().formatExecError)( - err, - config, - { - noStackTrace: false - }, - undefined, - true - ) - ) - // E.g. timeouts might give multiple traces to the same line of code - // This hairy filtering tries to remove entries with duplicate stack traces - .filter(handle => { - const ansiFree = (0, _stripAnsi().default)(handle); - const match = ansiFree.match(/\s+at(.*)/); - if (!match || match.length < 2) { - return true; - } - const stack = ansiFree.substr(ansiFree.indexOf(match[1])).trim(); - if (stacks.has(stack)) { - return false; - } - stacks.add(stack); - return true; - }) - ); -} diff --git a/node_modules/@jest/core/build/getChangedFilesPromise.js b/node_modules/@jest/core/build/getChangedFilesPromise.js deleted file mode 100644 index aed28f569..000000000 --- a/node_modules/@jest/core/build/getChangedFilesPromise.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getChangedFilesPromise; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestChangedFiles() { - const data = require('jest-changed-files'); - _jestChangedFiles = function () { - return data; - }; - return data; -} -function _jestMessageUtil() { - const data = require('jest-message-util'); - _jestMessageUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getChangedFilesPromise(globalConfig, configs) { - if (globalConfig.onlyChanged) { - const allRootsForAllProjects = configs.reduce((roots, config) => { - if (config.roots) { - roots.push(...config.roots); - } - return roots; - }, []); - return (0, _jestChangedFiles().getChangedFilesForRoots)( - allRootsForAllProjects, - { - changedSince: globalConfig.changedSince, - lastCommit: globalConfig.lastCommit, - withAncestor: globalConfig.changedFilesWithAncestor - } - ).catch(e => { - const message = (0, _jestMessageUtil().formatExecError)(e, configs[0], { - noStackTrace: true - }) - .split('\n') - .filter(line => !line.includes('Command failed:')) - .join('\n'); - console.error(_chalk().default.red(`\n\n${message}`)); - process.exit(1); - }); - } - return undefined; -} diff --git a/node_modules/@jest/core/build/getConfigsOfProjectsToRun.js b/node_modules/@jest/core/build/getConfigsOfProjectsToRun.js deleted file mode 100644 index c07702ecc..000000000 --- a/node_modules/@jest/core/build/getConfigsOfProjectsToRun.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getConfigsOfProjectsToRun; -var _getProjectDisplayName = _interopRequireDefault( - require('./getProjectDisplayName') -); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getConfigsOfProjectsToRun(projectConfigs, opts) { - const projectFilter = createProjectFilter(opts); - return projectConfigs.filter(config => { - const name = (0, _getProjectDisplayName.default)(config); - return projectFilter(name); - }); -} -function createProjectFilter(opts) { - const {selectProjects, ignoreProjects} = opts; - const always = () => true; - const selected = selectProjects - ? name => name && selectProjects.includes(name) - : always; - const notIgnore = ignoreProjects - ? name => !(name && ignoreProjects.includes(name)) - : always; - function test(name) { - return selected(name) && notIgnore(name); - } - return test; -} diff --git a/node_modules/@jest/core/build/getNoTestFound.js b/node_modules/@jest/core/build/getNoTestFound.js deleted file mode 100644 index 0d03163ba..000000000 --- a/node_modules/@jest/core/build/getNoTestFound.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getNoTestFound; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -var _pluralize = _interopRequireDefault(require('./pluralize')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getNoTestFound(testRunData, globalConfig, willExitWith0) { - const testFiles = testRunData.reduce( - (current, testRun) => current + (testRun.matches.total || 0), - 0 - ); - let dataMessage; - if (globalConfig.runTestsByPath) { - dataMessage = `Files: ${globalConfig.nonFlagArgs - .map(p => `"${p}"`) - .join(', ')}`; - } else { - dataMessage = `Pattern: ${_chalk().default.yellow( - globalConfig.testPathPattern - )} - 0 matches`; - } - if (willExitWith0) { - return ( - `${_chalk().default.bold('No tests found, exiting with code 0')}\n` + - `In ${_chalk().default.bold(globalConfig.rootDir)}` + - '\n' + - ` ${(0, _pluralize.default)('file', testFiles, 's')} checked across ${(0, - _pluralize.default)( - 'project', - testRunData.length, - 's' - )}. Run with \`--verbose\` for more details.` + - `\n${dataMessage}` - ); - } - return ( - `${_chalk().default.bold('No tests found, exiting with code 1')}\n` + - 'Run with `--passWithNoTests` to exit with code 0' + - '\n' + - `In ${_chalk().default.bold(globalConfig.rootDir)}` + - '\n' + - ` ${(0, _pluralize.default)('file', testFiles, 's')} checked across ${(0, - _pluralize.default)( - 'project', - testRunData.length, - 's' - )}. Run with \`--verbose\` for more details.` + - `\n${dataMessage}` - ); -} diff --git a/node_modules/@jest/core/build/getNoTestFoundFailed.js b/node_modules/@jest/core/build/getNoTestFoundFailed.js deleted file mode 100644 index 1c8cc61c0..000000000 --- a/node_modules/@jest/core/build/getNoTestFoundFailed.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getNoTestFoundFailed; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getNoTestFoundFailed(globalConfig) { - let msg = _chalk().default.bold('No failed test found.'); - if (_jestUtil().isInteractive) { - msg += _chalk().default.dim( - `\n${ - globalConfig.watch - ? 'Press `f` to quit "only failed tests" mode.' - : 'Run Jest without `--onlyFailures` or with `--all` to run all tests.' - }` - ); - } - return msg; -} diff --git a/node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.js b/node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.js deleted file mode 100644 index b0c36287d..000000000 --- a/node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getNoTestFoundPassWithNoTests; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getNoTestFoundPassWithNoTests() { - return _chalk().default.bold('No tests found, exiting with code 0'); -} diff --git a/node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.js b/node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.js deleted file mode 100644 index 334561f14..000000000 --- a/node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getNoTestFoundRelatedToChangedFiles; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getNoTestFoundRelatedToChangedFiles(globalConfig) { - const ref = globalConfig.changedSince - ? `"${globalConfig.changedSince}"` - : 'last commit'; - let msg = _chalk().default.bold( - `No tests found related to files changed since ${ref}.` - ); - if (_jestUtil().isInteractive) { - msg += _chalk().default.dim( - `\n${ - globalConfig.watch - ? 'Press `a` to run all tests, or run Jest with `--watchAll`.' - : 'Run Jest without `-o` or with `--all` to run all tests.' - }` - ); - } - return msg; -} diff --git a/node_modules/@jest/core/build/getNoTestFoundVerbose.js b/node_modules/@jest/core/build/getNoTestFoundVerbose.js deleted file mode 100644 index 1970086df..000000000 --- a/node_modules/@jest/core/build/getNoTestFoundVerbose.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getNoTestFoundVerbose; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -var _pluralize = _interopRequireDefault(require('./pluralize')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getNoTestFoundVerbose(testRunData, globalConfig, willExitWith0) { - const individualResults = testRunData.map(testRun => { - const stats = testRun.matches.stats || {}; - const config = testRun.context.config; - const statsMessage = Object.keys(stats) - .map(key => { - if (key === 'roots' && config.roots.length === 1) { - return null; - } - const value = config[key]; - if (value) { - const valueAsString = Array.isArray(value) - ? value.join(', ') - : String(value); - const matches = (0, _pluralize.default)( - 'match', - stats[key] || 0, - 'es' - ); - return ` ${key}: ${_chalk().default.yellow( - valueAsString - )} - ${matches}`; - } - return null; - }) - .filter(line => line) - .join('\n'); - return testRun.matches.total - ? `In ${_chalk().default.bold(config.rootDir)}\n` + - ` ${(0, _pluralize.default)( - 'file', - testRun.matches.total || 0, - 's' - )} checked.\n${statsMessage}` - : `No files found in ${config.rootDir}.\n` + - "Make sure Jest's configuration does not exclude this directory." + - '\nTo set up Jest, make sure a package.json file exists.\n' + - 'Jest Documentation: ' + - 'https://jestjs.io/docs/configuration'; - }); - let dataMessage; - if (globalConfig.runTestsByPath) { - dataMessage = `Files: ${globalConfig.nonFlagArgs - .map(p => `"${p}"`) - .join(', ')}`; - } else { - dataMessage = `Pattern: ${_chalk().default.yellow( - globalConfig.testPathPattern - )} - 0 matches`; - } - if (willExitWith0) { - return `${_chalk().default.bold( - 'No tests found, exiting with code 0' - )}\n${individualResults.join('\n')}\n${dataMessage}`; - } - return ( - `${_chalk().default.bold('No tests found, exiting with code 1')}\n` + - 'Run with `--passWithNoTests` to exit with code 0' + - `\n${individualResults.join('\n')}\n${dataMessage}` - ); -} diff --git a/node_modules/@jest/core/build/getNoTestsFoundMessage.js b/node_modules/@jest/core/build/getNoTestsFoundMessage.js deleted file mode 100644 index 60f09a215..000000000 --- a/node_modules/@jest/core/build/getNoTestsFoundMessage.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getNoTestsFoundMessage; -var _getNoTestFound = _interopRequireDefault(require('./getNoTestFound')); -var _getNoTestFoundFailed = _interopRequireDefault( - require('./getNoTestFoundFailed') -); -var _getNoTestFoundPassWithNoTests = _interopRequireDefault( - require('./getNoTestFoundPassWithNoTests') -); -var _getNoTestFoundRelatedToChangedFiles = _interopRequireDefault( - require('./getNoTestFoundRelatedToChangedFiles') -); -var _getNoTestFoundVerbose = _interopRequireDefault( - require('./getNoTestFoundVerbose') -); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getNoTestsFoundMessage(testRunData, globalConfig) { - const exitWith0 = - globalConfig.passWithNoTests || - globalConfig.lastCommit || - globalConfig.onlyChanged; - if (globalConfig.onlyFailures) { - return { - exitWith0, - message: (0, _getNoTestFoundFailed.default)(globalConfig) - }; - } - if (globalConfig.onlyChanged) { - return { - exitWith0, - message: (0, _getNoTestFoundRelatedToChangedFiles.default)(globalConfig) - }; - } - if (globalConfig.passWithNoTests) { - return { - exitWith0, - message: (0, _getNoTestFoundPassWithNoTests.default)() - }; - } - return { - exitWith0, - message: - testRunData.length === 1 || globalConfig.verbose - ? (0, _getNoTestFoundVerbose.default)( - testRunData, - globalConfig, - exitWith0 - ) - : (0, _getNoTestFound.default)(testRunData, globalConfig, exitWith0) - }; -} diff --git a/node_modules/@jest/core/build/getProjectDisplayName.js b/node_modules/@jest/core/build/getProjectDisplayName.js deleted file mode 100644 index b5857033e..000000000 --- a/node_modules/@jest/core/build/getProjectDisplayName.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getProjectDisplayName; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getProjectDisplayName(projectConfig) { - return projectConfig.displayName?.name || undefined; -} diff --git a/node_modules/@jest/core/build/getProjectNamesMissingWarning.js b/node_modules/@jest/core/build/getProjectNamesMissingWarning.js deleted file mode 100644 index 6efed6377..000000000 --- a/node_modules/@jest/core/build/getProjectNamesMissingWarning.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getProjectNamesMissingWarning; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -var _getProjectDisplayName = _interopRequireDefault( - require('./getProjectDisplayName') -); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getProjectNamesMissingWarning(projectConfigs, opts) { - const numberOfProjectsWithoutAName = projectConfigs.filter( - config => !(0, _getProjectDisplayName.default)(config) - ).length; - if (numberOfProjectsWithoutAName === 0) { - return undefined; - } - const args = []; - if (opts.selectProjects) { - args.push('--selectProjects'); - } - if (opts.ignoreProjects) { - args.push('--ignoreProjects'); - } - return _chalk().default.yellow( - `You provided values for ${args.join(' and ')} but ${ - numberOfProjectsWithoutAName === 1 - ? 'a project does not have a name' - : `${numberOfProjectsWithoutAName} projects do not have a name` - }.\n` + - 'Set displayName in the config of all projects in order to disable this warning.\n' - ); -} diff --git a/node_modules/@jest/core/build/getSelectProjectsMessage.js b/node_modules/@jest/core/build/getSelectProjectsMessage.js deleted file mode 100644 index 5f3f0ad85..000000000 --- a/node_modules/@jest/core/build/getSelectProjectsMessage.js +++ /dev/null @@ -1,71 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getSelectProjectsMessage; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -var _getProjectDisplayName = _interopRequireDefault( - require('./getProjectDisplayName') -); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getSelectProjectsMessage(projectConfigs, opts) { - if (projectConfigs.length === 0) { - return getNoSelectionWarning(opts); - } - return getProjectsRunningMessage(projectConfigs); -} -function getNoSelectionWarning(opts) { - if (opts.ignoreProjects && opts.selectProjects) { - return _chalk().default.yellow( - 'You provided values for --selectProjects and --ignoreProjects, but no projects were found matching the selection.\n' + - 'Are you ignoring all the selected projects?\n' - ); - } else if (opts.ignoreProjects) { - return _chalk().default.yellow( - 'You provided values for --ignoreProjects, but no projects were found matching the selection.\n' + - 'Are you ignoring all projects?\n' - ); - } else if (opts.selectProjects) { - return _chalk().default.yellow( - 'You provided values for --selectProjects but no projects were found matching the selection.\n' - ); - } else { - return _chalk().default.yellow('No projects were found.\n'); - } -} -function getProjectsRunningMessage(projectConfigs) { - if (projectConfigs.length === 1) { - const name = - (0, _getProjectDisplayName.default)(projectConfigs[0]) ?? - ''; - return `Running one project: ${_chalk().default.bold(name)}\n`; - } - const projectsList = projectConfigs - .map(getProjectNameListElement) - .sort() - .join('\n'); - return `Running ${projectConfigs.length} projects:\n${projectsList}\n`; -} -function getProjectNameListElement(projectConfig) { - const name = (0, _getProjectDisplayName.default)(projectConfig); - const elementContent = name - ? _chalk().default.bold(name) - : ''; - return `- ${elementContent}`; -} diff --git a/node_modules/@jest/core/build/index.d.ts b/node_modules/@jest/core/build/index.d.ts deleted file mode 100644 index 19d9ba34d..000000000 --- a/node_modules/@jest/core/build/index.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import {AggregatedResult} from '@jest/test-result'; -import {BaseReporter} from '@jest/reporters'; -import type {ChangedFiles} from 'jest-changed-files'; -import type {Config} from '@jest/types'; -import {Reporter} from '@jest/reporters'; -import {ReporterContext} from '@jest/reporters'; -import {Test} from '@jest/test-result'; -import type {TestContext} from '@jest/test-result'; -import type {TestRunnerContext} from 'jest-runner'; -import type {TestWatcher} from 'jest-watcher'; - -export declare function createTestScheduler( - globalConfig: Config.GlobalConfig, - context: TestSchedulerContext, -): Promise; - -declare type Filter = (testPaths: Array) => Promise<{ - filtered: Array; -}>; - -declare type FilterResult = { - test: string; - message: string; -}; - -export declare function getVersion(): string; - -declare type ReporterConstructor = new ( - globalConfig: Config.GlobalConfig, - reporterConfig: Record, - reporterContext: ReporterContext, -) => BaseReporter; - -export declare function runCLI( - argv: Config.Argv, - projects: Array, -): Promise<{ - results: AggregatedResult; - globalConfig: Config.GlobalConfig; -}>; - -declare type SearchResult = { - noSCM?: boolean; - stats?: Stats; - collectCoverageFrom?: Set; - tests: Array; - total?: number; -}; - -export declare class SearchSource { - private readonly _context; - private _dependencyResolver; - private readonly _testPathCases; - constructor(context: TestContext); - private _getOrBuildDependencyResolver; - private _filterTestPathsWithStats; - private _getAllTestPaths; - isTestFilePath(path: string): boolean; - findMatchingTests(testPathPattern: string): SearchResult; - findRelatedTests( - allPaths: Set, - collectCoverage: boolean, - ): Promise; - findTestsByPaths(paths: Array): SearchResult; - findRelatedTestsFromPattern( - paths: Array, - collectCoverage: boolean, - ): Promise; - findTestRelatedToChangedFiles( - changedFilesInfo: ChangedFiles, - collectCoverage: boolean, - ): Promise; - private _getTestPaths; - filterPathsWin32(paths: Array): Array; - getTestPaths( - globalConfig: Config.GlobalConfig, - changedFiles?: ChangedFiles, - filter?: Filter, - ): Promise; - findRelatedSourcesFromTestsInChangedFiles( - changedFilesInfo: ChangedFiles, - ): Promise>; -} - -declare type Stats = { - roots: number; - testMatch: number; - testPathIgnorePatterns: number; - testRegex: number; - testPathPattern?: number; -}; - -declare class TestScheduler { - private readonly _context; - private readonly _dispatcher; - private readonly _globalConfig; - constructor(globalConfig: Config.GlobalConfig, context: TestSchedulerContext); - addReporter(reporter: Reporter): void; - removeReporter(reporterConstructor: ReporterConstructor): void; - scheduleTests( - tests: Array, - watcher: TestWatcher, - ): Promise; - private _partitionTests; - _setupReporters(): Promise; - private _addCustomReporter; - private _bailIfNeeded; -} - -declare type TestSchedulerContext = ReporterContext & TestRunnerContext; - -export {}; diff --git a/node_modules/@jest/core/build/index.js b/node_modules/@jest/core/build/index.js deleted file mode 100644 index e6a0fe59c..000000000 --- a/node_modules/@jest/core/build/index.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'SearchSource', { - enumerable: true, - get: function () { - return _SearchSource.default; - } -}); -Object.defineProperty(exports, 'createTestScheduler', { - enumerable: true, - get: function () { - return _TestScheduler.createTestScheduler; - } -}); -Object.defineProperty(exports, 'getVersion', { - enumerable: true, - get: function () { - return _version.default; - } -}); -Object.defineProperty(exports, 'runCLI', { - enumerable: true, - get: function () { - return _cli.runCLI; - } -}); -var _SearchSource = _interopRequireDefault(require('./SearchSource')); -var _TestScheduler = require('./TestScheduler'); -var _cli = require('./cli'); -var _version = _interopRequireDefault(require('./version')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/core/build/lib/activeFiltersMessage.js b/node_modules/@jest/core/build/lib/activeFiltersMessage.js deleted file mode 100644 index f17171b49..000000000 --- a/node_modules/@jest/core/build/lib/activeFiltersMessage.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const activeFilters = (globalConfig, delimiter = '\n') => { - const {testNamePattern, testPathPattern} = globalConfig; - if (testNamePattern || testPathPattern) { - const filters = [ - testPathPattern - ? _chalk().default.dim('filename ') + - _chalk().default.yellow(`/${testPathPattern}/`) - : null, - testNamePattern - ? _chalk().default.dim('test name ') + - _chalk().default.yellow(`/${testNamePattern}/`) - : null - ] - .filter(f => f) - .join(', '); - const messages = [ - `\n${_chalk().default.bold('Active Filters: ')}${filters}` - ]; - return messages.filter(message => !!message).join(delimiter); - } - return ''; -}; -var _default = activeFilters; -exports.default = _default; diff --git a/node_modules/@jest/core/build/lib/createContext.js b/node_modules/@jest/core/build/lib/createContext.js deleted file mode 100644 index 67d416d5a..000000000 --- a/node_modules/@jest/core/build/lib/createContext.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = createContext; -function _jestRuntime() { - const data = _interopRequireDefault(require('jest-runtime')); - _jestRuntime = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function createContext(config, {hasteFS, moduleMap}) { - return { - config, - hasteFS, - moduleMap, - resolver: _jestRuntime().default.createResolver(config, moduleMap) - }; -} diff --git a/node_modules/@jest/core/build/lib/handleDeprecationWarnings.js b/node_modules/@jest/core/build/lib/handleDeprecationWarnings.js deleted file mode 100644 index 7d4dc1b7b..000000000 --- a/node_modules/@jest/core/build/lib/handleDeprecationWarnings.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = handleDeprecationWarnings; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function handleDeprecationWarnings(pipe, stdin = process.stdin) { - return new Promise((resolve, reject) => { - if (typeof stdin.setRawMode === 'function') { - const messages = [ - _chalk().default.red('There are deprecation warnings.\n'), - `${_chalk().default.dim(' \u203A Press ')}Enter${_chalk().default.dim( - ' to continue.' - )}`, - `${_chalk().default.dim(' \u203A Press ')}Esc${_chalk().default.dim( - ' to exit.' - )}` - ]; - pipe.write(messages.join('\n')); - stdin.setRawMode(true); - stdin.resume(); - stdin.setEncoding('utf8'); - // this is a string since we set encoding above - stdin.on('data', key => { - if (key === _jestWatcher().KEYS.ENTER) { - resolve(); - } else if ( - [ - _jestWatcher().KEYS.ESCAPE, - _jestWatcher().KEYS.CONTROL_C, - _jestWatcher().KEYS.CONTROL_D - ].indexOf(key) !== -1 - ) { - reject(); - } - }); - } else { - resolve(); - } - }); -} diff --git a/node_modules/@jest/core/build/lib/isValidPath.js b/node_modules/@jest/core/build/lib/isValidPath.js deleted file mode 100644 index fd2f91ca7..000000000 --- a/node_modules/@jest/core/build/lib/isValidPath.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = isValidPath; -function _jestSnapshot() { - const data = require('jest-snapshot'); - _jestSnapshot = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function isValidPath(globalConfig, filePath) { - return ( - !filePath.includes(globalConfig.coverageDirectory) && - !(0, _jestSnapshot().isSnapshotPath)(filePath) - ); -} diff --git a/node_modules/@jest/core/build/lib/logDebugMessages.js b/node_modules/@jest/core/build/lib/logDebugMessages.js deleted file mode 100644 index ab8fd0fd8..000000000 --- a/node_modules/@jest/core/build/lib/logDebugMessages.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = logDebugMessages; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const VERSION = require('../../package.json').version; - -// if the output here changes, update `getConfig` in e2e/runJest.ts -function logDebugMessages(globalConfig, configs, outputStream) { - const output = { - configs, - globalConfig, - version: VERSION - }; - outputStream.write(`${JSON.stringify(output, null, ' ')}\n`); -} diff --git a/node_modules/@jest/core/build/lib/updateGlobalConfig.js b/node_modules/@jest/core/build/lib/updateGlobalConfig.js deleted file mode 100644 index 38bdc4fa8..000000000 --- a/node_modules/@jest/core/build/lib/updateGlobalConfig.js +++ /dev/null @@ -1,95 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = updateGlobalConfig; -function _jestRegexUtil() { - const data = require('jest-regex-util'); - _jestRegexUtil = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function updateGlobalConfig(globalConfig, options = {}) { - const newConfig = { - ...globalConfig - }; - if (options.mode === 'watch') { - newConfig.watch = true; - newConfig.watchAll = false; - } else if (options.mode === 'watchAll') { - newConfig.watch = false; - newConfig.watchAll = true; - } - if (options.testNamePattern !== undefined) { - newConfig.testNamePattern = options.testNamePattern || ''; - } - if (options.testPathPattern !== undefined) { - newConfig.testPathPattern = - (0, _jestRegexUtil().replacePathSepForRegex)(options.testPathPattern) || - ''; - } - newConfig.onlyChanged = - !newConfig.watchAll && - !newConfig.testNamePattern && - !newConfig.testPathPattern; - if (typeof options.bail === 'boolean') { - newConfig.bail = options.bail ? 1 : 0; - } else if (options.bail !== undefined) { - newConfig.bail = options.bail; - } - if (options.changedSince !== undefined) { - newConfig.changedSince = options.changedSince; - } - if (options.collectCoverage !== undefined) { - newConfig.collectCoverage = options.collectCoverage || false; - } - if (options.collectCoverageFrom !== undefined) { - newConfig.collectCoverageFrom = options.collectCoverageFrom; - } - if (options.coverageDirectory !== undefined) { - newConfig.coverageDirectory = options.coverageDirectory; - } - if (options.coverageReporters !== undefined) { - newConfig.coverageReporters = options.coverageReporters; - } - if (options.findRelatedTests !== undefined) { - newConfig.findRelatedTests = options.findRelatedTests; - } - if (options.nonFlagArgs !== undefined) { - newConfig.nonFlagArgs = options.nonFlagArgs; - } - if (options.noSCM) { - newConfig.noSCM = true; - } - if (options.notify !== undefined) { - newConfig.notify = options.notify || false; - } - if (options.notifyMode !== undefined) { - newConfig.notifyMode = options.notifyMode; - } - if (options.onlyFailures !== undefined) { - newConfig.onlyFailures = options.onlyFailures || false; - } - if (options.passWithNoTests !== undefined) { - newConfig.passWithNoTests = true; - } - if (options.reporters !== undefined) { - newConfig.reporters = options.reporters; - } - if (options.updateSnapshot !== undefined) { - newConfig.updateSnapshot = options.updateSnapshot; - } - if (options.verbose !== undefined) { - newConfig.verbose = options.verbose || false; - } - return Object.freeze(newConfig); -} diff --git a/node_modules/@jest/core/build/lib/watchPluginsHelpers.js b/node_modules/@jest/core/build/lib/watchPluginsHelpers.js deleted file mode 100644 index dc4d61b11..000000000 --- a/node_modules/@jest/core/build/lib/watchPluginsHelpers.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.getSortedUsageRows = exports.filterInteractivePlugins = void 0; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const filterInteractivePlugins = (watchPlugins, globalConfig) => { - const usageInfos = watchPlugins.map( - p => p.getUsageInfo && p.getUsageInfo(globalConfig) - ); - return watchPlugins.filter((_plugin, i) => { - const usageInfo = usageInfos[i]; - if (usageInfo) { - const {key} = usageInfo; - return !usageInfos.slice(i + 1).some(u => !!u && key === u.key); - } - return false; - }); -}; -exports.filterInteractivePlugins = filterInteractivePlugins; -function notEmpty(value) { - return value != null; -} -const getSortedUsageRows = (watchPlugins, globalConfig) => - filterInteractivePlugins(watchPlugins, globalConfig) - .sort((a, b) => { - if (a.isInternal && b.isInternal) { - // internal plugins in the order we specify them - return 0; - } - if (a.isInternal !== b.isInternal) { - // external plugins afterwards - return a.isInternal ? -1 : 1; - } - const usageInfoA = a.getUsageInfo && a.getUsageInfo(globalConfig); - const usageInfoB = b.getUsageInfo && b.getUsageInfo(globalConfig); - if (usageInfoA && usageInfoB) { - // external plugins in alphabetical order - return usageInfoA.key.localeCompare(usageInfoB.key); - } - return 0; - }) - .map(p => p.getUsageInfo && p.getUsageInfo(globalConfig)) - .filter(notEmpty); -exports.getSortedUsageRows = getSortedUsageRows; diff --git a/node_modules/@jest/core/build/plugins/FailedTestsInteractive.js b/node_modules/@jest/core/build/plugins/FailedTestsInteractive.js deleted file mode 100644 index 8e71740a1..000000000 --- a/node_modules/@jest/core/build/plugins/FailedTestsInteractive.js +++ /dev/null @@ -1,96 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -var _FailedTestsInteractiveMode = _interopRequireDefault( - require('../FailedTestsInteractiveMode') -); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class FailedTestsInteractivePlugin extends _jestWatcher().BaseWatchPlugin { - _failedTestAssertions; - _manager = new _FailedTestsInteractiveMode.default(this._stdout); - apply(hooks) { - hooks.onTestRunComplete(results => { - this._failedTestAssertions = this.getFailedTestAssertions(results); - if (this._manager.isActive()) this._manager.updateWithResults(results); - }); - } - getUsageInfo() { - if (this._failedTestAssertions?.length) { - return { - key: 'i', - prompt: 'run failing tests interactively' - }; - } - return null; - } - onKey(key) { - if (this._manager.isActive()) { - this._manager.put(key); - } - } - run(_, updateConfigAndRun) { - return new Promise(resolve => { - if ( - !this._failedTestAssertions || - this._failedTestAssertions.length === 0 - ) { - resolve(); - return; - } - this._manager.run(this._failedTestAssertions, failure => { - updateConfigAndRun({ - mode: 'watch', - testNamePattern: failure ? `^${failure.fullName}$` : '', - testPathPattern: failure?.path || '' - }); - if (!this._manager.isActive()) { - resolve(); - } - }); - }); - } - getFailedTestAssertions(results) { - const failedTestPaths = []; - if ( - // skip if no failed tests - results.numFailedTests === 0 || - // skip if missing test results - !results.testResults || - // skip if unmatched snapshots are present - results.snapshot.unmatched - ) { - return failedTestPaths; - } - results.testResults.forEach(testResult => { - testResult.testResults.forEach(result => { - if (result.status === 'failed') { - failedTestPaths.push({ - fullName: result.fullName, - path: testResult.testFilePath - }); - } - }); - }); - return failedTestPaths; - } -} -exports.default = FailedTestsInteractivePlugin; diff --git a/node_modules/@jest/core/build/plugins/Quit.js b/node_modules/@jest/core/build/plugins/Quit.js deleted file mode 100644 index d417abc7c..000000000 --- a/node_modules/@jest/core/build/plugins/Quit.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class QuitPlugin extends _jestWatcher().BaseWatchPlugin { - isInternal; - constructor(options) { - super(options); - this.isInternal = true; - } - async run() { - if (typeof this._stdin.setRawMode === 'function') { - this._stdin.setRawMode(false); - } - this._stdout.write('\n'); - process.exit(0); - } - getUsageInfo() { - return { - key: 'q', - prompt: 'quit watch mode' - }; - } -} -var _default = QuitPlugin; -exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/TestNamePattern.js b/node_modules/@jest/core/build/plugins/TestNamePattern.js deleted file mode 100644 index f959b5668..000000000 --- a/node_modules/@jest/core/build/plugins/TestNamePattern.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -var _TestNamePatternPrompt = _interopRequireDefault( - require('../TestNamePatternPrompt') -); -var _activeFiltersMessage = _interopRequireDefault( - require('../lib/activeFiltersMessage') -); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class TestNamePatternPlugin extends _jestWatcher().BaseWatchPlugin { - _prompt; - isInternal; - constructor(options) { - super(options); - this._prompt = new (_jestWatcher().Prompt)(); - this.isInternal = true; - } - getUsageInfo() { - return { - key: 't', - prompt: 'filter by a test name regex pattern' - }; - } - onKey(key) { - this._prompt.put(key); - } - run(globalConfig, updateConfigAndRun) { - return new Promise((res, rej) => { - const testNamePatternPrompt = new _TestNamePatternPrompt.default( - this._stdout, - this._prompt - ); - testNamePatternPrompt.run( - value => { - updateConfigAndRun({ - mode: 'watch', - testNamePattern: value - }); - res(); - }, - rej, - { - header: (0, _activeFiltersMessage.default)(globalConfig) - } - ); - }); - } -} -var _default = TestNamePatternPlugin; -exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/TestPathPattern.js b/node_modules/@jest/core/build/plugins/TestPathPattern.js deleted file mode 100644 index 10c4ccfe7..000000000 --- a/node_modules/@jest/core/build/plugins/TestPathPattern.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -var _TestPathPatternPrompt = _interopRequireDefault( - require('../TestPathPatternPrompt') -); -var _activeFiltersMessage = _interopRequireDefault( - require('../lib/activeFiltersMessage') -); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class TestPathPatternPlugin extends _jestWatcher().BaseWatchPlugin { - _prompt; - isInternal; - constructor(options) { - super(options); - this._prompt = new (_jestWatcher().Prompt)(); - this.isInternal = true; - } - getUsageInfo() { - return { - key: 'p', - prompt: 'filter by a filename regex pattern' - }; - } - onKey(key) { - this._prompt.put(key); - } - run(globalConfig, updateConfigAndRun) { - return new Promise((res, rej) => { - const testPathPatternPrompt = new _TestPathPatternPrompt.default( - this._stdout, - this._prompt - ); - testPathPatternPrompt.run( - value => { - updateConfigAndRun({ - mode: 'watch', - testPathPattern: value - }); - res(); - }, - rej, - { - header: (0, _activeFiltersMessage.default)(globalConfig) - } - ); - }); - } -} -var _default = TestPathPatternPlugin; -exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshots.js b/node_modules/@jest/core/build/plugins/UpdateSnapshots.js deleted file mode 100644 index 17a8d15be..000000000 --- a/node_modules/@jest/core/build/plugins/UpdateSnapshots.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class UpdateSnapshotsPlugin extends _jestWatcher().BaseWatchPlugin { - _hasSnapshotFailure; - isInternal; - constructor(options) { - super(options); - this.isInternal = true; - this._hasSnapshotFailure = false; - } - run(_globalConfig, updateConfigAndRun) { - updateConfigAndRun({ - updateSnapshot: 'all' - }); - return Promise.resolve(false); - } - apply(hooks) { - hooks.onTestRunComplete(results => { - this._hasSnapshotFailure = results.snapshot.failure; - }); - } - getUsageInfo() { - if (this._hasSnapshotFailure) { - return { - key: 'u', - prompt: 'update failing snapshots' - }; - } - return null; - } -} -var _default = UpdateSnapshotsPlugin; -exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.js b/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.js deleted file mode 100644 index d21821e36..000000000 --- a/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.js +++ /dev/null @@ -1,99 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -var _SnapshotInteractiveMode = _interopRequireDefault( - require('../SnapshotInteractiveMode') -); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* eslint-disable local/ban-types-eventually */ - -class UpdateSnapshotInteractivePlugin extends _jestWatcher().BaseWatchPlugin { - _snapshotInteractiveMode = new _SnapshotInteractiveMode.default(this._stdout); - _failedSnapshotTestAssertions = []; - isInternal = true; - getFailedSnapshotTestAssertions(testResults) { - const failedTestPaths = []; - if (testResults.numFailedTests === 0 || !testResults.testResults) { - return failedTestPaths; - } - testResults.testResults.forEach(testResult => { - if (testResult.snapshot && testResult.snapshot.unmatched) { - testResult.testResults.forEach(result => { - if (result.status === 'failed') { - failedTestPaths.push({ - fullName: result.fullName, - path: testResult.testFilePath - }); - } - }); - } - }); - return failedTestPaths; - } - apply(hooks) { - hooks.onTestRunComplete(results => { - this._failedSnapshotTestAssertions = - this.getFailedSnapshotTestAssertions(results); - if (this._snapshotInteractiveMode.isActive()) { - this._snapshotInteractiveMode.updateWithResults(results); - } - }); - } - onKey(key) { - if (this._snapshotInteractiveMode.isActive()) { - this._snapshotInteractiveMode.put(key); - } - } - run(_globalConfig, updateConfigAndRun) { - if (this._failedSnapshotTestAssertions.length) { - return new Promise(res => { - this._snapshotInteractiveMode.run( - this._failedSnapshotTestAssertions, - (assertion, shouldUpdateSnapshot) => { - updateConfigAndRun({ - mode: 'watch', - testNamePattern: assertion ? `^${assertion.fullName}$` : '', - testPathPattern: assertion ? assertion.path : '', - updateSnapshot: shouldUpdateSnapshot ? 'all' : 'none' - }); - if (!this._snapshotInteractiveMode.isActive()) { - res(); - } - } - ); - }); - } else { - return Promise.resolve(); - } - } - getUsageInfo() { - if (this._failedSnapshotTestAssertions?.length > 0) { - return { - key: 'i', - prompt: 'update failing snapshots interactively' - }; - } - return null; - } -} -var _default = UpdateSnapshotInteractivePlugin; -exports.default = _default; diff --git a/node_modules/@jest/core/build/pluralize.js b/node_modules/@jest/core/build/pluralize.js deleted file mode 100644 index c0f66fbf3..000000000 --- a/node_modules/@jest/core/build/pluralize.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = pluralize; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function pluralize(word, count, ending) { - return `${count} ${word}${count === 1 ? '' : ending}`; -} diff --git a/node_modules/@jest/core/build/runGlobalHook.js b/node_modules/@jest/core/build/runGlobalHook.js deleted file mode 100644 index c6c0f7ce7..000000000 --- a/node_modules/@jest/core/build/runGlobalHook.js +++ /dev/null @@ -1,126 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = runGlobalHook; -function util() { - const data = _interopRequireWildcard(require('util')); - util = function () { - return data; - }; - return data; -} -function _transform() { - const data = require('@jest/transform'); - _transform = function () { - return data; - }; - return data; -} -function _prettyFormat() { - const data = _interopRequireDefault(require('pretty-format')); - _prettyFormat = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -async function runGlobalHook({allTests, globalConfig, moduleName}) { - const globalModulePaths = new Set( - allTests.map(test => test.context.config[moduleName]) - ); - if (globalConfig[moduleName]) { - globalModulePaths.add(globalConfig[moduleName]); - } - if (globalModulePaths.size > 0) { - for (const modulePath of globalModulePaths) { - if (!modulePath) { - continue; - } - const correctConfig = allTests.find( - t => t.context.config[moduleName] === modulePath - ); - const projectConfig = correctConfig - ? correctConfig.context.config - : // Fallback to first config - allTests[0].context.config; - const transformer = await (0, _transform().createScriptTransformer)( - projectConfig - ); - try { - await transformer.requireAndTranspileModule( - modulePath, - async globalModule => { - if (typeof globalModule !== 'function') { - throw new TypeError( - `${moduleName} file must export a function at ${modulePath}` - ); - } - await globalModule(globalConfig, projectConfig); - } - ); - } catch (error) { - if (util().types.isNativeError(error)) { - error.message = `Jest: Got error running ${moduleName} - ${modulePath}, reason: ${error.message}`; - throw error; - } - throw new Error( - `Jest: Got error running ${moduleName} - ${modulePath}, reason: ${(0, - _prettyFormat().default)(error, { - maxDepth: 3 - })}` - ); - } - } - } -} diff --git a/node_modules/@jest/core/build/runJest.js b/node_modules/@jest/core/build/runJest.js deleted file mode 100644 index 039ef5799..000000000 --- a/node_modules/@jest/core/build/runJest.js +++ /dev/null @@ -1,391 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = runJest; -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function _perf_hooks() { - const data = require('perf_hooks'); - _perf_hooks = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _exit() { - const data = _interopRequireDefault(require('exit')); - _exit = function () { - return data; - }; - return data; -} -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - fs = function () { - return data; - }; - return data; -} -function _console() { - const data = require('@jest/console'); - _console = function () { - return data; - }; - return data; -} -function _testResult() { - const data = require('@jest/test-result'); - _testResult = function () { - return data; - }; - return data; -} -function _jestResolve() { - const data = _interopRequireDefault(require('jest-resolve')); - _jestResolve = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -var _SearchSource = _interopRequireDefault(require('./SearchSource')); -var _TestScheduler = require('./TestScheduler'); -var _collectHandles = _interopRequireDefault(require('./collectHandles')); -var _getNoTestsFoundMessage = _interopRequireDefault( - require('./getNoTestsFoundMessage') -); -var _runGlobalHook = _interopRequireDefault(require('./runGlobalHook')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const getTestPaths = async ( - globalConfig, - source, - outputStream, - changedFiles, - jestHooks, - filter -) => { - const data = await source.getTestPaths(globalConfig, changedFiles, filter); - if (!data.tests.length && globalConfig.onlyChanged && data.noSCM) { - new (_console().CustomConsole)(outputStream, outputStream).log( - 'Jest can only find uncommitted changed files in a git or hg ' + - 'repository. If you make your project a git or hg ' + - 'repository (`git init` or `hg init`), Jest will be able ' + - 'to only run tests related to files changed since the last ' + - 'commit.' - ); - } - const shouldTestArray = await Promise.all( - data.tests.map(test => - jestHooks.shouldRunTestSuite({ - config: test.context.config, - duration: test.duration, - testPath: test.path - }) - ) - ); - const filteredTests = data.tests.filter((_test, i) => shouldTestArray[i]); - return { - ...data, - allTests: filteredTests.length, - tests: filteredTests - }; -}; -const processResults = async (runResults, options) => { - const { - outputFile, - json: isJSON, - onComplete, - outputStream, - testResultsProcessor, - collectHandles - } = options; - if (collectHandles) { - runResults.openHandles = await collectHandles(); - } else { - runResults.openHandles = []; - } - if (testResultsProcessor) { - const processor = await (0, _jestUtil().requireOrImportModule)( - testResultsProcessor - ); - runResults = await processor(runResults); - } - if (isJSON) { - if (outputFile) { - const cwd = (0, _jestUtil().tryRealpath)(process.cwd()); - const filePath = path().resolve(cwd, outputFile); - fs().writeFileSync( - filePath, - `${JSON.stringify((0, _testResult().formatTestResults)(runResults))}\n` - ); - outputStream.write( - `Test results written to: ${path().relative(cwd, filePath)}\n` - ); - } else { - process.stdout.write( - `${JSON.stringify((0, _testResult().formatTestResults)(runResults))}\n` - ); - } - } - onComplete?.(runResults); -}; -const testSchedulerContext = { - firstRun: true, - previousSuccess: true -}; -async function runJest({ - contexts, - globalConfig, - outputStream, - testWatcher, - jestHooks = new (_jestWatcher().JestHook)().getEmitter(), - startRun, - changedFilesPromise, - onComplete, - failedTestsCache, - filter -}) { - // Clear cache for required modules - there might be different resolutions - // from Jest's config loading to running the tests - _jestResolve().default.clearDefaultResolverCache(); - const Sequencer = await (0, _jestUtil().requireOrImportModule)( - globalConfig.testSequencer - ); - const sequencer = new Sequencer(); - let allTests = []; - if (changedFilesPromise && globalConfig.watch) { - const {repos} = await changedFilesPromise; - const noSCM = Object.keys(repos).every(scm => repos[scm].size === 0); - if (noSCM) { - process.stderr.write( - `\n${_chalk().default.bold( - '--watch' - )} is not supported without git/hg, please use --watchAll\n` - ); - (0, _exit().default)(1); - } - } - const searchSources = contexts.map( - context => new _SearchSource.default(context) - ); - _perf_hooks().performance.mark('jest/getTestPaths:start'); - const testRunData = await Promise.all( - contexts.map(async (context, index) => { - const searchSource = searchSources[index]; - const matches = await getTestPaths( - globalConfig, - searchSource, - outputStream, - changedFilesPromise && (await changedFilesPromise), - jestHooks, - filter - ); - allTests = allTests.concat(matches.tests); - return { - context, - matches - }; - }) - ); - _perf_hooks().performance.mark('jest/getTestPaths:end'); - if (globalConfig.shard) { - if (typeof sequencer.shard !== 'function') { - throw new Error( - `Shard ${globalConfig.shard.shardIndex}/${globalConfig.shard.shardCount} requested, but test sequencer ${Sequencer.name} in ${globalConfig.testSequencer} has no shard method.` - ); - } - allTests = await sequencer.shard(allTests, globalConfig.shard); - } - allTests = await sequencer.sort(allTests); - if (globalConfig.listTests) { - const testsPaths = Array.from(new Set(allTests.map(test => test.path))); - /* eslint-disable no-console */ - if (globalConfig.json) { - console.log(JSON.stringify(testsPaths)); - } else { - console.log(testsPaths.join('\n')); - } - /* eslint-enable */ - - onComplete && - onComplete((0, _testResult().makeEmptyAggregatedTestResult)()); - return; - } - if (globalConfig.onlyFailures) { - if (failedTestsCache) { - allTests = failedTestsCache.filterTests(allTests); - } else { - allTests = await sequencer.allFailedTests(allTests); - } - } - const hasTests = allTests.length > 0; - if (!hasTests) { - const {exitWith0, message: noTestsFoundMessage} = (0, - _getNoTestsFoundMessage.default)(testRunData, globalConfig); - if (exitWith0) { - new (_console().CustomConsole)(outputStream, outputStream).log( - noTestsFoundMessage - ); - } else { - new (_console().CustomConsole)(outputStream, outputStream).error( - noTestsFoundMessage - ); - (0, _exit().default)(1); - } - } else if ( - allTests.length === 1 && - globalConfig.silent !== true && - globalConfig.verbose !== false - ) { - const newConfig = { - ...globalConfig, - verbose: true - }; - globalConfig = Object.freeze(newConfig); - } - let collectHandles; - if (globalConfig.detectOpenHandles) { - collectHandles = (0, _collectHandles.default)(); - } - if (hasTests) { - _perf_hooks().performance.mark('jest/globalSetup:start'); - await (0, _runGlobalHook.default)({ - allTests, - globalConfig, - moduleName: 'globalSetup' - }); - _perf_hooks().performance.mark('jest/globalSetup:end'); - } - if (changedFilesPromise) { - const changedFilesInfo = await changedFilesPromise; - if (changedFilesInfo.changedFiles) { - testSchedulerContext.changedFiles = changedFilesInfo.changedFiles; - const sourcesRelatedToTestsInChangedFilesArray = ( - await Promise.all( - contexts.map(async (_, index) => { - const searchSource = searchSources[index]; - return searchSource.findRelatedSourcesFromTestsInChangedFiles( - changedFilesInfo - ); - }) - ) - ).reduce((total, paths) => total.concat(paths), []); - testSchedulerContext.sourcesRelatedToTestsInChangedFiles = new Set( - sourcesRelatedToTestsInChangedFilesArray - ); - } - } - const scheduler = await (0, _TestScheduler.createTestScheduler)( - globalConfig, - { - startRun, - ...testSchedulerContext - } - ); - - // @ts-expect-error - second arg is unsupported (but harmless) in Node 14 - _perf_hooks().performance.mark('jest/scheduleAndRun:start', { - detail: { - numTests: allTests.length - } - }); - const results = await scheduler.scheduleTests(allTests, testWatcher); - _perf_hooks().performance.mark('jest/scheduleAndRun:start'); - _perf_hooks().performance.mark('jest/cacheResults:start'); - sequencer.cacheResults(allTests, results); - _perf_hooks().performance.mark('jest/cacheResults:end'); - if (hasTests) { - _perf_hooks().performance.mark('jest/globalTeardown:start'); - await (0, _runGlobalHook.default)({ - allTests, - globalConfig, - moduleName: 'globalTeardown' - }); - _perf_hooks().performance.mark('jest/globalTeardown:end'); - } - _perf_hooks().performance.mark('jest/processResults:start'); - await processResults(results, { - collectHandles, - json: globalConfig.json, - onComplete, - outputFile: globalConfig.outputFile, - outputStream, - testResultsProcessor: globalConfig.testResultsProcessor - }); - _perf_hooks().performance.mark('jest/processResults:end'); -} diff --git a/node_modules/@jest/core/build/testSchedulerHelper.js b/node_modules/@jest/core/build/testSchedulerHelper.js deleted file mode 100644 index 4748174f0..000000000 --- a/node_modules/@jest/core/build/testSchedulerHelper.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.shouldRunInBand = shouldRunInBand; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const SLOW_TEST_TIME = 1000; -function shouldRunInBand( - tests, - timings, - {detectOpenHandles, maxWorkers, watch, watchAll, workerIdleMemoryLimit} -) { - // detectOpenHandles makes no sense without runInBand, because it cannot detect leaks in workers - if (detectOpenHandles) { - return true; - } - - /* - * Run in band if we only have one test or one worker available, unless we - * are using the watch mode, in which case the TTY has to be responsive and - * we cannot schedule anything in the main thread. Same logic applies to - * watchAll. - * Also, if we are confident from previous runs that the tests will finish - * quickly we also run in band to reduce the overhead of spawning workers. - * Finally, the user can provide the runInBand argument in the CLI to - * force running in band. - * https://github.com/facebook/jest/blob/700e0dadb85f5dc8ff5dac6c7e98956690049734/packages/jest-config/src/getMaxWorkers.js#L14-L17 - */ - const isWatchMode = watch || watchAll; - const areFastTests = timings.every(timing => timing < SLOW_TEST_TIME); - const oneWorkerOrLess = maxWorkers <= 1; - const oneTestOrLess = tests.length <= 1; - if (isWatchMode) { - return oneWorkerOrLess || (oneTestOrLess && areFastTests); - } - return ( - // When specifying a memory limit, workers should be used - !workerIdleMemoryLimit && - (oneWorkerOrLess || - oneTestOrLess || - (tests.length <= 20 && timings.length > 0 && areFastTests)) - ); -} diff --git a/node_modules/@jest/core/build/types.js b/node_modules/@jest/core/build/types.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/core/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/core/build/version.js b/node_modules/@jest/core/build/version.js deleted file mode 100644 index cb06e7fa8..000000000 --- a/node_modules/@jest/core/build/version.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getVersion; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// Cannot be `import` as it's not under TS root dir -const {version: VERSION} = require('../package.json'); -function getVersion() { - return VERSION; -} diff --git a/node_modules/@jest/core/build/watch.js b/node_modules/@jest/core/build/watch.js deleted file mode 100644 index a61af3ea0..000000000 --- a/node_modules/@jest/core/build/watch.js +++ /dev/null @@ -1,666 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = watch; -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function _ansiEscapes() { - const data = _interopRequireDefault(require('ansi-escapes')); - _ansiEscapes = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _exit() { - const data = _interopRequireDefault(require('exit')); - _exit = function () { - return data; - }; - return data; -} -function _slash() { - const data = _interopRequireDefault(require('slash')); - _slash = function () { - return data; - }; - return data; -} -function _jestMessageUtil() { - const data = require('jest-message-util'); - _jestMessageUtil = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _jestValidate() { - const data = require('jest-validate'); - _jestValidate = function () { - return data; - }; - return data; -} -function _jestWatcher() { - const data = require('jest-watcher'); - _jestWatcher = function () { - return data; - }; - return data; -} -var _FailedTestsCache = _interopRequireDefault(require('./FailedTestsCache')); -var _SearchSource = _interopRequireDefault(require('./SearchSource')); -var _getChangedFilesPromise = _interopRequireDefault( - require('./getChangedFilesPromise') -); -var _activeFiltersMessage = _interopRequireDefault( - require('./lib/activeFiltersMessage') -); -var _createContext = _interopRequireDefault(require('./lib/createContext')); -var _isValidPath = _interopRequireDefault(require('./lib/isValidPath')); -var _updateGlobalConfig = _interopRequireDefault( - require('./lib/updateGlobalConfig') -); -var _watchPluginsHelpers = require('./lib/watchPluginsHelpers'); -var _FailedTestsInteractive = _interopRequireDefault( - require('./plugins/FailedTestsInteractive') -); -var _Quit = _interopRequireDefault(require('./plugins/Quit')); -var _TestNamePattern = _interopRequireDefault( - require('./plugins/TestNamePattern') -); -var _TestPathPattern = _interopRequireDefault( - require('./plugins/TestPathPattern') -); -var _UpdateSnapshots = _interopRequireDefault( - require('./plugins/UpdateSnapshots') -); -var _UpdateSnapshotsInteractive = _interopRequireDefault( - require('./plugins/UpdateSnapshotsInteractive') -); -var _runJest = _interopRequireDefault(require('./runJest')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const {print: preRunMessagePrint} = _jestUtil().preRunMessage; -let hasExitListener = false; -const INTERNAL_PLUGINS = [ - _FailedTestsInteractive.default, - _TestPathPattern.default, - _TestNamePattern.default, - _UpdateSnapshots.default, - _UpdateSnapshotsInteractive.default, - _Quit.default -]; -const RESERVED_KEY_PLUGINS = new Map([ - [ - _UpdateSnapshots.default, - { - forbiddenOverwriteMessage: 'updating snapshots', - key: 'u' - } - ], - [ - _UpdateSnapshotsInteractive.default, - { - forbiddenOverwriteMessage: 'updating snapshots interactively', - key: 'i' - } - ], - [ - _Quit.default, - { - forbiddenOverwriteMessage: 'quitting watch mode' - } - ] -]); -async function watch( - initialGlobalConfig, - contexts, - outputStream, - hasteMapInstances, - stdin = process.stdin, - hooks = new (_jestWatcher().JestHook)(), - filter -) { - // `globalConfig` will be constantly updated and reassigned as a result of - // watch mode interactions. - let globalConfig = initialGlobalConfig; - let activePlugin; - globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { - mode: globalConfig.watch ? 'watch' : 'watchAll', - passWithNoTests: true - }); - const updateConfigAndRun = ({ - bail, - changedSince, - collectCoverage, - collectCoverageFrom, - coverageDirectory, - coverageReporters, - findRelatedTests, - mode, - nonFlagArgs, - notify, - notifyMode, - onlyFailures, - reporters, - testNamePattern, - testPathPattern, - updateSnapshot, - verbose - } = {}) => { - const previousUpdateSnapshot = globalConfig.updateSnapshot; - globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { - bail, - changedSince, - collectCoverage, - collectCoverageFrom, - coverageDirectory, - coverageReporters, - findRelatedTests, - mode, - nonFlagArgs, - notify, - notifyMode, - onlyFailures, - reporters, - testNamePattern, - testPathPattern, - updateSnapshot, - verbose - }); - startRun(globalConfig); - globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { - // updateSnapshot is not sticky after a run. - updateSnapshot: - previousUpdateSnapshot === 'all' ? 'none' : previousUpdateSnapshot - }); - }; - const watchPlugins = INTERNAL_PLUGINS.map( - InternalPlugin => - new InternalPlugin({ - stdin, - stdout: outputStream - }) - ); - watchPlugins.forEach(plugin => { - const hookSubscriber = hooks.getSubscriber(); - if (plugin.apply) { - plugin.apply(hookSubscriber); - } - }); - if (globalConfig.watchPlugins != null) { - const watchPluginKeys = new Map(); - for (const plugin of watchPlugins) { - const reservedInfo = RESERVED_KEY_PLUGINS.get(plugin.constructor) || {}; - const key = reservedInfo.key || getPluginKey(plugin, globalConfig); - if (!key) { - continue; - } - const {forbiddenOverwriteMessage} = reservedInfo; - watchPluginKeys.set(key, { - forbiddenOverwriteMessage, - overwritable: forbiddenOverwriteMessage == null, - plugin - }); - } - for (const pluginWithConfig of globalConfig.watchPlugins) { - let plugin; - try { - const ThirdPartyPlugin = await (0, _jestUtil().requireOrImportModule)( - pluginWithConfig.path - ); - plugin = new ThirdPartyPlugin({ - config: pluginWithConfig.config, - stdin, - stdout: outputStream - }); - } catch (error) { - const errorWithContext = new Error( - `Failed to initialize watch plugin "${_chalk().default.bold( - (0, _slash().default)( - path().relative(process.cwd(), pluginWithConfig.path) - ) - )}":\n\n${(0, _jestMessageUtil().formatExecError)( - error, - contexts[0].config, - { - noStackTrace: false - } - )}` - ); - delete errorWithContext.stack; - return Promise.reject(errorWithContext); - } - checkForConflicts(watchPluginKeys, plugin, globalConfig); - const hookSubscriber = hooks.getSubscriber(); - if (plugin.apply) { - plugin.apply(hookSubscriber); - } - watchPlugins.push(plugin); - } - } - const failedTestsCache = new _FailedTestsCache.default(); - let searchSources = contexts.map(context => ({ - context, - searchSource: new _SearchSource.default(context) - })); - let isRunning = false; - let testWatcher; - let shouldDisplayWatchUsage = true; - let isWatchUsageDisplayed = false; - const emitFileChange = () => { - if (hooks.isUsed('onFileChange')) { - const projects = searchSources.map(({context, searchSource}) => ({ - config: context.config, - testPaths: searchSource.findMatchingTests('').tests.map(t => t.path) - })); - hooks.getEmitter().onFileChange({ - projects - }); - } - }; - emitFileChange(); - hasteMapInstances.forEach((hasteMapInstance, index) => { - hasteMapInstance.on('change', ({eventsQueue, hasteFS, moduleMap}) => { - const validPaths = eventsQueue.filter(({filePath}) => - (0, _isValidPath.default)(globalConfig, filePath) - ); - if (validPaths.length) { - const context = (contexts[index] = (0, _createContext.default)( - contexts[index].config, - { - hasteFS, - moduleMap - } - )); - activePlugin = null; - searchSources = searchSources.slice(); - searchSources[index] = { - context, - searchSource: new _SearchSource.default(context) - }; - emitFileChange(); - startRun(globalConfig); - } - }); - }); - if (!hasExitListener) { - hasExitListener = true; - process.on('exit', () => { - if (activePlugin) { - outputStream.write(_ansiEscapes().default.cursorDown()); - outputStream.write(_ansiEscapes().default.eraseDown); - } - }); - } - const startRun = globalConfig => { - if (isRunning) { - return Promise.resolve(null); - } - testWatcher = new (_jestWatcher().TestWatcher)({ - isWatchMode: true - }); - _jestUtil().isInteractive && - outputStream.write(_jestUtil().specialChars.CLEAR); - preRunMessagePrint(outputStream); - isRunning = true; - const configs = contexts.map(context => context.config); - const changedFilesPromise = (0, _getChangedFilesPromise.default)( - globalConfig, - configs - ); - return (0, _runJest.default)({ - changedFilesPromise, - contexts, - failedTestsCache, - filter, - globalConfig, - jestHooks: hooks.getEmitter(), - onComplete: results => { - isRunning = false; - hooks.getEmitter().onTestRunComplete(results); - - // Create a new testWatcher instance so that re-runs won't be blocked. - // The old instance that was passed to Jest will still be interrupted - // and prevent test runs from the previous run. - testWatcher = new (_jestWatcher().TestWatcher)({ - isWatchMode: true - }); - - // Do not show any Watch Usage related stuff when running in a - // non-interactive environment - if (_jestUtil().isInteractive) { - if (shouldDisplayWatchUsage) { - outputStream.write(usage(globalConfig, watchPlugins)); - shouldDisplayWatchUsage = false; // hide Watch Usage after first run - isWatchUsageDisplayed = true; - } else { - outputStream.write(showToggleUsagePrompt()); - shouldDisplayWatchUsage = false; - isWatchUsageDisplayed = false; - } - } else { - outputStream.write('\n'); - } - failedTestsCache.setTestResults(results.testResults); - }, - outputStream, - startRun, - testWatcher - }).catch(error => - // Errors thrown inside `runJest`, e.g. by resolvers, are caught here for - // continuous watch mode execution. We need to reprint them to the - // terminal and give just a little bit of extra space so they fit below - // `preRunMessagePrint` message nicely. - console.error( - `\n\n${(0, _jestMessageUtil().formatExecError)( - error, - contexts[0].config, - { - noStackTrace: false - } - )}` - ) - ); - }; - const onKeypress = key => { - if ( - key === _jestWatcher().KEYS.CONTROL_C || - key === _jestWatcher().KEYS.CONTROL_D - ) { - if (typeof stdin.setRawMode === 'function') { - stdin.setRawMode(false); - } - outputStream.write('\n'); - (0, _exit().default)(0); - return; - } - if (activePlugin != null && activePlugin.onKey) { - // if a plugin is activate, Jest should let it handle keystrokes, so ignore - // them here - activePlugin.onKey(key); - return; - } - - // Abort test run - const pluginKeys = (0, _watchPluginsHelpers.getSortedUsageRows)( - watchPlugins, - globalConfig - ).map(usage => Number(usage.key).toString(16)); - if ( - isRunning && - testWatcher && - ['q', _jestWatcher().KEYS.ENTER, 'a', 'o', 'f'] - .concat(pluginKeys) - .includes(key) - ) { - testWatcher.setState({ - interrupted: true - }); - return; - } - const matchingWatchPlugin = (0, - _watchPluginsHelpers.filterInteractivePlugins)( - watchPlugins, - globalConfig - ).find(plugin => getPluginKey(plugin, globalConfig) === key); - if (matchingWatchPlugin != null) { - if (isRunning) { - testWatcher.setState({ - interrupted: true - }); - return; - } - // "activate" the plugin, which has jest ignore keystrokes so the plugin - // can handle them - activePlugin = matchingWatchPlugin; - if (activePlugin.run) { - activePlugin.run(globalConfig, updateConfigAndRun).then( - shouldRerun => { - activePlugin = null; - if (shouldRerun) { - updateConfigAndRun(); - } - }, - () => { - activePlugin = null; - onCancelPatternPrompt(); - } - ); - } else { - activePlugin = null; - } - } - switch (key) { - case _jestWatcher().KEYS.ENTER: - startRun(globalConfig); - break; - case 'a': - globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { - mode: 'watchAll', - testNamePattern: '', - testPathPattern: '' - }); - startRun(globalConfig); - break; - case 'c': - updateConfigAndRun({ - mode: 'watch', - testNamePattern: '', - testPathPattern: '' - }); - break; - case 'f': - globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { - onlyFailures: !globalConfig.onlyFailures - }); - startRun(globalConfig); - break; - case 'o': - globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { - mode: 'watch', - testNamePattern: '', - testPathPattern: '' - }); - startRun(globalConfig); - break; - case '?': - break; - case 'w': - if (!shouldDisplayWatchUsage && !isWatchUsageDisplayed) { - outputStream.write(_ansiEscapes().default.cursorUp()); - outputStream.write(_ansiEscapes().default.eraseDown); - outputStream.write(usage(globalConfig, watchPlugins)); - isWatchUsageDisplayed = true; - shouldDisplayWatchUsage = false; - } - break; - } - }; - const onCancelPatternPrompt = () => { - outputStream.write(_ansiEscapes().default.cursorHide); - outputStream.write(_jestUtil().specialChars.CLEAR); - outputStream.write(usage(globalConfig, watchPlugins)); - outputStream.write(_ansiEscapes().default.cursorShow); - }; - if (typeof stdin.setRawMode === 'function') { - stdin.setRawMode(true); - stdin.resume(); - stdin.setEncoding('utf8'); - stdin.on('data', onKeypress); - } - startRun(globalConfig); - return Promise.resolve(); -} -const checkForConflicts = (watchPluginKeys, plugin, globalConfig) => { - const key = getPluginKey(plugin, globalConfig); - if (!key) { - return; - } - const conflictor = watchPluginKeys.get(key); - if (!conflictor || conflictor.overwritable) { - watchPluginKeys.set(key, { - overwritable: false, - plugin - }); - return; - } - let error; - if (conflictor.forbiddenOverwriteMessage) { - error = ` - Watch plugin ${_chalk().default.bold.red( - getPluginIdentifier(plugin) - )} attempted to register key ${_chalk().default.bold.red(`<${key}>`)}, - that is reserved internally for ${_chalk().default.bold.red( - conflictor.forbiddenOverwriteMessage - )}. - Please change the configuration key for this plugin.`.trim(); - } else { - const plugins = [conflictor.plugin, plugin] - .map(p => _chalk().default.bold.red(getPluginIdentifier(p))) - .join(' and '); - error = ` - Watch plugins ${plugins} both attempted to register key ${_chalk().default.bold.red( - `<${key}>` - )}. - Please change the key configuration for one of the conflicting plugins to avoid overlap.`.trim(); - } - throw new (_jestValidate().ValidationError)( - 'Watch plugin configuration error', - error - ); -}; -const getPluginIdentifier = plugin => - // This breaks as `displayName` is not defined as a static, but since - // WatchPlugin is an interface, and it is my understanding interface - // static fields are not definable anymore, no idea how to circumvent - // this :-( - // @ts-expect-error: leave `displayName` be. - plugin.constructor.displayName || plugin.constructor.name; -const getPluginKey = (plugin, globalConfig) => { - if (typeof plugin.getUsageInfo === 'function') { - return ( - plugin.getUsageInfo(globalConfig) || { - key: null - } - ).key; - } - return null; -}; -const usage = (globalConfig, watchPlugins, delimiter = '\n') => { - const messages = [ - (0, _activeFiltersMessage.default)(globalConfig), - globalConfig.testPathPattern || globalConfig.testNamePattern - ? `${_chalk().default.dim(' \u203A Press ')}c${_chalk().default.dim( - ' to clear filters.' - )}` - : null, - `\n${_chalk().default.bold('Watch Usage')}`, - globalConfig.watch - ? `${_chalk().default.dim(' \u203A Press ')}a${_chalk().default.dim( - ' to run all tests.' - )}` - : null, - globalConfig.onlyFailures - ? `${_chalk().default.dim(' \u203A Press ')}f${_chalk().default.dim( - ' to quit "only failed tests" mode.' - )}` - : `${_chalk().default.dim(' \u203A Press ')}f${_chalk().default.dim( - ' to run only failed tests.' - )}`, - (globalConfig.watchAll || - globalConfig.testPathPattern || - globalConfig.testNamePattern) && - !globalConfig.noSCM - ? `${_chalk().default.dim(' \u203A Press ')}o${_chalk().default.dim( - ' to only run tests related to changed files.' - )}` - : null, - ...(0, _watchPluginsHelpers.getSortedUsageRows)( - watchPlugins, - globalConfig - ).map( - plugin => - `${_chalk().default.dim(' \u203A Press')} ${ - plugin.key - } ${_chalk().default.dim(`to ${plugin.prompt}.`)}` - ), - `${_chalk().default.dim(' \u203A Press ')}Enter${_chalk().default.dim( - ' to trigger a test run.' - )}` - ]; - return `${messages.filter(message => !!message).join(delimiter)}\n`; -}; -const showToggleUsagePrompt = () => - '\n' + - `${_chalk().default.bold('Watch Usage: ')}${_chalk().default.dim( - 'Press ' - )}w${_chalk().default.dim(' to show more.')}`; diff --git a/node_modules/@jest/core/package.json b/node_modules/@jest/core/package.json deleted file mode 100644 index 8a64c65e6..000000000 --- a/node_modules/@jest/core/package.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "@jest/core", - "description": "Delightful JavaScript Testing.", - "version": "29.5.0", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@jest/console": "^29.5.0", - "@jest/reporters": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.5.0", - "jest-config": "^29.5.0", - "jest-haste-map": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-regex-util": "^29.4.3", - "jest-resolve": "^29.5.0", - "jest-resolve-dependencies": "^29.5.0", - "jest-runner": "^29.5.0", - "jest-runtime": "^29.5.0", - "jest-snapshot": "^29.5.0", - "jest-util": "^29.5.0", - "jest-validate": "^29.5.0", - "jest-watcher": "^29.5.0", - "micromatch": "^4.0.4", - "pretty-format": "^29.5.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "devDependencies": { - "@jest/test-sequencer": "^29.5.0", - "@jest/test-utils": "^29.5.0", - "@types/exit": "^0.1.30", - "@types/graceful-fs": "^4.1.3", - "@types/micromatch": "^4.0.1" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-core" - }, - "bugs": { - "url": "https://github.com/facebook/jest/issues" - }, - "homepage": "https://jestjs.io/", - "license": "MIT", - "keywords": [ - "ava", - "babel", - "coverage", - "easy", - "expect", - "facebook", - "immersive", - "instant", - "jasmine", - "jest", - "jsdom", - "mocha", - "mocking", - "painless", - "qunit", - "runner", - "sandboxed", - "snapshot", - "tap", - "tape", - "test", - "testing", - "typescript", - "watch" - ], - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/environment/LICENSE b/node_modules/@jest/environment/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/environment/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/environment/build/index.d.ts b/node_modules/@jest/environment/build/index.d.ts deleted file mode 100644 index 1837e6ac0..000000000 --- a/node_modules/@jest/environment/build/index.d.ts +++ /dev/null @@ -1,418 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// - -import type {Circus} from '@jest/types'; -import type {Config} from '@jest/types'; -import type {Context} from 'vm'; -import type {Global} from '@jest/types'; -import type {LegacyFakeTimers} from '@jest/fake-timers'; -import type {Mocked} from 'jest-mock'; -import type {ModernFakeTimers} from '@jest/fake-timers'; -import type {ModuleMocker} from 'jest-mock'; - -export declare type EnvironmentContext = { - console: Console; - docblockPragmas: Record>; - testPath: string; -}; - -export declare interface Jest { - /** - * Advances all timers by `msToRun` milliseconds. All pending "macro-tasks" - * that have been queued via `setTimeout()` or `setInterval()`, and would be - * executed within this time frame will be executed. - */ - advanceTimersByTime(msToRun: number): void; - /** - * Advances all timers by `msToRun` milliseconds, firing callbacks if necessary. - * - * @remarks - * Not available when using legacy fake timers implementation. - */ - advanceTimersByTimeAsync(msToRun: number): Promise; - /** - * Advances all timers by the needed milliseconds so that only the next - * timeouts/intervals will run. Optionally, you can provide steps, so it will - * run steps amount of next timeouts/intervals. - */ - advanceTimersToNextTimer(steps?: number): void; - /** - * Advances the clock to the the moment of the first scheduled timer, firing it. - * Optionally, you can provide steps, so it will run steps amount of - * next timeouts/intervals. - * - * @remarks - * Not available when using legacy fake timers implementation. - */ - advanceTimersToNextTimerAsync(steps?: number): Promise; - /** - * Disables automatic mocking in the module loader. - */ - autoMockOff(): Jest; - /** - * Enables automatic mocking in the module loader. - */ - autoMockOn(): Jest; - /** - * Clears the `mock.calls`, `mock.instances`, `mock.contexts` and `mock.results` properties of - * all mocks. Equivalent to calling `.mockClear()` on every mocked function. - */ - clearAllMocks(): Jest; - /** - * Removes any pending timers from the timer system. If any timers have been - * scheduled, they will be cleared and will never have the opportunity to - * execute in the future. - */ - clearAllTimers(): void; - /** - * Given the name of a module, use the automatic mocking system to generate a - * mocked version of the module for you. - * - * This is useful when you want to create a manual mock that extends the - * automatic mock's behavior. - */ - createMockFromModule(moduleName: string): Mocked; - /** - * Indicates that the module system should never return a mocked version of - * the specified module and its dependencies. - */ - deepUnmock(moduleName: string): Jest; - /** - * Disables automatic mocking in the module loader. - * - * After this method is called, all `require()`s will return the real - * versions of each module (rather than a mocked version). - */ - disableAutomock(): Jest; - /** - * When using `babel-jest`, calls to `jest.mock()` will automatically be hoisted - * to the top of the code block. Use this method if you want to explicitly - * avoid this behavior. - */ - doMock( - moduleName: string, - moduleFactory?: () => T, - options?: { - virtual?: boolean; - }, - ): Jest; - /** - * When using `babel-jest`, calls to `jest.unmock()` will automatically be hoisted - * to the top of the code block. Use this method if you want to explicitly - * avoid this behavior. - */ - dontMock(moduleName: string): Jest; - /** - * Enables automatic mocking in the module loader. - */ - enableAutomock(): Jest; - /** - * Creates a mock function. Optionally takes a mock implementation. - */ - fn: ModuleMocker['fn']; - /** - * Given the name of a module, use the automatic mocking system to generate a - * mocked version of the module for you. - * - * This is useful when you want to create a manual mock that extends the - * automatic mock's behavior. - * - * @deprecated Use `jest.createMockFromModule()` instead - */ - genMockFromModule(moduleName: string): Mocked; - /** - * When mocking time, `Date.now()` will also be mocked. If you for some reason - * need access to the real current time, you can invoke this function. - * - * @remarks - * Not available when using legacy fake timers implementation. - */ - getRealSystemTime(): number; - /** - * Retrieves the seed value. It will be randomly generated for each test run - * or can be manually set via the `--seed` CLI argument. - */ - getSeed(): number; - /** - * Returns the number of fake timers still left to run. - */ - getTimerCount(): number; - /** - * Returns `true` if test environment has been torn down. - * - * @example - * ```js - * if (jest.isEnvironmentTornDown()) { - * // The Jest environment has been torn down, so stop doing work - * return; - * } - * ``` - */ - isEnvironmentTornDown(): boolean; - /** - * Determines if the given function is a mocked function. - */ - isMockFunction: ModuleMocker['isMockFunction']; - /** - * `jest.isolateModules()` goes a step further than `jest.resetModules()` and - * creates a sandbox registry for the modules that are loaded inside the callback - * function. This is useful to isolate specific modules for every test so that - * local module state doesn't conflict between tests. - */ - isolateModules(fn: () => void): Jest; - /** - * `jest.isolateModulesAsync()` is the equivalent of `jest.isolateModules()`, but for - * async functions to be wrapped. The caller is expected to `await` the completion of - * `isolateModulesAsync`. - */ - isolateModulesAsync(fn: () => Promise): Promise; - /** - * Mocks a module with an auto-mocked version when it is being required. - */ - mock( - moduleName: string, - moduleFactory?: () => T, - options?: { - virtual?: boolean; - }, - ): Jest; - /** - * Mocks a module with the provided module factory when it is being imported. - */ - unstable_mockModule( - moduleName: string, - moduleFactory: () => T | Promise, - options?: { - virtual?: boolean; - }, - ): Jest; - /** - * Wraps types of the `source` object and its deep members with type definitions - * of Jest mock function. Pass `{shallow: true}` option to disable the deeply - * mocked behavior. - */ - mocked: ModuleMocker['mocked']; - /** - * Returns the current time in ms of the fake timer clock. - */ - now(): number; - /** - * Replaces property on an object with another value. - * - * @remarks - * For mocking functions or 'get' or 'set' accessors, use `jest.spyOn()` instead. - */ - replaceProperty: ModuleMocker['replaceProperty']; - /** - * Returns the actual module instead of a mock, bypassing all checks on - * whether the module should receive a mock implementation or not. - * - * @example - * ```js - * jest.mock('../myModule', () => { - * // Require the original module to not be mocked... - * const originalModule = jest.requireActual('../myModule'); - * - * return { - * __esModule: true, // Use it when dealing with esModules - * ...originalModule, - * getRandom: jest.fn().mockReturnValue(10), - * }; - * }); - * - * const getRandom = require('../myModule').getRandom; - * - * getRandom(); // Always returns 10 - * ``` - */ - requireActual(moduleName: string): T; - /** - * Returns a mock module instead of the actual module, bypassing all checks - * on whether the module should be required normally or not. - */ - requireMock(moduleName: string): T; - /** - * Resets the state of all mocks. Equivalent to calling `.mockReset()` on - * every mocked function. - */ - resetAllMocks(): Jest; - /** - * Resets the module registry - the cache of all required modules. This is - * useful to isolate modules where local state might conflict between tests. - */ - resetModules(): Jest; - /** - * Restores all mocks and replaced properties back to their original value. - * Equivalent to calling `.mockRestore()` on every mocked function - * and `.restore()` on every replaced property. - * - * Beware that `jest.restoreAllMocks()` only works when the mock was created - * with `jest.spyOn()`; other mocks will require you to manually restore them. - */ - restoreAllMocks(): Jest; - /** - * Runs failed tests n-times until they pass or until the max number of - * retries is exhausted. - * - * If `logErrorsBeforeRetry` is enabled, Jest will log the error(s) that caused - * the test to fail to the console, providing visibility on why a retry occurred. - * retries is exhausted. - * - * @remarks - * Only available with `jest-circus` runner. - */ - retryTimes( - numRetries: number, - options?: { - logErrorsBeforeRetry?: boolean; - }, - ): Jest; - /** - * Exhausts tasks queued by `setImmediate()`. - * - * @remarks - * Only available when using legacy fake timers implementation. - */ - runAllImmediates(): void; - /** - * Exhausts the micro-task queue (usually interfaced in node via - * `process.nextTick()`). - */ - runAllTicks(): void; - /** - * Exhausts the macro-task queue (i.e., all tasks queued by `setTimeout()` - * and `setInterval()`). - */ - runAllTimers(): void; - /** - * Exhausts the macro-task queue (i.e., all tasks queued by `setTimeout()` - * and `setInterval()`). - * - * @remarks - * If new timers are added while it is executing they will be run as well. - * @remarks - * Not available when using legacy fake timers implementation. - */ - runAllTimersAsync(): Promise; - /** - * Executes only the macro-tasks that are currently pending (i.e., only the - * tasks that have been queued by `setTimeout()` or `setInterval()` up to this - * point). If any of the currently pending macro-tasks schedule new - * macro-tasks, those new tasks will not be executed by this call. - */ - runOnlyPendingTimers(): void; - /** - * Executes only the macro-tasks that are currently pending (i.e., only the - * tasks that have been queued by `setTimeout()` or `setInterval()` up to this - * point). If any of the currently pending macro-tasks schedule new - * macro-tasks, those new tasks will not be executed by this call. - * - * @remarks - * Not available when using legacy fake timers implementation. - */ - runOnlyPendingTimersAsync(): Promise; - /** - * Explicitly supplies the mock object that the module system should return - * for the specified module. - * - * @remarks - * It is recommended to use `jest.mock()` instead. The `jest.mock()` API's second - * argument is a module factory instead of the expected exported module object. - */ - setMock(moduleName: string, moduleExports: unknown): Jest; - /** - * Set the current system time used by fake timers. Simulates a user changing - * the system clock while your program is running. It affects the current time, - * but it does not in itself cause e.g. timers to fire; they will fire exactly - * as they would have done without the call to `jest.setSystemTime()`. - * - * @remarks - * Not available when using legacy fake timers implementation. - */ - setSystemTime(now?: number | Date): void; - /** - * Set the default timeout interval for tests and before/after hooks in - * milliseconds. - * - * @remarks - * The default timeout interval is 5 seconds if this method is not called. - */ - setTimeout(timeout: number): Jest; - /** - * Creates a mock function similar to `jest.fn()` but also tracks calls to - * `object[methodName]`. - * - * Optional third argument of `accessType` can be either 'get' or 'set', which - * proves to be useful when you want to spy on a getter or a setter, respectively. - * - * @remarks - * By default, `jest.spyOn()` also calls the spied method. This is different - * behavior from most other test libraries. - */ - spyOn: ModuleMocker['spyOn']; - /** - * Indicates that the module system should never return a mocked version of - * the specified module from `require()` (e.g. that it should always return the - * real module). - */ - unmock(moduleName: string): Jest; - /** - * Instructs Jest to use fake versions of the global date, performance, - * time and timer APIs. Fake timers implementation is backed by - * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). - * - * @remarks - * Calling `jest.useFakeTimers()` once again in the same test file would reinstall - * fake timers using the provided options. - */ - useFakeTimers( - fakeTimersConfig?: Config.FakeTimersConfig | Config.LegacyFakeTimersConfig, - ): Jest; - /** - * Instructs Jest to restore the original implementations of the global date, - * performance, time and timer APIs. - */ - useRealTimers(): Jest; -} - -export declare class JestEnvironment { - constructor(config: JestEnvironmentConfig, context: EnvironmentContext); - global: Global.Global; - fakeTimers: LegacyFakeTimers | null; - fakeTimersModern: ModernFakeTimers | null; - moduleMocker: ModuleMocker | null; - getVmContext(): Context | null; - setup(): Promise; - teardown(): Promise; - handleTestEvent?: Circus.EventHandler; - exportConditions?: () => Array; -} - -export declare interface JestEnvironmentConfig { - projectConfig: Config.ProjectConfig; - globalConfig: Config.GlobalConfig; -} - -export declare interface JestImportMeta extends ImportMeta { - jest: Jest; -} - -export declare type Module = NodeModule; - -export declare type ModuleWrapper = ( - this: Module['exports'], - module: Module, - exports: Module['exports'], - require: Module['require'], - __dirname: string, - __filename: Module['filename'], - jest?: Jest, - ...sandboxInjectedGlobals: Array -) => unknown; - -export {}; diff --git a/node_modules/@jest/environment/build/index.js b/node_modules/@jest/environment/build/index.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/environment/build/index.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/environment/package.json b/node_modules/@jest/environment/package.json deleted file mode 100644 index 160623f76..000000000 --- a/node_modules/@jest/environment/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@jest/environment", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-environment" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@jest/fake-timers": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "jest-mock": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/expect-utils/LICENSE b/node_modules/@jest/expect-utils/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/expect-utils/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/expect-utils/README.md b/node_modules/@jest/expect-utils/README.md deleted file mode 100644 index 12ae8b2f0..000000000 --- a/node_modules/@jest/expect-utils/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# `@jest/expect-utils` - -This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/). - -You probably don't want to use this package directly. E.g. if you're writing [custom matcher](https://jestjs.io/docs/expect#expectextendmatchers), you should use the injected [`this.equals`](https://jestjs.io/docs/expect#thisequalsa-b). diff --git a/node_modules/@jest/expect-utils/build/immutableUtils.js b/node_modules/@jest/expect-utils/build/immutableUtils.js deleted file mode 100644 index f61ee6cbb..000000000 --- a/node_modules/@jest/expect-utils/build/immutableUtils.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.isImmutableList = isImmutableList; -exports.isImmutableOrderedKeyed = isImmutableOrderedKeyed; -exports.isImmutableOrderedSet = isImmutableOrderedSet; -exports.isImmutableRecord = isImmutableRecord; -exports.isImmutableUnorderedKeyed = isImmutableUnorderedKeyed; -exports.isImmutableUnorderedSet = isImmutableUnorderedSet; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - -// SENTINEL constants are from https://github.com/immutable-js/immutable-js/tree/main/src/predicates -const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; -const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; -const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; -const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; -const IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@'; -function isObjectLiteral(source) { - return source != null && typeof source === 'object' && !Array.isArray(source); -} -function isImmutableUnorderedKeyed(source) { - return Boolean( - source && - isObjectLiteral(source) && - source[IS_KEYED_SENTINEL] && - !source[IS_ORDERED_SENTINEL] - ); -} -function isImmutableUnorderedSet(source) { - return Boolean( - source && - isObjectLiteral(source) && - source[IS_SET_SENTINEL] && - !source[IS_ORDERED_SENTINEL] - ); -} -function isImmutableList(source) { - return Boolean(source && isObjectLiteral(source) && source[IS_LIST_SENTINEL]); -} -function isImmutableOrderedKeyed(source) { - return Boolean( - source && - isObjectLiteral(source) && - source[IS_KEYED_SENTINEL] && - source[IS_ORDERED_SENTINEL] - ); -} -function isImmutableOrderedSet(source) { - return Boolean( - source && - isObjectLiteral(source) && - source[IS_SET_SENTINEL] && - source[IS_ORDERED_SENTINEL] - ); -} -function isImmutableRecord(source) { - return Boolean(source && isObjectLiteral(source) && source[IS_RECORD_SYMBOL]); -} diff --git a/node_modules/@jest/expect-utils/build/index.d.ts b/node_modules/@jest/expect-utils/build/index.d.ts deleted file mode 100644 index 7579b5129..000000000 --- a/node_modules/@jest/expect-utils/build/index.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -export declare const arrayBufferEquality: ( - a: unknown, - b: unknown, -) => boolean | undefined; - -export declare function emptyObject(obj: unknown): boolean; - -export declare const equals: EqualsFunction; - -export declare type EqualsFunction = ( - a: unknown, - b: unknown, - customTesters?: Array, - strictCheck?: boolean, -) => boolean; - -export declare const getObjectSubset: ( - object: any, - subset: any, - customTesters?: Array, - seenReferences?: WeakMap, -) => any; - -declare type GetPath = { - hasEndProp?: boolean; - endPropIsDefined?: boolean; - lastTraversedObject: unknown; - traversedPath: Array; - value?: unknown; -}; - -export declare const getPath: ( - object: Record, - propertyPath: string | Array, -) => GetPath; - -export declare function isA(typeName: string, value: unknown): value is T; - -export declare const isError: (value: unknown) => value is Error; - -export declare const isOneline: ( - expected: unknown, - received: unknown, -) => boolean; - -export declare const iterableEquality: ( - a: any, - b: any, - customTesters?: Array, - aStack?: Array, - bStack?: Array, -) => boolean | undefined; - -export declare const partition: ( - items: T[], - predicate: (arg: T) => boolean, -) => [T[], T[]]; - -export declare const pathAsArray: (propertyPath: string) => Array; - -export declare const sparseArrayEquality: ( - a: unknown, - b: unknown, - customTesters?: Array, -) => boolean | undefined; - -export declare const subsetEquality: ( - object: unknown, - subset: unknown, - customTesters?: Array, -) => boolean | undefined; - -export declare type Tester = ( - this: TesterContext, - a: any, - b: any, - customTesters: Array, -) => boolean | undefined; - -export declare interface TesterContext { - equals: EqualsFunction; -} - -export declare const typeEquality: (a: any, b: any) => boolean | undefined; - -export {}; diff --git a/node_modules/@jest/expect-utils/build/index.js b/node_modules/@jest/expect-utils/build/index.js deleted file mode 100644 index e84aca98e..000000000 --- a/node_modules/@jest/expect-utils/build/index.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -var _exportNames = { - equals: true, - isA: true -}; -Object.defineProperty(exports, 'equals', { - enumerable: true, - get: function () { - return _jasmineUtils.equals; - } -}); -Object.defineProperty(exports, 'isA', { - enumerable: true, - get: function () { - return _jasmineUtils.isA; - } -}); -var _jasmineUtils = require('./jasmineUtils'); -var _utils = require('./utils'); -Object.keys(_utils).forEach(function (key) { - if (key === 'default' || key === '__esModule') return; - if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; - if (key in exports && exports[key] === _utils[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function () { - return _utils[key]; - } - }); -}); diff --git a/node_modules/@jest/expect-utils/build/jasmineUtils.js b/node_modules/@jest/expect-utils/build/jasmineUtils.js deleted file mode 100644 index d643ede8a..000000000 --- a/node_modules/@jest/expect-utils/build/jasmineUtils.js +++ /dev/null @@ -1,218 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.equals = void 0; -exports.isA = isA; -/* -Copyright (c) 2008-2016 Pivotal Labs - -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. - -*/ - -// Extracted out of jasmine 2.5.2 -const equals = (a, b, customTesters, strictCheck) => { - customTesters = customTesters || []; - return eq(a, b, [], [], customTesters, strictCheck); -}; -exports.equals = equals; -function isAsymmetric(obj) { - return !!obj && isA('Function', obj.asymmetricMatch); -} -function asymmetricMatch(a, b) { - const asymmetricA = isAsymmetric(a); - const asymmetricB = isAsymmetric(b); - if (asymmetricA && asymmetricB) { - return undefined; - } - if (asymmetricA) { - return a.asymmetricMatch(b); - } - if (asymmetricB) { - return b.asymmetricMatch(a); - } -} - -// Equality function lovingly adapted from isEqual in -// [Underscore](http://underscorejs.org) -function eq(a, b, aStack, bStack, customTesters, strictCheck) { - let result = true; - const asymmetricResult = asymmetricMatch(a, b); - if (asymmetricResult !== undefined) { - return asymmetricResult; - } - const testerContext = { - equals - }; - for (let i = 0; i < customTesters.length; i++) { - const customTesterResult = customTesters[i].call( - testerContext, - a, - b, - customTesters - ); - if (customTesterResult !== undefined) { - return customTesterResult; - } - } - if (a instanceof Error && b instanceof Error) { - return a.message == b.message; - } - if (Object.is(a, b)) { - return true; - } - // A strict comparison is necessary because `null == undefined`. - if (a === null || b === null) { - return a === b; - } - const className = Object.prototype.toString.call(a); - if (className != Object.prototype.toString.call(b)) { - return false; - } - switch (className) { - case '[object Boolean]': - case '[object String]': - case '[object Number]': - if (typeof a !== typeof b) { - // One is a primitive, one a `new Primitive()` - return false; - } else if (typeof a !== 'object' && typeof b !== 'object') { - // both are proper primitives - return Object.is(a, b); - } else { - // both are `new Primitive()`s - return Object.is(a.valueOf(), b.valueOf()); - } - case '[object Date]': - // Coerce dates to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - return +a == +b; - // RegExps are compared by their source patterns and flags. - case '[object RegExp]': - return a.source === b.source && a.flags === b.flags; - } - if (typeof a !== 'object' || typeof b !== 'object') { - return false; - } - - // Use DOM3 method isEqualNode (IE>=9) - if (isDomNode(a) && isDomNode(b)) { - return a.isEqualNode(b); - } - - // Used to detect circular references. - let length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - // circular references at same depth are equal - // circular reference is not equal to non-circular one - if (aStack[length] === a) { - return bStack[length] === b; - } else if (bStack[length] === b) { - return false; - } - } - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - // Recursively compare objects and arrays. - // Compare array lengths to determine if a deep comparison is necessary. - if (strictCheck && className == '[object Array]' && a.length !== b.length) { - return false; - } - - // Deep compare objects. - const aKeys = keys(a, hasKey); - let key; - const bKeys = keys(b, hasKey); - // Add keys corresponding to asymmetric matchers if they miss in non strict check mode - if (!strictCheck) { - for (let index = 0; index !== bKeys.length; ++index) { - key = bKeys[index]; - if ((isAsymmetric(b[key]) || b[key] === undefined) && !hasKey(a, key)) { - aKeys.push(key); - } - } - for (let index = 0; index !== aKeys.length; ++index) { - key = aKeys[index]; - if ((isAsymmetric(a[key]) || a[key] === undefined) && !hasKey(b, key)) { - bKeys.push(key); - } - } - } - - // Ensure that both objects contain the same number of properties before comparing deep equality. - let size = aKeys.length; - if (bKeys.length !== size) { - return false; - } - while (size--) { - key = aKeys[size]; - - // Deep compare each member - if (strictCheck) - result = - hasKey(b, key) && - eq(a[key], b[key], aStack, bStack, customTesters, strictCheck); - else - result = - (hasKey(b, key) || isAsymmetric(a[key]) || a[key] === undefined) && - eq(a[key], b[key], aStack, bStack, customTesters, strictCheck); - if (!result) { - return false; - } - } - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - return result; -} -function keys(obj, hasKey) { - const keys = []; - for (const key in obj) { - if (hasKey(obj, key)) { - keys.push(key); - } - } - return keys.concat( - Object.getOwnPropertySymbols(obj).filter( - symbol => Object.getOwnPropertyDescriptor(obj, symbol).enumerable - ) - ); -} -function hasKey(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} -function isA(typeName, value) { - return Object.prototype.toString.apply(value) === `[object ${typeName}]`; -} -function isDomNode(obj) { - return ( - obj !== null && - typeof obj === 'object' && - typeof obj.nodeType === 'number' && - typeof obj.nodeName === 'string' && - typeof obj.isEqualNode === 'function' - ); -} diff --git a/node_modules/@jest/expect-utils/build/types.js b/node_modules/@jest/expect-utils/build/types.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/expect-utils/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/expect-utils/build/utils.js b/node_modules/@jest/expect-utils/build/utils.js deleted file mode 100644 index 4ba61fc81..000000000 --- a/node_modules/@jest/expect-utils/build/utils.js +++ /dev/null @@ -1,453 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.arrayBufferEquality = void 0; -exports.emptyObject = emptyObject; -exports.typeEquality = - exports.subsetEquality = - exports.sparseArrayEquality = - exports.pathAsArray = - exports.partition = - exports.iterableEquality = - exports.isOneline = - exports.isError = - exports.getPath = - exports.getObjectSubset = - void 0; -var _jestGetType = require('jest-get-type'); -var _immutableUtils = require('./immutableUtils'); -var _jasmineUtils = require('./jasmineUtils'); -var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol; -/** - * Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`. - */ -const hasPropertyInObject = (object, key) => { - const shouldTerminate = - !object || typeof object !== 'object' || object === Object.prototype; - if (shouldTerminate) { - return false; - } - return ( - Object.prototype.hasOwnProperty.call(object, key) || - hasPropertyInObject(Object.getPrototypeOf(object), key) - ); -}; - -// Retrieves an object's keys for evaluation by getObjectSubset. This evaluates -// the prototype chain for string keys but not for symbols. (Otherwise, it -// could find values such as a Set or Map's Symbol.toStringTag, with unexpected -// results.) -const getObjectKeys = object => [ - ...Object.keys(object), - ...Object.getOwnPropertySymbols(object) -]; -const getPath = (object, propertyPath) => { - if (!Array.isArray(propertyPath)) { - propertyPath = pathAsArray(propertyPath); - } - if (propertyPath.length) { - const lastProp = propertyPath.length === 1; - const prop = propertyPath[0]; - const newObject = object[prop]; - if (!lastProp && (newObject === null || newObject === undefined)) { - // This is not the last prop in the chain. If we keep recursing it will - // hit a `can't access property X of undefined | null`. At this point we - // know that the chain has broken and we can return right away. - return { - hasEndProp: false, - lastTraversedObject: object, - traversedPath: [] - }; - } - const result = getPath(newObject, propertyPath.slice(1)); - if (result.lastTraversedObject === null) { - result.lastTraversedObject = object; - } - result.traversedPath.unshift(prop); - if (lastProp) { - // Does object have the property with an undefined value? - // Although primitive values support bracket notation (above) - // they would throw TypeError for in operator (below). - result.endPropIsDefined = - !(0, _jestGetType.isPrimitive)(object) && prop in object; - result.hasEndProp = newObject !== undefined || result.endPropIsDefined; - if (!result.hasEndProp) { - result.traversedPath.shift(); - } - } - return result; - } - return { - lastTraversedObject: null, - traversedPath: [], - value: object - }; -}; - -// Strip properties from object that are not present in the subset. Useful for -// printing the diff for toMatchObject() without adding unrelated noise. -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -exports.getPath = getPath; -const getObjectSubset = ( - object, - subset, - customTesters = [], - seenReferences = new WeakMap() -) => { - /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ - if (Array.isArray(object)) { - if (Array.isArray(subset) && subset.length === object.length) { - // The map method returns correct subclass of subset. - return subset.map((sub, i) => - getObjectSubset(object[i], sub, customTesters) - ); - } - } else if (object instanceof Date) { - return object; - } else if (isObject(object) && isObject(subset)) { - if ( - (0, _jasmineUtils.equals)(object, subset, [ - ...customTesters, - iterableEquality, - subsetEquality - ]) - ) { - // Avoid unnecessary copy which might return Object instead of subclass. - return subset; - } - const trimmed = {}; - seenReferences.set(object, trimmed); - getObjectKeys(object) - .filter(key => hasPropertyInObject(subset, key)) - .forEach(key => { - trimmed[key] = seenReferences.has(object[key]) - ? seenReferences.get(object[key]) - : getObjectSubset( - object[key], - subset[key], - customTesters, - seenReferences - ); - }); - if (getObjectKeys(trimmed).length > 0) { - return trimmed; - } - } - return object; -}; -exports.getObjectSubset = getObjectSubset; -const IteratorSymbol = Symbol.iterator; -const hasIterator = object => !!(object != null && object[IteratorSymbol]); - -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -const iterableEquality = ( - a, - b, - customTesters = [] /* eslint-enable @typescript-eslint/explicit-module-boundary-types */, - aStack = [], - bStack = [] -) => { - if ( - typeof a !== 'object' || - typeof b !== 'object' || - Array.isArray(a) || - Array.isArray(b) || - !hasIterator(a) || - !hasIterator(b) - ) { - return undefined; - } - if (a.constructor !== b.constructor) { - return false; - } - let length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - // circular references at same depth are equal - // circular reference is not equal to non-circular one - if (aStack[length] === a) { - return bStack[length] === b; - } - } - aStack.push(a); - bStack.push(b); - const iterableEqualityWithStack = (a, b) => - iterableEquality( - a, - b, - [...filteredCustomTesters], - [...aStack], - [...bStack] - ); - - // Replace any instance of iterableEquality with the new - // iterableEqualityWithStack so we can do circular detection - const filteredCustomTesters = [ - ...customTesters.filter(t => t !== iterableEquality), - iterableEqualityWithStack - ]; - if (a.size !== undefined) { - if (a.size !== b.size) { - return false; - } else if ( - (0, _jasmineUtils.isA)('Set', a) || - (0, _immutableUtils.isImmutableUnorderedSet)(a) - ) { - let allFound = true; - for (const aValue of a) { - if (!b.has(aValue)) { - let has = false; - for (const bValue of b) { - const isEqual = (0, _jasmineUtils.equals)( - aValue, - bValue, - filteredCustomTesters - ); - if (isEqual === true) { - has = true; - } - } - if (has === false) { - allFound = false; - break; - } - } - } - // Remove the first value from the stack of traversed values. - aStack.pop(); - bStack.pop(); - return allFound; - } else if ( - (0, _jasmineUtils.isA)('Map', a) || - (0, _immutableUtils.isImmutableUnorderedKeyed)(a) - ) { - let allFound = true; - for (const aEntry of a) { - if ( - !b.has(aEntry[0]) || - !(0, _jasmineUtils.equals)( - aEntry[1], - b.get(aEntry[0]), - filteredCustomTesters - ) - ) { - let has = false; - for (const bEntry of b) { - const matchedKey = (0, _jasmineUtils.equals)( - aEntry[0], - bEntry[0], - filteredCustomTesters - ); - let matchedValue = false; - if (matchedKey === true) { - matchedValue = (0, _jasmineUtils.equals)( - aEntry[1], - bEntry[1], - filteredCustomTesters - ); - } - if (matchedValue === true) { - has = true; - } - } - if (has === false) { - allFound = false; - break; - } - } - } - // Remove the first value from the stack of traversed values. - aStack.pop(); - bStack.pop(); - return allFound; - } - } - const bIterator = b[IteratorSymbol](); - for (const aValue of a) { - const nextB = bIterator.next(); - if ( - nextB.done || - !(0, _jasmineUtils.equals)(aValue, nextB.value, filteredCustomTesters) - ) { - return false; - } - } - if (!bIterator.next().done) { - return false; - } - if ( - !(0, _immutableUtils.isImmutableList)(a) && - !(0, _immutableUtils.isImmutableOrderedKeyed)(a) && - !(0, _immutableUtils.isImmutableOrderedSet)(a) && - !(0, _immutableUtils.isImmutableRecord)(a) - ) { - const aEntries = Object.entries(a); - const bEntries = Object.entries(b); - if (!(0, _jasmineUtils.equals)(aEntries, bEntries)) { - return false; - } - } - - // Remove the first value from the stack of traversed values. - aStack.pop(); - bStack.pop(); - return true; -}; -exports.iterableEquality = iterableEquality; -const isObject = a => a !== null && typeof a === 'object'; -const isObjectWithKeys = a => - isObject(a) && - !(a instanceof Error) && - !(a instanceof Array) && - !(a instanceof Date); -const subsetEquality = (object, subset, customTesters = []) => { - const filteredCustomTesters = customTesters.filter(t => t !== subsetEquality); - - // subsetEquality needs to keep track of the references - // it has already visited to avoid infinite loops in case - // there are circular references in the subset passed to it. - const subsetEqualityWithContext = - (seenReferences = new WeakMap()) => - (object, subset) => { - if (!isObjectWithKeys(subset)) { - return undefined; - } - return getObjectKeys(subset).every(key => { - if (isObjectWithKeys(subset[key])) { - if (seenReferences.has(subset[key])) { - return (0, _jasmineUtils.equals)( - object[key], - subset[key], - filteredCustomTesters - ); - } - seenReferences.set(subset[key], true); - } - const result = - object != null && - hasPropertyInObject(object, key) && - (0, _jasmineUtils.equals)(object[key], subset[key], [ - ...filteredCustomTesters, - subsetEqualityWithContext(seenReferences) - ]); - // The main goal of using seenReference is to avoid circular node on tree. - // It will only happen within a parent and its child, not a node and nodes next to it (same level) - // We should keep the reference for a parent and its child only - // Thus we should delete the reference immediately so that it doesn't interfere - // other nodes within the same level on tree. - seenReferences.delete(subset[key]); - return result; - }); - }; - return subsetEqualityWithContext()(object, subset); -}; - -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -exports.subsetEquality = subsetEquality; -const typeEquality = (a, b) => { - if ( - a == null || - b == null || - a.constructor === b.constructor || - // Since Jest globals are different from Node globals, - // constructors are different even between arrays when comparing properties of mock objects. - // Both of them should be able to compare correctly when they are array-to-array. - // https://github.com/facebook/jest/issues/2549 - (Array.isArray(a) && Array.isArray(b)) - ) { - return undefined; - } - return false; -}; -exports.typeEquality = typeEquality; -const arrayBufferEquality = (a, b) => { - if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) { - return undefined; - } - const dataViewA = new DataView(a); - const dataViewB = new DataView(b); - - // Buffers are not equal when they do not have the same byte length - if (dataViewA.byteLength !== dataViewB.byteLength) { - return false; - } - - // Check if every byte value is equal to each other - for (let i = 0; i < dataViewA.byteLength; i++) { - if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) { - return false; - } - } - return true; -}; -exports.arrayBufferEquality = arrayBufferEquality; -const sparseArrayEquality = (a, b, customTesters = []) => { - if (!Array.isArray(a) || !Array.isArray(b)) { - return undefined; - } - - // A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"] - const aKeys = Object.keys(a); - const bKeys = Object.keys(b); - return ( - (0, _jasmineUtils.equals)( - a, - b, - customTesters.filter(t => t !== sparseArrayEquality), - true - ) && (0, _jasmineUtils.equals)(aKeys, bKeys) - ); -}; -exports.sparseArrayEquality = sparseArrayEquality; -const partition = (items, predicate) => { - const result = [[], []]; - items.forEach(item => result[predicate(item) ? 0 : 1].push(item)); - return result; -}; -exports.partition = partition; -const pathAsArray = propertyPath => { - const properties = []; - if (propertyPath === '') { - properties.push(''); - return properties; - } - - // will match everything that's not a dot or a bracket, and "" for consecutive dots. - const pattern = RegExp('[^.[\\]]+|(?=(?:\\.)(?:\\.|$))', 'g'); - - // Because the regex won't match a dot in the beginning of the path, if present. - if (propertyPath[0] === '.') { - properties.push(''); - } - propertyPath.replace(pattern, match => { - properties.push(match); - return match; - }); - return properties; -}; - -// Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693 -exports.pathAsArray = pathAsArray; -const isError = value => { - switch (Object.prototype.toString.call(value)) { - case '[object Error]': - case '[object Exception]': - case '[object DOMException]': - return true; - default: - return value instanceof Error; - } -}; -exports.isError = isError; -function emptyObject(obj) { - return obj && typeof obj === 'object' ? !Object.keys(obj).length : false; -} -const MULTILINE_REGEXP = /[\r\n]/; -const isOneline = (expected, received) => - typeof expected === 'string' && - typeof received === 'string' && - (!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received)); -exports.isOneline = isOneline; diff --git a/node_modules/@jest/expect-utils/package.json b/node_modules/@jest/expect-utils/package.json deleted file mode 100644 index ea0c5d4d4..000000000 --- a/node_modules/@jest/expect-utils/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "@jest/expect-utils", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/expect-utils" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "jest-get-type": "^29.4.3" - }, - "devDependencies": { - "@tsd/typescript": "^4.9.0", - "immutable": "^4.0.0", - "jest-matcher-utils": "^29.5.0", - "tsd-lite": "^0.6.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/expect/LICENSE b/node_modules/@jest/expect/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/expect/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/expect/README.md b/node_modules/@jest/expect/README.md deleted file mode 100644 index 81cf1b41a..000000000 --- a/node_modules/@jest/expect/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# @jest/expect - -This package extends `expect` library with `jest-snapshot` matchers. It exports `jestExpect` object, which can be used as standalone replacement of `expect`. - -The `jestExpect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/expect). diff --git a/node_modules/@jest/expect/build/index.d.ts b/node_modules/@jest/expect/build/index.d.ts deleted file mode 100644 index 1b6964638..000000000 --- a/node_modules/@jest/expect/build/index.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type {addSerializer} from 'jest-snapshot'; -import {AsymmetricMatchers} from 'expect'; -import type {BaseExpect} from 'expect'; -import {MatcherContext} from 'expect'; -import {MatcherFunction} from 'expect'; -import {MatcherFunctionWithContext} from 'expect'; -import {Matchers} from 'expect'; -import {MatcherState} from 'expect'; -import {MatcherUtils} from 'expect'; -import type {SnapshotMatchers} from 'jest-snapshot'; - -export {AsymmetricMatchers}; - -declare type Inverse = { - /** - * Inverse next matcher. If you know how to test something, `.not` lets you test its opposite. - */ - not: Matchers; -}; - -export declare type JestExpect = { - (actual: T): JestMatchers & - Inverse> & - PromiseMatchers; - addSnapshotSerializer: typeof addSerializer; -} & BaseExpect & - AsymmetricMatchers & - Inverse>; - -export declare const jestExpect: JestExpect; - -declare type JestMatchers, T> = Matchers & - SnapshotMatchers; - -export {MatcherContext}; - -export {MatcherFunction}; - -export {MatcherFunctionWithContext}; - -export {Matchers}; - -export {MatcherState}; - -export {MatcherUtils}; - -declare type PromiseMatchers = { - /** - * Unwraps the reason of a rejected promise so any other matcher can be chained. - * If the promise is fulfilled the assertion fails. - */ - rejects: JestMatchers, T> & - Inverse, T>>; - /** - * Unwraps the value of a fulfilled promise so any other matcher can be chained. - * If the promise is rejected the assertion fails. - */ - resolves: JestMatchers, T> & - Inverse, T>>; -}; - -export {}; diff --git a/node_modules/@jest/expect/build/index.js b/node_modules/@jest/expect/build/index.js deleted file mode 100644 index bc1cc9386..000000000 --- a/node_modules/@jest/expect/build/index.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.jestExpect = void 0; -function _expect() { - const data = require('expect'); - _expect = function () { - return data; - }; - return data; -} -function _jestSnapshot() { - const data = require('jest-snapshot'); - _jestSnapshot = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function createJestExpect() { - _expect().expect.extend({ - toMatchInlineSnapshot: _jestSnapshot().toMatchInlineSnapshot, - toMatchSnapshot: _jestSnapshot().toMatchSnapshot, - toThrowErrorMatchingInlineSnapshot: - _jestSnapshot().toThrowErrorMatchingInlineSnapshot, - toThrowErrorMatchingSnapshot: _jestSnapshot().toThrowErrorMatchingSnapshot - }); - _expect().expect.addSnapshotSerializer = _jestSnapshot().addSerializer; - return _expect().expect; -} -const jestExpect = createJestExpect(); -exports.jestExpect = jestExpect; diff --git a/node_modules/@jest/expect/build/types.js b/node_modules/@jest/expect/build/types.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/expect/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/expect/package.json b/node_modules/@jest/expect/package.json deleted file mode 100644 index 42e9cac9f..000000000 --- a/node_modules/@jest/expect/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "@jest/expect", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-expect" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "expect": "^29.5.0", - "jest-snapshot": "^29.5.0" - }, - "devDependencies": { - "@tsd/typescript": "^4.9.0", - "tsd-lite": "^0.6.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/fake-timers/LICENSE b/node_modules/@jest/fake-timers/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/fake-timers/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/fake-timers/build/index.d.ts b/node_modules/@jest/fake-timers/build/index.d.ts deleted file mode 100644 index 5a2b4c98f..000000000 --- a/node_modules/@jest/fake-timers/build/index.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type {Config} from '@jest/types'; -import type {ModuleMocker} from 'jest-mock'; -import {StackTraceConfig} from 'jest-message-util'; - -declare type Callback = (...args: Array) => void; - -export declare class LegacyFakeTimers { - private _cancelledTicks; - private readonly _config; - private _disposed; - private _fakeTimerAPIs; - private _fakingTime; - private _global; - private _immediates; - private readonly _maxLoops; - private readonly _moduleMocker; - private _now; - private _ticks; - private readonly _timerAPIs; - private _timers; - private _uuidCounter; - private readonly _timerConfig; - constructor({ - global, - moduleMocker, - timerConfig, - config, - maxLoops, - }: { - global: typeof globalThis; - moduleMocker: ModuleMocker; - timerConfig: TimerConfig; - config: StackTraceConfig; - maxLoops?: number; - }); - clearAllTimers(): void; - dispose(): void; - reset(): void; - now(): number; - runAllTicks(): void; - runAllImmediates(): void; - private _runImmediate; - runAllTimers(): void; - runOnlyPendingTimers(): void; - advanceTimersToNextTimer(steps?: number): void; - advanceTimersByTime(msToRun: number): void; - runWithRealTimers(cb: Callback): void; - useRealTimers(): void; - useFakeTimers(): void; - getTimerCount(): number; - private _checkFakeTimers; - private _createMocks; - private _fakeClearTimer; - private _fakeClearImmediate; - private _fakeNextTick; - private _fakeRequestAnimationFrame; - private _fakeSetImmediate; - private _fakeSetInterval; - private _fakeSetTimeout; - private _getNextTimerHandleAndExpiry; - private _runTimerHandle; -} - -export declare class ModernFakeTimers { - private _clock; - private readonly _config; - private _fakingTime; - private readonly _global; - private readonly _fakeTimers; - constructor({ - global, - config, - }: { - global: typeof globalThis; - config: Config.ProjectConfig; - }); - clearAllTimers(): void; - dispose(): void; - runAllTimers(): void; - runAllTimersAsync(): Promise; - runOnlyPendingTimers(): void; - runOnlyPendingTimersAsync(): Promise; - advanceTimersToNextTimer(steps?: number): void; - advanceTimersToNextTimerAsync(steps?: number): Promise; - advanceTimersByTime(msToRun: number): void; - advanceTimersByTimeAsync(msToRun: number): Promise; - runAllTicks(): void; - useRealTimers(): void; - useFakeTimers(fakeTimersConfig?: Config.FakeTimersConfig): void; - reset(): void; - setSystemTime(now?: number | Date): void; - getRealSystemTime(): number; - now(): number; - getTimerCount(): number; - private _checkFakeTimers; - private _toSinonFakeTimersConfig; -} - -declare type TimerConfig = { - idToRef: (id: number) => Ref; - refToId: (ref: Ref) => number | void; -}; - -export {}; diff --git a/node_modules/@jest/fake-timers/build/index.js b/node_modules/@jest/fake-timers/build/index.js deleted file mode 100644 index 776d3e535..000000000 --- a/node_modules/@jest/fake-timers/build/index.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'LegacyFakeTimers', { - enumerable: true, - get: function () { - return _legacyFakeTimers.default; - } -}); -Object.defineProperty(exports, 'ModernFakeTimers', { - enumerable: true, - get: function () { - return _modernFakeTimers.default; - } -}); -var _legacyFakeTimers = _interopRequireDefault(require('./legacyFakeTimers')); -var _modernFakeTimers = _interopRequireDefault(require('./modernFakeTimers')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/fake-timers/build/legacyFakeTimers.js b/node_modules/@jest/fake-timers/build/legacyFakeTimers.js deleted file mode 100644 index 92963a7e8..000000000 --- a/node_modules/@jest/fake-timers/build/legacyFakeTimers.js +++ /dev/null @@ -1,545 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _util() { - const data = require('util'); - _util = function () { - return data; - }; - return data; -} -function _jestMessageUtil() { - const data = require('jest-message-util'); - _jestMessageUtil = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* eslint-disable local/prefer-spread-eventually */ - -const MS_IN_A_YEAR = 31536000000; -class FakeTimers { - _cancelledTicks; - _config; - _disposed; - _fakeTimerAPIs; - _fakingTime = false; - _global; - _immediates; - _maxLoops; - _moduleMocker; - _now; - _ticks; - _timerAPIs; - _timers; - _uuidCounter; - _timerConfig; - constructor({global, moduleMocker, timerConfig, config, maxLoops}) { - this._global = global; - this._timerConfig = timerConfig; - this._config = config; - this._maxLoops = maxLoops || 100000; - this._uuidCounter = 1; - this._moduleMocker = moduleMocker; - - // Store original timer APIs for future reference - this._timerAPIs = { - cancelAnimationFrame: global.cancelAnimationFrame, - clearImmediate: global.clearImmediate, - clearInterval: global.clearInterval, - clearTimeout: global.clearTimeout, - nextTick: global.process && global.process.nextTick, - requestAnimationFrame: global.requestAnimationFrame, - setImmediate: global.setImmediate, - setInterval: global.setInterval, - setTimeout: global.setTimeout - }; - this._disposed = false; - this.reset(); - } - clearAllTimers() { - this._immediates = []; - this._timers.clear(); - } - dispose() { - this._disposed = true; - this.clearAllTimers(); - } - reset() { - this._cancelledTicks = {}; - this._now = 0; - this._ticks = []; - this._immediates = []; - this._timers = new Map(); - } - now() { - if (this._fakingTime) { - return this._now; - } - return Date.now(); - } - runAllTicks() { - this._checkFakeTimers(); - // Only run a generous number of ticks and then bail. - // This is just to help avoid recursive loops - let i; - for (i = 0; i < this._maxLoops; i++) { - const tick = this._ticks.shift(); - if (tick === undefined) { - break; - } - if ( - !Object.prototype.hasOwnProperty.call(this._cancelledTicks, tick.uuid) - ) { - // Callback may throw, so update the map prior calling. - this._cancelledTicks[tick.uuid] = true; - tick.callback(); - } - } - if (i === this._maxLoops) { - throw new Error( - `Ran ${this._maxLoops} ticks, and there are still more! ` + - "Assuming we've hit an infinite recursion and bailing out..." - ); - } - } - runAllImmediates() { - this._checkFakeTimers(); - // Only run a generous number of immediates and then bail. - let i; - for (i = 0; i < this._maxLoops; i++) { - const immediate = this._immediates.shift(); - if (immediate === undefined) { - break; - } - this._runImmediate(immediate); - } - if (i === this._maxLoops) { - throw new Error( - `Ran ${this._maxLoops} immediates, and there are still more! Assuming ` + - "we've hit an infinite recursion and bailing out..." - ); - } - } - _runImmediate(immediate) { - try { - immediate.callback(); - } finally { - this._fakeClearImmediate(immediate.uuid); - } - } - runAllTimers() { - this._checkFakeTimers(); - this.runAllTicks(); - this.runAllImmediates(); - - // Only run a generous number of timers and then bail. - // This is just to help avoid recursive loops - let i; - for (i = 0; i < this._maxLoops; i++) { - const nextTimerHandleAndExpiry = this._getNextTimerHandleAndExpiry(); - - // If there are no more timer handles, stop! - if (nextTimerHandleAndExpiry === null) { - break; - } - const [nextTimerHandle, expiry] = nextTimerHandleAndExpiry; - this._now = expiry; - this._runTimerHandle(nextTimerHandle); - - // Some of the immediate calls could be enqueued - // during the previous handling of the timers, we should - // run them as well. - if (this._immediates.length) { - this.runAllImmediates(); - } - if (this._ticks.length) { - this.runAllTicks(); - } - } - if (i === this._maxLoops) { - throw new Error( - `Ran ${this._maxLoops} timers, and there are still more! ` + - "Assuming we've hit an infinite recursion and bailing out..." - ); - } - } - runOnlyPendingTimers() { - // We need to hold the current shape of `this._timers` because existing - // timers can add new ones to the map and hence would run more than necessary. - // See https://github.com/facebook/jest/pull/4608 for details - const timerEntries = Array.from(this._timers.entries()); - this._checkFakeTimers(); - this._immediates.forEach(this._runImmediate, this); - timerEntries - .sort(([, left], [, right]) => left.expiry - right.expiry) - .forEach(([timerHandle, timer]) => { - this._now = timer.expiry; - this._runTimerHandle(timerHandle); - }); - } - advanceTimersToNextTimer(steps = 1) { - if (steps < 1) { - return; - } - const nextExpiry = Array.from(this._timers.values()).reduce( - (minExpiry, timer) => { - if (minExpiry === null || timer.expiry < minExpiry) return timer.expiry; - return minExpiry; - }, - null - ); - if (nextExpiry !== null) { - this.advanceTimersByTime(nextExpiry - this._now); - this.advanceTimersToNextTimer(steps - 1); - } - } - advanceTimersByTime(msToRun) { - this._checkFakeTimers(); - // Only run a generous number of timers and then bail. - // This is just to help avoid recursive loops - let i; - for (i = 0; i < this._maxLoops; i++) { - const timerHandleAndExpiry = this._getNextTimerHandleAndExpiry(); - - // If there are no more timer handles, stop! - if (timerHandleAndExpiry === null) { - break; - } - const [timerHandle, nextTimerExpiry] = timerHandleAndExpiry; - if (this._now + msToRun < nextTimerExpiry) { - // There are no timers between now and the target we're running to - break; - } else { - msToRun -= nextTimerExpiry - this._now; - this._now = nextTimerExpiry; - this._runTimerHandle(timerHandle); - } - } - - // Advance the clock by whatever time we still have left to run - this._now += msToRun; - if (i === this._maxLoops) { - throw new Error( - `Ran ${this._maxLoops} timers, and there are still more! ` + - "Assuming we've hit an infinite recursion and bailing out..." - ); - } - } - runWithRealTimers(cb) { - const prevClearImmediate = this._global.clearImmediate; - const prevClearInterval = this._global.clearInterval; - const prevClearTimeout = this._global.clearTimeout; - const prevNextTick = this._global.process.nextTick; - const prevSetImmediate = this._global.setImmediate; - const prevSetInterval = this._global.setInterval; - const prevSetTimeout = this._global.setTimeout; - this.useRealTimers(); - let cbErr = null; - let errThrown = false; - try { - cb(); - } catch (e) { - errThrown = true; - cbErr = e; - } - this._global.clearImmediate = prevClearImmediate; - this._global.clearInterval = prevClearInterval; - this._global.clearTimeout = prevClearTimeout; - this._global.process.nextTick = prevNextTick; - this._global.setImmediate = prevSetImmediate; - this._global.setInterval = prevSetInterval; - this._global.setTimeout = prevSetTimeout; - if (errThrown) { - throw cbErr; - } - } - useRealTimers() { - const global = this._global; - if (typeof global.cancelAnimationFrame === 'function') { - (0, _jestUtil().setGlobal)( - global, - 'cancelAnimationFrame', - this._timerAPIs.cancelAnimationFrame - ); - } - if (typeof global.clearImmediate === 'function') { - (0, _jestUtil().setGlobal)( - global, - 'clearImmediate', - this._timerAPIs.clearImmediate - ); - } - (0, _jestUtil().setGlobal)( - global, - 'clearInterval', - this._timerAPIs.clearInterval - ); - (0, _jestUtil().setGlobal)( - global, - 'clearTimeout', - this._timerAPIs.clearTimeout - ); - if (typeof global.requestAnimationFrame === 'function') { - (0, _jestUtil().setGlobal)( - global, - 'requestAnimationFrame', - this._timerAPIs.requestAnimationFrame - ); - } - if (typeof global.setImmediate === 'function') { - (0, _jestUtil().setGlobal)( - global, - 'setImmediate', - this._timerAPIs.setImmediate - ); - } - (0, _jestUtil().setGlobal)( - global, - 'setInterval', - this._timerAPIs.setInterval - ); - (0, _jestUtil().setGlobal)( - global, - 'setTimeout', - this._timerAPIs.setTimeout - ); - global.process.nextTick = this._timerAPIs.nextTick; - this._fakingTime = false; - } - useFakeTimers() { - this._createMocks(); - const global = this._global; - if (typeof global.cancelAnimationFrame === 'function') { - (0, _jestUtil().setGlobal)( - global, - 'cancelAnimationFrame', - this._fakeTimerAPIs.cancelAnimationFrame - ); - } - if (typeof global.clearImmediate === 'function') { - (0, _jestUtil().setGlobal)( - global, - 'clearImmediate', - this._fakeTimerAPIs.clearImmediate - ); - } - (0, _jestUtil().setGlobal)( - global, - 'clearInterval', - this._fakeTimerAPIs.clearInterval - ); - (0, _jestUtil().setGlobal)( - global, - 'clearTimeout', - this._fakeTimerAPIs.clearTimeout - ); - if (typeof global.requestAnimationFrame === 'function') { - (0, _jestUtil().setGlobal)( - global, - 'requestAnimationFrame', - this._fakeTimerAPIs.requestAnimationFrame - ); - } - if (typeof global.setImmediate === 'function') { - (0, _jestUtil().setGlobal)( - global, - 'setImmediate', - this._fakeTimerAPIs.setImmediate - ); - } - (0, _jestUtil().setGlobal)( - global, - 'setInterval', - this._fakeTimerAPIs.setInterval - ); - (0, _jestUtil().setGlobal)( - global, - 'setTimeout', - this._fakeTimerAPIs.setTimeout - ); - global.process.nextTick = this._fakeTimerAPIs.nextTick; - this._fakingTime = true; - } - getTimerCount() { - this._checkFakeTimers(); - return this._timers.size + this._immediates.length + this._ticks.length; - } - _checkFakeTimers() { - if (!this._fakingTime) { - this._global.console.warn( - 'A function to advance timers was called but the timers APIs are not mocked ' + - 'with fake timers. Call `jest.useFakeTimers({legacyFakeTimers: true})` ' + - 'in this test file or enable fake timers for all tests by setting ' + - "{'enableGlobally': true, 'legacyFakeTimers': true} in " + - `Jest configuration file.\nStack Trace:\n${(0, - _jestMessageUtil().formatStackTrace)( - new Error().stack, - this._config, - { - noStackTrace: false - } - )}` - ); - } - } - _createMocks() { - const fn = implementation => this._moduleMocker.fn(implementation); - const promisifiableFakeSetTimeout = fn(this._fakeSetTimeout.bind(this)); - // @ts-expect-error: no index - promisifiableFakeSetTimeout[_util().promisify.custom] = (delay, arg) => - new Promise(resolve => promisifiableFakeSetTimeout(resolve, delay, arg)); - this._fakeTimerAPIs = { - cancelAnimationFrame: fn(this._fakeClearTimer.bind(this)), - clearImmediate: fn(this._fakeClearImmediate.bind(this)), - clearInterval: fn(this._fakeClearTimer.bind(this)), - clearTimeout: fn(this._fakeClearTimer.bind(this)), - nextTick: fn(this._fakeNextTick.bind(this)), - requestAnimationFrame: fn(this._fakeRequestAnimationFrame.bind(this)), - setImmediate: fn(this._fakeSetImmediate.bind(this)), - setInterval: fn(this._fakeSetInterval.bind(this)), - setTimeout: promisifiableFakeSetTimeout - }; - } - _fakeClearTimer(timerRef) { - const uuid = this._timerConfig.refToId(timerRef); - if (uuid) { - this._timers.delete(String(uuid)); - } - } - _fakeClearImmediate(uuid) { - this._immediates = this._immediates.filter( - immediate => immediate.uuid !== uuid - ); - } - _fakeNextTick(callback, ...args) { - if (this._disposed) { - return; - } - const uuid = String(this._uuidCounter++); - this._ticks.push({ - callback: () => callback.apply(null, args), - uuid - }); - const cancelledTicks = this._cancelledTicks; - this._timerAPIs.nextTick(() => { - if (!Object.prototype.hasOwnProperty.call(cancelledTicks, uuid)) { - // Callback may throw, so update the map prior calling. - cancelledTicks[uuid] = true; - callback.apply(null, args); - } - }); - } - _fakeRequestAnimationFrame(callback) { - return this._fakeSetTimeout(() => { - // TODO: Use performance.now() once it's mocked - callback(this._now); - }, 1000 / 60); - } - _fakeSetImmediate(callback, ...args) { - if (this._disposed) { - return null; - } - const uuid = String(this._uuidCounter++); - this._immediates.push({ - callback: () => callback.apply(null, args), - uuid - }); - this._timerAPIs.setImmediate(() => { - if (!this._disposed) { - if (this._immediates.find(x => x.uuid === uuid)) { - try { - callback.apply(null, args); - } finally { - this._fakeClearImmediate(uuid); - } - } - } - }); - return uuid; - } - _fakeSetInterval(callback, intervalDelay, ...args) { - if (this._disposed) { - return null; - } - if (intervalDelay == null) { - intervalDelay = 0; - } - const uuid = this._uuidCounter++; - this._timers.set(String(uuid), { - callback: () => callback.apply(null, args), - expiry: this._now + intervalDelay, - interval: intervalDelay, - type: 'interval' - }); - return this._timerConfig.idToRef(uuid); - } - _fakeSetTimeout(callback, delay, ...args) { - if (this._disposed) { - return null; - } - - // eslint-disable-next-line no-bitwise - delay = Number(delay) | 0; - const uuid = this._uuidCounter++; - this._timers.set(String(uuid), { - callback: () => callback.apply(null, args), - expiry: this._now + delay, - interval: undefined, - type: 'timeout' - }); - return this._timerConfig.idToRef(uuid); - } - _getNextTimerHandleAndExpiry() { - let nextTimerHandle = null; - let soonestTime = MS_IN_A_YEAR; - this._timers.forEach((timer, uuid) => { - if (timer.expiry < soonestTime) { - soonestTime = timer.expiry; - nextTimerHandle = uuid; - } - }); - if (nextTimerHandle === null) { - return null; - } - return [nextTimerHandle, soonestTime]; - } - _runTimerHandle(timerHandle) { - const timer = this._timers.get(timerHandle); - if (!timer) { - // Timer has been cleared - we'll hit this when a timer is cleared within - // another timer in runOnlyPendingTimers - return; - } - switch (timer.type) { - case 'timeout': - this._timers.delete(timerHandle); - timer.callback(); - break; - case 'interval': - timer.expiry = this._now + (timer.interval || 0); - timer.callback(); - break; - default: - throw new Error(`Unexpected timer type: ${timer.type}`); - } - } -} -exports.default = FakeTimers; diff --git a/node_modules/@jest/fake-timers/build/modernFakeTimers.js b/node_modules/@jest/fake-timers/build/modernFakeTimers.js deleted file mode 100644 index d9518a91d..000000000 --- a/node_modules/@jest/fake-timers/build/modernFakeTimers.js +++ /dev/null @@ -1,191 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _fakeTimers() { - const data = require('@sinonjs/fake-timers'); - _fakeTimers = function () { - return data; - }; - return data; -} -function _jestMessageUtil() { - const data = require('jest-message-util'); - _jestMessageUtil = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -class FakeTimers { - _clock; - _config; - _fakingTime; - _global; - _fakeTimers; - constructor({global, config}) { - this._global = global; - this._config = config; - this._fakingTime = false; - this._fakeTimers = (0, _fakeTimers().withGlobal)(global); - } - clearAllTimers() { - if (this._fakingTime) { - this._clock.reset(); - } - } - dispose() { - this.useRealTimers(); - } - runAllTimers() { - if (this._checkFakeTimers()) { - this._clock.runAll(); - } - } - async runAllTimersAsync() { - if (this._checkFakeTimers()) { - await this._clock.runAllAsync(); - } - } - runOnlyPendingTimers() { - if (this._checkFakeTimers()) { - this._clock.runToLast(); - } - } - async runOnlyPendingTimersAsync() { - if (this._checkFakeTimers()) { - await this._clock.runToLastAsync(); - } - } - advanceTimersToNextTimer(steps = 1) { - if (this._checkFakeTimers()) { - for (let i = steps; i > 0; i--) { - this._clock.next(); - // Fire all timers at this point: https://github.com/sinonjs/fake-timers/issues/250 - this._clock.tick(0); - if (this._clock.countTimers() === 0) { - break; - } - } - } - } - async advanceTimersToNextTimerAsync(steps = 1) { - if (this._checkFakeTimers()) { - for (let i = steps; i > 0; i--) { - await this._clock.nextAsync(); - // Fire all timers at this point: https://github.com/sinonjs/fake-timers/issues/250 - await this._clock.tickAsync(0); - if (this._clock.countTimers() === 0) { - break; - } - } - } - } - advanceTimersByTime(msToRun) { - if (this._checkFakeTimers()) { - this._clock.tick(msToRun); - } - } - async advanceTimersByTimeAsync(msToRun) { - if (this._checkFakeTimers()) { - await this._clock.tickAsync(msToRun); - } - } - runAllTicks() { - if (this._checkFakeTimers()) { - // @ts-expect-error - doesn't exist? - this._clock.runMicrotasks(); - } - } - useRealTimers() { - if (this._fakingTime) { - this._clock.uninstall(); - this._fakingTime = false; - } - } - useFakeTimers(fakeTimersConfig) { - if (this._fakingTime) { - this._clock.uninstall(); - } - this._clock = this._fakeTimers.install( - this._toSinonFakeTimersConfig(fakeTimersConfig) - ); - this._fakingTime = true; - } - reset() { - if (this._checkFakeTimers()) { - const {now} = this._clock; - this._clock.reset(); - this._clock.setSystemTime(now); - } - } - setSystemTime(now) { - if (this._checkFakeTimers()) { - this._clock.setSystemTime(now); - } - } - getRealSystemTime() { - return Date.now(); - } - now() { - if (this._fakingTime) { - return this._clock.now; - } - return Date.now(); - } - getTimerCount() { - if (this._checkFakeTimers()) { - return this._clock.countTimers(); - } - return 0; - } - _checkFakeTimers() { - if (!this._fakingTime) { - this._global.console.warn( - 'A function to advance timers was called but the timers APIs are not replaced ' + - 'with fake timers. Call `jest.useFakeTimers()` in this test file or enable ' + - "fake timers for all tests by setting 'fakeTimers': {'enableGlobally': true} " + - `in Jest configuration file.\nStack Trace:\n${(0, - _jestMessageUtil().formatStackTrace)( - new Error().stack, - this._config, - { - noStackTrace: false - } - )}` - ); - } - return this._fakingTime; - } - _toSinonFakeTimersConfig(fakeTimersConfig = {}) { - fakeTimersConfig = { - ...this._config.fakeTimers, - ...fakeTimersConfig - }; - const advanceTimeDelta = - typeof fakeTimersConfig.advanceTimers === 'number' - ? fakeTimersConfig.advanceTimers - : undefined; - const toFake = new Set(Object.keys(this._fakeTimers.timers)); - fakeTimersConfig.doNotFake?.forEach(nameOfFakeableAPI => { - toFake.delete(nameOfFakeableAPI); - }); - return { - advanceTimeDelta, - loopLimit: fakeTimersConfig.timerLimit || 100_000, - now: fakeTimersConfig.now ?? Date.now(), - shouldAdvanceTime: Boolean(fakeTimersConfig.advanceTimers), - shouldClearNativeTimers: true, - toFake: Array.from(toFake) - }; - } -} -exports.default = FakeTimers; diff --git a/node_modules/@jest/fake-timers/package.json b/node_modules/@jest/fake-timers/package.json deleted file mode 100644 index 242889a19..000000000 --- a/node_modules/@jest/fake-timers/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@jest/fake-timers", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-fake-timers" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@jest/types": "^29.5.0", - "@sinonjs/fake-timers": "^10.0.2", - "@types/node": "*", - "jest-message-util": "^29.5.0", - "jest-mock": "^29.5.0", - "jest-util": "^29.5.0" - }, - "devDependencies": { - "@jest/test-utils": "^29.5.0", - "@types/sinonjs__fake-timers": "^8.1.2" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/globals/LICENSE b/node_modules/@jest/globals/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/globals/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/globals/build/index.d.ts b/node_modules/@jest/globals/build/index.d.ts deleted file mode 100644 index 456044cee..000000000 --- a/node_modules/@jest/globals/build/index.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type { Jest } from '@jest/environment'; -import type { JestExpect } from '@jest/expect'; -import type { Global } from '@jest/types'; -import type { ClassLike, FunctionLike, Mock as JestMock, Mocked as JestMocked, MockedClass as JestMockedClass, MockedFunction as JestMockedFunction, MockedObject as JestMockedObject, Replaced as JestReplaced, Spied as JestSpied, SpiedClass as JestSpiedClass, SpiedFunction as JestSpiedFunction, SpiedGetter as JestSpiedGetter, SpiedSetter as JestSpiedSetter, UnknownFunction } from 'jest-mock'; -export declare const expect: JestExpect; -export declare const it: Global.GlobalAdditions['it']; -export declare const test: Global.GlobalAdditions['test']; -export declare const fit: Global.GlobalAdditions['fit']; -export declare const xit: Global.GlobalAdditions['xit']; -export declare const xtest: Global.GlobalAdditions['xtest']; -export declare const describe: Global.GlobalAdditions['describe']; -export declare const xdescribe: Global.GlobalAdditions['xdescribe']; -export declare const fdescribe: Global.GlobalAdditions['fdescribe']; -export declare const beforeAll: Global.GlobalAdditions['beforeAll']; -export declare const beforeEach: Global.GlobalAdditions['beforeEach']; -export declare const afterEach: Global.GlobalAdditions['afterEach']; -export declare const afterAll: Global.GlobalAdditions['afterAll']; -declare const jest: Jest; -declare namespace jest { - /** - * Constructs the type of a mock function, e.g. the return type of `jest.fn()`. - */ - type Mock = JestMock; - /** - * Wraps a class, function or object type with Jest mock type definitions. - */ - type Mocked = JestMocked; - /** - * Wraps a class type with Jest mock type definitions. - */ - type MockedClass = JestMockedClass; - /** - * Wraps a function type with Jest mock type definitions. - */ - type MockedFunction = JestMockedFunction; - /** - * Wraps an object type with Jest mock type definitions. - */ - type MockedObject = JestMockedObject; - /** - * Constructs the type of a replaced property. - */ - type Replaced = JestReplaced; - /** - * Constructs the type of a spied class or function. - */ - type Spied = JestSpied; - /** - * Constructs the type of a spied class. - */ - type SpiedClass = JestSpiedClass; - /** - * Constructs the type of a spied function. - */ - type SpiedFunction = JestSpiedFunction; - /** - * Constructs the type of a spied getter. - */ - type SpiedGetter = JestSpiedGetter; - /** - * Constructs the type of a spied setter. - */ - type SpiedSetter = JestSpiedSetter; -} -export { jest }; diff --git a/node_modules/@jest/globals/build/index.js b/node_modules/@jest/globals/build/index.js deleted file mode 100644 index ebd57915b..000000000 --- a/node_modules/@jest/globals/build/index.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// eslint-disable-next-line @typescript-eslint/no-namespace - -throw new Error( - 'Do not import `@jest/globals` outside of the Jest test environment' -); diff --git a/node_modules/@jest/globals/package.json b/node_modules/@jest/globals/package.json deleted file mode 100644 index 11c9be3df..000000000 --- a/node_modules/@jest/globals/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@jest/globals", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-globals" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@jest/environment": "^29.5.0", - "@jest/expect": "^29.5.0", - "@jest/types": "^29.5.0", - "jest-mock": "^29.5.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/reporters/LICENSE b/node_modules/@jest/reporters/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/reporters/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/reporters/assets/jest_logo.png b/node_modules/@jest/reporters/assets/jest_logo.png deleted file mode 100644 index 1e8274df8..000000000 Binary files a/node_modules/@jest/reporters/assets/jest_logo.png and /dev/null differ diff --git a/node_modules/@jest/reporters/build/BaseReporter.js b/node_modules/@jest/reporters/build/BaseReporter.js deleted file mode 100644 index 83ce850a1..000000000 --- a/node_modules/@jest/reporters/build/BaseReporter.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const {remove: preRunMessageRemove} = _jestUtil().preRunMessage; -class BaseReporter { - _error; - log(message) { - process.stderr.write(`${message}\n`); - } - onRunStart(_results, _options) { - preRunMessageRemove(process.stderr); - } - - /* eslint-disable @typescript-eslint/no-empty-function */ - onTestCaseResult(_test, _testCaseResult) {} - onTestResult(_test, _testResult, _results) {} - onTestStart(_test) {} - onRunComplete(_testContexts, _aggregatedResults) {} - /* eslint-enable */ - - _setError(error) { - this._error = error; - } - - // Return an error that occurred during reporting. This error will - // define whether the test run was successful or failed. - getLastError() { - return this._error; - } -} -exports.default = BaseReporter; diff --git a/node_modules/@jest/reporters/build/CoverageReporter.js b/node_modules/@jest/reporters/build/CoverageReporter.js deleted file mode 100644 index 70ac001a3..000000000 --- a/node_modules/@jest/reporters/build/CoverageReporter.js +++ /dev/null @@ -1,561 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function _v8Coverage() { - const data = require('@bcoe/v8-coverage'); - _v8Coverage = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _glob() { - const data = _interopRequireDefault(require('glob')); - _glob = function () { - return data; - }; - return data; -} -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - fs = function () { - return data; - }; - return data; -} -function _istanbulLibCoverage() { - const data = _interopRequireDefault(require('istanbul-lib-coverage')); - _istanbulLibCoverage = function () { - return data; - }; - return data; -} -function _istanbulLibReport() { - const data = _interopRequireDefault(require('istanbul-lib-report')); - _istanbulLibReport = function () { - return data; - }; - return data; -} -function _istanbulLibSourceMaps() { - const data = _interopRequireDefault(require('istanbul-lib-source-maps')); - _istanbulLibSourceMaps = function () { - return data; - }; - return data; -} -function _istanbulReports() { - const data = _interopRequireDefault(require('istanbul-reports')); - _istanbulReports = function () { - return data; - }; - return data; -} -function _v8ToIstanbul() { - const data = _interopRequireDefault(require('v8-to-istanbul')); - _v8ToIstanbul = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _jestWorker() { - const data = require('jest-worker'); - _jestWorker = function () { - return data; - }; - return data; -} -var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); -var _getWatermarks = _interopRequireDefault(require('./getWatermarks')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const FAIL_COLOR = _chalk().default.bold.red; -const RUNNING_TEST_COLOR = _chalk().default.bold.dim; -class CoverageReporter extends _BaseReporter.default { - _context; - _coverageMap; - _globalConfig; - _sourceMapStore; - _v8CoverageResults; - static filename = __filename; - constructor(globalConfig, context) { - super(); - this._context = context; - this._coverageMap = _istanbulLibCoverage().default.createCoverageMap({}); - this._globalConfig = globalConfig; - this._sourceMapStore = - _istanbulLibSourceMaps().default.createSourceMapStore(); - this._v8CoverageResults = []; - } - onTestResult(_test, testResult) { - if (testResult.v8Coverage) { - this._v8CoverageResults.push(testResult.v8Coverage); - return; - } - if (testResult.coverage) { - this._coverageMap.merge(testResult.coverage); - } - } - async onRunComplete(testContexts, aggregatedResults) { - await this._addUntestedFiles(testContexts); - const {map, reportContext} = await this._getCoverageResult(); - try { - const coverageReporters = this._globalConfig.coverageReporters || []; - if (!this._globalConfig.useStderr && coverageReporters.length < 1) { - coverageReporters.push('text-summary'); - } - coverageReporters.forEach(reporter => { - let additionalOptions = {}; - if (Array.isArray(reporter)) { - [reporter, additionalOptions] = reporter; - } - _istanbulReports() - .default.create(reporter, { - maxCols: process.stdout.columns || Infinity, - ...additionalOptions - }) - .execute(reportContext); - }); - aggregatedResults.coverageMap = map; - } catch (e) { - console.error( - _chalk().default.red(` - Failed to write coverage reports: - ERROR: ${e.toString()} - STACK: ${e.stack} - `) - ); - } - this._checkThreshold(map); - } - async _addUntestedFiles(testContexts) { - const files = []; - testContexts.forEach(context => { - const config = context.config; - if ( - this._globalConfig.collectCoverageFrom && - this._globalConfig.collectCoverageFrom.length - ) { - context.hasteFS - .matchFilesWithGlob( - this._globalConfig.collectCoverageFrom, - config.rootDir - ) - .forEach(filePath => - files.push({ - config, - path: filePath - }) - ); - } - }); - if (!files.length) { - return; - } - if (_jestUtil().isInteractive) { - process.stderr.write( - RUNNING_TEST_COLOR('Running coverage on untested files...') - ); - } - let worker; - if (this._globalConfig.maxWorkers <= 1) { - worker = require('./CoverageWorker'); - } else { - worker = new (_jestWorker().Worker)(require.resolve('./CoverageWorker'), { - enableWorkerThreads: this._globalConfig.workerThreads, - exposedMethods: ['worker'], - forkOptions: { - serialization: 'json' - }, - maxRetries: 2, - numWorkers: this._globalConfig.maxWorkers - }); - } - const instrumentation = files.map(async fileObj => { - const filename = fileObj.path; - const config = fileObj.config; - const hasCoverageData = this._v8CoverageResults.some(v8Res => - v8Res.some(innerRes => innerRes.result.url === filename) - ); - if ( - !hasCoverageData && - !this._coverageMap.data[filename] && - 'worker' in worker - ) { - try { - const result = await worker.worker({ - config, - context: { - changedFiles: - this._context.changedFiles && - Array.from(this._context.changedFiles), - sourcesRelatedToTestsInChangedFiles: - this._context.sourcesRelatedToTestsInChangedFiles && - Array.from(this._context.sourcesRelatedToTestsInChangedFiles) - }, - globalConfig: this._globalConfig, - path: filename - }); - if (result) { - if (result.kind === 'V8Coverage') { - this._v8CoverageResults.push([ - { - codeTransformResult: undefined, - result: result.result - } - ]); - } else { - this._coverageMap.addFileCoverage(result.coverage); - } - } - } catch (error) { - console.error( - _chalk().default.red( - [ - `Failed to collect coverage from ${filename}`, - `ERROR: ${error.message}`, - `STACK: ${error.stack}` - ].join('\n') - ) - ); - } - } - }); - try { - await Promise.all(instrumentation); - } catch { - // Do nothing; errors were reported earlier to the console. - } - if (_jestUtil().isInteractive) { - (0, _jestUtil().clearLine)(process.stderr); - } - if (worker && 'end' in worker && typeof worker.end === 'function') { - await worker.end(); - } - } - _checkThreshold(map) { - const {coverageThreshold} = this._globalConfig; - if (coverageThreshold) { - function check(name, thresholds, actuals) { - return ['statements', 'branches', 'lines', 'functions'].reduce( - (errors, key) => { - const actual = actuals[key].pct; - const actualUncovered = actuals[key].total - actuals[key].covered; - const threshold = thresholds[key]; - if (threshold !== undefined) { - if (threshold < 0) { - if (threshold * -1 < actualUncovered) { - errors.push( - `Jest: Uncovered count for ${key} (${actualUncovered}) ` + - `exceeds ${name} threshold (${-1 * threshold})` - ); - } - } else if (actual < threshold) { - errors.push( - `Jest: "${name}" coverage threshold for ${key} (${threshold}%) not met: ${actual}%` - ); - } - } - return errors; - }, - [] - ); - } - const THRESHOLD_GROUP_TYPES = { - GLOB: 'glob', - GLOBAL: 'global', - PATH: 'path' - }; - const coveredFiles = map.files(); - const thresholdGroups = Object.keys(coverageThreshold); - const groupTypeByThresholdGroup = {}; - const filesByGlob = {}; - const coveredFilesSortedIntoThresholdGroup = coveredFiles.reduce( - (files, file) => { - const pathOrGlobMatches = thresholdGroups.reduce( - (agg, thresholdGroup) => { - // Preserve trailing slash, but not required if root dir - // See https://github.com/facebook/jest/issues/12703 - const resolvedThresholdGroup = path().resolve(thresholdGroup); - const suffix = - (thresholdGroup.endsWith(path().sep) || - (process.platform === 'win32' && - thresholdGroup.endsWith('/'))) && - !resolvedThresholdGroup.endsWith(path().sep) - ? path().sep - : ''; - const absoluteThresholdGroup = `${resolvedThresholdGroup}${suffix}`; - - // The threshold group might be a path: - - if (file.indexOf(absoluteThresholdGroup) === 0) { - groupTypeByThresholdGroup[thresholdGroup] = - THRESHOLD_GROUP_TYPES.PATH; - return agg.concat([[file, thresholdGroup]]); - } - - // If the threshold group is not a path it might be a glob: - - // Note: glob.sync is slow. By memoizing the files matching each glob - // (rather than recalculating it for each covered file) we save a tonne - // of execution time. - if (filesByGlob[absoluteThresholdGroup] === undefined) { - filesByGlob[absoluteThresholdGroup] = _glob() - .default.sync(absoluteThresholdGroup) - .map(filePath => path().resolve(filePath)); - } - if (filesByGlob[absoluteThresholdGroup].indexOf(file) > -1) { - groupTypeByThresholdGroup[thresholdGroup] = - THRESHOLD_GROUP_TYPES.GLOB; - return agg.concat([[file, thresholdGroup]]); - } - return agg; - }, - [] - ); - if (pathOrGlobMatches.length > 0) { - return files.concat(pathOrGlobMatches); - } - - // Neither a glob or a path? Toss it in global if there's a global threshold: - if (thresholdGroups.indexOf(THRESHOLD_GROUP_TYPES.GLOBAL) > -1) { - groupTypeByThresholdGroup[THRESHOLD_GROUP_TYPES.GLOBAL] = - THRESHOLD_GROUP_TYPES.GLOBAL; - return files.concat([[file, THRESHOLD_GROUP_TYPES.GLOBAL]]); - } - - // A covered file that doesn't have a threshold: - return files.concat([[file, undefined]]); - }, - [] - ); - const getFilesInThresholdGroup = thresholdGroup => - coveredFilesSortedIntoThresholdGroup - .filter(fileAndGroup => fileAndGroup[1] === thresholdGroup) - .map(fileAndGroup => fileAndGroup[0]); - function combineCoverage(filePaths) { - return filePaths - .map(filePath => map.fileCoverageFor(filePath)) - .reduce((combinedCoverage, nextFileCoverage) => { - if (combinedCoverage === undefined || combinedCoverage === null) { - return nextFileCoverage.toSummary(); - } - return combinedCoverage.merge(nextFileCoverage.toSummary()); - }, undefined); - } - let errors = []; - thresholdGroups.forEach(thresholdGroup => { - switch (groupTypeByThresholdGroup[thresholdGroup]) { - case THRESHOLD_GROUP_TYPES.GLOBAL: { - const coverage = combineCoverage( - getFilesInThresholdGroup(THRESHOLD_GROUP_TYPES.GLOBAL) - ); - if (coverage) { - errors = errors.concat( - check( - thresholdGroup, - coverageThreshold[thresholdGroup], - coverage - ) - ); - } - break; - } - case THRESHOLD_GROUP_TYPES.PATH: { - const coverage = combineCoverage( - getFilesInThresholdGroup(thresholdGroup) - ); - if (coverage) { - errors = errors.concat( - check( - thresholdGroup, - coverageThreshold[thresholdGroup], - coverage - ) - ); - } - break; - } - case THRESHOLD_GROUP_TYPES.GLOB: - getFilesInThresholdGroup(thresholdGroup).forEach( - fileMatchingGlob => { - errors = errors.concat( - check( - fileMatchingGlob, - coverageThreshold[thresholdGroup], - map.fileCoverageFor(fileMatchingGlob).toSummary() - ) - ); - } - ); - break; - default: - // If the file specified by path is not found, error is returned. - if (thresholdGroup !== THRESHOLD_GROUP_TYPES.GLOBAL) { - errors = errors.concat( - `Jest: Coverage data for ${thresholdGroup} was not found.` - ); - } - // Sometimes all files in the coverage data are matched by - // PATH and GLOB threshold groups in which case, don't error when - // the global threshold group doesn't match any files. - } - }); - - errors = errors.filter( - err => err !== undefined && err !== null && err.length > 0 - ); - if (errors.length > 0) { - this.log(`${FAIL_COLOR(errors.join('\n'))}`); - this._setError(new Error(errors.join('\n'))); - } - } - } - async _getCoverageResult() { - if (this._globalConfig.coverageProvider === 'v8') { - const mergedCoverages = (0, _v8Coverage().mergeProcessCovs)( - this._v8CoverageResults.map(cov => ({ - result: cov.map(r => r.result) - })) - ); - const fileTransforms = new Map(); - this._v8CoverageResults.forEach(res => - res.forEach(r => { - if (r.codeTransformResult && !fileTransforms.has(r.result.url)) { - fileTransforms.set(r.result.url, r.codeTransformResult); - } - }) - ); - const transformedCoverage = await Promise.all( - mergedCoverages.result.map(async res => { - const fileTransform = fileTransforms.get(res.url); - let sourcemapContent = undefined; - if ( - fileTransform?.sourceMapPath && - fs().existsSync(fileTransform.sourceMapPath) - ) { - sourcemapContent = JSON.parse( - fs().readFileSync(fileTransform.sourceMapPath, 'utf8') - ); - } - const converter = (0, _v8ToIstanbul().default)( - res.url, - fileTransform?.wrapperLength ?? 0, - fileTransform && sourcemapContent - ? { - originalSource: fileTransform.originalCode, - source: fileTransform.code, - sourceMap: { - sourcemap: { - file: res.url, - ...sourcemapContent - } - } - } - : { - source: fs().readFileSync(res.url, 'utf8') - } - ); - await converter.load(); - converter.applyCoverage(res.functions); - const istanbulData = converter.toIstanbul(); - return istanbulData; - }) - ); - const map = _istanbulLibCoverage().default.createCoverageMap({}); - transformedCoverage.forEach(res => map.merge(res)); - const reportContext = _istanbulLibReport().default.createContext({ - coverageMap: map, - dir: this._globalConfig.coverageDirectory, - watermarks: (0, _getWatermarks.default)(this._globalConfig) - }); - return { - map, - reportContext - }; - } - const map = await this._sourceMapStore.transformCoverage(this._coverageMap); - const reportContext = _istanbulLibReport().default.createContext({ - coverageMap: map, - dir: this._globalConfig.coverageDirectory, - sourceFinder: this._sourceMapStore.sourceFinder, - watermarks: (0, _getWatermarks.default)(this._globalConfig) - }); - return { - map, - reportContext - }; - } -} -exports.default = CoverageReporter; diff --git a/node_modules/@jest/reporters/build/CoverageWorker.js b/node_modules/@jest/reporters/build/CoverageWorker.js deleted file mode 100644 index 685fcfacb..000000000 --- a/node_modules/@jest/reporters/build/CoverageWorker.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.worker = worker; -function _exit() { - const data = _interopRequireDefault(require('exit')); - _exit = function () { - return data; - }; - return data; -} -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - fs = function () { - return data; - }; - return data; -} -var _generateEmptyCoverage = _interopRequireDefault( - require('./generateEmptyCoverage') -); -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// Make sure uncaught errors are logged before we exit. -process.on('uncaughtException', err => { - console.error(err.stack); - (0, _exit().default)(1); -}); -function worker({config, globalConfig, path, context}) { - return (0, _generateEmptyCoverage.default)( - fs().readFileSync(path, 'utf8'), - path, - globalConfig, - config, - context.changedFiles && new Set(context.changedFiles), - context.sourcesRelatedToTestsInChangedFiles && - new Set(context.sourcesRelatedToTestsInChangedFiles) - ); -} diff --git a/node_modules/@jest/reporters/build/DefaultReporter.js b/node_modules/@jest/reporters/build/DefaultReporter.js deleted file mode 100644 index eb1c0e06c..000000000 --- a/node_modules/@jest/reporters/build/DefaultReporter.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _console() { - const data = require('@jest/console'); - _console = function () { - return data; - }; - return data; -} -function _jestMessageUtil() { - const data = require('jest-message-util'); - _jestMessageUtil = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); -var _Status = _interopRequireDefault(require('./Status')); -var _getResultHeader = _interopRequireDefault(require('./getResultHeader')); -var _getSnapshotStatus = _interopRequireDefault(require('./getSnapshotStatus')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const TITLE_BULLET = _chalk().default.bold('\u25cf '); -class DefaultReporter extends _BaseReporter.default { - _clear; // ANSI clear sequence for the last printed status - _err; - _globalConfig; - _out; - _status; - _bufferedOutput; - static filename = __filename; - constructor(globalConfig) { - super(); - this._globalConfig = globalConfig; - this._clear = ''; - this._out = process.stdout.write.bind(process.stdout); - this._err = process.stderr.write.bind(process.stderr); - this._status = new _Status.default(globalConfig); - this._bufferedOutput = new Set(); - this.__wrapStdio(process.stdout); - this.__wrapStdio(process.stderr); - this._status.onChange(() => { - this.__clearStatus(); - this.__printStatus(); - }); - } - __wrapStdio(stream) { - const write = stream.write.bind(stream); - let buffer = []; - let timeout = null; - const flushBufferedOutput = () => { - const string = buffer.join(''); - buffer = []; - - // This is to avoid conflicts between random output and status text - this.__clearStatus(); - if (string) { - write(string); - } - this.__printStatus(); - this._bufferedOutput.delete(flushBufferedOutput); - }; - this._bufferedOutput.add(flushBufferedOutput); - const debouncedFlush = () => { - // If the process blows up no errors would be printed. - // There should be a smart way to buffer stderr, but for now - // we just won't buffer it. - if (stream === process.stderr) { - flushBufferedOutput(); - } else { - if (!timeout) { - timeout = setTimeout(() => { - flushBufferedOutput(); - timeout = null; - }, 100); - } - } - }; - stream.write = chunk => { - buffer.push(chunk); - debouncedFlush(); - return true; - }; - } - - // Don't wait for the debounced call and flush all output immediately. - forceFlushBufferedOutput() { - for (const flushBufferedOutput of this._bufferedOutput) { - flushBufferedOutput(); - } - } - __clearStatus() { - if (_jestUtil().isInteractive) { - if (this._globalConfig.useStderr) { - this._err(this._clear); - } else { - this._out(this._clear); - } - } - } - __printStatus() { - const {content, clear} = this._status.get(); - this._clear = clear; - if (_jestUtil().isInteractive) { - if (this._globalConfig.useStderr) { - this._err(content); - } else { - this._out(content); - } - } - } - onRunStart(aggregatedResults, options) { - this._status.runStarted(aggregatedResults, options); - } - onTestStart(test) { - this._status.testStarted(test.path, test.context.config); - } - onTestCaseResult(test, testCaseResult) { - this._status.addTestCaseResult(test, testCaseResult); - } - onRunComplete() { - this.forceFlushBufferedOutput(); - this._status.runFinished(); - process.stdout.write = this._out; - process.stderr.write = this._err; - (0, _jestUtil().clearLine)(process.stderr); - } - onTestResult(test, testResult, aggregatedResults) { - this.testFinished(test.context.config, testResult, aggregatedResults); - if (!testResult.skipped) { - this.printTestFileHeader( - testResult.testFilePath, - test.context.config, - testResult - ); - this.printTestFileFailureMessage( - testResult.testFilePath, - test.context.config, - testResult - ); - } - this.forceFlushBufferedOutput(); - } - testFinished(config, testResult, aggregatedResults) { - this._status.testFinished(config, testResult, aggregatedResults); - } - printTestFileHeader(testPath, config, result) { - // log retry errors if any exist - result.testResults.forEach(testResult => { - const testRetryReasons = testResult.retryReasons; - if (testRetryReasons && testRetryReasons.length > 0) { - this.log( - `${_chalk().default.reset.inverse.bold.yellow( - ' LOGGING RETRY ERRORS ' - )} ${_chalk().default.bold(testResult.fullName)}` - ); - testRetryReasons.forEach((retryReasons, index) => { - let {message, stack} = (0, - _jestMessageUtil().separateMessageFromStack)(retryReasons); - stack = this._globalConfig.noStackTrace - ? '' - : _chalk().default.dim( - (0, _jestMessageUtil().formatStackTrace)( - stack, - config, - this._globalConfig, - testPath - ) - ); - message = (0, _jestMessageUtil().indentAllLines)(message); - this.log( - `${_chalk().default.reset.inverse.bold.blueBright( - ` RETRY ${index + 1} ` - )}\n` - ); - this.log(`${message}\n${stack}\n`); - }); - } - }); - this.log((0, _getResultHeader.default)(result, this._globalConfig, config)); - if (result.console) { - this.log( - ` ${TITLE_BULLET}Console\n\n${(0, _console().getConsoleOutput)( - result.console, - config, - this._globalConfig - )}` - ); - } - } - printTestFileFailureMessage(_testPath, _config, result) { - if (result.failureMessage) { - this.log(result.failureMessage); - } - const didUpdate = this._globalConfig.updateSnapshot === 'all'; - const snapshotStatuses = (0, _getSnapshotStatus.default)( - result.snapshot, - didUpdate - ); - snapshotStatuses.forEach(this.log); - } -} -exports.default = DefaultReporter; diff --git a/node_modules/@jest/reporters/build/GitHubActionsReporter.js b/node_modules/@jest/reporters/build/GitHubActionsReporter.js deleted file mode 100644 index 4064e5c7f..000000000 --- a/node_modules/@jest/reporters/build/GitHubActionsReporter.js +++ /dev/null @@ -1,364 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _stripAnsi() { - const data = _interopRequireDefault(require('strip-ansi')); - _stripAnsi = function () { - return data; - }; - return data; -} -function _jestMessageUtil() { - const data = require('jest-message-util'); - _jestMessageUtil = function () { - return data; - }; - return data; -} -var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const titleSeparator = ' \u203A '; -class GitHubActionsReporter extends _BaseReporter.default { - static filename = __filename; - options; - constructor( - _globalConfig, - reporterOptions = { - silent: true - } - ) { - super(); - this.options = { - silent: - typeof reporterOptions.silent === 'boolean' - ? reporterOptions.silent - : true - }; - } - onTestResult(test, testResult, aggregatedResults) { - this.generateAnnotations(test, testResult); - if (!this.options.silent) { - this.printFullResult(test.context, testResult); - } - if (this.isLastTestSuite(aggregatedResults)) { - this.printFailedTestLogs(test, aggregatedResults); - } - } - generateAnnotations({context}, {testResults}) { - testResults.forEach(result => { - const title = [...result.ancestorTitles, result.title].join( - titleSeparator - ); - result.retryReasons?.forEach((retryReason, index) => { - this.#createAnnotation({ - ...this.#getMessageDetails(retryReason, context.config), - title: `RETRY ${index + 1}: ${title}`, - type: 'warning' - }); - }); - result.failureMessages.forEach(failureMessage => { - this.#createAnnotation({ - ...this.#getMessageDetails(failureMessage, context.config), - title, - type: 'error' - }); - }); - }); - } - #getMessageDetails(failureMessage, config) { - const {message, stack} = (0, _jestMessageUtil().separateMessageFromStack)( - failureMessage - ); - const stackLines = (0, _jestMessageUtil().getStackTraceLines)(stack); - const topFrame = (0, _jestMessageUtil().getTopFrame)(stackLines); - const normalizedStackLines = stackLines.map(line => - (0, _jestMessageUtil().formatPath)(line, config) - ); - const messageText = [message, ...normalizedStackLines].join('\n'); - return { - file: topFrame?.file, - line: topFrame?.line, - message: messageText - }; - } - #createAnnotation({file, line, message, title, type}) { - message = (0, _stripAnsi().default)( - // copied from: https://github.com/actions/toolkit/blob/main/packages/core/src/command.ts - message.replace(/%/g, '%25').replace(/\r/g, '%0D').replace(/\n/g, '%0A') - ); - this.log( - `\n::${type} file=${file},line=${line},title=${title}::${message}` - ); - } - isLastTestSuite(results) { - const passedTestSuites = results.numPassedTestSuites; - const failedTestSuites = results.numFailedTestSuites; - const totalTestSuites = results.numTotalTestSuites; - const computedTotal = passedTestSuites + failedTestSuites; - if (computedTotal < totalTestSuites) { - return false; - } else if (computedTotal === totalTestSuites) { - return true; - } else { - throw new Error( - `Sum(${computedTotal}) of passed (${passedTestSuites}) and failed (${failedTestSuites}) test suites is greater than the total number of test suites (${totalTestSuites}). Please report the bug at https://github.com/facebook/jest/issues` - ); - } - } - printFullResult(context, results) { - const rootDir = context.config.rootDir; - let testDir = results.testFilePath.replace(rootDir, ''); - testDir = testDir.slice(1, testDir.length); - const resultTree = this.getResultTree( - results.testResults, - testDir, - results.perfStats - ); - this.printResultTree(resultTree); - } - arrayEqual(a1, a2) { - if (a1.length !== a2.length) { - return false; - } - for (let index = 0; index < a1.length; index++) { - const element = a1[index]; - if (element !== a2[index]) { - return false; - } - } - return true; - } - arrayChild(a1, a2) { - if (a1.length - a2.length !== 1) { - return false; - } - for (let index = 0; index < a2.length; index++) { - const element = a2[index]; - if (element !== a1[index]) { - return false; - } - } - return true; - } - getResultTree(suiteResult, testPath, suitePerf) { - const root = { - children: [], - name: testPath, - passed: true, - performanceInfo: suitePerf - }; - const branches = []; - suiteResult.forEach(element => { - if (element.ancestorTitles.length === 0) { - let passed = true; - if (element.status !== 'passed') { - root.passed = false; - passed = false; - } - const duration = element.duration || 1; - root.children.push({ - children: [], - duration, - name: element.title, - passed - }); - } else { - let alreadyInserted = false; - for (let index = 0; index < branches.length; index++) { - if ( - this.arrayEqual(branches[index], element.ancestorTitles.slice(0, 1)) - ) { - alreadyInserted = true; - break; - } - } - if (!alreadyInserted) { - branches.push(element.ancestorTitles.slice(0, 1)); - } - } - }); - branches.forEach(element => { - const newChild = this.getResultChildren(suiteResult, element); - if (!newChild.passed) { - root.passed = false; - } - root.children.push(newChild); - }); - return root; - } - getResultChildren(suiteResult, ancestors) { - const node = { - children: [], - name: ancestors[ancestors.length - 1], - passed: true - }; - const branches = []; - suiteResult.forEach(element => { - let passed = true; - let duration = element.duration; - if (!duration || isNaN(duration)) { - duration = 1; - } - if (this.arrayEqual(element.ancestorTitles, ancestors)) { - if (element.status !== 'passed') { - node.passed = false; - passed = false; - } - node.children.push({ - children: [], - duration, - name: element.title, - passed - }); - } else if ( - this.arrayChild( - element.ancestorTitles.slice(0, ancestors.length + 1), - ancestors - ) - ) { - let alreadyInserted = false; - for (let index = 0; index < branches.length; index++) { - if ( - this.arrayEqual( - branches[index], - element.ancestorTitles.slice(0, ancestors.length + 1) - ) - ) { - alreadyInserted = true; - break; - } - } - if (!alreadyInserted) { - branches.push(element.ancestorTitles.slice(0, ancestors.length + 1)); - } - } - }); - branches.forEach(element => { - const newChild = this.getResultChildren(suiteResult, element); - if (!newChild.passed) { - node.passed = false; - } - node.children.push(newChild); - }); - return node; - } - printResultTree(resultTree) { - let perfMs; - if (resultTree.performanceInfo.slow) { - perfMs = ` (${_chalk().default.red.inverse( - `${resultTree.performanceInfo.runtime} ms` - )})`; - } else { - perfMs = ` (${resultTree.performanceInfo.runtime} ms)`; - } - if (resultTree.passed) { - this.startGroup( - `${_chalk().default.bold.green.inverse('PASS')} ${ - resultTree.name - }${perfMs}` - ); - resultTree.children.forEach(child => { - this.recursivePrintResultTree(child, true, 1); - }); - this.endGroup(); - } else { - this.log( - ` ${_chalk().default.bold.red.inverse('FAIL')} ${ - resultTree.name - }${perfMs}` - ); - resultTree.children.forEach(child => { - this.recursivePrintResultTree(child, false, 1); - }); - } - } - recursivePrintResultTree(resultTree, alreadyGrouped, depth) { - if (resultTree.children.length === 0) { - if (!('duration' in resultTree)) { - throw new Error('Expected a leaf. Got a node.'); - } - let numberSpaces = depth; - if (!alreadyGrouped) { - numberSpaces++; - } - const spaces = ' '.repeat(numberSpaces); - let resultSymbol; - if (resultTree.passed) { - resultSymbol = _chalk().default.green('\u2713'); - } else { - resultSymbol = _chalk().default.red('\u00D7'); - } - this.log( - `${spaces + resultSymbol} ${resultTree.name} (${ - resultTree.duration - } ms)` - ); - } else { - if (resultTree.passed) { - if (alreadyGrouped) { - this.log(' '.repeat(depth) + resultTree.name); - resultTree.children.forEach(child => { - this.recursivePrintResultTree(child, true, depth + 1); - }); - } else { - this.startGroup(' '.repeat(depth) + resultTree.name); - resultTree.children.forEach(child => { - this.recursivePrintResultTree(child, true, depth + 1); - }); - this.endGroup(); - } - } else { - this.log(' '.repeat(depth + 1) + resultTree.name); - resultTree.children.forEach(child => { - this.recursivePrintResultTree(child, false, depth + 1); - }); - } - } - } - printFailedTestLogs(context, testResults) { - const rootDir = context.context.config.rootDir; - const results = testResults.testResults; - let written = false; - results.forEach(result => { - let testDir = result.testFilePath; - testDir = testDir.replace(rootDir, ''); - testDir = testDir.slice(1, testDir.length); - if (result.failureMessage) { - if (!written) { - this.log(''); - written = true; - } - this.startGroup(`Errors thrown in ${testDir}`); - this.log(result.failureMessage); - this.endGroup(); - } - }); - return written; - } - startGroup(title) { - this.log(`::group::${title}`); - } - endGroup() { - this.log('::endgroup::'); - } -} -exports.default = GitHubActionsReporter; diff --git a/node_modules/@jest/reporters/build/NotifyReporter.js b/node_modules/@jest/reporters/build/NotifyReporter.js deleted file mode 100644 index fec46abcb..000000000 --- a/node_modules/@jest/reporters/build/NotifyReporter.js +++ /dev/null @@ -1,218 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function util() { - const data = _interopRequireWildcard(require('util')); - util = function () { - return data; - }; - return data; -} -function _exit() { - const data = _interopRequireDefault(require('exit')); - _exit = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const isDarwin = process.platform === 'darwin'; -const icon = path().resolve(__dirname, '../assets/jest_logo.png'); -class NotifyReporter extends _BaseReporter.default { - _notifier = loadNotifier(); - _globalConfig; - _context; - static filename = __filename; - constructor(globalConfig, context) { - super(); - this._globalConfig = globalConfig; - this._context = context; - } - onRunComplete(testContexts, result) { - const success = - result.numFailedTests === 0 && result.numRuntimeErrorTestSuites === 0; - const firstContext = testContexts.values().next(); - const hasteFS = - firstContext && firstContext.value && firstContext.value.hasteFS; - let packageName; - if (hasteFS != null) { - // assuming root package.json is the first one - const [filePath] = hasteFS.matchFiles('package.json'); - packageName = - filePath != null - ? hasteFS.getModuleName(filePath) - : this._globalConfig.rootDir; - } else { - packageName = this._globalConfig.rootDir; - } - packageName = packageName != null ? `${packageName} - ` : ''; - const notifyMode = this._globalConfig.notifyMode; - const statusChanged = - this._context.previousSuccess !== success || this._context.firstRun; - const testsHaveRun = result.numTotalTests !== 0; - if ( - testsHaveRun && - success && - (notifyMode === 'always' || - notifyMode === 'success' || - notifyMode === 'success-change' || - (notifyMode === 'change' && statusChanged) || - (notifyMode === 'failure-change' && statusChanged)) - ) { - const title = util().format('%s%d%% Passed', packageName, 100); - const message = `${isDarwin ? '\u2705 ' : ''}${(0, _jestUtil().pluralize)( - 'test', - result.numPassedTests - )} passed`; - this._notifier.notify({ - hint: 'int:transient:1', - icon, - message, - timeout: false, - title - }); - } else if ( - testsHaveRun && - !success && - (notifyMode === 'always' || - notifyMode === 'failure' || - notifyMode === 'failure-change' || - (notifyMode === 'change' && statusChanged) || - (notifyMode === 'success-change' && statusChanged)) - ) { - const failed = result.numFailedTests / result.numTotalTests; - const title = util().format( - '%s%d%% Failed', - packageName, - Math.ceil(Number.isNaN(failed) ? 0 : failed * 100) - ); - const message = util().format( - `${isDarwin ? '\u26D4\uFE0F ' : ''}%d of %d tests failed`, - result.numFailedTests, - result.numTotalTests - ); - const watchMode = this._globalConfig.watch || this._globalConfig.watchAll; - const restartAnswer = 'Run again'; - const quitAnswer = 'Exit tests'; - if (!watchMode) { - this._notifier.notify({ - hint: 'int:transient:1', - icon, - message, - timeout: false, - title - }); - } else { - this._notifier.notify( - { - // @ts-expect-error - not all options are supported by all systems (specifically `actions` and `hint`) - actions: [restartAnswer, quitAnswer], - closeLabel: 'Close', - hint: 'int:transient:1', - icon, - message, - timeout: false, - title - }, - (err, _, metadata) => { - if (err || !metadata) { - return; - } - if (metadata.activationValue === quitAnswer) { - (0, _exit().default)(0); - return; - } - if ( - metadata.activationValue === restartAnswer && - this._context.startRun - ) { - this._context.startRun(this._globalConfig); - } - } - ); - } - } - this._context.previousSuccess = success; - this._context.firstRun = false; - } -} -exports.default = NotifyReporter; -function loadNotifier() { - try { - return require('node-notifier'); - } catch (err) { - if (err.code !== 'MODULE_NOT_FOUND') { - throw err; - } - throw Error( - 'notify reporter requires optional peer dependency "node-notifier" but it was not found' - ); - } -} diff --git a/node_modules/@jest/reporters/build/Status.js b/node_modules/@jest/reporters/build/Status.js deleted file mode 100644 index 1e751df8b..000000000 --- a/node_modules/@jest/reporters/build/Status.js +++ /dev/null @@ -1,214 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _stringLength() { - const data = _interopRequireDefault(require('string-length')); - _stringLength = function () { - return data; - }; - return data; -} -var _getSummary = _interopRequireDefault(require('./getSummary')); -var _printDisplayName = _interopRequireDefault(require('./printDisplayName')); -var _trimAndFormatPath = _interopRequireDefault(require('./trimAndFormatPath')); -var _wrapAnsiString = _interopRequireDefault(require('./wrapAnsiString')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const RUNNING_TEXT = ' RUNS '; -const RUNNING = `${_chalk().default.reset.inverse.yellow.bold(RUNNING_TEXT)} `; - -/** - * This class is a perf optimization for sorting the list of currently - * running tests. It tries to keep tests in the same positions without - * shifting the whole list. - */ -class CurrentTestList { - _array; - constructor() { - this._array = []; - } - add(testPath, config) { - const index = this._array.indexOf(null); - const record = { - config, - testPath - }; - if (index !== -1) { - this._array[index] = record; - } else { - this._array.push(record); - } - } - delete(testPath) { - const record = this._array.find( - record => record !== null && record.testPath === testPath - ); - this._array[this._array.indexOf(record || null)] = null; - } - get() { - return this._array; - } -} -/** - * A class that generates the CLI status of currently running tests - * and also provides an ANSI escape sequence to remove status lines - * from the terminal. - */ -class Status { - _cache; - _callback; - _currentTests; - _currentTestCases; - _done; - _emitScheduled; - _estimatedTime; - _interval; - _aggregatedResults; - _showStatus; - constructor(_globalConfig) { - this._globalConfig = _globalConfig; - this._cache = null; - this._currentTests = new CurrentTestList(); - this._currentTestCases = []; - this._done = false; - this._emitScheduled = false; - this._estimatedTime = 0; - this._showStatus = false; - } - onChange(callback) { - this._callback = callback; - } - runStarted(aggregatedResults, options) { - this._estimatedTime = (options && options.estimatedTime) || 0; - this._showStatus = options && options.showStatus; - this._interval = setInterval(() => this._tick(), 1000); - this._aggregatedResults = aggregatedResults; - this._debouncedEmit(); - } - runFinished() { - this._done = true; - if (this._interval) clearInterval(this._interval); - this._emit(); - } - addTestCaseResult(test, testCaseResult) { - this._currentTestCases.push({ - test, - testCaseResult - }); - if (!this._showStatus) { - this._emit(); - } else { - this._debouncedEmit(); - } - } - testStarted(testPath, config) { - this._currentTests.add(testPath, config); - if (!this._showStatus) { - this._emit(); - } else { - this._debouncedEmit(); - } - } - testFinished(_config, testResult, aggregatedResults) { - const {testFilePath} = testResult; - this._aggregatedResults = aggregatedResults; - this._currentTests.delete(testFilePath); - this._currentTestCases = this._currentTestCases.filter(({test}) => { - if (_config !== test.context.config) { - return true; - } - return test.path !== testFilePath; - }); - this._debouncedEmit(); - } - get() { - if (this._cache) { - return this._cache; - } - if (this._done) { - return { - clear: '', - content: '' - }; - } - const width = process.stdout.columns; - let content = '\n'; - this._currentTests.get().forEach(record => { - if (record) { - const {config, testPath} = record; - const projectDisplayName = config.displayName - ? `${(0, _printDisplayName.default)(config)} ` - : ''; - const prefix = RUNNING + projectDisplayName; - content += `${(0, _wrapAnsiString.default)( - prefix + - (0, _trimAndFormatPath.default)( - (0, _stringLength().default)(prefix), - config, - testPath, - width - ), - width - )}\n`; - } - }); - if (this._showStatus && this._aggregatedResults) { - content += `\n${(0, _getSummary.default)(this._aggregatedResults, { - currentTestCases: this._currentTestCases, - estimatedTime: this._estimatedTime, - roundTime: true, - seed: this._globalConfig.seed, - showSeed: this._globalConfig.showSeed, - width - })}`; - } - let height = 0; - for (let i = 0; i < content.length; i++) { - if (content[i] === '\n') { - height++; - } - } - const clear = '\r\x1B[K\r\x1B[1A'.repeat(height); - return (this._cache = { - clear, - content - }); - } - _emit() { - this._cache = null; - if (this._callback) this._callback(); - } - _debouncedEmit() { - if (!this._emitScheduled) { - // Perf optimization to avoid two separate renders When - // one test finishes and another test starts executing. - this._emitScheduled = true; - setTimeout(() => { - this._emit(); - this._emitScheduled = false; - }, 100); - } - } - _tick() { - this._debouncedEmit(); - } -} -exports.default = Status; diff --git a/node_modules/@jest/reporters/build/SummaryReporter.js b/node_modules/@jest/reporters/build/SummaryReporter.js deleted file mode 100644 index da1bffac9..000000000 --- a/node_modules/@jest/reporters/build/SummaryReporter.js +++ /dev/null @@ -1,239 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); -var _getResultHeader = _interopRequireDefault(require('./getResultHeader')); -var _getSnapshotSummary = _interopRequireDefault( - require('./getSnapshotSummary') -); -var _getSummary = _interopRequireDefault(require('./getSummary')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const NPM_EVENTS = new Set([ - 'prepublish', - 'publish', - 'postpublish', - 'preinstall', - 'install', - 'postinstall', - 'preuninstall', - 'uninstall', - 'postuninstall', - 'preversion', - 'version', - 'postversion', - 'pretest', - 'test', - 'posttest', - 'prestop', - 'stop', - 'poststop', - 'prestart', - 'start', - 'poststart', - 'prerestart', - 'restart', - 'postrestart' -]); -const {npm_config_user_agent, npm_lifecycle_event, npm_lifecycle_script} = - process.env; -class SummaryReporter extends _BaseReporter.default { - _estimatedTime; - _globalConfig; - _summaryThreshold; - static filename = __filename; - constructor(globalConfig, options) { - super(); - this._globalConfig = globalConfig; - this._estimatedTime = 0; - this._validateOptions(options); - this._summaryThreshold = options?.summaryThreshold ?? 20; - } - _validateOptions(options) { - if ( - options?.summaryThreshold && - typeof options.summaryThreshold !== 'number' - ) { - throw new TypeError('The option summaryThreshold should be a number'); - } - } - - // If we write more than one character at a time it is possible that - // Node.js exits in the middle of printing the result. This was first observed - // in Node.js 0.10 and still persists in Node.js 6.7+. - // Let's print the test failure summary character by character which is safer - // when hundreds of tests are failing. - _write(string) { - for (let i = 0; i < string.length; i++) { - process.stderr.write(string.charAt(i)); - } - } - onRunStart(aggregatedResults, options) { - super.onRunStart(aggregatedResults, options); - this._estimatedTime = options.estimatedTime; - } - onRunComplete(testContexts, aggregatedResults) { - const {numTotalTestSuites, testResults, wasInterrupted} = aggregatedResults; - if (numTotalTestSuites) { - const lastResult = testResults[testResults.length - 1]; - // Print a newline if the last test did not fail to line up newlines - // similar to when an error would have been thrown in the test. - if ( - !this._globalConfig.verbose && - lastResult && - !lastResult.numFailingTests && - !lastResult.testExecError - ) { - this.log(''); - } - this._printSummary(aggregatedResults, this._globalConfig); - this._printSnapshotSummary( - aggregatedResults.snapshot, - this._globalConfig - ); - let message = (0, _getSummary.default)(aggregatedResults, { - estimatedTime: this._estimatedTime, - seed: this._globalConfig.seed, - showSeed: this._globalConfig.showSeed - }); - if (!this._globalConfig.silent) { - message += `\n${ - wasInterrupted - ? _chalk().default.bold.red('Test run was interrupted.') - : this._getTestSummary(testContexts, this._globalConfig) - }`; - } - this.log(message); - } - } - _printSnapshotSummary(snapshots, globalConfig) { - if ( - snapshots.added || - snapshots.filesRemoved || - snapshots.unchecked || - snapshots.unmatched || - snapshots.updated - ) { - let updateCommand; - const event = npm_lifecycle_event || ''; - const prefix = NPM_EVENTS.has(event) ? '' : 'run '; - const isYarn = - typeof npm_config_user_agent === 'string' && - npm_config_user_agent.includes('yarn'); - const client = isYarn ? 'yarn' : 'npm'; - const scriptUsesJest = - typeof npm_lifecycle_script === 'string' && - npm_lifecycle_script.includes('jest'); - if (globalConfig.watch || globalConfig.watchAll) { - updateCommand = 'press `u`'; - } else if (event && scriptUsesJest) { - updateCommand = `run \`${`${client} ${prefix}${event}${ - isYarn ? '' : ' --' - }`} -u\``; - } else { - updateCommand = 're-run jest with `-u`'; - } - const snapshotSummary = (0, _getSnapshotSummary.default)( - snapshots, - globalConfig, - updateCommand - ); - snapshotSummary.forEach(this.log); - this.log(''); // print empty line - } - } - - _printSummary(aggregatedResults, globalConfig) { - // If there were any failing tests and there was a large number of tests - // executed, re-print the failing results at the end of execution output. - const failedTests = aggregatedResults.numFailedTests; - const runtimeErrors = aggregatedResults.numRuntimeErrorTestSuites; - if ( - failedTests + runtimeErrors > 0 && - aggregatedResults.numTotalTestSuites > this._summaryThreshold - ) { - this.log(_chalk().default.bold('Summary of all failing tests')); - aggregatedResults.testResults.forEach(testResult => { - const {failureMessage} = testResult; - if (failureMessage) { - this._write( - `${(0, _getResultHeader.default)( - testResult, - globalConfig - )}\n${failureMessage}\n` - ); - } - }); - this.log(''); // print empty line - } - } - - _getTestSummary(testContexts, globalConfig) { - const getMatchingTestsInfo = () => { - const prefix = globalConfig.findRelatedTests - ? ' related to files matching ' - : ' matching '; - return ( - _chalk().default.dim(prefix) + - (0, _jestUtil().testPathPatternToRegExp)( - globalConfig.testPathPattern - ).toString() - ); - }; - let testInfo = ''; - if (globalConfig.runTestsByPath) { - testInfo = _chalk().default.dim(' within paths'); - } else if (globalConfig.onlyChanged) { - testInfo = _chalk().default.dim(' related to changed files'); - } else if (globalConfig.testPathPattern) { - testInfo = getMatchingTestsInfo(); - } - let nameInfo = ''; - if (globalConfig.runTestsByPath) { - nameInfo = ` ${globalConfig.nonFlagArgs.map(p => `"${p}"`).join(', ')}`; - } else if (globalConfig.testNamePattern) { - nameInfo = `${_chalk().default.dim(' with tests matching ')}"${ - globalConfig.testNamePattern - }"`; - } - const contextInfo = - testContexts.size > 1 - ? _chalk().default.dim(' in ') + - testContexts.size + - _chalk().default.dim(' projects') - : ''; - return ( - _chalk().default.dim('Ran all test suites') + - testInfo + - nameInfo + - contextInfo + - _chalk().default.dim('.') - ); - } -} -exports.default = SummaryReporter; diff --git a/node_modules/@jest/reporters/build/VerboseReporter.js b/node_modules/@jest/reporters/build/VerboseReporter.js deleted file mode 100644 index 5fc662c5f..000000000 --- a/node_modules/@jest/reporters/build/VerboseReporter.js +++ /dev/null @@ -1,175 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -var _DefaultReporter = _interopRequireDefault(require('./DefaultReporter')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const {ICONS} = _jestUtil().specialChars; -class VerboseReporter extends _DefaultReporter.default { - _globalConfig; - static filename = __filename; - constructor(globalConfig) { - super(globalConfig); - this._globalConfig = globalConfig; - } - - // Verbose mode is for debugging. Buffering of output is undesirable. - // See https://github.com/facebook/jest/issues/8208 - __wrapStdio(stream) { - const write = stream.write.bind(stream); - stream.write = chunk => { - this.__clearStatus(); - write(chunk); - this.__printStatus(); - return true; - }; - } - static filterTestResults(testResults) { - return testResults.filter(({status}) => status !== 'pending'); - } - static groupTestsBySuites(testResults) { - const root = { - suites: [], - tests: [], - title: '' - }; - testResults.forEach(testResult => { - let targetSuite = root; - - // Find the target suite for this test, - // creating nested suites as necessary. - for (const title of testResult.ancestorTitles) { - let matchingSuite = targetSuite.suites.find(s => s.title === title); - if (!matchingSuite) { - matchingSuite = { - suites: [], - tests: [], - title - }; - targetSuite.suites.push(matchingSuite); - } - targetSuite = matchingSuite; - } - targetSuite.tests.push(testResult); - }); - return root; - } - onTestResult(test, result, aggregatedResults) { - super.testFinished(test.context.config, result, aggregatedResults); - if (!result.skipped) { - this.printTestFileHeader( - result.testFilePath, - test.context.config, - result - ); - if (!result.testExecError && !result.skipped) { - this._logTestResults(result.testResults); - } - this.printTestFileFailureMessage( - result.testFilePath, - test.context.config, - result - ); - } - super.forceFlushBufferedOutput(); - } - _logTestResults(testResults) { - this._logSuite(VerboseReporter.groupTestsBySuites(testResults), 0); - this._logLine(); - } - _logSuite(suite, indentLevel) { - if (suite.title) { - this._logLine(suite.title, indentLevel); - } - this._logTests(suite.tests, indentLevel + 1); - suite.suites.forEach(suite => this._logSuite(suite, indentLevel + 1)); - } - _getIcon(status) { - if (status === 'failed') { - return _chalk().default.red(ICONS.failed); - } else if (status === 'pending') { - return _chalk().default.yellow(ICONS.pending); - } else if (status === 'todo') { - return _chalk().default.magenta(ICONS.todo); - } else { - return _chalk().default.green(ICONS.success); - } - } - _logTest(test, indentLevel) { - const status = this._getIcon(test.status); - const time = test.duration - ? ` (${(0, _jestUtil().formatTime)(Math.round(test.duration))})` - : ''; - this._logLine( - `${status} ${_chalk().default.dim(test.title + time)}`, - indentLevel - ); - } - _logTests(tests, indentLevel) { - if (this._globalConfig.expand) { - tests.forEach(test => this._logTest(test, indentLevel)); - } else { - const summedTests = tests.reduce( - (result, test) => { - if (test.status === 'pending') { - result.pending.push(test); - } else if (test.status === 'todo') { - result.todo.push(test); - } else { - this._logTest(test, indentLevel); - } - return result; - }, - { - pending: [], - todo: [] - } - ); - if (summedTests.pending.length > 0) { - summedTests.pending.forEach(this._logTodoOrPendingTest(indentLevel)); - } - if (summedTests.todo.length > 0) { - summedTests.todo.forEach(this._logTodoOrPendingTest(indentLevel)); - } - } - } - _logTodoOrPendingTest(indentLevel) { - return test => { - const printedTestStatus = - test.status === 'pending' ? 'skipped' : test.status; - const icon = this._getIcon(test.status); - const text = _chalk().default.dim(`${printedTestStatus} ${test.title}`); - this._logLine(`${icon} ${text}`, indentLevel); - }; - } - _logLine(str, indentLevel) { - const indentation = ' '.repeat(indentLevel || 0); - this.log(indentation + (str || '')); - } -} -exports.default = VerboseReporter; diff --git a/node_modules/@jest/reporters/build/formatTestPath.js b/node_modules/@jest/reporters/build/formatTestPath.js deleted file mode 100644 index a7b53dea7..000000000 --- a/node_modules/@jest/reporters/build/formatTestPath.js +++ /dev/null @@ -1,84 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = formatTestPath; -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _slash() { - const data = _interopRequireDefault(require('slash')); - _slash = function () { - return data; - }; - return data; -} -var _relativePath = _interopRequireDefault(require('./relativePath')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function formatTestPath(config, testPath) { - const {dirname, basename} = (0, _relativePath.default)(config, testPath); - return (0, _slash().default)( - _chalk().default.dim(dirname + path().sep) + _chalk().default.bold(basename) - ); -} diff --git a/node_modules/@jest/reporters/build/generateEmptyCoverage.js b/node_modules/@jest/reporters/build/generateEmptyCoverage.js deleted file mode 100644 index 32d6a9e4a..000000000 --- a/node_modules/@jest/reporters/build/generateEmptyCoverage.js +++ /dev/null @@ -1,151 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = generateEmptyCoverage; -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - fs = function () { - return data; - }; - return data; -} -function _istanbulLibCoverage() { - const data = require('istanbul-lib-coverage'); - _istanbulLibCoverage = function () { - return data; - }; - return data; -} -function _istanbulLibInstrument() { - const data = require('istanbul-lib-instrument'); - _istanbulLibInstrument = function () { - return data; - }; - return data; -} -function _transform() { - const data = require('@jest/transform'); - _transform = function () { - return data; - }; - return data; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -async function generateEmptyCoverage( - source, - filename, - globalConfig, - config, - changedFiles, - sourcesRelatedToTestsInChangedFiles -) { - const coverageOptions = { - changedFiles, - collectCoverage: globalConfig.collectCoverage, - collectCoverageFrom: globalConfig.collectCoverageFrom, - coverageProvider: globalConfig.coverageProvider, - sourcesRelatedToTestsInChangedFiles - }; - let coverageWorkerResult = null; - if ((0, _transform().shouldInstrument)(filename, coverageOptions, config)) { - if (coverageOptions.coverageProvider === 'v8') { - const stat = fs().statSync(filename); - return { - kind: 'V8Coverage', - result: { - functions: [ - { - functionName: '(empty-report)', - isBlockCoverage: true, - ranges: [ - { - count: 0, - endOffset: stat.size, - startOffset: 0 - } - ] - } - ], - scriptId: '0', - url: filename - } - }; - } - const scriptTransformer = await (0, _transform().createScriptTransformer)( - config - ); - - // Transform file with instrumentation to make sure initial coverage data is well mapped to original code. - const {code} = await scriptTransformer.transformSourceAsync( - filename, - source, - { - instrument: true, - supportsDynamicImport: true, - supportsExportNamespaceFrom: true, - supportsStaticESM: true, - supportsTopLevelAwait: true - } - ); - // TODO: consider passing AST - const extracted = (0, _istanbulLibInstrument().readInitialCoverage)(code); - // Check extracted initial coverage is not null, this can happen when using /* istanbul ignore file */ - if (extracted) { - coverageWorkerResult = { - coverage: (0, _istanbulLibCoverage().createFileCoverage)( - extracted.coverageData - ), - kind: 'BabelCoverage' - }; - } - } - return coverageWorkerResult; -} diff --git a/node_modules/@jest/reporters/build/getResultHeader.js b/node_modules/@jest/reporters/build/getResultHeader.js deleted file mode 100644 index 4cb4d445d..000000000 --- a/node_modules/@jest/reporters/build/getResultHeader.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getResultHeader; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -var _formatTestPath = _interopRequireDefault(require('./formatTestPath')); -var _printDisplayName = _interopRequireDefault(require('./printDisplayName')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const LONG_TEST_COLOR = _chalk().default.reset.bold.bgRed; -// Explicitly reset for these messages since they can get written out in the -// middle of error logging -const FAIL_TEXT = 'FAIL'; -const PASS_TEXT = 'PASS'; -const FAIL = _chalk().default.supportsColor - ? _chalk().default.reset.inverse.bold.red(` ${FAIL_TEXT} `) - : FAIL_TEXT; -const PASS = _chalk().default.supportsColor - ? _chalk().default.reset.inverse.bold.green(` ${PASS_TEXT} `) - : PASS_TEXT; -function getResultHeader(result, globalConfig, projectConfig) { - const testPath = result.testFilePath; - const status = - result.numFailingTests > 0 || result.testExecError ? FAIL : PASS; - const testDetail = []; - if (result.perfStats?.slow) { - const runTime = result.perfStats.runtime / 1000; - testDetail.push(LONG_TEST_COLOR((0, _jestUtil().formatTime)(runTime, 0))); - } - if (result.memoryUsage) { - const toMB = bytes => Math.floor(bytes / 1024 / 1024); - testDetail.push(`${toMB(result.memoryUsage)} MB heap size`); - } - const projectDisplayName = - projectConfig && projectConfig.displayName - ? `${(0, _printDisplayName.default)(projectConfig)} ` - : ''; - return `${status} ${projectDisplayName}${(0, _formatTestPath.default)( - projectConfig ?? globalConfig, - testPath - )}${testDetail.length ? ` (${testDetail.join(', ')})` : ''}`; -} diff --git a/node_modules/@jest/reporters/build/getSnapshotStatus.js b/node_modules/@jest/reporters/build/getSnapshotStatus.js deleted file mode 100644 index 411f664a1..000000000 --- a/node_modules/@jest/reporters/build/getSnapshotStatus.js +++ /dev/null @@ -1,92 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getSnapshotStatus; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const ARROW = ' \u203A '; -const DOT = ' \u2022 '; -const FAIL_COLOR = _chalk().default.bold.red; -const SNAPSHOT_ADDED = _chalk().default.bold.green; -const SNAPSHOT_UPDATED = _chalk().default.bold.green; -const SNAPSHOT_OUTDATED = _chalk().default.bold.yellow; -function getSnapshotStatus(snapshot, afterUpdate) { - const statuses = []; - if (snapshot.added) { - statuses.push( - SNAPSHOT_ADDED( - `${ - ARROW + (0, _jestUtil().pluralize)('snapshot', snapshot.added) - } written.` - ) - ); - } - if (snapshot.updated) { - statuses.push( - SNAPSHOT_UPDATED( - `${ - ARROW + (0, _jestUtil().pluralize)('snapshot', snapshot.updated) - } updated.` - ) - ); - } - if (snapshot.unmatched) { - statuses.push( - FAIL_COLOR( - `${ - ARROW + (0, _jestUtil().pluralize)('snapshot', snapshot.unmatched) - } failed.` - ) - ); - } - if (snapshot.unchecked) { - if (afterUpdate) { - statuses.push( - SNAPSHOT_UPDATED( - `${ - ARROW + (0, _jestUtil().pluralize)('snapshot', snapshot.unchecked) - } removed.` - ) - ); - } else { - statuses.push( - `${SNAPSHOT_OUTDATED( - `${ - ARROW + (0, _jestUtil().pluralize)('snapshot', snapshot.unchecked) - } obsolete` - )}.` - ); - } - snapshot.uncheckedKeys.forEach(key => { - statuses.push(` ${DOT}${key}`); - }); - } - if (snapshot.fileDeleted) { - statuses.push(SNAPSHOT_UPDATED(`${ARROW}snapshot file removed.`)); - } - return statuses; -} diff --git a/node_modules/@jest/reporters/build/getSnapshotSummary.js b/node_modules/@jest/reporters/build/getSnapshotSummary.js deleted file mode 100644 index 5d665056b..000000000 --- a/node_modules/@jest/reporters/build/getSnapshotSummary.js +++ /dev/null @@ -1,169 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getSnapshotSummary; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -var _formatTestPath = _interopRequireDefault(require('./formatTestPath')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const ARROW = ' \u203A '; -const DOWN_ARROW = ' \u21B3 '; -const DOT = ' \u2022 '; -const FAIL_COLOR = _chalk().default.bold.red; -const OBSOLETE_COLOR = _chalk().default.bold.yellow; -const SNAPSHOT_ADDED = _chalk().default.bold.green; -const SNAPSHOT_NOTE = _chalk().default.dim; -const SNAPSHOT_REMOVED = _chalk().default.bold.green; -const SNAPSHOT_SUMMARY = _chalk().default.bold; -const SNAPSHOT_UPDATED = _chalk().default.bold.green; -function getSnapshotSummary(snapshots, globalConfig, updateCommand) { - const summary = []; - summary.push(SNAPSHOT_SUMMARY('Snapshot Summary')); - if (snapshots.added) { - summary.push( - `${SNAPSHOT_ADDED( - `${ - ARROW + (0, _jestUtil().pluralize)('snapshot', snapshots.added) - } written ` - )}from ${(0, _jestUtil().pluralize)('test suite', snapshots.filesAdded)}.` - ); - } - if (snapshots.unmatched) { - summary.push( - `${FAIL_COLOR( - `${ARROW}${(0, _jestUtil().pluralize)( - 'snapshot', - snapshots.unmatched - )} failed` - )} from ${(0, _jestUtil().pluralize)( - 'test suite', - snapshots.filesUnmatched - )}. ${SNAPSHOT_NOTE( - `Inspect your code changes or ${updateCommand} to update them.` - )}` - ); - } - if (snapshots.updated) { - summary.push( - `${SNAPSHOT_UPDATED( - `${ - ARROW + (0, _jestUtil().pluralize)('snapshot', snapshots.updated) - } updated ` - )}from ${(0, _jestUtil().pluralize)( - 'test suite', - snapshots.filesUpdated - )}.` - ); - } - if (snapshots.filesRemoved) { - if (snapshots.didUpdate) { - summary.push( - `${SNAPSHOT_REMOVED( - `${ARROW}${(0, _jestUtil().pluralize)( - 'snapshot file', - snapshots.filesRemoved - )} removed ` - )}from ${(0, _jestUtil().pluralize)( - 'test suite', - snapshots.filesRemoved - )}.` - ); - } else { - summary.push( - `${OBSOLETE_COLOR( - `${ARROW}${(0, _jestUtil().pluralize)( - 'snapshot file', - snapshots.filesRemoved - )} obsolete ` - )}from ${(0, _jestUtil().pluralize)( - 'test suite', - snapshots.filesRemoved - )}. ${SNAPSHOT_NOTE( - `To remove ${ - snapshots.filesRemoved === 1 ? 'it' : 'them all' - }, ${updateCommand}.` - )}` - ); - } - } - if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) { - const [head, ...tail] = snapshots.filesRemovedList; - summary.push( - ` ${DOWN_ARROW} ${DOT}${(0, _formatTestPath.default)( - globalConfig, - head - )}` - ); - tail.forEach(key => { - summary.push( - ` ${DOT}${(0, _formatTestPath.default)(globalConfig, key)}` - ); - }); - } - if (snapshots.unchecked) { - if (snapshots.didUpdate) { - summary.push( - `${SNAPSHOT_REMOVED( - `${ARROW}${(0, _jestUtil().pluralize)( - 'snapshot', - snapshots.unchecked - )} removed ` - )}from ${(0, _jestUtil().pluralize)( - 'test suite', - snapshots.uncheckedKeysByFile.length - )}.` - ); - } else { - summary.push( - `${OBSOLETE_COLOR( - `${ARROW}${(0, _jestUtil().pluralize)( - 'snapshot', - snapshots.unchecked - )} obsolete ` - )}from ${(0, _jestUtil().pluralize)( - 'test suite', - snapshots.uncheckedKeysByFile.length - )}. ${SNAPSHOT_NOTE( - `To remove ${ - snapshots.unchecked === 1 ? 'it' : 'them all' - }, ${updateCommand}.` - )}` - ); - } - snapshots.uncheckedKeysByFile.forEach(uncheckedFile => { - summary.push( - ` ${DOWN_ARROW}${(0, _formatTestPath.default)( - globalConfig, - uncheckedFile.filePath - )}` - ); - uncheckedFile.keys.forEach(key => { - summary.push(` ${DOT}${key}`); - }); - }); - } - return summary; -} diff --git a/node_modules/@jest/reporters/build/getSummary.js b/node_modules/@jest/reporters/build/getSummary.js deleted file mode 100644 index aae461ed5..000000000 --- a/node_modules/@jest/reporters/build/getSummary.js +++ /dev/null @@ -1,206 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.PROGRESS_BAR_WIDTH = void 0; -exports.default = getSummary; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const PROGRESS_BAR_WIDTH = 40; -exports.PROGRESS_BAR_WIDTH = PROGRESS_BAR_WIDTH; -function getValuesCurrentTestCases(currentTestCases = []) { - let numFailingTests = 0; - let numPassingTests = 0; - let numPendingTests = 0; - let numTodoTests = 0; - let numTotalTests = 0; - currentTestCases.forEach(testCase => { - switch (testCase.testCaseResult.status) { - case 'failed': { - numFailingTests++; - break; - } - case 'passed': { - numPassingTests++; - break; - } - case 'skipped': { - numPendingTests++; - break; - } - case 'todo': { - numTodoTests++; - break; - } - } - numTotalTests++; - }); - return { - numFailingTests, - numPassingTests, - numPendingTests, - numTodoTests, - numTotalTests - }; -} -function renderTime(runTime, estimatedTime, width) { - // If we are more than one second over the estimated time, highlight it. - const renderedTime = - estimatedTime && runTime >= estimatedTime + 1 - ? _chalk().default.bold.yellow((0, _jestUtil().formatTime)(runTime, 0)) - : (0, _jestUtil().formatTime)(runTime, 0); - let time = `${_chalk().default.bold('Time:')} ${renderedTime}`; - if (runTime < estimatedTime) { - time += `, estimated ${(0, _jestUtil().formatTime)(estimatedTime, 0)}`; - } - - // Only show a progress bar if the test run is actually going to take - // some time. - if (estimatedTime > 2 && runTime < estimatedTime && width) { - const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width); - const length = Math.min( - Math.floor((runTime / estimatedTime) * availableWidth), - availableWidth - ); - if (availableWidth >= 2) { - time += `\n${_chalk().default.green('█').repeat(length)}${_chalk() - .default.white('█') - .repeat(availableWidth - length)}`; - } - } - return time; -} -function getSummary(aggregatedResults, options) { - let runTime = (Date.now() - aggregatedResults.startTime) / 1000; - if (options && options.roundTime) { - runTime = Math.floor(runTime); - } - const valuesForCurrentTestCases = getValuesCurrentTestCases( - options?.currentTestCases - ); - const estimatedTime = (options && options.estimatedTime) || 0; - const snapshotResults = aggregatedResults.snapshot; - const snapshotsAdded = snapshotResults.added; - const snapshotsFailed = snapshotResults.unmatched; - const snapshotsOutdated = snapshotResults.unchecked; - const snapshotsFilesRemoved = snapshotResults.filesRemoved; - const snapshotsDidUpdate = snapshotResults.didUpdate; - const snapshotsPassed = snapshotResults.matched; - const snapshotsTotal = snapshotResults.total; - const snapshotsUpdated = snapshotResults.updated; - const suitesFailed = aggregatedResults.numFailedTestSuites; - const suitesPassed = aggregatedResults.numPassedTestSuites; - const suitesPending = aggregatedResults.numPendingTestSuites; - const suitesRun = suitesFailed + suitesPassed; - const suitesTotal = aggregatedResults.numTotalTestSuites; - const testsFailed = aggregatedResults.numFailedTests; - const testsPassed = aggregatedResults.numPassedTests; - const testsPending = aggregatedResults.numPendingTests; - const testsTodo = aggregatedResults.numTodoTests; - const testsTotal = aggregatedResults.numTotalTests; - const width = (options && options.width) || 0; - const optionalLines = []; - if (options?.showSeed === true) { - const {seed} = options; - if (seed === undefined) { - throw new Error('Attempted to display seed but seed value is undefined'); - } - optionalLines.push(`${_chalk().default.bold('Seed: ') + seed}`); - } - const suites = `${ - _chalk().default.bold('Test Suites: ') + - (suitesFailed - ? `${_chalk().default.bold.red(`${suitesFailed} failed`)}, ` - : '') + - (suitesPending - ? `${_chalk().default.bold.yellow(`${suitesPending} skipped`)}, ` - : '') + - (suitesPassed - ? `${_chalk().default.bold.green(`${suitesPassed} passed`)}, ` - : '') + - (suitesRun !== suitesTotal ? `${suitesRun} of ${suitesTotal}` : suitesTotal) - } total`; - const updatedTestsFailed = - testsFailed + valuesForCurrentTestCases.numFailingTests; - const updatedTestsPending = - testsPending + valuesForCurrentTestCases.numPendingTests; - const updatedTestsTodo = testsTodo + valuesForCurrentTestCases.numTodoTests; - const updatedTestsPassed = - testsPassed + valuesForCurrentTestCases.numPassingTests; - const updatedTestsTotal = - testsTotal + valuesForCurrentTestCases.numTotalTests; - const tests = `${ - _chalk().default.bold('Tests: ') + - (updatedTestsFailed > 0 - ? `${_chalk().default.bold.red(`${updatedTestsFailed} failed`)}, ` - : '') + - (updatedTestsPending > 0 - ? `${_chalk().default.bold.yellow(`${updatedTestsPending} skipped`)}, ` - : '') + - (updatedTestsTodo > 0 - ? `${_chalk().default.bold.magenta(`${updatedTestsTodo} todo`)}, ` - : '') + - (updatedTestsPassed > 0 - ? `${_chalk().default.bold.green(`${updatedTestsPassed} passed`)}, ` - : '') - }${updatedTestsTotal} total`; - const snapshots = `${ - _chalk().default.bold('Snapshots: ') + - (snapshotsFailed - ? `${_chalk().default.bold.red(`${snapshotsFailed} failed`)}, ` - : '') + - (snapshotsOutdated && !snapshotsDidUpdate - ? `${_chalk().default.bold.yellow(`${snapshotsOutdated} obsolete`)}, ` - : '') + - (snapshotsOutdated && snapshotsDidUpdate - ? `${_chalk().default.bold.green(`${snapshotsOutdated} removed`)}, ` - : '') + - (snapshotsFilesRemoved && !snapshotsDidUpdate - ? `${_chalk().default.bold.yellow( - `${(0, _jestUtil().pluralize)( - 'file', - snapshotsFilesRemoved - )} obsolete` - )}, ` - : '') + - (snapshotsFilesRemoved && snapshotsDidUpdate - ? `${_chalk().default.bold.green( - `${(0, _jestUtil().pluralize)('file', snapshotsFilesRemoved)} removed` - )}, ` - : '') + - (snapshotsUpdated - ? `${_chalk().default.bold.green(`${snapshotsUpdated} updated`)}, ` - : '') + - (snapshotsAdded - ? `${_chalk().default.bold.green(`${snapshotsAdded} written`)}, ` - : '') + - (snapshotsPassed - ? `${_chalk().default.bold.green(`${snapshotsPassed} passed`)}, ` - : '') - }${snapshotsTotal} total`; - const time = renderTime(runTime, estimatedTime, width); - return [...optionalLines, suites, tests, snapshots, time].join('\n'); -} diff --git a/node_modules/@jest/reporters/build/getWatermarks.js b/node_modules/@jest/reporters/build/getWatermarks.js deleted file mode 100644 index 2d8cdd79b..000000000 --- a/node_modules/@jest/reporters/build/getWatermarks.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getWatermarks; -function _istanbulLibReport() { - const data = _interopRequireDefault(require('istanbul-lib-report')); - _istanbulLibReport = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function getWatermarks(config) { - const defaultWatermarks = _istanbulLibReport().default.getDefaultWatermarks(); - const {coverageThreshold} = config; - if (!coverageThreshold || !coverageThreshold.global) { - return defaultWatermarks; - } - const keys = ['branches', 'functions', 'lines', 'statements']; - return keys.reduce((watermarks, key) => { - const value = coverageThreshold.global[key]; - if (value !== undefined) { - watermarks[key][1] = value; - } - return watermarks; - }, defaultWatermarks); -} diff --git a/node_modules/@jest/reporters/build/index.d.ts b/node_modules/@jest/reporters/build/index.d.ts deleted file mode 100644 index 913b77177..000000000 --- a/node_modules/@jest/reporters/build/index.d.ts +++ /dev/null @@ -1,316 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// - -import {AggregatedResult} from '@jest/test-result'; -import type {AssertionResult} from '@jest/test-result'; -import {Config} from '@jest/types'; -import {SnapshotSummary} from '@jest/test-result'; -import type {Suite} from '@jest/test-result'; -import {Test} from '@jest/test-result'; -import {TestCaseResult} from '@jest/test-result'; -import {TestContext} from '@jest/test-result'; -import {TestResult} from '@jest/test-result'; - -export {AggregatedResult}; - -export declare class BaseReporter implements Reporter { - private _error?; - log(message: string): void; - onRunStart( - _results?: AggregatedResult, - _options?: ReporterOnStartOptions, - ): void; - onTestCaseResult(_test: Test, _testCaseResult: TestCaseResult): void; - onTestResult( - _test?: Test, - _testResult?: TestResult, - _results?: AggregatedResult, - ): void; - onTestStart(_test?: Test): void; - onRunComplete( - _testContexts?: Set, - _aggregatedResults?: AggregatedResult, - ): Promise | void; - protected _setError(error: Error): void; - getLastError(): Error | undefined; -} - -export {Config}; - -export declare class CoverageReporter extends BaseReporter { - private readonly _context; - private readonly _coverageMap; - private readonly _globalConfig; - private readonly _sourceMapStore; - private readonly _v8CoverageResults; - static readonly filename: string; - constructor(globalConfig: Config.GlobalConfig, context: ReporterContext); - onTestResult(_test: Test, testResult: TestResult): void; - onRunComplete( - testContexts: Set, - aggregatedResults: AggregatedResult, - ): Promise; - private _addUntestedFiles; - private _checkThreshold; - private _getCoverageResult; -} - -export declare class DefaultReporter extends BaseReporter { - private _clear; - private readonly _err; - protected _globalConfig: Config.GlobalConfig; - private readonly _out; - private readonly _status; - private readonly _bufferedOutput; - static readonly filename: string; - constructor(globalConfig: Config.GlobalConfig); - protected __wrapStdio( - stream: NodeJS.WritableStream | NodeJS.WriteStream, - ): void; - forceFlushBufferedOutput(): void; - protected __clearStatus(): void; - protected __printStatus(): void; - onRunStart( - aggregatedResults: AggregatedResult, - options: ReporterOnStartOptions, - ): void; - onTestStart(test: Test): void; - onTestCaseResult(test: Test, testCaseResult: TestCaseResult): void; - onRunComplete(): void; - onTestResult( - test: Test, - testResult: TestResult, - aggregatedResults: AggregatedResult, - ): void; - testFinished( - config: Config.ProjectConfig, - testResult: TestResult, - aggregatedResults: AggregatedResult, - ): void; - printTestFileHeader( - testPath: string, - config: Config.ProjectConfig, - result: TestResult, - ): void; - printTestFileFailureMessage( - _testPath: string, - _config: Config.ProjectConfig, - result: TestResult, - ): void; -} - -declare function formatTestPath( - config: Config.GlobalConfig | Config.ProjectConfig, - testPath: string, -): string; - -declare function getResultHeader( - result: TestResult, - globalConfig: Config.GlobalConfig, - projectConfig?: Config.ProjectConfig, -): string; - -declare function getSnapshotStatus( - snapshot: TestResult['snapshot'], - afterUpdate: boolean, -): Array; - -declare function getSnapshotSummary( - snapshots: SnapshotSummary, - globalConfig: Config.GlobalConfig, - updateCommand: string, -): Array; - -declare function getSummary( - aggregatedResults: AggregatedResult, - options?: SummaryOptions, -): string; - -export declare class GitHubActionsReporter extends BaseReporter { - #private; - static readonly filename: string; - private readonly options; - constructor( - _globalConfig: Config.GlobalConfig, - reporterOptions?: { - silent?: boolean; - }, - ); - onTestResult( - test: Test, - testResult: TestResult, - aggregatedResults: AggregatedResult, - ): void; - private generateAnnotations; - private isLastTestSuite; - private printFullResult; - private arrayEqual; - private arrayChild; - private getResultTree; - private getResultChildren; - private printResultTree; - private recursivePrintResultTree; - private printFailedTestLogs; - private startGroup; - private endGroup; -} - -export declare class NotifyReporter extends BaseReporter { - private readonly _notifier; - private readonly _globalConfig; - private _context; - static readonly filename: string; - constructor(globalConfig: Config.GlobalConfig, context: ReporterContext); - onRunComplete(testContexts: Set, result: AggregatedResult): void; -} - -declare function printDisplayName(config: Config.ProjectConfig): string; - -declare function relativePath( - config: Config.GlobalConfig | Config.ProjectConfig, - testPath: string, -): { - basename: string; - dirname: string; -}; - -export declare interface Reporter { - readonly onTestResult?: ( - test: Test, - testResult: TestResult, - aggregatedResult: AggregatedResult, - ) => Promise | void; - readonly onTestFileResult?: ( - test: Test, - testResult: TestResult, - aggregatedResult: AggregatedResult, - ) => Promise | void; - readonly onTestCaseResult?: ( - test: Test, - testCaseResult: TestCaseResult, - ) => Promise | void; - readonly onRunStart: ( - results: AggregatedResult, - options: ReporterOnStartOptions, - ) => Promise | void; - readonly onTestStart?: (test: Test) => Promise | void; - readonly onTestFileStart?: (test: Test) => Promise | void; - readonly onRunComplete: ( - testContexts: Set, - results: AggregatedResult, - ) => Promise | void; - readonly getLastError: () => Error | void; -} - -export declare type ReporterContext = { - firstRun: boolean; - previousSuccess: boolean; - changedFiles?: Set; - sourcesRelatedToTestsInChangedFiles?: Set; - startRun?: (globalConfig: Config.GlobalConfig) => unknown; -}; - -export declare type ReporterOnStartOptions = { - estimatedTime: number; - showStatus: boolean; -}; - -export {SnapshotSummary}; - -export declare type SummaryOptions = { - currentTestCases?: Array<{ - test: Test; - testCaseResult: TestCaseResult; - }>; - estimatedTime?: number; - roundTime?: boolean; - width?: number; - showSeed?: boolean; - seed?: number; -}; - -export declare class SummaryReporter extends BaseReporter { - private _estimatedTime; - private readonly _globalConfig; - private readonly _summaryThreshold; - static readonly filename: string; - constructor( - globalConfig: Config.GlobalConfig, - options?: SummaryReporterOptions, - ); - private _validateOptions; - private _write; - onRunStart( - aggregatedResults: AggregatedResult, - options: ReporterOnStartOptions, - ): void; - onRunComplete( - testContexts: Set, - aggregatedResults: AggregatedResult, - ): void; - private _printSnapshotSummary; - private _printSummary; - private _getTestSummary; -} - -export declare type SummaryReporterOptions = { - summaryThreshold?: number; -}; - -export {Test}; - -export {TestCaseResult}; - -export {TestContext}; - -export {TestResult}; - -declare function trimAndFormatPath( - pad: number, - config: Config.ProjectConfig | Config.GlobalConfig, - testPath: string, - columns: number, -): string; - -export declare const utils: { - formatTestPath: typeof formatTestPath; - getResultHeader: typeof getResultHeader; - getSnapshotStatus: typeof getSnapshotStatus; - getSnapshotSummary: typeof getSnapshotSummary; - getSummary: typeof getSummary; - printDisplayName: typeof printDisplayName; - relativePath: typeof relativePath; - trimAndFormatPath: typeof trimAndFormatPath; -}; - -export declare class VerboseReporter extends DefaultReporter { - protected _globalConfig: Config.GlobalConfig; - static readonly filename: string; - constructor(globalConfig: Config.GlobalConfig); - protected __wrapStdio( - stream: NodeJS.WritableStream | NodeJS.WriteStream, - ): void; - static filterTestResults( - testResults: Array, - ): Array; - static groupTestsBySuites(testResults: Array): Suite; - onTestResult( - test: Test, - result: TestResult, - aggregatedResults: AggregatedResult, - ): void; - private _logTestResults; - private _logSuite; - private _getIcon; - private _logTest; - private _logTests; - private _logTodoOrPendingTest; - private _logLine; -} - -export {}; diff --git a/node_modules/@jest/reporters/build/index.js b/node_modules/@jest/reporters/build/index.js deleted file mode 100644 index 8da383a70..000000000 --- a/node_modules/@jest/reporters/build/index.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'BaseReporter', { - enumerable: true, - get: function () { - return _BaseReporter.default; - } -}); -Object.defineProperty(exports, 'CoverageReporter', { - enumerable: true, - get: function () { - return _CoverageReporter.default; - } -}); -Object.defineProperty(exports, 'DefaultReporter', { - enumerable: true, - get: function () { - return _DefaultReporter.default; - } -}); -Object.defineProperty(exports, 'GitHubActionsReporter', { - enumerable: true, - get: function () { - return _GitHubActionsReporter.default; - } -}); -Object.defineProperty(exports, 'NotifyReporter', { - enumerable: true, - get: function () { - return _NotifyReporter.default; - } -}); -Object.defineProperty(exports, 'SummaryReporter', { - enumerable: true, - get: function () { - return _SummaryReporter.default; - } -}); -Object.defineProperty(exports, 'VerboseReporter', { - enumerable: true, - get: function () { - return _VerboseReporter.default; - } -}); -exports.utils = void 0; -var _formatTestPath = _interopRequireDefault(require('./formatTestPath')); -var _getResultHeader = _interopRequireDefault(require('./getResultHeader')); -var _getSnapshotStatus = _interopRequireDefault(require('./getSnapshotStatus')); -var _getSnapshotSummary = _interopRequireDefault( - require('./getSnapshotSummary') -); -var _getSummary = _interopRequireDefault(require('./getSummary')); -var _printDisplayName = _interopRequireDefault(require('./printDisplayName')); -var _relativePath = _interopRequireDefault(require('./relativePath')); -var _trimAndFormatPath = _interopRequireDefault(require('./trimAndFormatPath')); -var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); -var _CoverageReporter = _interopRequireDefault(require('./CoverageReporter')); -var _DefaultReporter = _interopRequireDefault(require('./DefaultReporter')); -var _GitHubActionsReporter = _interopRequireDefault( - require('./GitHubActionsReporter') -); -var _NotifyReporter = _interopRequireDefault(require('./NotifyReporter')); -var _SummaryReporter = _interopRequireDefault(require('./SummaryReporter')); -var _VerboseReporter = _interopRequireDefault(require('./VerboseReporter')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const utils = { - formatTestPath: _formatTestPath.default, - getResultHeader: _getResultHeader.default, - getSnapshotStatus: _getSnapshotStatus.default, - getSnapshotSummary: _getSnapshotSummary.default, - getSummary: _getSummary.default, - printDisplayName: _printDisplayName.default, - relativePath: _relativePath.default, - trimAndFormatPath: _trimAndFormatPath.default -}; -exports.utils = utils; diff --git a/node_modules/@jest/reporters/build/printDisplayName.js b/node_modules/@jest/reporters/build/printDisplayName.js deleted file mode 100644 index 148cc0c0b..000000000 --- a/node_modules/@jest/reporters/build/printDisplayName.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = printDisplayName; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function printDisplayName(config) { - const {displayName} = config; - const white = _chalk().default.reset.inverse.white; - if (!displayName) { - return ''; - } - const {name, color} = displayName; - const chosenColor = _chalk().default.reset.inverse[color] - ? _chalk().default.reset.inverse[color] - : white; - return _chalk().default.supportsColor ? chosenColor(` ${name} `) : name; -} diff --git a/node_modules/@jest/reporters/build/relativePath.js b/node_modules/@jest/reporters/build/relativePath.js deleted file mode 100644 index 38c1b3812..000000000 --- a/node_modules/@jest/reporters/build/relativePath.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = relativePath; -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function relativePath(config, testPath) { - // this function can be called with ProjectConfigs or GlobalConfigs. GlobalConfigs - // do not have config.cwd, only config.rootDir. Try using config.cwd, fallback - // to config.rootDir. (Also, some unit just use config.rootDir, which is ok) - testPath = path().relative(config.cwd || config.rootDir, testPath); - const dirname = path().dirname(testPath); - const basename = path().basename(testPath); - return { - basename, - dirname - }; -} diff --git a/node_modules/@jest/reporters/build/trimAndFormatPath.js b/node_modules/@jest/reporters/build/trimAndFormatPath.js deleted file mode 100644 index 844410e81..000000000 --- a/node_modules/@jest/reporters/build/trimAndFormatPath.js +++ /dev/null @@ -1,118 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = trimAndFormatPath; -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _slash() { - const data = _interopRequireDefault(require('slash')); - _slash = function () { - return data; - }; - return data; -} -var _relativePath = _interopRequireDefault(require('./relativePath')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -function trimAndFormatPath(pad, config, testPath, columns) { - const maxLength = columns - pad; - const relative = (0, _relativePath.default)(config, testPath); - const {basename} = relative; - let {dirname} = relative; - - // length is ok - if ((dirname + path().sep + basename).length <= maxLength) { - return (0, _slash().default)( - _chalk().default.dim(dirname + path().sep) + - _chalk().default.bold(basename) - ); - } - - // we can fit trimmed dirname and full basename - const basenameLength = basename.length; - if (basenameLength + 4 < maxLength) { - const dirnameLength = maxLength - 4 - basenameLength; - dirname = `...${dirname.slice( - dirname.length - dirnameLength, - dirname.length - )}`; - return (0, _slash().default)( - _chalk().default.dim(dirname + path().sep) + - _chalk().default.bold(basename) - ); - } - if (basenameLength + 4 === maxLength) { - return (0, _slash().default)( - _chalk().default.dim(`...${path().sep}`) + _chalk().default.bold(basename) - ); - } - - // can't fit dirname, but can fit trimmed basename - return (0, _slash().default)( - _chalk().default.bold( - `...${basename.slice(basename.length - maxLength - 4, basename.length)}` - ) - ); -} diff --git a/node_modules/@jest/reporters/build/types.js b/node_modules/@jest/reporters/build/types.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/reporters/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/reporters/build/wrapAnsiString.js b/node_modules/@jest/reporters/build/wrapAnsiString.js deleted file mode 100644 index 85f3cdf89..000000000 --- a/node_modules/@jest/reporters/build/wrapAnsiString.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = wrapAnsiString; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// word-wrap a string that contains ANSI escape sequences. -// ANSI escape sequences do not add to the string length. -function wrapAnsiString(string, terminalWidth) { - if (terminalWidth === 0) { - // if the terminal width is zero, don't bother word-wrapping - return string; - } - const ANSI_REGEXP = /[\u001b\u009b]\[\d{1,2}m/gu; - const tokens = []; - let lastIndex = 0; - let match; - while ((match = ANSI_REGEXP.exec(string))) { - const ansi = match[0]; - const index = match.index; - if (index != lastIndex) { - tokens.push(['string', string.slice(lastIndex, index)]); - } - tokens.push(['ansi', ansi]); - lastIndex = index + ansi.length; - } - if (lastIndex != string.length - 1) { - tokens.push(['string', string.slice(lastIndex, string.length)]); - } - let lastLineLength = 0; - return tokens - .reduce( - (lines, [kind, token]) => { - if (kind === 'string') { - if (lastLineLength + token.length > terminalWidth) { - while (token.length) { - const chunk = token.slice(0, terminalWidth - lastLineLength); - const remaining = token.slice( - terminalWidth - lastLineLength, - token.length - ); - lines[lines.length - 1] += chunk; - lastLineLength += chunk.length; - token = remaining; - if (token.length) { - lines.push(''); - lastLineLength = 0; - } - } - } else { - lines[lines.length - 1] += token; - lastLineLength += token.length; - } - } else { - lines[lines.length - 1] += token; - } - return lines; - }, - [''] - ) - .join('\n'); -} diff --git a/node_modules/@jest/reporters/package.json b/node_modules/@jest/reporters/package.json deleted file mode 100644 index da815def5..000000000 --- a/node_modules/@jest/reporters/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "@jest/reporters", - "description": "Jest's reporters", - "version": "29.5.0", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@jridgewell/trace-mapping": "^0.3.15", - "@types/node": "*", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0", - "jest-worker": "^29.5.0", - "slash": "^3.0.0", - "string-length": "^4.0.1", - "strip-ansi": "^6.0.0", - "v8-to-istanbul": "^9.0.1" - }, - "devDependencies": { - "@jest/test-utils": "^29.5.0", - "@tsd/typescript": "^4.9.0", - "@types/exit": "^0.1.30", - "@types/glob": "^7.1.1", - "@types/graceful-fs": "^4.1.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-lib-instrument": "^1.7.2", - "@types/istanbul-lib-report": "^3.0.0", - "@types/istanbul-lib-source-maps": "^4.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node-notifier": "^8.0.0", - "jest-resolve": "^29.5.0", - "mock-fs": "^5.1.2", - "node-notifier": "^10.0.0", - "tsd-lite": "^0.6.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-reporters" - }, - "bugs": { - "url": "https://github.com/facebook/jest/issues" - }, - "homepage": "https://jestjs.io/", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/schemas/LICENSE b/node_modules/@jest/schemas/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/schemas/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/schemas/README.md b/node_modules/@jest/schemas/README.md deleted file mode 100644 index b2a1d1229..000000000 --- a/node_modules/@jest/schemas/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@jest/schemas` - -Experimental and currently incomplete module for JSON schemas for [Jest's](https://jestjs.io/) configuration. diff --git a/node_modules/@jest/schemas/build/index.d.ts b/node_modules/@jest/schemas/build/index.d.ts deleted file mode 100644 index 158ce86a6..000000000 --- a/node_modules/@jest/schemas/build/index.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import {Static} from '@sinclair/typebox'; -import {TBoolean} from '@sinclair/typebox'; -import {TNull} from '@sinclair/typebox'; -import {TNumber} from '@sinclair/typebox'; -import {TObject} from '@sinclair/typebox'; -import {TPartial} from '@sinclair/typebox'; -import {TReadonly} from '@sinclair/typebox'; -import {TString} from '@sinclair/typebox'; - -declare const RawSnapshotFormat: TPartial< - TObject<{ - callToJSON: TReadonly; - compareKeys: TReadonly; - escapeRegex: TReadonly; - escapeString: TReadonly; - highlight: TReadonly; - indent: TReadonly; - maxDepth: TReadonly; - maxWidth: TReadonly; - min: TReadonly; - printBasicPrototype: TReadonly; - printFunctionName: TReadonly; - theme: TReadonly< - TPartial< - TObject<{ - comment: TReadonly>; - content: TReadonly>; - prop: TReadonly>; - tag: TReadonly>; - value: TReadonly>; - }> - > - >; - }> ->; - -export declare const SnapshotFormat: TPartial< - TObject<{ - callToJSON: TReadonly; - compareKeys: TReadonly; - escapeRegex: TReadonly; - escapeString: TReadonly; - highlight: TReadonly; - indent: TReadonly; - maxDepth: TReadonly; - maxWidth: TReadonly; - min: TReadonly; - printBasicPrototype: TReadonly; - printFunctionName: TReadonly; - theme: TReadonly< - TPartial< - TObject<{ - comment: TReadonly>; - content: TReadonly>; - prop: TReadonly>; - tag: TReadonly>; - value: TReadonly>; - }> - > - >; - }> ->; - -export declare type SnapshotFormat = Static; - -export {}; diff --git a/node_modules/@jest/schemas/build/index.js b/node_modules/@jest/schemas/build/index.js deleted file mode 100644 index 870c18440..000000000 --- a/node_modules/@jest/schemas/build/index.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.SnapshotFormat = void 0; -function _typebox() { - const data = require('@sinclair/typebox'); - _typebox = function () { - return data; - }; - return data; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const RawSnapshotFormat = _typebox().Type.Partial( - _typebox().Type.Object({ - callToJSON: _typebox().Type.Readonly(_typebox().Type.Boolean()), - compareKeys: _typebox().Type.Readonly(_typebox().Type.Null()), - escapeRegex: _typebox().Type.Readonly(_typebox().Type.Boolean()), - escapeString: _typebox().Type.Readonly(_typebox().Type.Boolean()), - highlight: _typebox().Type.Readonly(_typebox().Type.Boolean()), - indent: _typebox().Type.Readonly( - _typebox().Type.Number({ - minimum: 0 - }) - ), - maxDepth: _typebox().Type.Readonly( - _typebox().Type.Number({ - minimum: 0 - }) - ), - maxWidth: _typebox().Type.Readonly( - _typebox().Type.Number({ - minimum: 0 - }) - ), - min: _typebox().Type.Readonly(_typebox().Type.Boolean()), - printBasicPrototype: _typebox().Type.Readonly(_typebox().Type.Boolean()), - printFunctionName: _typebox().Type.Readonly(_typebox().Type.Boolean()), - theme: _typebox().Type.Readonly( - _typebox().Type.Partial( - _typebox().Type.Object({ - comment: _typebox().Type.Readonly(_typebox().Type.String()), - content: _typebox().Type.Readonly(_typebox().Type.String()), - prop: _typebox().Type.Readonly(_typebox().Type.String()), - tag: _typebox().Type.Readonly(_typebox().Type.String()), - value: _typebox().Type.Readonly(_typebox().Type.String()) - }) - ) - ) - }) -); -const SnapshotFormat = _typebox().Type.Strict(RawSnapshotFormat); -exports.SnapshotFormat = SnapshotFormat; diff --git a/node_modules/@jest/schemas/package.json b/node_modules/@jest/schemas/package.json deleted file mode 100644 index 8f7f57e45..000000000 --- a/node_modules/@jest/schemas/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@jest/schemas", - "version": "29.4.3", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-schemas" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@sinclair/typebox": "^0.25.16" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "a49c88610e49a3242576160740a32a2fe11161e1" -} diff --git a/node_modules/@jest/source-map/LICENSE b/node_modules/@jest/source-map/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/source-map/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/source-map/build/getCallsite.js b/node_modules/@jest/source-map/build/getCallsite.js deleted file mode 100644 index 48f633aa1..000000000 --- a/node_modules/@jest/source-map/build/getCallsite.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = getCallsite; -function _traceMapping() { - const data = require('@jridgewell/trace-mapping'); - _traceMapping = function () { - return data; - }; - return data; -} -function _callsites() { - const data = _interopRequireDefault(require('callsites')); - _callsites = function () { - return data; - }; - return data; -} -function _gracefulFs() { - const data = require('graceful-fs'); - _gracefulFs = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// Copied from https://github.com/rexxars/sourcemap-decorate-callsites/blob/5b9735a156964973a75dc62fd2c7f0c1975458e8/lib/index.js#L113-L158 -const addSourceMapConsumer = (callsite, tracer) => { - const getLineNumber = callsite.getLineNumber.bind(callsite); - const getColumnNumber = callsite.getColumnNumber.bind(callsite); - let position = null; - function getPosition() { - if (!position) { - position = (0, _traceMapping().originalPositionFor)(tracer, { - column: getColumnNumber() ?? -1, - line: getLineNumber() ?? -1 - }); - } - return position; - } - Object.defineProperties(callsite, { - getColumnNumber: { - value() { - const value = getPosition().column; - return value == null || value === 0 ? getColumnNumber() : value; - }, - writable: false - }, - getLineNumber: { - value() { - const value = getPosition().line; - return value == null || value === 0 ? getLineNumber() : value; - }, - writable: false - } - }); -}; -function getCallsite(level, sourceMaps) { - const levelAfterThisCall = level + 1; - const stack = (0, _callsites().default)()[levelAfterThisCall]; - const sourceMapFileName = sourceMaps?.get(stack.getFileName() ?? ''); - if (sourceMapFileName != null && sourceMapFileName !== '') { - try { - const sourceMap = (0, _gracefulFs().readFileSync)( - sourceMapFileName, - 'utf8' - ); - addSourceMapConsumer(stack, new (_traceMapping().TraceMap)(sourceMap)); - } catch { - // ignore - } - } - return stack; -} diff --git a/node_modules/@jest/source-map/build/index.d.ts b/node_modules/@jest/source-map/build/index.d.ts deleted file mode 100644 index 7a421847a..000000000 --- a/node_modules/@jest/source-map/build/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import callsites = require('callsites'); - -export declare function getCallsite( - level: number, - sourceMaps?: SourceMapRegistry | null, -): callsites.CallSite; - -export declare type SourceMapRegistry = Map; - -export {}; diff --git a/node_modules/@jest/source-map/build/index.js b/node_modules/@jest/source-map/build/index.js deleted file mode 100644 index c4f4cf9e7..000000000 --- a/node_modules/@jest/source-map/build/index.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'getCallsite', { - enumerable: true, - get: function () { - return _getCallsite.default; - } -}); -var _getCallsite = _interopRequireDefault(require('./getCallsite')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/source-map/build/types.js b/node_modules/@jest/source-map/build/types.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/source-map/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/source-map/package.json b/node_modules/@jest/source-map/package.json deleted file mode 100644 index 71d70b1ae..000000000 --- a/node_modules/@jest/source-map/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "@jest/source-map", - "version": "29.4.3", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-source-map" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.15", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" - }, - "devDependencies": { - "@types/graceful-fs": "^4.1.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "a49c88610e49a3242576160740a32a2fe11161e1" -} diff --git a/node_modules/@jest/test-result/LICENSE b/node_modules/@jest/test-result/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/test-result/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/test-result/build/formatTestResults.js b/node_modules/@jest/test-result/build/formatTestResults.js deleted file mode 100644 index 4d7be9b05..000000000 --- a/node_modules/@jest/test-result/build/formatTestResults.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = formatTestResults; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const formatTestResult = (testResult, codeCoverageFormatter, reporter) => { - if (testResult.testExecError) { - const now = Date.now(); - return { - assertionResults: testResult.testResults, - coverage: {}, - endTime: now, - message: testResult.failureMessage ?? testResult.testExecError.message, - name: testResult.testFilePath, - startTime: now, - status: 'failed', - summary: '' - }; - } - if (testResult.skipped) { - const now = Date.now(); - return { - assertionResults: testResult.testResults, - coverage: {}, - endTime: now, - message: testResult.failureMessage ?? '', - name: testResult.testFilePath, - startTime: now, - status: 'skipped', - summary: '' - }; - } - const allTestsExecuted = testResult.numPendingTests === 0; - const allTestsPassed = testResult.numFailingTests === 0; - return { - assertionResults: testResult.testResults, - coverage: - codeCoverageFormatter != null - ? codeCoverageFormatter(testResult.coverage, reporter) - : testResult.coverage, - endTime: testResult.perfStats.end, - message: testResult.failureMessage ?? '', - name: testResult.testFilePath, - startTime: testResult.perfStats.start, - status: allTestsPassed - ? allTestsExecuted - ? 'passed' - : 'focused' - : 'failed', - summary: '' - }; -}; -function formatTestResults(results, codeCoverageFormatter, reporter) { - const testResults = results.testResults.map(testResult => - formatTestResult(testResult, codeCoverageFormatter, reporter) - ); - return { - ...results, - testResults - }; -} diff --git a/node_modules/@jest/test-result/build/helpers.js b/node_modules/@jest/test-result/build/helpers.js deleted file mode 100644 index 544763924..000000000 --- a/node_modules/@jest/test-result/build/helpers.js +++ /dev/null @@ -1,175 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.makeEmptyAggregatedTestResult = - exports.createEmptyTestResult = - exports.buildFailureTestResult = - exports.addResult = - void 0; -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const makeEmptyAggregatedTestResult = () => ({ - numFailedTestSuites: 0, - numFailedTests: 0, - numPassedTestSuites: 0, - numPassedTests: 0, - numPendingTestSuites: 0, - numPendingTests: 0, - numRuntimeErrorTestSuites: 0, - numTodoTests: 0, - numTotalTestSuites: 0, - numTotalTests: 0, - openHandles: [], - snapshot: { - added: 0, - didUpdate: false, - // is set only after the full run - failure: false, - filesAdded: 0, - // combines individual test results + removed files after the full run - filesRemoved: 0, - filesRemovedList: [], - filesUnmatched: 0, - filesUpdated: 0, - matched: 0, - total: 0, - unchecked: 0, - uncheckedKeysByFile: [], - unmatched: 0, - updated: 0 - }, - startTime: 0, - success: true, - testResults: [], - wasInterrupted: false -}); -exports.makeEmptyAggregatedTestResult = makeEmptyAggregatedTestResult; -const buildFailureTestResult = (testPath, err) => ({ - console: undefined, - displayName: undefined, - failureMessage: null, - leaks: false, - numFailingTests: 0, - numPassingTests: 0, - numPendingTests: 0, - numTodoTests: 0, - openHandles: [], - perfStats: { - end: 0, - runtime: 0, - slow: false, - start: 0 - }, - skipped: false, - snapshot: { - added: 0, - fileDeleted: false, - matched: 0, - unchecked: 0, - uncheckedKeys: [], - unmatched: 0, - updated: 0 - }, - testExecError: err, - testFilePath: testPath, - testResults: [] -}); - -// Add individual test result to an aggregated test result -exports.buildFailureTestResult = buildFailureTestResult; -const addResult = (aggregatedResults, testResult) => { - // `todos` are new as of Jest 24, and not all runners return it. - // Set it to `0` to avoid `NaN` - if (!testResult.numTodoTests) { - testResult.numTodoTests = 0; - } - aggregatedResults.testResults.push(testResult); - aggregatedResults.numTotalTests += - testResult.numPassingTests + - testResult.numFailingTests + - testResult.numPendingTests + - testResult.numTodoTests; - aggregatedResults.numFailedTests += testResult.numFailingTests; - aggregatedResults.numPassedTests += testResult.numPassingTests; - aggregatedResults.numPendingTests += testResult.numPendingTests; - aggregatedResults.numTodoTests += testResult.numTodoTests; - if (testResult.testExecError) { - aggregatedResults.numRuntimeErrorTestSuites++; - } - if (testResult.skipped) { - aggregatedResults.numPendingTestSuites++; - } else if (testResult.numFailingTests > 0 || testResult.testExecError) { - aggregatedResults.numFailedTestSuites++; - } else { - aggregatedResults.numPassedTestSuites++; - } - - // Snapshot data - if (testResult.snapshot.added) { - aggregatedResults.snapshot.filesAdded++; - } - if (testResult.snapshot.fileDeleted) { - aggregatedResults.snapshot.filesRemoved++; - } - if (testResult.snapshot.unmatched) { - aggregatedResults.snapshot.filesUnmatched++; - } - if (testResult.snapshot.updated) { - aggregatedResults.snapshot.filesUpdated++; - } - aggregatedResults.snapshot.added += testResult.snapshot.added; - aggregatedResults.snapshot.matched += testResult.snapshot.matched; - aggregatedResults.snapshot.unchecked += testResult.snapshot.unchecked; - if ( - testResult.snapshot.uncheckedKeys != null && - testResult.snapshot.uncheckedKeys.length > 0 - ) { - aggregatedResults.snapshot.uncheckedKeysByFile.push({ - filePath: testResult.testFilePath, - keys: testResult.snapshot.uncheckedKeys - }); - } - aggregatedResults.snapshot.unmatched += testResult.snapshot.unmatched; - aggregatedResults.snapshot.updated += testResult.snapshot.updated; - aggregatedResults.snapshot.total += - testResult.snapshot.added + - testResult.snapshot.matched + - testResult.snapshot.unmatched + - testResult.snapshot.updated; -}; -exports.addResult = addResult; -const createEmptyTestResult = () => ({ - leaks: false, - // That's legacy code, just adding it as needed for typing - numFailingTests: 0, - numPassingTests: 0, - numPendingTests: 0, - numTodoTests: 0, - openHandles: [], - perfStats: { - end: 0, - runtime: 0, - slow: false, - start: 0 - }, - skipped: false, - snapshot: { - added: 0, - fileDeleted: false, - matched: 0, - unchecked: 0, - uncheckedKeys: [], - unmatched: 0, - updated: 0 - }, - testFilePath: '', - testResults: [] -}); -exports.createEmptyTestResult = createEmptyTestResult; diff --git a/node_modules/@jest/test-result/build/index.d.ts b/node_modules/@jest/test-result/build/index.d.ts deleted file mode 100644 index 29be3b358..000000000 --- a/node_modules/@jest/test-result/build/index.d.ts +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type {Config} from '@jest/types'; -import type {ConsoleBuffer} from '@jest/console'; -import type {CoverageMap} from 'istanbul-lib-coverage'; -import type {CoverageMapData} from 'istanbul-lib-coverage'; -import type {IHasteFS} from 'jest-haste-map'; -import type {IModuleMap} from 'jest-haste-map'; -import type Resolver from 'jest-resolve'; -import type {TestResult as TestResult_2} from '@jest/types'; -import type {TransformTypes} from '@jest/types'; -import type {V8Coverage} from 'collect-v8-coverage'; - -export declare const addResult: ( - aggregatedResults: AggregatedResult, - testResult: TestResult, -) => void; - -export declare type AggregatedResult = AggregatedResultWithoutCoverage & { - coverageMap?: CoverageMap | null; -}; - -declare type AggregatedResultWithoutCoverage = { - numFailedTests: number; - numFailedTestSuites: number; - numPassedTests: number; - numPassedTestSuites: number; - numPendingTests: number; - numTodoTests: number; - numPendingTestSuites: number; - numRuntimeErrorTestSuites: number; - numTotalTests: number; - numTotalTestSuites: number; - openHandles: Array; - snapshot: SnapshotSummary; - startTime: number; - success: boolean; - testResults: Array; - wasInterrupted: boolean; - runExecError?: SerializableError; -}; - -export declare type AssertionLocation = { - fullName: string; - path: string; -}; - -export declare type AssertionResult = TestResult_2.AssertionResult; - -export declare const buildFailureTestResult: ( - testPath: string, - err: SerializableError, -) => TestResult; - -declare type CodeCoverageFormatter = ( - coverage: CoverageMapData | null | undefined, - reporter: CodeCoverageReporter, -) => Record | null | undefined; - -declare type CodeCoverageReporter = unknown; - -export declare const createEmptyTestResult: () => TestResult; - -export declare type FailedAssertion = { - matcherName?: string; - message?: string; - actual?: unknown; - pass?: boolean; - passed?: boolean; - expected?: unknown; - isNot?: boolean; - stack?: string; - error?: unknown; -}; - -declare type FormattedAssertionResult = Pick< - AssertionResult, - 'ancestorTitles' | 'fullName' | 'location' | 'status' | 'title' | 'duration' -> & { - failureMessages: AssertionResult['failureMessages'] | null; -}; - -declare type FormattedTestResult = { - message: string; - name: string; - summary: string; - status: 'failed' | 'passed' | 'skipped' | 'focused'; - startTime: number; - endTime: number; - coverage: unknown; - assertionResults: Array; -}; - -export declare type FormattedTestResults = { - coverageMap?: CoverageMap | null | undefined; - numFailedTests: number; - numFailedTestSuites: number; - numPassedTests: number; - numPassedTestSuites: number; - numPendingTests: number; - numPendingTestSuites: number; - numRuntimeErrorTestSuites: number; - numTotalTests: number; - numTotalTestSuites: number; - snapshot: SnapshotSummary; - startTime: number; - success: boolean; - testResults: Array; - wasInterrupted: boolean; -}; - -export declare function formatTestResults( - results: AggregatedResult, - codeCoverageFormatter?: CodeCoverageFormatter, - reporter?: CodeCoverageReporter, -): FormattedTestResults; - -export declare const makeEmptyAggregatedTestResult: () => AggregatedResult; - -export declare interface RuntimeTransformResult - extends TransformTypes.TransformResult { - wrapperLength: number; -} - -export declare type SerializableError = TestResult_2.SerializableError; - -export declare type SnapshotSummary = { - added: number; - didUpdate: boolean; - failure: boolean; - filesAdded: number; - filesRemoved: number; - filesRemovedList: Array; - filesUnmatched: number; - filesUpdated: number; - matched: number; - total: number; - unchecked: number; - uncheckedKeysByFile: Array; - unmatched: number; - updated: number; -}; - -export declare type Status = AssertionResult['status']; - -export declare type Suite = { - title: string; - suites: Array; - tests: Array; -}; - -export declare type Test = { - context: TestContext; - duration?: number; - path: string; -}; - -export declare type TestCaseResult = AssertionResult; - -export declare type TestContext = { - config: Config.ProjectConfig; - hasteFS: IHasteFS; - moduleMap: IModuleMap; - resolver: Resolver; -}; - -export declare type TestEvents = { - 'test-file-start': [Test]; - 'test-file-success': [Test, TestResult]; - 'test-file-failure': [Test, SerializableError]; - 'test-case-result': [string, AssertionResult]; -}; - -export declare type TestFileEvent< - T extends keyof TestEvents = keyof TestEvents, -> = (eventName: T, args: TestEvents[T]) => unknown; - -export declare type TestResult = { - console?: ConsoleBuffer; - coverage?: CoverageMapData; - displayName?: Config.DisplayName; - failureMessage?: string | null; - leaks: boolean; - memoryUsage?: number; - numFailingTests: number; - numPassingTests: number; - numPendingTests: number; - numTodoTests: number; - openHandles: Array; - perfStats: { - end: number; - runtime: number; - slow: boolean; - start: number; - }; - skipped: boolean; - snapshot: { - added: number; - fileDeleted: boolean; - matched: number; - unchecked: number; - uncheckedKeys: Array; - unmatched: number; - updated: number; - }; - testExecError?: SerializableError; - testFilePath: string; - testResults: Array; - v8Coverage?: V8CoverageResult; -}; - -export declare type TestResultsProcessor = ( - results: AggregatedResult, -) => AggregatedResult | Promise; - -declare type UncheckedSnapshot = { - filePath: string; - keys: Array; -}; - -export declare type V8CoverageResult = Array<{ - codeTransformResult: RuntimeTransformResult | undefined; - result: V8Coverage[number]; -}>; - -export {}; diff --git a/node_modules/@jest/test-result/build/index.js b/node_modules/@jest/test-result/build/index.js deleted file mode 100644 index 2f7f67a5f..000000000 --- a/node_modules/@jest/test-result/build/index.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'addResult', { - enumerable: true, - get: function () { - return _helpers.addResult; - } -}); -Object.defineProperty(exports, 'buildFailureTestResult', { - enumerable: true, - get: function () { - return _helpers.buildFailureTestResult; - } -}); -Object.defineProperty(exports, 'createEmptyTestResult', { - enumerable: true, - get: function () { - return _helpers.createEmptyTestResult; - } -}); -Object.defineProperty(exports, 'formatTestResults', { - enumerable: true, - get: function () { - return _formatTestResults.default; - } -}); -Object.defineProperty(exports, 'makeEmptyAggregatedTestResult', { - enumerable: true, - get: function () { - return _helpers.makeEmptyAggregatedTestResult; - } -}); -var _formatTestResults = _interopRequireDefault(require('./formatTestResults')); -var _helpers = require('./helpers'); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/test-result/build/types.js b/node_modules/@jest/test-result/build/types.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/test-result/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/test-result/package.json b/node_modules/@jest/test-result/package.json deleted file mode 100644 index 152ad8b86..000000000 --- a/node_modules/@jest/test-result/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@jest/test-result", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-test-result" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@jest/console": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - }, - "devDependencies": { - "jest-haste-map": "^29.5.0", - "jest-resolve": "^29.5.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/test-sequencer/LICENSE b/node_modules/@jest/test-sequencer/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/test-sequencer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/test-sequencer/build/index.d.ts b/node_modules/@jest/test-sequencer/build/index.d.ts deleted file mode 100644 index 8fc5c55bf..000000000 --- a/node_modules/@jest/test-sequencer/build/index.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type {AggregatedResult} from '@jest/test-result'; -import type {Test} from '@jest/test-result'; -import type {TestContext} from '@jest/test-result'; - -declare type Cache_2 = { - [key: string]: [0 | 1, number] | undefined; -}; - -export declare type ShardOptions = { - shardIndex: number; - shardCount: number; -}; - -/** - * The TestSequencer will ultimately decide which tests should run first. - * It is responsible for storing and reading from a local cache - * map that stores context information for a given test, such as how long it - * took to run during the last run and if it has failed or not. - * Such information is used on: - * TestSequencer.sort(tests: Array) - * to sort the order of the provided tests. - * - * After the results are collected, - * TestSequencer.cacheResults(tests: Array, results: AggregatedResult) - * is called to store/update this information on the cache map. - */ -declare class TestSequencer { - private readonly _cache; - _getCachePath(testContext: TestContext): string; - _getCache(test: Test): Cache_2; - private _shardPosition; - /** - * Select tests for shard requested via --shard=shardIndex/shardCount - * Sharding is applied before sorting - * - * @param tests All tests - * @param options shardIndex and shardIndex to select - * - * @example - * ```typescript - * class CustomSequencer extends Sequencer { - * shard(tests, { shardIndex, shardCount }) { - * const shardSize = Math.ceil(tests.length / options.shardCount); - * const shardStart = shardSize * (options.shardIndex - 1); - * const shardEnd = shardSize * options.shardIndex; - * return [...tests] - * .sort((a, b) => (a.path > b.path ? 1 : -1)) - * .slice(shardStart, shardEnd); - * } - * } - * ``` - */ - shard( - tests: Array, - options: ShardOptions, - ): Array | Promise>; - /** - * Sort test to determine order of execution - * Sorting is applied after sharding - * @param tests - * - * ```typescript - * class CustomSequencer extends Sequencer { - * sort(tests) { - * const copyTests = Array.from(tests); - * return [...tests].sort((a, b) => (a.path > b.path ? 1 : -1)); - * } - * } - * ``` - */ - sort(tests: Array): Array | Promise>; - allFailedTests(tests: Array): Array | Promise>; - cacheResults(tests: Array, results: AggregatedResult): void; - private hasFailed; - private time; -} -export default TestSequencer; - -export {}; diff --git a/node_modules/@jest/test-sequencer/build/index.js b/node_modules/@jest/test-sequencer/build/index.js deleted file mode 100644 index 46b74bfcd..000000000 --- a/node_modules/@jest/test-sequencer/build/index.js +++ /dev/null @@ -1,288 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; -function crypto() { - const data = _interopRequireWildcard(require('crypto')); - crypto = function () { - return data; - }; - return data; -} -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - fs = function () { - return data; - }; - return data; -} -function _slash() { - const data = _interopRequireDefault(require('slash')); - _slash = function () { - return data; - }; - return data; -} -function _jestHasteMap() { - const data = _interopRequireDefault(require('jest-haste-map')); - _jestHasteMap = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const FAIL = 0; -const SUCCESS = 1; -/** - * The TestSequencer will ultimately decide which tests should run first. - * It is responsible for storing and reading from a local cache - * map that stores context information for a given test, such as how long it - * took to run during the last run and if it has failed or not. - * Such information is used on: - * TestSequencer.sort(tests: Array) - * to sort the order of the provided tests. - * - * After the results are collected, - * TestSequencer.cacheResults(tests: Array, results: AggregatedResult) - * is called to store/update this information on the cache map. - */ -class TestSequencer { - _cache = new Map(); - _getCachePath(testContext) { - const {config} = testContext; - const HasteMapClass = _jestHasteMap().default.getStatic(config); - return HasteMapClass.getCacheFilePath( - config.cacheDirectory, - `perf-cache-${config.id}` - ); - } - _getCache(test) { - const {context} = test; - if (!this._cache.has(context) && context.config.cache) { - const cachePath = this._getCachePath(context); - if (fs().existsSync(cachePath)) { - try { - this._cache.set( - context, - JSON.parse(fs().readFileSync(cachePath, 'utf8')) - ); - } catch {} - } - } - let cache = this._cache.get(context); - if (!cache) { - cache = {}; - this._cache.set(context, cache); - } - return cache; - } - _shardPosition(options) { - const shardRest = options.suiteLength % options.shardCount; - const ratio = options.suiteLength / options.shardCount; - return new Array(options.shardIndex) - .fill(true) - .reduce((acc, _, shardIndex) => { - const dangles = shardIndex < shardRest; - const shardSize = dangles ? Math.ceil(ratio) : Math.floor(ratio); - return acc + shardSize; - }, 0); - } - - /** - * Select tests for shard requested via --shard=shardIndex/shardCount - * Sharding is applied before sorting - * - * @param tests All tests - * @param options shardIndex and shardIndex to select - * - * @example - * ```typescript - * class CustomSequencer extends Sequencer { - * shard(tests, { shardIndex, shardCount }) { - * const shardSize = Math.ceil(tests.length / options.shardCount); - * const shardStart = shardSize * (options.shardIndex - 1); - * const shardEnd = shardSize * options.shardIndex; - * return [...tests] - * .sort((a, b) => (a.path > b.path ? 1 : -1)) - * .slice(shardStart, shardEnd); - * } - * } - * ``` - */ - shard(tests, options) { - const shardStart = this._shardPosition({ - shardCount: options.shardCount, - shardIndex: options.shardIndex - 1, - suiteLength: tests.length - }); - const shardEnd = this._shardPosition({ - shardCount: options.shardCount, - shardIndex: options.shardIndex, - suiteLength: tests.length - }); - return tests - .map(test => { - const relativeTestPath = path().posix.relative( - (0, _slash().default)(test.context.config.rootDir), - (0, _slash().default)(test.path) - ); - return { - hash: crypto() - .createHash('sha1') - .update(relativeTestPath) - .digest('hex'), - test - }; - }) - .sort((a, b) => (a.hash < b.hash ? -1 : a.hash > b.hash ? 1 : 0)) - .slice(shardStart, shardEnd) - .map(result => result.test); - } - - /** - * Sort test to determine order of execution - * Sorting is applied after sharding - * @param tests - * - * ```typescript - * class CustomSequencer extends Sequencer { - * sort(tests) { - * const copyTests = Array.from(tests); - * return [...tests].sort((a, b) => (a.path > b.path ? 1 : -1)); - * } - * } - * ``` - */ - sort(tests) { - /** - * Sorting tests is very important because it has a great impact on the - * user-perceived responsiveness and speed of the test run. - * - * If such information is on cache, tests are sorted based on: - * -> Has it failed during the last run ? - * Since it's important to provide the most expected feedback as quickly - * as possible. - * -> How long it took to run ? - * Because running long tests first is an effort to minimize worker idle - * time at the end of a long test run. - * And if that information is not available they are sorted based on file size - * since big test files usually take longer to complete. - * - * Note that a possible improvement would be to analyse other information - * from the file other than its size. - * - */ - const stats = {}; - const fileSize = ({path, context: {hasteFS}}) => - stats[path] || (stats[path] = hasteFS.getSize(path) ?? 0); - tests.forEach(test => { - test.duration = this.time(test); - }); - return tests.sort((testA, testB) => { - const failedA = this.hasFailed(testA); - const failedB = this.hasFailed(testB); - const hasTimeA = testA.duration != null; - if (failedA !== failedB) { - return failedA === true ? -1 : 1; - } else if (hasTimeA != (testB.duration != null)) { - // If only one of two tests has timing information, run it last - return hasTimeA ? 1 : -1; - } else if (testA.duration != null && testB.duration != null) { - return testA.duration < testB.duration ? 1 : -1; - } else { - return fileSize(testA) < fileSize(testB) ? 1 : -1; - } - }); - } - allFailedTests(tests) { - const hasFailed = (cache, test) => cache[test.path]?.[0] === FAIL; - return this.sort( - tests.filter(test => hasFailed(this._getCache(test), test)) - ); - } - cacheResults(tests, results) { - const map = Object.create(null); - tests.forEach(test => (map[test.path] = test)); - results.testResults.forEach(testResult => { - const test = map[testResult.testFilePath]; - if (test != null && !testResult.skipped) { - const cache = this._getCache(test); - const perf = testResult.perfStats; - cache[testResult.testFilePath] = [ - testResult.numFailingTests ? FAIL : SUCCESS, - perf.runtime || 0 - ]; - } - }); - this._cache.forEach((cache, context) => - fs().writeFileSync(this._getCachePath(context), JSON.stringify(cache)) - ); - } - hasFailed(test) { - const cache = this._getCache(test); - return cache[test.path]?.[0] === FAIL; - } - time(test) { - const cache = this._getCache(test); - return cache[test.path]?.[1]; - } -} -exports.default = TestSequencer; diff --git a/node_modules/@jest/test-sequencer/package.json b/node_modules/@jest/test-sequencer/package.json deleted file mode 100644 index 3b831cfca..000000000 --- a/node_modules/@jest/test-sequencer/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@jest/test-sequencer", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-test-sequencer" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@jest/test-result": "^29.5.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "slash": "^3.0.0" - }, - "devDependencies": { - "@jest/test-utils": "^29.5.0", - "@types/graceful-fs": "^4.1.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/transform/LICENSE b/node_modules/@jest/transform/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/transform/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/transform/build/ScriptTransformer.js b/node_modules/@jest/transform/build/ScriptTransformer.js deleted file mode 100644 index a3e23d9f7..000000000 --- a/node_modules/@jest/transform/build/ScriptTransformer.js +++ /dev/null @@ -1,1002 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.createScriptTransformer = createScriptTransformer; -exports.createTranspilingRequire = createTranspilingRequire; -function _crypto() { - const data = require('crypto'); - _crypto = function () { - return data; - }; - return data; -} -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function _core() { - const data = require('@babel/core'); - _core = function () { - return data; - }; - return data; -} -function _babelPluginIstanbul() { - const data = _interopRequireDefault(require('babel-plugin-istanbul')); - _babelPluginIstanbul = function () { - return data; - }; - return data; -} -function _convertSourceMap() { - const data = require('convert-source-map'); - _convertSourceMap = function () { - return data; - }; - return data; -} -function _fastJsonStableStringify() { - const data = _interopRequireDefault(require('fast-json-stable-stringify')); - _fastJsonStableStringify = function () { - return data; - }; - return data; -} -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - fs = function () { - return data; - }; - return data; -} -function _pirates() { - const data = require('pirates'); - _pirates = function () { - return data; - }; - return data; -} -function _slash() { - const data = _interopRequireDefault(require('slash')); - _slash = function () { - return data; - }; - return data; -} -function _writeFileAtomic() { - const data = require('write-file-atomic'); - _writeFileAtomic = function () { - return data; - }; - return data; -} -function _jestHasteMap() { - const data = _interopRequireDefault(require('jest-haste-map')); - _jestHasteMap = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -var _enhanceUnexpectedTokenMessage = _interopRequireDefault( - require('./enhanceUnexpectedTokenMessage') -); -var _runtimeErrorsAndWarnings = require('./runtimeErrorsAndWarnings'); -var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument')); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @ts-expect-error: should just be `require.resolve`, but the tests mess that up - -// Use `require` to avoid TS rootDir -const {version: VERSION} = require('../package.json'); -// This data structure is used to avoid recalculating some data every time that -// we need to transform a file. Since ScriptTransformer is instantiated for each -// file we need to keep this object in the local scope of this module. -const projectCaches = new Map(); - -// To reset the cache for specific changesets (rather than package version). -const CACHE_VERSION = '1'; -async function waitForPromiseWithCleanup(promise, cleanup) { - try { - await promise; - } finally { - cleanup(); - } -} - -// type predicate -function isTransformerFactory(t) { - return typeof t.createTransformer === 'function'; -} -class ScriptTransformer { - _cache; - _transformCache = new Map(); - _transformsAreLoaded = false; - constructor(_config, _cacheFS) { - this._config = _config; - this._cacheFS = _cacheFS; - const configString = (0, _fastJsonStableStringify().default)(this._config); - let projectCache = projectCaches.get(configString); - if (!projectCache) { - projectCache = { - configString, - ignorePatternsRegExp: calcIgnorePatternRegExp(this._config), - transformRegExp: calcTransformRegExp(this._config), - transformedFiles: new Map() - }; - projectCaches.set(configString, projectCache); - } - this._cache = projectCache; - } - _buildCacheKeyFromFileInfo( - fileData, - filename, - transformOptions, - transformerCacheKey - ) { - if (transformerCacheKey != null) { - return (0, _crypto().createHash)('sha1') - .update(transformerCacheKey) - .update(CACHE_VERSION) - .digest('hex') - .substring(0, 32); - } - return (0, _crypto().createHash)('sha1') - .update(fileData) - .update(transformOptions.configString) - .update(transformOptions.instrument ? 'instrument' : '') - .update(filename) - .update(CACHE_VERSION) - .digest('hex') - .substring(0, 32); - } - _buildTransformCacheKey(pattern, filepath) { - return pattern + filepath; - } - _getCacheKey(fileData, filename, options) { - const configString = this._cache.configString; - const {transformer, transformerConfig = {}} = - this._getTransformer(filename) ?? {}; - let transformerCacheKey = undefined; - const transformOptions = { - ...options, - cacheFS: this._cacheFS, - config: this._config, - configString, - transformerConfig - }; - if (typeof transformer?.getCacheKey === 'function') { - transformerCacheKey = transformer.getCacheKey( - fileData, - filename, - transformOptions - ); - } - return this._buildCacheKeyFromFileInfo( - fileData, - filename, - transformOptions, - transformerCacheKey - ); - } - async _getCacheKeyAsync(fileData, filename, options) { - const configString = this._cache.configString; - const {transformer, transformerConfig = {}} = - this._getTransformer(filename) ?? {}; - let transformerCacheKey = undefined; - const transformOptions = { - ...options, - cacheFS: this._cacheFS, - config: this._config, - configString, - transformerConfig - }; - if (transformer) { - const getCacheKey = - transformer.getCacheKeyAsync ?? transformer.getCacheKey; - if (typeof getCacheKey === 'function') { - transformerCacheKey = await getCacheKey( - fileData, - filename, - transformOptions - ); - } - } - return this._buildCacheKeyFromFileInfo( - fileData, - filename, - transformOptions, - transformerCacheKey - ); - } - _createCachedFilename(filename, cacheKey) { - const HasteMapClass = _jestHasteMap().default.getStatic(this._config); - const baseCacheDir = HasteMapClass.getCacheFilePath( - this._config.cacheDirectory, - `jest-transform-cache-${this._config.id}`, - VERSION - ); - // Create sub folders based on the cacheKey to avoid creating one - // directory with many files. - const cacheDir = path().join(baseCacheDir, cacheKey[0] + cacheKey[1]); - const cacheFilenamePrefix = path() - .basename(filename, path().extname(filename)) - .replace(/\W/g, ''); - return (0, _slash().default)( - path().join(cacheDir, `${cacheFilenamePrefix}_${cacheKey}`) - ); - } - _getFileCachePath(filename, content, options) { - const cacheKey = this._getCacheKey(content, filename, options); - return this._createCachedFilename(filename, cacheKey); - } - async _getFileCachePathAsync(filename, content, options) { - const cacheKey = await this._getCacheKeyAsync(content, filename, options); - return this._createCachedFilename(filename, cacheKey); - } - _getTransformPatternAndPath(filename) { - const transformEntry = this._cache.transformRegExp; - if (transformEntry == null) { - return undefined; - } - for (let i = 0; i < transformEntry.length; i++) { - const [transformRegExp, transformPath] = transformEntry[i]; - if (transformRegExp.test(filename)) { - return [transformRegExp.source, transformPath]; - } - } - return undefined; - } - _getTransformPath(filename) { - const transformInfo = this._getTransformPatternAndPath(filename); - if (!Array.isArray(transformInfo)) { - return undefined; - } - return transformInfo[1]; - } - async loadTransformers() { - await Promise.all( - this._config.transform.map( - async ([transformPattern, transformPath, transformerConfig], i) => { - let transformer = await (0, _jestUtil().requireOrImportModule)( - transformPath - ); - if (transformer == null) { - throw new Error( - (0, _runtimeErrorsAndWarnings.makeInvalidTransformerError)( - transformPath - ) - ); - } - if (isTransformerFactory(transformer)) { - transformer = await transformer.createTransformer( - transformerConfig - ); - } - if ( - typeof transformer.process !== 'function' && - typeof transformer.processAsync !== 'function' - ) { - throw new Error( - (0, _runtimeErrorsAndWarnings.makeInvalidTransformerError)( - transformPath - ) - ); - } - const res = { - transformer, - transformerConfig - }; - const transformCacheKey = this._buildTransformCacheKey( - this._cache.transformRegExp?.[i]?.[0].source ?? - new RegExp(transformPattern).source, - transformPath - ); - this._transformCache.set(transformCacheKey, res); - } - ) - ); - this._transformsAreLoaded = true; - } - _getTransformer(filename) { - if (!this._transformsAreLoaded) { - throw new Error( - 'Jest: Transformers have not been loaded yet - make sure to run `loadTransformers` and wait for it to complete before starting to transform files' - ); - } - if (this._config.transform.length === 0) { - return null; - } - const transformPatternAndPath = this._getTransformPatternAndPath(filename); - if (!Array.isArray(transformPatternAndPath)) { - return null; - } - const [transformPattern, transformPath] = transformPatternAndPath; - const transformCacheKey = this._buildTransformCacheKey( - transformPattern, - transformPath - ); - const transformer = this._transformCache.get(transformCacheKey); - if (transformer !== undefined) { - return transformer; - } - throw new Error( - `Jest was unable to load the transformer defined for ${filename}. This is a bug in Jest, please open up an issue` - ); - } - _instrumentFile(filename, input, canMapToInput, options) { - const inputCode = typeof input === 'string' ? input : input.code; - const inputMap = typeof input === 'string' ? null : input.map; - const result = (0, _core().transformSync)(inputCode, { - auxiliaryCommentBefore: ' istanbul ignore next ', - babelrc: false, - caller: { - name: '@jest/transform', - supportsDynamicImport: options.supportsDynamicImport, - supportsExportNamespaceFrom: options.supportsExportNamespaceFrom, - supportsStaticESM: options.supportsStaticESM, - supportsTopLevelAwait: options.supportsTopLevelAwait - }, - configFile: false, - filename, - plugins: [ - [ - _babelPluginIstanbul().default, - { - compact: false, - // files outside `cwd` will not be instrumented - cwd: this._config.rootDir, - exclude: [], - extension: false, - inputSourceMap: inputMap, - useInlineSourceMaps: false - } - ] - ], - sourceMaps: canMapToInput ? 'both' : false - }); - if (result?.code != null) { - return result; - } - return input; - } - _buildTransformResult( - filename, - cacheFilePath, - content, - transformer, - shouldCallTransform, - options, - processed, - sourceMapPath - ) { - let transformed = { - code: content, - map: null - }; - if (transformer && shouldCallTransform) { - if (processed != null && typeof processed.code === 'string') { - transformed = processed; - } else { - const transformPath = this._getTransformPath(filename); - invariant(transformPath); - throw new Error( - (0, _runtimeErrorsAndWarnings.makeInvalidReturnValueError)( - transformPath - ) - ); - } - } - if (transformed.map == null || transformed.map === '') { - try { - //Could be a potential freeze here. - //See: https://github.com/facebook/jest/pull/5177#discussion_r158883570 - const inlineSourceMap = (0, _convertSourceMap().fromSource)( - transformed.code - ); - if (inlineSourceMap) { - transformed.map = inlineSourceMap.toObject(); - } - } catch { - const transformPath = this._getTransformPath(filename); - invariant(transformPath); - console.warn( - (0, _runtimeErrorsAndWarnings.makeInvalidSourceMapWarning)( - filename, - transformPath - ) - ); - } - } - - // That means that the transform has a custom instrumentation - // logic and will handle it based on `config.collectCoverage` option - const transformWillInstrument = - shouldCallTransform && transformer && transformer.canInstrument; - - // Apply instrumentation to the code if necessary, keeping the instrumented code and new map - let map = transformed.map; - let code; - if (transformWillInstrument !== true && options.instrument) { - /** - * We can map the original source code to the instrumented code ONLY if - * - the process of transforming the code produced a source map e.g. ts-jest - * - we did not transform the source code - * - * Otherwise we cannot make any statements about how the instrumented code corresponds to the original code, - * and we should NOT emit any source maps - * - */ - const shouldEmitSourceMaps = - (transformer != null && map != null) || transformer == null; - const instrumented = this._instrumentFile( - filename, - transformed, - shouldEmitSourceMaps, - options - ); - code = - typeof instrumented === 'string' ? instrumented : instrumented.code; - map = typeof instrumented === 'string' ? null : instrumented.map; - } else { - code = transformed.code; - } - if (map != null) { - const sourceMapContent = - typeof map === 'string' ? map : JSON.stringify(map); - invariant(sourceMapPath, 'We should always have default sourceMapPath'); - writeCacheFile(sourceMapPath, sourceMapContent); - } else { - sourceMapPath = null; - } - writeCodeCacheFile(cacheFilePath, code); - return { - code, - originalCode: content, - sourceMapPath - }; - } - transformSource(filepath, content, options) { - const filename = (0, _jestUtil().tryRealpath)(filepath); - const {transformer, transformerConfig = {}} = - this._getTransformer(filename) ?? {}; - const cacheFilePath = this._getFileCachePath(filename, content, options); - const sourceMapPath = `${cacheFilePath}.map`; - // Ignore cache if `config.cache` is set (--no-cache) - const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null; - if (code != null) { - // This is broken: we return the code, and a path for the source map - // directly from the cache. But, nothing ensures the source map actually - // matches that source code. They could have gotten out-of-sync in case - // two separate processes write concurrently to the same cache files. - return { - code, - originalCode: content, - sourceMapPath - }; - } - let processed = null; - let shouldCallTransform = false; - if (transformer && this.shouldTransform(filename)) { - shouldCallTransform = true; - assertSyncTransformer(transformer, this._getTransformPath(filename)); - processed = transformer.process(content, filename, { - ...options, - cacheFS: this._cacheFS, - config: this._config, - configString: this._cache.configString, - transformerConfig - }); - } - (0, _jestUtil().createDirectory)(path().dirname(cacheFilePath)); - return this._buildTransformResult( - filename, - cacheFilePath, - content, - transformer, - shouldCallTransform, - options, - processed, - sourceMapPath - ); - } - async transformSourceAsync(filepath, content, options) { - const filename = (0, _jestUtil().tryRealpath)(filepath); - const {transformer, transformerConfig = {}} = - this._getTransformer(filename) ?? {}; - const cacheFilePath = await this._getFileCachePathAsync( - filename, - content, - options - ); - const sourceMapPath = `${cacheFilePath}.map`; - // Ignore cache if `config.cache` is set (--no-cache) - const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null; - if (code != null) { - // This is broken: we return the code, and a path for the source map - // directly from the cache. But, nothing ensures the source map actually - // matches that source code. They could have gotten out-of-sync in case - // two separate processes write concurrently to the same cache files. - return { - code, - originalCode: content, - sourceMapPath - }; - } - let processed = null; - let shouldCallTransform = false; - if (transformer && this.shouldTransform(filename)) { - shouldCallTransform = true; - const process = transformer.processAsync ?? transformer.process; - - // This is probably dead code since `_getTransformerAsync` already asserts this - invariant( - typeof process === 'function', - 'A transformer must always export either a `process` or `processAsync`' - ); - processed = await process(content, filename, { - ...options, - cacheFS: this._cacheFS, - config: this._config, - configString: this._cache.configString, - transformerConfig - }); - } - (0, _jestUtil().createDirectory)(path().dirname(cacheFilePath)); - return this._buildTransformResult( - filename, - cacheFilePath, - content, - transformer, - shouldCallTransform, - options, - processed, - sourceMapPath - ); - } - async _transformAndBuildScriptAsync( - filename, - options, - transformOptions, - fileSource - ) { - const {isInternalModule} = options; - let fileContent = fileSource ?? this._cacheFS.get(filename); - if (fileContent == null) { - fileContent = fs().readFileSync(filename, 'utf8'); - this._cacheFS.set(filename, fileContent); - } - const content = stripShebang(fileContent); - let code = content; - let sourceMapPath = null; - const willTransform = - isInternalModule !== true && - (transformOptions.instrument || this.shouldTransform(filename)); - try { - if (willTransform) { - const transformedSource = await this.transformSourceAsync( - filename, - content, - transformOptions - ); - code = transformedSource.code; - sourceMapPath = transformedSource.sourceMapPath; - } - return { - code, - originalCode: content, - sourceMapPath - }; - } catch (e) { - if (!(e instanceof Error)) { - throw e; - } - throw (0, _enhanceUnexpectedTokenMessage.default)(e); - } - } - _transformAndBuildScript(filename, options, transformOptions, fileSource) { - const {isInternalModule} = options; - let fileContent = fileSource ?? this._cacheFS.get(filename); - if (fileContent == null) { - fileContent = fs().readFileSync(filename, 'utf8'); - this._cacheFS.set(filename, fileContent); - } - const content = stripShebang(fileContent); - let code = content; - let sourceMapPath = null; - const willTransform = - isInternalModule !== true && - (transformOptions.instrument || this.shouldTransform(filename)); - try { - if (willTransform) { - const transformedSource = this.transformSource( - filename, - content, - transformOptions - ); - code = transformedSource.code; - sourceMapPath = transformedSource.sourceMapPath; - } - return { - code, - originalCode: content, - sourceMapPath - }; - } catch (e) { - if (!(e instanceof Error)) { - throw e; - } - throw (0, _enhanceUnexpectedTokenMessage.default)(e); - } - } - async transformAsync(filename, options, fileSource) { - const instrument = - options.coverageProvider === 'babel' && - (0, _shouldInstrument.default)(filename, options, this._config); - const scriptCacheKey = getScriptCacheKey(filename, instrument); - let result = this._cache.transformedFiles.get(scriptCacheKey); - if (result) { - return result; - } - result = await this._transformAndBuildScriptAsync( - filename, - options, - { - ...options, - instrument - }, - fileSource - ); - if (scriptCacheKey) { - this._cache.transformedFiles.set(scriptCacheKey, result); - } - return result; - } - transform(filename, options, fileSource) { - const instrument = - options.coverageProvider === 'babel' && - (0, _shouldInstrument.default)(filename, options, this._config); - const scriptCacheKey = getScriptCacheKey(filename, instrument); - let result = this._cache.transformedFiles.get(scriptCacheKey); - if (result) { - return result; - } - result = this._transformAndBuildScript( - filename, - options, - { - ...options, - instrument - }, - fileSource - ); - if (scriptCacheKey) { - this._cache.transformedFiles.set(scriptCacheKey, result); - } - return result; - } - transformJson(filename, options, fileSource) { - const {isInternalModule} = options; - const willTransform = - isInternalModule !== true && this.shouldTransform(filename); - if (willTransform) { - const {code: transformedJsonSource} = this.transformSource( - filename, - fileSource, - { - ...options, - instrument: false - } - ); - return transformedJsonSource; - } - return fileSource; - } - async requireAndTranspileModule( - moduleName, - callback, - options = { - applyInteropRequireDefault: true, - instrument: false, - supportsDynamicImport: false, - supportsExportNamespaceFrom: false, - supportsStaticESM: false, - supportsTopLevelAwait: false - } - ) { - let transforming = false; - const {applyInteropRequireDefault, ...transformOptions} = options; - const revertHook = (0, _pirates().addHook)( - (code, filename) => { - try { - transforming = true; - return ( - this.transformSource(filename, code, transformOptions).code || code - ); - } finally { - transforming = false; - } - }, - { - // Exclude `mjs` extension when addHook because pirates don't support hijack es module - exts: this._config.moduleFileExtensions - .filter(ext => ext !== 'mjs') - .map(ext => `.${ext}`), - ignoreNodeModules: false, - matcher: filename => { - if (transforming) { - // Don't transform any dependency required by the transformer itself - return false; - } - return this.shouldTransform(filename); - } - } - ); - try { - const module = await (0, _jestUtil().requireOrImportModule)( - moduleName, - applyInteropRequireDefault - ); - if (!callback) { - revertHook(); - return module; - } - const cbResult = callback(module); - if ((0, _jestUtil().isPromise)(cbResult)) { - return await waitForPromiseWithCleanup(cbResult, revertHook).then( - () => module - ); - } - return module; - } finally { - revertHook(); - } - } - shouldTransform(filename) { - const ignoreRegexp = this._cache.ignorePatternsRegExp; - const isIgnored = ignoreRegexp ? ignoreRegexp.test(filename) : false; - return this._config.transform.length !== 0 && !isIgnored; - } -} - -// TODO: do we need to define the generics twice? -async function createTranspilingRequire(config) { - const transformer = await createScriptTransformer(config); - return async function requireAndTranspileModule( - resolverPath, - applyInteropRequireDefault = false - ) { - const transpiledModule = await transformer.requireAndTranspileModule( - resolverPath, - // eslint-disable-next-line @typescript-eslint/no-empty-function - () => {}, - { - applyInteropRequireDefault, - instrument: false, - supportsDynamicImport: false, - // this might be true, depending on node version. - supportsExportNamespaceFrom: false, - supportsStaticESM: false, - supportsTopLevelAwait: false - } - ); - return transpiledModule; - }; -} -const removeFile = path => { - try { - fs().unlinkSync(path); - } catch {} -}; -const stripShebang = content => { - // If the file data starts with a shebang remove it. Leaves the empty line - // to keep stack trace line numbers correct. - if (content.startsWith('#!')) { - return content.replace(/^#!.*/, ''); - } else { - return content; - } -}; - -/** - * This is like `writeCacheFile` but with an additional sanity checksum. We - * cannot use the same technique for source maps because we expose source map - * cache file paths directly to callsites, with the expectation they can read - * it right away. This is not a great system, because source map cache file - * could get corrupted, out-of-sync, etc. - */ -function writeCodeCacheFile(cachePath, code) { - const checksum = (0, _crypto().createHash)('sha1') - .update(code) - .digest('hex') - .substring(0, 32); - writeCacheFile(cachePath, `${checksum}\n${code}`); -} - -/** - * Read counterpart of `writeCodeCacheFile`. We verify that the content of the - * file matches the checksum, in case some kind of corruption happened. This - * could happen if an older version of `jest-runtime` writes non-atomically to - * the same cache, for example. - */ -function readCodeCacheFile(cachePath) { - const content = readCacheFile(cachePath); - if (content == null) { - return null; - } - const code = content.substring(33); - const checksum = (0, _crypto().createHash)('sha1') - .update(code) - .digest('hex') - .substring(0, 32); - if (checksum === content.substring(0, 32)) { - return code; - } - return null; -} - -/** - * Writing to the cache atomically relies on 'rename' being atomic on most - * file systems. Doing atomic write reduces the risk of corruption by avoiding - * two processes to write to the same file at the same time. It also reduces - * the risk of reading a file that's being overwritten at the same time. - */ -const writeCacheFile = (cachePath, fileData) => { - try { - (0, _writeFileAtomic().sync)(cachePath, fileData, { - encoding: 'utf8', - fsync: false - }); - } catch (e) { - if (!(e instanceof Error)) { - throw e; - } - if (cacheWriteErrorSafeToIgnore(e, cachePath)) { - return; - } - e.message = `jest: failed to cache transform results in: ${cachePath}\nFailure message: ${e.message}`; - removeFile(cachePath); - throw e; - } -}; - -/** - * On Windows, renames are not atomic, leading to EPERM exceptions when two - * processes attempt to rename to the same target file at the same time. - * If the target file exists we can be reasonably sure another process has - * legitimately won a cache write race and ignore the error. - */ -const cacheWriteErrorSafeToIgnore = (e, cachePath) => - process.platform === 'win32' && - e.code === 'EPERM' && - fs().existsSync(cachePath); -const readCacheFile = cachePath => { - if (!fs().existsSync(cachePath)) { - return null; - } - let fileData; - try { - fileData = fs().readFileSync(cachePath, 'utf8'); - } catch (e) { - if (!(e instanceof Error)) { - throw e; - } - // on windows write-file-atomic is not atomic which can - // result in this error - if (e.code === 'ENOENT' && process.platform === 'win32') { - return null; - } - e.message = `jest: failed to read cache file: ${cachePath}\nFailure message: ${e.message}`; - removeFile(cachePath); - throw e; - } - if (fileData == null) { - // We must have somehow created the file but failed to write to it, - // let's delete it and retry. - removeFile(cachePath); - } - return fileData; -}; -const getScriptCacheKey = (filename, instrument) => { - const mtime = fs().statSync(filename).mtime; - return `${filename}_${mtime.getTime()}${instrument ? '_instrumented' : ''}`; -}; -const calcIgnorePatternRegExp = config => { - if ( - config.transformIgnorePatterns == null || - config.transformIgnorePatterns.length === 0 - ) { - return undefined; - } - return new RegExp(config.transformIgnorePatterns.join('|')); -}; -const calcTransformRegExp = config => { - if (!config.transform.length) { - return undefined; - } - const transformRegexp = []; - for (let i = 0; i < config.transform.length; i++) { - transformRegexp.push([ - new RegExp(config.transform[i][0]), - config.transform[i][1], - config.transform[i][2] - ]); - } - return transformRegexp; -}; -function invariant(condition, message) { - if (condition == null || condition === false || condition === '') { - throw new Error(message); - } -} -function assertSyncTransformer(transformer, name) { - invariant(name); - invariant( - typeof transformer.process === 'function', - (0, _runtimeErrorsAndWarnings.makeInvalidSyncTransformerError)(name) - ); -} -async function createScriptTransformer(config, cacheFS = new Map()) { - const transformer = new ScriptTransformer(config, cacheFS); - await transformer.loadTransformers(); - return transformer; -} diff --git a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js deleted file mode 100644 index d0498e696..000000000 --- a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = handlePotentialSyntaxError; -exports.enhanceUnexpectedTokenMessage = enhanceUnexpectedTokenMessage; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const DOT = ' \u2022 '; -function handlePotentialSyntaxError(e) { - if (e.codeFrame != null) { - e.stack = `${e.message}\n${e.codeFrame}`; - } - if ( - // `instanceof` might come from the wrong context - e.name === 'SyntaxError' && - !e.message.includes(' expected') - ) { - throw enhanceUnexpectedTokenMessage(e); - } - return e; -} -function enhanceUnexpectedTokenMessage(e) { - e.stack = `${_chalk().default.bold.red( - 'Jest encountered an unexpected token' - )} - -Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - -Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - -By default "node_modules" folder is ignored by transformers. - -Here's what you can do: -${DOT}If you are trying to use ECMAScript Modules, see ${_chalk().default.underline( - 'https://jestjs.io/docs/ecmascript-modules' - )} for how to enable it. -${DOT}If you are trying to use TypeScript, see ${_chalk().default.underline( - 'https://jestjs.io/docs/getting-started#using-typescript' - )} -${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${_chalk().default.bold( - '"transformIgnorePatterns"' - )} in your config. -${DOT}If you need a custom transformation specify a ${_chalk().default.bold( - '"transform"' - )} option in your config. -${DOT}If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the ${_chalk().default.bold( - '"moduleNameMapper"' - )} config option. - -You'll find more details and examples of these config options in the docs: -${_chalk().default.cyan('https://jestjs.io/docs/configuration')} -For information about custom transformations, see: -${_chalk().default.cyan('https://jestjs.io/docs/code-transformation')} - -${_chalk().default.bold.red('Details:')} - -${e.stack ?? ''}`.trimRight(); - return e; -} diff --git a/node_modules/@jest/transform/build/index.d.ts b/node_modules/@jest/transform/build/index.d.ts deleted file mode 100644 index a5065488f..000000000 --- a/node_modules/@jest/transform/build/index.d.ts +++ /dev/null @@ -1,240 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -import type {Config} from '@jest/types'; -import type {EncodedSourceMap} from '@jridgewell/trace-mapping'; -import type {TransformTypes} from '@jest/types'; - -export declare interface AsyncTransformer { - /** - * Indicates if the transformer is capable of instrumenting the code for code coverage. - * - * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented. - * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel. - */ - canInstrument?: boolean; - getCacheKey?: ( - sourceText: string, - sourcePath: string, - options: TransformOptions, - ) => string; - getCacheKeyAsync?: ( - sourceText: string, - sourcePath: string, - options: TransformOptions, - ) => Promise; - process?: ( - sourceText: string, - sourcePath: string, - options: TransformOptions, - ) => TransformedSource; - processAsync: ( - sourceText: string, - sourcePath: string, - options: TransformOptions, - ) => Promise; -} - -export declare interface CallerTransformOptions { - supportsDynamicImport: boolean; - supportsExportNamespaceFrom: boolean; - supportsStaticESM: boolean; - supportsTopLevelAwait: boolean; -} - -export declare function createScriptTransformer( - config: Config.ProjectConfig, - cacheFS?: StringMap, -): Promise; - -export declare function createTranspilingRequire( - config: Config.ProjectConfig, -): Promise< - ( - resolverPath: string, - applyInteropRequireDefault?: boolean, - ) => Promise ->; - -declare interface ErrorWithCodeFrame extends Error { - codeFrame?: string; -} - -declare interface FixedRawSourceMap extends Omit { - version: number; -} - -export declare function handlePotentialSyntaxError( - e: ErrorWithCodeFrame, -): ErrorWithCodeFrame; - -declare interface ReducedTransformOptions extends CallerTransformOptions { - instrument: boolean; -} - -declare interface RequireAndTranspileModuleOptions - extends ReducedTransformOptions { - applyInteropRequireDefault: boolean; -} - -export declare type ScriptTransformer = ScriptTransformer_2; - -declare class ScriptTransformer_2 { - private readonly _config; - private readonly _cacheFS; - private readonly _cache; - private readonly _transformCache; - private _transformsAreLoaded; - constructor(_config: Config.ProjectConfig, _cacheFS: StringMap); - private _buildCacheKeyFromFileInfo; - private _buildTransformCacheKey; - private _getCacheKey; - private _getCacheKeyAsync; - private _createCachedFilename; - private _getFileCachePath; - private _getFileCachePathAsync; - private _getTransformPatternAndPath; - private _getTransformPath; - loadTransformers(): Promise; - private _getTransformer; - private _instrumentFile; - private _buildTransformResult; - transformSource( - filepath: string, - content: string, - options: ReducedTransformOptions, - ): TransformResult; - transformSourceAsync( - filepath: string, - content: string, - options: ReducedTransformOptions, - ): Promise; - private _transformAndBuildScriptAsync; - private _transformAndBuildScript; - transformAsync( - filename: string, - options: TransformationOptions, - fileSource?: string, - ): Promise; - transform( - filename: string, - options: TransformationOptions, - fileSource?: string, - ): TransformResult; - transformJson( - filename: string, - options: TransformationOptions, - fileSource: string, - ): string; - requireAndTranspileModule( - moduleName: string, - callback?: (module: ModuleType) => void | Promise, - options?: RequireAndTranspileModuleOptions, - ): Promise; - shouldTransform(filename: string): boolean; -} - -export declare function shouldInstrument( - filename: string, - options: ShouldInstrumentOptions, - config: Config.ProjectConfig, - loadedFilenames?: Array, -): boolean; - -export declare interface ShouldInstrumentOptions - extends Pick< - Config.GlobalConfig, - 'collectCoverage' | 'collectCoverageFrom' | 'coverageProvider' - > { - changedFiles?: Set; - sourcesRelatedToTestsInChangedFiles?: Set; -} - -declare type StringMap = Map; - -export declare interface SyncTransformer { - /** - * Indicates if the transformer is capable of instrumenting the code for code coverage. - * - * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented. - * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel. - */ - canInstrument?: boolean; - getCacheKey?: ( - sourceText: string, - sourcePath: string, - options: TransformOptions, - ) => string; - getCacheKeyAsync?: ( - sourceText: string, - sourcePath: string, - options: TransformOptions, - ) => Promise; - process: ( - sourceText: string, - sourcePath: string, - options: TransformOptions, - ) => TransformedSource; - processAsync?: ( - sourceText: string, - sourcePath: string, - options: TransformOptions, - ) => Promise; -} - -export declare interface TransformationOptions - extends ShouldInstrumentOptions, - CallerTransformOptions { - isInternalModule?: boolean; -} - -export declare type TransformedSource = { - code: string; - map?: FixedRawSourceMap | string | null; -}; - -/** - * We have both sync (`process`) and async (`processAsync`) code transformation, which both can be provided. - * `require` will always use `process`, and `import` will use `processAsync` if it exists, otherwise fall back to `process`. - * Meaning, if you use `import` exclusively you do not need `process`, but in most cases supplying both makes sense: - * Jest transpiles on demand rather than ahead of time, so the sync one needs to exist. - * - * For more info on the sync vs async model, see https://jestjs.io/docs/code-transformation#writing-custom-transformers - */ -declare type Transformer_2 = - | SyncTransformer - | AsyncTransformer; -export {Transformer_2 as Transformer}; - -export declare type TransformerCreator< - X extends Transformer_2, - TransformerConfig = unknown, -> = (transformerConfig?: TransformerConfig) => X | Promise; - -/** - * Instead of having your custom transformer implement the Transformer interface - * directly, you can choose to export a factory function to dynamically create - * transformers. This is to allow having a transformer config in your jest config. - */ -export declare type TransformerFactory = { - createTransformer: TransformerCreator; -}; - -export declare interface TransformOptions - extends ReducedTransformOptions { - /** Cached file system which is used by `jest-runtime` to improve performance. */ - cacheFS: StringMap; - /** Jest configuration of currently running project. */ - config: Config.ProjectConfig; - /** Stringified version of the `config` - useful in cache busting. */ - configString: string; - /** Transformer configuration passed through `transform` option by the user. */ - transformerConfig: TransformerConfig; -} - -export declare type TransformResult = TransformTypes.TransformResult; - -export {}; diff --git a/node_modules/@jest/transform/build/index.js b/node_modules/@jest/transform/build/index.js deleted file mode 100644 index 7b2d0303a..000000000 --- a/node_modules/@jest/transform/build/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'createScriptTransformer', { - enumerable: true, - get: function () { - return _ScriptTransformer.createScriptTransformer; - } -}); -Object.defineProperty(exports, 'createTranspilingRequire', { - enumerable: true, - get: function () { - return _ScriptTransformer.createTranspilingRequire; - } -}); -Object.defineProperty(exports, 'handlePotentialSyntaxError', { - enumerable: true, - get: function () { - return _enhanceUnexpectedTokenMessage.default; - } -}); -Object.defineProperty(exports, 'shouldInstrument', { - enumerable: true, - get: function () { - return _shouldInstrument.default; - } -}); -var _ScriptTransformer = require('./ScriptTransformer'); -var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument')); -var _enhanceUnexpectedTokenMessage = _interopRequireDefault( - require('./enhanceUnexpectedTokenMessage') -); -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js b/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js deleted file mode 100644 index eba96778f..000000000 --- a/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.makeInvalidTransformerError = - exports.makeInvalidSyncTransformerError = - exports.makeInvalidSourceMapWarning = - exports.makeInvalidReturnValueError = - void 0; -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - _chalk = function () { - return data; - }; - return data; -} -function _slash() { - const data = _interopRequireDefault(require('slash')); - _slash = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const BULLET = '\u25cf '; -const DOCUMENTATION_NOTE = ` ${_chalk().default.bold( - 'Code Transformation Documentation:' -)} - https://jestjs.io/docs/code-transformation -`; -const UPGRADE_NOTE = ` ${_chalk().default.bold( - 'This error may be caused by a breaking change in Jest 28:' -)} - https://jestjs.io/docs/28.x/upgrading-to-jest28#transformer -`; -const makeInvalidReturnValueError = transformPath => - _chalk().default.red( - [ - _chalk().default.bold(`${BULLET}Invalid return value:`), - ' `process()` or/and `processAsync()` method of code transformer found at ', - ` "${(0, _slash().default)(transformPath)}" `, - ' should return an object or a Promise resolving to an object. The object ', - ' must have `code` property with a string of processed code.', - '' - ].join('\n') + - UPGRADE_NOTE + - DOCUMENTATION_NOTE - ); -exports.makeInvalidReturnValueError = makeInvalidReturnValueError; -const makeInvalidSourceMapWarning = (filename, transformPath) => - _chalk().default.yellow( - [ - _chalk().default.bold(`${BULLET}Invalid source map:`), - ` The source map for "${(0, _slash().default)( - filename - )}" returned by "${(0, _slash().default)(transformPath)}" is invalid.`, - ' Proceeding without source mapping for that file.' - ].join('\n') - ); -exports.makeInvalidSourceMapWarning = makeInvalidSourceMapWarning; -const makeInvalidSyncTransformerError = transformPath => - _chalk().default.red( - [ - _chalk().default.bold(`${BULLET}Invalid synchronous transformer module:`), - ` "${(0, _slash().default)( - transformPath - )}" specified in the "transform" object of Jest configuration`, - ' must export a `process` function.', - '' - ].join('\n') + DOCUMENTATION_NOTE - ); -exports.makeInvalidSyncTransformerError = makeInvalidSyncTransformerError; -const makeInvalidTransformerError = transformPath => - _chalk().default.red( - [ - _chalk().default.bold(`${BULLET}Invalid transformer module:`), - ` "${(0, _slash().default)( - transformPath - )}" specified in the "transform" object of Jest configuration`, - ' must export a `process` or `processAsync` or `createTransformer` function.', - '' - ].join('\n') + DOCUMENTATION_NOTE - ); -exports.makeInvalidTransformerError = makeInvalidTransformerError; diff --git a/node_modules/@jest/transform/build/shouldInstrument.js b/node_modules/@jest/transform/build/shouldInstrument.js deleted file mode 100644 index 017f39e72..000000000 --- a/node_modules/@jest/transform/build/shouldInstrument.js +++ /dev/null @@ -1,174 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = shouldInstrument; -function path() { - const data = _interopRequireWildcard(require('path')); - path = function () { - return data; - }; - return data; -} -function _micromatch() { - const data = _interopRequireDefault(require('micromatch')); - _micromatch = function () { - return data; - }; - return data; -} -function _jestRegexUtil() { - const data = require('jest-regex-util'); - _jestRegexUtil = function () { - return data; - }; - return data; -} -function _jestUtil() { - const data = require('jest-util'); - _jestUtil = function () { - return data; - }; - return data; -} -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== 'function') return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function (nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj.default = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const MOCKS_PATTERN = new RegExp( - (0, _jestRegexUtil().escapePathForRegex)( - `${path().sep}__mocks__${path().sep}` - ) -); -const cachedRegexes = new Map(); -const getRegex = regexStr => { - if (!cachedRegexes.has(regexStr)) { - cachedRegexes.set(regexStr, new RegExp(regexStr)); - } - const regex = cachedRegexes.get(regexStr); - - // prevent stateful regexes from breaking, just in case - regex.lastIndex = 0; - return regex; -}; -function shouldInstrument(filename, options, config, loadedFilenames) { - if (!options.collectCoverage) { - return false; - } - if ( - config.forceCoverageMatch.length && - _micromatch().default.any(filename, config.forceCoverageMatch) - ) { - return true; - } - if ( - !config.testPathIgnorePatterns.some(pattern => - getRegex(pattern).test(filename) - ) - ) { - if (config.testRegex.some(regex => new RegExp(regex).test(filename))) { - return false; - } - if ( - (0, _jestUtil().globsToMatcher)(config.testMatch)( - (0, _jestUtil().replacePathSepForGlob)(filename) - ) - ) { - return false; - } - } - if ( - options.collectCoverageFrom.length === 0 && - loadedFilenames != null && - !loadedFilenames.includes(filename) - ) { - return false; - } - if ( - // still cover if `only` is specified - options.collectCoverageFrom.length && - !(0, _jestUtil().globsToMatcher)(options.collectCoverageFrom)( - (0, _jestUtil().replacePathSepForGlob)( - path().relative(config.rootDir, filename) - ) - ) - ) { - return false; - } - if ( - config.coveragePathIgnorePatterns.some(pattern => !!filename.match(pattern)) - ) { - return false; - } - if (config.globalSetup === filename) { - return false; - } - if (config.globalTeardown === filename) { - return false; - } - if (config.setupFiles.includes(filename)) { - return false; - } - if (config.setupFilesAfterEnv.includes(filename)) { - return false; - } - if (MOCKS_PATTERN.test(filename)) { - return false; - } - if (options.changedFiles && !options.changedFiles.has(filename)) { - if (!options.sourcesRelatedToTestsInChangedFiles) { - return false; - } - if (!options.sourcesRelatedToTestsInChangedFiles.has(filename)) { - return false; - } - } - return true; -} diff --git a/node_modules/@jest/transform/build/types.js b/node_modules/@jest/transform/build/types.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/transform/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/transform/package.json b/node_modules/@jest/transform/package.json deleted file mode 100644 index 79a9a58fa..000000000 --- a/node_modules/@jest/transform/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@jest/transform", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-transform" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/types": "^29.5.0", - "@jridgewell/trace-mapping": "^0.3.15", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", - "convert-source-map": "^2.0.0", - "fast-json-stable-stringify": "^2.1.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "jest-regex-util": "^29.4.3", - "jest-util": "^29.5.0", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", - "slash": "^3.0.0", - "write-file-atomic": "^4.0.2" - }, - "devDependencies": { - "@jest/test-utils": "^29.5.0", - "@types/babel__core": "^7.1.14", - "@types/convert-source-map": "^2.0.0", - "@types/graceful-fs": "^4.1.3", - "@types/micromatch": "^4.0.1", - "@types/write-file-atomic": "^4.0.0", - "dedent": "^0.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jest/types/LICENSE b/node_modules/@jest/types/LICENSE deleted file mode 100644 index b93be9051..000000000 --- a/node_modules/@jest/types/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -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/@jest/types/README.md b/node_modules/@jest/types/README.md deleted file mode 100644 index a4f56b6d7..000000000 --- a/node_modules/@jest/types/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# @jest/types - -This package contains shared types of Jest's packages. - -If you are looking for types of [Jest globals](https://jestjs.io/docs/api), you can import them from `@jest/globals` package: - -```ts -import {describe, expect, it} from '@jest/globals'; - -describe('my tests', () => { - it('works', () => { - expect(1).toBe(1); - }); -}); -``` - -If you prefer to omit imports, a similar result can be achieved installing the [@types/jest](https://npmjs.com/package/@types/jest) package. Note that this is a third party library maintained at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) and may not cover the latest Jest features. - -Another use-case for `@types/jest` is a typed Jest config as those types are not provided by Jest out of the box: - -```ts -// jest.config.ts -import {Config} from '@jest/types'; - -const config: Config.InitialOptions = { - // some typed config -}; - -export default config; -``` diff --git a/node_modules/@jest/types/build/Circus.js b/node_modules/@jest/types/build/Circus.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/types/build/Circus.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/types/build/Config.js b/node_modules/@jest/types/build/Config.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/types/build/Config.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/types/build/Global.js b/node_modules/@jest/types/build/Global.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/types/build/Global.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/types/build/TestResult.js b/node_modules/@jest/types/build/TestResult.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/types/build/TestResult.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/types/build/Transform.js b/node_modules/@jest/types/build/Transform.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/types/build/Transform.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/types/build/index.d.ts b/node_modules/@jest/types/build/index.d.ts deleted file mode 100644 index 8a6b1191a..000000000 --- a/node_modules/@jest/types/build/index.d.ts +++ /dev/null @@ -1,1185 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -/// - -import type {Arguments} from 'yargs'; -import type {CoverageMapData} from 'istanbul-lib-coverage'; -import type {ForegroundColor} from 'chalk'; -import type {ReportOptions} from 'istanbul-reports'; -import type {SnapshotFormat} from '@jest/schemas'; - -declare type Argv = Arguments< - Partial<{ - all: boolean; - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: string; - changedFilesWithAncestor: boolean; - changedSince: string; - ci: boolean; - clearCache: boolean; - clearMocks: boolean; - collectCoverage: boolean; - collectCoverageFrom: string; - color: boolean; - colors: boolean; - config: string; - coverage: boolean; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageThreshold: string; - debug: boolean; - env: string; - expand: boolean; - findRelatedTests: boolean; - forceExit: boolean; - globals: string; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: string; - ignoreProjects: Array; - init: boolean; - injectGlobals: boolean; - json: boolean; - lastCommit: boolean; - logHeapUsage: boolean; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: string; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - outputFile: string; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - randomize: boolean; - reporters: Array; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runInBand: boolean; - seed: number; - showSeed: boolean; - selectProjects: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - shard: string; - showConfig: boolean; - silent: boolean; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: string; - testFailureExitCode: string | null | undefined; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testPathPattern: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testTimeout: number | null | undefined; - transform: string; - transformIgnorePatterns: Array; - unmockedModulePathPatterns: Array | null | undefined; - updateSnapshot: boolean; - useStderr: boolean; - verbose: boolean; - version: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPathIgnorePatterns: Array; - workerIdleMemoryLimit: number | string; - workerThreads: boolean; - }> ->; - -declare type ArrayTable = Table | Row; - -declare type AssertionResult = { - ancestorTitles: Array; - duration?: number | null; - failureDetails: Array; - failureMessages: Array; - fullName: string; - invocations?: number; - location?: Callsite | null; - numPassingAsserts: number; - retryReasons?: Array; - status: Status; - title: string; -}; - -declare type AsyncEvent = - | { - name: 'setup'; - testNamePattern?: string; - runtimeGlobals: JestGlobals; - parentProcess: Process; - } - | { - name: 'include_test_location_in_result'; - } - | { - name: 'hook_start'; - hook: Hook; - } - | { - name: 'hook_success'; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; - } - | { - name: 'hook_failure'; - error: string | Exception; - describeBlock?: DescribeBlock; - test?: TestEntry; - hook: Hook; - } - | { - name: 'test_fn_start'; - test: TestEntry; - } - | { - name: 'test_fn_success'; - test: TestEntry; - } - | { - name: 'test_fn_failure'; - error: Exception; - test: TestEntry; - } - | { - name: 'test_retry'; - test: TestEntry; - } - | { - name: 'test_start'; - test: TestEntry; - } - | { - name: 'test_skip'; - test: TestEntry; - } - | { - name: 'test_todo'; - test: TestEntry; - } - | { - name: 'test_done'; - test: TestEntry; - } - | { - name: 'run_describe_start'; - describeBlock: DescribeBlock; - } - | { - name: 'run_describe_finish'; - describeBlock: DescribeBlock; - } - | { - name: 'run_start'; - } - | { - name: 'run_finish'; - } - | { - name: 'teardown'; - }; - -declare type AsyncFn = TestFn_2 | HookFn_2; - -declare type BlockFn = () => void; - -declare type BlockFn_2 = Global.BlockFn; - -declare type BlockMode = void | 'skip' | 'only' | 'todo'; - -declare type BlockName = string; - -declare type BlockName_2 = Global.BlockName; - -declare type BlockNameLike = BlockName | NameLike; - -declare type BlockNameLike_2 = Global.BlockNameLike; - -declare type Callsite = { - column: number; - line: number; -}; - -declare namespace Circus { - export { - DoneFn, - BlockFn_2 as BlockFn, - BlockName_2 as BlockName, - BlockNameLike_2 as BlockNameLike, - BlockMode, - TestMode, - TestName_2 as TestName, - TestNameLike_2 as TestNameLike, - TestFn_2 as TestFn, - ConcurrentTestFn_2 as ConcurrentTestFn, - HookFn_2 as HookFn, - AsyncFn, - SharedHookType, - HookType, - TestContext_2 as TestContext, - Exception, - FormattedError, - Hook, - EventHandler, - Event_2 as Event, - SyncEvent, - AsyncEvent, - MatcherResults, - TestStatus, - TestResult_2 as TestResult, - RunResult, - TestResults, - GlobalErrorHandlers, - State, - DescribeBlock, - TestError, - TestEntry, - }; -} -export {Circus}; - -declare type Col = unknown; - -declare type ConcurrentTestFn = () => TestReturnValuePromise; - -declare type ConcurrentTestFn_2 = Global.ConcurrentTestFn; - -declare namespace Config { - export { - FakeableAPI, - GlobalFakeTimersConfig, - FakeTimersConfig, - LegacyFakeTimersConfig, - HasteConfig, - CoverageReporterName, - CoverageReporterWithOptions, - CoverageReporters, - ReporterConfig, - TransformerConfig, - ConfigGlobals, - DefaultOptions, - DisplayName, - InitialOptionsWithRootDir, - InitialProjectOptions, - InitialOptions, - SnapshotUpdateState, - CoverageThresholdValue, - GlobalConfig, - ProjectConfig, - Argv, - }; -} -export {Config}; - -declare interface ConfigGlobals { - [K: string]: unknown; -} - -declare type CoverageProvider = 'babel' | 'v8'; - -declare type CoverageReporterName = keyof ReportOptions; - -declare type CoverageReporters = Array< - CoverageReporterName | CoverageReporterWithOptions ->; - -declare type CoverageReporterWithOptions = - K extends CoverageReporterName - ? ReportOptions[K] extends never - ? never - : [K, Partial] - : never; - -declare type CoverageThreshold = { - [path: string]: CoverageThresholdValue; - global: CoverageThresholdValue; -}; - -declare type CoverageThresholdValue = { - branches?: number; - functions?: number; - lines?: number; - statements?: number; -}; - -declare type DefaultOptions = { - automock: boolean; - bail: number; - cache: boolean; - cacheDirectory: string; - changedFilesWithAncestor: boolean; - ci: boolean; - clearMocks: boolean; - collectCoverage: boolean; - coveragePathIgnorePatterns: Array; - coverageReporters: Array; - coverageProvider: CoverageProvider; - detectLeaks: boolean; - detectOpenHandles: boolean; - errorOnDeprecated: boolean; - expand: boolean; - extensionsToTreatAsEsm: Array; - fakeTimers: FakeTimers; - forceCoverageMatch: Array; - globals: ConfigGlobals; - haste: HasteConfig; - injectGlobals: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Record>; - modulePathIgnorePatterns: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: NotifyMode; - openHandlesTimeout: number; - passWithNoTests: boolean; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - restoreMocks: boolean; - roots: Array; - runTestsByPath: boolean; - runner: string; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - slowTestThreshold: number; - snapshotFormat: SnapshotFormat; - snapshotSerializers: Array; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - testSequencer: string; - transformIgnorePatterns: Array; - useStderr: boolean; - watch: boolean; - watchPathIgnorePatterns: Array; - watchman: boolean; - workerThreads: boolean; -}; - -declare interface Describe extends DescribeBase { - only: DescribeBase; - skip: DescribeBase; -} - -declare interface DescribeBase { - (blockName: BlockNameLike, blockFn: BlockFn): void; - each: Each; -} - -declare type DescribeBlock = { - type: 'describeBlock'; - children: Array; - hooks: Array; - mode: BlockMode; - name: BlockName_2; - parent?: DescribeBlock; - /** @deprecated Please get from `children` array instead */ - tests: Array; -}; - -declare type DisplayName = { - name: string; - color: typeof ForegroundColor; -}; - -declare type DoneFn = Global.DoneFn; - -declare type DoneFn_2 = (reason?: string | Error) => void; - -declare type DoneTakingTestFn = ( - this: TestContext, - done: DoneFn_2, -) => ValidTestReturnValues; - -declare interface Each { - >(table: ReadonlyArray): ( - name: string | NameLike, - fn: (arg: T, done: DoneFn_2) => ReturnType, - timeout?: number, - ) => void; - ]>(table: ReadonlyArray): ( - name: string | NameLike, - fn: (...args: T) => ReturnType, - timeout?: number, - ) => void; - >(table: ReadonlyArray): ( - name: string | NameLike, - fn: (...args: T) => ReturnType, - timeout?: number, - ) => void; - (table: ReadonlyArray): ( - name: string | NameLike, - fn: (arg: T, done: DoneFn_2) => ReturnType, - timeout?: number, - ) => void; - (strings: TemplateStringsArray, ...expressions: Array): ( - name: string | NameLike, - fn: (arg: Record, done: DoneFn_2) => ReturnType, - timeout?: number, - ) => void; - >( - strings: TemplateStringsArray, - ...expressions: Array - ): ( - name: string | NameLike, - fn: (arg: T, done: DoneFn_2) => ReturnType, - timeout?: number, - ) => void; -} - -declare type EachTable = ArrayTable | TemplateTable; - -declare type EachTestFn = ( - ...args: ReadonlyArray -) => ReturnType; - -declare type Event_2 = SyncEvent | AsyncEvent; - -declare interface EventHandler { - (event: AsyncEvent, state: State): void | Promise; - (event: SyncEvent, state: State): void; -} - -declare type Exception = any; - -declare interface Failing { - (testName: TestNameLike, fn: T, timeout?: number): void; - each: Each; -} - -declare type FakeableAPI = - | 'Date' - | 'hrtime' - | 'nextTick' - | 'performance' - | 'queueMicrotask' - | 'requestAnimationFrame' - | 'cancelAnimationFrame' - | 'requestIdleCallback' - | 'cancelIdleCallback' - | 'setImmediate' - | 'clearImmediate' - | 'setInterval' - | 'clearInterval' - | 'setTimeout' - | 'clearTimeout'; - -declare type FakeTimers = GlobalFakeTimersConfig & - ( - | (FakeTimersConfig & { - now?: Exclude; - }) - | LegacyFakeTimersConfig - ); - -declare type FakeTimersConfig = { - /** - * If set to `true` all timers will be advanced automatically - * by 20 milliseconds every 20 milliseconds. A custom time delta - * may be provided by passing a number. - * - * @defaultValue - * The default is `false`. - */ - advanceTimers?: boolean | number; - /** - * List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, - * `setTimeout()`) that should not be faked. - * - * @defaultValue - * The default is `[]`, meaning all APIs are faked. - */ - doNotFake?: Array; - /** - * Sets current system time to be used by fake timers. - * - * @defaultValue - * The default is `Date.now()`. - */ - now?: number | Date; - /** - * The maximum number of recursive timers that will be run when calling - * `jest.runAllTimers()`. - * - * @defaultValue - * The default is `100_000` timers. - */ - timerLimit?: number; - /** - * Use the old fake timers implementation instead of one backed by - * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). - * - * @defaultValue - * The default is `false`. - */ - legacyFakeTimers?: false; -}; - -declare type FormattedError = string; - -declare type GeneratorReturningTestFn = ( - this: TestContext, -) => TestReturnValueGenerator; - -declare namespace Global { - export { - ValidTestReturnValues, - TestReturnValue, - TestContext, - DoneFn_2 as DoneFn, - DoneTakingTestFn, - PromiseReturningTestFn, - GeneratorReturningTestFn, - NameLike, - TestName, - TestNameLike, - TestFn, - ConcurrentTestFn, - BlockFn, - BlockName, - BlockNameLike, - HookFn, - Col, - Row, - Table, - ArrayTable, - TemplateTable, - TemplateData, - EachTable, - TestCallback, - EachTestFn, - HookBase, - Failing, - ItBase, - It, - ItConcurrentBase, - ItConcurrentExtended, - ItConcurrent, - DescribeBase, - Describe, - TestFrameworkGlobals, - GlobalAdditions, - Global_2 as Global, - }; -} -export {Global}; - -declare interface Global_2 - extends GlobalAdditions, - Omit { - [extras: PropertyKey]: unknown; -} - -declare interface GlobalAdditions extends TestFrameworkGlobals { - __coverage__: CoverageMapData; -} - -declare type GlobalConfig = { - bail: number; - changedSince?: string; - changedFilesWithAncestor: boolean; - ci: boolean; - collectCoverage: boolean; - collectCoverageFrom: Array; - coverageDirectory: string; - coveragePathIgnorePatterns?: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold?: CoverageThreshold; - detectLeaks: boolean; - detectOpenHandles: boolean; - expand: boolean; - filter?: string; - findRelatedTests: boolean; - forceExit: boolean; - json: boolean; - globalSetup?: string; - globalTeardown?: string; - lastCommit: boolean; - logHeapUsage: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number; - noStackTrace: boolean; - nonFlagArgs: Array; - noSCM?: boolean; - notify: boolean; - notifyMode: NotifyMode; - outputFile?: string; - onlyChanged: boolean; - onlyFailures: boolean; - openHandlesTimeout: number; - passWithNoTests: boolean; - projects: Array; - randomize?: boolean; - replname?: string; - reporters?: Array; - runTestsByPath: boolean; - rootDir: string; - seed: number; - showSeed?: boolean; - shard?: ShardConfig; - silent?: boolean; - skipFilter: boolean; - snapshotFormat: SnapshotFormat; - errorOnDeprecated: boolean; - testFailureExitCode: number; - testNamePattern?: string; - testPathPattern: string; - testResultsProcessor?: string; - testSequencer: string; - testTimeout?: number; - updateSnapshot: SnapshotUpdateState; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins?: Array<{ - path: string; - config: Record; - }> | null; - workerIdleMemoryLimit?: number; - workerThreads?: boolean; -}; - -declare type GlobalErrorHandlers = { - uncaughtException: Array<(exception: Exception) => void>; - unhandledRejection: Array< - (exception: Exception, promise: Promise) => void - >; -}; - -declare type GlobalFakeTimersConfig = { - /** - * Whether fake timers should be enabled globally for all test files. - * - * @defaultValue - * The default is `false`. - */ - enableGlobally?: boolean; -}; - -declare type HasteConfig = { - /** Whether to hash files using SHA-1. */ - computeSha1?: boolean; - /** The platform to use as the default, e.g. 'ios'. */ - defaultPlatform?: string | null; - /** Force use of Node's `fs` APIs rather than shelling out to `find` */ - forceNodeFilesystemAPI?: boolean; - /** - * Whether to follow symlinks when crawling for files. - * This options cannot be used in projects which use watchman. - * Projects with `watchman` set to true will error if this option is set to true. - */ - enableSymlinks?: boolean; - /** string to a custom implementation of Haste. */ - hasteImplModulePath?: string; - /** All platforms to target, e.g ['ios', 'android']. */ - platforms?: Array; - /** Whether to throw on error on module collision. */ - throwOnModuleCollision?: boolean; - /** Custom HasteMap module */ - hasteMapModulePath?: string; - /** Whether to retain all files, allowing e.g. search for tests in `node_modules`. */ - retainAllFiles?: boolean; -}; - -declare type Hook = { - asyncError: Error; - fn: HookFn_2; - type: HookType; - parent: DescribeBlock; - seenDone: boolean; - timeout: number | undefined | null; -}; - -declare interface HookBase { - (fn: HookFn, timeout?: number): void; -} - -declare type HookFn = TestFn; - -declare type HookFn_2 = Global.HookFn; - -declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; - -declare type InitialOptions = Partial<{ - automock: boolean; - bail: boolean | number; - cache: boolean; - cacheDirectory: string; - ci: boolean; - clearMocks: boolean; - changedFilesWithAncestor: boolean; - changedSince: string; - collectCoverage: boolean; - collectCoverageFrom: Array; - coverageDirectory: string; - coveragePathIgnorePatterns: Array; - coverageProvider: CoverageProvider; - coverageReporters: CoverageReporters; - coverageThreshold: CoverageThreshold; - dependencyExtractor: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName: string | DisplayName; - expand: boolean; - extensionsToTreatAsEsm: Array; - fakeTimers: FakeTimers; - filter: string; - findRelatedTests: boolean; - forceCoverageMatch: Array; - forceExit: boolean; - json: boolean; - globals: ConfigGlobals; - globalSetup: string | null | undefined; - globalTeardown: string | null | undefined; - haste: HasteConfig; - id: string; - injectGlobals: boolean; - reporters: Array; - logHeapUsage: boolean; - lastCommit: boolean; - listTests: boolean; - maxConcurrency: number; - maxWorkers: number | string; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: { - [key: string]: string | Array; - }; - modulePathIgnorePatterns: Array; - modulePaths: Array; - noStackTrace: boolean; - notify: boolean; - notifyMode: string; - onlyChanged: boolean; - onlyFailures: boolean; - openHandlesTimeout: number; - outputFile: string; - passWithNoTests: boolean; - preset: string | null | undefined; - prettierPath: string | null | undefined; - projects: Array; - randomize: boolean; - replname: string | null | undefined; - resetMocks: boolean; - resetModules: boolean; - resolver: string | null | undefined; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runner: string; - runTestsByPath: boolean; - runtime: string; - sandboxInjectedGlobals: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - showSeed: boolean; - silent: boolean; - skipFilter: boolean; - skipNodeResolution: boolean; - slowTestThreshold: number; - snapshotResolver: string; - snapshotSerializers: Array; - snapshotFormat: SnapshotFormat; - errorOnDeprecated: boolean; - testEnvironment: string; - testEnvironmentOptions: Record; - testFailureExitCode: string | number; - testLocationInResults: boolean; - testMatch: Array; - testNamePattern: string; - testPathIgnorePatterns: Array; - testRegex: string | Array; - testResultsProcessor: string; - testRunner: string; - testSequencer: string; - testTimeout: number; - transform: { - [regex: string]: string | TransformerConfig; - }; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns: Array; - updateSnapshot: boolean; - useStderr: boolean; - verbose?: boolean; - watch: boolean; - watchAll: boolean; - watchman: boolean; - watchPlugins: Array]>; - workerIdleMemoryLimit: number | string; - workerThreads: boolean; -}>; - -declare type InitialOptionsWithRootDir = InitialOptions & - Required>; - -declare type InitialProjectOptions = Pick< - InitialOptions & { - cwd?: string; - }, - keyof ProjectConfig ->; - -declare interface It extends ItBase { - only: ItBase; - skip: ItBase; - todo: (testName: TestNameLike) => void; -} - -declare interface ItBase { - (testName: TestNameLike, fn: TestFn, timeout?: number): void; - each: Each; - failing: Failing; -} - -declare interface ItConcurrent extends It { - concurrent: ItConcurrentExtended; -} - -declare interface ItConcurrentBase { - (testName: TestNameLike, testFn: ConcurrentTestFn, timeout?: number): void; - each: Each; - failing: Failing; -} - -declare interface ItConcurrentExtended extends ItConcurrentBase { - only: ItConcurrentBase; - skip: ItConcurrentBase; -} - -declare interface JestGlobals extends Global.TestFrameworkGlobals { - expect: unknown; -} - -declare type LegacyFakeTimersConfig = { - /** - * Use the old fake timers implementation instead of one backed by - * [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers). - * - * @defaultValue - * The default is `false`. - */ - legacyFakeTimers?: true; -}; - -declare type MatcherResults = { - actual: unknown; - expected: unknown; - name: string; - pass: boolean; -}; - -declare type NameLike = number | Function; - -declare type NotifyMode = - | 'always' - | 'failure' - | 'success' - | 'change' - | 'success-change' - | 'failure-change'; - -declare type Process = NodeJS.Process; - -declare type ProjectConfig = { - automock: boolean; - cache: boolean; - cacheDirectory: string; - clearMocks: boolean; - coveragePathIgnorePatterns: Array; - cwd: string; - dependencyExtractor?: string; - detectLeaks: boolean; - detectOpenHandles: boolean; - displayName?: DisplayName; - errorOnDeprecated: boolean; - extensionsToTreatAsEsm: Array; - fakeTimers: FakeTimers; - filter?: string; - forceCoverageMatch: Array; - globalSetup?: string; - globalTeardown?: string; - globals: ConfigGlobals; - haste: HasteConfig; - id: string; - injectGlobals: boolean; - moduleDirectories: Array; - moduleFileExtensions: Array; - moduleNameMapper: Array<[string, string]>; - modulePathIgnorePatterns: Array; - modulePaths?: Array; - openHandlesTimeout: number; - preset?: string; - prettierPath: string; - resetMocks: boolean; - resetModules: boolean; - resolver?: string; - restoreMocks: boolean; - rootDir: string; - roots: Array; - runner: string; - runtime?: string; - sandboxInjectedGlobals: Array; - setupFiles: Array; - setupFilesAfterEnv: Array; - skipFilter: boolean; - skipNodeResolution?: boolean; - slowTestThreshold: number; - snapshotResolver?: string; - snapshotSerializers: Array; - snapshotFormat: SnapshotFormat; - testEnvironment: string; - testEnvironmentOptions: Record; - testMatch: Array; - testLocationInResults: boolean; - testPathIgnorePatterns: Array; - testRegex: Array; - testRunner: string; - transform: Array<[string, string, Record]>; - transformIgnorePatterns: Array; - watchPathIgnorePatterns: Array; - unmockedModulePathPatterns?: Array; - workerIdleMemoryLimit?: number; -}; - -declare type PromiseReturningTestFn = (this: TestContext) => TestReturnValue; - -declare type ReporterConfig = [string, Record]; - -declare type Row = ReadonlyArray; - -declare type RunResult = { - unhandledErrors: Array; - testResults: TestResults; -}; - -declare type SerializableError = { - code?: unknown; - message: string; - stack: string | null | undefined; - type?: string; -}; - -declare type ShardConfig = { - shardIndex: number; - shardCount: number; -}; - -declare type SharedHookType = 'afterAll' | 'beforeAll'; - -declare type SnapshotUpdateState = 'all' | 'new' | 'none'; - -declare type State = { - currentDescribeBlock: DescribeBlock; - currentlyRunningTest?: TestEntry | null; - expand?: boolean; - hasFocusedTests: boolean; - hasStarted: boolean; - originalGlobalErrorHandlers?: GlobalErrorHandlers; - parentProcess: Process | null; - randomize?: boolean; - rootDescribeBlock: DescribeBlock; - seed: number; - testNamePattern?: RegExp | null; - testTimeout: number; - unhandledErrors: Array; - includeTestLocationInResult: boolean; - maxConcurrency: number; -}; - -declare type Status = - | 'passed' - | 'failed' - | 'skipped' - | 'pending' - | 'todo' - | 'disabled' - | 'focused'; - -declare type SyncEvent = - | { - asyncError: Error; - mode: BlockMode; - name: 'start_describe_definition'; - blockName: BlockName_2; - } - | { - mode: BlockMode; - name: 'finish_describe_definition'; - blockName: BlockName_2; - } - | { - asyncError: Error; - name: 'add_hook'; - hookType: HookType; - fn: HookFn_2; - timeout: number | undefined; - } - | { - asyncError: Error; - name: 'add_test'; - testName: TestName_2; - fn: TestFn_2; - mode?: TestMode; - concurrent: boolean; - timeout: number | undefined; - failing: boolean; - } - | { - name: 'error'; - error: Exception; - }; - -declare type Table = ReadonlyArray; - -declare type TemplateData = ReadonlyArray; - -declare type TemplateTable = TemplateStringsArray; - -declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; - -declare type TestContext = Record; - -declare type TestContext_2 = Global.TestContext; - -declare type TestEntry = { - type: 'test'; - asyncError: Exception; - errors: Array; - retryReasons: Array; - fn: TestFn_2; - invocations: number; - mode: TestMode; - concurrent: boolean; - name: TestName_2; - numPassingAsserts: number; - parent: DescribeBlock; - startedAt?: number | null; - duration?: number | null; - seenDone: boolean; - status?: TestStatus | null; - timeout?: number; - failing: boolean; -}; - -declare type TestError = Exception | [Exception | undefined, Exception]; - -declare type TestFn = - | PromiseReturningTestFn - | GeneratorReturningTestFn - | DoneTakingTestFn; - -declare type TestFn_2 = Global.TestFn; - -declare interface TestFrameworkGlobals { - it: ItConcurrent; - test: ItConcurrent; - fit: ItBase & { - concurrent?: ItConcurrentBase; - }; - xit: ItBase; - xtest: ItBase; - describe: Describe; - xdescribe: DescribeBase; - fdescribe: DescribeBase; - beforeAll: HookBase; - beforeEach: HookBase; - afterEach: HookBase; - afterAll: HookBase; -} - -declare type TestMode = BlockMode; - -declare type TestName = string; - -declare type TestName_2 = Global.TestName; - -declare type TestNameLike = TestName | NameLike; - -declare type TestNameLike_2 = Global.TestNameLike; - -declare namespace TestResult { - export {AssertionResult, SerializableError}; -} -export {TestResult}; - -declare type TestResult_2 = { - duration?: number | null; - errors: Array; - errorsDetailed: Array; - invocations: number; - status: TestStatus; - location?: { - column: number; - line: number; - } | null; - numPassingAsserts: number; - retryReasons: Array; - testPath: Array; -}; - -declare type TestResults = Array; - -declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; - -declare type TestReturnValueGenerator = Generator; - -declare type TestReturnValuePromise = Promise; - -declare type TestStatus = 'skip' | 'done' | 'todo'; - -declare type TransformerConfig = [string, Record]; - -declare type TransformResult = { - code: string; - originalCode: string; - sourceMapPath: string | null; -}; - -declare namespace TransformTypes { - export {TransformResult}; -} -export {TransformTypes}; - -declare type ValidTestReturnValues = void | undefined; - -export {}; diff --git a/node_modules/@jest/types/build/index.js b/node_modules/@jest/types/build/index.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/node_modules/@jest/types/build/index.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/types/package.json b/node_modules/@jest/types/package.json deleted file mode 100644 index 13f7af7f3..000000000 --- a/node_modules/@jest/types/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@jest/types", - "version": "29.5.0", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-types" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "license": "MIT", - "main": "./build/index.js", - "types": "./build/index.d.ts", - "exports": { - ".": { - "types": "./build/index.d.ts", - "default": "./build/index.js" - }, - "./package.json": "./package.json" - }, - "dependencies": { - "@jest/schemas": "^29.4.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "devDependencies": { - "@tsd/typescript": "^4.9.0", - "tsd-lite": "^0.6.0" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" -} diff --git a/node_modules/@jridgewell/gen-mapping/LICENSE b/node_modules/@jridgewell/gen-mapping/LICENSE deleted file mode 100644 index 352f0715f..000000000 --- a/node_modules/@jridgewell/gen-mapping/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2022 Justin Ridgewell - -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/@jridgewell/gen-mapping/README.md b/node_modules/@jridgewell/gen-mapping/README.md deleted file mode 100644 index 4066cdbbd..000000000 --- a/node_modules/@jridgewell/gen-mapping/README.md +++ /dev/null @@ -1,227 +0,0 @@ -# @jridgewell/gen-mapping - -> Generate source maps - -`gen-mapping` allows you to generate a source map during transpilation or minification. -With a source map, you're able to trace the original location in the source file, either in Chrome's -DevTools or using a library like [`@jridgewell/trace-mapping`][trace-mapping]. - -You may already be familiar with the [`source-map`][source-map] package's `SourceMapGenerator`. This -provides the same `addMapping` and `setSourceContent` API. - -## Installation - -```sh -npm install @jridgewell/gen-mapping -``` - -## Usage - -```typescript -import { GenMapping, addMapping, setSourceContent, toEncodedMap, toDecodedMap } from '@jridgewell/gen-mapping'; - -const map = new GenMapping({ - file: 'output.js', - sourceRoot: 'https://example.com/', -}); - -setSourceContent(map, 'input.js', `function foo() {}`); - -addMapping(map, { - // Lines start at line 1, columns at column 0. - generated: { line: 1, column: 0 }, - source: 'input.js', - original: { line: 1, column: 0 }, -}); - -addMapping(map, { - generated: { line: 1, column: 9 }, - source: 'input.js', - original: { line: 1, column: 9 }, - name: 'foo', -}); - -assert.deepEqual(toDecodedMap(map), { - version: 3, - file: 'output.js', - names: ['foo'], - sourceRoot: 'https://example.com/', - sources: ['input.js'], - sourcesContent: ['function foo() {}'], - mappings: [ - [ [0, 0, 0, 0], [9, 0, 0, 9, 0] ] - ], -}); - -assert.deepEqual(toEncodedMap(map), { - version: 3, - file: 'output.js', - names: ['foo'], - sourceRoot: 'https://example.com/', - sources: ['input.js'], - sourcesContent: ['function foo() {}'], - mappings: 'AAAA,SAASA', -}); -``` - -### Smaller Sourcemaps - -Not everything needs to be added to a sourcemap, and needless markings can cause signficantly -larger file sizes. `gen-mapping` exposes `maybeAddSegment`/`maybeAddMapping` APIs that will -intelligently determine if this marking adds useful information. If not, the marking will be -skipped. - -```typescript -import { maybeAddMapping } from '@jridgewell/gen-mapping'; - -const map = new GenMapping(); - -// Adding a sourceless marking at the beginning of a line isn't useful. -maybeAddMapping(map, { - generated: { line: 1, column: 0 }, -}); - -// Adding a new source marking is useful. -maybeAddMapping(map, { - generated: { line: 1, column: 0 }, - source: 'input.js', - original: { line: 1, column: 0 }, -}); - -// But adding another marking pointing to the exact same original location isn't, even if the -// generated column changed. -maybeAddMapping(map, { - generated: { line: 1, column: 9 }, - source: 'input.js', - original: { line: 1, column: 0 }, -}); - -assert.deepEqual(toEncodedMap(map), { - version: 3, - names: [], - sources: ['input.js'], - sourcesContent: [null], - mappings: 'AAAA', -}); -``` - -## Benchmarks - -``` -node v18.0.0 - -amp.js.map -Memory Usage: -gen-mapping: addSegment 5852872 bytes -gen-mapping: addMapping 7716042 bytes -source-map-js 6143250 bytes -source-map-0.6.1 6124102 bytes -source-map-0.8.0 6121173 bytes -Smallest memory usage is gen-mapping: addSegment - -Adding speed: -gen-mapping: addSegment x 441 ops/sec ±2.07% (90 runs sampled) -gen-mapping: addMapping x 350 ops/sec ±2.40% (86 runs sampled) -source-map-js: addMapping x 169 ops/sec ±2.42% (80 runs sampled) -source-map-0.6.1: addMapping x 167 ops/sec ±2.56% (80 runs sampled) -source-map-0.8.0: addMapping x 168 ops/sec ±2.52% (80 runs sampled) -Fastest is gen-mapping: addSegment - -Generate speed: -gen-mapping: decoded output x 150,824,370 ops/sec ±0.07% (102 runs sampled) -gen-mapping: encoded output x 663 ops/sec ±0.22% (98 runs sampled) -source-map-js: encoded output x 197 ops/sec ±0.45% (84 runs sampled) -source-map-0.6.1: encoded output x 198 ops/sec ±0.33% (85 runs sampled) -source-map-0.8.0: encoded output x 197 ops/sec ±0.06% (93 runs sampled) -Fastest is gen-mapping: decoded output - - -*** - - -babel.min.js.map -Memory Usage: -gen-mapping: addSegment 37578063 bytes -gen-mapping: addMapping 37212897 bytes -source-map-js 47638527 bytes -source-map-0.6.1 47690503 bytes -source-map-0.8.0 47470188 bytes -Smallest memory usage is gen-mapping: addMapping - -Adding speed: -gen-mapping: addSegment x 31.05 ops/sec ±8.31% (43 runs sampled) -gen-mapping: addMapping x 29.83 ops/sec ±7.36% (51 runs sampled) -source-map-js: addMapping x 20.73 ops/sec ±6.22% (38 runs sampled) -source-map-0.6.1: addMapping x 20.03 ops/sec ±10.51% (38 runs sampled) -source-map-0.8.0: addMapping x 19.30 ops/sec ±8.27% (37 runs sampled) -Fastest is gen-mapping: addSegment - -Generate speed: -gen-mapping: decoded output x 381,379,234 ops/sec ±0.29% (96 runs sampled) -gen-mapping: encoded output x 95.15 ops/sec ±2.98% (72 runs sampled) -source-map-js: encoded output x 15.20 ops/sec ±7.41% (33 runs sampled) -source-map-0.6.1: encoded output x 16.36 ops/sec ±10.46% (31 runs sampled) -source-map-0.8.0: encoded output x 16.06 ops/sec ±6.45% (31 runs sampled) -Fastest is gen-mapping: decoded output - - -*** - - -preact.js.map -Memory Usage: -gen-mapping: addSegment 416247 bytes -gen-mapping: addMapping 419824 bytes -source-map-js 1024619 bytes -source-map-0.6.1 1146004 bytes -source-map-0.8.0 1113250 bytes -Smallest memory usage is gen-mapping: addSegment - -Adding speed: -gen-mapping: addSegment x 13,755 ops/sec ±0.15% (98 runs sampled) -gen-mapping: addMapping x 13,013 ops/sec ±0.11% (101 runs sampled) -source-map-js: addMapping x 4,564 ops/sec ±0.21% (98 runs sampled) -source-map-0.6.1: addMapping x 4,562 ops/sec ±0.11% (99 runs sampled) -source-map-0.8.0: addMapping x 4,593 ops/sec ±0.11% (100 runs sampled) -Fastest is gen-mapping: addSegment - -Generate speed: -gen-mapping: decoded output x 379,864,020 ops/sec ±0.23% (93 runs sampled) -gen-mapping: encoded output x 14,368 ops/sec ±4.07% (82 runs sampled) -source-map-js: encoded output x 5,261 ops/sec ±0.21% (99 runs sampled) -source-map-0.6.1: encoded output x 5,124 ops/sec ±0.58% (99 runs sampled) -source-map-0.8.0: encoded output x 5,434 ops/sec ±0.33% (96 runs sampled) -Fastest is gen-mapping: decoded output - - -*** - - -react.js.map -Memory Usage: -gen-mapping: addSegment 975096 bytes -gen-mapping: addMapping 1102981 bytes -source-map-js 2918836 bytes -source-map-0.6.1 2885435 bytes -source-map-0.8.0 2874336 bytes -Smallest memory usage is gen-mapping: addSegment - -Adding speed: -gen-mapping: addSegment x 4,772 ops/sec ±0.15% (100 runs sampled) -gen-mapping: addMapping x 4,456 ops/sec ±0.13% (97 runs sampled) -source-map-js: addMapping x 1,618 ops/sec ±0.24% (97 runs sampled) -source-map-0.6.1: addMapping x 1,622 ops/sec ±0.12% (99 runs sampled) -source-map-0.8.0: addMapping x 1,631 ops/sec ±0.12% (100 runs sampled) -Fastest is gen-mapping: addSegment - -Generate speed: -gen-mapping: decoded output x 379,107,695 ops/sec ±0.07% (99 runs sampled) -gen-mapping: encoded output x 5,421 ops/sec ±1.60% (89 runs sampled) -source-map-js: encoded output x 2,113 ops/sec ±1.81% (98 runs sampled) -source-map-0.6.1: encoded output x 2,126 ops/sec ±0.10% (100 runs sampled) -source-map-0.8.0: encoded output x 2,176 ops/sec ±0.39% (98 runs sampled) -Fastest is gen-mapping: decoded output -``` - -[source-map]: https://www.npmjs.com/package/source-map -[trace-mapping]: https://github.com/jridgewell/trace-mapping diff --git a/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs b/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs deleted file mode 100644 index 5aeb5ccc9..000000000 --- a/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs +++ /dev/null @@ -1,230 +0,0 @@ -import { SetArray, put } from '@jridgewell/set-array'; -import { encode } from '@jridgewell/sourcemap-codec'; -import { TraceMap, decodedMappings } from '@jridgewell/trace-mapping'; - -const COLUMN = 0; -const SOURCES_INDEX = 1; -const SOURCE_LINE = 2; -const SOURCE_COLUMN = 3; -const NAMES_INDEX = 4; - -const NO_NAME = -1; -/** - * A low-level API to associate a generated position with an original source position. Line and - * column here are 0-based, unlike `addMapping`. - */ -let addSegment; -/** - * A high-level API to associate a generated position with an original source position. Line is - * 1-based, but column is 0-based, due to legacy behavior in `source-map` library. - */ -let addMapping; -/** - * Same as `addSegment`, but will only add the segment if it generates useful information in the - * resulting map. This only works correctly if segments are added **in order**, meaning you should - * not add a segment with a lower generated line/column than one that came before. - */ -let maybeAddSegment; -/** - * Same as `addMapping`, but will only add the mapping if it generates useful information in the - * resulting map. This only works correctly if mappings are added **in order**, meaning you should - * not add a mapping with a lower generated line/column than one that came before. - */ -let maybeAddMapping; -/** - * Adds/removes the content of the source file to the source map. - */ -let setSourceContent; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -let toDecodedMap; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -let toEncodedMap; -/** - * Constructs a new GenMapping, using the already present mappings of the input. - */ -let fromMap; -/** - * Returns an array of high-level mapping objects for every recorded segment, which could then be - * passed to the `source-map` library. - */ -let allMappings; -// This split declaration is only so that terser can elminiate the static initialization block. -let addSegmentInternal; -/** - * Provides the state to generate a sourcemap. - */ -class GenMapping { - constructor({ file, sourceRoot } = {}) { - this._names = new SetArray(); - this._sources = new SetArray(); - this._sourcesContent = []; - this._mappings = []; - this.file = file; - this.sourceRoot = sourceRoot; - } -} -(() => { - addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { - return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); - }; - maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { - return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); - }; - addMapping = (map, mapping) => { - return addMappingInternal(false, map, mapping); - }; - maybeAddMapping = (map, mapping) => { - return addMappingInternal(true, map, mapping); - }; - setSourceContent = (map, source, content) => { - const { _sources: sources, _sourcesContent: sourcesContent } = map; - sourcesContent[put(sources, source)] = content; - }; - toDecodedMap = (map) => { - const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map; - removeEmptyFinalLines(mappings); - return { - version: 3, - file: file || undefined, - names: names.array, - sourceRoot: sourceRoot || undefined, - sources: sources.array, - sourcesContent, - mappings, - }; - }; - toEncodedMap = (map) => { - const decoded = toDecodedMap(map); - return Object.assign(Object.assign({}, decoded), { mappings: encode(decoded.mappings) }); - }; - allMappings = (map) => { - const out = []; - const { _mappings: mappings, _sources: sources, _names: names } = map; - for (let i = 0; i < mappings.length; i++) { - const line = mappings[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generated = { line: i + 1, column: seg[COLUMN] }; - let source = undefined; - let original = undefined; - let name = undefined; - if (seg.length !== 1) { - source = sources.array[seg[SOURCES_INDEX]]; - original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] }; - if (seg.length === 5) - name = names.array[seg[NAMES_INDEX]]; - } - out.push({ generated, source, original, name }); - } - } - return out; - }; - fromMap = (input) => { - const map = new TraceMap(input); - const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot }); - putAll(gen._names, map.names); - putAll(gen._sources, map.sources); - gen._sourcesContent = map.sourcesContent || map.sources.map(() => null); - gen._mappings = decodedMappings(map); - return gen; - }; - // Internal helpers - addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { - const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map; - const line = getLine(mappings, genLine); - const index = getColumnIndex(line, genColumn); - if (!source) { - if (skipable && skipSourceless(line, index)) - return; - return insert(line, index, [genColumn]); - } - const sourcesIndex = put(sources, source); - const namesIndex = name ? put(names, name) : NO_NAME; - if (sourcesIndex === sourcesContent.length) - sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null; - if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) { - return; - } - return insert(line, index, name - ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] - : [genColumn, sourcesIndex, sourceLine, sourceColumn]); - }; -})(); -function getLine(mappings, index) { - for (let i = mappings.length; i <= index; i++) { - mappings[i] = []; - } - return mappings[index]; -} -function getColumnIndex(line, genColumn) { - let index = line.length; - for (let i = index - 1; i >= 0; index = i--) { - const current = line[i]; - if (genColumn >= current[COLUMN]) - break; - } - return index; -} -function insert(array, index, value) { - for (let i = array.length; i > index; i--) { - array[i] = array[i - 1]; - } - array[index] = value; -} -function removeEmptyFinalLines(mappings) { - const { length } = mappings; - let len = length; - for (let i = len - 1; i >= 0; len = i, i--) { - if (mappings[i].length > 0) - break; - } - if (len < length) - mappings.length = len; -} -function putAll(strarr, array) { - for (let i = 0; i < array.length; i++) - put(strarr, array[i]); -} -function skipSourceless(line, index) { - // The start of a line is already sourceless, so adding a sourceless segment to the beginning - // doesn't generate any useful information. - if (index === 0) - return true; - const prev = line[index - 1]; - // If the previous segment is also sourceless, then adding another sourceless segment doesn't - // genrate any new information. Else, this segment will end the source/named segment and point to - // a sourceless position, which is useful. - return prev.length === 1; -} -function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) { - // A source/named segment at the start of a line gives position at that genColumn - if (index === 0) - return false; - const prev = line[index - 1]; - // If the previous segment is sourceless, then we're transitioning to a source. - if (prev.length === 1) - return false; - // If the previous segment maps to the exact same source position, then this segment doesn't - // provide any new position information. - return (sourcesIndex === prev[SOURCES_INDEX] && - sourceLine === prev[SOURCE_LINE] && - sourceColumn === prev[SOURCE_COLUMN] && - namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME)); -} -function addMappingInternal(skipable, map, mapping) { - const { generated, source, original, name, content } = mapping; - if (!source) { - return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null); - } - const s = source; - return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content); -} - -export { GenMapping, addMapping, addSegment, allMappings, fromMap, maybeAddMapping, maybeAddSegment, setSourceContent, toDecodedMap, toEncodedMap }; -//# sourceMappingURL=gen-mapping.mjs.map diff --git a/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs.map b/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs.map deleted file mode 100644 index 2fee0cd4e..000000000 --- a/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gen-mapping.mjs","sources":["../src/sourcemap-segment.ts","../src/gen-mapping.ts"],"sourcesContent":["type GeneratedColumn = number;\ntype SourcesIndex = number;\ntype SourceLine = number;\ntype SourceColumn = number;\ntype NamesIndex = number;\n\nexport type SourceMapSegment =\n | [GeneratedColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];\n\nexport const COLUMN = 0;\nexport const SOURCES_INDEX = 1;\nexport const SOURCE_LINE = 2;\nexport const SOURCE_COLUMN = 3;\nexport const NAMES_INDEX = 4;\n","import { SetArray, put } from '@jridgewell/set-array';\nimport { encode } from '@jridgewell/sourcemap-codec';\nimport { TraceMap, decodedMappings } from '@jridgewell/trace-mapping';\n\nimport {\n COLUMN,\n SOURCES_INDEX,\n SOURCE_LINE,\n SOURCE_COLUMN,\n NAMES_INDEX,\n} from './sourcemap-segment';\n\nimport type { SourceMapInput } from '@jridgewell/trace-mapping';\nimport type { SourceMapSegment } from './sourcemap-segment';\nimport type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types';\n\nexport type { DecodedSourceMap, EncodedSourceMap, Mapping };\n\nexport type Options = {\n file?: string | null;\n sourceRoot?: string | null;\n};\n\nconst NO_NAME = -1;\n\n/**\n * A low-level API to associate a generated position with an original source position. Line and\n * column here are 0-based, unlike `addMapping`.\n */\nexport let addSegment: {\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source?: null,\n sourceLine?: null,\n sourceColumn?: null,\n name?: null,\n content?: null,\n ): void;\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: string,\n sourceLine: number,\n sourceColumn: number,\n name?: null,\n content?: string | null,\n ): void;\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: string,\n sourceLine: number,\n sourceColumn: number,\n name: string,\n content?: string | null,\n ): void;\n};\n\n/**\n * A high-level API to associate a generated position with an original source position. Line is\n * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.\n */\nexport let addMapping: {\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source?: null;\n original?: null;\n name?: null;\n content?: null;\n },\n ): void;\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: string;\n original: Pos;\n name?: null;\n content?: string | null;\n },\n ): void;\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: string;\n original: Pos;\n name: string;\n content?: string | null;\n },\n ): void;\n};\n\n/**\n * Same as `addSegment`, but will only add the segment if it generates useful information in the\n * resulting map. This only works correctly if segments are added **in order**, meaning you should\n * not add a segment with a lower generated line/column than one that came before.\n */\nexport let maybeAddSegment: typeof addSegment;\n\n/**\n * Same as `addMapping`, but will only add the mapping if it generates useful information in the\n * resulting map. This only works correctly if mappings are added **in order**, meaning you should\n * not add a mapping with a lower generated line/column than one that came before.\n */\nexport let maybeAddMapping: typeof addMapping;\n\n/**\n * Adds/removes the content of the source file to the source map.\n */\nexport let setSourceContent: (map: GenMapping, source: string, content: string | null) => void;\n\n/**\n * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let toDecodedMap: (map: GenMapping) => DecodedSourceMap;\n\n/**\n * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let toEncodedMap: (map: GenMapping) => EncodedSourceMap;\n\n/**\n * Constructs a new GenMapping, using the already present mappings of the input.\n */\nexport let fromMap: (input: SourceMapInput) => GenMapping;\n\n/**\n * Returns an array of high-level mapping objects for every recorded segment, which could then be\n * passed to the `source-map` library.\n */\nexport let allMappings: (map: GenMapping) => Mapping[];\n\n// This split declaration is only so that terser can elminiate the static initialization block.\nlet addSegmentInternal: (\n skipable: boolean,\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: S,\n sourceLine: S extends string ? number : null | undefined,\n sourceColumn: S extends string ? number : null | undefined,\n name: S extends string ? string | null | undefined : null | undefined,\n content: S extends string ? string | null | undefined : null | undefined,\n) => void;\n\n/**\n * Provides the state to generate a sourcemap.\n */\nexport class GenMapping {\n private _names = new SetArray();\n private _sources = new SetArray();\n private _sourcesContent: (string | null)[] = [];\n private _mappings: SourceMapSegment[][] = [];\n declare file: string | null | undefined;\n declare sourceRoot: string | null | undefined;\n\n constructor({ file, sourceRoot }: Options = {}) {\n this.file = file;\n this.sourceRoot = sourceRoot;\n }\n\n static {\n addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {\n return addSegmentInternal(\n false,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n );\n };\n\n maybeAddSegment = (\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n ) => {\n return addSegmentInternal(\n true,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n );\n };\n\n addMapping = (map, mapping) => {\n return addMappingInternal(false, map, mapping as Parameters[2]);\n };\n\n maybeAddMapping = (map, mapping) => {\n return addMappingInternal(true, map, mapping as Parameters[2]);\n };\n\n setSourceContent = (map, source, content) => {\n const { _sources: sources, _sourcesContent: sourcesContent } = map;\n sourcesContent[put(sources, source)] = content;\n };\n\n toDecodedMap = (map) => {\n const {\n file,\n sourceRoot,\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names,\n } = map;\n removeEmptyFinalLines(mappings);\n\n return {\n version: 3,\n file: file || undefined,\n names: names.array,\n sourceRoot: sourceRoot || undefined,\n sources: sources.array,\n sourcesContent,\n mappings,\n };\n };\n\n toEncodedMap = (map) => {\n const decoded = toDecodedMap(map);\n return {\n ...decoded,\n mappings: encode(decoded.mappings as SourceMapSegment[][]),\n };\n };\n\n allMappings = (map) => {\n const out: Mapping[] = [];\n const { _mappings: mappings, _sources: sources, _names: names } = map;\n\n for (let i = 0; i < mappings.length; i++) {\n const line = mappings[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n\n const generated = { line: i + 1, column: seg[COLUMN] };\n let source: string | undefined = undefined;\n let original: Pos | undefined = undefined;\n let name: string | undefined = undefined;\n\n if (seg.length !== 1) {\n source = sources.array[seg[SOURCES_INDEX]];\n original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };\n\n if (seg.length === 5) name = names.array[seg[NAMES_INDEX]];\n }\n\n out.push({ generated, source, original, name } as Mapping);\n }\n }\n\n return out;\n };\n\n fromMap = (input) => {\n const map = new TraceMap(input);\n const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });\n\n putAll(gen._names, map.names);\n putAll(gen._sources, map.sources as string[]);\n gen._sourcesContent = map.sourcesContent || map.sources.map(() => null);\n gen._mappings = decodedMappings(map) as GenMapping['_mappings'];\n\n return gen;\n };\n\n // Internal helpers\n addSegmentInternal = (\n skipable,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n ) => {\n const {\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names,\n } = map;\n const line = getLine(mappings, genLine);\n const index = getColumnIndex(line, genColumn);\n\n if (!source) {\n if (skipable && skipSourceless(line, index)) return;\n return insert(line, index, [genColumn]);\n }\n\n // Sigh, TypeScript can't figure out sourceLine and sourceColumn aren't nullish if source\n // isn't nullish.\n assert(sourceLine);\n assert(sourceColumn);\n\n const sourcesIndex = put(sources, source);\n const namesIndex = name ? put(names, name) : NO_NAME;\n if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content ?? null;\n\n if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {\n return;\n }\n\n return insert(\n line,\n index,\n name\n ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]\n : [genColumn, sourcesIndex, sourceLine, sourceColumn],\n );\n };\n }\n}\n\nfunction assert(_val: unknown): asserts _val is T {\n // noop.\n}\n\nfunction getLine(mappings: SourceMapSegment[][], index: number): SourceMapSegment[] {\n for (let i = mappings.length; i <= index; i++) {\n mappings[i] = [];\n }\n return mappings[index];\n}\n\nfunction getColumnIndex(line: SourceMapSegment[], genColumn: number): number {\n let index = line.length;\n for (let i = index - 1; i >= 0; index = i--) {\n const current = line[i];\n if (genColumn >= current[COLUMN]) break;\n }\n return index;\n}\n\nfunction insert(array: T[], index: number, value: T) {\n for (let i = array.length; i > index; i--) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n}\n\nfunction removeEmptyFinalLines(mappings: SourceMapSegment[][]) {\n const { length } = mappings;\n let len = length;\n for (let i = len - 1; i >= 0; len = i, i--) {\n if (mappings[i].length > 0) break;\n }\n if (len < length) mappings.length = len;\n}\n\nfunction putAll(strarr: SetArray, array: string[]) {\n for (let i = 0; i < array.length; i++) put(strarr, array[i]);\n}\n\nfunction skipSourceless(line: SourceMapSegment[], index: number): boolean {\n // The start of a line is already sourceless, so adding a sourceless segment to the beginning\n // doesn't generate any useful information.\n if (index === 0) return true;\n\n const prev = line[index - 1];\n // If the previous segment is also sourceless, then adding another sourceless segment doesn't\n // genrate any new information. Else, this segment will end the source/named segment and point to\n // a sourceless position, which is useful.\n return prev.length === 1;\n}\n\nfunction skipSource(\n line: SourceMapSegment[],\n index: number,\n sourcesIndex: number,\n sourceLine: number,\n sourceColumn: number,\n namesIndex: number,\n): boolean {\n // A source/named segment at the start of a line gives position at that genColumn\n if (index === 0) return false;\n\n const prev = line[index - 1];\n\n // If the previous segment is sourceless, then we're transitioning to a source.\n if (prev.length === 1) return false;\n\n // If the previous segment maps to the exact same source position, then this segment doesn't\n // provide any new position information.\n return (\n sourcesIndex === prev[SOURCES_INDEX] &&\n sourceLine === prev[SOURCE_LINE] &&\n sourceColumn === prev[SOURCE_COLUMN] &&\n namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME)\n );\n}\n\nfunction addMappingInternal(\n skipable: boolean,\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: S;\n original: S extends string ? Pos : null | undefined;\n name: S extends string ? string | null | undefined : null | undefined;\n content: S extends string ? string | null | undefined : null | undefined;\n },\n) {\n const { generated, source, original, name, content } = mapping;\n if (!source) {\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n null,\n null,\n null,\n null,\n null,\n );\n }\n const s: string = source;\n assert(original);\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n s,\n original.line - 1,\n original.column,\n name,\n content,\n );\n}\n"],"names":[],"mappings":";;;;AAWO,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,WAAW,GAAG,CAAC;;ACQ5B,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC;AAEnB;;;AAGG;AACQ,IAAA,WA+BT;AAEF;;;AAGG;AACQ,IAAA,WA+BT;AAEF;;;;AAIG;AACQ,IAAA,gBAAmC;AAE9C;;;;AAIG;AACQ,IAAA,gBAAmC;AAE9C;;AAEG;AACQ,IAAA,iBAAoF;AAE/F;;;AAGG;AACQ,IAAA,aAAoD;AAE/D;;;AAGG;AACQ,IAAA,aAAoD;AAE/D;;AAEG;AACQ,IAAA,QAA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EACH,SAAS,CAAC,IAAI,GAAG,CAAC,EAClB,SAAS,CAAC,MAAM,EAChB,CAAC,EACD,QAAQ,CAAC,IAAI,GAAG,CAAC,EACjB,QAAQ,CAAC,MAAM,EACf,IAAI,EACJ,OAAO,CACR,CAAC;AACJ;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js b/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js deleted file mode 100644 index d9fcf5cff..000000000 --- a/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js +++ /dev/null @@ -1,236 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/set-array'), require('@jridgewell/sourcemap-codec'), require('@jridgewell/trace-mapping')) : - typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/set-array', '@jridgewell/sourcemap-codec', '@jridgewell/trace-mapping'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.genMapping = {}, global.setArray, global.sourcemapCodec, global.traceMapping)); -})(this, (function (exports, setArray, sourcemapCodec, traceMapping) { 'use strict'; - - const COLUMN = 0; - const SOURCES_INDEX = 1; - const SOURCE_LINE = 2; - const SOURCE_COLUMN = 3; - const NAMES_INDEX = 4; - - const NO_NAME = -1; - /** - * A low-level API to associate a generated position with an original source position. Line and - * column here are 0-based, unlike `addMapping`. - */ - exports.addSegment = void 0; - /** - * A high-level API to associate a generated position with an original source position. Line is - * 1-based, but column is 0-based, due to legacy behavior in `source-map` library. - */ - exports.addMapping = void 0; - /** - * Same as `addSegment`, but will only add the segment if it generates useful information in the - * resulting map. This only works correctly if segments are added **in order**, meaning you should - * not add a segment with a lower generated line/column than one that came before. - */ - exports.maybeAddSegment = void 0; - /** - * Same as `addMapping`, but will only add the mapping if it generates useful information in the - * resulting map. This only works correctly if mappings are added **in order**, meaning you should - * not add a mapping with a lower generated line/column than one that came before. - */ - exports.maybeAddMapping = void 0; - /** - * Adds/removes the content of the source file to the source map. - */ - exports.setSourceContent = void 0; - /** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ - exports.toDecodedMap = void 0; - /** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ - exports.toEncodedMap = void 0; - /** - * Constructs a new GenMapping, using the already present mappings of the input. - */ - exports.fromMap = void 0; - /** - * Returns an array of high-level mapping objects for every recorded segment, which could then be - * passed to the `source-map` library. - */ - exports.allMappings = void 0; - // This split declaration is only so that terser can elminiate the static initialization block. - let addSegmentInternal; - /** - * Provides the state to generate a sourcemap. - */ - class GenMapping { - constructor({ file, sourceRoot } = {}) { - this._names = new setArray.SetArray(); - this._sources = new setArray.SetArray(); - this._sourcesContent = []; - this._mappings = []; - this.file = file; - this.sourceRoot = sourceRoot; - } - } - (() => { - exports.addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { - return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); - }; - exports.maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { - return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); - }; - exports.addMapping = (map, mapping) => { - return addMappingInternal(false, map, mapping); - }; - exports.maybeAddMapping = (map, mapping) => { - return addMappingInternal(true, map, mapping); - }; - exports.setSourceContent = (map, source, content) => { - const { _sources: sources, _sourcesContent: sourcesContent } = map; - sourcesContent[setArray.put(sources, source)] = content; - }; - exports.toDecodedMap = (map) => { - const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map; - removeEmptyFinalLines(mappings); - return { - version: 3, - file: file || undefined, - names: names.array, - sourceRoot: sourceRoot || undefined, - sources: sources.array, - sourcesContent, - mappings, - }; - }; - exports.toEncodedMap = (map) => { - const decoded = exports.toDecodedMap(map); - return Object.assign(Object.assign({}, decoded), { mappings: sourcemapCodec.encode(decoded.mappings) }); - }; - exports.allMappings = (map) => { - const out = []; - const { _mappings: mappings, _sources: sources, _names: names } = map; - for (let i = 0; i < mappings.length; i++) { - const line = mappings[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generated = { line: i + 1, column: seg[COLUMN] }; - let source = undefined; - let original = undefined; - let name = undefined; - if (seg.length !== 1) { - source = sources.array[seg[SOURCES_INDEX]]; - original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] }; - if (seg.length === 5) - name = names.array[seg[NAMES_INDEX]]; - } - out.push({ generated, source, original, name }); - } - } - return out; - }; - exports.fromMap = (input) => { - const map = new traceMapping.TraceMap(input); - const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot }); - putAll(gen._names, map.names); - putAll(gen._sources, map.sources); - gen._sourcesContent = map.sourcesContent || map.sources.map(() => null); - gen._mappings = traceMapping.decodedMappings(map); - return gen; - }; - // Internal helpers - addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { - const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map; - const line = getLine(mappings, genLine); - const index = getColumnIndex(line, genColumn); - if (!source) { - if (skipable && skipSourceless(line, index)) - return; - return insert(line, index, [genColumn]); - } - const sourcesIndex = setArray.put(sources, source); - const namesIndex = name ? setArray.put(names, name) : NO_NAME; - if (sourcesIndex === sourcesContent.length) - sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null; - if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) { - return; - } - return insert(line, index, name - ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] - : [genColumn, sourcesIndex, sourceLine, sourceColumn]); - }; - })(); - function getLine(mappings, index) { - for (let i = mappings.length; i <= index; i++) { - mappings[i] = []; - } - return mappings[index]; - } - function getColumnIndex(line, genColumn) { - let index = line.length; - for (let i = index - 1; i >= 0; index = i--) { - const current = line[i]; - if (genColumn >= current[COLUMN]) - break; - } - return index; - } - function insert(array, index, value) { - for (let i = array.length; i > index; i--) { - array[i] = array[i - 1]; - } - array[index] = value; - } - function removeEmptyFinalLines(mappings) { - const { length } = mappings; - let len = length; - for (let i = len - 1; i >= 0; len = i, i--) { - if (mappings[i].length > 0) - break; - } - if (len < length) - mappings.length = len; - } - function putAll(strarr, array) { - for (let i = 0; i < array.length; i++) - setArray.put(strarr, array[i]); - } - function skipSourceless(line, index) { - // The start of a line is already sourceless, so adding a sourceless segment to the beginning - // doesn't generate any useful information. - if (index === 0) - return true; - const prev = line[index - 1]; - // If the previous segment is also sourceless, then adding another sourceless segment doesn't - // genrate any new information. Else, this segment will end the source/named segment and point to - // a sourceless position, which is useful. - return prev.length === 1; - } - function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) { - // A source/named segment at the start of a line gives position at that genColumn - if (index === 0) - return false; - const prev = line[index - 1]; - // If the previous segment is sourceless, then we're transitioning to a source. - if (prev.length === 1) - return false; - // If the previous segment maps to the exact same source position, then this segment doesn't - // provide any new position information. - return (sourcesIndex === prev[SOURCES_INDEX] && - sourceLine === prev[SOURCE_LINE] && - sourceColumn === prev[SOURCE_COLUMN] && - namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME)); - } - function addMappingInternal(skipable, map, mapping) { - const { generated, source, original, name, content } = mapping; - if (!source) { - return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null); - } - const s = source; - return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content); - } - - exports.GenMapping = GenMapping; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); -//# sourceMappingURL=gen-mapping.umd.js.map diff --git a/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js.map b/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js.map deleted file mode 100644 index 7cc8d149d..000000000 --- a/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gen-mapping.umd.js","sources":["../src/sourcemap-segment.ts","../src/gen-mapping.ts"],"sourcesContent":["type GeneratedColumn = number;\ntype SourcesIndex = number;\ntype SourceLine = number;\ntype SourceColumn = number;\ntype NamesIndex = number;\n\nexport type SourceMapSegment =\n | [GeneratedColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];\n\nexport const COLUMN = 0;\nexport const SOURCES_INDEX = 1;\nexport const SOURCE_LINE = 2;\nexport const SOURCE_COLUMN = 3;\nexport const NAMES_INDEX = 4;\n","import { SetArray, put } from '@jridgewell/set-array';\nimport { encode } from '@jridgewell/sourcemap-codec';\nimport { TraceMap, decodedMappings } from '@jridgewell/trace-mapping';\n\nimport {\n COLUMN,\n SOURCES_INDEX,\n SOURCE_LINE,\n SOURCE_COLUMN,\n NAMES_INDEX,\n} from './sourcemap-segment';\n\nimport type { SourceMapInput } from '@jridgewell/trace-mapping';\nimport type { SourceMapSegment } from './sourcemap-segment';\nimport type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types';\n\nexport type { DecodedSourceMap, EncodedSourceMap, Mapping };\n\nexport type Options = {\n file?: string | null;\n sourceRoot?: string | null;\n};\n\nconst NO_NAME = -1;\n\n/**\n * A low-level API to associate a generated position with an original source position. Line and\n * column here are 0-based, unlike `addMapping`.\n */\nexport let addSegment: {\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source?: null,\n sourceLine?: null,\n sourceColumn?: null,\n name?: null,\n content?: null,\n ): void;\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: string,\n sourceLine: number,\n sourceColumn: number,\n name?: null,\n content?: string | null,\n ): void;\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: string,\n sourceLine: number,\n sourceColumn: number,\n name: string,\n content?: string | null,\n ): void;\n};\n\n/**\n * A high-level API to associate a generated position with an original source position. Line is\n * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.\n */\nexport let addMapping: {\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source?: null;\n original?: null;\n name?: null;\n content?: null;\n },\n ): void;\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: string;\n original: Pos;\n name?: null;\n content?: string | null;\n },\n ): void;\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: string;\n original: Pos;\n name: string;\n content?: string | null;\n },\n ): void;\n};\n\n/**\n * Same as `addSegment`, but will only add the segment if it generates useful information in the\n * resulting map. This only works correctly if segments are added **in order**, meaning you should\n * not add a segment with a lower generated line/column than one that came before.\n */\nexport let maybeAddSegment: typeof addSegment;\n\n/**\n * Same as `addMapping`, but will only add the mapping if it generates useful information in the\n * resulting map. This only works correctly if mappings are added **in order**, meaning you should\n * not add a mapping with a lower generated line/column than one that came before.\n */\nexport let maybeAddMapping: typeof addMapping;\n\n/**\n * Adds/removes the content of the source file to the source map.\n */\nexport let setSourceContent: (map: GenMapping, source: string, content: string | null) => void;\n\n/**\n * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let toDecodedMap: (map: GenMapping) => DecodedSourceMap;\n\n/**\n * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let toEncodedMap: (map: GenMapping) => EncodedSourceMap;\n\n/**\n * Constructs a new GenMapping, using the already present mappings of the input.\n */\nexport let fromMap: (input: SourceMapInput) => GenMapping;\n\n/**\n * Returns an array of high-level mapping objects for every recorded segment, which could then be\n * passed to the `source-map` library.\n */\nexport let allMappings: (map: GenMapping) => Mapping[];\n\n// This split declaration is only so that terser can elminiate the static initialization block.\nlet addSegmentInternal: (\n skipable: boolean,\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: S,\n sourceLine: S extends string ? number : null | undefined,\n sourceColumn: S extends string ? number : null | undefined,\n name: S extends string ? string | null | undefined : null | undefined,\n content: S extends string ? string | null | undefined : null | undefined,\n) => void;\n\n/**\n * Provides the state to generate a sourcemap.\n */\nexport class GenMapping {\n private _names = new SetArray();\n private _sources = new SetArray();\n private _sourcesContent: (string | null)[] = [];\n private _mappings: SourceMapSegment[][] = [];\n declare file: string | null | undefined;\n declare sourceRoot: string | null | undefined;\n\n constructor({ file, sourceRoot }: Options = {}) {\n this.file = file;\n this.sourceRoot = sourceRoot;\n }\n\n static {\n addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {\n return addSegmentInternal(\n false,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n );\n };\n\n maybeAddSegment = (\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n ) => {\n return addSegmentInternal(\n true,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n );\n };\n\n addMapping = (map, mapping) => {\n return addMappingInternal(false, map, mapping as Parameters[2]);\n };\n\n maybeAddMapping = (map, mapping) => {\n return addMappingInternal(true, map, mapping as Parameters[2]);\n };\n\n setSourceContent = (map, source, content) => {\n const { _sources: sources, _sourcesContent: sourcesContent } = map;\n sourcesContent[put(sources, source)] = content;\n };\n\n toDecodedMap = (map) => {\n const {\n file,\n sourceRoot,\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names,\n } = map;\n removeEmptyFinalLines(mappings);\n\n return {\n version: 3,\n file: file || undefined,\n names: names.array,\n sourceRoot: sourceRoot || undefined,\n sources: sources.array,\n sourcesContent,\n mappings,\n };\n };\n\n toEncodedMap = (map) => {\n const decoded = toDecodedMap(map);\n return {\n ...decoded,\n mappings: encode(decoded.mappings as SourceMapSegment[][]),\n };\n };\n\n allMappings = (map) => {\n const out: Mapping[] = [];\n const { _mappings: mappings, _sources: sources, _names: names } = map;\n\n for (let i = 0; i < mappings.length; i++) {\n const line = mappings[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n\n const generated = { line: i + 1, column: seg[COLUMN] };\n let source: string | undefined = undefined;\n let original: Pos | undefined = undefined;\n let name: string | undefined = undefined;\n\n if (seg.length !== 1) {\n source = sources.array[seg[SOURCES_INDEX]];\n original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };\n\n if (seg.length === 5) name = names.array[seg[NAMES_INDEX]];\n }\n\n out.push({ generated, source, original, name } as Mapping);\n }\n }\n\n return out;\n };\n\n fromMap = (input) => {\n const map = new TraceMap(input);\n const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });\n\n putAll(gen._names, map.names);\n putAll(gen._sources, map.sources as string[]);\n gen._sourcesContent = map.sourcesContent || map.sources.map(() => null);\n gen._mappings = decodedMappings(map) as GenMapping['_mappings'];\n\n return gen;\n };\n\n // Internal helpers\n addSegmentInternal = (\n skipable,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n ) => {\n const {\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names,\n } = map;\n const line = getLine(mappings, genLine);\n const index = getColumnIndex(line, genColumn);\n\n if (!source) {\n if (skipable && skipSourceless(line, index)) return;\n return insert(line, index, [genColumn]);\n }\n\n // Sigh, TypeScript can't figure out sourceLine and sourceColumn aren't nullish if source\n // isn't nullish.\n assert(sourceLine);\n assert(sourceColumn);\n\n const sourcesIndex = put(sources, source);\n const namesIndex = name ? put(names, name) : NO_NAME;\n if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content ?? null;\n\n if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {\n return;\n }\n\n return insert(\n line,\n index,\n name\n ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]\n : [genColumn, sourcesIndex, sourceLine, sourceColumn],\n );\n };\n }\n}\n\nfunction assert(_val: unknown): asserts _val is T {\n // noop.\n}\n\nfunction getLine(mappings: SourceMapSegment[][], index: number): SourceMapSegment[] {\n for (let i = mappings.length; i <= index; i++) {\n mappings[i] = [];\n }\n return mappings[index];\n}\n\nfunction getColumnIndex(line: SourceMapSegment[], genColumn: number): number {\n let index = line.length;\n for (let i = index - 1; i >= 0; index = i--) {\n const current = line[i];\n if (genColumn >= current[COLUMN]) break;\n }\n return index;\n}\n\nfunction insert(array: T[], index: number, value: T) {\n for (let i = array.length; i > index; i--) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n}\n\nfunction removeEmptyFinalLines(mappings: SourceMapSegment[][]) {\n const { length } = mappings;\n let len = length;\n for (let i = len - 1; i >= 0; len = i, i--) {\n if (mappings[i].length > 0) break;\n }\n if (len < length) mappings.length = len;\n}\n\nfunction putAll(strarr: SetArray, array: string[]) {\n for (let i = 0; i < array.length; i++) put(strarr, array[i]);\n}\n\nfunction skipSourceless(line: SourceMapSegment[], index: number): boolean {\n // The start of a line is already sourceless, so adding a sourceless segment to the beginning\n // doesn't generate any useful information.\n if (index === 0) return true;\n\n const prev = line[index - 1];\n // If the previous segment is also sourceless, then adding another sourceless segment doesn't\n // genrate any new information. Else, this segment will end the source/named segment and point to\n // a sourceless position, which is useful.\n return prev.length === 1;\n}\n\nfunction skipSource(\n line: SourceMapSegment[],\n index: number,\n sourcesIndex: number,\n sourceLine: number,\n sourceColumn: number,\n namesIndex: number,\n): boolean {\n // A source/named segment at the start of a line gives position at that genColumn\n if (index === 0) return false;\n\n const prev = line[index - 1];\n\n // If the previous segment is sourceless, then we're transitioning to a source.\n if (prev.length === 1) return false;\n\n // If the previous segment maps to the exact same source position, then this segment doesn't\n // provide any new position information.\n return (\n sourcesIndex === prev[SOURCES_INDEX] &&\n sourceLine === prev[SOURCE_LINE] &&\n sourceColumn === prev[SOURCE_COLUMN] &&\n namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME)\n );\n}\n\nfunction addMappingInternal(\n skipable: boolean,\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: S;\n original: S extends string ? Pos : null | undefined;\n name: S extends string ? string | null | undefined : null | undefined;\n content: S extends string ? string | null | undefined : null | undefined;\n },\n) {\n const { generated, source, original, name, content } = mapping;\n if (!source) {\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n null,\n null,\n null,\n null,\n null,\n );\n }\n const s: string = source;\n assert(original);\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n s,\n original.line - 1,\n original.column,\n name,\n content,\n );\n}\n"],"names":["addSegment","addMapping","maybeAddSegment","maybeAddMapping","setSourceContent","toDecodedMap","toEncodedMap","fromMap","allMappings","SetArray","put","encode","TraceMap","decodedMappings"],"mappings":";;;;;;IAWO,MAAM,MAAM,GAAG,CAAC,CAAC;IACjB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC;IACtB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC;;ICQ5B,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC;IAEnB;;;IAGG;AACQA,gCA+BT;IAEF;;;IAGG;AACQC,gCA+BT;IAEF;;;;IAIG;AACQC,qCAAmC;IAE9C;;;;IAIG;AACQC,qCAAmC;IAE9C;;IAEG;AACQC,sCAAoF;IAE/F;;;IAGG;AACQC,kCAAoD;IAE/D;;;IAGG;AACQC,kCAAoD;IAE/D;;IAEG;AACQC,6BAA+C;IAE1D;;;IAGG;AACQC,iCAA4C;IAEvD;IACA,IAAI,kBAUK,CAAC;IAEV;;IAEG;UACU,UAAU,CAAA;IAQrB,IAAA,WAAA,CAAY,EAAE,IAAI,EAAE,UAAU,KAAc,EAAE,EAAA;IAPtC,QAAA,IAAA,CAAA,MAAM,GAAG,IAAIC,iBAAQ,EAAE,CAAC;IACxB,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAIA,iBAAQ,EAAE,CAAC;YAC1B,IAAe,CAAA,eAAA,GAAsB,EAAE,CAAC;YACxC,IAAS,CAAA,SAAA,GAAyB,EAAE,CAAC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A,OAAO,KAAK,CAAC;QAE9B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;;IAG7B,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;IAAE,QAAA,OAAO,KAAK,CAAC;;;IAIpC,IAAA,QACE,YAAY,KAAK,IAAI,CAAC,aAAa,CAAC;IACpC,QAAA,UAAU,KAAK,IAAI,CAAC,WAAW,CAAC;IAChC,QAAA,YAAY,KAAK,IAAI,CAAC,aAAa,CAAC;YACpC,UAAU,MAAM,IAAI,CAAC,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,EAChE;IACJ,CAAC;IAED,SAAS,kBAAkB,CACzB,QAAiB,EACjB,GAAe,EACf,OAMC,EAAA;IAED,IAAA,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAC/D,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,kBAAkB,CACvB,QAAQ,EACR,GAAG,EACH,SAAS,CAAC,IAAI,GAAG,CAAC,EAClB,SAAS,CAAC,MAAM,EAChB,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,CACL,CAAC;IACH,KAAA;QACD,MAAM,CAAC,GAAW,MAAM,CAAC;IAEzB,IAAA,OAAO,kBAAkB,CACvB,QAAQ,EACR,GAAG,EACH,SAAS,CAAC,IAAI,GAAG,CAAC,EAClB,SAAS,CAAC,MAAM,EAChB,CAAC,EACD,QAAQ,CAAC,IAAI,GAAG,CAAC,EACjB,QAAQ,CAAC,MAAM,EACf,IAAI,EACJ,OAAO,CACR,CAAC;IACJ;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts b/node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts deleted file mode 100644 index d510d74bb..000000000 --- a/node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -import type { SourceMapInput } from '@jridgewell/trace-mapping'; -import type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types'; -export type { DecodedSourceMap, EncodedSourceMap, Mapping }; -export declare type Options = { - file?: string | null; - sourceRoot?: string | null; -}; -/** - * A low-level API to associate a generated position with an original source position. Line and - * column here are 0-based, unlike `addMapping`. - */ -export declare let addSegment: { - (map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null, content?: null): void; - (map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name?: null, content?: string | null): void; - (map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name: string, content?: string | null): void; -}; -/** - * A high-level API to associate a generated position with an original source position. Line is - * 1-based, but column is 0-based, due to legacy behavior in `source-map` library. - */ -export declare let addMapping: { - (map: GenMapping, mapping: { - generated: Pos; - source?: null; - original?: null; - name?: null; - content?: null; - }): void; - (map: GenMapping, mapping: { - generated: Pos; - source: string; - original: Pos; - name?: null; - content?: string | null; - }): void; - (map: GenMapping, mapping: { - generated: Pos; - source: string; - original: Pos; - name: string; - content?: string | null; - }): void; -}; -/** - * Same as `addSegment`, but will only add the segment if it generates useful information in the - * resulting map. This only works correctly if segments are added **in order**, meaning you should - * not add a segment with a lower generated line/column than one that came before. - */ -export declare let maybeAddSegment: typeof addSegment; -/** - * Same as `addMapping`, but will only add the mapping if it generates useful information in the - * resulting map. This only works correctly if mappings are added **in order**, meaning you should - * not add a mapping with a lower generated line/column than one that came before. - */ -export declare let maybeAddMapping: typeof addMapping; -/** - * Adds/removes the content of the source file to the source map. - */ -export declare let setSourceContent: (map: GenMapping, source: string, content: string | null) => void; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare let toDecodedMap: (map: GenMapping) => DecodedSourceMap; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare let toEncodedMap: (map: GenMapping) => EncodedSourceMap; -/** - * Constructs a new GenMapping, using the already present mappings of the input. - */ -export declare let fromMap: (input: SourceMapInput) => GenMapping; -/** - * Returns an array of high-level mapping objects for every recorded segment, which could then be - * passed to the `source-map` library. - */ -export declare let allMappings: (map: GenMapping) => Mapping[]; -/** - * Provides the state to generate a sourcemap. - */ -export declare class GenMapping { - private _names; - private _sources; - private _sourcesContent; - private _mappings; - file: string | null | undefined; - sourceRoot: string | null | undefined; - constructor({ file, sourceRoot }?: Options); -} diff --git a/node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts b/node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts deleted file mode 100644 index e187ba98a..000000000 --- a/node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare type GeneratedColumn = number; -declare type SourcesIndex = number; -declare type SourceLine = number; -declare type SourceColumn = number; -declare type NamesIndex = number; -export declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; -export declare const COLUMN = 0; -export declare const SOURCES_INDEX = 1; -export declare const SOURCE_LINE = 2; -export declare const SOURCE_COLUMN = 3; -export declare const NAMES_INDEX = 4; -export {}; diff --git a/node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts b/node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts deleted file mode 100644 index b309c8111..000000000 --- a/node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment'; -export interface SourceMapV3 { - file?: string | null; - names: readonly string[]; - sourceRoot?: string; - sources: readonly (string | null)[]; - sourcesContent?: readonly (string | null)[]; - version: 3; -} -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; -} -export interface DecodedSourceMap extends SourceMapV3 { - mappings: readonly SourceMapSegment[][]; -} -export interface Pos { - line: number; - column: number; -} -export declare type Mapping = { - generated: Pos; - source: undefined; - original: undefined; - name: undefined; -} | { - generated: Pos; - source: string; - original: Pos; - name: string; -} | { - generated: Pos; - source: string; - original: Pos; - name: undefined; -}; diff --git a/node_modules/@jridgewell/gen-mapping/package.json b/node_modules/@jridgewell/gen-mapping/package.json deleted file mode 100644 index 69e0ac812..000000000 --- a/node_modules/@jridgewell/gen-mapping/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "@jridgewell/gen-mapping", - "version": "0.3.3", - "description": "Generate source maps", - "keywords": [ - "source", - "map" - ], - "author": "Justin Ridgewell ", - "license": "MIT", - "repository": "https://github.com/jridgewell/gen-mapping", - "main": "dist/gen-mapping.umd.js", - "module": "dist/gen-mapping.mjs", - "types": "dist/types/gen-mapping.d.ts", - "exports": { - ".": [ - { - "types": "./dist/types/gen-mapping.d.ts", - "browser": "./dist/gen-mapping.umd.js", - "require": "./dist/gen-mapping.umd.js", - "import": "./dist/gen-mapping.mjs" - }, - "./dist/gen-mapping.umd.js" - ], - "./package.json": "./package.json" - }, - "files": [ - "dist" - ], - "engines": { - "node": ">=6.0.0" - }, - "scripts": { - "benchmark": "run-s build:rollup benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node benchmark/index.mjs", - "prebuild": "rm -rf dist", - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "pretest": "run-s build:rollup", - "test": "run-s -n test:lint test:coverage", - "test:debug": "mocha --inspect-brk", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:coverage": "c8 mocha", - "test:watch": "run-p 'build:rollup -- --watch' 'test:only -- --watch'", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build" - }, - "devDependencies": { - "@rollup/plugin-typescript": "8.3.2", - "@types/mocha": "9.1.1", - "@types/node": "17.0.29", - "@typescript-eslint/eslint-plugin": "5.21.0", - "@typescript-eslint/parser": "5.21.0", - "benchmark": "2.1.4", - "c8": "7.11.2", - "eslint": "8.14.0", - "eslint-config-prettier": "8.5.0", - "mocha": "9.2.2", - "npm-run-all": "4.1.5", - "prettier": "2.6.2", - "rollup": "2.70.2", - "typescript": "4.6.3" - }, - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - } -} diff --git a/node_modules/@jridgewell/resolve-uri/LICENSE b/node_modules/@jridgewell/resolve-uri/LICENSE deleted file mode 100644 index 0a81b2ade..000000000 --- a/node_modules/@jridgewell/resolve-uri/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2019 Justin Ridgewell - -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/@jridgewell/resolve-uri/README.md b/node_modules/@jridgewell/resolve-uri/README.md deleted file mode 100644 index 2fe70df77..000000000 --- a/node_modules/@jridgewell/resolve-uri/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# @jridgewell/resolve-uri - -> Resolve a URI relative to an optional base URI - -Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths. - -## Installation - -```sh -npm install @jridgewell/resolve-uri -``` - -## Usage - -```typescript -function resolve(input: string, base?: string): string; -``` - -```js -import resolve from '@jridgewell/resolve-uri'; - -resolve('foo', 'https://example.com'); // => 'https://example.com/foo' -``` - -| Input | Base | Resolution | Explanation | -|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------| -| `https://example.com` | _any_ | `https://example.com/` | Input is normalized only | -| `//example.com` | `https://base.com/` | `https://example.com/` | Input inherits the base's protocol | -| `//example.com` | _rest_ | `//example.com/` | Input is normalized only | -| `/example` | `https://base.com/` | `https://base.com/example` | Input inherits the base's origin | -| `/example` | `//base.com/` | `//base.com/example` | Input inherits the base's host and remains protocol relative | -| `/example` | _rest_ | `/example` | Input is normalized only | -| `example` | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base | -| `example` | `https://base.com/file` | `https://base.com/example` | Input is joined with the base without its file | -| `example` | `//base.com/dir/` | `//base.com/dir/example` | Input is joined with the base's last directory | -| `example` | `//base.com/file` | `//base.com/example` | Input is joined with the base without its file | -| `example` | `/base/dir/` | `/base/dir/example` | Input is joined with the base's last directory | -| `example` | `/base/file` | `/base/example` | Input is joined with the base without its file | -| `example` | `base/dir/` | `base/dir/example` | Input is joined with the base's last directory | -| `example` | `base/file` | `base/example` | Input is joined with the base without its file | diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs deleted file mode 100644 index 94d8dceb9..000000000 --- a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs +++ /dev/null @@ -1,242 +0,0 @@ -// Matches the scheme of a URL, eg "http://" -const schemeRegex = /^[\w+.-]+:\/\//; -/** - * Matches the parts of a URL: - * 1. Scheme, including ":", guaranteed. - * 2. User/password, including "@", optional. - * 3. Host, guaranteed. - * 4. Port, including ":", optional. - * 5. Path, including "/", optional. - * 6. Query, including "?", optional. - * 7. Hash, including "#", optional. - */ -const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; -/** - * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start - * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). - * - * 1. Host, optional. - * 2. Path, which may include "/", guaranteed. - * 3. Query, including "?", optional. - * 4. Hash, including "#", optional. - */ -const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; -var UrlType; -(function (UrlType) { - UrlType[UrlType["Empty"] = 1] = "Empty"; - UrlType[UrlType["Hash"] = 2] = "Hash"; - UrlType[UrlType["Query"] = 3] = "Query"; - UrlType[UrlType["RelativePath"] = 4] = "RelativePath"; - UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath"; - UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative"; - UrlType[UrlType["Absolute"] = 7] = "Absolute"; -})(UrlType || (UrlType = {})); -function isAbsoluteUrl(input) { - return schemeRegex.test(input); -} -function isSchemeRelativeUrl(input) { - return input.startsWith('//'); -} -function isAbsolutePath(input) { - return input.startsWith('/'); -} -function isFileUrl(input) { - return input.startsWith('file:'); -} -function isRelative(input) { - return /^[.?#]/.test(input); -} -function parseAbsoluteUrl(input) { - const match = urlRegex.exec(input); - return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || ''); -} -function parseFileUrl(input) { - const match = fileRegex.exec(input); - const path = match[2]; - return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || ''); -} -function makeUrl(scheme, user, host, port, path, query, hash) { - return { - scheme, - user, - host, - port, - path, - query, - hash, - type: UrlType.Absolute, - }; -} -function parseUrl(input) { - if (isSchemeRelativeUrl(input)) { - const url = parseAbsoluteUrl('http:' + input); - url.scheme = ''; - url.type = UrlType.SchemeRelative; - return url; - } - if (isAbsolutePath(input)) { - const url = parseAbsoluteUrl('http://foo.com' + input); - url.scheme = ''; - url.host = ''; - url.type = UrlType.AbsolutePath; - return url; - } - if (isFileUrl(input)) - return parseFileUrl(input); - if (isAbsoluteUrl(input)) - return parseAbsoluteUrl(input); - const url = parseAbsoluteUrl('http://foo.com/' + input); - url.scheme = ''; - url.host = ''; - url.type = input - ? input.startsWith('?') - ? UrlType.Query - : input.startsWith('#') - ? UrlType.Hash - : UrlType.RelativePath - : UrlType.Empty; - return url; -} -function stripPathFilename(path) { - // If a path ends with a parent directory "..", then it's a relative path with excess parent - // paths. It's not a file, so we can't strip it. - if (path.endsWith('/..')) - return path; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); -} -function mergePaths(url, base) { - normalizePath(base, base.type); - // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative - // path). - if (url.path === '/') { - url.path = base.path; - } - else { - // Resolution happens relative to the base path's directory, not the file. - url.path = stripPathFilename(base.path) + url.path; - } -} -/** - * The path can have empty directories "//", unneeded parents "foo/..", or current directory - * "foo/.". We need to normalize to a standard representation. - */ -function normalizePath(url, type) { - const rel = type <= UrlType.RelativePath; - const pieces = url.path.split('/'); - // We need to preserve the first piece always, so that we output a leading slash. The item at - // pieces[0] is an empty string. - let pointer = 1; - // Positive is the number of real directories we've output, used for popping a parent directory. - // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo". - let positive = 0; - // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will - // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a - // real directory, we won't need to append, unless the other conditions happen again. - let addTrailingSlash = false; - for (let i = 1; i < pieces.length; i++) { - const piece = pieces[i]; - // An empty directory, could be a trailing slash, or just a double "//" in the path. - if (!piece) { - addTrailingSlash = true; - continue; - } - // If we encounter a real directory, then we don't need to append anymore. - addTrailingSlash = false; - // A current directory, which we can always drop. - if (piece === '.') - continue; - // A parent directory, we need to see if there are any real directories we can pop. Else, we - // have an excess of parents, and we'll need to keep the "..". - if (piece === '..') { - if (positive) { - addTrailingSlash = true; - positive--; - pointer--; - } - else if (rel) { - // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute - // URL, protocol relative URL, or an absolute path, we don't need to keep excess. - pieces[pointer++] = piece; - } - continue; - } - // We've encountered a real directory. Move it to the next insertion pointer, which accounts for - // any popped or dropped directories. - pieces[pointer++] = piece; - positive++; - } - let path = ''; - for (let i = 1; i < pointer; i++) { - path += '/' + pieces[i]; - } - if (!path || (addTrailingSlash && !path.endsWith('/..'))) { - path += '/'; - } - url.path = path; -} -/** - * Attempts to resolve `input` URL/path relative to `base`. - */ -function resolve(input, base) { - if (!input && !base) - return ''; - const url = parseUrl(input); - let inputType = url.type; - if (base && inputType !== UrlType.Absolute) { - const baseUrl = parseUrl(base); - const baseType = baseUrl.type; - switch (inputType) { - case UrlType.Empty: - url.hash = baseUrl.hash; - // fall through - case UrlType.Hash: - url.query = baseUrl.query; - // fall through - case UrlType.Query: - case UrlType.RelativePath: - mergePaths(url, baseUrl); - // fall through - case UrlType.AbsolutePath: - // The host, user, and port are joined, you can't copy one without the others. - url.user = baseUrl.user; - url.host = baseUrl.host; - url.port = baseUrl.port; - // fall through - case UrlType.SchemeRelative: - // The input doesn't have a schema at least, so we need to copy at least that over. - url.scheme = baseUrl.scheme; - } - if (baseType > inputType) - inputType = baseType; - } - normalizePath(url, inputType); - const queryHash = url.query + url.hash; - switch (inputType) { - // This is impossible, because of the empty checks at the start of the function. - // case UrlType.Empty: - case UrlType.Hash: - case UrlType.Query: - return queryHash; - case UrlType.RelativePath: { - // The first char is always a "/", and we need it to be relative. - const path = url.path.slice(1); - if (!path) - return queryHash || '.'; - if (isRelative(base || input) && !isRelative(path)) { - // If base started with a leading ".", or there is no base and input started with a ".", - // then we need to ensure that the relative path starts with a ".". We don't know if - // relative starts with a "..", though, so check before prepending. - return './' + path + queryHash; - } - return path + queryHash; - } - case UrlType.AbsolutePath: - return url.path + queryHash; - default: - return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash; - } -} - -export { resolve as default }; -//# sourceMappingURL=resolve-uri.mjs.map diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map deleted file mode 100644 index 009d0434b..000000000 --- a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve-uri.mjs","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nenum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n}\n"],"names":[],"mappings":"AAAA;AACA,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC;;;;;;;;;;AAUA,MAAM,QAAQ,GAAG,0EAA0E,CAAC;AAE5F;;;;;;;;;AASA,MAAM,SAAS,GAAG,iEAAiE,CAAC;AAapF,IAAK,OAQJ;AARD,WAAK,OAAO;IACV,uCAAS,CAAA;IACT,qCAAQ,CAAA;IACR,uCAAS,CAAA;IACT,qDAAgB,CAAA;IAChB,qDAAgB,CAAA;IAChB,yDAAkB,CAAA;IAClB,6CAAY,CAAA;AACd,CAAC,EARI,OAAO,KAAP,OAAO,QAQX;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAE,CAAC;IACpC,OAAO,OAAO,CACZ,KAAK,CAAC,CAAC,CAAC,EACR,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EACd,KAAK,CAAC,CAAC,CAAC,EACR,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EACd,KAAK,CAAC,CAAC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Aa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAE9B,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC;IACvC,QAAQ,SAAS;;;QAIf,KAAK,OAAO,CAAC,IAAI,CAAC;QAClB,KAAK,OAAO,CAAC,KAAK;YAChB,OAAO,SAAS,CAAC;QAEnB,KAAK,OAAO,CAAC,YAAY,EAAE;;YAEzB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAE/B,IAAI,CAAC,IAAI;gBAAE,OAAO,SAAS,IAAI,GAAG,CAAC;YAEnC,IAAI,UAAU,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;;;;gBAIlD,OAAO,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;aAChC;YAED,OAAO,IAAI,GAAG,SAAS,CAAC;SACzB;QAED,KAAK,OAAO,CAAC,YAAY;YACvB,OAAO,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;QAE9B;YACE,OAAO,GAAG,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;KACpF;AACH;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js deleted file mode 100644 index 0700a2d60..000000000 --- a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js +++ /dev/null @@ -1,250 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory()); -})(this, (function () { 'use strict'; - - // Matches the scheme of a URL, eg "http://" - const schemeRegex = /^[\w+.-]+:\/\//; - /** - * Matches the parts of a URL: - * 1. Scheme, including ":", guaranteed. - * 2. User/password, including "@", optional. - * 3. Host, guaranteed. - * 4. Port, including ":", optional. - * 5. Path, including "/", optional. - * 6. Query, including "?", optional. - * 7. Hash, including "#", optional. - */ - const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; - /** - * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start - * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). - * - * 1. Host, optional. - * 2. Path, which may include "/", guaranteed. - * 3. Query, including "?", optional. - * 4. Hash, including "#", optional. - */ - const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; - var UrlType; - (function (UrlType) { - UrlType[UrlType["Empty"] = 1] = "Empty"; - UrlType[UrlType["Hash"] = 2] = "Hash"; - UrlType[UrlType["Query"] = 3] = "Query"; - UrlType[UrlType["RelativePath"] = 4] = "RelativePath"; - UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath"; - UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative"; - UrlType[UrlType["Absolute"] = 7] = "Absolute"; - })(UrlType || (UrlType = {})); - function isAbsoluteUrl(input) { - return schemeRegex.test(input); - } - function isSchemeRelativeUrl(input) { - return input.startsWith('//'); - } - function isAbsolutePath(input) { - return input.startsWith('/'); - } - function isFileUrl(input) { - return input.startsWith('file:'); - } - function isRelative(input) { - return /^[.?#]/.test(input); - } - function parseAbsoluteUrl(input) { - const match = urlRegex.exec(input); - return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || ''); - } - function parseFileUrl(input) { - const match = fileRegex.exec(input); - const path = match[2]; - return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || ''); - } - function makeUrl(scheme, user, host, port, path, query, hash) { - return { - scheme, - user, - host, - port, - path, - query, - hash, - type: UrlType.Absolute, - }; - } - function parseUrl(input) { - if (isSchemeRelativeUrl(input)) { - const url = parseAbsoluteUrl('http:' + input); - url.scheme = ''; - url.type = UrlType.SchemeRelative; - return url; - } - if (isAbsolutePath(input)) { - const url = parseAbsoluteUrl('http://foo.com' + input); - url.scheme = ''; - url.host = ''; - url.type = UrlType.AbsolutePath; - return url; - } - if (isFileUrl(input)) - return parseFileUrl(input); - if (isAbsoluteUrl(input)) - return parseAbsoluteUrl(input); - const url = parseAbsoluteUrl('http://foo.com/' + input); - url.scheme = ''; - url.host = ''; - url.type = input - ? input.startsWith('?') - ? UrlType.Query - : input.startsWith('#') - ? UrlType.Hash - : UrlType.RelativePath - : UrlType.Empty; - return url; - } - function stripPathFilename(path) { - // If a path ends with a parent directory "..", then it's a relative path with excess parent - // paths. It's not a file, so we can't strip it. - if (path.endsWith('/..')) - return path; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); - } - function mergePaths(url, base) { - normalizePath(base, base.type); - // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative - // path). - if (url.path === '/') { - url.path = base.path; - } - else { - // Resolution happens relative to the base path's directory, not the file. - url.path = stripPathFilename(base.path) + url.path; - } - } - /** - * The path can have empty directories "//", unneeded parents "foo/..", or current directory - * "foo/.". We need to normalize to a standard representation. - */ - function normalizePath(url, type) { - const rel = type <= UrlType.RelativePath; - const pieces = url.path.split('/'); - // We need to preserve the first piece always, so that we output a leading slash. The item at - // pieces[0] is an empty string. - let pointer = 1; - // Positive is the number of real directories we've output, used for popping a parent directory. - // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo". - let positive = 0; - // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will - // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a - // real directory, we won't need to append, unless the other conditions happen again. - let addTrailingSlash = false; - for (let i = 1; i < pieces.length; i++) { - const piece = pieces[i]; - // An empty directory, could be a trailing slash, or just a double "//" in the path. - if (!piece) { - addTrailingSlash = true; - continue; - } - // If we encounter a real directory, then we don't need to append anymore. - addTrailingSlash = false; - // A current directory, which we can always drop. - if (piece === '.') - continue; - // A parent directory, we need to see if there are any real directories we can pop. Else, we - // have an excess of parents, and we'll need to keep the "..". - if (piece === '..') { - if (positive) { - addTrailingSlash = true; - positive--; - pointer--; - } - else if (rel) { - // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute - // URL, protocol relative URL, or an absolute path, we don't need to keep excess. - pieces[pointer++] = piece; - } - continue; - } - // We've encountered a real directory. Move it to the next insertion pointer, which accounts for - // any popped or dropped directories. - pieces[pointer++] = piece; - positive++; - } - let path = ''; - for (let i = 1; i < pointer; i++) { - path += '/' + pieces[i]; - } - if (!path || (addTrailingSlash && !path.endsWith('/..'))) { - path += '/'; - } - url.path = path; - } - /** - * Attempts to resolve `input` URL/path relative to `base`. - */ - function resolve(input, base) { - if (!input && !base) - return ''; - const url = parseUrl(input); - let inputType = url.type; - if (base && inputType !== UrlType.Absolute) { - const baseUrl = parseUrl(base); - const baseType = baseUrl.type; - switch (inputType) { - case UrlType.Empty: - url.hash = baseUrl.hash; - // fall through - case UrlType.Hash: - url.query = baseUrl.query; - // fall through - case UrlType.Query: - case UrlType.RelativePath: - mergePaths(url, baseUrl); - // fall through - case UrlType.AbsolutePath: - // The host, user, and port are joined, you can't copy one without the others. - url.user = baseUrl.user; - url.host = baseUrl.host; - url.port = baseUrl.port; - // fall through - case UrlType.SchemeRelative: - // The input doesn't have a schema at least, so we need to copy at least that over. - url.scheme = baseUrl.scheme; - } - if (baseType > inputType) - inputType = baseType; - } - normalizePath(url, inputType); - const queryHash = url.query + url.hash; - switch (inputType) { - // This is impossible, because of the empty checks at the start of the function. - // case UrlType.Empty: - case UrlType.Hash: - case UrlType.Query: - return queryHash; - case UrlType.RelativePath: { - // The first char is always a "/", and we need it to be relative. - const path = url.path.slice(1); - if (!path) - return queryHash || '.'; - if (isRelative(base || input) && !isRelative(path)) { - // If base started with a leading ".", or there is no base and input started with a ".", - // then we need to ensure that the relative path starts with a ".". We don't know if - // relative starts with a "..", though, so check before prepending. - return './' + path + queryHash; - } - return path + queryHash; - } - case UrlType.AbsolutePath: - return url.path + queryHash; - default: - return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash; - } - } - - return resolve; - -})); -//# sourceMappingURL=resolve-uri.umd.js.map diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map deleted file mode 100644 index a3e39ebad..000000000 --- a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve-uri.umd.js","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nenum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user +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CAAC;QAE9B,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC;QACvC,QAAQ,SAAS;;;YAIf,KAAK,OAAO,CAAC,IAAI,CAAC;YAClB,KAAK,OAAO,CAAC,KAAK;gBAChB,OAAO,SAAS,CAAC;YAEnB,KAAK,OAAO,CAAC,YAAY,EAAE;;gBAEzB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAE/B,IAAI,CAAC,IAAI;oBAAE,OAAO,SAAS,IAAI,GAAG,CAAC;gBAEnC,IAAI,UAAU,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;;;;oBAIlD,OAAO,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;iBAChC;gBAED,OAAO,IAAI,GAAG,SAAS,CAAC;aACzB;YAED,KAAK,OAAO,CAAC,YAAY;gBACvB,OAAO,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;YAE9B;gBACE,OAAO,GAAG,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;SACpF;IACH;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts b/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts deleted file mode 100644 index b7f0b3b2d..000000000 --- a/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Attempts to resolve `input` URL/path relative to `base`. - */ -export default function resolve(input: string, base: string | undefined): string; diff --git a/node_modules/@jridgewell/resolve-uri/package.json b/node_modules/@jridgewell/resolve-uri/package.json deleted file mode 100644 index 114937a00..000000000 --- a/node_modules/@jridgewell/resolve-uri/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@jridgewell/resolve-uri", - "version": "3.1.0", - "description": "Resolve a URI relative to an optional base URI", - "keywords": [ - "resolve", - "uri", - "url", - "path" - ], - "author": "Justin Ridgewell ", - "license": "MIT", - "repository": "https://github.com/jridgewell/resolve-uri", - "main": "dist/resolve-uri.umd.js", - "module": "dist/resolve-uri.mjs", - "typings": "dist/types/resolve-uri.d.ts", - "exports": { - ".": [ - { - "types": "./dist/types/resolve-uri.d.ts", - "browser": "./dist/resolve-uri.umd.js", - "require": "./dist/resolve-uri.umd.js", - "import": "./dist/resolve-uri.mjs" - }, - "./dist/resolve-uri.umd.js" - ], - "./package.json": "./package.json" - }, - "files": [ - "dist" - ], - "engines": { - "node": ">=6.0.0" - }, - "scripts": { - "prebuild": "rm -rf dist", - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "pretest": "run-s build:rollup", - "test": "run-s -n test:lint test:only", - "test:debug": "mocha --inspect-brk", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:coverage": "c8 mocha", - "test:watch": "mocha --watch", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build" - }, - "devDependencies": { - "@jridgewell/resolve-uri-latest": "npm:@jridgewell/resolve-uri@*", - "@rollup/plugin-typescript": "8.3.0", - "@typescript-eslint/eslint-plugin": "5.10.0", - "@typescript-eslint/parser": "5.10.0", - "c8": "7.11.0", - "eslint": "8.7.0", - "eslint-config-prettier": "8.3.0", - "mocha": "9.2.0", - "npm-run-all": "4.1.5", - "prettier": "2.5.1", - "rollup": "2.66.0", - "typescript": "4.5.5" - } -} diff --git a/node_modules/@jridgewell/set-array/LICENSE b/node_modules/@jridgewell/set-array/LICENSE deleted file mode 100644 index 352f0715f..000000000 --- a/node_modules/@jridgewell/set-array/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2022 Justin Ridgewell - -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/@jridgewell/set-array/README.md b/node_modules/@jridgewell/set-array/README.md deleted file mode 100644 index 2ed155ff7..000000000 --- a/node_modules/@jridgewell/set-array/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# @jridgewell/set-array - -> Like a Set, but provides the index of the `key` in the backing array - -This is designed to allow synchronizing a second array with the contents of the backing array, like -how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, and there -are never duplicates. - -## Installation - -```sh -npm install @jridgewell/set-array -``` - -## Usage - -```js -import { SetArray, get, put, pop } from '@jridgewell/set-array'; - -const sa = new SetArray(); - -let index = put(sa, 'first'); -assert.strictEqual(index, 0); - -index = put(sa, 'second'); -assert.strictEqual(index, 1); - -assert.deepEqual(sa.array, [ 'first', 'second' ]); - -index = get(sa, 'first'); -assert.strictEqual(index, 0); - -pop(sa); -index = get(sa, 'second'); -assert.strictEqual(index, undefined); -assert.deepEqual(sa.array, [ 'first' ]); -``` diff --git a/node_modules/@jridgewell/set-array/dist/set-array.mjs b/node_modules/@jridgewell/set-array/dist/set-array.mjs deleted file mode 100644 index b7f1a9cc6..000000000 --- a/node_modules/@jridgewell/set-array/dist/set-array.mjs +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Gets the index associated with `key` in the backing array, if it is already present. - */ -let get; -/** - * Puts `key` into the backing array, if it is not already present. Returns - * the index of the `key` in the backing array. - */ -let put; -/** - * Pops the last added item out of the SetArray. - */ -let pop; -/** - * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the - * index of the `key` in the backing array. - * - * This is designed to allow synchronizing a second array with the contents of the backing array, - * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, - * and there are never duplicates. - */ -class SetArray { - constructor() { - this._indexes = { __proto__: null }; - this.array = []; - } -} -(() => { - get = (strarr, key) => strarr._indexes[key]; - put = (strarr, key) => { - // The key may or may not be present. If it is present, it's a number. - const index = get(strarr, key); - if (index !== undefined) - return index; - const { array, _indexes: indexes } = strarr; - return (indexes[key] = array.push(key) - 1); - }; - pop = (strarr) => { - const { array, _indexes: indexes } = strarr; - if (array.length === 0) - return; - const last = array.pop(); - indexes[last] = undefined; - }; -})(); - -export { SetArray, get, pop, put }; -//# sourceMappingURL=set-array.mjs.map diff --git a/node_modules/@jridgewell/set-array/dist/set-array.mjs.map b/node_modules/@jridgewell/set-array/dist/set-array.mjs.map deleted file mode 100644 index ead56431a..000000000 --- a/node_modules/@jridgewell/set-array/dist/set-array.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set-array.mjs","sources":["../src/set-array.ts"],"sourcesContent":["/**\n * Gets the index associated with `key` in the backing array, if it is already present.\n */\nexport let get: (strarr: SetArray, key: string) => number | undefined;\n\n/**\n * Puts `key` into the backing array, if it is not already present. Returns\n * the index of the `key` in the backing array.\n */\nexport let put: (strarr: SetArray, key: string) => number;\n\n/**\n * Pops the last added item out of the SetArray.\n */\nexport let pop: (strarr: SetArray) => void;\n\n/**\n * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the\n * index of the `key` in the backing array.\n *\n * This is designed to allow synchronizing a second array with the contents of the backing array,\n * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,\n * and there are never duplicates.\n */\nexport class SetArray {\n private declare _indexes: { [key: string]: number | undefined };\n declare array: readonly string[];\n\n constructor() {\n this._indexes = { __proto__: null } as any;\n this.array = [];\n }\n\n static {\n get = (strarr, key) => strarr._indexes[key];\n\n put = (strarr, key) => {\n // The key may or may not be present. If it is present, it's a number.\n const index = get(strarr, key);\n if (index !== undefined) return index;\n\n const { array, _indexes: indexes } = strarr;\n\n return (indexes[key] = (array as string[]).push(key) - 1);\n };\n\n pop = (strarr) => {\n const { array, _indexes: indexes } = strarr;\n if (array.length === 0) return;\n\n const last = (array as string[]).pop()!;\n indexes[last] = undefined;\n };\n }\n}\n"],"names":[],"mappings":"AAAA;;;IAGW,IAA2D;AAEtE;;;;IAIW,IAA+C;AAE1D;;;IAGW,IAAgC;AAE3C;;;;;;;;MAQa,QAAQ;IAInB;QACE,IAAI,CAAC,QAAQ,GAAG,EAAE,SAAS,EAAE,IAAI,EAAS,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;KACjB;CAuBF;AArBC;IACE,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAE5C,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG;;QAEhB,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAEtC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAE5C,QAAQ,OAAO,CAAC,GAAG,CAAC,GAAI,KAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;KAC3D,CAAC;IAEF,GAAG,GAAG,CAAC,MAAM;QACX,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAE/B,MAAM,IAAI,GAAI,KAAkB,CAAC,GAAG,EAAG,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;KAC3B,CAAC;AACJ,CAAC,GAAA;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/set-array/dist/set-array.umd.js b/node_modules/@jridgewell/set-array/dist/set-array.umd.js deleted file mode 100644 index a1c200a1c..000000000 --- a/node_modules/@jridgewell/set-array/dist/set-array.umd.js +++ /dev/null @@ -1,58 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.setArray = {})); -})(this, (function (exports) { 'use strict'; - - /** - * Gets the index associated with `key` in the backing array, if it is already present. - */ - exports.get = void 0; - /** - * Puts `key` into the backing array, if it is not already present. Returns - * the index of the `key` in the backing array. - */ - exports.put = void 0; - /** - * Pops the last added item out of the SetArray. - */ - exports.pop = void 0; - /** - * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the - * index of the `key` in the backing array. - * - * This is designed to allow synchronizing a second array with the contents of the backing array, - * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, - * and there are never duplicates. - */ - class SetArray { - constructor() { - this._indexes = { __proto__: null }; - this.array = []; - } - } - (() => { - exports.get = (strarr, key) => strarr._indexes[key]; - exports.put = (strarr, key) => { - // The key may or may not be present. If it is present, it's a number. - const index = exports.get(strarr, key); - if (index !== undefined) - return index; - const { array, _indexes: indexes } = strarr; - return (indexes[key] = array.push(key) - 1); - }; - exports.pop = (strarr) => { - const { array, _indexes: indexes } = strarr; - if (array.length === 0) - return; - const last = array.pop(); - indexes[last] = undefined; - }; - })(); - - exports.SetArray = SetArray; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); -//# sourceMappingURL=set-array.umd.js.map diff --git a/node_modules/@jridgewell/set-array/dist/set-array.umd.js.map b/node_modules/@jridgewell/set-array/dist/set-array.umd.js.map deleted file mode 100644 index 10005af88..000000000 --- a/node_modules/@jridgewell/set-array/dist/set-array.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set-array.umd.js","sources":["../src/set-array.ts"],"sourcesContent":["/**\n * Gets the index associated with `key` in the backing array, if it is already present.\n */\nexport let get: (strarr: SetArray, key: string) => number | undefined;\n\n/**\n * Puts `key` into the backing array, if it is not already present. Returns\n * the index of the `key` in the backing array.\n */\nexport let put: (strarr: SetArray, key: string) => number;\n\n/**\n * Pops the last added item out of the SetArray.\n */\nexport let pop: (strarr: SetArray) => void;\n\n/**\n * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the\n * index of the `key` in the backing array.\n *\n * This is designed to allow synchronizing a second array with the contents of the backing array,\n * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,\n * and there are never duplicates.\n */\nexport class SetArray {\n private declare _indexes: { [key: string]: number | undefined };\n declare array: readonly string[];\n\n constructor() {\n this._indexes = { __proto__: null } as any;\n this.array = [];\n }\n\n static {\n get = (strarr, key) => strarr._indexes[key];\n\n put = (strarr, key) => {\n // The key may or may not be present. If it is present, it's a number.\n const index = get(strarr, key);\n if (index !== undefined) return index;\n\n const { array, _indexes: indexes } = strarr;\n\n return (indexes[key] = (array as string[]).push(key) - 1);\n };\n\n pop = (strarr) => {\n const { array, _indexes: indexes } = strarr;\n if (array.length === 0) return;\n\n const last = (array as string[]).pop()!;\n indexes[last] = undefined;\n };\n }\n}\n"],"names":["get","put","pop"],"mappings":";;;;;;IAAA;;;AAGWA,yBAA2D;IAEtE;;;;AAIWC,yBAA+C;IAE1D;;;AAGWC,yBAAgC;IAE3C;;;;;;;;UAQa,QAAQ;QAInB;YACE,IAAI,CAAC,QAAQ,GAAG,EAAE,SAAS,EAAE,IAAI,EAAS,CAAC;YAC3C,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;SACjB;KAuBF;IArBC;QACEF,WAAG,GAAG,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAE5CC,WAAG,GAAG,CAAC,MAAM,EAAE,GAAG;;YAEhB,MAAM,KAAK,GAAGD,WAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAC/B,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAC;YAEtC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;YAE5C,QAAQ,OAAO,CAAC,GAAG,CAAC,GAAI,KAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;SAC3D,CAAC;QAEFE,WAAG,GAAG,CAAC,MAAM;YACX,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;YAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO;YAE/B,MAAM,IAAI,GAAI,KAAkB,CAAC,GAAG,EAAG,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;SAC3B,CAAC;IACJ,CAAC,GAAA;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/set-array/dist/types/set-array.d.ts b/node_modules/@jridgewell/set-array/dist/types/set-array.d.ts deleted file mode 100644 index 7ed59b966..000000000 --- a/node_modules/@jridgewell/set-array/dist/types/set-array.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Gets the index associated with `key` in the backing array, if it is already present. - */ -export declare let get: (strarr: SetArray, key: string) => number | undefined; -/** - * Puts `key` into the backing array, if it is not already present. Returns - * the index of the `key` in the backing array. - */ -export declare let put: (strarr: SetArray, key: string) => number; -/** - * Pops the last added item out of the SetArray. - */ -export declare let pop: (strarr: SetArray) => void; -/** - * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the - * index of the `key` in the backing array. - * - * This is designed to allow synchronizing a second array with the contents of the backing array, - * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, - * and there are never duplicates. - */ -export declare class SetArray { - private _indexes; - array: readonly string[]; - constructor(); -} diff --git a/node_modules/@jridgewell/set-array/package.json b/node_modules/@jridgewell/set-array/package.json deleted file mode 100644 index aec4ee029..000000000 --- a/node_modules/@jridgewell/set-array/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@jridgewell/set-array", - "version": "1.1.2", - "description": "Like a Set, but provides the index of the `key` in the backing array", - "keywords": [], - "author": "Justin Ridgewell ", - "license": "MIT", - "repository": "https://github.com/jridgewell/set-array", - "main": "dist/set-array.umd.js", - "module": "dist/set-array.mjs", - "typings": "dist/types/set-array.d.ts", - "exports": { - ".": [ - { - "types": "./dist/types/set-array.d.ts", - "browser": "./dist/set-array.umd.js", - "require": "./dist/set-array.umd.js", - "import": "./dist/set-array.mjs" - }, - "./dist/set-array.umd.js" - ], - "./package.json": "./package.json" - }, - "files": [ - "dist", - "src" - ], - "engines": { - "node": ">=6.0.0" - }, - "scripts": { - "prebuild": "rm -rf dist", - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "pretest": "run-s build:rollup", - "test": "run-s -n test:lint test:only", - "test:debug": "mocha --inspect-brk", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:coverage": "c8 mocha", - "test:watch": "mocha --watch", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build" - }, - "devDependencies": { - "@rollup/plugin-typescript": "8.3.0", - "@types/mocha": "9.1.1", - "@types/node": "17.0.29", - "@typescript-eslint/eslint-plugin": "5.10.0", - "@typescript-eslint/parser": "5.10.0", - "c8": "7.11.0", - "eslint": "8.7.0", - "eslint-config-prettier": "8.3.0", - "mocha": "9.2.0", - "npm-run-all": "4.1.5", - "prettier": "2.5.1", - "rollup": "2.66.0", - "typescript": "4.5.5" - } -} diff --git a/node_modules/@jridgewell/set-array/src/set-array.ts b/node_modules/@jridgewell/set-array/src/set-array.ts deleted file mode 100644 index f9ff60427..000000000 --- a/node_modules/@jridgewell/set-array/src/set-array.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Gets the index associated with `key` in the backing array, if it is already present. - */ -export let get: (strarr: SetArray, key: string) => number | undefined; - -/** - * Puts `key` into the backing array, if it is not already present. Returns - * the index of the `key` in the backing array. - */ -export let put: (strarr: SetArray, key: string) => number; - -/** - * Pops the last added item out of the SetArray. - */ -export let pop: (strarr: SetArray) => void; - -/** - * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the - * index of the `key` in the backing array. - * - * This is designed to allow synchronizing a second array with the contents of the backing array, - * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, - * and there are never duplicates. - */ -export class SetArray { - private declare _indexes: { [key: string]: number | undefined }; - declare array: readonly string[]; - - constructor() { - this._indexes = { __proto__: null } as any; - this.array = []; - } - - static { - get = (strarr, key) => strarr._indexes[key]; - - put = (strarr, key) => { - // The key may or may not be present. If it is present, it's a number. - const index = get(strarr, key); - if (index !== undefined) return index; - - const { array, _indexes: indexes } = strarr; - - return (indexes[key] = (array as string[]).push(key) - 1); - }; - - pop = (strarr) => { - const { array, _indexes: indexes } = strarr; - if (array.length === 0) return; - - const last = (array as string[]).pop()!; - indexes[last] = undefined; - }; - } -} diff --git a/node_modules/@jridgewell/sourcemap-codec/LICENSE b/node_modules/@jridgewell/sourcemap-codec/LICENSE deleted file mode 100644 index a331065a4..000000000 --- a/node_modules/@jridgewell/sourcemap-codec/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2015 Rich Harris - -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/@jridgewell/sourcemap-codec/README.md b/node_modules/@jridgewell/sourcemap-codec/README.md deleted file mode 100644 index 5cbb31525..000000000 --- a/node_modules/@jridgewell/sourcemap-codec/README.md +++ /dev/null @@ -1,200 +0,0 @@ -# @jridgewell/sourcemap-codec - -Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit). - - -## Why? - -Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap. - -This package makes the process slightly easier. - - -## Installation - -```bash -npm install @jridgewell/sourcemap-codec -``` - - -## Usage - -```js -import { encode, decode } from '@jridgewell/sourcemap-codec'; - -var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); - -assert.deepEqual( decoded, [ - // the first line (of the generated code) has no mappings, - // as shown by the starting semi-colon (which separates lines) - [], - - // the second line contains four (comma-separated) segments - [ - // segments are encoded as you'd expect: - // [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ] - - // i.e. the first segment begins at column 2, and maps back to the second column - // of the second line (both zero-based) of the 0th source, and uses the 0th - // name in the `map.names` array - [ 2, 0, 2, 2, 0 ], - - // the remaining segments are 4-length rather than 5-length, - // because they don't map a name - [ 4, 0, 2, 4 ], - [ 6, 0, 2, 5 ], - [ 7, 0, 2, 7 ] - ], - - // the final line contains two segments - [ - [ 2, 1, 10, 19 ], - [ 12, 1, 11, 20 ] - ] -]); - -var encoded = encode( decoded ); -assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); -``` - -## Benchmarks - -``` -node v18.0.0 - -amp.js.map - 45120 segments - -Decode Memory Usage: -@jridgewell/sourcemap-codec 5479160 bytes -sourcemap-codec 5659336 bytes -source-map-0.6.1 17144440 bytes -source-map-0.8.0 6867424 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Decode speed: -decode: @jridgewell/sourcemap-codec x 502 ops/sec ±1.03% (90 runs sampled) -decode: sourcemap-codec x 445 ops/sec ±0.97% (92 runs sampled) -decode: source-map-0.6.1 x 36.01 ops/sec ±1.64% (49 runs sampled) -decode: source-map-0.8.0 x 367 ops/sec ±0.04% (95 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec - -Encode Memory Usage: -@jridgewell/sourcemap-codec 1261620 bytes -sourcemap-codec 9119248 bytes -source-map-0.6.1 8968560 bytes -source-map-0.8.0 8952952 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Encode speed: -encode: @jridgewell/sourcemap-codec x 738 ops/sec ±0.42% (98 runs sampled) -encode: sourcemap-codec x 238 ops/sec ±0.73% (88 runs sampled) -encode: source-map-0.6.1 x 162 ops/sec ±0.43% (84 runs sampled) -encode: source-map-0.8.0 x 191 ops/sec ±0.34% (90 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec - - -*** - - -babel.min.js.map - 347793 segments - -Decode Memory Usage: -@jridgewell/sourcemap-codec 35338184 bytes -sourcemap-codec 35922736 bytes -source-map-0.6.1 62366360 bytes -source-map-0.8.0 44337416 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Decode speed: -decode: @jridgewell/sourcemap-codec x 40.35 ops/sec ±4.47% (54 runs sampled) -decode: sourcemap-codec x 36.76 ops/sec ±3.67% (51 runs sampled) -decode: source-map-0.6.1 x 4.44 ops/sec ±2.15% (16 runs sampled) -decode: source-map-0.8.0 x 59.35 ops/sec ±0.05% (78 runs sampled) -Fastest is decode: source-map-0.8.0 - -Encode Memory Usage: -@jridgewell/sourcemap-codec 7212604 bytes -sourcemap-codec 21421456 bytes -source-map-0.6.1 25286888 bytes -source-map-0.8.0 25498744 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Encode speed: -encode: @jridgewell/sourcemap-codec x 112 ops/sec ±0.13% (84 runs sampled) -encode: sourcemap-codec x 30.23 ops/sec ±2.76% (53 runs sampled) -encode: source-map-0.6.1 x 19.43 ops/sec ±3.70% (37 runs sampled) -encode: source-map-0.8.0 x 19.40 ops/sec ±3.26% (37 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec - - -*** - - -preact.js.map - 1992 segments - -Decode Memory Usage: -@jridgewell/sourcemap-codec 500272 bytes -sourcemap-codec 516864 bytes -source-map-0.6.1 1596672 bytes -source-map-0.8.0 517272 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Decode speed: -decode: @jridgewell/sourcemap-codec x 16,137 ops/sec ±0.17% (99 runs sampled) -decode: sourcemap-codec x 12,139 ops/sec ±0.13% (99 runs sampled) -decode: source-map-0.6.1 x 1,264 ops/sec ±0.12% (100 runs sampled) -decode: source-map-0.8.0 x 9,894 ops/sec ±0.08% (101 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec - -Encode Memory Usage: -@jridgewell/sourcemap-codec 321026 bytes -sourcemap-codec 830832 bytes -source-map-0.6.1 586608 bytes -source-map-0.8.0 586680 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Encode speed: -encode: @jridgewell/sourcemap-codec x 19,876 ops/sec ±0.78% (95 runs sampled) -encode: sourcemap-codec x 6,983 ops/sec ±0.15% (100 runs sampled) -encode: source-map-0.6.1 x 5,070 ops/sec ±0.12% (102 runs sampled) -encode: source-map-0.8.0 x 5,641 ops/sec ±0.17% (100 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec - - -*** - - -react.js.map - 5726 segments - -Decode Memory Usage: -@jridgewell/sourcemap-codec 734848 bytes -sourcemap-codec 954200 bytes -source-map-0.6.1 2276432 bytes -source-map-0.8.0 955488 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Decode speed: -decode: @jridgewell/sourcemap-codec x 5,723 ops/sec ±0.12% (98 runs sampled) -decode: sourcemap-codec x 4,555 ops/sec ±0.09% (101 runs sampled) -decode: source-map-0.6.1 x 437 ops/sec ±0.11% (93 runs sampled) -decode: source-map-0.8.0 x 3,441 ops/sec ±0.15% (100 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec - -Encode Memory Usage: -@jridgewell/sourcemap-codec 638672 bytes -sourcemap-codec 1109840 bytes -source-map-0.6.1 1321224 bytes -source-map-0.8.0 1324448 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Encode speed: -encode: @jridgewell/sourcemap-codec x 6,801 ops/sec ±0.48% (98 runs sampled) -encode: sourcemap-codec x 2,533 ops/sec ±0.13% (101 runs sampled) -encode: source-map-0.6.1 x 2,248 ops/sec ±0.08% (100 runs sampled) -encode: source-map-0.8.0 x 2,303 ops/sec ±0.15% (100 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec -``` - -# License - -MIT diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs deleted file mode 100644 index 3dff37217..000000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +++ /dev/null @@ -1,164 +0,0 @@ -const comma = ','.charCodeAt(0); -const semicolon = ';'.charCodeAt(0); -const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -const intToChar = new Uint8Array(64); // 64 possible chars. -const charToInt = new Uint8Array(128); // z is 122 in ASCII -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -// Provide a fallback for older environments. -const td = typeof TextDecoder !== 'undefined' - ? /* #__PURE__ */ new TextDecoder() - : typeof Buffer !== 'undefined' - ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - }, - } - : { - decode(buf) { - let out = ''; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - }, - }; -function decode(mappings) { - const state = new Int32Array(5); - const decoded = []; - let index = 0; - do { - const semi = indexOf(mappings, index); - const line = []; - let sorted = true; - let lastCol = 0; - state[0] = 0; - for (let i = index; i < semi; i++) { - let seg; - i = decodeInteger(mappings, i, state, 0); // genColumn - const col = state[0]; - if (col < lastCol) - sorted = false; - lastCol = col; - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 1); // sourcesIndex - i = decodeInteger(mappings, i, state, 2); // sourceLine - i = decodeInteger(mappings, i, state, 3); // sourceColumn - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 4); // namesIndex - seg = [col, state[1], state[2], state[3], state[4]]; - } - else { - seg = [col, state[1], state[2], state[3]]; - } - } - else { - seg = [col]; - } - line.push(seg); - } - if (!sorted) - sort(line); - decoded.push(line); - index = semi + 1; - } while (index <= mappings.length); - return decoded; -} -function indexOf(mappings, index) { - const idx = mappings.indexOf(';', index); - return idx === -1 ? mappings.length : idx; -} -function decodeInteger(mappings, pos, state, j) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = mappings.charCodeAt(pos++); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -0x80000000 | -value; - } - state[j] += value; - return pos; -} -function hasMoreVlq(mappings, i, length) { - if (i >= length) - return false; - return mappings.charCodeAt(i) !== comma; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} -function encode(decoded) { - const state = new Int32Array(5); - const bufLength = 1024 * 16; - const subLength = bufLength - 36; - const buf = new Uint8Array(bufLength); - const sub = buf.subarray(0, subLength); - let pos = 0; - let out = ''; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) { - if (pos === bufLength) { - out += td.decode(buf); - pos = 0; - } - buf[pos++] = semicolon; - } - if (line.length === 0) - continue; - state[0] = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - // We can push up to 5 ints, each int can take at most 7 chars, and we - // may push a comma. - if (pos > subLength) { - out += td.decode(sub); - buf.copyWithin(0, subLength, pos); - pos -= subLength; - } - if (j > 0) - buf[pos++] = comma; - pos = encodeInteger(buf, pos, state, segment, 0); // genColumn - if (segment.length === 1) - continue; - pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex - pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine - pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn - if (segment.length === 4) - continue; - pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex - } - } - return out + td.decode(buf.subarray(0, pos)); -} -function encodeInteger(buf, pos, state, segment, j) { - const next = segment[j]; - let num = next - state[j]; - state[j] = next; - num = num < 0 ? (-num << 1) | 1 : num << 1; - do { - let clamped = num & 0b011111; - num >>>= 5; - if (num > 0) - clamped |= 0b100000; - buf[pos++] = intToChar[clamped]; - } while (num > 0); - return pos; -} - -export { decode, encode }; -//# sourceMappingURL=sourcemap-codec.mjs.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map deleted file mode 100644 index 236fd120a..000000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.mjs","sources":["../src/sourcemap-codec.ts"],"sourcesContent":["export type SourceMapSegment =\n | [number]\n | [number, number, number, number]\n | [number, number, number, number, number];\nexport type SourceMapLine = SourceMapSegment[];\nexport type SourceMapMappings = SourceMapLine[];\n\nconst comma = ','.charCodeAt(0);\nconst semicolon = ';'.charCodeAt(0);\nconst chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst intToChar = new Uint8Array(64); // 64 possible chars.\nconst charToInt = new Uint8Array(128); // z is 122 in ASCII\n\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\n\n// Provide a fallback for older environments.\nconst td =\n typeof TextDecoder !== 'undefined'\n ? /* #__PURE__ */ new TextDecoder()\n : typeof Buffer !== 'undefined'\n ? {\n decode(buf: Uint8Array) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n },\n }\n : {\n decode(buf: Uint8Array) {\n let out = '';\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n },\n };\n\nexport function decode(mappings: string): SourceMapMappings {\n const state: [number, number, number, number, number] = new Int32Array(5) as any;\n const decoded: SourceMapMappings = [];\n\n let index = 0;\n do {\n const semi = indexOf(mappings, index);\n const line: SourceMapLine = [];\n let sorted = true;\n let lastCol = 0;\n state[0] = 0;\n\n for (let i = index; i < semi; i++) {\n let seg: SourceMapSegment;\n\n i = decodeInteger(mappings, i, state, 0); // genColumn\n const col = state[0];\n if (col < lastCol) sorted = false;\n lastCol = col;\n\n if (hasMoreVlq(mappings, i, semi)) {\n i = decodeInteger(mappings, i, state, 1); // sourcesIndex\n i = decodeInteger(mappings, i, state, 2); // sourceLine\n i = decodeInteger(mappings, i, state, 3); // sourceColumn\n\n if (hasMoreVlq(mappings, i, semi)) {\n i = decodeInteger(mappings, i, state, 4); // namesIndex\n seg = [col, state[1], state[2], state[3], state[4]];\n } else {\n seg = [col, state[1], state[2], state[3]];\n }\n } else {\n seg = [col];\n }\n\n line.push(seg);\n }\n\n if (!sorted) sort(line);\n decoded.push(line);\n index = semi + 1;\n } while (index <= mappings.length);\n\n return decoded;\n}\n\nfunction indexOf(mappings: string, index: number): number {\n const idx = mappings.indexOf(';', index);\n return idx === -1 ? mappings.length : idx;\n}\n\nfunction decodeInteger(mappings: string, pos: number, state: SourceMapSegment, j: number): number {\n let value = 0;\n let shift = 0;\n let integer = 0;\n\n do {\n const c = mappings.charCodeAt(pos++);\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n\n const shouldNegate = value & 1;\n value >>>= 1;\n\n if (shouldNegate) {\n value = -0x80000000 | -value;\n }\n\n state[j] += value;\n return pos;\n}\n\nfunction hasMoreVlq(mappings: string, i: number, length: number): boolean {\n if (i >= length) return false;\n return mappings.charCodeAt(i) !== comma;\n}\n\nfunction sort(line: SourceMapSegment[]) {\n line.sort(sortComparator);\n}\n\nfunction sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {\n return a[0] - b[0];\n}\n\nexport function encode(decoded: SourceMapMappings): string;\nexport function encode(decoded: Readonly): string;\nexport function encode(decoded: Readonly): string {\n const state: [number, number, number, number, number] = new Int32Array(5) as any;\n const bufLength = 1024 * 16;\n const subLength = bufLength - 36;\n const buf = new Uint8Array(bufLength);\n const sub = buf.subarray(0, subLength);\n let pos = 0;\n let out = '';\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) {\n if (pos === bufLength) {\n out += td.decode(buf);\n pos = 0;\n }\n buf[pos++] = semicolon;\n }\n if (line.length === 0) continue;\n\n state[0] = 0;\n\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n // We can push up to 5 ints, each int can take at most 7 chars, and we\n // may push a comma.\n if (pos > subLength) {\n out += td.decode(sub);\n buf.copyWithin(0, subLength, pos);\n pos -= subLength;\n }\n if (j > 0) buf[pos++] = comma;\n\n pos = encodeInteger(buf, pos, state, segment, 0); // genColumn\n\n if (segment.length === 1) continue;\n pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex\n pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine\n pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn\n\n if (segment.length === 4) continue;\n pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex\n }\n }\n\n return out + td.decode(buf.subarray(0, pos));\n}\n\nfunction encodeInteger(\n buf: Uint8Array,\n pos: number,\n state: SourceMapSegment,\n segment: SourceMapSegment,\n j: number,\n): number {\n const next = segment[j];\n let num = next - state[j];\n state[j] = next;\n\n num = num < 0 ? (-num << 1) | 1 : num << 1;\n do {\n let clamped = num & 0b011111;\n num >>>= 5;\n if (num > 0) clamped |= 0b100000;\n buf[pos++] = intToChar[clamped];\n } while (num > 0);\n\n return pos;\n}\n"],"names":[],"mappings":"AAOA,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAChC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,KAAK,GAAG,kEAAkE,CAAC;AACjF,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACrC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAEtC,KAAK,IAAI,CAAC,GAAG,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EACzB,CAAS;IAET,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1B,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAEhB,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IAC3C,GAAG;QACD,IAAI,OAAO,GAAG,GAAG,GAAG,QAAQ,CAAC;QAC7B,GAAG,MAAM,CAAC,CAAC;QACX,IAAI,GAAG,GAAG,CAAC;YAAE,OAAO,IAAI,QAAQ,CAAC;QACjC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;KACjC,QAAQ,GAAG,GAAG,CAAC,EAAE;IAElB,OAAO,GAAG,CAAC;AACb;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js deleted file mode 100644 index bec92a9c6..000000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +++ /dev/null @@ -1,175 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {})); -})(this, (function (exports) { 'use strict'; - - const comma = ','.charCodeAt(0); - const semicolon = ';'.charCodeAt(0); - const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - const intToChar = new Uint8Array(64); // 64 possible chars. - const charToInt = new Uint8Array(128); // z is 122 in ASCII - for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; - } - // Provide a fallback for older environments. - const td = typeof TextDecoder !== 'undefined' - ? /* #__PURE__ */ new TextDecoder() - : typeof Buffer !== 'undefined' - ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - }, - } - : { - decode(buf) { - let out = ''; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - }, - }; - function decode(mappings) { - const state = new Int32Array(5); - const decoded = []; - let index = 0; - do { - const semi = indexOf(mappings, index); - const line = []; - let sorted = true; - let lastCol = 0; - state[0] = 0; - for (let i = index; i < semi; i++) { - let seg; - i = decodeInteger(mappings, i, state, 0); // genColumn - const col = state[0]; - if (col < lastCol) - sorted = false; - lastCol = col; - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 1); // sourcesIndex - i = decodeInteger(mappings, i, state, 2); // sourceLine - i = decodeInteger(mappings, i, state, 3); // sourceColumn - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 4); // namesIndex - seg = [col, state[1], state[2], state[3], state[4]]; - } - else { - seg = [col, state[1], state[2], state[3]]; - } - } - else { - seg = [col]; - } - line.push(seg); - } - if (!sorted) - sort(line); - decoded.push(line); - index = semi + 1; - } while (index <= mappings.length); - return decoded; - } - function indexOf(mappings, index) { - const idx = mappings.indexOf(';', index); - return idx === -1 ? mappings.length : idx; - } - function decodeInteger(mappings, pos, state, j) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = mappings.charCodeAt(pos++); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -0x80000000 | -value; - } - state[j] += value; - return pos; - } - function hasMoreVlq(mappings, i, length) { - if (i >= length) - return false; - return mappings.charCodeAt(i) !== comma; - } - function sort(line) { - line.sort(sortComparator); - } - function sortComparator(a, b) { - return a[0] - b[0]; - } - function encode(decoded) { - const state = new Int32Array(5); - const bufLength = 1024 * 16; - const subLength = bufLength - 36; - const buf = new Uint8Array(bufLength); - const sub = buf.subarray(0, subLength); - let pos = 0; - let out = ''; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) { - if (pos === bufLength) { - out += td.decode(buf); - pos = 0; - } - buf[pos++] = semicolon; - } - if (line.length === 0) - continue; - state[0] = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - // We can push up to 5 ints, each int can take at most 7 chars, and we - // may push a comma. - if (pos > subLength) { - out += td.decode(sub); - buf.copyWithin(0, subLength, pos); - pos -= subLength; - } - if (j > 0) - buf[pos++] = comma; - pos = encodeInteger(buf, pos, state, segment, 0); // genColumn - if (segment.length === 1) - continue; - pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex - pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine - pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn - if (segment.length === 4) - continue; - pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex - } - } - return out + td.decode(buf.subarray(0, pos)); - } - function encodeInteger(buf, pos, state, segment, j) { - const next = segment[j]; - let num = next - state[j]; - state[j] = next; - num = num < 0 ? (-num << 1) | 1 : num << 1; - do { - let clamped = num & 0b011111; - num >>>= 5; - if (num > 0) - clamped |= 0b100000; - buf[pos++] = intToChar[clamped]; - } while (num > 0); - return pos; - } - - exports.decode = decode; - exports.encode = encode; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); -//# sourceMappingURL=sourcemap-codec.umd.js.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map deleted file mode 100644 index b6b2003c2..000000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.umd.js","sources":["../src/sourcemap-codec.ts"],"sourcesContent":["export type SourceMapSegment =\n | [number]\n | [number, number, number, number]\n | [number, number, number, number, number];\nexport type SourceMapLine = SourceMapSegment[];\nexport type SourceMapMappings = SourceMapLine[];\n\nconst comma = ','.charCodeAt(0);\nconst semicolon = ';'.charCodeAt(0);\nconst chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst intToChar = new Uint8Array(64); // 64 possible chars.\nconst charToInt = new Uint8Array(128); // z is 122 in ASCII\n\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\n\n// Provide a fallback for older environments.\nconst td =\n typeof TextDecoder !== 'undefined'\n ? /* #__PURE__ */ new TextDecoder()\n : typeof Buffer !== 'undefined'\n ? {\n decode(buf: Uint8Array) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n },\n }\n : {\n decode(buf: Uint8Array) {\n let out = '';\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n },\n };\n\nexport function decode(mappings: string): SourceMapMappings {\n const state: [number, number, number, number, number] = new Int32Array(5) as any;\n const decoded: SourceMapMappings = [];\n\n let index = 0;\n do {\n const semi = indexOf(mappings, index);\n const line: SourceMapLine = [];\n let sorted = true;\n let lastCol = 0;\n state[0] = 0;\n\n for (let i = index; i < semi; i++) {\n let seg: SourceMapSegment;\n\n i = decodeInteger(mappings, i, state, 0); // genColumn\n const col = state[0];\n if (col < lastCol) sorted = false;\n lastCol = col;\n\n if (hasMoreVlq(mappings, i, semi)) {\n i = decodeInteger(mappings, i, state, 1); // sourcesIndex\n i = decodeInteger(mappings, i, state, 2); // sourceLine\n i = decodeInteger(mappings, i, state, 3); // sourceColumn\n\n if (hasMoreVlq(mappings, i, semi)) {\n i = decodeInteger(mappings, i, state, 4); // namesIndex\n seg = [col, state[1], state[2], state[3], state[4]];\n } else {\n seg = [col, state[1], state[2], state[3]];\n }\n } else {\n seg = [col];\n }\n\n line.push(seg);\n }\n\n if (!sorted) sort(line);\n decoded.push(line);\n index = semi + 1;\n } while (index <= mappings.length);\n\n return decoded;\n}\n\nfunction indexOf(mappings: string, index: number): number {\n const idx = mappings.indexOf(';', index);\n return idx === -1 ? mappings.length : idx;\n}\n\nfunction decodeInteger(mappings: string, pos: number, state: SourceMapSegment, j: number): number {\n let value = 0;\n let shift = 0;\n let integer = 0;\n\n do {\n const c = mappings.charCodeAt(pos++);\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n\n const shouldNegate = value & 1;\n value >>>= 1;\n\n if (shouldNegate) {\n value = -0x80000000 | -value;\n }\n\n state[j] += value;\n return pos;\n}\n\nfunction hasMoreVlq(mappings: string, i: number, length: number): boolean {\n if (i >= length) return false;\n return mappings.charCodeAt(i) !== comma;\n}\n\nfunction sort(line: SourceMapSegment[]) {\n line.sort(sortComparator);\n}\n\nfunction sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {\n return a[0] - b[0];\n}\n\nexport function encode(decoded: SourceMapMappings): string;\nexport function encode(decoded: Readonly): string;\nexport function encode(decoded: Readonly): string {\n const state: [number, number, number, number, number] = new Int32Array(5) as any;\n const bufLength = 1024 * 16;\n const subLength = bufLength - 36;\n const buf = new Uint8Array(bufLength);\n const sub = buf.subarray(0, subLength);\n let pos = 0;\n let out = '';\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) {\n if (pos === bufLength) {\n out += td.decode(buf);\n pos = 0;\n }\n buf[pos++] = semicolon;\n }\n if (line.length === 0) continue;\n\n state[0] = 0;\n\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n // We can push up to 5 ints, each int can take at most 7 chars, and we\n // may push a comma.\n if (pos > subLength) {\n out += td.decode(sub);\n buf.copyWithin(0, subLength, pos);\n pos -= subLength;\n }\n if (j > 0) buf[pos++] = comma;\n\n pos = encodeInteger(buf, pos, state, segment, 0); // genColumn\n\n if (segment.length === 1) continue;\n pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex\n pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine\n pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn\n\n if (segment.length === 4) continue;\n pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex\n }\n }\n\n return out + td.decode(buf.subarray(0, pos));\n}\n\nfunction encodeInteger(\n buf: Uint8Array,\n pos: number,\n state: SourceMapSegment,\n segment: SourceMapSegment,\n j: number,\n): number {\n const next = segment[j];\n let num = next - state[j];\n state[j] = next;\n\n num = num < 0 ? (-num << 1) | 1 : num << 1;\n do {\n let clamped = num & 0b011111;\n num >>>= 5;\n if (num > 0) clamped |= 0b100000;\n buf[pos++] = intToChar[clamped];\n } while (num > 0);\n\n return pos;\n}\n"],"names":[],"mappings":";;;;;;IAOA,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,kEAAkE,CAAC;IACjF,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KAClB;IAED;IACA,MAAM,EAAE,GACN,OAAO,WAAW,KAAK,WAAW;0BACd,IAAI,WAAW,EAAE;UACjC,OAAO,MAAM,KAAK,WAAW;cAC7B;gBACE,MAAM,CAAC,GAAe;oBACpB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC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AC;YACX,IAAI,GAAG,GAAG,CAAC;gBAAE,OAAO,IAAI,QAAQ,CAAC;YACjC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;SACjC,QAAQ,GAAG,GAAG,CAAC,EAAE;QAElB,OAAO,GAAG,CAAC;IACb;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts b/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts deleted file mode 100644 index 410d3202f..000000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; -export declare type SourceMapLine = SourceMapSegment[]; -export declare type SourceMapMappings = SourceMapLine[]; -export declare function decode(mappings: string): SourceMapMappings; -export declare function encode(decoded: SourceMapMappings): string; -export declare function encode(decoded: Readonly): string; diff --git a/node_modules/@jridgewell/sourcemap-codec/package.json b/node_modules/@jridgewell/sourcemap-codec/package.json deleted file mode 100644 index 578448f1c..000000000 --- a/node_modules/@jridgewell/sourcemap-codec/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@jridgewell/sourcemap-codec", - "version": "1.4.15", - "description": "Encode/decode sourcemap mappings", - "keywords": [ - "sourcemap", - "vlq" - ], - "main": "dist/sourcemap-codec.umd.js", - "module": "dist/sourcemap-codec.mjs", - "types": "dist/types/sourcemap-codec.d.ts", - "files": [ - "dist" - ], - "exports": { - ".": [ - { - "types": "./dist/types/sourcemap-codec.d.ts", - "browser": "./dist/sourcemap-codec.umd.js", - "require": "./dist/sourcemap-codec.umd.js", - "import": "./dist/sourcemap-codec.mjs" - }, - "./dist/sourcemap-codec.umd.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "benchmark": "run-s build:rollup benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node --expose-gc benchmark/index.js", - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "prebuild": "rm -rf dist", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build", - "pretest": "run-s build:rollup", - "test": "run-s -n test:lint test:only", - "test:debug": "mocha --inspect-brk", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:coverage": "c8 mocha", - "test:watch": "mocha --watch" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/sourcemap-codec.git" - }, - "author": "Rich Harris", - "license": "MIT", - "devDependencies": { - "@rollup/plugin-typescript": "8.3.0", - "@types/node": "17.0.15", - "@typescript-eslint/eslint-plugin": "5.10.0", - "@typescript-eslint/parser": "5.10.0", - "benchmark": "2.1.4", - "c8": "7.11.2", - "eslint": "8.7.0", - "eslint-config-prettier": "8.3.0", - "mocha": "9.2.0", - "npm-run-all": "4.1.5", - "prettier": "2.5.1", - "rollup": "2.64.0", - "source-map": "0.6.1", - "source-map-js": "1.0.2", - "sourcemap-codec": "1.4.8", - "typescript": "4.5.4" - } -} diff --git a/node_modules/@jridgewell/trace-mapping/LICENSE b/node_modules/@jridgewell/trace-mapping/LICENSE deleted file mode 100644 index 37bb488f0..000000000 --- a/node_modules/@jridgewell/trace-mapping/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2022 Justin Ridgewell - -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/@jridgewell/trace-mapping/README.md b/node_modules/@jridgewell/trace-mapping/README.md deleted file mode 100644 index cc5e4f915..000000000 --- a/node_modules/@jridgewell/trace-mapping/README.md +++ /dev/null @@ -1,252 +0,0 @@ -# @jridgewell/trace-mapping - -> Trace the original position through a source map - -`trace-mapping` allows you to take the line and column of an output file and trace it to the -original location in the source file through a source map. - -You may already be familiar with the [`source-map`][source-map] package's `SourceMapConsumer`. This -provides the same `originalPositionFor` and `generatedPositionFor` API, without requiring WASM. - -## Installation - -```sh -npm install @jridgewell/trace-mapping -``` - -## Usage - -```typescript -import { - TraceMap, - originalPositionFor, - generatedPositionFor, - sourceContentFor, -} from '@jridgewell/trace-mapping'; - -const tracer = new TraceMap({ - version: 3, - sources: ['input.js'], - sourcesContent: ['content of input.js'], - names: ['foo'], - mappings: 'KAyCIA', -}); - -// Lines start at line 1, columns at column 0. -const traced = originalPositionFor(tracer, { line: 1, column: 5 }); -assert.deepEqual(traced, { - source: 'input.js', - line: 42, - column: 4, - name: 'foo', -}); - -const content = sourceContentFor(tracer, traced.source); -assert.strictEqual(content, 'content for input.js'); - -const generated = generatedPositionFor(tracer, { - source: 'input.js', - line: 42, - column: 4, -}); -assert.deepEqual(generated, { - line: 1, - column: 5, -}); -``` - -We also provide a lower level API to get the actual segment that matches our line and column. Unlike -`originalPositionFor`, `traceSegment` uses a 0-base for `line`: - -```typescript -import { traceSegment } from '@jridgewell/trace-mapping'; - -// line is 0-base. -const traced = traceSegment(tracer, /* line */ 0, /* column */ 5); - -// Segments are [outputColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] -// Again, line is 0-base and so is sourceLine -assert.deepEqual(traced, [5, 0, 41, 4, 0]); -``` - -### SectionedSourceMaps - -The sourcemap spec defines a special `sections` field that's designed to handle concatenation of -output code with associated sourcemaps. This type of sourcemap is rarely used (no major build tool -produces it), but if you are hand coding a concatenation you may need it. We provide an `AnyMap` -helper that can receive either a regular sourcemap or a `SectionedSourceMap` and returns a -`TraceMap` instance: - -```typescript -import { AnyMap } from '@jridgewell/trace-mapping'; -const fooOutput = 'foo'; -const barOutput = 'bar'; -const output = [fooOutput, barOutput].join('\n'); - -const sectioned = new AnyMap({ - version: 3, - sections: [ - { - // 0-base line and column - offset: { line: 0, column: 0 }, - // fooOutput's sourcemap - map: { - version: 3, - sources: ['foo.js'], - names: ['foo'], - mappings: 'AAAAA', - }, - }, - { - // barOutput's sourcemap will not affect the first line, only the second - offset: { line: 1, column: 0 }, - map: { - version: 3, - sources: ['bar.js'], - names: ['bar'], - mappings: 'AAAAA', - }, - }, - ], -}); - -const traced = originalPositionFor(sectioned, { - line: 2, - column: 0, -}); - -assert.deepEqual(traced, { - source: 'bar.js', - line: 1, - column: 0, - name: 'bar', -}); -``` - -## Benchmarks - -``` -node v18.0.0 - -amp.js.map - 45120 segments - -Memory Usage: -trace-mapping decoded 562400 bytes -trace-mapping encoded 5706544 bytes -source-map-js 10717664 bytes -source-map-0.6.1 17446384 bytes -source-map-0.8.0 9701757 bytes -Smallest memory usage is trace-mapping decoded - -Init speed: -trace-mapping: decoded JSON input x 180 ops/sec ±0.34% (85 runs sampled) -trace-mapping: encoded JSON input x 364 ops/sec ±1.77% (89 runs sampled) -trace-mapping: decoded Object input x 3,116 ops/sec ±0.50% (96 runs sampled) -trace-mapping: encoded Object input x 410 ops/sec ±2.62% (85 runs sampled) -source-map-js: encoded Object input x 84.23 ops/sec ±0.91% (73 runs sampled) -source-map-0.6.1: encoded Object input x 37.21 ops/sec ±2.08% (51 runs sampled) -Fastest is trace-mapping: decoded Object input - -Trace speed: -trace-mapping: decoded originalPositionFor x 3,952,212 ops/sec ±0.17% (98 runs sampled) -trace-mapping: encoded originalPositionFor x 3,487,468 ops/sec ±1.58% (90 runs sampled) -source-map-js: encoded originalPositionFor x 827,730 ops/sec ±0.78% (97 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 748,991 ops/sec ±0.53% (94 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 2,532,894 ops/sec ±0.57% (95 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - - -*** - - -babel.min.js.map - 347793 segments - -Memory Usage: -trace-mapping decoded 89832 bytes -trace-mapping encoded 35474640 bytes -source-map-js 51257176 bytes -source-map-0.6.1 63515664 bytes -source-map-0.8.0 42933752 bytes -Smallest memory usage is trace-mapping decoded - -Init speed: -trace-mapping: decoded JSON input x 15.41 ops/sec ±8.65% (34 runs sampled) -trace-mapping: encoded JSON input x 28.20 ops/sec ±12.87% (42 runs sampled) -trace-mapping: decoded Object input x 964 ops/sec ±0.36% (99 runs sampled) -trace-mapping: encoded Object input x 31.77 ops/sec ±13.79% (45 runs sampled) -source-map-js: encoded Object input x 6.45 ops/sec ±5.16% (21 runs sampled) -source-map-0.6.1: encoded Object input x 4.07 ops/sec ±5.24% (15 runs sampled) -Fastest is trace-mapping: decoded Object input - -Trace speed: -trace-mapping: decoded originalPositionFor x 7,183,038 ops/sec ±0.58% (95 runs sampled) -trace-mapping: encoded originalPositionFor x 5,192,185 ops/sec ±0.41% (100 runs sampled) -source-map-js: encoded originalPositionFor x 4,259,489 ops/sec ±0.79% (94 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 3,742,629 ops/sec ±0.71% (95 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 6,270,211 ops/sec ±0.64% (94 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - - -*** - - -preact.js.map - 1992 segments - -Memory Usage: -trace-mapping decoded 37128 bytes -trace-mapping encoded 247280 bytes -source-map-js 1143536 bytes -source-map-0.6.1 1290992 bytes -source-map-0.8.0 96544 bytes -Smallest memory usage is trace-mapping decoded - -Init speed: -trace-mapping: decoded JSON input x 3,483 ops/sec ±0.30% (98 runs sampled) -trace-mapping: encoded JSON input x 6,092 ops/sec ±0.18% (97 runs sampled) -trace-mapping: decoded Object input x 249,076 ops/sec ±0.24% (98 runs sampled) -trace-mapping: encoded Object input x 14,555 ops/sec ±0.48% (100 runs sampled) -source-map-js: encoded Object input x 2,447 ops/sec ±0.36% (99 runs sampled) -source-map-0.6.1: encoded Object input x 1,201 ops/sec ±0.57% (96 runs sampled) -Fastest is trace-mapping: decoded Object input - -Trace speed: -trace-mapping: decoded originalPositionFor x 7,620,192 ops/sec ±0.09% (99 runs sampled) -trace-mapping: encoded originalPositionFor x 6,872,554 ops/sec ±0.30% (97 runs sampled) -source-map-js: encoded originalPositionFor x 2,489,570 ops/sec ±0.35% (94 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 1,698,633 ops/sec ±0.28% (98 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 4,015,644 ops/sec ±0.22% (98 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - - -*** - - -react.js.map - 5726 segments - -Memory Usage: -trace-mapping decoded 16176 bytes -trace-mapping encoded 681552 bytes -source-map-js 2418352 bytes -source-map-0.6.1 2443672 bytes -source-map-0.8.0 111768 bytes -Smallest memory usage is trace-mapping decoded - -Init speed: -trace-mapping: decoded JSON input x 1,720 ops/sec ±0.34% (98 runs sampled) -trace-mapping: encoded JSON input x 4,406 ops/sec ±0.35% (100 runs sampled) -trace-mapping: decoded Object input x 92,122 ops/sec ±0.10% (99 runs sampled) -trace-mapping: encoded Object input x 5,385 ops/sec ±0.37% (99 runs sampled) -source-map-js: encoded Object input x 794 ops/sec ±0.40% (98 runs sampled) -source-map-0.6.1: encoded Object input x 416 ops/sec ±0.54% (91 runs sampled) -Fastest is trace-mapping: decoded Object input - -Trace speed: -trace-mapping: decoded originalPositionFor x 32,759,519 ops/sec ±0.33% (100 runs sampled) -trace-mapping: encoded originalPositionFor x 31,116,306 ops/sec ±0.33% (97 runs sampled) -source-map-js: encoded originalPositionFor x 17,458,435 ops/sec ±0.44% (97 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 12,687,097 ops/sec ±0.43% (95 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 23,538,275 ops/sec ±0.38% (95 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor -``` - -[source-map]: https://www.npmjs.com/package/source-map diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs deleted file mode 100644 index 917a3303a..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +++ /dev/null @@ -1,552 +0,0 @@ -import { encode, decode } from '@jridgewell/sourcemap-codec'; -import resolveUri from '@jridgewell/resolve-uri'; - -function resolve(input, base) { - // The base is always treated as a directory, if it's not empty. - // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327 - // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401 - if (base && !base.endsWith('/')) - base += '/'; - return resolveUri(input, base); -} - -/** - * Removes everything after the last "/", but leaves the slash. - */ -function stripFilename(path) { - if (!path) - return ''; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); -} - -const COLUMN = 0; -const SOURCES_INDEX = 1; -const SOURCE_LINE = 2; -const SOURCE_COLUMN = 3; -const NAMES_INDEX = 4; -const REV_GENERATED_LINE = 1; -const REV_GENERATED_COLUMN = 2; - -function maybeSort(mappings, owned) { - const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); - if (unsortedIndex === mappings.length) - return mappings; - // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If - // not, we do not want to modify the consumer's input array. - if (!owned) - mappings = mappings.slice(); - for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { - mappings[i] = sortSegments(mappings[i], owned); - } - return mappings; -} -function nextUnsortedSegmentLine(mappings, start) { - for (let i = start; i < mappings.length; i++) { - if (!isSorted(mappings[i])) - return i; - } - return mappings.length; -} -function isSorted(line) { - for (let j = 1; j < line.length; j++) { - if (line[j][COLUMN] < line[j - 1][COLUMN]) { - return false; - } - } - return true; -} -function sortSegments(line, owned) { - if (!owned) - line = line.slice(); - return line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[COLUMN] - b[COLUMN]; -} - -let found = false; -/** - * A binary search implementation that returns the index if a match is found. - * If no match is found, then the left-index (the index associated with the item that comes just - * before the desired index) is returned. To maintain proper sort order, a splice would happen at - * the next index: - * - * ```js - * const array = [1, 3]; - * const needle = 2; - * const index = binarySearch(array, needle, (item, needle) => item - needle); - * - * assert.equal(index, 0); - * array.splice(index + 1, 0, needle); - * assert.deepEqual(array, [1, 2, 3]); - * ``` - */ -function binarySearch(haystack, needle, low, high) { - while (low <= high) { - const mid = low + ((high - low) >> 1); - const cmp = haystack[mid][COLUMN] - needle; - if (cmp === 0) { - found = true; - return mid; - } - if (cmp < 0) { - low = mid + 1; - } - else { - high = mid - 1; - } - } - found = false; - return low - 1; -} -function upperBound(haystack, needle, index) { - for (let i = index + 1; i < haystack.length; index = i++) { - if (haystack[i][COLUMN] !== needle) - break; - } - return index; -} -function lowerBound(haystack, needle, index) { - for (let i = index - 1; i >= 0; index = i--) { - if (haystack[i][COLUMN] !== needle) - break; - } - return index; -} -function memoizedState() { - return { - lastKey: -1, - lastNeedle: -1, - lastIndex: -1, - }; -} -/** - * This overly complicated beast is just to record the last tested line/column and the resulting - * index, allowing us to skip a few tests if mappings are monotonically increasing. - */ -function memoizedBinarySearch(haystack, needle, state, key) { - const { lastKey, lastNeedle, lastIndex } = state; - let low = 0; - let high = haystack.length - 1; - if (key === lastKey) { - if (needle === lastNeedle) { - found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; - return lastIndex; - } - if (needle >= lastNeedle) { - // lastIndex may be -1 if the previous needle was not found. - low = lastIndex === -1 ? 0 : lastIndex; - } - else { - high = lastIndex; - } - } - state.lastKey = key; - state.lastNeedle = needle; - return (state.lastIndex = binarySearch(haystack, needle, low, high)); -} - -// Rebuilds the original source files, with mappings that are ordered by source line/column instead -// of generated line/column. -function buildBySources(decoded, memos) { - const sources = memos.map(buildNullArray); - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - if (seg.length === 1) - continue; - const sourceIndex = seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - const originalSource = sources[sourceIndex]; - const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = [])); - const memo = memos[sourceIndex]; - // The binary search either found a match, or it found the left-index just before where the - // segment should go. Either way, we want to insert after that. And there may be multiple - // generated segments associated with an original location, so there may need to move several - // indexes before we find where we need to insert. - const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine)); - insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]); - } - } - return sources; -} -function insert(array, index, value) { - for (let i = array.length; i > index; i--) { - array[i] = array[i - 1]; - } - array[index] = value; -} -// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like -// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations. -// Numeric properties on objects are magically sorted in ascending order by the engine regardless of -// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending -// order when iterating with for-in. -function buildNullArray() { - return { __proto__: null }; -} - -const AnyMap = function (map, mapUrl) { - const parsed = typeof map === 'string' ? JSON.parse(map) : map; - if (!('sections' in parsed)) - return new TraceMap(parsed, mapUrl); - const mappings = []; - const sources = []; - const sourcesContent = []; - const names = []; - recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, 0, 0, Infinity, Infinity); - const joined = { - version: 3, - file: parsed.file, - names, - sources, - sourcesContent, - mappings, - }; - return presortedDecodedMap(joined); -}; -function recurse(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { - const { sections } = input; - for (let i = 0; i < sections.length; i++) { - const { map, offset } = sections[i]; - let sl = stopLine; - let sc = stopColumn; - if (i + 1 < sections.length) { - const nextOffset = sections[i + 1].offset; - sl = Math.min(stopLine, lineOffset + nextOffset.line); - if (sl === stopLine) { - sc = Math.min(stopColumn, columnOffset + nextOffset.column); - } - else if (sl < stopLine) { - sc = columnOffset + nextOffset.column; - } - } - addSection(map, mapUrl, mappings, sources, sourcesContent, names, lineOffset + offset.line, columnOffset + offset.column, sl, sc); - } -} -function addSection(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { - if ('sections' in input) - return recurse(...arguments); - const map = new TraceMap(input, mapUrl); - const sourcesOffset = sources.length; - const namesOffset = names.length; - const decoded = decodedMappings(map); - const { resolvedSources, sourcesContent: contents } = map; - append(sources, resolvedSources); - append(names, map.names); - if (contents) - append(sourcesContent, contents); - else - for (let i = 0; i < resolvedSources.length; i++) - sourcesContent.push(null); - for (let i = 0; i < decoded.length; i++) { - const lineI = lineOffset + i; - // We can only add so many lines before we step into the range that the next section's map - // controls. When we get to the last line, then we'll start checking the segments to see if - // they've crossed into the column range. But it may not have any columns that overstep, so we - // still need to check that we don't overstep lines, too. - if (lineI > stopLine) - return; - // The out line may already exist in mappings (if we're continuing the line started by a - // previous section). Or, we may have jumped ahead several lines to start this section. - const out = getLine(mappings, lineI); - // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the - // map can be multiple lines), it doesn't. - const cOffset = i === 0 ? columnOffset : 0; - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const column = cOffset + seg[COLUMN]; - // If this segment steps into the column range that the next section's map controls, we need - // to stop early. - if (lineI === stopLine && column >= stopColumn) - return; - if (seg.length === 1) { - out.push([column]); - continue; - } - const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - out.push(seg.length === 4 - ? [column, sourcesIndex, sourceLine, sourceColumn] - : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]); - } - } -} -function append(arr, other) { - for (let i = 0; i < other.length; i++) - arr.push(other[i]); -} -function getLine(arr, index) { - for (let i = arr.length; i <= index; i++) - arr[i] = []; - return arr[index]; -} - -const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; -const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; -const LEAST_UPPER_BOUND = -1; -const GREATEST_LOWER_BOUND = 1; -/** - * Returns the encoded (VLQ string) form of the SourceMap's mappings field. - */ -let encodedMappings; -/** - * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. - */ -let decodedMappings; -/** - * A low-level API to find the segment associated with a generated line/column (think, from a - * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. - */ -let traceSegment; -/** - * A higher-level API to find the source/line/column associated with a generated line/column - * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in - * `source-map` library. - */ -let originalPositionFor; -/** - * Finds the generated line/column position of the provided source/line/column source position. - */ -let generatedPositionFor; -/** - * Finds all generated line/column positions of the provided source/line/column source position. - */ -let allGeneratedPositionsFor; -/** - * Iterates each mapping in generated position order. - */ -let eachMapping; -/** - * Retrieves the source content for a particular source, if its found. Returns null if not. - */ -let sourceContentFor; -/** - * A helper that skips sorting of the input map's mappings array, which can be expensive for larger - * maps. - */ -let presortedDecodedMap; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -let decodedMap; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -let encodedMap; -class TraceMap { - constructor(map, mapUrl) { - const isString = typeof map === 'string'; - if (!isString && map._decodedMemo) - return map; - const parsed = (isString ? JSON.parse(map) : map); - const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; - this.version = version; - this.file = file; - this.names = names; - this.sourceRoot = sourceRoot; - this.sources = sources; - this.sourcesContent = sourcesContent; - const from = resolve(sourceRoot || '', stripFilename(mapUrl)); - this.resolvedSources = sources.map((s) => resolve(s || '', from)); - const { mappings } = parsed; - if (typeof mappings === 'string') { - this._encoded = mappings; - this._decoded = undefined; - } - else { - this._encoded = undefined; - this._decoded = maybeSort(mappings, isString); - } - this._decodedMemo = memoizedState(); - this._bySources = undefined; - this._bySourceMemos = undefined; - } -} -(() => { - encodedMappings = (map) => { - var _a; - return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = encode(map._decoded))); - }; - decodedMappings = (map) => { - return (map._decoded || (map._decoded = decode(map._encoded))); - }; - traceSegment = (map, line, column) => { - const decoded = decodedMappings(map); - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) - return null; - const segments = decoded[line]; - const index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND); - return index === -1 ? null : segments[index]; - }; - originalPositionFor = (map, { line, column, bias }) => { - line--; - if (line < 0) - throw new Error(LINE_GTR_ZERO); - if (column < 0) - throw new Error(COL_GTR_EQ_ZERO); - const decoded = decodedMappings(map); - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) - return OMapping(null, null, null, null); - const segments = decoded[line]; - const index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); - if (index === -1) - return OMapping(null, null, null, null); - const segment = segments[index]; - if (segment.length === 1) - return OMapping(null, null, null, null); - const { names, resolvedSources } = map; - return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null); - }; - allGeneratedPositionsFor = (map, { source, line, column, bias }) => { - // SourceMapConsumer uses LEAST_UPPER_BOUND for some reason, so we follow suit. - return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true); - }; - generatedPositionFor = (map, { source, line, column, bias }) => { - return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false); - }; - eachMapping = (map, cb) => { - const decoded = decodedMappings(map); - const { names, resolvedSources } = map; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generatedLine = i + 1; - const generatedColumn = seg[0]; - let source = null; - let originalLine = null; - let originalColumn = null; - let name = null; - if (seg.length !== 1) { - source = resolvedSources[seg[1]]; - originalLine = seg[2] + 1; - originalColumn = seg[3]; - } - if (seg.length === 5) - name = names[seg[4]]; - cb({ - generatedLine, - generatedColumn, - source, - originalLine, - originalColumn, - name, - }); - } - } - }; - sourceContentFor = (map, source) => { - const { sources, resolvedSources, sourcesContent } = map; - if (sourcesContent == null) - return null; - let index = sources.indexOf(source); - if (index === -1) - index = resolvedSources.indexOf(source); - return index === -1 ? null : sourcesContent[index]; - }; - presortedDecodedMap = (map, mapUrl) => { - const tracer = new TraceMap(clone(map, []), mapUrl); - tracer._decoded = map.mappings; - return tracer; - }; - decodedMap = (map) => { - return clone(map, decodedMappings(map)); - }; - encodedMap = (map) => { - return clone(map, encodedMappings(map)); - }; - function generatedPosition(map, source, line, column, bias, all) { - line--; - if (line < 0) - throw new Error(LINE_GTR_ZERO); - if (column < 0) - throw new Error(COL_GTR_EQ_ZERO); - const { sources, resolvedSources } = map; - let sourceIndex = sources.indexOf(source); - if (sourceIndex === -1) - sourceIndex = resolvedSources.indexOf(source); - if (sourceIndex === -1) - return all ? [] : GMapping(null, null); - const generated = (map._bySources || (map._bySources = buildBySources(decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState))))); - const segments = generated[sourceIndex][line]; - if (segments == null) - return all ? [] : GMapping(null, null); - const memo = map._bySourceMemos[sourceIndex]; - if (all) - return sliceGeneratedPositions(segments, memo, line, column, bias); - const index = traceSegmentInternal(segments, memo, line, column, bias); - if (index === -1) - return GMapping(null, null); - const segment = segments[index]; - return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]); - } -})(); -function clone(map, mappings) { - return { - version: map.version, - file: map.file, - names: map.names, - sourceRoot: map.sourceRoot, - sources: map.sources, - sourcesContent: map.sourcesContent, - mappings, - }; -} -function OMapping(source, line, column, name) { - return { source, line, column, name }; -} -function GMapping(line, column) { - return { line, column }; -} -function traceSegmentInternal(segments, memo, line, column, bias) { - let index = memoizedBinarySearch(segments, column, memo, line); - if (found) { - index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); - } - else if (bias === LEAST_UPPER_BOUND) - index++; - if (index === -1 || index === segments.length) - return -1; - return index; -} -function sliceGeneratedPositions(segments, memo, line, column, bias) { - let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND); - // We ignored the bias when tracing the segment so that we're guarnateed to find the first (in - // insertion order) segment that matched. Even if we did respect the bias when tracing, we would - // still need to call `lowerBound()` to find the first segment, which is slower than just looking - // for the GREATEST_LOWER_BOUND to begin with. The only difference that matters for us is when the - // binary search didn't match, in which case GREATEST_LOWER_BOUND just needs to increment to - // match LEAST_UPPER_BOUND. - if (!found && bias === LEAST_UPPER_BOUND) - min++; - if (min === -1 || min === segments.length) - return []; - // We may have found the segment that started at an earlier column. If this is the case, then we - // need to slice all generated segments that match _that_ column, because all such segments span - // to our desired column. - const matchedColumn = found ? column : segments[min][COLUMN]; - // The binary search is not guaranteed to find the lower bound when a match wasn't found. - if (!found) - min = lowerBound(segments, matchedColumn, min); - const max = upperBound(segments, matchedColumn, min); - const result = []; - for (; min <= max; min++) { - const segment = segments[min]; - result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN])); - } - return result; -} - -export { AnyMap, GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap, allGeneratedPositionsFor, decodedMap, decodedMappings, eachMapping, encodedMap, encodedMappings, generatedPositionFor, originalPositionFor, presortedDecodedMap, sourceContentFor, traceSegment }; -//# sourceMappingURL=trace-mapping.mjs.map diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map deleted file mode 100644 index 4d40aa13f..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace-mapping.mjs","sources":["../src/resolve.ts","../src/strip-filename.ts","../src/sourcemap-segment.ts","../src/sort.ts","../src/binary-search.ts","../src/by-source.ts","../src/any-map.ts","../src/trace-mapping.ts"],"sourcesContent":["import resolveUri from '@jridgewell/resolve-uri';\n\nexport default function resolve(input: string, base: string | undefined): string {\n // The base is always treated as a directory, if it's not empty.\n // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327\n // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401\n if (base && !base.endsWith('/')) base += '/';\n\n return resolveUri(input, base);\n}\n","/**\n * Removes everything after the last \"/\", but leaves the slash.\n */\nexport default function stripFilename(path: string | undefined | null): string {\n if (!path) return '';\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n","type GeneratedColumn = number;\ntype SourcesIndex = number;\ntype SourceLine = number;\ntype SourceColumn = number;\ntype NamesIndex = number;\n\ntype GeneratedLine = number;\n\nexport type SourceMapSegment =\n | [GeneratedColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];\n\nexport type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn];\n\nexport const COLUMN = 0;\nexport const SOURCES_INDEX = 1;\nexport const SOURCE_LINE = 2;\nexport const SOURCE_COLUMN = 3;\nexport const NAMES_INDEX = 4;\n\nexport const REV_GENERATED_LINE = 1;\nexport const REV_GENERATED_COLUMN = 2;\n","import { COLUMN } from './sourcemap-segment';\n\nimport type { SourceMapSegment } from './sourcemap-segment';\n\nexport default function maybeSort(\n mappings: SourceMapSegment[][],\n owned: boolean,\n): SourceMapSegment[][] {\n const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);\n if (unsortedIndex === mappings.length) return mappings;\n\n // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If\n // not, we do not want to modify the consumer's input array.\n if (!owned) mappings = mappings.slice();\n\n for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {\n mappings[i] = sortSegments(mappings[i], owned);\n }\n return mappings;\n}\n\nfunction nextUnsortedSegmentLine(mappings: SourceMapSegment[][], start: number): number {\n for (let i = start; i < mappings.length; i++) {\n if (!isSorted(mappings[i])) return i;\n }\n return mappings.length;\n}\n\nfunction isSorted(line: SourceMapSegment[]): boolean {\n for (let j = 1; j < line.length; j++) {\n if (line[j][COLUMN] < line[j - 1][COLUMN]) {\n return false;\n }\n }\n return true;\n}\n\nfunction sortSegments(line: SourceMapSegment[], owned: boolean): SourceMapSegment[] {\n if (!owned) line = line.slice();\n return line.sort(sortComparator);\n}\n\nfunction sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {\n return a[COLUMN] - b[COLUMN];\n}\n","import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment';\nimport { COLUMN } from './sourcemap-segment';\n\nexport type MemoState = {\n lastKey: number;\n lastNeedle: number;\n lastIndex: number;\n};\n\nexport let found = false;\n\n/**\n * A binary search implementation that returns the index if a match is found.\n * If no match is found, then the left-index (the index associated with the item that comes just\n * before the desired index) is returned. To maintain proper sort order, a splice would happen at\n * the next index:\n *\n * ```js\n * const array = [1, 3];\n * const needle = 2;\n * const index = binarySearch(array, needle, (item, needle) => item - needle);\n *\n * assert.equal(index, 0);\n * array.splice(index + 1, 0, needle);\n * assert.deepEqual(array, [1, 2, 3]);\n * ```\n */\nexport function binarySearch(\n haystack: SourceMapSegment[] | ReverseSegment[],\n needle: number,\n low: number,\n high: number,\n): number {\n while (low <= high) {\n const mid = low + ((high - low) >> 1);\n const cmp = haystack[mid][COLUMN] - needle;\n\n if (cmp === 0) {\n found = true;\n return mid;\n }\n\n if (cmp < 0) {\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n\n found = false;\n return low - 1;\n}\n\nexport function upperBound(\n haystack: SourceMapSegment[] | ReverseSegment[],\n needle: number,\n index: number,\n): number {\n for (let i = index + 1; i < haystack.length; index = i++) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\n\nexport function lowerBound(\n haystack: SourceMapSegment[] | ReverseSegment[],\n needle: number,\n index: number,\n): number {\n for (let i = index - 1; i >= 0; index = i--) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\n\nexport function memoizedState(): MemoState {\n return {\n lastKey: -1,\n lastNeedle: -1,\n lastIndex: -1,\n };\n}\n\n/**\n * This overly complicated beast is just to record the last tested line/column and the resulting\n * index, allowing us to skip a few tests if mappings are monotonically increasing.\n */\nexport function memoizedBinarySearch(\n haystack: SourceMapSegment[] | ReverseSegment[],\n needle: number,\n state: MemoState,\n key: number,\n): number {\n const { lastKey, lastNeedle, lastIndex } = state;\n\n let low = 0;\n let high = haystack.length - 1;\n if (key === lastKey) {\n if (needle === lastNeedle) {\n found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;\n return lastIndex;\n }\n\n if (needle >= lastNeedle) {\n // lastIndex may be -1 if the previous needle was not found.\n low = lastIndex === -1 ? 0 : lastIndex;\n } else {\n high = lastIndex;\n }\n }\n state.lastKey = key;\n state.lastNeedle = needle;\n\n return (state.lastIndex = binarySearch(haystack, needle, low, high));\n}\n","import { COLUMN, SOURCES_INDEX, SOURCE_LINE, SOURCE_COLUMN } from './sourcemap-segment';\nimport { memoizedBinarySearch, upperBound } from './binary-search';\n\nimport type { ReverseSegment, SourceMapSegment } from './sourcemap-segment';\nimport type { MemoState } from './binary-search';\n\nexport type Source = {\n __proto__: null;\n [line: number]: Exclude[];\n};\n\n// Rebuilds the original source files, with mappings that are ordered by source line/column instead\n// of generated line/column.\nexport default function buildBySources(\n decoded: readonly SourceMapSegment[][],\n memos: MemoState[],\n): Source[] {\n const sources: Source[] = memos.map(buildNullArray);\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n if (seg.length === 1) continue;\n\n const sourceIndex = seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n const originalSource = sources[sourceIndex];\n const originalLine = (originalSource[sourceLine] ||= []);\n const memo = memos[sourceIndex];\n\n // The binary search either found a match, or it found the left-index just before where the\n // segment should go. Either way, we want to insert after that. And there may be multiple\n // generated segments associated with an original location, so there may need to move several\n // indexes before we find where we need to insert.\n const index = upperBound(\n originalLine,\n sourceColumn,\n memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine),\n );\n\n insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);\n }\n }\n\n return sources;\n}\n\nfunction insert(array: T[], index: number, value: T) {\n for (let i = array.length; i > index; i--) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n}\n\n// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like\n// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations.\n// Numeric properties on objects are magically sorted in ascending order by the engine regardless of\n// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending\n// order when iterating with for-in.\nfunction buildNullArray(): T {\n return { __proto__: null } as T;\n}\n","import { TraceMap, presortedDecodedMap, decodedMappings } from './trace-mapping';\nimport {\n COLUMN,\n SOURCES_INDEX,\n SOURCE_LINE,\n SOURCE_COLUMN,\n NAMES_INDEX,\n} from './sourcemap-segment';\n\nimport type {\n Section,\n SectionedSourceMap,\n DecodedSourceMap,\n SectionedSourceMapInput,\n Ro,\n} from './types';\nimport type { SourceMapSegment } from './sourcemap-segment';\n\ntype AnyMap = {\n new (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;\n (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;\n};\n\nexport const AnyMap: AnyMap = function (map, mapUrl) {\n const parsed =\n typeof map === 'string' ? (JSON.parse(map) as Exclude) : map;\n\n if (!('sections' in parsed)) return new TraceMap(parsed, mapUrl);\n\n const mappings: SourceMapSegment[][] = [];\n const sources: string[] = [];\n const sourcesContent: (string | null)[] = [];\n const names: string[] = [];\n\n recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, 0, 0, Infinity, Infinity);\n\n const joined: DecodedSourceMap = {\n version: 3,\n file: parsed.file,\n names,\n sources,\n sourcesContent,\n mappings,\n };\n\n return presortedDecodedMap(joined);\n} as AnyMap;\n\nfunction recurse(\n input: Ro,\n mapUrl: string | null | undefined,\n mappings: SourceMapSegment[][],\n sources: string[],\n sourcesContent: (string | null)[],\n names: string[],\n lineOffset: number,\n columnOffset: number,\n stopLine: number,\n stopColumn: number,\n) {\n const { sections } = input;\n for (let i = 0; i < sections.length; i++) {\n const { map, offset } = sections[i];\n\n let sl = stopLine;\n let sc = stopColumn;\n if (i + 1 < sections.length) {\n const nextOffset = sections[i + 1].offset;\n sl = Math.min(stopLine, lineOffset + nextOffset.line);\n\n if (sl === stopLine) {\n sc = Math.min(stopColumn, columnOffset + nextOffset.column);\n } else if (sl < stopLine) {\n sc = columnOffset + nextOffset.column;\n }\n }\n\n addSection(\n map,\n mapUrl,\n mappings,\n sources,\n sourcesContent,\n names,\n lineOffset + offset.line,\n columnOffset + offset.column,\n sl,\n sc,\n );\n }\n}\n\nfunction addSection(\n input: Ro,\n mapUrl: string | null | undefined,\n mappings: SourceMapSegment[][],\n sources: string[],\n sourcesContent: (string | null)[],\n names: string[],\n lineOffset: number,\n columnOffset: number,\n stopLine: number,\n stopColumn: number,\n) {\n if ('sections' in input) return recurse(...(arguments as unknown as Parameters));\n\n const map = new TraceMap(input, mapUrl);\n const sourcesOffset = sources.length;\n const namesOffset = names.length;\n const decoded = decodedMappings(map);\n const { resolvedSources, sourcesContent: contents } = map;\n\n append(sources, resolvedSources);\n append(names, map.names);\n if (contents) append(sourcesContent, contents);\n else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);\n\n for (let i = 0; i < decoded.length; i++) {\n const lineI = lineOffset + i;\n\n // We can only add so many lines before we step into the range that the next section's map\n // controls. When we get to the last line, then we'll start checking the segments to see if\n // they've crossed into the column range. But it may not have any columns that overstep, so we\n // still need to check that we don't overstep lines, too.\n if (lineI > stopLine) return;\n\n // The out line may already exist in mappings (if we're continuing the line started by a\n // previous section). Or, we may have jumped ahead several lines to start this section.\n const out = getLine(mappings, lineI);\n // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the\n // map can be multiple lines), it doesn't.\n const cOffset = i === 0 ? columnOffset : 0;\n\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n const column = cOffset + seg[COLUMN];\n\n // If this segment steps into the column range that the next section's map controls, we need\n // to stop early.\n if (lineI === stopLine && column >= stopColumn) return;\n\n if (seg.length === 1) {\n out.push([column]);\n continue;\n }\n\n const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n out.push(\n seg.length === 4\n ? [column, sourcesIndex, sourceLine, sourceColumn]\n : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]],\n );\n }\n }\n}\n\nfunction append(arr: T[], other: T[]) {\n for (let i = 0; i < other.length; i++) arr.push(other[i]);\n}\n\nfunction getLine(arr: T[][], index: number): T[] {\n for (let i = arr.length; i <= index; i++) arr[i] = [];\n return arr[index];\n}\n","import { encode, decode } from '@jridgewell/sourcemap-codec';\n\nimport resolve from './resolve';\nimport stripFilename from './strip-filename';\nimport maybeSort from './sort';\nimport buildBySources from './by-source';\nimport {\n memoizedState,\n memoizedBinarySearch,\n upperBound,\n lowerBound,\n found as bsFound,\n} from './binary-search';\nimport {\n COLUMN,\n SOURCES_INDEX,\n SOURCE_LINE,\n SOURCE_COLUMN,\n NAMES_INDEX,\n REV_GENERATED_LINE,\n REV_GENERATED_COLUMN,\n} from './sourcemap-segment';\n\nimport type { SourceMapSegment, ReverseSegment } from './sourcemap-segment';\nimport type {\n SourceMapV3,\n DecodedSourceMap,\n EncodedSourceMap,\n InvalidOriginalMapping,\n OriginalMapping,\n InvalidGeneratedMapping,\n GeneratedMapping,\n SourceMapInput,\n Needle,\n SourceNeedle,\n SourceMap,\n EachMapping,\n Bias,\n} from './types';\nimport type { Source } from './by-source';\nimport type { MemoState } from './binary-search';\n\nexport type { SourceMapSegment } from './sourcemap-segment';\nexport type {\n SourceMapInput,\n SectionedSourceMapInput,\n DecodedSourceMap,\n EncodedSourceMap,\n SectionedSourceMap,\n InvalidOriginalMapping,\n OriginalMapping as Mapping,\n OriginalMapping,\n InvalidGeneratedMapping,\n GeneratedMapping,\n EachMapping,\n} from './types';\n\nconst LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';\nconst COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';\n\nexport const LEAST_UPPER_BOUND = -1;\nexport const GREATEST_LOWER_BOUND = 1;\n\n/**\n * Returns the encoded (VLQ string) form of the SourceMap's mappings field.\n */\nexport let encodedMappings: (map: TraceMap) => EncodedSourceMap['mappings'];\n\n/**\n * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.\n */\nexport let decodedMappings: (map: TraceMap) => Readonly;\n\n/**\n * A low-level API to find the segment associated with a generated line/column (think, from a\n * stack trace). Line and column here are 0-based, unlike `originalPositionFor`.\n */\nexport let traceSegment: (\n map: TraceMap,\n line: number,\n column: number,\n) => Readonly | null;\n\n/**\n * A higher-level API to find the source/line/column associated with a generated line/column\n * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in\n * `source-map` library.\n */\nexport let originalPositionFor: (\n map: TraceMap,\n needle: Needle,\n) => OriginalMapping | InvalidOriginalMapping;\n\n/**\n * Finds the generated line/column position of the provided source/line/column source position.\n */\nexport let generatedPositionFor: (\n map: TraceMap,\n needle: SourceNeedle,\n) => GeneratedMapping | InvalidGeneratedMapping;\n\n/**\n * Finds all generated line/column positions of the provided source/line/column source position.\n */\nexport let allGeneratedPositionsFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping[];\n\n/**\n * Iterates each mapping in generated position order.\n */\nexport let eachMapping: (map: TraceMap, cb: (mapping: EachMapping) => void) => void;\n\n/**\n * Retrieves the source content for a particular source, if its found. Returns null if not.\n */\nexport let sourceContentFor: (map: TraceMap, source: string) => string | null;\n\n/**\n * A helper that skips sorting of the input map's mappings array, which can be expensive for larger\n * maps.\n */\nexport let presortedDecodedMap: (map: DecodedSourceMap, mapUrl?: string) => TraceMap;\n\n/**\n * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let decodedMap: (\n map: TraceMap,\n) => Omit & { mappings: readonly SourceMapSegment[][] };\n\n/**\n * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let encodedMap: (map: TraceMap) => EncodedSourceMap;\n\nexport { AnyMap } from './any-map';\n\nexport class TraceMap implements SourceMap {\n declare version: SourceMapV3['version'];\n declare file: SourceMapV3['file'];\n declare names: SourceMapV3['names'];\n declare sourceRoot: SourceMapV3['sourceRoot'];\n declare sources: SourceMapV3['sources'];\n declare sourcesContent: SourceMapV3['sourcesContent'];\n\n declare resolvedSources: string[];\n private declare _encoded: string | undefined;\n\n private declare _decoded: SourceMapSegment[][] | undefined;\n private declare _decodedMemo: MemoState;\n\n private declare _bySources: Source[] | undefined;\n private declare _bySourceMemos: MemoState[] | undefined;\n\n constructor(map: SourceMapInput, mapUrl?: string | null) {\n const isString = typeof map === 'string';\n\n if (!isString && (map as unknown as { _decodedMemo: any })._decodedMemo) return map as TraceMap;\n\n const parsed = (isString ? JSON.parse(map) : map) as DecodedSourceMap | EncodedSourceMap;\n\n const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;\n this.version = version;\n this.file = file;\n this.names = names;\n this.sourceRoot = sourceRoot;\n this.sources = sources;\n this.sourcesContent = sourcesContent;\n\n const from = resolve(sourceRoot || '', stripFilename(mapUrl));\n this.resolvedSources = sources.map((s) => resolve(s || '', from));\n\n const { mappings } = parsed;\n if (typeof mappings === 'string') {\n this._encoded = mappings;\n this._decoded = undefined;\n } else {\n this._encoded = undefined;\n this._decoded = maybeSort(mappings, isString);\n }\n\n this._decodedMemo = memoizedState();\n this._bySources = undefined;\n this._bySourceMemos = undefined;\n }\n\n static {\n encodedMappings = (map) => {\n return (map._encoded ??= encode(map._decoded!));\n };\n\n decodedMappings = (map) => {\n return (map._decoded ||= decode(map._encoded!));\n };\n\n traceSegment = (map, line, column) => {\n const decoded = decodedMappings(map);\n\n // It's common for parent source maps to have pointers to lines that have no\n // mapping (like a \"//# sourceMappingURL=\") at the end of the child file.\n if (line >= decoded.length) return null;\n\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n map._decodedMemo,\n line,\n column,\n GREATEST_LOWER_BOUND,\n );\n\n return index === -1 ? null : segments[index];\n };\n\n originalPositionFor = (map, { line, column, bias }) => {\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n\n const decoded = decodedMappings(map);\n\n // It's common for parent source maps to have pointers to lines that have no\n // mapping (like a \"//# sourceMappingURL=\") at the end of the child file.\n if (line >= decoded.length) return OMapping(null, null, null, null);\n\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n map._decodedMemo,\n line,\n column,\n bias || GREATEST_LOWER_BOUND,\n );\n\n if (index === -1) return OMapping(null, null, null, null);\n\n const segment = segments[index];\n if (segment.length === 1) return OMapping(null, null, null, null);\n\n const { names, resolvedSources } = map;\n return OMapping(\n resolvedSources[segment[SOURCES_INDEX]],\n segment[SOURCE_LINE] + 1,\n segment[SOURCE_COLUMN],\n segment.length === 5 ? names[segment[NAMES_INDEX]] : null,\n );\n };\n\n allGeneratedPositionsFor = (map, { source, line, column, bias }) => {\n // SourceMapConsumer uses LEAST_UPPER_BOUND for some reason, so we follow suit.\n return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);\n };\n\n generatedPositionFor = (map, { source, line, column, bias }) => {\n return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);\n };\n\n eachMapping = (map, cb) => {\n const decoded = decodedMappings(map);\n const { names, resolvedSources } = map;\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n\n const generatedLine = i + 1;\n const generatedColumn = seg[0];\n let source = null;\n let originalLine = null;\n let originalColumn = null;\n let name = null;\n if (seg.length !== 1) {\n source = resolvedSources[seg[1]];\n originalLine = seg[2] + 1;\n originalColumn = seg[3];\n }\n if (seg.length === 5) name = names[seg[4]];\n\n cb({\n generatedLine,\n generatedColumn,\n source,\n originalLine,\n originalColumn,\n name,\n } as EachMapping);\n }\n }\n };\n\n sourceContentFor = (map, source) => {\n const { sources, resolvedSources, sourcesContent } = map;\n if (sourcesContent == null) return null;\n\n let index = sources.indexOf(source);\n if (index === -1) index = resolvedSources.indexOf(source);\n\n return index === -1 ? null : sourcesContent[index];\n };\n\n presortedDecodedMap = (map, mapUrl) => {\n const tracer = new TraceMap(clone(map, []), mapUrl);\n tracer._decoded = map.mappings;\n return tracer;\n };\n\n decodedMap = (map) => {\n return clone(map, decodedMappings(map));\n };\n\n encodedMap = (map) => {\n return clone(map, encodedMappings(map));\n };\n\n function generatedPosition(\n map: TraceMap,\n source: string,\n line: number,\n column: number,\n bias: Bias,\n all: false,\n ): GeneratedMapping | InvalidGeneratedMapping;\n function generatedPosition(\n map: TraceMap,\n source: string,\n line: number,\n column: number,\n bias: Bias,\n all: true,\n ): GeneratedMapping[];\n function generatedPosition(\n map: TraceMap,\n source: string,\n line: number,\n column: number,\n bias: Bias,\n all: boolean,\n ): GeneratedMapping | InvalidGeneratedMapping | GeneratedMapping[] {\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n\n const { sources, resolvedSources } = map;\n let sourceIndex = sources.indexOf(source);\n if (sourceIndex === -1) sourceIndex = resolvedSources.indexOf(source);\n if (sourceIndex === -1) return all ? [] : GMapping(null, null);\n\n const generated = (map._bySources ||= buildBySources(\n decodedMappings(map),\n (map._bySourceMemos = sources.map(memoizedState)),\n ));\n\n const segments = generated[sourceIndex][line];\n if (segments == null) return all ? [] : GMapping(null, null);\n\n const memo = map._bySourceMemos![sourceIndex];\n\n if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);\n\n const index = traceSegmentInternal(segments, memo, line, column, bias);\n if (index === -1) return GMapping(null, null);\n\n const segment = segments[index];\n return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);\n }\n }\n}\n\nfunction clone(\n map: TraceMap | DecodedSourceMap | EncodedSourceMap,\n mappings: T,\n): T extends string ? EncodedSourceMap : DecodedSourceMap {\n return {\n version: map.version,\n file: map.file,\n names: map.names,\n sourceRoot: map.sourceRoot,\n sources: map.sources,\n sourcesContent: map.sourcesContent,\n mappings,\n } as any;\n}\n\nfunction OMapping(source: null, line: null, column: null, name: null): InvalidOriginalMapping;\nfunction OMapping(\n source: string,\n line: number,\n column: number,\n name: string | null,\n): OriginalMapping;\nfunction OMapping(\n source: string | null,\n line: number | null,\n column: number | null,\n name: string | null,\n): OriginalMapping | InvalidOriginalMapping {\n return { source, line, column, name } as any;\n}\n\nfunction GMapping(line: null, column: null): InvalidGeneratedMapping;\nfunction GMapping(line: number, column: number): GeneratedMapping;\nfunction GMapping(\n line: number | null,\n column: number | null,\n): GeneratedMapping | InvalidGeneratedMapping {\n return { line, column } as any;\n}\n\nfunction traceSegmentInternal(\n segments: SourceMapSegment[],\n memo: MemoState,\n line: number,\n column: number,\n bias: Bias,\n): number;\nfunction traceSegmentInternal(\n segments: ReverseSegment[],\n memo: MemoState,\n line: number,\n column: number,\n bias: Bias,\n): number;\nfunction traceSegmentInternal(\n segments: SourceMapSegment[] | ReverseSegment[],\n memo: MemoState,\n line: number,\n column: number,\n bias: Bias,\n): number {\n let index = memoizedBinarySearch(segments, column, memo, line);\n if (bsFound) {\n index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);\n } else if (bias === LEAST_UPPER_BOUND) index++;\n\n if (index === -1 || index === segments.length) return -1;\n return index;\n}\n\nfunction sliceGeneratedPositions(\n segments: ReverseSegment[],\n memo: MemoState,\n line: number,\n column: number,\n bias: Bias,\n): GeneratedMapping[] {\n let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);\n\n // We ignored the bias when tracing the segment so that we're guarnateed to find the first (in\n // insertion order) segment that matched. Even if we did respect the bias when tracing, we would\n // still need to call `lowerBound()` to find the first segment, which is slower than just looking\n // for the GREATEST_LOWER_BOUND to begin with. The only difference that matters for us is when the\n // binary search didn't match, in which case GREATEST_LOWER_BOUND just needs to increment to\n // match LEAST_UPPER_BOUND.\n if (!bsFound && bias === LEAST_UPPER_BOUND) min++;\n\n if (min === -1 || min === segments.length) return [];\n\n // We may have found the segment that started at an earlier column. If this is the case, then we\n // need to slice all generated segments that match _that_ column, because all such segments span\n // to our desired column.\n const matchedColumn = bsFound ? column : segments[min][COLUMN];\n\n // The binary search is not guaranteed to find the lower bound when a match wasn't found.\n if (!bsFound) min = lowerBound(segments, matchedColumn, min);\n const max = upperBound(segments, matchedColumn, min);\n\n const result = [];\n for (; min <= max; min++) {\n const segment = segments[min];\n result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_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AA,OAAO,MAAM,CAAC;AAChB;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js deleted file mode 100644 index a3251f166..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +++ /dev/null @@ -1,566 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/sourcemap-codec'), require('@jridgewell/resolve-uri')) : - typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/sourcemap-codec', '@jridgewell/resolve-uri'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.traceMapping = {}, global.sourcemapCodec, global.resolveURI)); -})(this, (function (exports, sourcemapCodec, resolveUri) { 'use strict'; - - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - - var resolveUri__default = /*#__PURE__*/_interopDefaultLegacy(resolveUri); - - function resolve(input, base) { - // The base is always treated as a directory, if it's not empty. - // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327 - // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401 - if (base && !base.endsWith('/')) - base += '/'; - return resolveUri__default["default"](input, base); - } - - /** - * Removes everything after the last "/", but leaves the slash. - */ - function stripFilename(path) { - if (!path) - return ''; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); - } - - const COLUMN = 0; - const SOURCES_INDEX = 1; - const SOURCE_LINE = 2; - const SOURCE_COLUMN = 3; - const NAMES_INDEX = 4; - const REV_GENERATED_LINE = 1; - const REV_GENERATED_COLUMN = 2; - - function maybeSort(mappings, owned) { - const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); - if (unsortedIndex === mappings.length) - return mappings; - // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If - // not, we do not want to modify the consumer's input array. - if (!owned) - mappings = mappings.slice(); - for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { - mappings[i] = sortSegments(mappings[i], owned); - } - return mappings; - } - function nextUnsortedSegmentLine(mappings, start) { - for (let i = start; i < mappings.length; i++) { - if (!isSorted(mappings[i])) - return i; - } - return mappings.length; - } - function isSorted(line) { - for (let j = 1; j < line.length; j++) { - if (line[j][COLUMN] < line[j - 1][COLUMN]) { - return false; - } - } - return true; - } - function sortSegments(line, owned) { - if (!owned) - line = line.slice(); - return line.sort(sortComparator); - } - function sortComparator(a, b) { - return a[COLUMN] - b[COLUMN]; - } - - let found = false; - /** - * A binary search implementation that returns the index if a match is found. - * If no match is found, then the left-index (the index associated with the item that comes just - * before the desired index) is returned. To maintain proper sort order, a splice would happen at - * the next index: - * - * ```js - * const array = [1, 3]; - * const needle = 2; - * const index = binarySearch(array, needle, (item, needle) => item - needle); - * - * assert.equal(index, 0); - * array.splice(index + 1, 0, needle); - * assert.deepEqual(array, [1, 2, 3]); - * ``` - */ - function binarySearch(haystack, needle, low, high) { - while (low <= high) { - const mid = low + ((high - low) >> 1); - const cmp = haystack[mid][COLUMN] - needle; - if (cmp === 0) { - found = true; - return mid; - } - if (cmp < 0) { - low = mid + 1; - } - else { - high = mid - 1; - } - } - found = false; - return low - 1; - } - function upperBound(haystack, needle, index) { - for (let i = index + 1; i < haystack.length; index = i++) { - if (haystack[i][COLUMN] !== needle) - break; - } - return index; - } - function lowerBound(haystack, needle, index) { - for (let i = index - 1; i >= 0; index = i--) { - if (haystack[i][COLUMN] !== needle) - break; - } - return index; - } - function memoizedState() { - return { - lastKey: -1, - lastNeedle: -1, - lastIndex: -1, - }; - } - /** - * This overly complicated beast is just to record the last tested line/column and the resulting - * index, allowing us to skip a few tests if mappings are monotonically increasing. - */ - function memoizedBinarySearch(haystack, needle, state, key) { - const { lastKey, lastNeedle, lastIndex } = state; - let low = 0; - let high = haystack.length - 1; - if (key === lastKey) { - if (needle === lastNeedle) { - found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; - return lastIndex; - } - if (needle >= lastNeedle) { - // lastIndex may be -1 if the previous needle was not found. - low = lastIndex === -1 ? 0 : lastIndex; - } - else { - high = lastIndex; - } - } - state.lastKey = key; - state.lastNeedle = needle; - return (state.lastIndex = binarySearch(haystack, needle, low, high)); - } - - // Rebuilds the original source files, with mappings that are ordered by source line/column instead - // of generated line/column. - function buildBySources(decoded, memos) { - const sources = memos.map(buildNullArray); - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - if (seg.length === 1) - continue; - const sourceIndex = seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - const originalSource = sources[sourceIndex]; - const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = [])); - const memo = memos[sourceIndex]; - // The binary search either found a match, or it found the left-index just before where the - // segment should go. Either way, we want to insert after that. And there may be multiple - // generated segments associated with an original location, so there may need to move several - // indexes before we find where we need to insert. - const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine)); - insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]); - } - } - return sources; - } - function insert(array, index, value) { - for (let i = array.length; i > index; i--) { - array[i] = array[i - 1]; - } - array[index] = value; - } - // Null arrays allow us to use ordered index keys without actually allocating contiguous memory like - // a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations. - // Numeric properties on objects are magically sorted in ascending order by the engine regardless of - // the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending - // order when iterating with for-in. - function buildNullArray() { - return { __proto__: null }; - } - - const AnyMap = function (map, mapUrl) { - const parsed = typeof map === 'string' ? JSON.parse(map) : map; - if (!('sections' in parsed)) - return new TraceMap(parsed, mapUrl); - const mappings = []; - const sources = []; - const sourcesContent = []; - const names = []; - recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, 0, 0, Infinity, Infinity); - const joined = { - version: 3, - file: parsed.file, - names, - sources, - sourcesContent, - mappings, - }; - return exports.presortedDecodedMap(joined); - }; - function recurse(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { - const { sections } = input; - for (let i = 0; i < sections.length; i++) { - const { map, offset } = sections[i]; - let sl = stopLine; - let sc = stopColumn; - if (i + 1 < sections.length) { - const nextOffset = sections[i + 1].offset; - sl = Math.min(stopLine, lineOffset + nextOffset.line); - if (sl === stopLine) { - sc = Math.min(stopColumn, columnOffset + nextOffset.column); - } - else if (sl < stopLine) { - sc = columnOffset + nextOffset.column; - } - } - addSection(map, mapUrl, mappings, sources, sourcesContent, names, lineOffset + offset.line, columnOffset + offset.column, sl, sc); - } - } - function addSection(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { - if ('sections' in input) - return recurse(...arguments); - const map = new TraceMap(input, mapUrl); - const sourcesOffset = sources.length; - const namesOffset = names.length; - const decoded = exports.decodedMappings(map); - const { resolvedSources, sourcesContent: contents } = map; - append(sources, resolvedSources); - append(names, map.names); - if (contents) - append(sourcesContent, contents); - else - for (let i = 0; i < resolvedSources.length; i++) - sourcesContent.push(null); - for (let i = 0; i < decoded.length; i++) { - const lineI = lineOffset + i; - // We can only add so many lines before we step into the range that the next section's map - // controls. When we get to the last line, then we'll start checking the segments to see if - // they've crossed into the column range. But it may not have any columns that overstep, so we - // still need to check that we don't overstep lines, too. - if (lineI > stopLine) - return; - // The out line may already exist in mappings (if we're continuing the line started by a - // previous section). Or, we may have jumped ahead several lines to start this section. - const out = getLine(mappings, lineI); - // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the - // map can be multiple lines), it doesn't. - const cOffset = i === 0 ? columnOffset : 0; - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const column = cOffset + seg[COLUMN]; - // If this segment steps into the column range that the next section's map controls, we need - // to stop early. - if (lineI === stopLine && column >= stopColumn) - return; - if (seg.length === 1) { - out.push([column]); - continue; - } - const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - out.push(seg.length === 4 - ? [column, sourcesIndex, sourceLine, sourceColumn] - : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]); - } - } - } - function append(arr, other) { - for (let i = 0; i < other.length; i++) - arr.push(other[i]); - } - function getLine(arr, index) { - for (let i = arr.length; i <= index; i++) - arr[i] = []; - return arr[index]; - } - - const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; - const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; - const LEAST_UPPER_BOUND = -1; - const GREATEST_LOWER_BOUND = 1; - /** - * Returns the encoded (VLQ string) form of the SourceMap's mappings field. - */ - exports.encodedMappings = void 0; - /** - * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. - */ - exports.decodedMappings = void 0; - /** - * A low-level API to find the segment associated with a generated line/column (think, from a - * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. - */ - exports.traceSegment = void 0; - /** - * A higher-level API to find the source/line/column associated with a generated line/column - * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in - * `source-map` library. - */ - exports.originalPositionFor = void 0; - /** - * Finds the generated line/column position of the provided source/line/column source position. - */ - exports.generatedPositionFor = void 0; - /** - * Finds all generated line/column positions of the provided source/line/column source position. - */ - exports.allGeneratedPositionsFor = void 0; - /** - * Iterates each mapping in generated position order. - */ - exports.eachMapping = void 0; - /** - * Retrieves the source content for a particular source, if its found. Returns null if not. - */ - exports.sourceContentFor = void 0; - /** - * A helper that skips sorting of the input map's mappings array, which can be expensive for larger - * maps. - */ - exports.presortedDecodedMap = void 0; - /** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ - exports.decodedMap = void 0; - /** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ - exports.encodedMap = void 0; - class TraceMap { - constructor(map, mapUrl) { - const isString = typeof map === 'string'; - if (!isString && map._decodedMemo) - return map; - const parsed = (isString ? JSON.parse(map) : map); - const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; - this.version = version; - this.file = file; - this.names = names; - this.sourceRoot = sourceRoot; - this.sources = sources; - this.sourcesContent = sourcesContent; - const from = resolve(sourceRoot || '', stripFilename(mapUrl)); - this.resolvedSources = sources.map((s) => resolve(s || '', from)); - const { mappings } = parsed; - if (typeof mappings === 'string') { - this._encoded = mappings; - this._decoded = undefined; - } - else { - this._encoded = undefined; - this._decoded = maybeSort(mappings, isString); - } - this._decodedMemo = memoizedState(); - this._bySources = undefined; - this._bySourceMemos = undefined; - } - } - (() => { - exports.encodedMappings = (map) => { - var _a; - return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = sourcemapCodec.encode(map._decoded))); - }; - exports.decodedMappings = (map) => { - return (map._decoded || (map._decoded = sourcemapCodec.decode(map._encoded))); - }; - exports.traceSegment = (map, line, column) => { - const decoded = exports.decodedMappings(map); - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) - return null; - const segments = decoded[line]; - const index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND); - return index === -1 ? null : segments[index]; - }; - exports.originalPositionFor = (map, { line, column, bias }) => { - line--; - if (line < 0) - throw new Error(LINE_GTR_ZERO); - if (column < 0) - throw new Error(COL_GTR_EQ_ZERO); - const decoded = exports.decodedMappings(map); - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) - return OMapping(null, null, null, null); - const segments = decoded[line]; - const index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); - if (index === -1) - return OMapping(null, null, null, null); - const segment = segments[index]; - if (segment.length === 1) - return OMapping(null, null, null, null); - const { names, resolvedSources } = map; - return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null); - }; - exports.allGeneratedPositionsFor = (map, { source, line, column, bias }) => { - // SourceMapConsumer uses LEAST_UPPER_BOUND for some reason, so we follow suit. - return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true); - }; - exports.generatedPositionFor = (map, { source, line, column, bias }) => { - return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false); - }; - exports.eachMapping = (map, cb) => { - const decoded = exports.decodedMappings(map); - const { names, resolvedSources } = map; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generatedLine = i + 1; - const generatedColumn = seg[0]; - let source = null; - let originalLine = null; - let originalColumn = null; - let name = null; - if (seg.length !== 1) { - source = resolvedSources[seg[1]]; - originalLine = seg[2] + 1; - originalColumn = seg[3]; - } - if (seg.length === 5) - name = names[seg[4]]; - cb({ - generatedLine, - generatedColumn, - source, - originalLine, - originalColumn, - name, - }); - } - } - }; - exports.sourceContentFor = (map, source) => { - const { sources, resolvedSources, sourcesContent } = map; - if (sourcesContent == null) - return null; - let index = sources.indexOf(source); - if (index === -1) - index = resolvedSources.indexOf(source); - return index === -1 ? null : sourcesContent[index]; - }; - exports.presortedDecodedMap = (map, mapUrl) => { - const tracer = new TraceMap(clone(map, []), mapUrl); - tracer._decoded = map.mappings; - return tracer; - }; - exports.decodedMap = (map) => { - return clone(map, exports.decodedMappings(map)); - }; - exports.encodedMap = (map) => { - return clone(map, exports.encodedMappings(map)); - }; - function generatedPosition(map, source, line, column, bias, all) { - line--; - if (line < 0) - throw new Error(LINE_GTR_ZERO); - if (column < 0) - throw new Error(COL_GTR_EQ_ZERO); - const { sources, resolvedSources } = map; - let sourceIndex = sources.indexOf(source); - if (sourceIndex === -1) - sourceIndex = resolvedSources.indexOf(source); - if (sourceIndex === -1) - return all ? [] : GMapping(null, null); - const generated = (map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState))))); - const segments = generated[sourceIndex][line]; - if (segments == null) - return all ? [] : GMapping(null, null); - const memo = map._bySourceMemos[sourceIndex]; - if (all) - return sliceGeneratedPositions(segments, memo, line, column, bias); - const index = traceSegmentInternal(segments, memo, line, column, bias); - if (index === -1) - return GMapping(null, null); - const segment = segments[index]; - return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]); - } - })(); - function clone(map, mappings) { - return { - version: map.version, - file: map.file, - names: map.names, - sourceRoot: map.sourceRoot, - sources: map.sources, - sourcesContent: map.sourcesContent, - mappings, - }; - } - function OMapping(source, line, column, name) { - return { source, line, column, name }; - } - function GMapping(line, column) { - return { line, column }; - } - function traceSegmentInternal(segments, memo, line, column, bias) { - let index = memoizedBinarySearch(segments, column, memo, line); - if (found) { - index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); - } - else if (bias === LEAST_UPPER_BOUND) - index++; - if (index === -1 || index === segments.length) - return -1; - return index; - } - function sliceGeneratedPositions(segments, memo, line, column, bias) { - let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND); - // We ignored the bias when tracing the segment so that we're guarnateed to find the first (in - // insertion order) segment that matched. Even if we did respect the bias when tracing, we would - // still need to call `lowerBound()` to find the first segment, which is slower than just looking - // for the GREATEST_LOWER_BOUND to begin with. The only difference that matters for us is when the - // binary search didn't match, in which case GREATEST_LOWER_BOUND just needs to increment to - // match LEAST_UPPER_BOUND. - if (!found && bias === LEAST_UPPER_BOUND) - min++; - if (min === -1 || min === segments.length) - return []; - // We may have found the segment that started at an earlier column. If this is the case, then we - // need to slice all generated segments that match _that_ column, because all such segments span - // to our desired column. - const matchedColumn = found ? column : segments[min][COLUMN]; - // The binary search is not guaranteed to find the lower bound when a match wasn't found. - if (!found) - min = lowerBound(segments, matchedColumn, min); - const max = upperBound(segments, matchedColumn, min); - const result = []; - for (; min <= max; min++) { - const segment = segments[min]; - result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN])); - } - return result; - } - - exports.AnyMap = AnyMap; - exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND; - exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND; - exports.TraceMap = TraceMap; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); -//# sourceMappingURL=trace-mapping.umd.js.map diff --git a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map b/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map deleted file mode 100644 index fee12194c..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace-mapping.umd.js","sources":["../src/resolve.ts","../src/strip-filename.ts","../src/sourcemap-segment.ts","../src/sort.ts","../src/binary-search.ts","../src/by-source.ts","../src/any-map.ts","../src/trace-mapping.ts"],"sourcesContent":["import resolveUri from '@jridgewell/resolve-uri';\n\nexport default function resolve(input: string, base: string | undefined): string {\n // The base is always treated as a directory, if it's not empty.\n // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327\n // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401\n if (base && !base.endsWith('/')) base += '/';\n\n return resolveUri(input, base);\n}\n","/**\n * Removes everything after the last \"/\", but leaves the slash.\n */\nexport default function stripFilename(path: string | undefined | null): string {\n if (!path) return '';\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n","type GeneratedColumn = number;\ntype SourcesIndex = number;\ntype SourceLine = number;\ntype SourceColumn = number;\ntype NamesIndex = number;\n\ntype GeneratedLine = number;\n\nexport type SourceMapSegment =\n | [GeneratedColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];\n\nexport type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn];\n\nexport const COLUMN = 0;\nexport const SOURCES_INDEX = 1;\nexport const SOURCE_LINE = 2;\nexport const SOURCE_COLUMN = 3;\nexport const NAMES_INDEX = 4;\n\nexport const REV_GENERATED_LINE = 1;\nexport const REV_GENERATED_COLUMN = 2;\n","import { COLUMN } from './sourcemap-segment';\n\nimport type { SourceMapSegment } from './sourcemap-segment';\n\nexport default function maybeSort(\n mappings: SourceMapSegment[][],\n owned: boolean,\n): SourceMapSegment[][] {\n const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);\n if (unsortedIndex === mappings.length) return mappings;\n\n // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If\n // not, we do not want to modify the consumer's input array.\n if (!owned) mappings = mappings.slice();\n\n for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {\n mappings[i] = sortSegments(mappings[i], owned);\n }\n return mappings;\n}\n\nfunction nextUnsortedSegmentLine(mappings: SourceMapSegment[][], start: number): number {\n for (let i = start; i < mappings.length; i++) {\n if (!isSorted(mappings[i])) return i;\n }\n return mappings.length;\n}\n\nfunction isSorted(line: SourceMapSegment[]): boolean {\n for (let j = 1; j < line.length; j++) {\n if (line[j][COLUMN] < line[j - 1][COLUMN]) {\n return false;\n }\n }\n return true;\n}\n\nfunction sortSegments(line: SourceMapSegment[], owned: boolean): SourceMapSegment[] {\n if (!owned) line = line.slice();\n return line.sort(sortComparator);\n}\n\nfunction sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {\n return a[COLUMN] - b[COLUMN];\n}\n","import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment';\nimport { COLUMN } from './sourcemap-segment';\n\nexport type MemoState = {\n lastKey: number;\n lastNeedle: number;\n lastIndex: number;\n};\n\nexport let found = false;\n\n/**\n * A binary search implementation that returns the index if a match is found.\n * If no match is found, then the left-index (the index associated with the item that comes just\n * before the desired index) is returned. To maintain proper sort order, a splice would happen at\n * the next index:\n *\n * ```js\n * const array = [1, 3];\n * const needle = 2;\n * const index = binarySearch(array, needle, (item, needle) => item - needle);\n *\n * assert.equal(index, 0);\n * array.splice(index + 1, 0, needle);\n * assert.deepEqual(array, [1, 2, 3]);\n * ```\n */\nexport function binarySearch(\n haystack: SourceMapSegment[] | ReverseSegment[],\n needle: number,\n low: number,\n high: number,\n): number {\n while (low <= high) {\n const mid = low + ((high - low) >> 1);\n const cmp = haystack[mid][COLUMN] - needle;\n\n if (cmp === 0) {\n found = true;\n return mid;\n }\n\n if (cmp < 0) {\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n\n found = false;\n return low - 1;\n}\n\nexport function upperBound(\n haystack: SourceMapSegment[] | ReverseSegment[],\n needle: number,\n index: number,\n): number {\n for (let i = index + 1; i < haystack.length; index = i++) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\n\nexport function lowerBound(\n haystack: SourceMapSegment[] | ReverseSegment[],\n needle: number,\n index: number,\n): number {\n for (let i = index - 1; i >= 0; index = i--) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\n\nexport function memoizedState(): MemoState {\n return {\n lastKey: -1,\n lastNeedle: -1,\n lastIndex: -1,\n };\n}\n\n/**\n * This overly complicated beast is just to record the last tested line/column and the resulting\n * index, allowing us to skip a few tests if mappings are monotonically increasing.\n */\nexport function memoizedBinarySearch(\n haystack: SourceMapSegment[] | ReverseSegment[],\n needle: number,\n state: MemoState,\n key: number,\n): number {\n const { lastKey, lastNeedle, lastIndex } = state;\n\n let low = 0;\n let high = haystack.length - 1;\n if (key === lastKey) {\n if (needle === lastNeedle) {\n found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;\n return lastIndex;\n }\n\n if (needle >= lastNeedle) {\n // lastIndex may be -1 if the previous needle was not found.\n low = lastIndex === -1 ? 0 : lastIndex;\n } else {\n high = lastIndex;\n }\n }\n state.lastKey = key;\n state.lastNeedle = needle;\n\n return (state.lastIndex = binarySearch(haystack, needle, low, high));\n}\n","import { COLUMN, SOURCES_INDEX, SOURCE_LINE, SOURCE_COLUMN } from './sourcemap-segment';\nimport { memoizedBinarySearch, upperBound } from './binary-search';\n\nimport type { ReverseSegment, SourceMapSegment } from './sourcemap-segment';\nimport type { MemoState } from './binary-search';\n\nexport type Source = {\n __proto__: null;\n [line: number]: Exclude[];\n};\n\n// Rebuilds the original source files, with mappings that are ordered by source line/column instead\n// of generated line/column.\nexport default function buildBySources(\n decoded: readonly SourceMapSegment[][],\n memos: MemoState[],\n): Source[] {\n const sources: Source[] = memos.map(buildNullArray);\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n if (seg.length === 1) continue;\n\n const sourceIndex = seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n const originalSource = sources[sourceIndex];\n const originalLine = (originalSource[sourceLine] ||= []);\n const memo = memos[sourceIndex];\n\n // The binary search either found a match, or it found the left-index just before where the\n // segment should go. Either way, we want to insert after that. And there may be multiple\n // generated segments associated with an original location, so there may need to move several\n // indexes before we find where we need to insert.\n const index = upperBound(\n originalLine,\n sourceColumn,\n memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine),\n );\n\n insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);\n }\n }\n\n return sources;\n}\n\nfunction insert(array: T[], index: number, value: T) {\n for (let i = array.length; i > index; i--) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n}\n\n// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like\n// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations.\n// Numeric properties on objects are magically sorted in ascending order by the engine regardless of\n// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending\n// order when iterating with for-in.\nfunction buildNullArray(): T {\n return { __proto__: null } as T;\n}\n","import { TraceMap, presortedDecodedMap, decodedMappings } from './trace-mapping';\nimport {\n COLUMN,\n SOURCES_INDEX,\n SOURCE_LINE,\n SOURCE_COLUMN,\n NAMES_INDEX,\n} from './sourcemap-segment';\n\nimport type {\n Section,\n SectionedSourceMap,\n DecodedSourceMap,\n SectionedSourceMapInput,\n Ro,\n} from './types';\nimport type { SourceMapSegment } from './sourcemap-segment';\n\ntype AnyMap = {\n new (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;\n (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;\n};\n\nexport const AnyMap: AnyMap = function (map, mapUrl) {\n const parsed =\n typeof map === 'string' ? (JSON.parse(map) as Exclude) : map;\n\n if (!('sections' in parsed)) return new TraceMap(parsed, mapUrl);\n\n const mappings: SourceMapSegment[][] = [];\n const sources: string[] = [];\n const sourcesContent: (string | null)[] = [];\n const names: string[] = [];\n\n recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, 0, 0, Infinity, Infinity);\n\n const joined: DecodedSourceMap = {\n version: 3,\n file: parsed.file,\n names,\n sources,\n sourcesContent,\n mappings,\n };\n\n return presortedDecodedMap(joined);\n} as AnyMap;\n\nfunction recurse(\n input: Ro,\n mapUrl: string | null | undefined,\n mappings: SourceMapSegment[][],\n sources: string[],\n sourcesContent: (string | null)[],\n names: string[],\n lineOffset: number,\n columnOffset: number,\n stopLine: number,\n stopColumn: number,\n) {\n const { sections } = input;\n for (let i = 0; i < sections.length; i++) {\n const { map, offset } = sections[i];\n\n let sl = stopLine;\n let sc = stopColumn;\n if (i + 1 < sections.length) {\n const nextOffset = sections[i + 1].offset;\n sl = Math.min(stopLine, lineOffset + nextOffset.line);\n\n if (sl === stopLine) {\n sc = Math.min(stopColumn, columnOffset + nextOffset.column);\n } else if (sl < stopLine) {\n sc = columnOffset + nextOffset.column;\n }\n }\n\n addSection(\n map,\n mapUrl,\n mappings,\n sources,\n sourcesContent,\n names,\n lineOffset + offset.line,\n columnOffset + offset.column,\n sl,\n sc,\n );\n }\n}\n\nfunction addSection(\n input: Ro,\n mapUrl: string | null | undefined,\n mappings: SourceMapSegment[][],\n sources: string[],\n sourcesContent: (string | null)[],\n names: string[],\n lineOffset: number,\n columnOffset: number,\n stopLine: number,\n stopColumn: number,\n) {\n if ('sections' in input) return recurse(...(arguments as unknown as Parameters));\n\n const map = new TraceMap(input, mapUrl);\n const sourcesOffset = sources.length;\n const namesOffset = names.length;\n const decoded = decodedMappings(map);\n const { resolvedSources, sourcesContent: contents } = map;\n\n append(sources, resolvedSources);\n append(names, map.names);\n if (contents) append(sourcesContent, contents);\n else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);\n\n for (let i = 0; i < decoded.length; i++) {\n const lineI = lineOffset + i;\n\n // We can only add so many lines before we step into the range that the next section's map\n // controls. When we get to the last line, then we'll start checking the segments to see if\n // they've crossed into the column range. But it may not have any columns that overstep, so we\n // still need to check that we don't overstep lines, too.\n if (lineI > stopLine) return;\n\n // The out line may already exist in mappings (if we're continuing the line started by a\n // previous section). Or, we may have jumped ahead several lines to start this section.\n const out = getLine(mappings, lineI);\n // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the\n // map can be multiple lines), it doesn't.\n const cOffset = i === 0 ? columnOffset : 0;\n\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n const column = cOffset + seg[COLUMN];\n\n // If this segment steps into the column range that the next section's map controls, we need\n // to stop early.\n if (lineI === stopLine && column >= stopColumn) return;\n\n if (seg.length === 1) {\n out.push([column]);\n continue;\n }\n\n const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n out.push(\n seg.length === 4\n ? [column, sourcesIndex, sourceLine, sourceColumn]\n : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]],\n );\n }\n }\n}\n\nfunction append(arr: T[], other: T[]) {\n for (let i = 0; i < other.length; i++) arr.push(other[i]);\n}\n\nfunction getLine(arr: T[][], index: number): T[] {\n for (let i = arr.length; i <= index; i++) arr[i] = [];\n return arr[index];\n}\n","import { encode, decode } from '@jridgewell/sourcemap-codec';\n\nimport resolve from './resolve';\nimport stripFilename from './strip-filename';\nimport maybeSort from './sort';\nimport buildBySources from './by-source';\nimport {\n memoizedState,\n memoizedBinarySearch,\n upperBound,\n lowerBound,\n found as bsFound,\n} from './binary-search';\nimport {\n COLUMN,\n SOURCES_INDEX,\n SOURCE_LINE,\n SOURCE_COLUMN,\n NAMES_INDEX,\n REV_GENERATED_LINE,\n REV_GENERATED_COLUMN,\n} from './sourcemap-segment';\n\nimport type { SourceMapSegment, ReverseSegment } from './sourcemap-segment';\nimport type {\n SourceMapV3,\n DecodedSourceMap,\n EncodedSourceMap,\n InvalidOriginalMapping,\n OriginalMapping,\n InvalidGeneratedMapping,\n GeneratedMapping,\n SourceMapInput,\n Needle,\n SourceNeedle,\n SourceMap,\n EachMapping,\n Bias,\n} from './types';\nimport type { Source } from './by-source';\nimport type { MemoState } from './binary-search';\n\nexport type { SourceMapSegment } from './sourcemap-segment';\nexport type {\n SourceMapInput,\n SectionedSourceMapInput,\n DecodedSourceMap,\n EncodedSourceMap,\n SectionedSourceMap,\n InvalidOriginalMapping,\n OriginalMapping as Mapping,\n OriginalMapping,\n InvalidGeneratedMapping,\n GeneratedMapping,\n EachMapping,\n} from './types';\n\nconst LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';\nconst COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';\n\nexport const LEAST_UPPER_BOUND = -1;\nexport const GREATEST_LOWER_BOUND = 1;\n\n/**\n * Returns the encoded (VLQ string) form of the SourceMap's mappings field.\n */\nexport let encodedMappings: (map: TraceMap) => EncodedSourceMap['mappings'];\n\n/**\n * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.\n */\nexport let decodedMappings: (map: TraceMap) => Readonly;\n\n/**\n * A low-level API to find the segment associated with a generated line/column (think, from a\n * stack trace). Line and column here are 0-based, unlike `originalPositionFor`.\n */\nexport let traceSegment: (\n map: TraceMap,\n line: number,\n column: number,\n) => Readonly | null;\n\n/**\n * A higher-level API to find the source/line/column associated with a generated line/column\n * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in\n * `source-map` library.\n */\nexport let originalPositionFor: (\n map: TraceMap,\n needle: Needle,\n) => OriginalMapping | InvalidOriginalMapping;\n\n/**\n * Finds the generated line/column position of the provided source/line/column source position.\n */\nexport let generatedPositionFor: (\n map: TraceMap,\n needle: SourceNeedle,\n) => GeneratedMapping | InvalidGeneratedMapping;\n\n/**\n * Finds all generated line/column positions of the provided source/line/column source position.\n */\nexport let allGeneratedPositionsFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping[];\n\n/**\n * Iterates each mapping in generated position order.\n */\nexport let eachMapping: (map: TraceMap, cb: (mapping: EachMapping) => void) => void;\n\n/**\n * Retrieves the source content for a particular source, if its found. Returns null if not.\n */\nexport let sourceContentFor: (map: TraceMap, source: string) => string | null;\n\n/**\n * A helper that skips sorting of the input map's mappings array, which can be expensive for larger\n * maps.\n */\nexport let presortedDecodedMap: (map: DecodedSourceMap, mapUrl?: string) => TraceMap;\n\n/**\n * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let decodedMap: (\n map: TraceMap,\n) => Omit & { mappings: readonly SourceMapSegment[][] };\n\n/**\n * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let encodedMap: (map: TraceMap) => EncodedSourceMap;\n\nexport { AnyMap } from './any-map';\n\nexport class TraceMap implements SourceMap {\n declare version: SourceMapV3['version'];\n declare file: SourceMapV3['file'];\n declare names: SourceMapV3['names'];\n declare sourceRoot: SourceMapV3['sourceRoot'];\n declare sources: SourceMapV3['sources'];\n declare sourcesContent: SourceMapV3['sourcesContent'];\n\n declare resolvedSources: string[];\n private declare _encoded: string | undefined;\n\n private declare _decoded: SourceMapSegment[][] | undefined;\n private declare _decodedMemo: MemoState;\n\n private declare _bySources: Source[] | undefined;\n private declare _bySourceMemos: MemoState[] | undefined;\n\n constructor(map: SourceMapInput, mapUrl?: string | null) {\n const isString = typeof map === 'string';\n\n if (!isString && (map as unknown as { _decodedMemo: any })._decodedMemo) return map as TraceMap;\n\n const parsed = (isString ? JSON.parse(map) : map) as DecodedSourceMap | EncodedSourceMap;\n\n const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;\n this.version = version;\n this.file = file;\n this.names = names;\n this.sourceRoot = sourceRoot;\n this.sources = sources;\n this.sourcesContent = sourcesContent;\n\n const from = resolve(sourceRoot || '', stripFilename(mapUrl));\n this.resolvedSources = sources.map((s) => resolve(s || '', from));\n\n const { mappings } = parsed;\n if (typeof mappings === 'string') {\n this._encoded = mappings;\n this._decoded = undefined;\n } else {\n this._encoded = undefined;\n this._decoded = maybeSort(mappings, isString);\n }\n\n this._decodedMemo = memoizedState();\n this._bySources = undefined;\n this._bySourceMemos = undefined;\n }\n\n static {\n encodedMappings = (map) => {\n return (map._encoded ??= encode(map._decoded!));\n };\n\n decodedMappings = (map) => {\n return (map._decoded ||= decode(map._encoded!));\n };\n\n traceSegment = (map, line, column) => {\n const decoded = decodedMappings(map);\n\n // It's common for parent source maps to have pointers to lines that have no\n // mapping (like a \"//# sourceMappingURL=\") at the end of the child file.\n if (line >= decoded.length) return null;\n\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n map._decodedMemo,\n line,\n column,\n GREATEST_LOWER_BOUND,\n );\n\n return index === -1 ? null : segments[index];\n };\n\n originalPositionFor = (map, { line, column, bias }) => {\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n\n const decoded = decodedMappings(map);\n\n // It's common for parent source maps to have pointers to lines that have no\n // mapping (like a \"//# sourceMappingURL=\") at the end of the child file.\n if (line >= decoded.length) return OMapping(null, null, null, null);\n\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n map._decodedMemo,\n line,\n column,\n bias || GREATEST_LOWER_BOUND,\n );\n\n if (index === -1) return OMapping(null, null, null, null);\n\n const segment = segments[index];\n if (segment.length === 1) return OMapping(null, null, null, null);\n\n const { names, resolvedSources } = map;\n return OMapping(\n resolvedSources[segment[SOURCES_INDEX]],\n segment[SOURCE_LINE] + 1,\n segment[SOURCE_COLUMN],\n segment.length === 5 ? names[segment[NAMES_INDEX]] : null,\n );\n };\n\n allGeneratedPositionsFor = (map, { source, line, column, bias }) => {\n // SourceMapConsumer uses LEAST_UPPER_BOUND for some reason, so we follow suit.\n return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);\n };\n\n generatedPositionFor = (map, { source, line, column, bias }) => {\n return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);\n };\n\n eachMapping = (map, cb) => {\n const decoded = decodedMappings(map);\n const { names, resolvedSources } = map;\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n\n const generatedLine = i + 1;\n const generatedColumn = seg[0];\n let source = null;\n let originalLine = null;\n let originalColumn = null;\n let name = null;\n if (seg.length !== 1) {\n source = resolvedSources[seg[1]];\n originalLine = seg[2] + 1;\n originalColumn = seg[3];\n }\n if (seg.length === 5) name = names[seg[4]];\n\n cb({\n generatedLine,\n generatedColumn,\n source,\n originalLine,\n originalColumn,\n name,\n } as EachMapping);\n }\n }\n };\n\n sourceContentFor = (map, source) => {\n const { sources, resolvedSources, sourcesContent } = map;\n if (sourcesContent == null) return null;\n\n let index = sources.indexOf(source);\n if (index === -1) index = resolvedSources.indexOf(source);\n\n return index === -1 ? null : sourcesContent[index];\n };\n\n presortedDecodedMap = (map, mapUrl) => {\n const tracer = new TraceMap(clone(map, []), mapUrl);\n tracer._decoded = map.mappings;\n return tracer;\n };\n\n decodedMap = (map) => {\n return clone(map, decodedMappings(map));\n };\n\n encodedMap = (map) => {\n return clone(map, encodedMappings(map));\n };\n\n function generatedPosition(\n map: TraceMap,\n source: string,\n line: number,\n column: number,\n bias: Bias,\n all: false,\n ): GeneratedMapping | InvalidGeneratedMapping;\n function generatedPosition(\n map: TraceMap,\n source: string,\n line: number,\n column: number,\n bias: Bias,\n all: true,\n ): GeneratedMapping[];\n function generatedPosition(\n map: TraceMap,\n source: string,\n line: number,\n column: number,\n bias: Bias,\n all: boolean,\n ): GeneratedMapping | InvalidGeneratedMapping | GeneratedMapping[] {\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n\n const { sources, resolvedSources } = map;\n let sourceIndex = sources.indexOf(source);\n if (sourceIndex === -1) sourceIndex = resolvedSources.indexOf(source);\n if (sourceIndex === -1) return all ? [] : GMapping(null, null);\n\n const generated = (map._bySources ||= buildBySources(\n decodedMappings(map),\n (map._bySourceMemos = sources.map(memoizedState)),\n ));\n\n const segments = generated[sourceIndex][line];\n if (segments == null) return all ? [] : GMapping(null, null);\n\n const memo = map._bySourceMemos![sourceIndex];\n\n if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);\n\n const index = traceSegmentInternal(segments, memo, line, column, bias);\n if (index === -1) return GMapping(null, null);\n\n const segment = segments[index];\n return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);\n }\n }\n}\n\nfunction clone(\n map: TraceMap | DecodedSourceMap | EncodedSourceMap,\n mappings: T,\n): T extends string ? EncodedSourceMap : DecodedSourceMap {\n return {\n version: map.version,\n file: map.file,\n names: map.names,\n sourceRoot: map.sourceRoot,\n sources: map.sources,\n sourcesContent: map.sourcesContent,\n mappings,\n } as any;\n}\n\nfunction OMapping(source: null, line: null, column: null, name: null): InvalidOriginalMapping;\nfunction OMapping(\n source: string,\n line: number,\n column: number,\n name: string | null,\n): OriginalMapping;\nfunction OMapping(\n source: string | null,\n line: number | null,\n column: number | null,\n name: string | null,\n): OriginalMapping | InvalidOriginalMapping {\n return { source, line, column, name } as any;\n}\n\nfunction GMapping(line: null, column: null): InvalidGeneratedMapping;\nfunction GMapping(line: number, column: number): GeneratedMapping;\nfunction GMapping(\n line: number | null,\n column: number | null,\n): GeneratedMapping | InvalidGeneratedMapping {\n return { line, column } as any;\n}\n\nfunction traceSegmentInternal(\n segments: SourceMapSegment[],\n memo: MemoState,\n line: number,\n column: number,\n bias: Bias,\n): number;\nfunction traceSegmentInternal(\n segments: ReverseSegment[],\n memo: MemoState,\n line: number,\n column: number,\n bias: Bias,\n): number;\nfunction traceSegmentInternal(\n segments: SourceMapSegment[] | ReverseSegment[],\n memo: MemoState,\n line: number,\n column: number,\n bias: Bias,\n): number {\n let index = memoizedBinarySearch(segments, column, memo, line);\n if (bsFound) {\n index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);\n } else if (bias === LEAST_UPPER_BOUND) index++;\n\n if (index === -1 || index === segments.length) return -1;\n return index;\n}\n\nfunction sliceGeneratedPositions(\n segments: ReverseSegment[],\n memo: MemoState,\n line: number,\n column: number,\n bias: Bias,\n): GeneratedMapping[] {\n let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);\n\n // We ignored the bias when tracing the segment so that we're guarnateed to find the first (in\n // insertion order) segment that matched. Even if we did respect the bias when tracing, we would\n // still need to call `lowerBound()` to find the first segment, which is slower than just looking\n // for the GREATEST_LOWER_BOUND to begin with. The only difference that matters for us is when the\n // binary search didn't match, in which case GREATEST_LOWER_BOUND just needs to increment to\n // match LEAST_UPPER_BOUND.\n if (!bsFound && bias === LEAST_UPPER_BOUND) min++;\n\n if (min === -1 || min === segments.length) return [];\n\n // We may have found the segment that started at an earlier column. If this is the case, then we\n // need to slice all generated segments that match _that_ column, because all such segments span\n // to our desired column.\n const matchedColumn = bsFound ? column : segments[min][COLUMN];\n\n // The binary search is not guaranteed to find the lower bound when a match wasn't found.\n if (!bsFound) min = lowerBound(segments, matchedColumn, min);\n const max = upperBound(segments, matchedColumn, min);\n\n const result = [];\n for (; min <= max; min++) {\n const segment = segments[min];\n result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));\n }\n return result;\n}\n"],"names":["resolveUri","presortedDecodedMap","decodedMappings","encodedMappings","traceSegment","originalPositionFor","generatedPositionFor","allGeneratedPositionsFor","eachMapping","sourceContentFor","decodedMap","encodedMap","encode","decode","bsFound"],"mappings":";;;;;;;;;;IAEc,SAAU,OAAO,CAAC,KAAa,EAAE,IAAwB,EAAA;;;;QAIrE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,IAAI,IAAI,GAAG,CAAC;IAE7C,IAAA,OAAOA,8BAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC;;ICTA;;IAEG;IACqB,SAAA,aAAa,CAAC,IAA+B,EAAA;IACnE,IAAA,IAAI,CAAC,IAAI;IAAE,QAAA,OAAO,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAClC;;ICQO,MAAM,MAAM,GAAG,CAAC,CAAC;IACjB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC;IACtB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC;IAEtB,MAAM,kBAAkB,GAAG,CAAC,CAAC;IAC7B,MAAM,oBAAoB,GAAG,CAAC;;IClBvB,SAAU,SAAS,CAC/B,QAA8B,EAC9B,KAAc,EAAA;QAEd,MAAM,aAAa,GAAG,uBAAuB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3D,IAAA,IAAI,aAAa,KAAK,QAAQ,C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AAA,OAAO,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,EAAE;IACxB,QAAA,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC9B,QAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACvF,KAAA;IACD,IAAA,OAAO,MAAM,CAAC;IAChB;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts deleted file mode 100644 index 08bca6bfa..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { TraceMap } from './trace-mapping'; -import type { SectionedSourceMapInput } from './types'; -declare type AnyMap = { - new (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap; - (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap; -}; -export declare const AnyMap: AnyMap; -export {}; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts deleted file mode 100644 index 88820e500..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment'; -export declare type MemoState = { - lastKey: number; - lastNeedle: number; - lastIndex: number; -}; -export declare let found: boolean; -/** - * A binary search implementation that returns the index if a match is found. - * If no match is found, then the left-index (the index associated with the item that comes just - * before the desired index) is returned. To maintain proper sort order, a splice would happen at - * the next index: - * - * ```js - * const array = [1, 3]; - * const needle = 2; - * const index = binarySearch(array, needle, (item, needle) => item - needle); - * - * assert.equal(index, 0); - * array.splice(index + 1, 0, needle); - * assert.deepEqual(array, [1, 2, 3]); - * ``` - */ -export declare function binarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, low: number, high: number): number; -export declare function upperBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; -export declare function lowerBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; -export declare function memoizedState(): MemoState; -/** - * This overly complicated beast is just to record the last tested line/column and the resulting - * index, allowing us to skip a few tests if mappings are monotonically increasing. - */ -export declare function memoizedBinarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, state: MemoState, key: number): number; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts deleted file mode 100644 index 8d1e53833..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment'; -import type { MemoState } from './binary-search'; -export declare type Source = { - __proto__: null; - [line: number]: Exclude[]; -}; -export default function buildBySources(decoded: readonly SourceMapSegment[][], memos: MemoState[]): Source[]; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts deleted file mode 100644 index cf7d4f8a5..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts +++ /dev/null @@ -1 +0,0 @@ -export default function resolve(input: string, base: string | undefined): string; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts deleted file mode 100644 index 2bfb5dc10..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment'; -export default function maybeSort(mappings: SourceMapSegment[][], owned: boolean): SourceMapSegment[][]; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts deleted file mode 100644 index 6d70924e1..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare type GeneratedColumn = number; -declare type SourcesIndex = number; -declare type SourceLine = number; -declare type SourceColumn = number; -declare type NamesIndex = number; -declare type GeneratedLine = number; -export declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; -export declare type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn]; -export declare const COLUMN = 0; -export declare const SOURCES_INDEX = 1; -export declare const SOURCE_LINE = 2; -export declare const SOURCE_COLUMN = 3; -export declare const NAMES_INDEX = 4; -export declare const REV_GENERATED_LINE = 1; -export declare const REV_GENERATED_COLUMN = 2; -export {}; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts deleted file mode 100644 index bead5c12c..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Removes everything after the last "/", but leaves the slash. - */ -export default function stripFilename(path: string | undefined | null): string; diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts deleted file mode 100644 index c125ead38..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment'; -import type { SourceMapV3, DecodedSourceMap, EncodedSourceMap, InvalidOriginalMapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, SourceMapInput, Needle, SourceNeedle, SourceMap, EachMapping } from './types'; -export type { SourceMapSegment } from './sourcemap-segment'; -export type { SourceMapInput, SectionedSourceMapInput, DecodedSourceMap, EncodedSourceMap, SectionedSourceMap, InvalidOriginalMapping, OriginalMapping as Mapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, EachMapping, } from './types'; -export declare const LEAST_UPPER_BOUND = -1; -export declare const GREATEST_LOWER_BOUND = 1; -/** - * Returns the encoded (VLQ string) form of the SourceMap's mappings field. - */ -export declare let encodedMappings: (map: TraceMap) => EncodedSourceMap['mappings']; -/** - * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. - */ -export declare let decodedMappings: (map: TraceMap) => Readonly; -/** - * A low-level API to find the segment associated with a generated line/column (think, from a - * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. - */ -export declare let traceSegment: (map: TraceMap, line: number, column: number) => Readonly | null; -/** - * A higher-level API to find the source/line/column associated with a generated line/column - * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in - * `source-map` library. - */ -export declare let originalPositionFor: (map: TraceMap, needle: Needle) => OriginalMapping | InvalidOriginalMapping; -/** - * Finds the generated line/column position of the provided source/line/column source position. - */ -export declare let generatedPositionFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping | InvalidGeneratedMapping; -/** - * Finds all generated line/column positions of the provided source/line/column source position. - */ -export declare let allGeneratedPositionsFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping[]; -/** - * Iterates each mapping in generated position order. - */ -export declare let eachMapping: (map: TraceMap, cb: (mapping: EachMapping) => void) => void; -/** - * Retrieves the source content for a particular source, if its found. Returns null if not. - */ -export declare let sourceContentFor: (map: TraceMap, source: string) => string | null; -/** - * A helper that skips sorting of the input map's mappings array, which can be expensive for larger - * maps. - */ -export declare let presortedDecodedMap: (map: DecodedSourceMap, mapUrl?: string) => TraceMap; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare let decodedMap: (map: TraceMap) => Omit & { - mappings: readonly SourceMapSegment[][]; -}; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare let encodedMap: (map: TraceMap) => EncodedSourceMap; -export { AnyMap } from './any-map'; -export declare class TraceMap implements SourceMap { - version: SourceMapV3['version']; - file: SourceMapV3['file']; - names: SourceMapV3['names']; - sourceRoot: SourceMapV3['sourceRoot']; - sources: SourceMapV3['sources']; - sourcesContent: SourceMapV3['sourcesContent']; - resolvedSources: string[]; - private _encoded; - private _decoded; - private _decodedMemo; - private _bySources; - private _bySourceMemos; - constructor(map: SourceMapInput, mapUrl?: string | null); -} diff --git a/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts b/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts deleted file mode 100644 index 2f4fd452d..000000000 --- a/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment'; -import type { GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap } from './trace-mapping'; -export interface SourceMapV3 { - file?: string | null; - names: string[]; - sourceRoot?: string; - sources: (string | null)[]; - sourcesContent?: (string | null)[]; - version: 3; -} -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; -} -export interface DecodedSourceMap extends SourceMapV3 { - mappings: SourceMapSegment[][]; -} -export interface Section { - offset: { - line: number; - column: number; - }; - map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap; -} -export interface SectionedSourceMap { - file?: string | null; - sections: Section[]; - version: 3; -} -export declare type OriginalMapping = { - source: string | null; - line: number; - column: number; - name: string | null; -}; -export declare type InvalidOriginalMapping = { - source: null; - line: null; - column: null; - name: null; -}; -export declare type GeneratedMapping = { - line: number; - column: number; -}; -export declare type InvalidGeneratedMapping = { - line: null; - column: null; -}; -export declare type Bias = typeof GREATEST_LOWER_BOUND | typeof LEAST_UPPER_BOUND; -export declare type SourceMapInput = string | Ro | Ro | TraceMap; -export declare type SectionedSourceMapInput = SourceMapInput | Ro; -export declare type Needle = { - line: number; - column: number; - bias?: Bias; -}; -export declare type SourceNeedle = { - source: string; - line: number; - column: number; - bias?: Bias; -}; -export declare type EachMapping = { - generatedLine: number; - generatedColumn: number; - source: null; - originalLine: null; - originalColumn: null; - name: null; -} | { - generatedLine: number; - generatedColumn: number; - source: string | null; - originalLine: number; - originalColumn: number; - name: string | null; -}; -export declare abstract class SourceMap { - version: SourceMapV3['version']; - file: SourceMapV3['file']; - names: SourceMapV3['names']; - sourceRoot: SourceMapV3['sourceRoot']; - sources: SourceMapV3['sources']; - sourcesContent: SourceMapV3['sourcesContent']; - resolvedSources: SourceMapV3['sources']; -} -export declare type Ro = T extends Array ? V[] | Readonly | RoArray | Readonly> : T extends object ? T | Readonly | RoObject | Readonly> : T; -declare type RoArray = Ro[]; -declare type RoObject = { - [K in keyof T]: T[K] | Ro; -}; -export {}; diff --git a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/LICENSE b/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/LICENSE deleted file mode 100644 index a331065a4..000000000 --- a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2015 Rich Harris - -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/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/README.md b/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/README.md deleted file mode 100644 index 2b9e39713..000000000 --- a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/README.md +++ /dev/null @@ -1,200 +0,0 @@ -# sourcemap-codec - -Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit). - - -## Why? - -Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap. - -This package makes the process slightly easier. - - -## Installation - -```bash -npm install sourcemap-codec -``` - - -## Usage - -```js -import { encode, decode } from 'sourcemap-codec'; - -var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); - -assert.deepEqual( decoded, [ - // the first line (of the generated code) has no mappings, - // as shown by the starting semi-colon (which separates lines) - [], - - // the second line contains four (comma-separated) segments - [ - // segments are encoded as you'd expect: - // [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ] - - // i.e. the first segment begins at column 2, and maps back to the second column - // of the second line (both zero-based) of the 0th source, and uses the 0th - // name in the `map.names` array - [ 2, 0, 2, 2, 0 ], - - // the remaining segments are 4-length rather than 5-length, - // because they don't map a name - [ 4, 0, 2, 4 ], - [ 6, 0, 2, 5 ], - [ 7, 0, 2, 7 ] - ], - - // the final line contains two segments - [ - [ 2, 1, 10, 19 ], - [ 12, 1, 11, 20 ] - ] -]); - -var encoded = encode( decoded ); -assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); -``` - -## Benchmarks - -``` -node v18.0.0 - -amp.js.map - 45120 segments - -Decode Memory Usage: -@jridgewell/sourcemap-codec 5479160 bytes -sourcemap-codec 5659336 bytes -source-map-0.6.1 17144440 bytes -source-map-0.8.0 6867424 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Decode speed: -decode: @jridgewell/sourcemap-codec x 502 ops/sec ±1.03% (90 runs sampled) -decode: sourcemap-codec x 445 ops/sec ±0.97% (92 runs sampled) -decode: source-map-0.6.1 x 36.01 ops/sec ±1.64% (49 runs sampled) -decode: source-map-0.8.0 x 367 ops/sec ±0.04% (95 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec - -Encode Memory Usage: -@jridgewell/sourcemap-codec 1261620 bytes -sourcemap-codec 9119248 bytes -source-map-0.6.1 8968560 bytes -source-map-0.8.0 8952952 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Encode speed: -encode: @jridgewell/sourcemap-codec x 738 ops/sec ±0.42% (98 runs sampled) -encode: sourcemap-codec x 238 ops/sec ±0.73% (88 runs sampled) -encode: source-map-0.6.1 x 162 ops/sec ±0.43% (84 runs sampled) -encode: source-map-0.8.0 x 191 ops/sec ±0.34% (90 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec - - -*** - - -babel.min.js.map - 347793 segments - -Decode Memory Usage: -@jridgewell/sourcemap-codec 35338184 bytes -sourcemap-codec 35922736 bytes -source-map-0.6.1 62366360 bytes -source-map-0.8.0 44337416 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Decode speed: -decode: @jridgewell/sourcemap-codec x 40.35 ops/sec ±4.47% (54 runs sampled) -decode: sourcemap-codec x 36.76 ops/sec ±3.67% (51 runs sampled) -decode: source-map-0.6.1 x 4.44 ops/sec ±2.15% (16 runs sampled) -decode: source-map-0.8.0 x 59.35 ops/sec ±0.05% (78 runs sampled) -Fastest is decode: source-map-0.8.0 - -Encode Memory Usage: -@jridgewell/sourcemap-codec 7212604 bytes -sourcemap-codec 21421456 bytes -source-map-0.6.1 25286888 bytes -source-map-0.8.0 25498744 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Encode speed: -encode: @jridgewell/sourcemap-codec x 112 ops/sec ±0.13% (84 runs sampled) -encode: sourcemap-codec x 30.23 ops/sec ±2.76% (53 runs sampled) -encode: source-map-0.6.1 x 19.43 ops/sec ±3.70% (37 runs sampled) -encode: source-map-0.8.0 x 19.40 ops/sec ±3.26% (37 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec - - -*** - - -preact.js.map - 1992 segments - -Decode Memory Usage: -@jridgewell/sourcemap-codec 500272 bytes -sourcemap-codec 516864 bytes -source-map-0.6.1 1596672 bytes -source-map-0.8.0 517272 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Decode speed: -decode: @jridgewell/sourcemap-codec x 16,137 ops/sec ±0.17% (99 runs sampled) -decode: sourcemap-codec x 12,139 ops/sec ±0.13% (99 runs sampled) -decode: source-map-0.6.1 x 1,264 ops/sec ±0.12% (100 runs sampled) -decode: source-map-0.8.0 x 9,894 ops/sec ±0.08% (101 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec - -Encode Memory Usage: -@jridgewell/sourcemap-codec 321026 bytes -sourcemap-codec 830832 bytes -source-map-0.6.1 586608 bytes -source-map-0.8.0 586680 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Encode speed: -encode: @jridgewell/sourcemap-codec x 19,876 ops/sec ±0.78% (95 runs sampled) -encode: sourcemap-codec x 6,983 ops/sec ±0.15% (100 runs sampled) -encode: source-map-0.6.1 x 5,070 ops/sec ±0.12% (102 runs sampled) -encode: source-map-0.8.0 x 5,641 ops/sec ±0.17% (100 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec - - -*** - - -react.js.map - 5726 segments - -Decode Memory Usage: -@jridgewell/sourcemap-codec 734848 bytes -sourcemap-codec 954200 bytes -source-map-0.6.1 2276432 bytes -source-map-0.8.0 955488 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Decode speed: -decode: @jridgewell/sourcemap-codec x 5,723 ops/sec ±0.12% (98 runs sampled) -decode: sourcemap-codec x 4,555 ops/sec ±0.09% (101 runs sampled) -decode: source-map-0.6.1 x 437 ops/sec ±0.11% (93 runs sampled) -decode: source-map-0.8.0 x 3,441 ops/sec ±0.15% (100 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec - -Encode Memory Usage: -@jridgewell/sourcemap-codec 638672 bytes -sourcemap-codec 1109840 bytes -source-map-0.6.1 1321224 bytes -source-map-0.8.0 1324448 bytes -Smallest memory usage is @jridgewell/sourcemap-codec - -Encode speed: -encode: @jridgewell/sourcemap-codec x 6,801 ops/sec ±0.48% (98 runs sampled) -encode: sourcemap-codec x 2,533 ops/sec ±0.13% (101 runs sampled) -encode: source-map-0.6.1 x 2,248 ops/sec ±0.08% (100 runs sampled) -encode: source-map-0.8.0 x 2,303 ops/sec ±0.15% (100 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec -``` - -# License - -MIT diff --git a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs b/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs deleted file mode 100644 index 3dff37217..000000000 --- a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +++ /dev/null @@ -1,164 +0,0 @@ -const comma = ','.charCodeAt(0); -const semicolon = ';'.charCodeAt(0); -const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -const intToChar = new Uint8Array(64); // 64 possible chars. -const charToInt = new Uint8Array(128); // z is 122 in ASCII -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -// Provide a fallback for older environments. -const td = typeof TextDecoder !== 'undefined' - ? /* #__PURE__ */ new TextDecoder() - : typeof Buffer !== 'undefined' - ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - }, - } - : { - decode(buf) { - let out = ''; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - }, - }; -function decode(mappings) { - const state = new Int32Array(5); - const decoded = []; - let index = 0; - do { - const semi = indexOf(mappings, index); - const line = []; - let sorted = true; - let lastCol = 0; - state[0] = 0; - for (let i = index; i < semi; i++) { - let seg; - i = decodeInteger(mappings, i, state, 0); // genColumn - const col = state[0]; - if (col < lastCol) - sorted = false; - lastCol = col; - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 1); // sourcesIndex - i = decodeInteger(mappings, i, state, 2); // sourceLine - i = decodeInteger(mappings, i, state, 3); // sourceColumn - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 4); // namesIndex - seg = [col, state[1], state[2], state[3], state[4]]; - } - else { - seg = [col, state[1], state[2], state[3]]; - } - } - else { - seg = [col]; - } - line.push(seg); - } - if (!sorted) - sort(line); - decoded.push(line); - index = semi + 1; - } while (index <= mappings.length); - return decoded; -} -function indexOf(mappings, index) { - const idx = mappings.indexOf(';', index); - return idx === -1 ? mappings.length : idx; -} -function decodeInteger(mappings, pos, state, j) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = mappings.charCodeAt(pos++); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -0x80000000 | -value; - } - state[j] += value; - return pos; -} -function hasMoreVlq(mappings, i, length) { - if (i >= length) - return false; - return mappings.charCodeAt(i) !== comma; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} -function encode(decoded) { - const state = new Int32Array(5); - const bufLength = 1024 * 16; - const subLength = bufLength - 36; - const buf = new Uint8Array(bufLength); - const sub = buf.subarray(0, subLength); - let pos = 0; - let out = ''; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) { - if (pos === bufLength) { - out += td.decode(buf); - pos = 0; - } - buf[pos++] = semicolon; - } - if (line.length === 0) - continue; - state[0] = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - // We can push up to 5 ints, each int can take at most 7 chars, and we - // may push a comma. - if (pos > subLength) { - out += td.decode(sub); - buf.copyWithin(0, subLength, pos); - pos -= subLength; - } - if (j > 0) - buf[pos++] = comma; - pos = encodeInteger(buf, pos, state, segment, 0); // genColumn - if (segment.length === 1) - continue; - pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex - pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine - pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn - if (segment.length === 4) - continue; - pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex - } - } - return out + td.decode(buf.subarray(0, pos)); -} -function encodeInteger(buf, pos, state, segment, j) { - const next = segment[j]; - let num = next - state[j]; - state[j] = next; - num = num < 0 ? (-num << 1) | 1 : num << 1; - do { - let clamped = num & 0b011111; - num >>>= 5; - if (num > 0) - clamped |= 0b100000; - buf[pos++] = intToChar[clamped]; - } while (num > 0); - return pos; -} - -export { decode, encode }; -//# sourceMappingURL=sourcemap-codec.mjs.map diff --git a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map b/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map deleted file mode 100644 index 36d724901..000000000 --- a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.mjs","sources":["../src/sourcemap-codec.ts"],"sourcesContent":[null],"names":[],"mappings":"AAOA,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CA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a,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;SAClD;KACF;IAED,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,aAAa,CACpB,GAAe,EACf,GAAW,EACX,KAAuB,EACvB,OAAyB,EACzB,CAAS;IAET,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1B,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAEhB,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IAC3C,GAAG;QACD,IAAI,OAAO,GAAG,GAAG,GAAG,QAAQ,CAAC;QAC7B,GAAG,MAAM,CAAC,CAAC;QACX,IAAI,GAAG,GAAG,CAAC;YAAE,OAAO,IAAI,QAAQ,CAAC;QACjC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;KACjC,QAAQ,GAAG,GAAG,CAAC,EAAE;IAElB,OAAO,GAAG,CAAC;AACb;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js b/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js deleted file mode 100644 index bec92a9c6..000000000 --- a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +++ /dev/null @@ -1,175 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {})); -})(this, (function (exports) { 'use strict'; - - const comma = ','.charCodeAt(0); - const semicolon = ';'.charCodeAt(0); - const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - const intToChar = new Uint8Array(64); // 64 possible chars. - const charToInt = new Uint8Array(128); // z is 122 in ASCII - for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; - } - // Provide a fallback for older environments. - const td = typeof TextDecoder !== 'undefined' - ? /* #__PURE__ */ new TextDecoder() - : typeof Buffer !== 'undefined' - ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - }, - } - : { - decode(buf) { - let out = ''; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - }, - }; - function decode(mappings) { - const state = new Int32Array(5); - const decoded = []; - let index = 0; - do { - const semi = indexOf(mappings, index); - const line = []; - let sorted = true; - let lastCol = 0; - state[0] = 0; - for (let i = index; i < semi; i++) { - let seg; - i = decodeInteger(mappings, i, state, 0); // genColumn - const col = state[0]; - if (col < lastCol) - sorted = false; - lastCol = col; - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 1); // sourcesIndex - i = decodeInteger(mappings, i, state, 2); // sourceLine - i = decodeInteger(mappings, i, state, 3); // sourceColumn - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 4); // namesIndex - seg = [col, state[1], state[2], state[3], state[4]]; - } - else { - seg = [col, state[1], state[2], state[3]]; - } - } - else { - seg = [col]; - } - line.push(seg); - } - if (!sorted) - sort(line); - decoded.push(line); - index = semi + 1; - } while (index <= mappings.length); - return decoded; - } - function indexOf(mappings, index) { - const idx = mappings.indexOf(';', index); - return idx === -1 ? mappings.length : idx; - } - function decodeInteger(mappings, pos, state, j) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = mappings.charCodeAt(pos++); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -0x80000000 | -value; - } - state[j] += value; - return pos; - } - function hasMoreVlq(mappings, i, length) { - if (i >= length) - return false; - return mappings.charCodeAt(i) !== comma; - } - function sort(line) { - line.sort(sortComparator); - } - function sortComparator(a, b) { - return a[0] - b[0]; - } - function encode(decoded) { - const state = new Int32Array(5); - const bufLength = 1024 * 16; - const subLength = bufLength - 36; - const buf = new Uint8Array(bufLength); - const sub = buf.subarray(0, subLength); - let pos = 0; - let out = ''; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) { - if (pos === bufLength) { - out += td.decode(buf); - pos = 0; - } - buf[pos++] = semicolon; - } - if (line.length === 0) - continue; - state[0] = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - // We can push up to 5 ints, each int can take at most 7 chars, and we - // may push a comma. - if (pos > subLength) { - out += td.decode(sub); - buf.copyWithin(0, subLength, pos); - pos -= subLength; - } - if (j > 0) - buf[pos++] = comma; - pos = encodeInteger(buf, pos, state, segment, 0); // genColumn - if (segment.length === 1) - continue; - pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex - pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine - pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn - if (segment.length === 4) - continue; - pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex - } - } - return out + td.decode(buf.subarray(0, pos)); - } - function encodeInteger(buf, pos, state, segment, j) { - const next = segment[j]; - let num = next - state[j]; - state[j] = next; - num = num < 0 ? (-num << 1) | 1 : num << 1; - do { - let clamped = num & 0b011111; - num >>>= 5; - if (num > 0) - clamped |= 0b100000; - buf[pos++] = intToChar[clamped]; - } while (num > 0); - return pos; - } - - exports.decode = decode; - exports.encode = encode; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); -//# sourceMappingURL=sourcemap-codec.umd.js.map diff --git a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map b/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map deleted file mode 100644 index a7a4628d7..000000000 --- a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.umd.js","sources":["../src/sourcemap-codec.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;IAOA,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,kEAAkE,CAAC;IACjF,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KAClB;IAED;IACA,MAAM,EAAE,GACN,OAAO,WAAW,KAAK,WAAW;0BACd,IAAI,WAAW,EAAE;UACjC,OAAO,MAAM,KAAK,WAAW;cAC7B;gBACE,MAAM,CAAC,GAAe;oBACpB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;oBACpE,OAA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AAE,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;SACjC,QAAQ,GAAG,GAAG,CAAC,EAAE;QAElB,OAAO,GAAG,CAAC;IACb;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts b/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts deleted file mode 100644 index 410d3202f..000000000 --- a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; -export declare type SourceMapLine = SourceMapSegment[]; -export declare type SourceMapMappings = SourceMapLine[]; -export declare function decode(mappings: string): SourceMapMappings; -export declare function encode(decoded: SourceMapMappings): string; -export declare function encode(decoded: Readonly): string; diff --git a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/package.json b/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/package.json deleted file mode 100644 index 594507287..000000000 --- a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "@jridgewell/sourcemap-codec", - "version": "1.4.14", - "description": "Encode/decode sourcemap mappings", - "keywords": [ - "sourcemap", - "vlq" - ], - "main": "dist/sourcemap-codec.umd.js", - "module": "dist/sourcemap-codec.mjs", - "typings": "dist/types/sourcemap-codec.d.ts", - "files": [ - "dist", - "src" - ], - "exports": { - ".": [ - { - "types": "./dist/types/sourcemap-codec.d.ts", - "browser": "./dist/sourcemap-codec.umd.js", - "import": "./dist/sourcemap-codec.mjs", - "require": "./dist/sourcemap-codec.umd.js" - }, - "./dist/sourcemap-codec.umd.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "benchmark": "run-s build:rollup benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node --expose-gc benchmark/index.js", - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "prebuild": "rm -rf dist", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build", - "pretest": "run-s build:rollup", - "test": "run-s -n test:lint test:only", - "test:debug": "mocha --inspect-brk", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:coverage": "c8 mocha", - "test:watch": "mocha --watch" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/sourcemap-codec.git" - }, - "author": "Rich Harris", - "license": "MIT", - "devDependencies": { - "@rollup/plugin-typescript": "8.3.0", - "@types/node": "17.0.15", - "@typescript-eslint/eslint-plugin": "5.10.0", - "@typescript-eslint/parser": "5.10.0", - "benchmark": "2.1.4", - "c8": "7.11.2", - "eslint": "8.7.0", - "eslint-config-prettier": "8.3.0", - "mocha": "9.2.0", - "npm-run-all": "4.1.5", - "prettier": "2.5.1", - "rollup": "2.64.0", - "source-map": "0.6.1", - "source-map-js": "1.0.2", - "sourcemap-codec": "1.4.8", - "typescript": "4.5.4" - } -} diff --git a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts b/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts deleted file mode 100644 index cafd90eff..000000000 --- a/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +++ /dev/null @@ -1,198 +0,0 @@ -export type SourceMapSegment = - | [number] - | [number, number, number, number] - | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; - -const comma = ','.charCodeAt(0); -const semicolon = ';'.charCodeAt(0); -const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -const intToChar = new Uint8Array(64); // 64 possible chars. -const charToInt = new Uint8Array(128); // z is 122 in ASCII - -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} - -// Provide a fallback for older environments. -const td = - typeof TextDecoder !== 'undefined' - ? /* #__PURE__ */ new TextDecoder() - : typeof Buffer !== 'undefined' - ? { - decode(buf: Uint8Array) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - }, - } - : { - decode(buf: Uint8Array) { - let out = ''; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - }, - }; - -export function decode(mappings: string): SourceMapMappings { - const state: [number, number, number, number, number] = new Int32Array(5) as any; - const decoded: SourceMapMappings = []; - - let index = 0; - do { - const semi = indexOf(mappings, index); - const line: SourceMapLine = []; - let sorted = true; - let lastCol = 0; - state[0] = 0; - - for (let i = index; i < semi; i++) { - let seg: SourceMapSegment; - - i = decodeInteger(mappings, i, state, 0); // genColumn - const col = state[0]; - if (col < lastCol) sorted = false; - lastCol = col; - - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 1); // sourcesIndex - i = decodeInteger(mappings, i, state, 2); // sourceLine - i = decodeInteger(mappings, i, state, 3); // sourceColumn - - if (hasMoreVlq(mappings, i, semi)) { - i = decodeInteger(mappings, i, state, 4); // namesIndex - seg = [col, state[1], state[2], state[3], state[4]]; - } else { - seg = [col, state[1], state[2], state[3]]; - } - } else { - seg = [col]; - } - - line.push(seg); - } - - if (!sorted) sort(line); - decoded.push(line); - index = semi + 1; - } while (index <= mappings.length); - - return decoded; -} - -function indexOf(mappings: string, index: number): number { - const idx = mappings.indexOf(';', index); - return idx === -1 ? mappings.length : idx; -} - -function decodeInteger(mappings: string, pos: number, state: SourceMapSegment, j: number): number { - let value = 0; - let shift = 0; - let integer = 0; - - do { - const c = mappings.charCodeAt(pos++); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - - const shouldNegate = value & 1; - value >>>= 1; - - if (shouldNegate) { - value = -0x80000000 | -value; - } - - state[j] += value; - return pos; -} - -function hasMoreVlq(mappings: string, i: number, length: number): boolean { - if (i >= length) return false; - return mappings.charCodeAt(i) !== comma; -} - -function sort(line: SourceMapSegment[]) { - line.sort(sortComparator); -} - -function sortComparator(a: SourceMapSegment, b: SourceMapSegment): number { - return a[0] - b[0]; -} - -export function encode(decoded: SourceMapMappings): string; -export function encode(decoded: Readonly): string; -export function encode(decoded: Readonly): string { - const state: [number, number, number, number, number] = new Int32Array(5) as any; - const bufLength = 1024 * 16; - const subLength = bufLength - 36; - const buf = new Uint8Array(bufLength); - const sub = buf.subarray(0, subLength); - let pos = 0; - let out = ''; - - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) { - if (pos === bufLength) { - out += td.decode(buf); - pos = 0; - } - buf[pos++] = semicolon; - } - if (line.length === 0) continue; - - state[0] = 0; - - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - // We can push up to 5 ints, each int can take at most 7 chars, and we - // may push a comma. - if (pos > subLength) { - out += td.decode(sub); - buf.copyWithin(0, subLength, pos); - pos -= subLength; - } - if (j > 0) buf[pos++] = comma; - - pos = encodeInteger(buf, pos, state, segment, 0); // genColumn - - if (segment.length === 1) continue; - pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex - pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine - pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn - - if (segment.length === 4) continue; - pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex - } - } - - return out + td.decode(buf.subarray(0, pos)); -} - -function encodeInteger( - buf: Uint8Array, - pos: number, - state: SourceMapSegment, - segment: SourceMapSegment, - j: number, -): number { - const next = segment[j]; - let num = next - state[j]; - state[j] = next; - - num = num < 0 ? (-num << 1) | 1 : num << 1; - do { - let clamped = num & 0b011111; - num >>>= 5; - if (num > 0) clamped |= 0b100000; - buf[pos++] = intToChar[clamped]; - } while (num > 0); - - return pos; -} diff --git a/node_modules/@jridgewell/trace-mapping/package.json b/node_modules/@jridgewell/trace-mapping/package.json deleted file mode 100644 index 9fcc07f4f..000000000 --- a/node_modules/@jridgewell/trace-mapping/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "@jridgewell/trace-mapping", - "version": "0.3.18", - "description": "Trace the original position through a source map", - "keywords": [ - "source", - "map" - ], - "main": "dist/trace-mapping.umd.js", - "module": "dist/trace-mapping.mjs", - "types": "dist/types/trace-mapping.d.ts", - "files": [ - "dist" - ], - "exports": { - ".": [ - { - "types": "./dist/types/trace-mapping.d.ts", - "browser": "./dist/trace-mapping.umd.js", - "require": "./dist/trace-mapping.umd.js", - "import": "./dist/trace-mapping.mjs" - }, - "./dist/trace-mapping.umd.js" - ], - "./package.json": "./package.json" - }, - "author": "Justin Ridgewell ", - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/trace-mapping.git" - }, - "license": "MIT", - "scripts": { - "benchmark": "run-s build:rollup benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node --expose-gc benchmark/index.mjs", - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "prebuild": "rm -rf dist", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build", - "test": "run-s -n test:lint test:only", - "test:debug": "ava debug", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts' '**/*.md'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "c8 ava", - "test:watch": "ava --watch" - }, - "devDependencies": { - "@rollup/plugin-typescript": "8.5.0", - "@typescript-eslint/eslint-plugin": "5.39.0", - "@typescript-eslint/parser": "5.39.0", - "ava": "4.3.3", - "benchmark": "2.1.4", - "c8": "7.12.0", - "esbuild": "0.15.10", - "eslint": "8.25.0", - "eslint-config-prettier": "8.5.0", - "eslint-plugin-no-only-tests": "3.0.0", - "npm-run-all": "4.1.5", - "prettier": "2.7.1", - "rollup": "2.79.1", - "tsx": "3.10.1", - "typescript": "4.8.4" - }, - "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } -} diff --git a/node_modules/@nodelib/fs.scandir/LICENSE b/node_modules/@nodelib/fs.scandir/LICENSE deleted file mode 100644 index 65a999460..000000000 --- a/node_modules/@nodelib/fs.scandir/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Denis Malinochkin - -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/@nodelib/fs.scandir/README.md b/node_modules/@nodelib/fs.scandir/README.md deleted file mode 100644 index e0b218b9f..000000000 --- a/node_modules/@nodelib/fs.scandir/README.md +++ /dev/null @@ -1,171 +0,0 @@ -# @nodelib/fs.scandir - -> List files and directories inside the specified directory. - -## :bulb: Highlights - -The package is aimed at obtaining information about entries in the directory. - -* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). -* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode). -* :link: Can safely work with broken symbolic links. - -## Install - -```console -npm install @nodelib/fs.scandir -``` - -## Usage - -```ts -import * as fsScandir from '@nodelib/fs.scandir'; - -fsScandir.scandir('path', (error, stats) => { /* … */ }); -``` - -## API - -### .scandir(path, [optionsOrSettings], callback) - -Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style. - -```ts -fsScandir.scandir('path', (error, entries) => { /* … */ }); -fsScandir.scandir('path', {}, (error, entries) => { /* … */ }); -fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ }); -``` - -### .scandirSync(path, [optionsOrSettings]) - -Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path. - -```ts -const entries = fsScandir.scandirSync('path'); -const entries = fsScandir.scandirSync('path', {}); -const entries = fsScandir.scandirSync(('path', new fsScandir.Settings()); -``` - -#### path - -* Required: `true` -* Type: `string | Buffer | URL` - -A path to a file. If a URL is provided, it must use the `file:` protocol. - -#### optionsOrSettings - -* Required: `false` -* Type: `Options | Settings` -* Default: An instance of `Settings` class - -An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class. - -> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. - -### Settings([options]) - -A class of full settings of the package. - -```ts -const settings = new fsScandir.Settings({ followSymbolicLinks: false }); - -const entries = fsScandir.scandirSync('path', settings); -``` - -## Entry - -* `name` — The name of the entry (`unknown.txt`). -* `path` — The path of the entry relative to call directory (`root/unknown.txt`). -* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class. -* `stats` (optional) — An instance of `fs.Stats` class. - -For example, the `scandir` call for `tools` directory with one directory inside: - -```ts -{ - dirent: Dirent { name: 'typedoc', /* … */ }, - name: 'typedoc', - path: 'tools/typedoc' -} -``` - -## Options - -### stats - -* Type: `boolean` -* Default: `false` - -Adds an instance of `fs.Stats` class to the [`Entry`](#entry). - -> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO?? - -### followSymbolicLinks - -* Type: `boolean` -* Default: `false` - -Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. - -### `throwErrorOnBrokenSymbolicLink` - -* Type: `boolean` -* Default: `true` - -Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`. - -### `pathSegmentSeparator` - -* Type: `string` -* Default: `path.sep` - -By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. - -### `fs` - -* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) -* Default: A default FS methods - -By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. - -```ts -interface FileSystemAdapter { - lstat?: typeof fs.lstat; - stat?: typeof fs.stat; - lstatSync?: typeof fs.lstatSync; - statSync?: typeof fs.statSync; - readdir?: typeof fs.readdir; - readdirSync?: typeof fs.readdirSync; -} - -const settings = new fsScandir.Settings({ - fs: { lstat: fakeLstat } -}); -``` - -## `old` and `modern` mode - -This package has two modes that are used depending on the environment and parameters of use. - -### old - -* Node.js below `10.10` or when the `stats` option is enabled - -When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links). - -### modern - -* Node.js 10.10+ and the `stats` option is disabled - -In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present. - -This mode makes fewer calls to the file system. It's faster. - -## Changelog - -See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. - -## License - -This software is released under the terms of the MIT license. diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts b/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts deleted file mode 100644 index 827f1db09..000000000 --- a/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type * as fsStat from '@nodelib/fs.stat'; -import type { Dirent, ErrnoException } from '../types'; -export interface ReaddirAsynchronousMethod { - (filepath: string, options: { - withFileTypes: true; - }, callback: (error: ErrnoException | null, files: Dirent[]) => void): void; - (filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void; -} -export interface ReaddirSynchronousMethod { - (filepath: string, options: { - withFileTypes: true; - }): Dirent[]; - (filepath: string): string[]; -} -export declare type FileSystemAdapter = fsStat.FileSystemAdapter & { - readdir: ReaddirAsynchronousMethod; - readdirSync: ReaddirSynchronousMethod; -}; -export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; -export declare function createFileSystemAdapter(fsMethods?: Partial): FileSystemAdapter; diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.js b/node_modules/@nodelib/fs.scandir/out/adapters/fs.js deleted file mode 100644 index f0fe02202..000000000 --- a/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; -const fs = require("fs"); -exports.FILE_SYSTEM_ADAPTER = { - lstat: fs.lstat, - stat: fs.stat, - lstatSync: fs.lstatSync, - statSync: fs.statSync, - readdir: fs.readdir, - readdirSync: fs.readdirSync -}; -function createFileSystemAdapter(fsMethods) { - if (fsMethods === undefined) { - return exports.FILE_SYSTEM_ADAPTER; - } - return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); -} -exports.createFileSystemAdapter = createFileSystemAdapter; diff --git a/node_modules/@nodelib/fs.scandir/out/constants.d.ts b/node_modules/@nodelib/fs.scandir/out/constants.d.ts deleted file mode 100644 index 33f17497d..000000000 --- a/node_modules/@nodelib/fs.scandir/out/constants.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * IS `true` for Node.js 10.10 and greater. - */ -export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean; diff --git a/node_modules/@nodelib/fs.scandir/out/constants.js b/node_modules/@nodelib/fs.scandir/out/constants.js deleted file mode 100644 index 7e3d4411f..000000000 --- a/node_modules/@nodelib/fs.scandir/out/constants.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; -const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); -if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) { - throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); -} -const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); -const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); -const SUPPORTED_MAJOR_VERSION = 10; -const SUPPORTED_MINOR_VERSION = 10; -const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; -const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; -/** - * IS `true` for Node.js 10.10 and greater. - */ -exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; diff --git a/node_modules/@nodelib/fs.scandir/out/index.d.ts b/node_modules/@nodelib/fs.scandir/out/index.d.ts deleted file mode 100644 index b9da83ed1..000000000 --- a/node_modules/@nodelib/fs.scandir/out/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from './adapters/fs'; -import * as async from './providers/async'; -import Settings, { Options } from './settings'; -import type { Dirent, Entry } from './types'; -declare type AsyncCallback = async.AsyncCallback; -declare function scandir(path: string, callback: AsyncCallback): void; -declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; -declare namespace scandir { - function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise; -} -declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[]; -export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod, Options }; diff --git a/node_modules/@nodelib/fs.scandir/out/index.js b/node_modules/@nodelib/fs.scandir/out/index.js deleted file mode 100644 index 99c70d3d6..000000000 --- a/node_modules/@nodelib/fs.scandir/out/index.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Settings = exports.scandirSync = exports.scandir = void 0; -const async = require("./providers/async"); -const sync = require("./providers/sync"); -const settings_1 = require("./settings"); -exports.Settings = settings_1.default; -function scandir(path, optionsOrSettingsOrCallback, callback) { - if (typeof optionsOrSettingsOrCallback === 'function') { - async.read(path, getSettings(), optionsOrSettingsOrCallback); - return; - } - async.read(path, getSettings(optionsOrSettingsOrCallback), callback); -} -exports.scandir = scandir; -function scandirSync(path, optionsOrSettings) { - const settings = getSettings(optionsOrSettings); - return sync.read(path, settings); -} -exports.scandirSync = scandirSync; -function getSettings(settingsOrOptions = {}) { - if (settingsOrOptions instanceof settings_1.default) { - return settingsOrOptions; - } - return new settings_1.default(settingsOrOptions); -} diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts deleted file mode 100644 index 5829676df..000000000 --- a/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -import type Settings from '../settings'; -import type { Entry } from '../types'; -export declare type AsyncCallback = (error: NodeJS.ErrnoException, entries: Entry[]) => void; -export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void; -export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void; -export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.js b/node_modules/@nodelib/fs.scandir/out/providers/async.js deleted file mode 100644 index e8e2f0a9c..000000000 --- a/node_modules/@nodelib/fs.scandir/out/providers/async.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; -const fsStat = require("@nodelib/fs.stat"); -const rpl = require("run-parallel"); -const constants_1 = require("../constants"); -const utils = require("../utils"); -const common = require("./common"); -function read(directory, settings, callback) { - if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { - readdirWithFileTypes(directory, settings, callback); - return; - } - readdir(directory, settings, callback); -} -exports.read = read; -function readdirWithFileTypes(directory, settings, callback) { - settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { - if (readdirError !== null) { - callFailureCallback(callback, readdirError); - return; - } - const entries = dirents.map((dirent) => ({ - dirent, - name: dirent.name, - path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) - })); - if (!settings.followSymbolicLinks) { - callSuccessCallback(callback, entries); - return; - } - const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); - rpl(tasks, (rplError, rplEntries) => { - if (rplError !== null) { - callFailureCallback(callback, rplError); - return; - } - callSuccessCallback(callback, rplEntries); - }); - }); -} -exports.readdirWithFileTypes = readdirWithFileTypes; -function makeRplTaskEntry(entry, settings) { - return (done) => { - if (!entry.dirent.isSymbolicLink()) { - done(null, entry); - return; - } - settings.fs.stat(entry.path, (statError, stats) => { - if (statError !== null) { - if (settings.throwErrorOnBrokenSymbolicLink) { - done(statError); - return; - } - done(null, entry); - return; - } - entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); - done(null, entry); - }); - }; -} -function readdir(directory, settings, callback) { - settings.fs.readdir(directory, (readdirError, names) => { - if (readdirError !== null) { - callFailureCallback(callback, readdirError); - return; - } - const tasks = names.map((name) => { - const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); - return (done) => { - fsStat.stat(path, settings.fsStatSettings, (error, stats) => { - if (error !== null) { - done(error); - return; - } - const entry = { - name, - path, - dirent: utils.fs.createDirentFromStats(name, stats) - }; - if (settings.stats) { - entry.stats = stats; - } - done(null, entry); - }); - }; - }); - rpl(tasks, (rplError, entries) => { - if (rplError !== null) { - callFailureCallback(callback, rplError); - return; - } - callSuccessCallback(callback, entries); - }); - }); -} -exports.readdir = readdir; -function callFailureCallback(callback, error) { - callback(error); -} -function callSuccessCallback(callback, result) { - callback(null, result); -} diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts deleted file mode 100644 index 2b4d08b57..000000000 --- a/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function joinPathSegments(a: string, b: string, separator: string): string; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.js b/node_modules/@nodelib/fs.scandir/out/providers/common.js deleted file mode 100644 index 8724cb59a..000000000 --- a/node_modules/@nodelib/fs.scandir/out/providers/common.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.joinPathSegments = void 0; -function joinPathSegments(a, b, separator) { - /** - * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). - */ - if (a.endsWith(separator)) { - return a + b; - } - return a + separator + b; -} -exports.joinPathSegments = joinPathSegments; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts deleted file mode 100644 index e05c8f072..000000000 --- a/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type Settings from '../settings'; -import type { Entry } from '../types'; -export declare function read(directory: string, settings: Settings): Entry[]; -export declare function readdirWithFileTypes(directory: string, settings: Settings): Entry[]; -export declare function readdir(directory: string, settings: Settings): Entry[]; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.js b/node_modules/@nodelib/fs.scandir/out/providers/sync.js deleted file mode 100644 index 146db3434..000000000 --- a/node_modules/@nodelib/fs.scandir/out/providers/sync.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; -const fsStat = require("@nodelib/fs.stat"); -const constants_1 = require("../constants"); -const utils = require("../utils"); -const common = require("./common"); -function read(directory, settings) { - if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { - return readdirWithFileTypes(directory, settings); - } - return readdir(directory, settings); -} -exports.read = read; -function readdirWithFileTypes(directory, settings) { - const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); - return dirents.map((dirent) => { - const entry = { - dirent, - name: dirent.name, - path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) - }; - if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { - try { - const stats = settings.fs.statSync(entry.path); - entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); - } - catch (error) { - if (settings.throwErrorOnBrokenSymbolicLink) { - throw error; - } - } - } - return entry; - }); -} -exports.readdirWithFileTypes = readdirWithFileTypes; -function readdir(directory, settings) { - const names = settings.fs.readdirSync(directory); - return names.map((name) => { - const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); - const stats = fsStat.statSync(entryPath, settings.fsStatSettings); - const entry = { - name, - path: entryPath, - dirent: utils.fs.createDirentFromStats(name, stats) - }; - if (settings.stats) { - entry.stats = stats; - } - return entry; - }); -} -exports.readdir = readdir; diff --git a/node_modules/@nodelib/fs.scandir/out/settings.d.ts b/node_modules/@nodelib/fs.scandir/out/settings.d.ts deleted file mode 100644 index a0db11559..000000000 --- a/node_modules/@nodelib/fs.scandir/out/settings.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as fsStat from '@nodelib/fs.stat'; -import * as fs from './adapters/fs'; -export interface Options { - followSymbolicLinks?: boolean; - fs?: Partial; - pathSegmentSeparator?: string; - stats?: boolean; - throwErrorOnBrokenSymbolicLink?: boolean; -} -export default class Settings { - private readonly _options; - readonly followSymbolicLinks: boolean; - readonly fs: fs.FileSystemAdapter; - readonly pathSegmentSeparator: string; - readonly stats: boolean; - readonly throwErrorOnBrokenSymbolicLink: boolean; - readonly fsStatSettings: fsStat.Settings; - constructor(_options?: Options); - private _getValue; -} diff --git a/node_modules/@nodelib/fs.scandir/out/settings.js b/node_modules/@nodelib/fs.scandir/out/settings.js deleted file mode 100644 index 15a3e8cde..000000000 --- a/node_modules/@nodelib/fs.scandir/out/settings.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const path = require("path"); -const fsStat = require("@nodelib/fs.stat"); -const fs = require("./adapters/fs"); -class Settings { - constructor(_options = {}) { - this._options = _options; - this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); - this.fs = fs.createFileSystemAdapter(this._options.fs); - this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); - this.stats = this._getValue(this._options.stats, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); - this.fsStatSettings = new fsStat.Settings({ - followSymbolicLink: this.followSymbolicLinks, - fs: this.fs, - throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink - }); - } - _getValue(option, value) { - return option !== null && option !== void 0 ? option : value; - } -} -exports.default = Settings; diff --git a/node_modules/@nodelib/fs.scandir/out/types/index.d.ts b/node_modules/@nodelib/fs.scandir/out/types/index.d.ts deleted file mode 100644 index f326c5e5e..000000000 --- a/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// -import type * as fs from 'fs'; -export interface Entry { - dirent: Dirent; - name: string; - path: string; - stats?: Stats; -} -export declare type Stats = fs.Stats; -export declare type ErrnoException = NodeJS.ErrnoException; -export interface Dirent { - isBlockDevice: () => boolean; - isCharacterDevice: () => boolean; - isDirectory: () => boolean; - isFIFO: () => boolean; - isFile: () => boolean; - isSocket: () => boolean; - isSymbolicLink: () => boolean; - name: string; -} diff --git a/node_modules/@nodelib/fs.scandir/out/types/index.js b/node_modules/@nodelib/fs.scandir/out/types/index.js deleted file mode 100644 index c8ad2e549..000000000 --- a/node_modules/@nodelib/fs.scandir/out/types/index.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts b/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts deleted file mode 100644 index bb863f157..000000000 --- a/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { Dirent, Stats } from '../types'; -export declare function createDirentFromStats(name: string, stats: Stats): Dirent; diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.js b/node_modules/@nodelib/fs.scandir/out/utils/fs.js deleted file mode 100644 index ace7c74d6..000000000 --- a/node_modules/@nodelib/fs.scandir/out/utils/fs.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createDirentFromStats = void 0; -class DirentFromStats { - constructor(name, stats) { - this.name = name; - this.isBlockDevice = stats.isBlockDevice.bind(stats); - this.isCharacterDevice = stats.isCharacterDevice.bind(stats); - this.isDirectory = stats.isDirectory.bind(stats); - this.isFIFO = stats.isFIFO.bind(stats); - this.isFile = stats.isFile.bind(stats); - this.isSocket = stats.isSocket.bind(stats); - this.isSymbolicLink = stats.isSymbolicLink.bind(stats); - } -} -function createDirentFromStats(name, stats) { - return new DirentFromStats(name, stats); -} -exports.createDirentFromStats = createDirentFromStats; diff --git a/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts b/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts deleted file mode 100644 index 1b41954e7..000000000 --- a/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import * as fs from './fs'; -export { fs }; diff --git a/node_modules/@nodelib/fs.scandir/out/utils/index.js b/node_modules/@nodelib/fs.scandir/out/utils/index.js deleted file mode 100644 index f5de129f4..000000000 --- a/node_modules/@nodelib/fs.scandir/out/utils/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fs = void 0; -const fs = require("./fs"); -exports.fs = fs; diff --git a/node_modules/@nodelib/fs.scandir/package.json b/node_modules/@nodelib/fs.scandir/package.json deleted file mode 100644 index d3a89241b..000000000 --- a/node_modules/@nodelib/fs.scandir/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@nodelib/fs.scandir", - "version": "2.1.5", - "description": "List files and directories inside the specified directory", - "license": "MIT", - "repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir", - "keywords": [ - "NodeLib", - "fs", - "FileSystem", - "file system", - "scandir", - "readdir", - "dirent" - ], - "engines": { - "node": ">= 8" - }, - "files": [ - "out/**", - "!out/**/*.map", - "!out/**/*.spec.*" - ], - "main": "out/index.js", - "typings": "out/index.d.ts", - "scripts": { - "clean": "rimraf {tsconfig.tsbuildinfo,out}", - "lint": "eslint \"src/**/*.ts\" --cache", - "compile": "tsc -b .", - "compile:watch": "tsc -p . --watch --sourceMap", - "test": "mocha \"out/**/*.spec.js\" -s 0", - "build": "npm run clean && npm run compile && npm run lint && npm test", - "watch": "npm run clean && npm run compile:watch" - }, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "devDependencies": { - "@nodelib/fs.macchiato": "1.0.4", - "@types/run-parallel": "^1.1.0" - }, - "gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562" -} diff --git a/node_modules/@nodelib/fs.stat/LICENSE b/node_modules/@nodelib/fs.stat/LICENSE deleted file mode 100644 index 65a999460..000000000 --- a/node_modules/@nodelib/fs.stat/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Denis Malinochkin - -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/@nodelib/fs.stat/README.md b/node_modules/@nodelib/fs.stat/README.md deleted file mode 100644 index 686f0471d..000000000 --- a/node_modules/@nodelib/fs.stat/README.md +++ /dev/null @@ -1,126 +0,0 @@ -# @nodelib/fs.stat - -> Get the status of a file with some features. - -## :bulb: Highlights - -Wrapper around standard method `fs.lstat` and `fs.stat` with some features. - -* :beginner: Normally follows symbolic link. -* :gear: Can safely work with broken symbolic link. - -## Install - -```console -npm install @nodelib/fs.stat -``` - -## Usage - -```ts -import * as fsStat from '@nodelib/fs.stat'; - -fsStat.stat('path', (error, stats) => { /* … */ }); -``` - -## API - -### .stat(path, [optionsOrSettings], callback) - -Returns an instance of `fs.Stats` class for provided path with standard callback-style. - -```ts -fsStat.stat('path', (error, stats) => { /* … */ }); -fsStat.stat('path', {}, (error, stats) => { /* … */ }); -fsStat.stat('path', new fsStat.Settings(), (error, stats) => { /* … */ }); -``` - -### .statSync(path, [optionsOrSettings]) - -Returns an instance of `fs.Stats` class for provided path. - -```ts -const stats = fsStat.stat('path'); -const stats = fsStat.stat('path', {}); -const stats = fsStat.stat('path', new fsStat.Settings()); -``` - -#### path - -* Required: `true` -* Type: `string | Buffer | URL` - -A path to a file. If a URL is provided, it must use the `file:` protocol. - -#### optionsOrSettings - -* Required: `false` -* Type: `Options | Settings` -* Default: An instance of `Settings` class - -An [`Options`](#options) object or an instance of [`Settings`](#settings) class. - -> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. - -### Settings([options]) - -A class of full settings of the package. - -```ts -const settings = new fsStat.Settings({ followSymbolicLink: false }); - -const stats = fsStat.stat('path', settings); -``` - -## Options - -### `followSymbolicLink` - -* Type: `boolean` -* Default: `true` - -Follow symbolic link or not. Call `fs.stat` on symbolic link if `true`. - -### `markSymbolicLink` - -* Type: `boolean` -* Default: `false` - -Mark symbolic link by setting the return value of `isSymbolicLink` function to always `true` (even after `fs.stat`). - -> :book: Can be used if you want to know what is hidden behind a symbolic link, but still continue to know that it is a symbolic link. - -### `throwErrorOnBrokenSymbolicLink` - -* Type: `boolean` -* Default: `true` - -Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. - -### `fs` - -* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) -* Default: A default FS methods - -By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. - -```ts -interface FileSystemAdapter { - lstat?: typeof fs.lstat; - stat?: typeof fs.stat; - lstatSync?: typeof fs.lstatSync; - statSync?: typeof fs.statSync; -} - -const settings = new fsStat.Settings({ - fs: { lstat: fakeLstat } -}); -``` - -## Changelog - -See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. - -## License - -This software is released under the terms of the MIT license. diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts b/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts deleted file mode 100644 index 3af759c95..000000000 --- a/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -import * as fs from 'fs'; -import type { ErrnoException } from '../types'; -export declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void; -export declare type StatSynchronousMethod = (path: string) => fs.Stats; -export interface FileSystemAdapter { - lstat: StatAsynchronousMethod; - stat: StatAsynchronousMethod; - lstatSync: StatSynchronousMethod; - statSync: StatSynchronousMethod; -} -export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; -export declare function createFileSystemAdapter(fsMethods?: Partial): FileSystemAdapter; diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.js b/node_modules/@nodelib/fs.stat/out/adapters/fs.js deleted file mode 100644 index 8dc08c8ca..000000000 --- a/node_modules/@nodelib/fs.stat/out/adapters/fs.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; -const fs = require("fs"); -exports.FILE_SYSTEM_ADAPTER = { - lstat: fs.lstat, - stat: fs.stat, - lstatSync: fs.lstatSync, - statSync: fs.statSync -}; -function createFileSystemAdapter(fsMethods) { - if (fsMethods === undefined) { - return exports.FILE_SYSTEM_ADAPTER; - } - return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); -} -exports.createFileSystemAdapter = createFileSystemAdapter; diff --git a/node_modules/@nodelib/fs.stat/out/index.d.ts b/node_modules/@nodelib/fs.stat/out/index.d.ts deleted file mode 100644 index f95db995c..000000000 --- a/node_modules/@nodelib/fs.stat/out/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod } from './adapters/fs'; -import * as async from './providers/async'; -import Settings, { Options } from './settings'; -import type { Stats } from './types'; -declare type AsyncCallback = async.AsyncCallback; -declare function stat(path: string, callback: AsyncCallback): void; -declare function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; -declare namespace stat { - function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise; -} -declare function statSync(path: string, optionsOrSettings?: Options | Settings): Stats; -export { Settings, stat, statSync, AsyncCallback, FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod, Options, Stats }; diff --git a/node_modules/@nodelib/fs.stat/out/index.js b/node_modules/@nodelib/fs.stat/out/index.js deleted file mode 100644 index b23f7510d..000000000 --- a/node_modules/@nodelib/fs.stat/out/index.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.statSync = exports.stat = exports.Settings = void 0; -const async = require("./providers/async"); -const sync = require("./providers/sync"); -const settings_1 = require("./settings"); -exports.Settings = settings_1.default; -function stat(path, optionsOrSettingsOrCallback, callback) { - if (typeof optionsOrSettingsOrCallback === 'function') { - async.read(path, getSettings(), optionsOrSettingsOrCallback); - return; - } - async.read(path, getSettings(optionsOrSettingsOrCallback), callback); -} -exports.stat = stat; -function statSync(path, optionsOrSettings) { - const settings = getSettings(optionsOrSettings); - return sync.read(path, settings); -} -exports.statSync = statSync; -function getSettings(settingsOrOptions = {}) { - if (settingsOrOptions instanceof settings_1.default) { - return settingsOrOptions; - } - return new settings_1.default(settingsOrOptions); -} diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.d.ts b/node_modules/@nodelib/fs.stat/out/providers/async.d.ts deleted file mode 100644 index 85423ce11..000000000 --- a/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type Settings from '../settings'; -import type { ErrnoException, Stats } from '../types'; -export declare type AsyncCallback = (error: ErrnoException, stats: Stats) => void; -export declare function read(path: string, settings: Settings, callback: AsyncCallback): void; diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.js b/node_modules/@nodelib/fs.stat/out/providers/async.js deleted file mode 100644 index 983ff0e6c..000000000 --- a/node_modules/@nodelib/fs.stat/out/providers/async.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.read = void 0; -function read(path, settings, callback) { - settings.fs.lstat(path, (lstatError, lstat) => { - if (lstatError !== null) { - callFailureCallback(callback, lstatError); - return; - } - if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { - callSuccessCallback(callback, lstat); - return; - } - settings.fs.stat(path, (statError, stat) => { - if (statError !== null) { - if (settings.throwErrorOnBrokenSymbolicLink) { - callFailureCallback(callback, statError); - return; - } - callSuccessCallback(callback, lstat); - return; - } - if (settings.markSymbolicLink) { - stat.isSymbolicLink = () => true; - } - callSuccessCallback(callback, stat); - }); - }); -} -exports.read = read; -function callFailureCallback(callback, error) { - callback(error); -} -function callSuccessCallback(callback, result) { - callback(null, result); -} diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts b/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts deleted file mode 100644 index 428c3d792..000000000 --- a/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type Settings from '../settings'; -import type { Stats } from '../types'; -export declare function read(path: string, settings: Settings): Stats; diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.js b/node_modules/@nodelib/fs.stat/out/providers/sync.js deleted file mode 100644 index 1521c3616..000000000 --- a/node_modules/@nodelib/fs.stat/out/providers/sync.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.read = void 0; -function read(path, settings) { - const lstat = settings.fs.lstatSync(path); - if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { - return lstat; - } - try { - const stat = settings.fs.statSync(path); - if (settings.markSymbolicLink) { - stat.isSymbolicLink = () => true; - } - return stat; - } - catch (error) { - if (!settings.throwErrorOnBrokenSymbolicLink) { - return lstat; - } - throw error; - } -} -exports.read = read; diff --git a/node_modules/@nodelib/fs.stat/out/settings.d.ts b/node_modules/@nodelib/fs.stat/out/settings.d.ts deleted file mode 100644 index f4b3d4443..000000000 --- a/node_modules/@nodelib/fs.stat/out/settings.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as fs from './adapters/fs'; -export interface Options { - followSymbolicLink?: boolean; - fs?: Partial; - markSymbolicLink?: boolean; - throwErrorOnBrokenSymbolicLink?: boolean; -} -export default class Settings { - private readonly _options; - readonly followSymbolicLink: boolean; - readonly fs: fs.FileSystemAdapter; - readonly markSymbolicLink: boolean; - readonly throwErrorOnBrokenSymbolicLink: boolean; - constructor(_options?: Options); - private _getValue; -} diff --git a/node_modules/@nodelib/fs.stat/out/settings.js b/node_modules/@nodelib/fs.stat/out/settings.js deleted file mode 100644 index 111ec09ca..000000000 --- a/node_modules/@nodelib/fs.stat/out/settings.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const fs = require("./adapters/fs"); -class Settings { - constructor(_options = {}) { - this._options = _options; - this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); - this.fs = fs.createFileSystemAdapter(this._options.fs); - this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); - } - _getValue(option, value) { - return option !== null && option !== void 0 ? option : value; - } -} -exports.default = Settings; diff --git a/node_modules/@nodelib/fs.stat/out/types/index.d.ts b/node_modules/@nodelib/fs.stat/out/types/index.d.ts deleted file mode 100644 index 74c08ed2f..000000000 --- a/node_modules/@nodelib/fs.stat/out/types/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/// -import type * as fs from 'fs'; -export declare type Stats = fs.Stats; -export declare type ErrnoException = NodeJS.ErrnoException; diff --git a/node_modules/@nodelib/fs.stat/out/types/index.js b/node_modules/@nodelib/fs.stat/out/types/index.js deleted file mode 100644 index c8ad2e549..000000000 --- a/node_modules/@nodelib/fs.stat/out/types/index.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/@nodelib/fs.stat/package.json b/node_modules/@nodelib/fs.stat/package.json deleted file mode 100644 index f2540c289..000000000 --- a/node_modules/@nodelib/fs.stat/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@nodelib/fs.stat", - "version": "2.0.5", - "description": "Get the status of a file with some features", - "license": "MIT", - "repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat", - "keywords": [ - "NodeLib", - "fs", - "FileSystem", - "file system", - "stat" - ], - "engines": { - "node": ">= 8" - }, - "files": [ - "out/**", - "!out/**/*.map", - "!out/**/*.spec.*" - ], - "main": "out/index.js", - "typings": "out/index.d.ts", - "scripts": { - "clean": "rimraf {tsconfig.tsbuildinfo,out}", - "lint": "eslint \"src/**/*.ts\" --cache", - "compile": "tsc -b .", - "compile:watch": "tsc -p . --watch --sourceMap", - "test": "mocha \"out/**/*.spec.js\" -s 0", - "build": "npm run clean && npm run compile && npm run lint && npm test", - "watch": "npm run clean && npm run compile:watch" - }, - "devDependencies": { - "@nodelib/fs.macchiato": "1.0.4" - }, - "gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562" -} diff --git a/node_modules/@nodelib/fs.walk/LICENSE b/node_modules/@nodelib/fs.walk/LICENSE deleted file mode 100644 index 65a999460..000000000 --- a/node_modules/@nodelib/fs.walk/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Denis Malinochkin - -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/@nodelib/fs.walk/README.md b/node_modules/@nodelib/fs.walk/README.md deleted file mode 100644 index 6ccc08db4..000000000 --- a/node_modules/@nodelib/fs.walk/README.md +++ /dev/null @@ -1,215 +0,0 @@ -# @nodelib/fs.walk - -> A library for efficiently walking a directory recursively. - -## :bulb: Highlights - -* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). -* :rocket: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type for performance reasons. See [`old` and `modern` mode](https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode). -* :gear: Built-in directories/files and error filtering system. -* :link: Can safely work with broken symbolic links. - -## Install - -```console -npm install @nodelib/fs.walk -``` - -## Usage - -```ts -import * as fsWalk from '@nodelib/fs.walk'; - -fsWalk.walk('path', (error, entries) => { /* … */ }); -``` - -## API - -### .walk(path, [optionsOrSettings], callback) - -Reads the directory recursively and asynchronously. Requires a callback function. - -> :book: If you want to use the Promise API, use `util.promisify`. - -```ts -fsWalk.walk('path', (error, entries) => { /* … */ }); -fsWalk.walk('path', {}, (error, entries) => { /* … */ }); -fsWalk.walk('path', new fsWalk.Settings(), (error, entries) => { /* … */ }); -``` - -### .walkStream(path, [optionsOrSettings]) - -Reads the directory recursively and asynchronously. [Readable Stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_readable_streams) is used as a provider. - -```ts -const stream = fsWalk.walkStream('path'); -const stream = fsWalk.walkStream('path', {}); -const stream = fsWalk.walkStream('path', new fsWalk.Settings()); -``` - -### .walkSync(path, [optionsOrSettings]) - -Reads the directory recursively and synchronously. Returns an array of entries. - -```ts -const entries = fsWalk.walkSync('path'); -const entries = fsWalk.walkSync('path', {}); -const entries = fsWalk.walkSync('path', new fsWalk.Settings()); -``` - -#### path - -* Required: `true` -* Type: `string | Buffer | URL` - -A path to a file. If a URL is provided, it must use the `file:` protocol. - -#### optionsOrSettings - -* Required: `false` -* Type: `Options | Settings` -* Default: An instance of `Settings` class - -An [`Options`](#options) object or an instance of [`Settings`](#settings) class. - -> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. - -### Settings([options]) - -A class of full settings of the package. - -```ts -const settings = new fsWalk.Settings({ followSymbolicLinks: true }); - -const entries = fsWalk.walkSync('path', settings); -``` - -## Entry - -* `name` — The name of the entry (`unknown.txt`). -* `path` — The path of the entry relative to call directory (`root/unknown.txt`). -* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. -* [`stats`] — An instance of `fs.Stats` class. - -## Options - -### basePath - -* Type: `string` -* Default: `undefined` - -By default, all paths are built relative to the root path. You can use this option to set custom root path. - -In the example below we read the files from the `root` directory, but in the results the root path will be `custom`. - -```ts -fsWalk.walkSync('root'); // → ['root/file.txt'] -fsWalk.walkSync('root', { basePath: 'custom' }); // → ['custom/file.txt'] -``` - -### concurrency - -* Type: `number` -* Default: `Infinity` - -The maximum number of concurrent calls to `fs.readdir`. - -> :book: The higher the number, the higher performance and the load on the File System. If you want to read in quiet mode, set the value to `4 * os.cpus().length` (4 is default size of [thread pool work scheduling](http://docs.libuv.org/en/v1.x/threadpool.html#thread-pool-work-scheduling)). - -### deepFilter - -* Type: [`DeepFilterFunction`](./src/settings.ts) -* Default: `undefined` - -A function that indicates whether the directory will be read deep or not. - -```ts -// Skip all directories that starts with `node_modules` -const filter: DeepFilterFunction = (entry) => !entry.path.startsWith('node_modules'); -``` - -### entryFilter - -* Type: [`EntryFilterFunction`](./src/settings.ts) -* Default: `undefined` - -A function that indicates whether the entry will be included to results or not. - -```ts -// Exclude all `.js` files from results -const filter: EntryFilterFunction = (entry) => !entry.name.endsWith('.js'); -``` - -### errorFilter - -* Type: [`ErrorFilterFunction`](./src/settings.ts) -* Default: `undefined` - -A function that allows you to skip errors that occur when reading directories. - -For example, you can skip `ENOENT` errors if required: - -```ts -// Skip all ENOENT errors -const filter: ErrorFilterFunction = (error) => error.code == 'ENOENT'; -``` - -### stats - -* Type: `boolean` -* Default: `false` - -Adds an instance of `fs.Stats` class to the [`Entry`](#entry). - -> :book: Always use `fs.readdir` with additional `fs.lstat/fs.stat` calls to determine the entry type. - -### followSymbolicLinks - -* Type: `boolean` -* Default: `false` - -Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. - -### `throwErrorOnBrokenSymbolicLink` - -* Type: `boolean` -* Default: `true` - -Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. - -### `pathSegmentSeparator` - -* Type: `string` -* Default: `path.sep` - -By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. - -### `fs` - -* Type: `FileSystemAdapter` -* Default: A default FS methods - -By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. - -```ts -interface FileSystemAdapter { - lstat: typeof fs.lstat; - stat: typeof fs.stat; - lstatSync: typeof fs.lstatSync; - statSync: typeof fs.statSync; - readdir: typeof fs.readdir; - readdirSync: typeof fs.readdirSync; -} - -const settings = new fsWalk.Settings({ - fs: { lstat: fakeLstat } -}); -``` - -## Changelog - -See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. - -## License - -This software is released under the terms of the MIT license. diff --git a/node_modules/@nodelib/fs.walk/out/index.d.ts b/node_modules/@nodelib/fs.walk/out/index.d.ts deleted file mode 100644 index 8864c7bff..000000000 --- a/node_modules/@nodelib/fs.walk/out/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// -import type { Readable } from 'stream'; -import type { Dirent, FileSystemAdapter } from '@nodelib/fs.scandir'; -import { AsyncCallback } from './providers/async'; -import Settings, { DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction, Options } from './settings'; -import type { Entry } from './types'; -declare function walk(directory: string, callback: AsyncCallback): void; -declare function walk(directory: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; -declare namespace walk { - function __promisify__(directory: string, optionsOrSettings?: Options | Settings): Promise; -} -declare function walkSync(directory: string, optionsOrSettings?: Options | Settings): Entry[]; -declare function walkStream(directory: string, optionsOrSettings?: Options | Settings): Readable; -export { walk, walkSync, walkStream, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, Options, DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction }; diff --git a/node_modules/@nodelib/fs.walk/out/index.js b/node_modules/@nodelib/fs.walk/out/index.js deleted file mode 100644 index 15207874a..000000000 --- a/node_modules/@nodelib/fs.walk/out/index.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; -const async_1 = require("./providers/async"); -const stream_1 = require("./providers/stream"); -const sync_1 = require("./providers/sync"); -const settings_1 = require("./settings"); -exports.Settings = settings_1.default; -function walk(directory, optionsOrSettingsOrCallback, callback) { - if (typeof optionsOrSettingsOrCallback === 'function') { - new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); - return; - } - new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); -} -exports.walk = walk; -function walkSync(directory, optionsOrSettings) { - const settings = getSettings(optionsOrSettings); - const provider = new sync_1.default(directory, settings); - return provider.read(); -} -exports.walkSync = walkSync; -function walkStream(directory, optionsOrSettings) { - const settings = getSettings(optionsOrSettings); - const provider = new stream_1.default(directory, settings); - return provider.read(); -} -exports.walkStream = walkStream; -function getSettings(settingsOrOptions = {}) { - if (settingsOrOptions instanceof settings_1.default) { - return settingsOrOptions; - } - return new settings_1.default(settingsOrOptions); -} diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.d.ts b/node_modules/@nodelib/fs.walk/out/providers/async.d.ts deleted file mode 100644 index 0f6717d78..000000000 --- a/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import AsyncReader from '../readers/async'; -import type Settings from '../settings'; -import type { Entry, Errno } from '../types'; -export declare type AsyncCallback = (error: Errno, entries: Entry[]) => void; -export default class AsyncProvider { - private readonly _root; - private readonly _settings; - protected readonly _reader: AsyncReader; - private readonly _storage; - constructor(_root: string, _settings: Settings); - read(callback: AsyncCallback): void; -} diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.js b/node_modules/@nodelib/fs.walk/out/providers/async.js deleted file mode 100644 index 51d3be51a..000000000 --- a/node_modules/@nodelib/fs.walk/out/providers/async.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const async_1 = require("../readers/async"); -class AsyncProvider { - constructor(_root, _settings) { - this._root = _root; - this._settings = _settings; - this._reader = new async_1.default(this._root, this._settings); - this._storage = []; - } - read(callback) { - this._reader.onError((error) => { - callFailureCallback(callback, error); - }); - this._reader.onEntry((entry) => { - this._storage.push(entry); - }); - this._reader.onEnd(() => { - callSuccessCallback(callback, this._storage); - }); - this._reader.read(); - } -} -exports.default = AsyncProvider; -function callFailureCallback(callback, error) { - callback(error); -} -function callSuccessCallback(callback, entries) { - callback(null, entries); -} diff --git a/node_modules/@nodelib/fs.walk/out/providers/index.d.ts b/node_modules/@nodelib/fs.walk/out/providers/index.d.ts deleted file mode 100644 index 874f60c5a..000000000 --- a/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import AsyncProvider from './async'; -import StreamProvider from './stream'; -import SyncProvider from './sync'; -export { AsyncProvider, StreamProvider, SyncProvider }; diff --git a/node_modules/@nodelib/fs.walk/out/providers/index.js b/node_modules/@nodelib/fs.walk/out/providers/index.js deleted file mode 100644 index 4c2529ce8..000000000 --- a/node_modules/@nodelib/fs.walk/out/providers/index.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SyncProvider = exports.StreamProvider = exports.AsyncProvider = void 0; -const async_1 = require("./async"); -exports.AsyncProvider = async_1.default; -const stream_1 = require("./stream"); -exports.StreamProvider = stream_1.default; -const sync_1 = require("./sync"); -exports.SyncProvider = sync_1.default; diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts b/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts deleted file mode 100644 index 294185f85..000000000 --- a/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -import { Readable } from 'stream'; -import AsyncReader from '../readers/async'; -import type Settings from '../settings'; -export default class StreamProvider { - private readonly _root; - private readonly _settings; - protected readonly _reader: AsyncReader; - protected readonly _stream: Readable; - constructor(_root: string, _settings: Settings); - read(): Readable; -} diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.js b/node_modules/@nodelib/fs.walk/out/providers/stream.js deleted file mode 100644 index 51298b0f5..000000000 --- a/node_modules/@nodelib/fs.walk/out/providers/stream.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = require("stream"); -const async_1 = require("../readers/async"); -class StreamProvider { - constructor(_root, _settings) { - this._root = _root; - this._settings = _settings; - this._reader = new async_1.default(this._root, this._settings); - this._stream = new stream_1.Readable({ - objectMode: true, - read: () => { }, - destroy: () => { - if (!this._reader.isDestroyed) { - this._reader.destroy(); - } - } - }); - } - read() { - this._reader.onError((error) => { - this._stream.emit('error', error); - }); - this._reader.onEntry((entry) => { - this._stream.push(entry); - }); - this._reader.onEnd(() => { - this._stream.push(null); - }); - this._reader.read(); - return this._stream; - } -} -exports.default = StreamProvider; diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts b/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts deleted file mode 100644 index 551c42e41..000000000 --- a/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import SyncReader from '../readers/sync'; -import type Settings from '../settings'; -import type { Entry } from '../types'; -export default class SyncProvider { - private readonly _root; - private readonly _settings; - protected readonly _reader: SyncReader; - constructor(_root: string, _settings: Settings); - read(): Entry[]; -} diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.js b/node_modules/@nodelib/fs.walk/out/providers/sync.js deleted file mode 100644 index faab6ca2a..000000000 --- a/node_modules/@nodelib/fs.walk/out/providers/sync.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const sync_1 = require("../readers/sync"); -class SyncProvider { - constructor(_root, _settings) { - this._root = _root; - this._settings = _settings; - this._reader = new sync_1.default(this._root, this._settings); - } - read() { - return this._reader.read(); - } -} -exports.default = SyncProvider; diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.d.ts b/node_modules/@nodelib/fs.walk/out/readers/async.d.ts deleted file mode 100644 index 9acf4e6c2..000000000 --- a/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// -import { EventEmitter } from 'events'; -import * as fsScandir from '@nodelib/fs.scandir'; -import type Settings from '../settings'; -import type { Entry, Errno } from '../types'; -import Reader from './reader'; -declare type EntryEventCallback = (entry: Entry) => void; -declare type ErrorEventCallback = (error: Errno) => void; -declare type EndEventCallback = () => void; -export default class AsyncReader extends Reader { - protected readonly _settings: Settings; - protected readonly _scandir: typeof fsScandir.scandir; - protected readonly _emitter: EventEmitter; - private readonly _queue; - private _isFatalError; - private _isDestroyed; - constructor(_root: string, _settings: Settings); - read(): EventEmitter; - get isDestroyed(): boolean; - destroy(): void; - onEntry(callback: EntryEventCallback): void; - onError(callback: ErrorEventCallback): void; - onEnd(callback: EndEventCallback): void; - private _pushToQueue; - private _worker; - private _handleError; - private _handleEntry; - private _emitEntry; -} -export {}; diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.js b/node_modules/@nodelib/fs.walk/out/readers/async.js deleted file mode 100644 index ebe8dd573..000000000 --- a/node_modules/@nodelib/fs.walk/out/readers/async.js +++ /dev/null @@ -1,97 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const events_1 = require("events"); -const fsScandir = require("@nodelib/fs.scandir"); -const fastq = require("fastq"); -const common = require("./common"); -const reader_1 = require("./reader"); -class AsyncReader extends reader_1.default { - constructor(_root, _settings) { - super(_root, _settings); - this._settings = _settings; - this._scandir = fsScandir.scandir; - this._emitter = new events_1.EventEmitter(); - this._queue = fastq(this._worker.bind(this), this._settings.concurrency); - this._isFatalError = false; - this._isDestroyed = false; - this._queue.drain = () => { - if (!this._isFatalError) { - this._emitter.emit('end'); - } - }; - } - read() { - this._isFatalError = false; - this._isDestroyed = false; - setImmediate(() => { - this._pushToQueue(this._root, this._settings.basePath); - }); - return this._emitter; - } - get isDestroyed() { - return this._isDestroyed; - } - destroy() { - if (this._isDestroyed) { - throw new Error('The reader is already destroyed'); - } - this._isDestroyed = true; - this._queue.killAndDrain(); - } - onEntry(callback) { - this._emitter.on('entry', callback); - } - onError(callback) { - this._emitter.once('error', callback); - } - onEnd(callback) { - this._emitter.once('end', callback); - } - _pushToQueue(directory, base) { - const queueItem = { directory, base }; - this._queue.push(queueItem, (error) => { - if (error !== null) { - this._handleError(error); - } - }); - } - _worker(item, done) { - this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { - if (error !== null) { - done(error, undefined); - return; - } - for (const entry of entries) { - this._handleEntry(entry, item.base); - } - done(null, undefined); - }); - } - _handleError(error) { - if (this._isDestroyed || !common.isFatalError(this._settings, error)) { - return; - } - this._isFatalError = true; - this._isDestroyed = true; - this._emitter.emit('error', error); - } - _handleEntry(entry, base) { - if (this._isDestroyed || this._isFatalError) { - return; - } - const fullpath = entry.path; - if (base !== undefined) { - entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); - } - if (common.isAppliedFilter(this._settings.entryFilter, entry)) { - this._emitEntry(entry); - } - if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { - this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); - } - } - _emitEntry(entry) { - this._emitter.emit('entry', entry); - } -} -exports.default = AsyncReader; diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.d.ts b/node_modules/@nodelib/fs.walk/out/readers/common.d.ts deleted file mode 100644 index 5985f97c4..000000000 --- a/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { FilterFunction } from '../settings'; -import type Settings from '../settings'; -import type { Errno } from '../types'; -export declare function isFatalError(settings: Settings, error: Errno): boolean; -export declare function isAppliedFilter(filter: FilterFunction | null, value: T): boolean; -export declare function replacePathSegmentSeparator(filepath: string, separator: string): string; -export declare function joinPathSegments(a: string, b: string, separator: string): string; diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.js b/node_modules/@nodelib/fs.walk/out/readers/common.js deleted file mode 100644 index a93572f48..000000000 --- a/node_modules/@nodelib/fs.walk/out/readers/common.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; -function isFatalError(settings, error) { - if (settings.errorFilter === null) { - return true; - } - return !settings.errorFilter(error); -} -exports.isFatalError = isFatalError; -function isAppliedFilter(filter, value) { - return filter === null || filter(value); -} -exports.isAppliedFilter = isAppliedFilter; -function replacePathSegmentSeparator(filepath, separator) { - return filepath.split(/[/\\]/).join(separator); -} -exports.replacePathSegmentSeparator = replacePathSegmentSeparator; -function joinPathSegments(a, b, separator) { - if (a === '') { - return b; - } - /** - * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). - */ - if (a.endsWith(separator)) { - return a + b; - } - return a + separator + b; -} -exports.joinPathSegments = joinPathSegments; diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts b/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts deleted file mode 100644 index e1f383b25..000000000 --- a/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type Settings from '../settings'; -export default class Reader { - protected readonly _root: string; - protected readonly _settings: Settings; - constructor(_root: string, _settings: Settings); -} diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.js b/node_modules/@nodelib/fs.walk/out/readers/reader.js deleted file mode 100644 index 782f07cbf..000000000 --- a/node_modules/@nodelib/fs.walk/out/readers/reader.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const common = require("./common"); -class Reader { - constructor(_root, _settings) { - this._root = _root; - this._settings = _settings; - this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); - } -} -exports.default = Reader; diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts b/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts deleted file mode 100644 index af4103353..000000000 --- a/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as fsScandir from '@nodelib/fs.scandir'; -import type { Entry } from '../types'; -import Reader from './reader'; -export default class SyncReader extends Reader { - protected readonly _scandir: typeof fsScandir.scandirSync; - private readonly _storage; - private readonly _queue; - read(): Entry[]; - private _pushToQueue; - private _handleQueue; - private _handleDirectory; - private _handleError; - private _handleEntry; - private _pushToStorage; -} diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.js b/node_modules/@nodelib/fs.walk/out/readers/sync.js deleted file mode 100644 index 9a8d5a6f1..000000000 --- a/node_modules/@nodelib/fs.walk/out/readers/sync.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const fsScandir = require("@nodelib/fs.scandir"); -const common = require("./common"); -const reader_1 = require("./reader"); -class SyncReader extends reader_1.default { - constructor() { - super(...arguments); - this._scandir = fsScandir.scandirSync; - this._storage = []; - this._queue = new Set(); - } - read() { - this._pushToQueue(this._root, this._settings.basePath); - this._handleQueue(); - return this._storage; - } - _pushToQueue(directory, base) { - this._queue.add({ directory, base }); - } - _handleQueue() { - for (const item of this._queue.values()) { - this._handleDirectory(item.directory, item.base); - } - } - _handleDirectory(directory, base) { - try { - const entries = this._scandir(directory, this._settings.fsScandirSettings); - for (const entry of entries) { - this._handleEntry(entry, base); - } - } - catch (error) { - this._handleError(error); - } - } - _handleError(error) { - if (!common.isFatalError(this._settings, error)) { - return; - } - throw error; - } - _handleEntry(entry, base) { - const fullpath = entry.path; - if (base !== undefined) { - entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); - } - if (common.isAppliedFilter(this._settings.entryFilter, entry)) { - this._pushToStorage(entry); - } - if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { - this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); - } - } - _pushToStorage(entry) { - this._storage.push(entry); - } -} -exports.default = SyncReader; diff --git a/node_modules/@nodelib/fs.walk/out/settings.d.ts b/node_modules/@nodelib/fs.walk/out/settings.d.ts deleted file mode 100644 index d1c4b45f6..000000000 --- a/node_modules/@nodelib/fs.walk/out/settings.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as fsScandir from '@nodelib/fs.scandir'; -import type { Entry, Errno } from './types'; -export declare type FilterFunction = (value: T) => boolean; -export declare type DeepFilterFunction = FilterFunction; -export declare type EntryFilterFunction = FilterFunction; -export declare type ErrorFilterFunction = FilterFunction; -export interface Options { - basePath?: string; - concurrency?: number; - deepFilter?: DeepFilterFunction; - entryFilter?: EntryFilterFunction; - errorFilter?: ErrorFilterFunction; - followSymbolicLinks?: boolean; - fs?: Partial; - pathSegmentSeparator?: string; - stats?: boolean; - throwErrorOnBrokenSymbolicLink?: boolean; -} -export default class Settings { - private readonly _options; - readonly basePath?: string; - readonly concurrency: number; - readonly deepFilter: DeepFilterFunction | null; - readonly entryFilter: EntryFilterFunction | null; - readonly errorFilter: ErrorFilterFunction | null; - readonly pathSegmentSeparator: string; - readonly fsScandirSettings: fsScandir.Settings; - constructor(_options?: Options); - private _getValue; -} diff --git a/node_modules/@nodelib/fs.walk/out/settings.js b/node_modules/@nodelib/fs.walk/out/settings.js deleted file mode 100644 index d7a85c81e..000000000 --- a/node_modules/@nodelib/fs.walk/out/settings.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const path = require("path"); -const fsScandir = require("@nodelib/fs.scandir"); -class Settings { - constructor(_options = {}) { - this._options = _options; - this.basePath = this._getValue(this._options.basePath, undefined); - this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY); - this.deepFilter = this._getValue(this._options.deepFilter, null); - this.entryFilter = this._getValue(this._options.entryFilter, null); - this.errorFilter = this._getValue(this._options.errorFilter, null); - this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); - this.fsScandirSettings = new fsScandir.Settings({ - followSymbolicLinks: this._options.followSymbolicLinks, - fs: this._options.fs, - pathSegmentSeparator: this._options.pathSegmentSeparator, - stats: this._options.stats, - throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink - }); - } - _getValue(option, value) { - return option !== null && option !== void 0 ? option : value; - } -} -exports.default = Settings; diff --git a/node_modules/@nodelib/fs.walk/out/types/index.d.ts b/node_modules/@nodelib/fs.walk/out/types/index.d.ts deleted file mode 100644 index 6ee9bd3f9..000000000 --- a/node_modules/@nodelib/fs.walk/out/types/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/// -import type * as scandir from '@nodelib/fs.scandir'; -export declare type Entry = scandir.Entry; -export declare type Errno = NodeJS.ErrnoException; -export interface QueueItem { - directory: string; - base?: string; -} diff --git a/node_modules/@nodelib/fs.walk/out/types/index.js b/node_modules/@nodelib/fs.walk/out/types/index.js deleted file mode 100644 index c8ad2e549..000000000 --- a/node_modules/@nodelib/fs.walk/out/types/index.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/@nodelib/fs.walk/package.json b/node_modules/@nodelib/fs.walk/package.json deleted file mode 100644 index 86bfce48b..000000000 --- a/node_modules/@nodelib/fs.walk/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@nodelib/fs.walk", - "version": "1.2.8", - "description": "A library for efficiently walking a directory recursively", - "license": "MIT", - "repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk", - "keywords": [ - "NodeLib", - "fs", - "FileSystem", - "file system", - "walk", - "scanner", - "crawler" - ], - "engines": { - "node": ">= 8" - }, - "files": [ - "out/**", - "!out/**/*.map", - "!out/**/*.spec.*", - "!out/**/tests/**" - ], - "main": "out/index.js", - "typings": "out/index.d.ts", - "scripts": { - "clean": "rimraf {tsconfig.tsbuildinfo,out}", - "lint": "eslint \"src/**/*.ts\" --cache", - "compile": "tsc -b .", - "compile:watch": "tsc -p . --watch --sourceMap", - "test": "mocha \"out/**/*.spec.js\" -s 0", - "build": "npm run clean && npm run compile && npm run lint && npm test", - "watch": "npm run clean && npm run compile:watch" - }, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "devDependencies": { - "@nodelib/fs.macchiato": "1.0.4" - }, - "gitHead": "1e5bad48565da2b06b8600e744324ea240bf49d8" -} diff --git a/node_modules/@sinclair/typebox/compiler/compiler.d.ts b/node_modules/@sinclair/typebox/compiler/compiler.d.ts deleted file mode 100644 index c655d4709..000000000 --- a/node_modules/@sinclair/typebox/compiler/compiler.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ValueError } from '../errors/index'; -import * as Types from '../typebox'; -export type CheckFunction = (value: unknown) => boolean; -export declare class TypeCheck { - private readonly schema; - private readonly references; - private readonly checkFunc; - private readonly code; - constructor(schema: T, references: Types.TSchema[], checkFunc: CheckFunction, code: string); - /** Returns the generated validation code used to validate this type. */ - Code(): string; - /** Returns an iterator for each error in this value. */ - Errors(value: unknown): IterableIterator; - /** Returns true if the value matches the compiled type. */ - Check(value: unknown): value is Types.Static; -} -export declare namespace MemberExpression { - function Encode(object: string, key: string): string; -} -export declare class TypeCompilerUnknownTypeError extends Error { - readonly schema: Types.TSchema; - constructor(schema: Types.TSchema); -} -/** Compiles Types for Runtime Type Checking */ -export declare namespace TypeCompiler { - /** Compiles the given type for runtime type checking. This compiler only accepts known TypeBox types non-inclusive of unsafe types. */ - function Compile(schema: T, references?: Types.TSchema[]): TypeCheck; -} diff --git a/node_modules/@sinclair/typebox/compiler/compiler.js b/node_modules/@sinclair/typebox/compiler/compiler.js deleted file mode 100644 index fc87b4f2c..000000000 --- a/node_modules/@sinclair/typebox/compiler/compiler.js +++ /dev/null @@ -1,498 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/compiler - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TypeCompiler = exports.TypeCompilerUnknownTypeError = exports.MemberExpression = exports.TypeCheck = void 0; -const index_1 = require("../errors/index"); -const index_2 = require("../system/index"); -const index_3 = require("../guard/index"); -const index_4 = require("../format/index"); -const index_5 = require("../custom/index"); -const index_6 = require("../hash/index"); -const Types = require("../typebox"); -// ------------------------------------------------------------------- -// TypeCheck -// ------------------------------------------------------------------- -class TypeCheck { - constructor(schema, references, checkFunc, code) { - this.schema = schema; - this.references = references; - this.checkFunc = checkFunc; - this.code = code; - } - /** Returns the generated validation code used to validate this type. */ - Code() { - return this.code; - } - /** Returns an iterator for each error in this value. */ - Errors(value) { - return index_1.ValueErrors.Errors(this.schema, this.references, value); - } - /** Returns true if the value matches the compiled type. */ - Check(value) { - return this.checkFunc(value); - } -} -exports.TypeCheck = TypeCheck; -// ------------------------------------------------------------------- -// Character -// ------------------------------------------------------------------- -var Character; -(function (Character) { - function DollarSign(code) { - return code === 36; - } - Character.DollarSign = DollarSign; - function Underscore(code) { - return code === 95; - } - Character.Underscore = Underscore; - function Numeric(code) { - return code >= 48 && code <= 57; - } - Character.Numeric = Numeric; - function Alpha(code) { - return (code >= 65 && code <= 90) || (code >= 97 && code <= 122); - } - Character.Alpha = Alpha; -})(Character || (Character = {})); -// ------------------------------------------------------------------- -// Identifier -// ------------------------------------------------------------------- -var Identifier; -(function (Identifier) { - function Encode($id) { - const buffer = []; - for (let i = 0; i < $id.length; i++) { - const code = $id.charCodeAt(i); - if (Character.Numeric(code) || Character.Alpha(code)) { - buffer.push($id.charAt(i)); - } - else { - buffer.push(`_${code}_`); - } - } - return buffer.join('').replace(/__/g, '_'); - } - Identifier.Encode = Encode; -})(Identifier || (Identifier = {})); -// ------------------------------------------------------------------- -// MemberExpression -// ------------------------------------------------------------------- -var MemberExpression; -(function (MemberExpression) { - function Check(propertyName) { - if (propertyName.length === 0) - return false; - { - const code = propertyName.charCodeAt(0); - if (!(Character.DollarSign(code) || Character.Underscore(code) || Character.Alpha(code))) { - return false; - } - } - for (let i = 1; i < propertyName.length; i++) { - const code = propertyName.charCodeAt(i); - if (!(Character.DollarSign(code) || Character.Underscore(code) || Character.Alpha(code) || Character.Numeric(code))) { - return false; - } - } - return true; - } - function Encode(object, key) { - return !Check(key) ? `${object}['${key}']` : `${object}.${key}`; - } - MemberExpression.Encode = Encode; -})(MemberExpression = exports.MemberExpression || (exports.MemberExpression = {})); -// ------------------------------------------------------------------- -// TypeCompiler -// ------------------------------------------------------------------- -class TypeCompilerUnknownTypeError extends Error { - constructor(schema) { - super('TypeCompiler: Unknown type'); - this.schema = schema; - } -} -exports.TypeCompilerUnknownTypeError = TypeCompilerUnknownTypeError; -/** Compiles Types for Runtime Type Checking */ -var TypeCompiler; -(function (TypeCompiler) { - // ------------------------------------------------------------------- - // Guards - // ------------------------------------------------------------------- - function IsNumber(value) { - return typeof value === 'number' && !globalThis.isNaN(value); - } - // ------------------------------------------------------------------- - // Types - // ------------------------------------------------------------------- - function* Any(schema, value) { - yield '(true)'; - } - function* Array(schema, value) { - const expression = CreateExpression(schema.items, 'value'); - yield `(Array.isArray(${value}) && ${value}.every(value => ${expression}))`; - if (IsNumber(schema.minItems)) - yield `(${value}.length >= ${schema.minItems})`; - if (IsNumber(schema.maxItems)) - yield `(${value}.length <= ${schema.maxItems})`; - if (schema.uniqueItems === true) - yield `((function() { const set = new Set(); for(const element of ${value}) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true })())`; - } - function* Boolean(schema, value) { - yield `(typeof ${value} === 'boolean')`; - } - function* Constructor(schema, value) { - yield* Visit(schema.returns, `${value}.prototype`); - } - function* Date(schema, value) { - yield `(${value} instanceof Date) && !isNaN(${value}.getTime())`; - if (IsNumber(schema.exclusiveMinimumTimestamp)) - yield `(${value}.getTime() > ${schema.exclusiveMinimumTimestamp})`; - if (IsNumber(schema.exclusiveMaximumTimestamp)) - yield `(${value}.getTime() < ${schema.exclusiveMaximumTimestamp})`; - if (IsNumber(schema.minimumTimestamp)) - yield `(${value}.getTime() >= ${schema.minimumTimestamp})`; - if (IsNumber(schema.maximumTimestamp)) - yield `(${value}.getTime() <= ${schema.maximumTimestamp})`; - } - function* Function(schema, value) { - yield `(typeof ${value} === 'function')`; - } - function* Integer(schema, value) { - yield `(typeof ${value} === 'number' && Number.isInteger(${value}))`; - if (IsNumber(schema.multipleOf)) - yield `(${value} % ${schema.multipleOf} === 0)`; - if (IsNumber(schema.exclusiveMinimum)) - yield `(${value} > ${schema.exclusiveMinimum})`; - if (IsNumber(schema.exclusiveMaximum)) - yield `(${value} < ${schema.exclusiveMaximum})`; - if (IsNumber(schema.minimum)) - yield `(${value} >= ${schema.minimum})`; - if (IsNumber(schema.maximum)) - yield `(${value} <= ${schema.maximum})`; - } - function* Literal(schema, value) { - if (typeof schema.const === 'number' || typeof schema.const === 'boolean') { - yield `(${value} === ${schema.const})`; - } - else { - yield `(${value} === '${schema.const}')`; - } - } - function* Never(schema, value) { - yield `(false)`; - } - function* Null(schema, value) { - yield `(${value} === null)`; - } - function* Number(schema, value) { - if (index_2.TypeSystem.AllowNaN) { - yield `(typeof ${value} === 'number')`; - } - else { - yield `(typeof ${value} === 'number' && !isNaN(${value}))`; - } - if (IsNumber(schema.multipleOf)) - yield `(${value} % ${schema.multipleOf} === 0)`; - if (IsNumber(schema.exclusiveMinimum)) - yield `(${value} > ${schema.exclusiveMinimum})`; - if (IsNumber(schema.exclusiveMaximum)) - yield `(${value} < ${schema.exclusiveMaximum})`; - if (IsNumber(schema.minimum)) - yield `(${value} >= ${schema.minimum})`; - if (IsNumber(schema.maximum)) - yield `(${value} <= ${schema.maximum})`; - } - function* Object(schema, value) { - if (index_2.TypeSystem.AllowArrayObjects) { - yield `(typeof ${value} === 'object' && ${value} !== null)`; - } - else { - yield `(typeof ${value} === 'object' && ${value} !== null && !Array.isArray(${value}))`; - } - if (IsNumber(schema.minProperties)) - yield `(Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties})`; - if (IsNumber(schema.maxProperties)) - yield `(Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties})`; - const propertyKeys = globalThis.Object.getOwnPropertyNames(schema.properties); - if (schema.additionalProperties === false) { - // Optimization: If the property key length matches the required keys length - // then we only need check that the values property key length matches that - // of the property key length. This is because exhaustive testing for values - // will occur in subsequent property tests. - if (schema.required && schema.required.length === propertyKeys.length) { - yield `(Object.getOwnPropertyNames(${value}).length === ${propertyKeys.length})`; - } - else { - const keys = `[${propertyKeys.map((key) => `'${key}'`).join(', ')}]`; - yield `(Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key)))`; - } - } - if (index_3.TypeGuard.TSchema(schema.additionalProperties)) { - const expression = CreateExpression(schema.additionalProperties, 'value[key]'); - const keys = `[${propertyKeys.map((key) => `'${key}'`).join(', ')}]`; - yield `(Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key) || ${expression}))`; - } - for (const propertyKey of propertyKeys) { - const memberExpression = MemberExpression.Encode(value, propertyKey); - const propertySchema = schema.properties[propertyKey]; - if (schema.required && schema.required.includes(propertyKey)) { - yield* Visit(propertySchema, memberExpression); - if (index_3.TypeExtends.Undefined(propertySchema)) { - yield `('${propertyKey}' in ${value})`; - } - } - else { - const expression = CreateExpression(propertySchema, memberExpression); - yield `(${memberExpression} === undefined ? true : (${expression}))`; - } - } - } - function* Promise(schema, value) { - yield `(typeof value === 'object' && typeof ${value}.then === 'function')`; - } - function* Record(schema, value) { - if (index_2.TypeSystem.AllowArrayObjects) { - yield `(typeof ${value} === 'object' && ${value} !== null && !(${value} instanceof Date))`; - } - else { - yield `(typeof ${value} === 'object' && ${value} !== null && !(${value} instanceof Date) && !Array.isArray(${value}))`; - } - const [keyPattern, valueSchema] = globalThis.Object.entries(schema.patternProperties)[0]; - const local = PushLocal(`new RegExp(/${keyPattern}/)`); - yield `(Object.getOwnPropertyNames(${value}).every(key => ${local}.test(key)))`; - const expression = CreateExpression(valueSchema, 'value'); - yield `(Object.values(${value}).every(value => ${expression}))`; - } - function* Ref(schema, value) { - // Reference: If we have seen this reference before we can just yield and return - // the function call. If this isn't the case we defer to visit to generate and - // set the function for subsequent passes. Consider for refactor. - if (state_local_function_names.has(schema.$ref)) - return yield `(${CreateFunctionName(schema.$ref)}(${value}))`; - if (!state_reference_map.has(schema.$ref)) - throw Error(`TypeCompiler.Ref: Cannot de-reference schema with $id '${schema.$ref}'`); - const reference = state_reference_map.get(schema.$ref); - yield* Visit(reference, value); - } - function* Self(schema, value) { - const func = CreateFunctionName(schema.$ref); - yield `(${func}(${value}))`; - } - function* String(schema, value) { - yield `(typeof ${value} === 'string')`; - if (IsNumber(schema.minLength)) - yield `(${value}.length >= ${schema.minLength})`; - if (IsNumber(schema.maxLength)) - yield `(${value}.length <= ${schema.maxLength})`; - if (schema.pattern !== undefined) { - const local = PushLocal(`${new RegExp(schema.pattern)};`); - yield `(${local}.test(${value}))`; - } - if (schema.format !== undefined) { - yield `(format('${schema.format}', ${value}))`; - } - } - function* Tuple(schema, value) { - yield `(Array.isArray(${value}))`; - if (schema.items === undefined) - return yield `(${value}.length === 0)`; - yield `(${value}.length === ${schema.maxItems})`; - for (let i = 0; i < schema.items.length; i++) { - const expression = CreateExpression(schema.items[i], `${value}[${i}]`); - yield `(${expression})`; - } - } - function* Undefined(schema, value) { - yield `(${value} === undefined)`; - } - function* Union(schema, value) { - const expressions = schema.anyOf.map((schema) => CreateExpression(schema, value)); - yield `(${expressions.join(' || ')})`; - } - function* Uint8Array(schema, value) { - yield `(${value} instanceof Uint8Array)`; - if (IsNumber(schema.maxByteLength)) - yield `(${value}.length <= ${schema.maxByteLength})`; - if (IsNumber(schema.minByteLength)) - yield `(${value}.length >= ${schema.minByteLength})`; - } - function* Unknown(schema, value) { - yield '(true)'; - } - function* Void(schema, value) { - yield `(${value} === null)`; - } - function* UserDefined(schema, value) { - const schema_key = `schema_key_${state_remote_custom_types.size}`; - state_remote_custom_types.set(schema_key, schema); - yield `(custom('${schema[Types.Kind]}', '${schema_key}', ${value}))`; - } - function* Visit(schema, value) { - // Reference: Referenced schemas can originate from either additional schemas - // or inline in the schema itself. Ideally the recursive path should align to - // reference path. Consider for refactor. - if (schema.$id && !state_local_function_names.has(schema.$id)) { - state_local_function_names.add(schema.$id); - const name = CreateFunctionName(schema.$id); - const body = CreateFunction(name, schema, 'value'); - PushFunction(body); - yield `(${name}(${value}))`; - return; - } - const anySchema = schema; - switch (anySchema[Types.Kind]) { - case 'Any': - return yield* Any(anySchema, value); - case 'Array': - return yield* Array(anySchema, value); - case 'Boolean': - return yield* Boolean(anySchema, value); - case 'Constructor': - return yield* Constructor(anySchema, value); - case 'Date': - return yield* Date(anySchema, value); - case 'Function': - return yield* Function(anySchema, value); - case 'Integer': - return yield* Integer(anySchema, value); - case 'Literal': - return yield* Literal(anySchema, value); - case 'Never': - return yield* Never(anySchema, value); - case 'Null': - return yield* Null(anySchema, value); - case 'Number': - return yield* Number(anySchema, value); - case 'Object': - return yield* Object(anySchema, value); - case 'Promise': - return yield* Promise(anySchema, value); - case 'Record': - return yield* Record(anySchema, value); - case 'Ref': - return yield* Ref(anySchema, value); - case 'Self': - return yield* Self(anySchema, value); - case 'String': - return yield* String(anySchema, value); - case 'Tuple': - return yield* Tuple(anySchema, value); - case 'Undefined': - return yield* Undefined(anySchema, value); - case 'Union': - return yield* Union(anySchema, value); - case 'Uint8Array': - return yield* Uint8Array(anySchema, value); - case 'Unknown': - return yield* Unknown(anySchema, value); - case 'Void': - return yield* Void(anySchema, value); - default: - if (!index_5.Custom.Has(anySchema[Types.Kind])) - throw new TypeCompilerUnknownTypeError(schema); - return yield* UserDefined(anySchema, value); - } - } - // ------------------------------------------------------------------- - // Compiler State - // ------------------------------------------------------------------- - const state_reference_map = new Map(); // tracks schemas with identifiers - const state_local_variables = new Set(); // local variables and functions - const state_local_function_names = new Set(); // local function names used call ref validators - const state_remote_custom_types = new Map(); // remote custom types used during compilation - function ResetCompiler() { - state_reference_map.clear(); - state_local_variables.clear(); - state_local_function_names.clear(); - state_remote_custom_types.clear(); - } - function AddReferences(schemas = []) { - for (const schema of schemas) { - if (!schema.$id) - throw new Error(`TypeCompiler: Referenced schemas must specify an $id.`); - if (state_reference_map.has(schema.$id)) - throw new Error(`TypeCompiler: Duplicate schema $id found for '${schema.$id}'`); - state_reference_map.set(schema.$id, schema); - } - } - function CreateExpression(schema, value) { - return `(${[...Visit(schema, value)].join(' && ')})`; - } - function CreateFunctionName($id) { - return `check_${Identifier.Encode($id)}`; - } - function CreateFunction(name, schema, value) { - const expression = [...Visit(schema, value)].map((condition) => ` ${condition}`).join(' &&\n'); - return `function ${name}(value) {\n return (\n${expression}\n )\n}`; - } - function PushFunction(functionBody) { - state_local_variables.add(functionBody); - } - function PushLocal(expression) { - const local = `local_${state_local_variables.size}`; - state_local_variables.add(`const ${local} = ${expression}`); - return local; - } - function GetLocals() { - return [...state_local_variables.values()]; - } - // ------------------------------------------------------------------- - // Compile - // ------------------------------------------------------------------- - function Build(schema, references = []) { - ResetCompiler(); - AddReferences(references); - const check = CreateFunction('check', schema, 'value'); - const locals = GetLocals(); - return `${locals.join('\n')}\nreturn ${check}`; - } - /** Compiles the given type for runtime type checking. This compiler only accepts known TypeBox types non-inclusive of unsafe types. */ - function Compile(schema, references = []) { - index_3.TypeGuard.Assert(schema, references); - const code = Build(schema, references); - const custom_schemas = new Map(state_remote_custom_types); - const compiledFunction = globalThis.Function('custom', 'format', 'hash', code); - const checkFunction = compiledFunction((kind, schema_key, value) => { - if (!index_5.Custom.Has(kind) || !custom_schemas.has(schema_key)) - return false; - const schema = custom_schemas.get(schema_key); - const func = index_5.Custom.Get(kind); - return func(schema, value); - }, (format, value) => { - if (!index_4.Format.Has(format)) - return false; - const func = index_4.Format.Get(format); - return func(value); - }, (value) => { - return index_6.ValueHash.Create(value); - }); - return new TypeCheck(schema, references, checkFunction, code); - } - TypeCompiler.Compile = Compile; -})(TypeCompiler = exports.TypeCompiler || (exports.TypeCompiler = {})); diff --git a/node_modules/@sinclair/typebox/compiler/index.d.ts b/node_modules/@sinclair/typebox/compiler/index.d.ts deleted file mode 100644 index 4062a62f8..000000000 --- a/node_modules/@sinclair/typebox/compiler/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { ValueError, ValueErrorType } from '../errors/index'; -export * from './compiler'; diff --git a/node_modules/@sinclair/typebox/compiler/index.js b/node_modules/@sinclair/typebox/compiler/index.js deleted file mode 100644 index 7a013c3ed..000000000 --- a/node_modules/@sinclair/typebox/compiler/index.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/compiler - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueErrorType = void 0; -var index_1 = require("../errors/index"); -Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } }); -__exportStar(require("./compiler"), exports); diff --git a/node_modules/@sinclair/typebox/conditional/conditional.d.ts b/node_modules/@sinclair/typebox/conditional/conditional.d.ts deleted file mode 100644 index 5f73a9075..000000000 --- a/node_modules/@sinclair/typebox/conditional/conditional.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as Types from '../typebox'; -export type TExtends = Types.Static extends Types.Static ? T : U; -export interface TExclude extends Types.TUnion { - static: Exclude, Types.Static>; -} -export interface TExtract extends Types.TUnion { - static: Extract, Types.Static>; -} -/** Conditional type mapping for TypeBox types */ -export declare namespace Conditional { - /** (Experimental) Creates a conditional expression type */ - function Extends(left: L, right: R, ok: T, fail: U): TExtends; - /** (Experimental) Constructs a type by excluding from UnionType all union members that are assignable to ExcludedMembers. */ - function Exclude(unionType: T, excludedMembers: U, options?: Types.SchemaOptions): TExclude; - /** (Experimental) Constructs a type by extracting from Type all union members that are assignable to Union. */ - function Extract(type: T, union: U, options?: Types.SchemaOptions): TExtract; -} diff --git a/node_modules/@sinclair/typebox/conditional/conditional.js b/node_modules/@sinclair/typebox/conditional/conditional.js deleted file mode 100644 index ee2f7512c..000000000 --- a/node_modules/@sinclair/typebox/conditional/conditional.js +++ /dev/null @@ -1,91 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/conditional - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Conditional = void 0; -const Types = require("../typebox"); -const structural_1 = require("./structural"); -const index_1 = require("../guard/index"); -/** Conditional type mapping for TypeBox types */ -var Conditional; -(function (Conditional) { - /** (Experimental) Creates a conditional expression type */ - function Extends(left, right, ok, fail) { - switch (structural_1.Structural.Check(left, right)) { - case structural_1.StructuralResult.Union: - return Types.Type.Union([Clone(ok), Clone(fail)]); - case structural_1.StructuralResult.True: - return Clone(ok); - case structural_1.StructuralResult.False: - return Clone(fail); - } - } - Conditional.Extends = Extends; - /** (Experimental) Constructs a type by excluding from UnionType all union members that are assignable to ExcludedMembers. */ - function Exclude(unionType, excludedMembers, options = {}) { - const anyOf = unionType.anyOf - .filter((schema) => { - const check = structural_1.Structural.Check(schema, excludedMembers); - return !(check === structural_1.StructuralResult.True || check === structural_1.StructuralResult.Union); - }) - .map((schema) => Clone(schema)); - return { ...options, [Types.Kind]: 'Union', anyOf }; - } - Conditional.Exclude = Exclude; - /** (Experimental) Constructs a type by extracting from Type all union members that are assignable to Union. */ - function Extract(type, union, options = {}) { - if (index_1.TypeGuard.TUnion(type)) { - const anyOf = type.anyOf.filter((schema) => structural_1.Structural.Check(schema, union) === structural_1.StructuralResult.True).map((schema) => Clone(schema)); - return { ...options, [Types.Kind]: 'Union', anyOf }; - } - else { - const anyOf = union.anyOf.filter((schema) => structural_1.Structural.Check(type, schema) === structural_1.StructuralResult.True).map((schema) => Clone(schema)); - return { ...options, [Types.Kind]: 'Union', anyOf }; - } - } - Conditional.Extract = Extract; - function Clone(value) { - const isObject = (object) => typeof object === 'object' && object !== null && !Array.isArray(object); - const isArray = (object) => typeof object === 'object' && object !== null && Array.isArray(object); - if (isObject(value)) { - return Object.keys(value).reduce((acc, key) => ({ - ...acc, - [key]: Clone(value[key]), - }), Object.getOwnPropertySymbols(value).reduce((acc, key) => ({ - ...acc, - [key]: Clone(value[key]), - }), {})); - } - else if (isArray(value)) { - return value.map((item) => Clone(item)); - } - else { - return value; - } - } -})(Conditional = exports.Conditional || (exports.Conditional = {})); diff --git a/node_modules/@sinclair/typebox/conditional/index.d.ts b/node_modules/@sinclair/typebox/conditional/index.d.ts deleted file mode 100644 index 773425d20..000000000 --- a/node_modules/@sinclair/typebox/conditional/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './conditional'; -export * from './structural'; diff --git a/node_modules/@sinclair/typebox/conditional/index.js b/node_modules/@sinclair/typebox/conditional/index.js deleted file mode 100644 index 70cda35de..000000000 --- a/node_modules/@sinclair/typebox/conditional/index.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/conditional - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./conditional"), exports); -__exportStar(require("./structural"), exports); diff --git a/node_modules/@sinclair/typebox/conditional/structural.d.ts b/node_modules/@sinclair/typebox/conditional/structural.d.ts deleted file mode 100644 index 7ba8fc798..000000000 --- a/node_modules/@sinclair/typebox/conditional/structural.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as Types from '../typebox'; -export declare enum StructuralResult { - Union = 0, - True = 1, - False = 2 -} -/** Performs structural equivalence checks against TypeBox types. */ -export declare namespace Structural { - /** Structurally tests if the left schema extends the right. */ - function Check(left: Types.TSchema, right: Types.TSchema): StructuralResult; -} diff --git a/node_modules/@sinclair/typebox/conditional/structural.js b/node_modules/@sinclair/typebox/conditional/structural.js deleted file mode 100644 index 3e37486e0..000000000 --- a/node_modules/@sinclair/typebox/conditional/structural.js +++ /dev/null @@ -1,685 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/conditional - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Structural = exports.StructuralResult = void 0; -const Types = require("../typebox"); -const guard_1 = require("../guard"); -// -------------------------------------------------------------------------- -// StructuralResult -// -------------------------------------------------------------------------- -var StructuralResult; -(function (StructuralResult) { - StructuralResult[StructuralResult["Union"] = 0] = "Union"; - StructuralResult[StructuralResult["True"] = 1] = "True"; - StructuralResult[StructuralResult["False"] = 2] = "False"; -})(StructuralResult = exports.StructuralResult || (exports.StructuralResult = {})); -// -------------------------------------------------------------------------- -// Structural -// -------------------------------------------------------------------------- -/** Performs structural equivalence checks against TypeBox types. */ -var Structural; -(function (Structural) { - const referenceMap = new Map(); - // ------------------------------------------------------------------------ - // Rules - // ------------------------------------------------------------------------ - function AnyUnknownOrCustomRule(right) { - // https://github.com/microsoft/TypeScript/issues/40049 - if (guard_1.TypeGuard.TUnion(right) && right.anyOf.some((schema) => schema[Types.Kind] === 'Any' || schema[Types.Kind] === 'Unknown')) - return true; - if (guard_1.TypeGuard.TUnknown(right)) - return true; - if (guard_1.TypeGuard.TAny(right)) - return true; - if (guard_1.TypeGuard.TUserDefined(right)) - throw Error(`Structural: Cannot structurally compare custom type '${right[Types.Kind]}'`); - return false; - } - function ObjectRightRule(left, right) { - // type A = boolean extends {} ? 1 : 2 // additionalProperties: false - // type B = boolean extends object ? 1 : 2 // additionalProperties: true - const additionalProperties = right.additionalProperties; - const propertyLength = globalThis.Object.keys(right.properties).length; - return additionalProperties === false && propertyLength === 0; - } - function UnionRightRule(left, right) { - const result = right.anyOf.some((right) => Visit(left, right) !== StructuralResult.False); - return result ? StructuralResult.True : StructuralResult.False; - } - // ------------------------------------------------------------------------ - // Records - // ------------------------------------------------------------------------ - function RecordPattern(schema) { - return globalThis.Object.keys(schema.patternProperties)[0]; - } - function RecordNumberOrStringKey(schema) { - const pattern = RecordPattern(schema); - return pattern === '^.*$' || pattern === '^(0|[1-9][0-9]*)$'; - } - function RecordValue(schema) { - const pattern = RecordPattern(schema); - return schema.patternProperties[pattern]; - } - function RecordKey(schema) { - const pattern = RecordPattern(schema); - if (pattern === '^.*$') { - return Types.Type.String(); - } - else if (pattern === '^(0|[1-9][0-9]*)$') { - return Types.Type.Number(); - } - else { - const keys = pattern.slice(1, pattern.length - 1).split('|'); - const schemas = keys.map((key) => (isNaN(+key) ? Types.Type.Literal(key) : Types.Type.Literal(parseFloat(key)))); - return Types.Type.Union(schemas); - } - } - function PropertyMap(schema) { - const comparable = new Map(); - if (guard_1.TypeGuard.TRecord(schema)) { - const propertyPattern = RecordPattern(schema); - if (propertyPattern === '^.*$' || propertyPattern === '^(0|[1-9][0-9]*)$') - throw Error('Cannot extract record properties without property constraints'); - const propertySchema = schema.patternProperties[propertyPattern]; - const propertyKeys = propertyPattern.slice(1, propertyPattern.length - 1).split('|'); - propertyKeys.forEach((propertyKey) => { - comparable.set(propertyKey, propertySchema); - }); - } - else { - globalThis.Object.entries(schema.properties).forEach(([propertyKey, propertySchema]) => { - comparable.set(propertyKey, propertySchema); - }); - } - return comparable; - } - // ------------------------------------------------------------------------ - // Indexable - // ------------------------------------------------------------------------ - function Indexable(left, right) { - if (guard_1.TypeGuard.TUnion(right)) { - return StructuralResult.False; - } - else { - return Visit(left, right); - } - } - // ------------------------------------------------------------------------ - // Checks - // ------------------------------------------------------------------------ - function Any(left, right) { - return AnyUnknownOrCustomRule(right) ? StructuralResult.True : StructuralResult.Union; - } - function Array(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right)) { - if (right.properties['length'] !== undefined && right.properties['length'][Types.Kind] === 'Number') - return StructuralResult.True; - if (globalThis.Object.keys(right.properties).length === 0) - return StructuralResult.True; - return StructuralResult.False; - } - else if (!guard_1.TypeGuard.TArray(right)) { - return StructuralResult.False; - } - else if (left.items === undefined && right.items !== undefined) { - return StructuralResult.False; - } - else if (left.items !== undefined && right.items === undefined) { - return StructuralResult.False; - } - else if (left.items === undefined && right.items === undefined) { - return StructuralResult.False; - } - else { - const result = Visit(left.items, right.items) !== StructuralResult.False; - return result ? StructuralResult.True : StructuralResult.False; - } - } - function Boolean(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right) && ObjectRightRule(left, right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TBoolean(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnion(right)) { - return UnionRightRule(left, right); - } - else { - return StructuralResult.False; - } - } - function Constructor(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right) && globalThis.Object.keys(right.properties).length === 0) { - return StructuralResult.True; - } - else if (!guard_1.TypeGuard.TConstructor(right)) { - return StructuralResult.False; - } - else if (right.parameters.length < left.parameters.length) { - return StructuralResult.False; - } - else { - if (Visit(left.returns, right.returns) === StructuralResult.False) { - return StructuralResult.False; - } - for (let i = 0; i < left.parameters.length; i++) { - const result = Visit(right.parameters[i], left.parameters[i]); - if (result === StructuralResult.False) - return StructuralResult.False; - } - return StructuralResult.True; - } - } - function Date(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right) && ObjectRightRule(left, right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TRecord(right)) { - return StructuralResult.False; - } - else if (guard_1.TypeGuard.TDate(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnion(right)) { - return UnionRightRule(left, right); - } - else { - return StructuralResult.False; - } - } - function Function(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right)) { - if (right.properties['length'] !== undefined && right.properties['length'][Types.Kind] === 'Number') - return StructuralResult.True; - if (globalThis.Object.keys(right.properties).length === 0) - return StructuralResult.True; - return StructuralResult.False; - } - else if (!guard_1.TypeGuard.TFunction(right)) { - return StructuralResult.False; - } - else if (right.parameters.length < left.parameters.length) { - return StructuralResult.False; - } - else if (Visit(left.returns, right.returns) === StructuralResult.False) { - return StructuralResult.False; - } - else { - for (let i = 0; i < left.parameters.length; i++) { - const result = Visit(right.parameters[i], left.parameters[i]); - if (result === StructuralResult.False) - return StructuralResult.False; - } - return StructuralResult.True; - } - } - function Integer(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right) && ObjectRightRule(left, right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TInteger(right) || guard_1.TypeGuard.TNumber(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnion(right)) { - return UnionRightRule(left, right); - } - else { - return StructuralResult.False; - } - } - function Literal(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right) && ObjectRightRule(left, right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TRecord(right)) { - if (typeof left.const === 'string') { - return Indexable(left, RecordValue(right)); - } - else { - return StructuralResult.False; - } - } - else if (guard_1.TypeGuard.TLiteral(right) && left.const === right.const) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TString(right) && typeof left.const === 'string') { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TNumber(right) && typeof left.const === 'number') { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TInteger(right) && typeof left.const === 'number') { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TBoolean(right) && typeof left.const === 'boolean') { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnion(right)) { - return UnionRightRule(left, right); - } - else { - return StructuralResult.False; - } - } - function Number(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right) && ObjectRightRule(left, right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TNumber(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TInteger(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnion(right)) { - return UnionRightRule(left, right); - } - else { - return StructuralResult.False; - } - } - function Null(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TNull(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnion(right)) { - return UnionRightRule(left, right); - } - else { - return StructuralResult.False; - } - } - function Properties(left, right) { - if (right.size > left.size) - return StructuralResult.False; - if (![...right.keys()].every((rightKey) => left.has(rightKey))) - return StructuralResult.False; - for (const rightKey of right.keys()) { - const leftProp = left.get(rightKey); - const rightProp = right.get(rightKey); - if (Visit(leftProp, rightProp) === StructuralResult.False) { - return StructuralResult.False; - } - } - return StructuralResult.True; - } - function Object(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right)) { - return Properties(PropertyMap(left), PropertyMap(right)); - } - else if (guard_1.TypeGuard.TRecord(right)) { - if (!RecordNumberOrStringKey(right)) { - return Properties(PropertyMap(left), PropertyMap(right)); - } - else { - return StructuralResult.True; - } - } - else { - return StructuralResult.False; - } - } - function Promise(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right)) { - if (ObjectRightRule(left, right) || globalThis.Object.keys(right.properties).length === 0) { - return StructuralResult.True; - } - else { - return StructuralResult.False; - } - } - else if (!guard_1.TypeGuard.TPromise(right)) { - return StructuralResult.False; - } - else { - const result = Visit(left.item, right.item) !== StructuralResult.False; - return result ? StructuralResult.True : StructuralResult.False; - } - } - function Record(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right)) { - if (RecordPattern(left) === '^.*$' && right[Types.Hint] === 'Record') { - return StructuralResult.True; - } - else if (RecordPattern(left) === '^.*$') { - return StructuralResult.False; - } - else { - return globalThis.Object.keys(right.properties).length === 0 ? StructuralResult.True : StructuralResult.False; - } - } - else if (guard_1.TypeGuard.TRecord(right)) { - if (!RecordNumberOrStringKey(left) && !RecordNumberOrStringKey(right)) { - return Properties(PropertyMap(left), PropertyMap(right)); - } - else if (RecordNumberOrStringKey(left) && !RecordNumberOrStringKey(right)) { - const leftKey = RecordKey(left); - const rightKey = RecordKey(right); - if (Visit(rightKey, leftKey) === StructuralResult.False) { - return StructuralResult.False; - } - else { - return StructuralResult.True; - } - } - else { - return StructuralResult.True; - } - } - else { - return StructuralResult.False; - } - } - function Ref(left, right) { - if (!referenceMap.has(left.$ref)) - throw Error(`Cannot locate referenced $id '${left.$ref}'`); - const resolved = referenceMap.get(left.$ref); - return Visit(resolved, right); - } - function Self(left, right) { - if (!referenceMap.has(left.$ref)) - throw Error(`Cannot locate referenced self $id '${left.$ref}'`); - const resolved = referenceMap.get(left.$ref); - return Visit(resolved, right); - } - function String(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right) && ObjectRightRule(left, right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TRecord(right)) { - return Indexable(left, RecordValue(right)); - } - else if (guard_1.TypeGuard.TString(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnion(right)) { - return UnionRightRule(left, right); - } - else { - return StructuralResult.False; - } - } - function Tuple(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right)) { - const result = ObjectRightRule(left, right) || globalThis.Object.keys(right.properties).length === 0; - return result ? StructuralResult.True : StructuralResult.False; - } - else if (guard_1.TypeGuard.TRecord(right)) { - return Indexable(left, RecordValue(right)); - } - else if (guard_1.TypeGuard.TArray(right)) { - if (right.items === undefined) { - return StructuralResult.False; - } - else if (guard_1.TypeGuard.TUnion(right.items) && left.items) { - const result = left.items.every((left) => UnionRightRule(left, right.items) !== StructuralResult.False); - return result ? StructuralResult.True : StructuralResult.False; - } - else if (guard_1.TypeGuard.TAny(right.items)) { - return StructuralResult.True; - } - else { - return StructuralResult.False; - } - } - if (!guard_1.TypeGuard.TTuple(right)) - return StructuralResult.False; - if (left.items === undefined && right.items === undefined) - return StructuralResult.True; - if (left.items === undefined && right.items !== undefined) - return StructuralResult.False; - if (left.items !== undefined && right.items === undefined) - return StructuralResult.False; - if (left.items === undefined && right.items === undefined) - return StructuralResult.True; - if (left.minItems !== right.minItems || left.maxItems !== right.maxItems) - return StructuralResult.False; - for (let i = 0; i < left.items.length; i++) { - if (Visit(left.items[i], right.items[i]) === StructuralResult.False) - return StructuralResult.False; - } - return StructuralResult.True; - } - function Uint8Array(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TObject(right) && ObjectRightRule(left, right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TRecord(right)) { - return Indexable(left, RecordValue(right)); - } - else if (guard_1.TypeGuard.TUint8Array(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnion(right)) { - return UnionRightRule(left, right); - } - else { - return StructuralResult.False; - } - } - function Undefined(left, right) { - if (AnyUnknownOrCustomRule(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUndefined(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TVoid(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnion(right)) { - return UnionRightRule(left, right); - } - else { - return StructuralResult.False; - } - } - function Union(left, right) { - if (left.anyOf.some((left) => guard_1.TypeGuard.TAny(left))) { - return StructuralResult.Union; - } - else if (guard_1.TypeGuard.TUnion(right)) { - const result = left.anyOf.every((left) => right.anyOf.some((right) => Visit(left, right) !== StructuralResult.False)); - return result ? StructuralResult.True : StructuralResult.False; - } - else { - const result = left.anyOf.every((left) => Visit(left, right) !== StructuralResult.False); - return result ? StructuralResult.True : StructuralResult.False; - } - } - function Unknown(left, right) { - if (guard_1.TypeGuard.TUnion(right)) { - const result = right.anyOf.some((right) => guard_1.TypeGuard.TAny(right) || guard_1.TypeGuard.TUnknown(right)); - return result ? StructuralResult.True : StructuralResult.False; - } - else if (guard_1.TypeGuard.TAny(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnknown(right)) { - return StructuralResult.True; - } - else { - return StructuralResult.False; - } - } - function Void(left, right) { - if (guard_1.TypeGuard.TUnion(right)) { - const result = right.anyOf.some((right) => guard_1.TypeGuard.TAny(right) || guard_1.TypeGuard.TUnknown(right)); - return result ? StructuralResult.True : StructuralResult.False; - } - else if (guard_1.TypeGuard.TAny(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TUnknown(right)) { - return StructuralResult.True; - } - else if (guard_1.TypeGuard.TVoid(right)) { - return StructuralResult.True; - } - else { - return StructuralResult.False; - } - } - let recursionDepth = 0; - function Visit(left, right) { - recursionDepth += 1; - if (recursionDepth >= 1000) - return StructuralResult.True; - if (left.$id !== undefined) - referenceMap.set(left.$id, left); - if (right.$id !== undefined) - referenceMap.set(right.$id, right); - const resolvedRight = right[Types.Kind] === 'Self' ? referenceMap.get(right.$ref) : right; - if (guard_1.TypeGuard.TAny(left)) { - return Any(left, resolvedRight); - } - else if (guard_1.TypeGuard.TArray(left)) { - return Array(left, resolvedRight); - } - else if (guard_1.TypeGuard.TBoolean(left)) { - return Boolean(left, resolvedRight); - } - else if (guard_1.TypeGuard.TConstructor(left)) { - return Constructor(left, resolvedRight); - } - else if (guard_1.TypeGuard.TDate(left)) { - return Date(left, resolvedRight); - } - else if (guard_1.TypeGuard.TFunction(left)) { - return Function(left, resolvedRight); - } - else if (guard_1.TypeGuard.TInteger(left)) { - return Integer(left, resolvedRight); - } - else if (guard_1.TypeGuard.TLiteral(left)) { - return Literal(left, resolvedRight); - } - else if (guard_1.TypeGuard.TNull(left)) { - return Null(left, resolvedRight); - } - else if (guard_1.TypeGuard.TNumber(left)) { - return Number(left, resolvedRight); - } - else if (guard_1.TypeGuard.TObject(left)) { - return Object(left, resolvedRight); - } - else if (guard_1.TypeGuard.TPromise(left)) { - return Promise(left, resolvedRight); - } - else if (guard_1.TypeGuard.TRecord(left)) { - return Record(left, resolvedRight); - } - else if (guard_1.TypeGuard.TRef(left)) { - return Ref(left, resolvedRight); - } - else if (guard_1.TypeGuard.TSelf(left)) { - return Self(left, resolvedRight); - } - else if (guard_1.TypeGuard.TString(left)) { - return String(left, resolvedRight); - } - else if (guard_1.TypeGuard.TTuple(left)) { - return Tuple(left, resolvedRight); - } - else if (guard_1.TypeGuard.TUndefined(left)) { - return Undefined(left, resolvedRight); - } - else if (guard_1.TypeGuard.TUint8Array(left)) { - return Uint8Array(left, resolvedRight); - } - else if (guard_1.TypeGuard.TUnion(left)) { - return Union(left, resolvedRight); - } - else if (guard_1.TypeGuard.TUnknown(left)) { - return Unknown(left, resolvedRight); - } - else if (guard_1.TypeGuard.TVoid(left)) { - return Void(left, resolvedRight); - } - else if (guard_1.TypeGuard.TUserDefined(left)) { - throw Error(`Structural: Cannot structurally compare custom type '${left[Types.Kind]}'`); - } - else { - throw Error(`Structural: Unknown left operand '${left[Types.Kind]}'`); - } - } - /** Structurally tests if the left schema extends the right. */ - function Check(left, right) { - referenceMap.clear(); - recursionDepth = 0; - return Visit(left, right); - } - Structural.Check = Check; -})(Structural = exports.Structural || (exports.Structural = {})); diff --git a/node_modules/@sinclair/typebox/custom/custom.d.ts b/node_modules/@sinclair/typebox/custom/custom.d.ts deleted file mode 100644 index ac27dfa51..000000000 --- a/node_modules/@sinclair/typebox/custom/custom.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type CustomValidationFunction = (schema: TSchema, value: unknown) => boolean; -/** Provides functions to create user defined types */ -export declare namespace Custom { - /** Clears all user defined types */ - function Clear(): void; - /** Returns true if this user defined type exists */ - function Has(kind: string): boolean; - /** Sets a validation function for a user defined type */ - function Set(kind: string, func: CustomValidationFunction): void; - /** Gets a custom validation function for a user defined type */ - function Get(kind: string): CustomValidationFunction | undefined; -} diff --git a/node_modules/@sinclair/typebox/custom/custom.js b/node_modules/@sinclair/typebox/custom/custom.js deleted file mode 100644 index e991de7d6..000000000 --- a/node_modules/@sinclair/typebox/custom/custom.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/custom - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Custom = void 0; -/** Provides functions to create user defined types */ -var Custom; -(function (Custom) { - const customs = new Map(); - /** Clears all user defined types */ - function Clear() { - return customs.clear(); - } - Custom.Clear = Clear; - /** Returns true if this user defined type exists */ - function Has(kind) { - return customs.has(kind); - } - Custom.Has = Has; - /** Sets a validation function for a user defined type */ - function Set(kind, func) { - customs.set(kind, func); - } - Custom.Set = Set; - /** Gets a custom validation function for a user defined type */ - function Get(kind) { - return customs.get(kind); - } - Custom.Get = Get; -})(Custom = exports.Custom || (exports.Custom = {})); diff --git a/node_modules/@sinclair/typebox/custom/index.d.ts b/node_modules/@sinclair/typebox/custom/index.d.ts deleted file mode 100644 index c7226ae4e..000000000 --- a/node_modules/@sinclair/typebox/custom/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './custom'; diff --git a/node_modules/@sinclair/typebox/custom/index.js b/node_modules/@sinclair/typebox/custom/index.js deleted file mode 100644 index 5f078e569..000000000 --- a/node_modules/@sinclair/typebox/custom/index.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/custom - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./custom"), exports); diff --git a/node_modules/@sinclair/typebox/errors/errors.d.ts b/node_modules/@sinclair/typebox/errors/errors.d.ts deleted file mode 100644 index 628512b82..000000000 --- a/node_modules/@sinclair/typebox/errors/errors.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import * as Types from '../typebox'; -export declare enum ValueErrorType { - Array = 0, - ArrayMinItems = 1, - ArrayMaxItems = 2, - ArrayUniqueItems = 3, - Boolean = 4, - Date = 5, - DateExclusiveMinimumTimestamp = 6, - DateExclusiveMaximumTimestamp = 7, - DateMinimumTimestamp = 8, - DateMaximumTimestamp = 9, - Function = 10, - Integer = 11, - IntegerMultipleOf = 12, - IntegerExclusiveMinimum = 13, - IntegerExclusiveMaximum = 14, - IntegerMinimum = 15, - IntegerMaximum = 16, - Literal = 17, - Never = 18, - Null = 19, - Number = 20, - NumberMultipleOf = 21, - NumberExclusiveMinimum = 22, - NumberExclusiveMaximum = 23, - NumberMinumum = 24, - NumberMaximum = 25, - Object = 26, - ObjectMinProperties = 27, - ObjectMaxProperties = 28, - ObjectAdditionalProperties = 29, - ObjectRequiredProperties = 30, - Promise = 31, - RecordKeyNumeric = 32, - RecordKeyString = 33, - String = 34, - StringMinLength = 35, - StringMaxLength = 36, - StringPattern = 37, - StringFormatUnknown = 38, - StringFormat = 39, - TupleZeroLength = 40, - TupleLength = 41, - Undefined = 42, - Union = 43, - Uint8Array = 44, - Uint8ArrayMinByteLength = 45, - Uint8ArrayMaxByteLength = 46, - Void = 47, - Custom = 48 -} -export interface ValueError { - type: ValueErrorType; - schema: Types.TSchema; - path: string; - value: unknown; - message: string; -} -export declare class ValueErrorsUnknownTypeError extends Error { - readonly schema: Types.TSchema; - constructor(schema: Types.TSchema); -} -/** Provides functionality to generate a sequence of errors against a TypeBox type. */ -export declare namespace ValueErrors { - function Errors(schema: T, references: Types.TSchema[], value: any): IterableIterator; -} diff --git a/node_modules/@sinclair/typebox/errors/errors.js b/node_modules/@sinclair/typebox/errors/errors.js deleted file mode 100644 index e746b06ae..000000000 --- a/node_modules/@sinclair/typebox/errors/errors.js +++ /dev/null @@ -1,472 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/errors - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueErrors = exports.ValueErrorsUnknownTypeError = exports.ValueErrorType = void 0; -const Types = require("../typebox"); -const index_1 = require("../system/index"); -const extends_1 = require("../guard/extends"); -const index_2 = require("../format/index"); -const index_3 = require("../custom/index"); -const index_4 = require("../hash/index"); -// ------------------------------------------------------------------- -// ValueErrorType -// ------------------------------------------------------------------- -var ValueErrorType; -(function (ValueErrorType) { - ValueErrorType[ValueErrorType["Array"] = 0] = "Array"; - ValueErrorType[ValueErrorType["ArrayMinItems"] = 1] = "ArrayMinItems"; - ValueErrorType[ValueErrorType["ArrayMaxItems"] = 2] = "ArrayMaxItems"; - ValueErrorType[ValueErrorType["ArrayUniqueItems"] = 3] = "ArrayUniqueItems"; - ValueErrorType[ValueErrorType["Boolean"] = 4] = "Boolean"; - ValueErrorType[ValueErrorType["Date"] = 5] = "Date"; - ValueErrorType[ValueErrorType["DateExclusiveMinimumTimestamp"] = 6] = "DateExclusiveMinimumTimestamp"; - ValueErrorType[ValueErrorType["DateExclusiveMaximumTimestamp"] = 7] = "DateExclusiveMaximumTimestamp"; - ValueErrorType[ValueErrorType["DateMinimumTimestamp"] = 8] = "DateMinimumTimestamp"; - ValueErrorType[ValueErrorType["DateMaximumTimestamp"] = 9] = "DateMaximumTimestamp"; - ValueErrorType[ValueErrorType["Function"] = 10] = "Function"; - ValueErrorType[ValueErrorType["Integer"] = 11] = "Integer"; - ValueErrorType[ValueErrorType["IntegerMultipleOf"] = 12] = "IntegerMultipleOf"; - ValueErrorType[ValueErrorType["IntegerExclusiveMinimum"] = 13] = "IntegerExclusiveMinimum"; - ValueErrorType[ValueErrorType["IntegerExclusiveMaximum"] = 14] = "IntegerExclusiveMaximum"; - ValueErrorType[ValueErrorType["IntegerMinimum"] = 15] = "IntegerMinimum"; - ValueErrorType[ValueErrorType["IntegerMaximum"] = 16] = "IntegerMaximum"; - ValueErrorType[ValueErrorType["Literal"] = 17] = "Literal"; - ValueErrorType[ValueErrorType["Never"] = 18] = "Never"; - ValueErrorType[ValueErrorType["Null"] = 19] = "Null"; - ValueErrorType[ValueErrorType["Number"] = 20] = "Number"; - ValueErrorType[ValueErrorType["NumberMultipleOf"] = 21] = "NumberMultipleOf"; - ValueErrorType[ValueErrorType["NumberExclusiveMinimum"] = 22] = "NumberExclusiveMinimum"; - ValueErrorType[ValueErrorType["NumberExclusiveMaximum"] = 23] = "NumberExclusiveMaximum"; - ValueErrorType[ValueErrorType["NumberMinumum"] = 24] = "NumberMinumum"; - ValueErrorType[ValueErrorType["NumberMaximum"] = 25] = "NumberMaximum"; - ValueErrorType[ValueErrorType["Object"] = 26] = "Object"; - ValueErrorType[ValueErrorType["ObjectMinProperties"] = 27] = "ObjectMinProperties"; - ValueErrorType[ValueErrorType["ObjectMaxProperties"] = 28] = "ObjectMaxProperties"; - ValueErrorType[ValueErrorType["ObjectAdditionalProperties"] = 29] = "ObjectAdditionalProperties"; - ValueErrorType[ValueErrorType["ObjectRequiredProperties"] = 30] = "ObjectRequiredProperties"; - ValueErrorType[ValueErrorType["Promise"] = 31] = "Promise"; - ValueErrorType[ValueErrorType["RecordKeyNumeric"] = 32] = "RecordKeyNumeric"; - ValueErrorType[ValueErrorType["RecordKeyString"] = 33] = "RecordKeyString"; - ValueErrorType[ValueErrorType["String"] = 34] = "String"; - ValueErrorType[ValueErrorType["StringMinLength"] = 35] = "StringMinLength"; - ValueErrorType[ValueErrorType["StringMaxLength"] = 36] = "StringMaxLength"; - ValueErrorType[ValueErrorType["StringPattern"] = 37] = "StringPattern"; - ValueErrorType[ValueErrorType["StringFormatUnknown"] = 38] = "StringFormatUnknown"; - ValueErrorType[ValueErrorType["StringFormat"] = 39] = "StringFormat"; - ValueErrorType[ValueErrorType["TupleZeroLength"] = 40] = "TupleZeroLength"; - ValueErrorType[ValueErrorType["TupleLength"] = 41] = "TupleLength"; - ValueErrorType[ValueErrorType["Undefined"] = 42] = "Undefined"; - ValueErrorType[ValueErrorType["Union"] = 43] = "Union"; - ValueErrorType[ValueErrorType["Uint8Array"] = 44] = "Uint8Array"; - ValueErrorType[ValueErrorType["Uint8ArrayMinByteLength"] = 45] = "Uint8ArrayMinByteLength"; - ValueErrorType[ValueErrorType["Uint8ArrayMaxByteLength"] = 46] = "Uint8ArrayMaxByteLength"; - ValueErrorType[ValueErrorType["Void"] = 47] = "Void"; - ValueErrorType[ValueErrorType["Custom"] = 48] = "Custom"; -})(ValueErrorType = exports.ValueErrorType || (exports.ValueErrorType = {})); -// ------------------------------------------------------------------- -// ValueErrors -// ------------------------------------------------------------------- -class ValueErrorsUnknownTypeError extends Error { - constructor(schema) { - super('ValueErrors: Unknown type'); - this.schema = schema; - } -} -exports.ValueErrorsUnknownTypeError = ValueErrorsUnknownTypeError; -/** Provides functionality to generate a sequence of errors against a TypeBox type. */ -var ValueErrors; -(function (ValueErrors) { - function IsNumber(value) { - return typeof value === 'number' && !isNaN(value); - } - function* Any(schema, references, path, value) { } - function* Array(schema, references, path, value) { - if (!globalThis.Array.isArray(value)) { - return yield { type: ValueErrorType.Array, schema, path, value, message: `Expected array` }; - } - if (IsNumber(schema.minItems) && !(value.length >= schema.minItems)) { - yield { type: ValueErrorType.ArrayMinItems, schema, path, value, message: `Expected array length to be greater or equal to ${schema.minItems}` }; - } - if (IsNumber(schema.maxItems) && !(value.length <= schema.maxItems)) { - yield { type: ValueErrorType.ArrayMinItems, schema, path, value, message: `Expected array length to be less or equal to ${schema.maxItems}` }; - } - // prettier-ignore - if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) { - const hashed = index_4.ValueHash.Create(element); - if (set.has(hashed)) { - return false; - } - else { - set.add(hashed); - } - } return true; })())) { - yield { type: ValueErrorType.ArrayUniqueItems, schema, path, value, message: `Expected array elements to be unique` }; - } - for (let i = 0; i < value.length; i++) { - yield* Visit(schema.items, references, `${path}/${i}`, value[i]); - } - } - function* Boolean(schema, references, path, value) { - if (!(typeof value === 'boolean')) { - return yield { type: ValueErrorType.Boolean, schema, path, value, message: `Expected boolean` }; - } - } - function* Constructor(schema, references, path, value) { - yield* Visit(schema.returns, references, path, value.prototype); - } - function* Date(schema, references, path, value) { - if (!(value instanceof globalThis.Date)) { - return yield { type: ValueErrorType.Date, schema, path, value, message: `Expected Date object` }; - } - if (isNaN(value.getTime())) { - return yield { type: ValueErrorType.Date, schema, path, value, message: `Invalid Date` }; - } - if (IsNumber(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) { - yield { type: ValueErrorType.DateExclusiveMinimumTimestamp, schema, path, value, message: `Expected Date timestamp to be greater than ${schema.exclusiveMinimum}` }; - } - if (IsNumber(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) { - yield { type: ValueErrorType.DateExclusiveMaximumTimestamp, schema, path, value, message: `Expected Date timestamp to be less than ${schema.exclusiveMaximum}` }; - } - if (IsNumber(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) { - yield { type: ValueErrorType.DateMinimumTimestamp, schema, path, value, message: `Expected Date timestamp to be greater or equal to ${schema.minimum}` }; - } - if (IsNumber(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) { - yield { type: ValueErrorType.DateMaximumTimestamp, schema, path, value, message: `Expected Date timestamp to be less or equal to ${schema.maximum}` }; - } - } - function* Function(schema, references, path, value) { - if (!(typeof value === 'function')) { - return yield { type: ValueErrorType.Function, schema, path, value, message: `Expected function` }; - } - } - function* Integer(schema, references, path, value) { - if (!(typeof value === 'number' && globalThis.Number.isInteger(value))) { - return yield { type: ValueErrorType.Integer, schema, path, value, message: `Expected integer` }; - } - if (IsNumber(schema.multipleOf) && !(value % schema.multipleOf === 0)) { - yield { type: ValueErrorType.IntegerMultipleOf, schema, path, value, message: `Expected integer to be a multiple of ${schema.multipleOf}` }; - } - if (IsNumber(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { - yield { type: ValueErrorType.IntegerExclusiveMinimum, schema, path, value, message: `Expected integer to be greater than ${schema.exclusiveMinimum}` }; - } - if (IsNumber(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { - yield { type: ValueErrorType.IntegerExclusiveMaximum, schema, path, value, message: `Expected integer to be less than ${schema.exclusiveMaximum}` }; - } - if (IsNumber(schema.minimum) && !(value >= schema.minimum)) { - yield { type: ValueErrorType.IntegerMinimum, schema, path, value, message: `Expected integer to be greater or equal to ${schema.minimum}` }; - } - if (IsNumber(schema.maximum) && !(value <= schema.maximum)) { - yield { type: ValueErrorType.IntegerMaximum, schema, path, value, message: `Expected integer to be less or equal to ${schema.maximum}` }; - } - } - function* Literal(schema, references, path, value) { - if (!(value === schema.const)) { - const error = typeof schema.const === 'string' ? `'${schema.const}'` : schema.const; - return yield { type: ValueErrorType.Literal, schema, path, value, message: `Expected ${error}` }; - } - } - function* Never(schema, references, path, value) { - yield { type: ValueErrorType.Never, schema, path, value, message: `Value cannot be validated` }; - } - function* Null(schema, references, path, value) { - if (!(value === null)) { - return yield { type: ValueErrorType.Null, schema, path, value, message: `Expected null` }; - } - } - function* Number(schema, references, path, value) { - if (index_1.TypeSystem.AllowNaN) { - if (!(typeof value === 'number')) { - return yield { type: ValueErrorType.Number, schema, path, value, message: `Expected number` }; - } - } - else { - if (!(typeof value === 'number' && !isNaN(value))) { - return yield { type: ValueErrorType.Number, schema, path, value, message: `Expected number` }; - } - } - if (IsNumber(schema.multipleOf) && !(value % schema.multipleOf === 0)) { - yield { type: ValueErrorType.NumberMultipleOf, schema, path, value, message: `Expected number to be a multiple of ${schema.multipleOf}` }; - } - if (IsNumber(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { - yield { type: ValueErrorType.NumberExclusiveMinimum, schema, path, value, message: `Expected number to be greater than ${schema.exclusiveMinimum}` }; - } - if (IsNumber(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { - yield { type: ValueErrorType.NumberExclusiveMaximum, schema, path, value, message: `Expected number to be less than ${schema.exclusiveMaximum}` }; - } - if (IsNumber(schema.minimum) && !(value >= schema.minimum)) { - yield { type: ValueErrorType.NumberMaximum, schema, path, value, message: `Expected number to be greater or equal to ${schema.minimum}` }; - } - if (IsNumber(schema.maximum) && !(value <= schema.maximum)) { - yield { type: ValueErrorType.NumberMinumum, schema, path, value, message: `Expected number to be less or equal to ${schema.maximum}` }; - } - } - function* Object(schema, references, path, value) { - if (index_1.TypeSystem.AllowArrayObjects) { - if (!(typeof value === 'object' && value !== null)) { - return yield { type: ValueErrorType.Object, schema, path, value, message: `Expected object` }; - } - } - else { - if (!(typeof value === 'object' && value !== null && !globalThis.Array.isArray(value))) { - return yield { type: ValueErrorType.Object, schema, path, value, message: `Expected object` }; - } - } - if (IsNumber(schema.minProperties) && !(globalThis.Object.getOwnPropertyNames(value).length >= schema.minProperties)) { - yield { type: ValueErrorType.ObjectMinProperties, schema, path, value, message: `Expected object to have at least ${schema.minProperties} properties` }; - } - if (IsNumber(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { - yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have less than ${schema.minProperties} properties` }; - } - const propertyNames = globalThis.Object.getOwnPropertyNames(schema.properties); - if (schema.additionalProperties === false) { - for (const propertyName of globalThis.Object.getOwnPropertyNames(value)) { - if (!propertyNames.includes(propertyName)) { - yield { type: ValueErrorType.ObjectAdditionalProperties, schema, path: `${path}/${propertyName}`, value: value[propertyName], message: `Unexpected property` }; - } - } - } - if (schema.required && schema.required.length > 0) { - const propertyNames = globalThis.Object.getOwnPropertyNames(value); - for (const requiredKey of schema.required) { - if (propertyNames.includes(requiredKey)) - continue; - yield { type: ValueErrorType.ObjectRequiredProperties, schema: schema.properties[requiredKey], path: `${path}/${requiredKey}`, value: undefined, message: `Expected required property` }; - } - } - if (typeof schema.additionalProperties === 'object') { - for (const propertyName of globalThis.Object.getOwnPropertyNames(value)) { - if (propertyNames.includes(propertyName)) - continue; - yield* Visit(schema.additionalProperties, references, `${path}/${propertyName}`, value[propertyName]); - } - } - for (const propertyKey of propertyNames) { - const propertySchema = schema.properties[propertyKey]; - if (schema.required && schema.required.includes(propertyKey)) { - yield* Visit(propertySchema, references, `${path}/${propertyKey}`, value[propertyKey]); - if (extends_1.TypeExtends.Undefined(schema) && !(propertyKey in value)) { - yield { type: ValueErrorType.ObjectRequiredProperties, schema: propertySchema, path: `${path}/${propertyKey}`, value: undefined, message: `Expected required property` }; - } - } - else { - if (value[propertyKey] !== undefined) { - yield* Visit(propertySchema, references, `${path}/${propertyKey}`, value[propertyKey]); - } - } - } - } - function* Promise(schema, references, path, value) { - if (!(typeof value === 'object' && typeof value.then === 'function')) { - yield { type: ValueErrorType.Promise, schema, path, value, message: `Expected Promise` }; - } - } - function* Record(schema, references, path, value) { - if (index_1.TypeSystem.AllowArrayObjects) { - if (!(typeof value === 'object' && value !== null && !(value instanceof globalThis.Date))) { - return yield { type: ValueErrorType.Object, schema, path, value, message: `Expected object` }; - } - } - else { - if (!(typeof value === 'object' && value !== null && !(value instanceof globalThis.Date) && !globalThis.Array.isArray(value))) { - return yield { type: ValueErrorType.Object, schema, path, value, message: `Expected object` }; - } - } - const [keyPattern, valueSchema] = globalThis.Object.entries(schema.patternProperties)[0]; - const regex = new RegExp(keyPattern); - if (!globalThis.Object.getOwnPropertyNames(value).every((key) => regex.test(key))) { - const numeric = keyPattern === '^(0|[1-9][0-9]*)$'; - const type = numeric ? ValueErrorType.RecordKeyNumeric : ValueErrorType.RecordKeyString; - const message = numeric ? 'Expected all object property keys to be numeric' : 'Expected all object property keys to be strings'; - return yield { type, schema, path, value, message }; - } - for (const [propKey, propValue] of globalThis.Object.entries(value)) { - yield* Visit(valueSchema, references, `${path}/${propKey}`, propValue); - } - } - function* Ref(schema, references, path, value) { - const reference = references.find((reference) => reference.$id === schema.$ref); - if (reference === undefined) - throw new Error(`ValueErrors.Ref: Cannot find schema with $id '${schema.$ref}'.`); - yield* Visit(reference, references, path, value); - } - function* Self(schema, references, path, value) { - const reference = references.find((reference) => reference.$id === schema.$ref); - if (reference === undefined) - throw new Error(`ValueErrors.Self: Cannot find schema with $id '${schema.$ref}'.`); - yield* Visit(reference, references, path, value); - } - function* String(schema, references, path, value) { - if (!(typeof value === 'string')) { - return yield { type: ValueErrorType.String, schema, path, value, message: 'Expected string' }; - } - if (IsNumber(schema.minLength) && !(value.length >= schema.minLength)) { - yield { type: ValueErrorType.StringMinLength, schema, path, value, message: `Expected string length greater or equal to ${schema.minLength}` }; - } - if (IsNumber(schema.maxLength) && !(value.length <= schema.maxLength)) { - yield { type: ValueErrorType.StringMaxLength, schema, path, value, message: `Expected string length less or equal to ${schema.maxLength}` }; - } - if (schema.pattern !== undefined) { - const regex = new RegExp(schema.pattern); - if (!regex.test(value)) { - yield { type: ValueErrorType.StringPattern, schema, path, value, message: `Expected string to match pattern ${schema.pattern}` }; - } - } - if (schema.format !== undefined) { - if (!index_2.Format.Has(schema.format)) { - yield { type: ValueErrorType.StringFormatUnknown, schema, path, value, message: `Unknown string format '${schema.format}'` }; - } - else { - const format = index_2.Format.Get(schema.format); - if (!format(value)) { - yield { type: ValueErrorType.StringFormat, schema, path, value, message: `Expected string to match format '${schema.format}'` }; - } - } - } - } - function* Tuple(schema, references, path, value) { - if (!globalThis.Array.isArray(value)) { - return yield { type: ValueErrorType.Array, schema, path, value, message: 'Expected Array' }; - } - if (schema.items === undefined && !(value.length === 0)) { - return yield { type: ValueErrorType.TupleZeroLength, schema, path, value, message: 'Expected tuple to have 0 elements' }; - } - if (!(value.length === schema.maxItems)) { - yield { type: ValueErrorType.TupleLength, schema, path, value, message: `Expected tuple to have ${schema.maxItems} elements` }; - } - if (!schema.items) { - return; - } - for (let i = 0; i < schema.items.length; i++) { - yield* Visit(schema.items[i], references, `${path}/${i}`, value[i]); - } - } - function* Undefined(schema, references, path, value) { - if (!(value === undefined)) { - yield { type: ValueErrorType.Undefined, schema, path, value, message: `Expected undefined` }; - } - } - function* Union(schema, references, path, value) { - const errors = []; - for (const inner of schema.anyOf) { - const variantErrors = [...Visit(inner, references, path, value)]; - if (variantErrors.length === 0) - return; - errors.push(...variantErrors); - } - for (const error of errors) { - yield error; - } - if (errors.length > 0) { - yield { type: ValueErrorType.Union, schema, path, value, message: 'Expected value of union' }; - } - } - function* Uint8Array(schema, references, path, value) { - if (!(value instanceof globalThis.Uint8Array)) { - return yield { type: ValueErrorType.Uint8Array, schema, path, value, message: `Expected Uint8Array` }; - } - if (IsNumber(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) { - yield { type: ValueErrorType.Uint8ArrayMaxByteLength, schema, path, value, message: `Expected Uint8Array to have a byte length less or equal to ${schema.maxByteLength}` }; - } - if (IsNumber(schema.minByteLength) && !(value.length >= schema.minByteLength)) { - yield { type: ValueErrorType.Uint8ArrayMinByteLength, schema, path, value, message: `Expected Uint8Array to have a byte length greater or equal to ${schema.maxByteLength}` }; - } - } - function* Unknown(schema, references, path, value) { } - function* Void(schema, references, path, value) { - if (!(value === null)) { - return yield { type: ValueErrorType.Void, schema, path, value, message: `Expected null` }; - } - } - function* UserDefined(schema, references, path, value) { - const func = index_3.Custom.Get(schema[Types.Kind]); - if (!func(schema, value)) { - return yield { type: ValueErrorType.Custom, schema, path, value, message: `Expected kind ${schema[Types.Kind]}` }; - } - } - function* Visit(schema, references, path, value) { - const anyReferences = schema.$id === undefined ? references : [schema, ...references]; - const anySchema = schema; - switch (anySchema[Types.Kind]) { - case 'Any': - return yield* Any(anySchema, anyReferences, path, value); - case 'Array': - return yield* Array(anySchema, anyReferences, path, value); - case 'Boolean': - return yield* Boolean(anySchema, anyReferences, path, value); - case 'Constructor': - return yield* Constructor(anySchema, anyReferences, path, value); - case 'Date': - return yield* Date(anySchema, anyReferences, path, value); - case 'Function': - return yield* Function(anySchema, anyReferences, path, value); - case 'Integer': - return yield* Integer(anySchema, anyReferences, path, value); - case 'Literal': - return yield* Literal(anySchema, anyReferences, path, value); - case 'Never': - return yield* Never(anySchema, anyReferences, path, value); - case 'Null': - return yield* Null(anySchema, anyReferences, path, value); - case 'Number': - return yield* Number(anySchema, anyReferences, path, value); - case 'Object': - return yield* Object(anySchema, anyReferences, path, value); - case 'Promise': - return yield* Promise(anySchema, anyReferences, path, value); - case 'Record': - return yield* Record(anySchema, anyReferences, path, value); - case 'Ref': - return yield* Ref(anySchema, anyReferences, path, value); - case 'Self': - return yield* Self(anySchema, anyReferences, path, value); - case 'String': - return yield* String(anySchema, anyReferences, path, value); - case 'Tuple': - return yield* Tuple(anySchema, anyReferences, path, value); - case 'Undefined': - return yield* Undefined(anySchema, anyReferences, path, value); - case 'Union': - return yield* Union(anySchema, anyReferences, path, value); - case 'Uint8Array': - return yield* Uint8Array(anySchema, anyReferences, path, value); - case 'Unknown': - return yield* Unknown(anySchema, anyReferences, path, value); - case 'Void': - return yield* Void(anySchema, anyReferences, path, value); - default: - if (!index_3.Custom.Has(anySchema[Types.Kind])) - throw new ValueErrorsUnknownTypeError(schema); - return yield* UserDefined(anySchema, anyReferences, path, value); - } - } - function* Errors(schema, references, value) { - yield* Visit(schema, references, '', value); - } - ValueErrors.Errors = Errors; -})(ValueErrors = exports.ValueErrors || (exports.ValueErrors = {})); diff --git a/node_modules/@sinclair/typebox/errors/index.d.ts b/node_modules/@sinclair/typebox/errors/index.d.ts deleted file mode 100644 index f72bc43e2..000000000 --- a/node_modules/@sinclair/typebox/errors/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './errors'; diff --git a/node_modules/@sinclair/typebox/errors/index.js b/node_modules/@sinclair/typebox/errors/index.js deleted file mode 100644 index 9637155fc..000000000 --- a/node_modules/@sinclair/typebox/errors/index.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/errors - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./errors"), exports); diff --git a/node_modules/@sinclair/typebox/format/format.d.ts b/node_modules/@sinclair/typebox/format/format.d.ts deleted file mode 100644 index 8bf3cf076..000000000 --- a/node_modules/@sinclair/typebox/format/format.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type FormatValidationFunction = (value: string) => boolean; -/** Provides functions to create user defined string formats */ -export declare namespace Format { - /** Clears all user defined string formats */ - function Clear(): void; - /** Returns true if the user defined string format exists */ - function Has(format: string): boolean; - /** Sets a validation function for a user defined string format */ - function Set(format: string, func: FormatValidationFunction): void; - /** Gets a validation function for a user defined string format */ - function Get(format: string): FormatValidationFunction | undefined; -} diff --git a/node_modules/@sinclair/typebox/format/format.js b/node_modules/@sinclair/typebox/format/format.js deleted file mode 100644 index 9f3ac64c7..000000000 --- a/node_modules/@sinclair/typebox/format/format.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/format - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Format = void 0; -/** Provides functions to create user defined string formats */ -var Format; -(function (Format) { - const formats = new Map(); - /** Clears all user defined string formats */ - function Clear() { - return formats.clear(); - } - Format.Clear = Clear; - /** Returns true if the user defined string format exists */ - function Has(format) { - return formats.has(format); - } - Format.Has = Has; - /** Sets a validation function for a user defined string format */ - function Set(format, func) { - formats.set(format, func); - } - Format.Set = Set; - /** Gets a validation function for a user defined string format */ - function Get(format) { - return formats.get(format); - } - Format.Get = Get; -})(Format = exports.Format || (exports.Format = {})); diff --git a/node_modules/@sinclair/typebox/format/index.d.ts b/node_modules/@sinclair/typebox/format/index.d.ts deleted file mode 100644 index 16c5b2b50..000000000 --- a/node_modules/@sinclair/typebox/format/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './format'; diff --git a/node_modules/@sinclair/typebox/format/index.js b/node_modules/@sinclair/typebox/format/index.js deleted file mode 100644 index 13d1375e5..000000000 --- a/node_modules/@sinclair/typebox/format/index.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/format - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./format"), exports); diff --git a/node_modules/@sinclair/typebox/guard/extends.d.ts b/node_modules/@sinclair/typebox/guard/extends.d.ts deleted file mode 100644 index 790c96ab5..000000000 --- a/node_modules/@sinclair/typebox/guard/extends.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import * as Types from '../typebox'; -export declare namespace TypeExtends { - /** - * This function returns true if the given schema is undefined, either directly or - * through union composition. This check is required on object property types of - * undefined, where an additional `'x' in value` check is required to determine - * the keys existence. - */ - function Undefined(schema: Types.TSchema): boolean; -} diff --git a/node_modules/@sinclair/typebox/guard/extends.js b/node_modules/@sinclair/typebox/guard/extends.js deleted file mode 100644 index 111097024..000000000 --- a/node_modules/@sinclair/typebox/guard/extends.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/guard - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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, dTribute, 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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TypeExtends = void 0; -const Types = require("../typebox"); -var TypeExtends; -(function (TypeExtends) { - /** - * This function returns true if the given schema is undefined, either directly or - * through union composition. This check is required on object property types of - * undefined, where an additional `'x' in value` check is required to determine - * the keys existence. - */ - function Undefined(schema) { - if (schema[Types.Kind] === 'Undefined') - return true; - if (schema[Types.Kind] === 'Union') { - const union = schema; - return union.anyOf.some((schema) => Undefined(schema)); - } - return false; - } - TypeExtends.Undefined = Undefined; -})(TypeExtends = exports.TypeExtends || (exports.TypeExtends = {})); diff --git a/node_modules/@sinclair/typebox/guard/guard.d.ts b/node_modules/@sinclair/typebox/guard/guard.d.ts deleted file mode 100644 index ed96871da..000000000 --- a/node_modules/@sinclair/typebox/guard/guard.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -import * as Types from '../typebox'; -export declare class TypeGuardUnknownTypeError extends Error { - readonly schema: unknown; - constructor(schema: unknown); -} -/** Provides functionality to test if values are TypeBox types */ -export declare namespace TypeGuard { - /** Returns true if the given schema is TAny */ - function TAny(schema: unknown): schema is Types.TAny; - /** Returns true if the given schema is TArray */ - function TArray(schema: unknown): schema is Types.TArray; - /** Returns true if the given schema is TBoolean */ - function TBoolean(schema: unknown): schema is Types.TBoolean; - /** Returns true if the given schema is TConstructor */ - function TConstructor(schema: unknown): schema is Types.TConstructor; - /** Returns true if the given schema is TDate */ - function TDate(schema: unknown): schema is Types.TDate; - /** Returns true if the given schema is TFunction */ - function TFunction(schema: unknown): schema is Types.TFunction; - /** Returns true if the given schema is TInteger */ - function TInteger(schema: unknown): schema is Types.TInteger; - /** Returns true if the given schema is TLiteral */ - function TLiteral(schema: unknown): schema is Types.TLiteral; - /** Returns true if the given schema is TNever */ - function TNever(schema: unknown): schema is Types.TNever; - /** Returns true if the given schema is TNull */ - function TNull(schema: unknown): schema is Types.TNull; - /** Returns true if the given schema is TNumber */ - function TNumber(schema: unknown): schema is Types.TNumber; - /** Returns true if the given schema is TObject */ - function TObject(schema: unknown): schema is Types.TObject; - /** Returns true if the given schema is TPromise */ - function TPromise(schema: unknown): schema is Types.TPromise; - /** Returns true if the given schema is TRecord */ - function TRecord(schema: unknown): schema is Types.TRecord; - /** Returns true if the given schema is TSelf */ - function TSelf(schema: unknown): schema is Types.TSelf; - /** Returns true if the given schema is TRef */ - function TRef(schema: unknown): schema is Types.TRef; - /** Returns true if the given schema is TString */ - function TString(schema: unknown): schema is Types.TString; - /** Returns true if the given schema is TTuple */ - function TTuple(schema: unknown): schema is Types.TTuple; - /** Returns true if the given schema is TUndefined */ - function TUndefined(schema: unknown): schema is Types.TUndefined; - /** Returns true if the given schema is TUnion */ - function TUnion(schema: unknown): schema is Types.TUnion; - /** Returns true if the given schema is TUint8Array */ - function TUint8Array(schema: unknown): schema is Types.TUint8Array; - /** Returns true if the given schema is TUnknown */ - function TUnknown(schema: unknown): schema is Types.TUnknown; - /** Returns true if the given schema is TVoid */ - function TVoid(schema: unknown): schema is Types.TVoid; - /** Returns true if the given schema is a registered user defined type */ - function TUserDefined(schema: unknown): schema is Types.TSchema; - /** Returns true if the given schema is TSchema */ - function TSchema(schema: unknown): schema is Types.TSchema; - /** Asserts if this schema and associated references are valid. */ - function Assert(schema: T, references?: Types.TSchema[]): void; -} diff --git a/node_modules/@sinclair/typebox/guard/guard.js b/node_modules/@sinclair/typebox/guard/guard.js deleted file mode 100644 index df65c5094..000000000 --- a/node_modules/@sinclair/typebox/guard/guard.js +++ /dev/null @@ -1,440 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/guard - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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, dTribute, 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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TypeGuard = exports.TypeGuardUnknownTypeError = void 0; -const index_1 = require("../custom/index"); -const Types = require("../typebox"); -class TypeGuardUnknownTypeError extends Error { - constructor(schema) { - super('TypeGuard: Unknown type'); - this.schema = schema; - } -} -exports.TypeGuardUnknownTypeError = TypeGuardUnknownTypeError; -/** Provides functionality to test if values are TypeBox types */ -var TypeGuard; -(function (TypeGuard) { - function IsObject(value) { - return typeof value === 'object' && value !== null && !Array.isArray(value); - } - function IsArray(value) { - return typeof value === 'object' && value !== null && Array.isArray(value); - } - function IsPattern(value) { - try { - new RegExp(value); - return true; - } - catch { - return false; - } - } - function IsControlCharacterFree(value) { - if (typeof value !== 'string') - return false; - for (let i = 0; i < value.length; i++) { - const code = value.charCodeAt(i); - if ((code >= 7 && code <= 13) || code === 27 || code === 127) { - return false; - } - } - return true; - } - function IsString(value) { - return typeof value === 'string'; - } - function IsNumber(value) { - return typeof value === 'number' && !isNaN(value); - } - function IsBoolean(value) { - return typeof value === 'boolean'; - } - function IsOptionalNumber(value) { - return value === undefined || (value !== undefined && IsNumber(value)); - } - function IsOptionalBoolean(value) { - return value === undefined || (value !== undefined && IsBoolean(value)); - } - function IsOptionalString(value) { - return value === undefined || (value !== undefined && IsString(value)); - } - function IsOptionalPattern(value) { - return value === undefined || (value !== undefined && IsString(value) && IsControlCharacterFree(value) && IsPattern(value)); - } - function IsOptionalFormat(value) { - return value === undefined || (value !== undefined && IsString(value) && IsControlCharacterFree(value)); - } - function IsOptionalSchema(value) { - return value === undefined || TSchema(value); - } - /** Returns true if the given schema is TAny */ - function TAny(schema) { - return IsObject(schema) && schema[Types.Kind] === 'Any' && IsOptionalString(schema.$id); - } - TypeGuard.TAny = TAny; - /** Returns true if the given schema is TArray */ - function TArray(schema) { - return (IsObject(schema) && - schema[Types.Kind] === 'Array' && - schema.type === 'array' && - IsOptionalString(schema.$id) && - TSchema(schema.items) && - IsOptionalNumber(schema.minItems) && - IsOptionalNumber(schema.maxItems) && - IsOptionalBoolean(schema.uniqueItems)); - } - TypeGuard.TArray = TArray; - /** Returns true if the given schema is TBoolean */ - function TBoolean(schema) { - // prettier-ignore - return (IsObject(schema) && - schema[Types.Kind] === 'Boolean' && - schema.type === 'boolean' && - IsOptionalString(schema.$id)); - } - TypeGuard.TBoolean = TBoolean; - /** Returns true if the given schema is TConstructor */ - function TConstructor(schema) { - // prettier-ignore - if (!(IsObject(schema) && - schema[Types.Kind] === 'Constructor' && - schema.type === 'object' && - schema.instanceOf === 'Constructor' && - IsOptionalString(schema.$id) && - IsArray(schema.parameters) && - TSchema(schema.returns))) { - return false; - } - for (const parameter of schema.parameters) { - if (!TSchema(parameter)) - return false; - } - return true; - } - TypeGuard.TConstructor = TConstructor; - /** Returns true if the given schema is TDate */ - function TDate(schema) { - return (IsObject(schema) && - schema[Types.Kind] === 'Date' && - schema.type === 'object' && - schema.instanceOf === 'Date' && - IsOptionalString(schema.$id) && - IsOptionalNumber(schema.minimumTimestamp) && - IsOptionalNumber(schema.maximumTimestamp) && - IsOptionalNumber(schema.exclusiveMinimumTimestamp) && - IsOptionalNumber(schema.exclusiveMaximumTimestamp)); - } - TypeGuard.TDate = TDate; - /** Returns true if the given schema is TFunction */ - function TFunction(schema) { - // prettier-ignore - if (!(IsObject(schema) && - schema[Types.Kind] === 'Function' && - schema.type === 'object' && - schema.instanceOf === 'Function' && - IsOptionalString(schema.$id) && - IsArray(schema.parameters) && - TSchema(schema.returns))) { - return false; - } - for (const parameter of schema.parameters) { - if (!TSchema(parameter)) - return false; - } - return true; - } - TypeGuard.TFunction = TFunction; - /** Returns true if the given schema is TInteger */ - function TInteger(schema) { - return (IsObject(schema) && - schema[Types.Kind] === 'Integer' && - schema.type === 'integer' && - IsOptionalString(schema.$id) && - IsOptionalNumber(schema.multipleOf) && - IsOptionalNumber(schema.minimum) && - IsOptionalNumber(schema.maximum) && - IsOptionalNumber(schema.exclusiveMinimum) && - IsOptionalNumber(schema.exclusiveMaximum)); - } - TypeGuard.TInteger = TInteger; - /** Returns true if the given schema is TLiteral */ - function TLiteral(schema) { - // prettier-ignore - return (IsObject(schema) && - schema[Types.Kind] === 'Literal' && - IsOptionalString(schema.$id) && - (IsString(schema.const) || - IsNumber(schema.const) || - IsBoolean(schema.const))); - } - TypeGuard.TLiteral = TLiteral; - /** Returns true if the given schema is TNever */ - function TNever(schema) { - return (IsObject(schema) && - schema[Types.Kind] === 'Never' && - IsArray(schema.allOf) && - schema.allOf.length === 2 && - IsObject(schema.allOf[0]) && - IsString(schema.allOf[0].type) && - schema.allOf[0].type === 'boolean' && - schema.allOf[0].const === false && - IsObject(schema.allOf[1]) && - IsString(schema.allOf[1].type) && - schema.allOf[1].type === 'boolean' && - schema.allOf[1].const === true); - } - TypeGuard.TNever = TNever; - /** Returns true if the given schema is TNull */ - function TNull(schema) { - return IsObject(schema) && schema[Types.Kind] === 'Null' && schema.type === 'null' && IsOptionalString(schema.$id); - } - TypeGuard.TNull = TNull; - /** Returns true if the given schema is TNumber */ - function TNumber(schema) { - return (IsObject(schema) && - schema[Types.Kind] === 'Number' && - schema.type === 'number' && - IsOptionalString(schema.$id) && - IsOptionalNumber(schema.multipleOf) && - IsOptionalNumber(schema.minimum) && - IsOptionalNumber(schema.maximum) && - IsOptionalNumber(schema.exclusiveMinimum) && - IsOptionalNumber(schema.exclusiveMaximum)); - } - TypeGuard.TNumber = TNumber; - /** Returns true if the given schema is TObject */ - function TObject(schema) { - if (!(IsObject(schema) && - schema[Types.Kind] === 'Object' && - schema.type === 'object' && - IsOptionalString(schema.$id) && - IsObject(schema.properties) && - (IsOptionalBoolean(schema.additionalProperties) || IsOptionalSchema(schema.additionalProperties)) && - IsOptionalNumber(schema.minProperties) && - IsOptionalNumber(schema.maxProperties))) { - return false; - } - for (const [key, value] of Object.entries(schema.properties)) { - if (!IsControlCharacterFree(key)) - return false; - if (!TSchema(value)) - return false; - } - return true; - } - TypeGuard.TObject = TObject; - /** Returns true if the given schema is TPromise */ - function TPromise(schema) { - // prettier-ignore - return (IsObject(schema) && - schema[Types.Kind] === 'Promise' && - schema.type === 'object' && - schema.instanceOf === 'Promise' && - IsOptionalString(schema.$id) && - TSchema(schema.item)); - } - TypeGuard.TPromise = TPromise; - /** Returns true if the given schema is TRecord */ - function TRecord(schema) { - // prettier-ignore - if (!(IsObject(schema) && - schema[Types.Kind] === 'Record' && - schema.type === 'object' && - IsOptionalString(schema.$id) && - schema.additionalProperties === false && - IsObject(schema.patternProperties))) { - return false; - } - const keys = Object.keys(schema.patternProperties); - if (keys.length !== 1) { - return false; - } - if (!IsPattern(keys[0])) { - return false; - } - if (!TSchema(schema.patternProperties[keys[0]])) { - return false; - } - return true; - } - TypeGuard.TRecord = TRecord; - /** Returns true if the given schema is TSelf */ - function TSelf(schema) { - // prettier-ignore - return (IsObject(schema) && - schema[Types.Kind] === 'Self' && - IsOptionalString(schema.$id) && - IsString(schema.$ref)); - } - TypeGuard.TSelf = TSelf; - /** Returns true if the given schema is TRef */ - function TRef(schema) { - // prettier-ignore - return (IsObject(schema) && - schema[Types.Kind] === 'Ref' && - IsOptionalString(schema.$id) && - IsString(schema.$ref)); - } - TypeGuard.TRef = TRef; - /** Returns true if the given schema is TString */ - function TString(schema) { - return (IsObject(schema) && - schema[Types.Kind] === 'String' && - schema.type === 'string' && - IsOptionalString(schema.$id) && - IsOptionalNumber(schema.minLength) && - IsOptionalNumber(schema.maxLength) && - IsOptionalPattern(schema.pattern) && - IsOptionalFormat(schema.format)); - } - TypeGuard.TString = TString; - /** Returns true if the given schema is TTuple */ - function TTuple(schema) { - // prettier-ignore - if (!(IsObject(schema) && - schema[Types.Kind] === 'Tuple' && - schema.type === 'array' && - IsOptionalString(schema.$id) && - IsNumber(schema.minItems) && - IsNumber(schema.maxItems) && - schema.minItems === schema.maxItems)) { - return false; - } - if (schema.items === undefined && schema.additionalItems === undefined && schema.minItems === 0) { - return true; - } - if (!IsArray(schema.items)) { - return false; - } - for (const inner of schema.items) { - if (!TSchema(inner)) - return false; - } - return true; - } - TypeGuard.TTuple = TTuple; - /** Returns true if the given schema is TUndefined */ - function TUndefined(schema) { - // prettier-ignore - return (IsObject(schema) && - schema[Types.Kind] === 'Undefined' && - schema.type === 'null' && - schema.typeOf === 'Undefined' && - IsOptionalString(schema.$id)); - } - TypeGuard.TUndefined = TUndefined; - /** Returns true if the given schema is TUnion */ - function TUnion(schema) { - // prettier-ignore - if (!(IsObject(schema) && - schema[Types.Kind] === 'Union' && - IsArray(schema.anyOf) && - IsOptionalString(schema.$id))) { - return false; - } - for (const inner of schema.anyOf) { - if (!TSchema(inner)) - return false; - } - return true; - } - TypeGuard.TUnion = TUnion; - /** Returns true if the given schema is TUint8Array */ - function TUint8Array(schema) { - return (IsObject(schema) && - schema[Types.Kind] === 'Uint8Array' && - schema.type === 'object' && - IsOptionalString(schema.$id) && - schema.instanceOf === 'Uint8Array' && - IsOptionalNumber(schema.minByteLength) && - IsOptionalNumber(schema.maxByteLength)); - } - TypeGuard.TUint8Array = TUint8Array; - /** Returns true if the given schema is TUnknown */ - function TUnknown(schema) { - // prettier-ignore - return (IsObject(schema) && - schema[Types.Kind] === 'Unknown' && - IsOptionalString(schema.$id)); - } - TypeGuard.TUnknown = TUnknown; - /** Returns true if the given schema is TVoid */ - function TVoid(schema) { - // prettier-ignore - return (IsObject(schema) && - schema[Types.Kind] === 'Void' && - schema.type === 'null' && - schema.typeOf === 'Void' && - IsOptionalString(schema.$id)); - } - TypeGuard.TVoid = TVoid; - /** Returns true if the given schema is a registered user defined type */ - function TUserDefined(schema) { - return IsObject(schema) && IsString(schema[Types.Kind]) && index_1.Custom.Has(schema[Types.Kind]); - } - TypeGuard.TUserDefined = TUserDefined; - /** Returns true if the given schema is TSchema */ - function TSchema(schema) { - return (TAny(schema) || - TArray(schema) || - TBoolean(schema) || - TConstructor(schema) || - TDate(schema) || - TFunction(schema) || - TInteger(schema) || - TLiteral(schema) || - TNever(schema) || - TNull(schema) || - TNumber(schema) || - TObject(schema) || - TPromise(schema) || - TRecord(schema) || - TSelf(schema) || - TRef(schema) || - TString(schema) || - TTuple(schema) || - TUndefined(schema) || - TUnion(schema) || - TUint8Array(schema) || - TUnknown(schema) || - TVoid(schema) || - TUserDefined(schema)); - } - TypeGuard.TSchema = TSchema; - /** Asserts if this schema and associated references are valid. */ - function Assert(schema, references = []) { - if (!TSchema(schema)) - throw new TypeGuardUnknownTypeError(schema); - for (const schema of references) { - if (!TSchema(schema)) - throw new TypeGuardUnknownTypeError(schema); - } - } - TypeGuard.Assert = Assert; -})(TypeGuard = exports.TypeGuard || (exports.TypeGuard = {})); diff --git a/node_modules/@sinclair/typebox/guard/index.d.ts b/node_modules/@sinclair/typebox/guard/index.d.ts deleted file mode 100644 index 2ca1183d3..000000000 --- a/node_modules/@sinclair/typebox/guard/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './guard'; -export * from './extends'; diff --git a/node_modules/@sinclair/typebox/guard/index.js b/node_modules/@sinclair/typebox/guard/index.js deleted file mode 100644 index 582547d88..000000000 --- a/node_modules/@sinclair/typebox/guard/index.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/guards - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./guard"), exports); -__exportStar(require("./extends"), exports); diff --git a/node_modules/@sinclair/typebox/hash/hash.d.ts b/node_modules/@sinclair/typebox/hash/hash.d.ts deleted file mode 100644 index 4c9116b5d..000000000 --- a/node_modules/@sinclair/typebox/hash/hash.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export declare class ValueHashError extends Error { - readonly value: unknown; - constructor(value: unknown); -} -export declare namespace ValueHash { - /** Creates a FNV1A-64 non cryptographic hash of the given value */ - function Create(value: unknown): bigint; -} diff --git a/node_modules/@sinclair/typebox/hash/hash.js b/node_modules/@sinclair/typebox/hash/hash.js deleted file mode 100644 index f3980912e..000000000 --- a/node_modules/@sinclair/typebox/hash/hash.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/hash - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueHash = exports.ValueHashError = void 0; -class ValueHashError extends Error { - constructor(value) { - super(`Hash: Unable to hash value`); - this.value = value; - } -} -exports.ValueHashError = ValueHashError; -var ValueHash; -(function (ValueHash) { - let ByteMarker; - (function (ByteMarker) { - ByteMarker[ByteMarker["Undefined"] = 0] = "Undefined"; - ByteMarker[ByteMarker["Null"] = 1] = "Null"; - ByteMarker[ByteMarker["Boolean"] = 2] = "Boolean"; - ByteMarker[ByteMarker["Number"] = 3] = "Number"; - ByteMarker[ByteMarker["String"] = 4] = "String"; - ByteMarker[ByteMarker["Object"] = 5] = "Object"; - ByteMarker[ByteMarker["Array"] = 6] = "Array"; - ByteMarker[ByteMarker["Date"] = 7] = "Date"; - ByteMarker[ByteMarker["Uint8Array"] = 8] = "Uint8Array"; - })(ByteMarker || (ByteMarker = {})); - // ---------------------------------------------------- - // State - // ---------------------------------------------------- - let Hash = globalThis.BigInt('14695981039346656037'); - const [Prime, Size] = [globalThis.BigInt('1099511628211'), globalThis.BigInt('2') ** globalThis.BigInt('64')]; - const Bytes = globalThis.Array.from({ length: 256 }).map((_, i) => globalThis.BigInt(i)); - const F64 = new globalThis.Float64Array(1); - const F64In = new globalThis.DataView(F64.buffer); - const F64Out = new globalThis.Uint8Array(F64.buffer); - // ---------------------------------------------------- - // Guards - // ---------------------------------------------------- - function IsDate(value) { - return value instanceof globalThis.Date; - } - function IsUint8Array(value) { - return value instanceof globalThis.Uint8Array; - } - function IsArray(value) { - return globalThis.Array.isArray(value); - } - function IsBoolean(value) { - return typeof value === 'boolean'; - } - function IsNull(value) { - return value === null; - } - function IsNumber(value) { - return typeof value === 'number'; - } - function IsObject(value) { - return typeof value === 'object' && value !== null && !IsArray(value) && !IsDate(value) && !IsUint8Array(value); - } - function IsString(value) { - return typeof value === 'string'; - } - function IsUndefined(value) { - return value === undefined; - } - // ---------------------------------------------------- - // Encoding - // ---------------------------------------------------- - function Array(value) { - Fnv1A64(ByteMarker.Array); - for (const item of value) { - Visit(item); - } - } - function Boolean(value) { - Fnv1A64(ByteMarker.Boolean); - Fnv1A64(value ? 1 : 0); - } - function Date(value) { - Fnv1A64(ByteMarker.Date); - Visit(value.getTime()); - } - function Null(value) { - Fnv1A64(ByteMarker.Null); - } - function Number(value) { - Fnv1A64(ByteMarker.Number); - F64In.setFloat64(0, value); - for (const byte of F64Out) { - Fnv1A64(byte); - } - } - function Object(value) { - Fnv1A64(ByteMarker.Object); - for (const key of globalThis.Object.keys(value).sort()) { - Visit(key); - Visit(value[key]); - } - } - function String(value) { - Fnv1A64(ByteMarker.String); - for (let i = 0; i < value.length; i++) { - Fnv1A64(value.charCodeAt(i)); - } - } - function Uint8Array(value) { - Fnv1A64(ByteMarker.Uint8Array); - for (let i = 0; i < value.length; i++) { - Fnv1A64(value[i]); - } - } - function Undefined(value) { - return Fnv1A64(ByteMarker.Undefined); - } - function Visit(value) { - if (IsArray(value)) { - Array(value); - } - else if (IsBoolean(value)) { - Boolean(value); - } - else if (IsDate(value)) { - Date(value); - } - else if (IsNull(value)) { - Null(value); - } - else if (IsNumber(value)) { - Number(value); - } - else if (IsObject(value)) { - Object(value); - } - else if (IsString(value)) { - String(value); - } - else if (IsUint8Array(value)) { - Uint8Array(value); - } - else if (IsUndefined(value)) { - Undefined(value); - } - else { - throw new ValueHashError(value); - } - } - function Fnv1A64(byte) { - Hash = Hash ^ Bytes[byte]; - Hash = (Hash * Prime) % Size; - } - /** Creates a FNV1A-64 non cryptographic hash of the given value */ - function Create(value) { - Hash = globalThis.BigInt('14695981039346656037'); - Visit(value); - return Hash; - } - ValueHash.Create = Create; -})(ValueHash = exports.ValueHash || (exports.ValueHash = {})); diff --git a/node_modules/@sinclair/typebox/hash/index.d.ts b/node_modules/@sinclair/typebox/hash/index.d.ts deleted file mode 100644 index 6719163c3..000000000 --- a/node_modules/@sinclair/typebox/hash/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './hash'; diff --git a/node_modules/@sinclair/typebox/hash/index.js b/node_modules/@sinclair/typebox/hash/index.js deleted file mode 100644 index 2fcf36960..000000000 --- a/node_modules/@sinclair/typebox/hash/index.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/hash - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./hash"), exports); diff --git a/node_modules/@sinclair/typebox/license b/node_modules/@sinclair/typebox/license deleted file mode 100644 index 08641fd64..000000000 --- a/node_modules/@sinclair/typebox/license +++ /dev/null @@ -1,23 +0,0 @@ -TypeBox: JSON Schema Type Builder with Static Type Resolution for TypeScript - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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/@sinclair/typebox/package.json b/node_modules/@sinclair/typebox/package.json deleted file mode 100644 index 50ce0021c..000000000 --- a/node_modules/@sinclair/typebox/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@sinclair/typebox", - "version": "0.25.24", - "description": "JSONSchema Type Builder with Static Type Resolution for TypeScript", - "keywords": [ - "typescript", - "json-schema", - "validate", - "typecheck" - ], - "author": "sinclairzx81", - "license": "MIT", - "main": "./typebox.js", - "types": "./typebox.d.ts", - "exports": { - "./compiler": "./compiler/index.js", - "./conditional": "./conditional/index.js", - "./custom": "./custom/index.js", - "./errors": "./errors/index.js", - "./format": "./format/index.js", - "./guard": "./guard/index.js", - "./hash": "./hash/index.js", - "./system": "./system/index.js", - "./value": "./value/index.js", - ".": "./typebox.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/sinclairzx81/typebox" - }, - "scripts": { - "clean": "hammer task clean", - "format": "hammer task format", - "start": "hammer task start", - "test": "hammer task test", - "benchmark": "hammer task benchmark", - "build": "hammer task build", - "publish": "hammer task publish" - }, - "devDependencies": { - "@sinclair/hammer": "^0.17.1", - "@types/chai": "^4.3.3", - "@types/mocha": "^9.1.1", - "@types/node": "^18.11.9", - "ajv": "^8.11.2", - "ajv-formats": "^2.1.1", - "chai": "^4.3.6", - "mocha": "^9.2.2", - "prettier": "^2.7.1", - "typescript": "^4.9.3" - } -} diff --git a/node_modules/@sinclair/typebox/readme.md b/node_modules/@sinclair/typebox/readme.md deleted file mode 100644 index 34acd8bbd..000000000 --- a/node_modules/@sinclair/typebox/readme.md +++ /dev/null @@ -1,1237 +0,0 @@ -
- -

TypeBox

- -

JSON Schema Type Builder with Static Type Resolution for TypeScript

- - - -
-
- -[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox) -[![Downloads](https://img.shields.io/npm/dm/%40sinclair%2Ftypebox.svg)](https://www.npmjs.com/package/%40sinclair%2Ftypebox) -[![GitHub CI](https://github.com/sinclairzx81/typebox/workflows/GitHub%20CI/badge.svg)](https://github.com/sinclairzx81/typebox/actions) - -
- - - -## Install - -#### Npm -```bash -$ npm install @sinclair/typebox --save -``` - -#### Deno -```typescript -import { Static, Type } from 'npm:@sinclair/typebox' -``` - -#### Esm - -```typescript -import { Static, Type } from 'https://esm.sh/@sinclair/typebox' -``` - -## Usage - -```typescript -import { Static, Type } from '@sinclair/typebox' - -const T = Type.Object({ // const T = { - x: Type.Number(), // type: 'object', - y: Type.Number(), // required: ['x', 'y', 'z'], - z: Type.Number() // properties: { -}) // x: { type: 'number' }, - // y: { type: 'number' }, - // z: { type: 'number' } - // } - // } - -type T = Static // type T = { - // x: number, - // y: number, - // z: number - // } -``` - - - - -## Overview - -TypeBox is a type builder library that creates in-memory JSON Schema objects that can be statically inferred as TypeScript types. The schemas produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox enables one to create a unified type that can be statically checked by TypeScript and runtime asserted using standard JSON Schema validation. - -This library is designed to enable JSON schema to compose with the same flexibility as TypeScript's type system. It can be used either as a simple tool to build up complex schemas or integrated into REST and RPC services to help validate data received over the wire. - -License MIT - -## Contents -- [Install](#install) -- [Overview](#overview) -- [Example](#Example) -- [Types](#types) - - [Standard](#types-standard) - - [Extended](#types-extended) - - [Modifiers](#types-modifiers) - - [Options](#types-options) - - [Reference](#types-reference) - - [Recursive](#types-recursive) - - [Generic](#types-generic) - - [Conditional](#types-conditional) - - [Unsafe](#types-unsafe) - - [Guards](#types-guards) - - [Strict](#types-strict) -- [Values](#values) - - [Create](#values-create) - - [Clone](#values-clone) - - [Check](#values-check) - - [Cast](#values-cast) - - [Equal](#values-equal) - - [Hash](#values-hash) - - [Diff](#values-diff) - - [Patch](#values-patch) - - [Errors](#values-errors) - - [Pointer](#values-pointer) -- [TypeCheck](#typecheck) - - [Ajv](#typecheck-ajv) - - [TypeCompiler](#typecheck-typecompiler) -- [TypeSystem](#typecheck) - - [Types](#typesystem-types) - - [Formats](#typesystem-formats) -- [Benchmark](#benchmark) - - [Compile](#benchmark-compile) - - [Validate](#benchmark-validate) - - [Compression](#benchmark-compression) -- [Contribute](#contribute) - - - -## Example - -The following demonstrates TypeBox's general usage. - -```typescript - -import { Static, Type } from '@sinclair/typebox' - -//-------------------------------------------------------------------------------------------- -// -// Let's say you have the following type ... -// -//-------------------------------------------------------------------------------------------- - -type T = { - id: string, - name: string, - timestamp: number -} - -//-------------------------------------------------------------------------------------------- -// -// ... you can express this type in the following way. -// -//-------------------------------------------------------------------------------------------- - -const T = Type.Object({ // const T = { - id: Type.String(), // type: 'object', - name: Type.String(), // properties: { - timestamp: Type.Integer() // id: { -}) // type: 'string' - // }, - // name: { - // type: 'string' - // }, - // timestamp: { - // type: 'integer' - // } - // }, - // required: [ - // 'id', - // 'name', - // 'timestamp' - // ] - // } - -//-------------------------------------------------------------------------------------------- -// -// ... then infer back to the original static type this way. -// -//-------------------------------------------------------------------------------------------- - -type T = Static // type T = { - // id: string, - // name: string, - // timestamp: number - // } - -//-------------------------------------------------------------------------------------------- -// -// ... then use the type both as JSON schema and as a TypeScript type. -// -//-------------------------------------------------------------------------------------------- - -function receive(value: T) { // ... as a Type - - if(JSON.validate(T, value)) { // ... as a Schema - - // ok... - } -} -``` - - - -## Types - -TypeBox provides a set of functions that allow you to compose JSON Schema similar to how you would compose static types with TypeScript. Each function creates a JSON schema fragment which can compose into more complex types. The schemas produced by TypeBox can be passed directly to any JSON Schema compliant validator, or used to reflect runtime metadata for a type. - - - -### Standard - -The following table lists the Standard TypeBox types. - -```typescript -┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ -│ TypeBox │ TypeScript │ JSON Schema │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Any() │ type T = any │ const T = { } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Unknown() │ type T = unknown │ const T = { } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.String() │ type T = string │ const T = { │ -│ │ │ type: 'string' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Number() │ type T = number │ const T = { │ -│ │ │ type: 'number' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Integer() │ type T = number │ const T = { │ -│ │ │ type: 'integer' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Boolean() │ type T = boolean │ const T = { │ -│ │ │ type: 'boolean' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Null() │ type T = null │ const T = { │ -│ │ │ type: 'null' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.RegEx(/foo/) │ type T = string │ const T = { │ -│ │ │ type: 'string', │ -│ │ │ pattern: 'foo' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Literal(42) │ type T = 42 │ const T = { │ -│ │ │ const: 42, │ -│ │ │ type: 'number' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Array( │ type T = number[] │ const T = { │ -│ Type.Number() │ │ type: 'array', │ -│ ) │ │ items: { │ -│ │ │ type: 'number' │ -│ │ │ } │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Object({ │ type T = { │ const T = { │ -│ x: Type.Number(), │ x: number, │ type: 'object', │ -│ y: Type.Number() │ y: number │ properties: { │ -│ }) │ } │ x: { │ -│ │ │ type: 'number' │ -│ │ │ }, │ -│ │ │ y: { │ -│ │ │ type: 'number' │ -│ │ │ } │ -│ │ │ }, │ -│ │ │ required: ['x', 'y'] │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Tuple([ │ type T = [number, number] │ const T = { │ -│ Type.Number(), │ │ type: 'array', │ -│ Type.Number() │ │ items: [{ │ -│ ]) │ │ type: 'number' │ -│ │ │ }, { │ -│ │ │ type: 'number' │ -│ │ │ }], │ -│ │ │ additionalItems: false, │ -│ │ │ minItems: 2, │ -│ │ │ maxItems: 2 │ -│ │ │ } │ -│ │ │ │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ enum Foo { │ enum Foo { │ const T = { │ -│ A, │ A, │ anyOf: [{ │ -│ B │ B │ type: 'number', │ -│ } │ } │ const: 0 │ -│ │ │ }, { │ -│ const T = Type.Enum(Foo) │ type T = Foo │ type: 'number', │ -│ │ │ const: 1 │ -│ │ │ }] │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.KeyOf( │ type T = keyof { │ const T = { │ -│ Type.Object({ │ x: number, │ anyOf: [{ │ -│ x: Type.Number(), │ y: number │ type: 'string', │ -│ y: Type.Number() │ } │ const: 'x' │ -│ }) │ │ }, { │ -│ ) │ │ type: 'string', │ -│ │ │ const: 'y' │ -│ │ │ }] │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Union([ │ type T = string | number │ const T = { │ -│ Type.String(), │ │ anyOf: [{ │ -│ Type.Number() │ │ type: 'string' │ -│ ]) │ │ }, { │ -│ │ │ type: 'number' │ -│ │ │ }] │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Intersect([ │ type T = { │ const T = { │ -│ Type.Object({ │ x: number │ type: 'object', │ -│ x: Type.Number() │ } & { │ properties: { │ -│ }), │ y: number │ x: { │ -│ Type.Object({ │ } │ type: 'number' │ -│ y: Type.Number() │ │ }, │ -│ }) │ │ y: { │ -│ ]) │ │ type: 'number' │ -│ │ │ } │ -│ │ │ }, │ -│ │ │ required: ['x', 'y'] │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Never() │ type T = never │ const T = { │ -│ │ │ allOf: [{ │ -│ │ │ type: 'boolean', │ -│ │ │ const: false │ -│ │ │ }, { │ -│ │ │ type: 'boolean', │ -│ │ │ const: true │ -│ │ │ }] │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Record( │ type T = Record< │ const T = { │ -│ Type.String(), │ string, │ type: 'object', │ -│ Type.Number() │ number, │ patternProperties: { │ -│ ) │ > │ '^.*$': { │ -│ │ │ type: 'number' │ -│ │ │ } │ -│ │ │ } │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Partial( │ type T = Partial<{ │ const T = { │ -│ Type.Object({ │ x: number, │ type: 'object', │ -│ x: Type.Number(), │ y: number │ properties: { │ -│ y: Type.Number() | }> │ x: { │ -│ }) │ │ type: 'number' │ -│ ) │ │ }, │ -│ │ │ y: { │ -│ │ │ type: 'number' │ -│ │ │ } │ -│ │ │ } │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Required( │ type T = Required<{ │ const T = { │ -│ Type.Object({ │ x?: number, │ type: 'object', │ -│ x: Type.Optional( │ y?: number │ properties: { │ -│ Type.Number() | }> │ x: { │ -│ ), │ │ type: 'number' │ -│ y: Type.Optional( │ │ }, │ -│ Type.Number() │ │ y: { │ -│ ) │ │ type: 'number' │ -│ }) │ │ } │ -│ ) │ │ }, │ -│ │ │ required: ['x', 'y'] │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Pick( │ type T = Pick<{ │ const T = { │ -│ Type.Object({ │ x: number, │ type: 'object', │ -│ x: Type.Number(), │ y: number │ properties: { │ -│ y: Type.Number() | }, 'x'> │ x: { │ -│ }), ['x'] │ │ type: 'number' │ -│ ) │ │ } │ -│ │ │ }, │ -│ │ │ required: ['x'] │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Omit( │ type T = Omit<{ │ const T = { │ -│ Type.Object({ │ x: number, │ type: 'object', │ -│ x: Type.Number(), │ y: number │ properties: { │ -│ y: Type.Number() | }, 'x'> │ y: { │ -│ }), ['x'] │ │ type: 'number' │ -│ ) │ │ } │ -│ │ │ }, │ -│ │ │ required: ['y'] │ -│ │ │ } │ -│ │ │ │ -└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ -``` - - - -### Extended - -TypeBox provides a set of extended types that can be used to express schematics for core JavaScript constructs and primitives. Extended types are not valid JSON Schema and will not validate using typical validation. These types however can be used to frame JSON schema and describe callable RPC interfaces that may receive JSON validated data. - -```typescript -┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ -│ TypeBox │ TypeScript │ Extended Schema │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Constructor([ │ type T = new ( │ const T = { │ -│ Type.String(), │ arg0: string, │ type: 'object', │ -│ Type.Number() │ arg1: number │ instanceOf: 'Constructor', │ -│ ], Type.Boolean()) │ ) => boolean │ parameters: [{ │ -│ │ │ type: 'string' │ -│ │ │ }, { │ -│ │ │ type: 'number' │ -│ │ │ }], │ -│ │ │ return: { │ -│ │ │ type: 'boolean' │ -│ │ │ } │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Function([ │ type T = ( │ const T = { │ -| Type.String(), │ arg0: string, │ type : 'object', │ -│ Type.Number() │ arg1: number │ instanceOf: 'Function', │ -│ ], Type.Boolean()) │ ) => boolean │ parameters: [{ │ -│ │ │ type: 'string' │ -│ │ │ }, { │ -│ │ │ type: 'number' │ -│ │ │ }], │ -│ │ │ return: { │ -│ │ │ type: 'boolean' │ -│ │ │ } │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Promise( │ type T = Promise │ const T = { │ -│ Type.String() │ │ type: 'object', │ -│ ) │ │ instanceOf: 'Promise', │ -│ │ │ item: { │ -│ │ │ type: 'string' │ -│ │ │ } │ -│ │ │ } │ -│ │ │ │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Uint8Array() │ type T = Uint8Array │ const T = { │ -│ │ │ type: 'object', │ -│ │ │ instanceOf: 'Uint8Array' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Date() │ type T = Date │ const T = { │ -│ │ │ type: 'object', │ -│ │ │ instanceOf: 'Date' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Undefined() │ type T = undefined │ const T = { │ -│ │ │ type: 'null', │ -│ │ │ typeOf: 'Undefined' │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Void() │ type T = void │ const T = { │ -│ │ │ type: 'null' │ -│ │ │ typeOf: 'Void' │ -│ │ │ } │ -│ │ │ │ -└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ -``` - - - -### Modifiers - -TypeBox provides modifiers that can be applied to an objects properties. This allows for `optional` and `readonly` to be applied to that property. The following table illustates how they map between TypeScript and JSON Schema. - -```typescript -┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ -│ TypeBox │ TypeScript │ JSON Schema │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Object({ │ type T = { │ const T = { │ -│ name: Type.Optional( │ name?: string │ type: 'object', │ -│ Type.String() │ } │ properties: { │ -│ ) │ │ name: { │ -│ }) │ │ type: 'string' │ -│ │ │ } │ -│ │ │ } │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Object({ │ type T = { │ const T = { │ -│ name: Type.Readonly( │ readonly name: string │ type: 'object', │ -│ Type.String() │ } │ properties: { │ -│ ) │ │ name: { │ -│ }) │ │ type: 'string' │ -│ │ │ } │ -│ │ │ }, │ -│ │ │ required: ['name'] │ -│ │ │ } │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Type.Object({ │ type T = { │ const T = { │ -│ name: Type.ReadonlyOptional( │ readonly name?: string │ type: 'object', │ -│ Type.String() │ } │ properties: { │ -│ ) │ │ name: { │ -│ }) │ │ type: 'string' │ -│ │ │ } │ -│ │ │ } │ -│ │ │ } │ -│ │ │ │ -└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ -``` - - - -### Options - -You can pass additional JSON schema options on the last argument of any given type. The following are some examples. - -```typescript -// string must be an email -const T = Type.String({ format: 'email' }) - -// number must be a multiple of 2 -const T = Type.Number({ multipleOf: 2 }) - -// array must have at least 5 integer values -const T = Type.Array(Type.Integer(), { minItems: 5 }) -``` - - - -### Reference - -Use `Type.Ref(...)` to create referenced types. The target type must specify an `$id`. - -```typescript -const T = Type.String({ $id: 'T' }) // const T = { - // $id: 'T', - // type: 'string' - // } - -const R = Type.Ref(T) // const R = { - // $ref: 'T' - // } -``` - - - -### Recursive - -Use `Type.Recursive(...)` to create recursive types. - -```typescript -const Node = Type.Recursive(Node => Type.Object({ // const Node = { - id: Type.String(), // $id: 'Node', - nodes: Type.Array(Node) // type: 'object', -}), { $id: 'Node' }) // properties: { - // id: { - // type: 'string' - // }, - // nodes: { - // type: 'array', - // items: { - // $ref: 'Node' - // } - // } - // }, - // required: [ - // 'id', - // 'nodes' - // ] - // } - -type Node = Static // type Node = { - // id: string - // nodes: Node[] - // } - -function test(node: Node) { - const id = node.nodes[0].nodes[0] // id is string - .nodes[0].nodes[0] - .id -} -``` - - - -### Generic - -Use functions to create generic types. The following creates a generic `Nullable` type. - -```typescript -import { Type, Static, TSchema } from '@sinclair/typebox' - -const Nullable = (type: T) => Type.Union([type, Type.Null()]) - -const T = Nullable(Type.String()) // const T = { - // anyOf: [{ - // type: 'string' - // }, { - // type: 'null' - // }] - // } - -type T = Static // type T = string | null - -const U = Nullable(Type.Number()) // const U = { - // anyOf: [{ - // type: 'number' - // }, { - // type: 'null' - // }] - // } - -type U = Static // type U = number | null -``` - - - -### Conditional - -Use the conditional module to create [Conditional Types](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html). This module implements TypeScript's structural equivalence checks to enable TypeBox types to be conditionally inferred at runtime. This module also provides the [Extract](https://www.typescriptlang.org/docs/handbook/utility-types.html#extracttype-union) and [Exclude](https://www.typescriptlang.org/docs/handbook/utility-types.html#excludeuniontype-excludedmembers) utility types which are expressed as conditional types in TypeScript. - -The conditional module is provided as an optional import. - -```typescript -import { Conditional } from '@sinclair/typebox/conditional' -``` -The following table shows the TypeBox mappings between TypeScript and JSON schema. - -```typescript -┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ -│ TypeBox │ TypeScript │ JSON Schema │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Conditional.Extends( │ type T = │ const T = { │ -│ Type.String(), │ string extends number │ const: false, │ -│ Type.Number(), │ true : false │ type: 'boolean' │ -│ Type.Literal(true), │ │ } │ -│ Type.Literal(false) │ │ │ -│ ) │ │ │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Conditional.Extract( │ type T = Extract< │ const T = { │ -│ Type.Union([ │ 'a' | 'b' | 'c', │ anyOf: [{ │ -│ Type.Literal('a'), │ 'a' | 'f' │ const: 'a' │ -│ Type.Literal('b'), │ > │ type: 'string' │ -│ Type.Literal('c') │ │ }] │ -│ ]), │ │ } │ -│ Type.Union([ │ │ │ -│ Type.Literal('a'), │ │ │ -│ Type.Literal('f') │ │ │ -│ ]) │ │ │ -│ ) │ │ │ -│ │ │ │ -├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ -│ const T = Conditional.Exclude( │ type T = Exclude< │ const T = { │ -│ Type.Union([ │ 'a' | 'b' | 'c', │ anyOf: [{ │ -│ Type.Literal('a'), │ 'a' │ const: 'b', │ -│ Type.Literal('b'), │ > │ type: 'string' │ -│ Type.Literal('c') │ │ }, { │ -│ ]), │ │ const: 'c', │ -│ Type.Union([ │ │ type: 'string' │ -│ Type.Literal('a') │ │ }] │ -│ ]) │ │ } │ -│ ) │ │ │ -│ │ │ │ -└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ -``` - - - -### Unsafe - -Use `Type.Unsafe(...)` to create custom schemas with user defined inference rules. - -```typescript -const T = Type.Unsafe({ type: 'number' }) // const T = { - // type: 'number' - // } - -type T = Static // type T = string -``` - -This function can be used to create custom schemas for validators that require specific schema representations. An example of this might be OpenAPI's `nullable` and `enum` schemas which are not provided by TypeBox. The following demonstrates using `Type.Unsafe(...)` to create these types. - -```typescript -import { Type, Static, TSchema } from '@sinclair/typebox' - -//-------------------------------------------------------------------------------------------- -// -// Nullable -// -//-------------------------------------------------------------------------------------------- - -function Nullable(schema: T) { - return Type.Unsafe | null>({ ...schema, nullable: true }) -} - -const T = Nullable(Type.String()) // const T = { - // type: 'string', - // nullable: true - // } - -type T = Static // type T = string | null - - -//-------------------------------------------------------------------------------------------- -// -// StringEnum -// -//-------------------------------------------------------------------------------------------- - -function StringEnum(values: [...T]) { - return Type.Unsafe({ type: 'string', enum: values }) -} - -const T = StringEnum(['A', 'B', 'C']) // const T = { - // enum: ['A', 'B', 'C'] - // } - -type T = Static // type T = 'A' | 'B' | 'C' -``` - - - -### Guards - -Use the guard module to test if values are TypeBox types. - -```typescript -import { TypeGuard } from '@sinclair/typebox/guard' - -const T = Type.String() - -if(TypeGuard.TString(T)) { - - // T is TString -} -``` - - - -### Strict - -TypeBox schemas contain the `Kind` and `Modifier` symbol properties. These properties are provided to enable runtime type reflection on schemas, as well as helping TypeBox internally compose types. These properties are not strictly valid JSON schema; so in some cases it may be desirable to omit them. TypeBox provides a `Type.Strict()` function that will omit these properties if necessary. - -```typescript -const T = Type.Object({ // const T = { - name: Type.Optional(Type.String()) // [Kind]: 'Object', -}) // type: 'object', - // properties: { - // name: { - // [Kind]: 'String', - // type: 'string', - // [Modifier]: 'Optional' - // } - // } - // } - -const U = Type.Strict(T) // const U = { - // type: 'object', - // properties: { - // name: { - // type: 'string' - // } - // } - // } -``` - - - -## Values - -TypeBox includes an optional values module that can be used to perform common operations on JavaScript values. This module enables one to create, check and cast values from types. It also provides functionality to check equality, clone and diff and patch JavaScript values. The value module is provided as an optional import. - -```typescript -import { Value } from '@sinclair/typebox/value' -``` - - - -### Create - -Use the Create function to create a value from a TypeBox type. TypeBox will use default values if specified. - -```typescript -const T = Type.Object({ x: Type.Number(), y: Type.Number({ default: 42 }) }) - -const A = Value.Create(T) // const A = { x: 0, y: 42 } -``` - - - -### Clone - -Use the Clone function to deeply clone a value - -```typescript -const A = Value.Clone({ x: 1, y: 2, z: 3 }) // const A = { x: 1, y: 2, z: 3 } -``` - - - -### Check - -Use the Check function to type check a value - -```typescript -const T = Type.Object({ x: Type.Number() }) - -const R = Value.Check(T, { x: 1 }) // const R = true -``` - - - -### Cast - -Use the Cast function to cast a value into a type. The cast function will retain as much information as possible from the original value. - -```typescript -const T = Type.Object({ x: Type.Number(), y: Type.Number() }, { additionalProperties: false }) - -const X = Value.Cast(T, null) // const X = { x: 0, y: 0 } - -const Y = Value.Cast(T, { x: 1 }) // const Y = { x: 1, y: 0 } - -const Z = Value.Cast(T, { x: 1, y: 2, z: 3 }) // const Z = { x: 1, y: 2 } -``` - - - -### Equal - -Use the Equal function to deeply check for value equality. - -```typescript -const R = Value.Equal( // const R = true - { x: 1, y: 2, z: 3 }, - { x: 1, y: 2, z: 3 } -) -``` - - - -### Hash - -Use the Hash function to create a [FNV1A-64](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function) non cryptographic hash of a value. - -```typescript -const A = Value.Hash({ x: 1, y: 2, z: 3 }) // const A = 2910466848807138541n - -const B = Value.Hash({ x: 1, y: 4, z: 3 }) // const B = 1418369778807423581n -``` - - - -### Diff - -Use the Diff function to produce a sequence of edits to transform one value into another. - -```typescript -const E = Value.Diff( // const E = [ - { x: 1, y: 2, z: 3 }, // { type: 'update', path: '/y', value: 4 }, - { y: 4, z: 5, w: 6 } // { type: 'update', path: '/z', value: 5 }, -) // { type: 'insert', path: '/w', value: 6 }, - // { type: 'delete', path: '/x' } - // ] -``` - - - -### Patch - -Use the Patch function to apply edits - -```typescript -const A = { x: 1, y: 2 } - -const B = { x: 3 } - -const E = Value.Diff(A, B) // const E = [ - // { type: 'update', path: '/x', value: 3 }, - // { type: 'delete', path: '/y' } - // ] - -const C = Value.Patch(A, E) // const C = { x: 3 } -``` - - - - -### Errors - -Use the Errors function enumerate validation errors. - -```typescript -const T = Type.Object({ x: Type.Number(), y: Type.Number() }) - -const R = [...Value.Errors(T, { x: '42' })] // const R = [{ - // schema: { type: 'number' }, - // path: '/x', - // value: '42', - // message: 'Expected number' - // }, { - // schema: { type: 'number' }, - // path: '/y', - // value: undefined, - // message: 'Expected number' - // }] -``` - - - -### Pointer - -Use ValuePointer to perform mutable updates on existing values using [RFC6901](https://www.rfc-editor.org/rfc/rfc6901) Json Pointers. - -```typescript -import { ValuePointer } from '@sinclair/typebox/value' - -const A = { x: 0, y: 0, z: 0 } - -ValuePointer.Set(A, '/x', 1) // const A = { x: 1, y: 0, z: 0 } -ValuePointer.Set(A, '/y', 1) // const A = { x: 1, y: 1, z: 0 } -ValuePointer.Set(A, '/z', 1) // const A = { x: 1, y: 1, z: 1 } -``` - - -## TypeCheck - -TypeBox constructs JSON Schema draft 6 compliant schematics and can be used with any validator that supports this specification. In JavaScript, an ideal validator to use is Ajv which supports draft 6 as well as more recent revisions to the specification. In addition to Ajv, TypeBox provides an optional built in type compiler which can offer faster runtime type compilation, as well as providing high performance data validation for TypeBox types only. - -The following sections detail using these validators. - - - -## Ajv - -The following shows the recommended setup for Ajv. - -```bash -$ npm install ajv ajv-formats --save -``` - -```typescript -import { Type } from '@sinclair/typebox' -import addFormats from 'ajv-formats' -import Ajv from 'ajv' - -const ajv = addFormats(new Ajv({}), [ - 'date-time', - 'time', - 'date', - 'email', - 'hostname', - 'ipv4', - 'ipv6', - 'uri', - 'uri-reference', - 'uuid', - 'uri-template', - 'json-pointer', - 'relative-json-pointer', - 'regex' -]) - -const C = ajv.compile(Type.Object({ - x: Type.Number(), - y: Type.Number(), - z: Type.Number() -})) - -const R = C({ x: 1, y: 2, z: 3 }) // const R = true -``` - - - -### TypeCompiler - -The TypeCompiler is a Just-In-Time (JIT) runtime compiler that can be used to convert TypeBox types into fast validation routines. This compiler is specifically tuned for fast compilation and validation for TypeBox types only. - -The TypeCompiler is provided as an optional import. - -```typescript -import { TypeCompiler } from '@sinclair/typebox/compiler' -``` - -Use the `Compile(...)` function to compile a type. - -```typescript -const C = TypeCompiler.Compile(Type.Object({ // const C: TypeCheck> - -const R = C.Check({ x: 1, y: 2, z: 3 }) // const R = true -``` - -Use `Errors(...)` to generate diagnostics for a value. The `Errors(...)` function will run an exhaustive check across the value and yield any error found. For performance, this function should only be called after failed `Check(...)`. - -```typescript -const C = TypeCompiler.Compile(Type.Object({ // const C: TypeCheck> - -const value = { } - -const errors = [...C.Errors(value)] // const errors = [{ - // schema: { type: 'number' }, - // path: '/x', - // value: undefined, - // message: 'Expected number' - // }, { - // schema: { type: 'number' }, - // path: '/y', - // value: undefined, - // message: 'Expected number' - // }, { - // schema: { type: 'number' }, - // path: '/z', - // value: undefined, - // message: 'Expected number' - // }] -``` - -Compiled routines can be inspected with the `.Code()` function. - -```typescript -const C = TypeCompiler.Compile(Type.String()) // const C: TypeCheck - -console.log(C.Code()) // return function check(value) { - // return ( - // (typeof value === 'string') - // ) - // } -``` - - - -## TypeSystem - -TypeBox provides an extensible TypeSystem module that enables developers to define additional types above and beyond the built in type set. This module also allows developers to define custom string formats as well as override certain type checking behaviours. - -The TypeSystem module is provided as an optional import. - -```typescript -import { TypeSystem } from '@sinclair/typebox/system' -``` - - - -### Types - -Use the `CreateType(...)` function to specify custom type. This function will return a type factory function that can be used to construct the type. The following creates and registers a BigNumber type which will statically infer as `bigint`. - -```typescript -//-------------------------------------------------------------------------------------------- -// -// Use TypeSystem.CreateType(...) to define and return a type factory function -// -//-------------------------------------------------------------------------------------------- - -type BigNumberOptions = { minimum?: bigint; maximum?: bigint } - -const BigNumber = TypeSystem.CreateType( - 'BigNumber', - (options, value) => { - if (typeof value !== 'bigint') return false - if (options.maximum !== undefined && value > options.maximum) return false - if (options.minimum !== undefined && value < options.minimum) return false - return true - } -) - -//-------------------------------------------------------------------------------------------- -// -// Use the custom type like any other type -// -//-------------------------------------------------------------------------------------------- - -const T = BigNumber({ minimum: 10n, maximum: 20n }) // const T = { - // minimum: 10n, - // maximum: 20n, - // [Symbol(TypeBox.Kind)]: 'BigNumber' - // } - -const C = TypeCompiler.Compile(T) -const X = C.Check(15n) // const X = true -const Y = C.Check(5n) // const Y = false -const Z = C.Check(25n) // const Z = false -``` - - - -### Formats - -Use the `CreateFormat(...)` function to specify user defined string formats. The following creates a custom string format that checks for lowercase. - -```typescript -//-------------------------------------------------------------------------------------------- -// -// Use TypeSystem.CreateFormat(...) to define a custom string format -// -//-------------------------------------------------------------------------------------------- - -TypeSystem.CreateFormat('lowercase', value => value === value.toLowerCase()) - -//-------------------------------------------------------------------------------------------- -// -// Use the format by creating string types with the 'format' option -// -//-------------------------------------------------------------------------------------------- - -const T = Type.String({ format: 'lowercase' }) - -const A = Value.Check(T, 'action') // const A = true - -const B = Value.Check(T, 'ACTION') // const B = false -``` - - - -## Benchmark - -This project maintains a set of benchmarks that measure Ajv, Value and TypeCompiler compilation and validation performance. These benchmarks can be run locally by cloning this repository and running `npm run benchmark`. The results below show for Ajv version 8.11.2. - -For additional comparative benchmarks, please refer to [typescript-runtime-type-benchmarks](https://moltar.github.io/typescript-runtime-type-benchmarks/). - - - -### Compile - -This benchmark measures compilation performance for varying types. You can review this benchmark [here](https://github.com/sinclairzx81/typebox/blob/master/benchmark/measurement/module/compile.ts). - -```typescript -┌──────────────────┬────────────┬──────────────┬──────────────┬──────────────┐ -│ (index) │ Iterations │ Ajv │ TypeCompiler │ Performance │ -├──────────────────┼────────────┼──────────────┼──────────────┼──────────────┤ -│ Number │ 2000 │ ' 451 ms' │ ' 16 ms' │ ' 28.19 x' │ -│ String │ 2000 │ ' 338 ms' │ ' 14 ms' │ ' 24.14 x' │ -│ Boolean │ 2000 │ ' 297 ms' │ ' 13 ms' │ ' 22.85 x' │ -│ Null │ 2000 │ ' 265 ms' │ ' 8 ms' │ ' 33.13 x' │ -│ RegEx │ 2000 │ ' 492 ms' │ ' 18 ms' │ ' 27.33 x' │ -│ ObjectA │ 2000 │ ' 2744 ms' │ ' 55 ms' │ ' 49.89 x' │ -│ ObjectB │ 2000 │ ' 3005 ms' │ ' 44 ms' │ ' 68.30 x' │ -│ Tuple │ 2000 │ ' 1283 ms' │ ' 26 ms' │ ' 49.35 x' │ -│ Union │ 2000 │ ' 1263 ms' │ ' 27 ms' │ ' 46.78 x' │ -│ Vector4 │ 2000 │ ' 1622 ms' │ ' 23 ms' │ ' 70.52 x' │ -│ Matrix4 │ 2000 │ ' 888 ms' │ ' 12 ms' │ ' 74.00 x' │ -│ Literal_String │ 2000 │ ' 344 ms' │ ' 14 ms' │ ' 24.57 x' │ -│ Literal_Number │ 2000 │ ' 389 ms' │ ' 8 ms' │ ' 48.63 x' │ -│ Literal_Boolean │ 2000 │ ' 374 ms' │ ' 9 ms' │ ' 41.56 x' │ -│ Array_Number │ 2000 │ ' 710 ms' │ ' 12 ms' │ ' 59.17 x' │ -│ Array_String │ 2000 │ ' 739 ms' │ ' 9 ms' │ ' 82.11 x' │ -│ Array_Boolean │ 2000 │ ' 732 ms' │ ' 7 ms' │ ' 104.57 x' │ -│ Array_ObjectA │ 2000 │ ' 3733 ms' │ ' 42 ms' │ ' 88.88 x' │ -│ Array_ObjectB │ 2000 │ ' 3602 ms' │ ' 42 ms' │ ' 85.76 x' │ -│ Array_Tuple │ 2000 │ ' 2204 ms' │ ' 20 ms' │ ' 110.20 x' │ -│ Array_Union │ 2000 │ ' 1533 ms' │ ' 24 ms' │ ' 63.88 x' │ -│ Array_Vector4 │ 2000 │ ' 2263 ms' │ ' 21 ms' │ ' 107.76 x' │ -│ Array_Matrix4 │ 2000 │ ' 1576 ms' │ ' 14 ms' │ ' 112.57 x' │ -└──────────────────┴────────────┴──────────────┴──────────────┴──────────────┘ -``` - - - -### Validate - -This benchmark measures validation performance for varying types. You can review this benchmark [here](https://github.com/sinclairzx81/typebox/blob/master/benchmark/measurement/module/check.ts). - -```typescript -┌──────────────────┬────────────┬──────────────┬──────────────┬──────────────┬──────────────┐ -│ (index) │ Iterations │ ValueCheck │ Ajv │ TypeCompiler │ Performance │ -├──────────────────┼────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ -│ Number │ 1000000 │ ' 30 ms' │ ' 7 ms' │ ' 6 ms' │ ' 1.17 x' │ -│ String │ 1000000 │ ' 23 ms' │ ' 21 ms' │ ' 11 ms' │ ' 1.91 x' │ -│ Boolean │ 1000000 │ ' 22 ms' │ ' 21 ms' │ ' 10 ms' │ ' 2.10 x' │ -│ Null │ 1000000 │ ' 27 ms' │ ' 20 ms' │ ' 10 ms' │ ' 2.00 x' │ -│ RegEx │ 1000000 │ ' 163 ms' │ ' 47 ms' │ ' 38 ms' │ ' 1.24 x' │ -│ ObjectA │ 1000000 │ ' 654 ms' │ ' 41 ms' │ ' 24 ms' │ ' 1.71 x' │ -│ ObjectB │ 1000000 │ ' 1173 ms' │ ' 59 ms' │ ' 41 ms' │ ' 1.44 x' │ -│ Tuple │ 1000000 │ ' 124 ms' │ ' 24 ms' │ ' 17 ms' │ ' 1.41 x' │ -│ Union │ 1000000 │ ' 332 ms' │ ' 26 ms' │ ' 16 ms' │ ' 1.63 x' │ -│ Recursive │ 1000000 │ ' 3129 ms' │ ' 412 ms' │ ' 102 ms' │ ' 4.04 x' │ -│ Vector4 │ 1000000 │ ' 147 ms' │ ' 26 ms' │ ' 13 ms' │ ' 2.00 x' │ -│ Matrix4 │ 1000000 │ ' 576 ms' │ ' 41 ms' │ ' 28 ms' │ ' 1.46 x' │ -│ Literal_String │ 1000000 │ ' 51 ms' │ ' 21 ms' │ ' 10 ms' │ ' 2.10 x' │ -│ Literal_Number │ 1000000 │ ' 47 ms' │ ' 21 ms' │ ' 11 ms' │ ' 1.91 x' │ -│ Literal_Boolean │ 1000000 │ ' 47 ms' │ ' 21 ms' │ ' 10 ms' │ ' 2.10 x' │ -│ Array_Number │ 1000000 │ ' 490 ms' │ ' 33 ms' │ ' 18 ms' │ ' 1.83 x' │ -│ Array_String │ 1000000 │ ' 502 ms' │ ' 31 ms' │ ' 25 ms' │ ' 1.24 x' │ -│ Array_Boolean │ 1000000 │ ' 465 ms' │ ' 33 ms' │ ' 27 ms' │ ' 1.22 x' │ -│ Array_ObjectA │ 1000000 │ ' 15463 ms' │ ' 2470 ms' │ ' 2052 ms' │ ' 1.20 x' │ -│ Array_ObjectB │ 1000000 │ ' 18047 ms' │ ' 2497 ms' │ ' 2348 ms' │ ' 1.06 x' │ -│ Array_Tuple │ 1000000 │ ' 1958 ms' │ ' 99 ms' │ ' 77 ms' │ ' 1.29 x' │ -│ Array_Union │ 1000000 │ ' 5348 ms' │ ' 254 ms' │ ' 89 ms' │ ' 2.85 x' │ -│ Array_Recursive │ 1000000 │ ' 54643 ms' │ ' 8870 ms' │ ' 1158 ms' │ ' 7.66 x' │ -│ Array_Vector4 │ 1000000 │ ' 2724 ms' │ ' 105 ms' │ ' 48 ms' │ ' 2.19 x' │ -│ Array_Matrix4 │ 1000000 │ ' 13821 ms' │ ' 437 ms' │ ' 266 ms' │ ' 1.64 x' │ -└──────────────────┴────────────┴──────────────┴──────────────┴──────────────┴──────────────┘ -``` - - - -### Compression - -The following table lists esbuild compiled and minified sizes for each TypeBox module. - -```typescript -┌──────────────────────┬────────────┬────────────┬─────────────┐ -│ (index) │ Compiled │ Minified │ Compression │ -├──────────────────────┼────────────┼────────────┼─────────────┤ -│ typebox/compiler │ ' 65.4 kb' │ ' 32.2 kb' │ '2.03 x' │ -│ typebox/conditional │ ' 45.5 kb' │ ' 18.6 kb' │ '2.45 x' │ -│ typebox/custom │ ' 0.6 kb' │ ' 0.2 kb' │ '2.61 x' │ -│ typebox/format │ ' 0.6 kb' │ ' 0.2 kb' │ '2.66 x' │ -│ typebox/guard │ ' 23.8 kb' │ ' 11.4 kb' │ '2.08 x' │ -│ typebox/hash │ ' 4.2 kb' │ ' 1.8 kb' │ '2.30 x' │ -│ typebox/system │ ' 14.0 kb' │ ' 7.1 kb' │ '1.96 x' │ -│ typebox/value │ ' 90.0 kb' │ ' 41.8 kb' │ '2.15 x' │ -│ typebox │ ' 12.0 kb' │ ' 6.4 kb' │ '1.89 x' │ -└──────────────────────┴────────────┴────────────┴─────────────┘ -``` - - - -## Contribute - -TypeBox is open to community contribution. Please ensure you submit an open issue before submitting your pull request. The TypeBox project preferences open community discussion prior to accepting new features. diff --git a/node_modules/@sinclair/typebox/system/index.d.ts b/node_modules/@sinclair/typebox/system/index.d.ts deleted file mode 100644 index 4b58cda61..000000000 --- a/node_modules/@sinclair/typebox/system/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './system'; diff --git a/node_modules/@sinclair/typebox/system/index.js b/node_modules/@sinclair/typebox/system/index.js deleted file mode 100644 index 3c5107f19..000000000 --- a/node_modules/@sinclair/typebox/system/index.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/system - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./system"), exports); diff --git a/node_modules/@sinclair/typebox/system/system.d.ts b/node_modules/@sinclair/typebox/system/system.d.ts deleted file mode 100644 index 056de98d9..000000000 --- a/node_modules/@sinclair/typebox/system/system.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export declare class TypeSystemDuplicateTypeKind extends Error { - constructor(kind: string); -} -export declare class TypeSystemDuplicateFormat extends Error { - constructor(kind: string); -} -/** Creates user defined types and formats and provides overrides for value checking behaviours */ -export declare namespace TypeSystem { - /** Sets whether arrays should be treated as kinds of objects. The default is `false` */ - let AllowArrayObjects: boolean; - /** Sets whether numeric checks should consider NaN a valid number type. The default is `false` */ - let AllowNaN: boolean; - /** Creates a custom type */ - function CreateType(kind: string, callback: (options: Options, value: unknown) => boolean): (options?: Partial) => import("../typebox").TUnsafe; - /** Creates a custom string format */ - function CreateFormat(format: string, callback: (value: string) => boolean): (value: string) => boolean; -} diff --git a/node_modules/@sinclair/typebox/system/system.js b/node_modules/@sinclair/typebox/system/system.js deleted file mode 100644 index 914cb8bbb..000000000 --- a/node_modules/@sinclair/typebox/system/system.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/system - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TypeSystem = exports.TypeSystemDuplicateFormat = exports.TypeSystemDuplicateTypeKind = void 0; -const typebox_1 = require("../typebox"); -const index_1 = require("../custom/index"); -const index_2 = require("../format/index"); -class TypeSystemDuplicateTypeKind extends Error { - constructor(kind) { - super(`Duplicate kind '${kind}' detected`); - } -} -exports.TypeSystemDuplicateTypeKind = TypeSystemDuplicateTypeKind; -class TypeSystemDuplicateFormat extends Error { - constructor(kind) { - super(`Duplicate format '${kind}' detected`); - } -} -exports.TypeSystemDuplicateFormat = TypeSystemDuplicateFormat; -/** Creates user defined types and formats and provides overrides for value checking behaviours */ -var TypeSystem; -(function (TypeSystem) { - /** Sets whether arrays should be treated as kinds of objects. The default is `false` */ - TypeSystem.AllowArrayObjects = false; - /** Sets whether numeric checks should consider NaN a valid number type. The default is `false` */ - TypeSystem.AllowNaN = false; - /** Creates a custom type */ - function CreateType(kind, callback) { - if (index_1.Custom.Has(kind)) - throw new TypeSystemDuplicateTypeKind(kind); - index_1.Custom.Set(kind, callback); - return (options = {}) => typebox_1.Type.Unsafe({ ...options, [typebox_1.Kind]: kind }); - } - TypeSystem.CreateType = CreateType; - /** Creates a custom string format */ - function CreateFormat(format, callback) { - if (index_2.Format.Has(format)) - throw new TypeSystemDuplicateFormat(format); - index_2.Format.Set(format, callback); - return callback; - } - TypeSystem.CreateFormat = CreateFormat; -})(TypeSystem = exports.TypeSystem || (exports.TypeSystem = {})); diff --git a/node_modules/@sinclair/typebox/typebox.d.ts b/node_modules/@sinclair/typebox/typebox.d.ts deleted file mode 100644 index 438756b19..000000000 --- a/node_modules/@sinclair/typebox/typebox.d.ts +++ /dev/null @@ -1,422 +0,0 @@ -export declare const Kind: unique symbol; -export declare const Hint: unique symbol; -export declare const Modifier: unique symbol; -export type TModifier = TReadonlyOptional | TOptional | TReadonly; -export type TReadonly = T & { - [Modifier]: 'Readonly'; -}; -export type TOptional = T & { - [Modifier]: 'Optional'; -}; -export type TReadonlyOptional = T & { - [Modifier]: 'ReadonlyOptional'; -}; -export interface SchemaOptions { - $schema?: string; - /** Id for this schema */ - $id?: string; - /** Title of this schema */ - title?: string; - /** Description of this schema */ - description?: string; - /** Default value for this schema */ - default?: any; - /** Example values matching this schema. */ - examples?: any; - [prop: string]: any; -} -export interface TSchema extends SchemaOptions { - [Kind]: string; - [Hint]?: string; - [Modifier]?: string; - params: unknown[]; - static: unknown; -} -export type TAnySchema = TSchema | TAny | TArray | TBoolean | TConstructor | TDate | TEnum | TFunction | TInteger | TLiteral | TNull | TNumber | TObject | TPromise | TRecord | TSelf | TRef | TString | TTuple | TUndefined | TUnion | TUint8Array | TUnknown | TVoid; -export interface NumericOptions extends SchemaOptions { - exclusiveMaximum?: number; - exclusiveMinimum?: number; - maximum?: number; - minimum?: number; - multipleOf?: number; -} -export type TNumeric = TInteger | TNumber; -export interface TAny extends TSchema { - [Kind]: 'Any'; - static: any; -} -export interface ArrayOptions extends SchemaOptions { - uniqueItems?: boolean; - minItems?: number; - maxItems?: number; -} -export interface TArray extends TSchema, ArrayOptions { - [Kind]: 'Array'; - static: Array>; - type: 'array'; - items: T; -} -export interface TBoolean extends TSchema { - [Kind]: 'Boolean'; - static: boolean; - type: 'boolean'; -} -export type TConstructorParameters> = TTuple; -export type TInstanceType> = T['returns']; -export type StaticContructorParameters = [...{ - [K in keyof T]: T[K] extends TSchema ? Static : never; -}]; -export interface TConstructor extends TSchema { - [Kind]: 'Constructor'; - static: new (...param: StaticContructorParameters) => Static; - type: 'object'; - instanceOf: 'Constructor'; - parameters: T; - returns: U; -} -export interface DateOptions extends SchemaOptions { - exclusiveMaximumTimestamp?: number; - exclusiveMinimumTimestamp?: number; - maximumTimestamp?: number; - minimumTimestamp?: number; -} -export interface TDate extends TSchema, DateOptions { - [Kind]: 'Date'; - static: Date; - type: 'object'; - instanceOf: 'Date'; -} -export interface TEnumOption { - type: 'number' | 'string'; - const: T; -} -export interface TEnum = Record> extends TSchema { - [Kind]: 'Union'; - static: T[keyof T]; - anyOf: TLiteral[]; -} -export type TParameters = TTuple; -export type TReturnType = T['returns']; -export type StaticFunctionParameters = [...{ - [K in keyof T]: T[K] extends TSchema ? Static : never; -}]; -export interface TFunction extends TSchema { - [Kind]: 'Function'; - static: (...param: StaticFunctionParameters) => Static; - type: 'object'; - instanceOf: 'Function'; - parameters: T; - returns: U; -} -export interface TInteger extends TSchema, NumericOptions { - [Kind]: 'Integer'; - static: number; - type: 'integer'; -} -export type IntersectReduce = T extends [infer A, ...infer B] ? IntersectReduce : I extends object ? I : {}; -export type IntersectEvaluate = { - [K in keyof T]: T[K] extends TSchema ? Static : never; -}; -export type IntersectProperties = { - [K in keyof T]: T[K] extends TObject ? P : {}; -}; -export interface TIntersect extends TObject { - static: IntersectReduce>; - properties: IntersectReduce>; -} -export type UnionToIntersect = (U extends unknown ? (arg: U) => 0 : never) extends (arg: infer I) => 0 ? I : never; -export type UnionLast = UnionToIntersect 0 : never> extends (x: infer L) => 0 ? L : never; -export type UnionToTuple> = [U] extends [never] ? [] : [...UnionToTuple>, L]; -export type UnionStringLiteralToTuple = T extends TUnion ? { - [I in keyof L]: L[I] extends TLiteral ? C : never; -} : never; -export type UnionLiteralsFromObject = { - [K in ObjectPropertyKeys]: TLiteral; -} extends infer R ? UnionToTuple : never; -export interface TKeyOf extends TUnion> { -} -export type TLiteralValue = string | number | boolean; -export interface TLiteral extends TSchema { - [Kind]: 'Literal'; - static: T; - const: T; -} -export interface TNever extends TSchema { - [Kind]: 'Never'; - static: never; - allOf: [{ - type: 'boolean'; - const: false; - }, { - type: 'boolean'; - const: true; - }]; -} -export interface TNull extends TSchema { - [Kind]: 'Null'; - static: null; - type: 'null'; -} -export interface TNumber extends TSchema, NumericOptions { - [Kind]: 'Number'; - static: number; - type: 'number'; -} -export type ReadonlyOptionalPropertyKeys = { - [K in keyof T]: T[K] extends TReadonlyOptional ? K : never; -}[keyof T]; -export type ReadonlyPropertyKeys = { - [K in keyof T]: T[K] extends TReadonly ? K : never; -}[keyof T]; -export type OptionalPropertyKeys = { - [K in keyof T]: T[K] extends TOptional ? K : never; -}[keyof T]; -export type RequiredPropertyKeys = keyof Omit | ReadonlyPropertyKeys | OptionalPropertyKeys>; -export type PropertiesReducer> = (Readonly>>> & Readonly>> & Partial>> & Required>>) extends infer O ? { - [K in keyof O]: O[K]; -} : never; -export type PropertiesReduce = PropertiesReducer; -}>; -export type TRecordProperties, T extends TSchema> = Static extends string ? { - [X in Static]: T; -} : never; -export interface TProperties { - [key: string]: TSchema; -} -export type ObjectProperties = T extends TObject ? U : never; -export type ObjectPropertyKeys = T extends TObject ? keyof U : never; -export type TAdditionalProperties = undefined | TSchema | boolean; -export interface ObjectOptions extends SchemaOptions { - additionalProperties?: TAdditionalProperties; - minProperties?: number; - maxProperties?: number; -} -export interface TObject extends TSchema, ObjectOptions { - [Kind]: 'Object'; - static: PropertiesReduce; - additionalProperties?: TAdditionalProperties; - type: 'object'; - properties: T; - required?: string[]; -} -export interface TOmit[]> extends TObject, ObjectOptions { - static: Omit, Properties[number]>; - properties: T extends TObject ? Omit : never; -} -export interface TPartial extends TObject { - static: Partial>; - properties: { - [K in keyof T['properties']]: T['properties'][K] extends TReadonlyOptional ? TReadonlyOptional : T['properties'][K] extends TReadonly ? TReadonlyOptional : T['properties'][K] extends TOptional ? TOptional : TOptional; - }; -} -export type TPick[]> = TObject<{ - [K in Properties[number]]: T['properties'][K]; -}>; -export interface TPromise extends TSchema { - [Kind]: 'Promise'; - static: Promise>; - type: 'object'; - instanceOf: 'Promise'; - item: TSchema; -} -export type TRecordKey = TString | TNumeric | TUnion[]>; -export interface TRecord extends TSchema { - [Kind]: 'Record'; - static: Record, Static>; - type: 'object'; - patternProperties: { - [pattern: string]: T; - }; - additionalProperties: false; -} -export interface TSelf extends TSchema { - [Kind]: 'Self'; - static: this['params'][0]; - $ref: string; -} -export type TRecursiveReduce = Static]>; -export interface TRecursive extends TSchema { - static: TRecursiveReduce; -} -export interface TRef extends TSchema { - [Kind]: 'Ref'; - static: Static; - $ref: string; -} -export interface TRequired> extends TObject { - static: Required>; - properties: { - [K in keyof T['properties']]: T['properties'][K] extends TReadonlyOptional ? TReadonly : T['properties'][K] extends TReadonly ? TReadonly : T['properties'][K] extends TOptional ? U : T['properties'][K]; - }; -} -export type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex'; -export interface StringOptions extends SchemaOptions { - minLength?: number; - maxLength?: number; - pattern?: string; - format?: Format; - contentEncoding?: '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64'; - contentMediaType?: string; -} -export interface TString extends TSchema, StringOptions { - [Kind]: 'String'; - static: string; - type: 'string'; -} -export type TupleToArray> = T extends TTuple ? R : never; -export interface TTuple extends TSchema { - [Kind]: 'Tuple'; - static: { - [K in keyof T]: T[K] extends TSchema ? Static : T[K]; - }; - type: 'array'; - items?: T; - additionalItems?: false; - minItems: number; - maxItems: number; -} -export interface TUndefined extends TSchema { - [Kind]: 'Undefined'; - static: undefined; - type: 'null'; - typeOf: 'Undefined'; -} -export interface TUnion extends TSchema { - [Kind]: 'Union'; - static: { - [K in keyof T]: T[K] extends TSchema ? Static : never; - }[number]; - anyOf: T; -} -export interface Uint8ArrayOptions extends SchemaOptions { - maxByteLength?: number; - minByteLength?: number; -} -export interface TUint8Array extends TSchema, Uint8ArrayOptions { - [Kind]: 'Uint8Array'; - static: Uint8Array; - instanceOf: 'Uint8Array'; - type: 'object'; -} -export interface TUnknown extends TSchema { - [Kind]: 'Unknown'; - static: unknown; -} -export interface UnsafeOptions extends SchemaOptions { - [Kind]?: string; -} -export interface TUnsafe extends TSchema { - [Kind]: string; - static: T; -} -export interface TVoid extends TSchema { - [Kind]: 'Void'; - static: void; - type: 'null'; - typeOf: 'Void'; -} -/** Creates a static type from a TypeBox type */ -export type Static = (T & { - params: P; -})['static']; -export declare class TypeBuilder { - /** Creates a readonly optional property */ - ReadonlyOptional(item: T): TReadonlyOptional; - /** Creates a readonly property */ - Readonly(item: T): TReadonly; - /** Creates a optional property */ - Optional(item: T): TOptional; - /** `Standard` Creates a any type */ - Any(options?: SchemaOptions): TAny; - /** `Standard` Creates a array type */ - Array(items: T, options?: ArrayOptions): TArray; - /** `Standard` Creates a boolean type */ - Boolean(options?: SchemaOptions): TBoolean; - /** `Extended` Creates a tuple type from this constructors parameters */ - ConstructorParameters>(schema: T, options?: SchemaOptions): TConstructorParameters; - /** `Extended` Creates a constructor type */ - Constructor, U extends TSchema>(parameters: T, returns: U, options?: SchemaOptions): TConstructor, U>; - /** `Extended` Creates a constructor type */ - Constructor(parameters: [...T], returns: U, options?: SchemaOptions): TConstructor; - /** `Extended` Creates a Date type */ - Date(options?: DateOptions): TDate; - /** `Standard` Creates a enum type */ - Enum>(item: T, options?: SchemaOptions): TEnum; - /** `Extended` Creates a function type */ - Function, U extends TSchema>(parameters: T, returns: U, options?: SchemaOptions): TFunction, U>; - /** `Extended` Creates a function type */ - Function(parameters: [...T], returns: U, options?: SchemaOptions): TFunction; - /** `Extended` Creates a type from this constructors instance type */ - InstanceType>(schema: T, options?: SchemaOptions): TInstanceType; - /** `Standard` Creates a integer type */ - Integer(options?: NumericOptions): TInteger; - /** `Standard` Creates a intersect type. */ - Intersect(objects: [...T], options?: ObjectOptions): TIntersect; - /** `Standard` Creates a keyof type */ - KeyOf(object: T, options?: SchemaOptions): TKeyOf; - /** `Standard` Creates a literal type. */ - Literal(value: T, options?: SchemaOptions): TLiteral; - /** `Standard` Creates a never type */ - Never(options?: SchemaOptions): TNever; - /** `Standard` Creates a null type */ - Null(options?: SchemaOptions): TNull; - /** `Standard` Creates a number type */ - Number(options?: NumericOptions): TNumber; - /** `Standard` Creates an object type */ - Object(properties: T, options?: ObjectOptions): TObject; - /** `Standard` Creates a new object type whose keys are omitted from the given source type */ - Omit[]>>(schema: T, keys: K, options?: ObjectOptions): TOmit>; - /** `Standard` Creates a new object type whose keys are omitted from the given source type */ - Omit[]>(schema: T, keys: readonly [...K], options?: ObjectOptions): TOmit; - /** `Extended` Creates a tuple type from this functions parameters */ - Parameters>(schema: T, options?: SchemaOptions): TParameters; - /** `Standard` Creates an object type whose properties are all optional */ - Partial(schema: T, options?: ObjectOptions): TPartial; - /** `Standard` Creates a new object type whose keys are picked from the given source type */ - Pick[]>>(schema: T, keys: K, options?: ObjectOptions): TPick>; - /** `Standard` Creates a new object type whose keys are picked from the given source type */ - Pick[]>(schema: T, keys: readonly [...K], options?: ObjectOptions): TPick; - /** `Extended` Creates a Promise type */ - Promise(item: T, options?: SchemaOptions): TPromise; - /** `Standard` Creates an object whose properties are derived from the given string literal union. */ - Record, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): TObject>; - /** `Standard` Creates a record type */ - Record(key: K, schema: T, options?: ObjectOptions): TRecord; - /** `Standard` Creates recursive type */ - Recursive(callback: (self: TSelf) => T, options?: SchemaOptions): TRecursive; - /** `Standard` Creates a reference type. The referenced type must contain a $id. */ - Ref(schema: T, options?: SchemaOptions): TRef; - /** `Standard` Creates a string type from a regular expression */ - RegEx(regex: RegExp, options?: SchemaOptions): TString; - /** `Standard` Creates an object type whose properties are all required */ - Required(schema: T, options?: SchemaOptions): TRequired; - /** `Extended` Creates a type from this functions return type */ - ReturnType>(schema: T, options?: SchemaOptions): TReturnType; - /** Removes Kind and Modifier symbol property keys from this schema */ - Strict(schema: T): T; - /** `Standard` Creates a string type */ - String(options?: StringOptions): TString; - /** `Standard` Creates a tuple type */ - Tuple(items: [...T], options?: SchemaOptions): TTuple; - /** `Extended` Creates a undefined type */ - Undefined(options?: SchemaOptions): TUndefined; - /** `Standard` Creates a union type */ - Union(items: [], options?: SchemaOptions): TNever; - /** `Standard` Creates a union type */ - Union(items: [...T], options?: SchemaOptions): TUnion; - /** `Extended` Creates a Uint8Array type */ - Uint8Array(options?: Uint8ArrayOptions): TUint8Array; - /** `Standard` Creates an unknown type */ - Unknown(options?: SchemaOptions): TUnknown; - /** `Standard` Creates a user defined schema that infers as type T */ - Unsafe(options?: UnsafeOptions): TUnsafe; - /** `Extended` Creates a void type */ - Void(options?: SchemaOptions): TVoid; - /** Use this function to return TSchema with static and params omitted */ - protected Create(schema: Omit): T; - /** Clones the given value */ - protected Clone(value: any): any; -} -/** JSON Schema Type Builder with Static Type Resolution for TypeScript */ -export declare const Type: TypeBuilder; diff --git a/node_modules/@sinclair/typebox/typebox.js b/node_modules/@sinclair/typebox/typebox.js deleted file mode 100644 index 5484d9554..000000000 --- a/node_modules/@sinclair/typebox/typebox.js +++ /dev/null @@ -1,388 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Type = exports.TypeBuilder = exports.Modifier = exports.Hint = exports.Kind = void 0; -// -------------------------------------------------------------------------- -// Symbols -// -------------------------------------------------------------------------- -exports.Kind = Symbol.for('TypeBox.Kind'); -exports.Hint = Symbol.for('TypeBox.Hint'); -exports.Modifier = Symbol.for('TypeBox.Modifier'); -// -------------------------------------------------------------------------- -// TypeBuilder -// -------------------------------------------------------------------------- -let TypeOrdinal = 0; -class TypeBuilder { - // ---------------------------------------------------------------------- - // Modifiers - // ---------------------------------------------------------------------- - /** Creates a readonly optional property */ - ReadonlyOptional(item) { - return { [exports.Modifier]: 'ReadonlyOptional', ...item }; - } - /** Creates a readonly property */ - Readonly(item) { - return { [exports.Modifier]: 'Readonly', ...item }; - } - /** Creates a optional property */ - Optional(item) { - return { [exports.Modifier]: 'Optional', ...item }; - } - // ---------------------------------------------------------------------- - // Types - // ---------------------------------------------------------------------- - /** `Standard` Creates a any type */ - Any(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Any' }); - } - /** `Standard` Creates a array type */ - Array(items, options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Array', type: 'array', items }); - } - /** `Standard` Creates a boolean type */ - Boolean(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Boolean', type: 'boolean' }); - } - /** `Extended` Creates a tuple type from this constructors parameters */ - ConstructorParameters(schema, options = {}) { - return this.Tuple([...schema.parameters], { ...options }); - } - /** `Extended` Creates a constructor type */ - Constructor(parameters, returns, options = {}) { - if (parameters[exports.Kind] === 'Tuple') { - const inner = parameters.items === undefined ? [] : parameters.items; - return this.Create({ ...options, [exports.Kind]: 'Constructor', type: 'object', instanceOf: 'Constructor', parameters: inner, returns }); - } - else if (globalThis.Array.isArray(parameters)) { - return this.Create({ ...options, [exports.Kind]: 'Constructor', type: 'object', instanceOf: 'Constructor', parameters, returns }); - } - else { - throw new Error('TypeBuilder.Constructor: Invalid parameters'); - } - } - /** `Extended` Creates a Date type */ - Date(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Date', type: 'object', instanceOf: 'Date' }); - } - /** `Standard` Creates a enum type */ - Enum(item, options = {}) { - const values = Object.keys(item) - .filter((key) => isNaN(key)) - .map((key) => item[key]); - const anyOf = values.map((value) => (typeof value === 'string' ? { [exports.Kind]: 'Literal', type: 'string', const: value } : { [exports.Kind]: 'Literal', type: 'number', const: value })); - return this.Create({ ...options, [exports.Kind]: 'Union', [exports.Hint]: 'Enum', anyOf }); - } - /** `Extended` Creates a function type */ - Function(parameters, returns, options = {}) { - if (parameters[exports.Kind] === 'Tuple') { - const inner = parameters.items === undefined ? [] : parameters.items; - return this.Create({ ...options, [exports.Kind]: 'Function', type: 'object', instanceOf: 'Function', parameters: inner, returns }); - } - else if (globalThis.Array.isArray(parameters)) { - return this.Create({ ...options, [exports.Kind]: 'Function', type: 'object', instanceOf: 'Function', parameters, returns }); - } - else { - throw new Error('TypeBuilder.Function: Invalid parameters'); - } - } - /** `Extended` Creates a type from this constructors instance type */ - InstanceType(schema, options = {}) { - return { ...options, ...this.Clone(schema.returns) }; - } - /** `Standard` Creates a integer type */ - Integer(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Integer', type: 'integer' }); - } - /** `Standard` Creates a intersect type. */ - Intersect(objects, options = {}) { - const isOptional = (schema) => (schema[exports.Modifier] && schema[exports.Modifier] === 'Optional') || schema[exports.Modifier] === 'ReadonlyOptional'; - const [required, optional] = [new Set(), new Set()]; - for (const object of objects) { - for (const [key, schema] of Object.entries(object.properties)) { - if (isOptional(schema)) - optional.add(key); - } - } - for (const object of objects) { - for (const key of Object.keys(object.properties)) { - if (!optional.has(key)) - required.add(key); - } - } - const properties = {}; - for (const object of objects) { - for (const [key, schema] of Object.entries(object.properties)) { - properties[key] = properties[key] === undefined ? schema : { [exports.Kind]: 'Union', anyOf: [properties[key], { ...schema }] }; - } - } - if (required.size > 0) { - return this.Create({ ...options, [exports.Kind]: 'Object', type: 'object', properties, required: [...required] }); - } - else { - return this.Create({ ...options, [exports.Kind]: 'Object', type: 'object', properties }); - } - } - /** `Standard` Creates a keyof type */ - KeyOf(object, options = {}) { - const items = Object.keys(object.properties).map((key) => this.Create({ ...options, [exports.Kind]: 'Literal', type: 'string', const: key })); - return this.Create({ ...options, [exports.Kind]: 'Union', [exports.Hint]: 'KeyOf', anyOf: items }); - } - /** `Standard` Creates a literal type. */ - Literal(value, options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Literal', const: value, type: typeof value }); - } - /** `Standard` Creates a never type */ - Never(options = {}) { - return this.Create({ - ...options, - [exports.Kind]: 'Never', - allOf: [ - { type: 'boolean', const: false }, - { type: 'boolean', const: true }, - ], - }); - } - /** `Standard` Creates a null type */ - Null(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Null', type: 'null' }); - } - /** `Standard` Creates a number type */ - Number(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Number', type: 'number' }); - } - /** `Standard` Creates an object type */ - Object(properties, options = {}) { - const property_names = Object.keys(properties); - const optional = property_names.filter((name) => { - const property = properties[name]; - const modifier = property[exports.Modifier]; - return modifier && (modifier === 'Optional' || modifier === 'ReadonlyOptional'); - }); - const required = property_names.filter((name) => !optional.includes(name)); - if (required.length > 0) { - return this.Create({ ...options, [exports.Kind]: 'Object', type: 'object', properties, required }); - } - else { - return this.Create({ ...options, [exports.Kind]: 'Object', type: 'object', properties }); - } - } - /** `Standard` Creates a new object type whose keys are omitted from the given source type */ - Omit(schema, keys, options = {}) { - const select = keys[exports.Kind] === 'Union' ? keys.anyOf.map((schema) => schema.const) : keys; - const next = { ...this.Clone(schema), ...options, [exports.Hint]: 'Omit' }; - if (next.required) { - next.required = next.required.filter((key) => !select.includes(key)); - if (next.required.length === 0) - delete next.required; - } - for (const key of Object.keys(next.properties)) { - if (select.includes(key)) - delete next.properties[key]; - } - return this.Create(next); - } - /** `Extended` Creates a tuple type from this functions parameters */ - Parameters(schema, options = {}) { - return exports.Type.Tuple(schema.parameters, { ...options }); - } - /** `Standard` Creates an object type whose properties are all optional */ - Partial(schema, options = {}) { - const next = { ...this.Clone(schema), ...options, [exports.Hint]: 'Partial' }; - delete next.required; - for (const key of Object.keys(next.properties)) { - const property = next.properties[key]; - const modifer = property[exports.Modifier]; - switch (modifer) { - case 'ReadonlyOptional': - property[exports.Modifier] = 'ReadonlyOptional'; - break; - case 'Readonly': - property[exports.Modifier] = 'ReadonlyOptional'; - break; - case 'Optional': - property[exports.Modifier] = 'Optional'; - break; - default: - property[exports.Modifier] = 'Optional'; - break; - } - } - return this.Create(next); - } - /** `Standard` Creates a new object type whose keys are picked from the given source type */ - Pick(schema, keys, options = {}) { - const select = keys[exports.Kind] === 'Union' ? keys.anyOf.map((schema) => schema.const) : keys; - const next = { ...this.Clone(schema), ...options, [exports.Hint]: 'Pick' }; - if (next.required) { - next.required = next.required.filter((key) => select.includes(key)); - if (next.required.length === 0) - delete next.required; - } - for (const key of Object.keys(next.properties)) { - if (!select.includes(key)) - delete next.properties[key]; - } - return this.Create(next); - } - /** `Extended` Creates a Promise type */ - Promise(item, options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Promise', type: 'object', instanceOf: 'Promise', item }); - } - /** `Standard` Creates a record type */ - Record(key, value, options = {}) { - // If string literal union return TObject with properties extracted from union. - if (key[exports.Kind] === 'Union') { - return this.Object(key.anyOf.reduce((acc, literal) => { - return { ...acc, [literal.const]: value }; - }, {}), { ...options, [exports.Hint]: 'Record' }); - } - // otherwise return TRecord with patternProperties - const pattern = ['Integer', 'Number'].includes(key[exports.Kind]) ? '^(0|[1-9][0-9]*)$' : key[exports.Kind] === 'String' && key.pattern ? key.pattern : '^.*$'; - return this.Create({ - ...options, - [exports.Kind]: 'Record', - type: 'object', - patternProperties: { [pattern]: value }, - additionalProperties: false, - }); - } - /** `Standard` Creates recursive type */ - Recursive(callback, options = {}) { - if (options.$id === undefined) - options.$id = `T${TypeOrdinal++}`; - const self = callback({ [exports.Kind]: 'Self', $ref: `${options.$id}` }); - self.$id = options.$id; - return this.Create({ ...options, ...self }); - } - /** `Standard` Creates a reference type. The referenced type must contain a $id. */ - Ref(schema, options = {}) { - if (schema.$id === undefined) - throw Error('TypeBuilder.Ref: Referenced schema must specify an $id'); - return this.Create({ ...options, [exports.Kind]: 'Ref', $ref: schema.$id }); - } - /** `Standard` Creates a string type from a regular expression */ - RegEx(regex, options = {}) { - return this.Create({ ...options, [exports.Kind]: 'String', type: 'string', pattern: regex.source }); - } - /** `Standard` Creates an object type whose properties are all required */ - Required(schema, options = {}) { - const next = { ...this.Clone(schema), ...options, [exports.Hint]: 'Required' }; - next.required = Object.keys(next.properties); - for (const key of Object.keys(next.properties)) { - const property = next.properties[key]; - const modifier = property[exports.Modifier]; - switch (modifier) { - case 'ReadonlyOptional': - property[exports.Modifier] = 'Readonly'; - break; - case 'Readonly': - property[exports.Modifier] = 'Readonly'; - break; - case 'Optional': - delete property[exports.Modifier]; - break; - default: - delete property[exports.Modifier]; - break; - } - } - return this.Create(next); - } - /** `Extended` Creates a type from this functions return type */ - ReturnType(schema, options = {}) { - return { ...options, ...this.Clone(schema.returns) }; - } - /** Removes Kind and Modifier symbol property keys from this schema */ - Strict(schema) { - return JSON.parse(JSON.stringify(schema)); - } - /** `Standard` Creates a string type */ - String(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'String', type: 'string' }); - } - /** `Standard` Creates a tuple type */ - Tuple(items, options = {}) { - const additionalItems = false; - const minItems = items.length; - const maxItems = items.length; - const schema = (items.length > 0 ? { ...options, [exports.Kind]: 'Tuple', type: 'array', items, additionalItems, minItems, maxItems } : { ...options, [exports.Kind]: 'Tuple', type: 'array', minItems, maxItems }); - return this.Create(schema); - } - /** `Extended` Creates a undefined type */ - Undefined(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Undefined', type: 'null', typeOf: 'Undefined' }); - } - /** `Standard` Creates a union type */ - Union(items, options = {}) { - return items.length === 0 ? exports.Type.Never({ ...options }) : this.Create({ ...options, [exports.Kind]: 'Union', anyOf: items }); - } - /** `Extended` Creates a Uint8Array type */ - Uint8Array(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Uint8Array', type: 'object', instanceOf: 'Uint8Array' }); - } - /** `Standard` Creates an unknown type */ - Unknown(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Unknown' }); - } - /** `Standard` Creates a user defined schema that infers as type T */ - Unsafe(options = {}) { - return this.Create({ ...options, [exports.Kind]: options[exports.Kind] || 'Unsafe' }); - } - /** `Extended` Creates a void type */ - Void(options = {}) { - return this.Create({ ...options, [exports.Kind]: 'Void', type: 'null', typeOf: 'Void' }); - } - /** Use this function to return TSchema with static and params omitted */ - Create(schema) { - return schema; - } - /** Clones the given value */ - Clone(value) { - const isObject = (object) => typeof object === 'object' && object !== null && !Array.isArray(object); - const isArray = (object) => typeof object === 'object' && object !== null && Array.isArray(object); - if (isObject(value)) { - return Object.keys(value).reduce((acc, key) => ({ - ...acc, - [key]: this.Clone(value[key]), - }), Object.getOwnPropertySymbols(value).reduce((acc, key) => ({ - ...acc, - [key]: this.Clone(value[key]), - }), {})); - } - else if (isArray(value)) { - return value.map((item) => this.Clone(item)); - } - else { - return value; - } - } -} -exports.TypeBuilder = TypeBuilder; -/** JSON Schema Type Builder with Static Type Resolution for TypeScript */ -exports.Type = new TypeBuilder(); diff --git a/node_modules/@sinclair/typebox/value/cast.d.ts b/node_modules/@sinclair/typebox/value/cast.d.ts deleted file mode 100644 index 0ab8ef633..000000000 --- a/node_modules/@sinclair/typebox/value/cast.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import * as Types from '../typebox'; -export declare class ValueCastReferenceTypeError extends Error { - readonly schema: Types.TRef | Types.TSelf; - constructor(schema: Types.TRef | Types.TSelf); -} -export declare class ValueCastArrayUniqueItemsTypeError extends Error { - readonly schema: Types.TSchema; - readonly value: unknown; - constructor(schema: Types.TSchema, value: unknown); -} -export declare class ValueCastNeverTypeError extends Error { - readonly schema: Types.TSchema; - constructor(schema: Types.TSchema); -} -export declare class ValueCastRecursiveTypeError extends Error { - readonly schema: Types.TSchema; - constructor(schema: Types.TSchema); -} -export declare class ValueCastUnknownTypeError extends Error { - readonly schema: Types.TSchema; - constructor(schema: Types.TSchema); -} -export declare namespace ValueCast { - function Visit(schema: Types.TSchema, references: Types.TSchema[], value: any): any; - function Cast(schema: T, references: [...R], value: any): Types.Static; -} diff --git a/node_modules/@sinclair/typebox/value/cast.js b/node_modules/@sinclair/typebox/value/cast.js deleted file mode 100644 index 3650f43ad..000000000 --- a/node_modules/@sinclair/typebox/value/cast.js +++ /dev/null @@ -1,415 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueCast = exports.ValueCastUnknownTypeError = exports.ValueCastRecursiveTypeError = exports.ValueCastNeverTypeError = exports.ValueCastArrayUniqueItemsTypeError = exports.ValueCastReferenceTypeError = void 0; -const Types = require("../typebox"); -const create_1 = require("./create"); -const check_1 = require("./check"); -const clone_1 = require("./clone"); -const index_1 = require("../custom/index"); -// ---------------------------------------------------------------------------------------------- -// Errors -// ---------------------------------------------------------------------------------------------- -class ValueCastReferenceTypeError extends Error { - constructor(schema) { - super(`ValueCast: Cannot locate referenced schema with $id '${schema.$ref}'`); - this.schema = schema; - } -} -exports.ValueCastReferenceTypeError = ValueCastReferenceTypeError; -class ValueCastArrayUniqueItemsTypeError extends Error { - constructor(schema, value) { - super('ValueCast: Array cast produced invalid data due to uniqueItems constraint'); - this.schema = schema; - this.value = value; - } -} -exports.ValueCastArrayUniqueItemsTypeError = ValueCastArrayUniqueItemsTypeError; -class ValueCastNeverTypeError extends Error { - constructor(schema) { - super('ValueCast: Never types cannot be cast'); - this.schema = schema; - } -} -exports.ValueCastNeverTypeError = ValueCastNeverTypeError; -class ValueCastRecursiveTypeError extends Error { - constructor(schema) { - super('ValueCast.Recursive: Cannot cast recursive schemas'); - this.schema = schema; - } -} -exports.ValueCastRecursiveTypeError = ValueCastRecursiveTypeError; -class ValueCastUnknownTypeError extends Error { - constructor(schema) { - super('ValueCast: Unknown type'); - this.schema = schema; - } -} -exports.ValueCastUnknownTypeError = ValueCastUnknownTypeError; -// ---------------------------------------------------------------------------------------------- -// The following will score a schema against a value. For objects, the score is the tally of -// points awarded for each property of the value. Property points are (1.0 / propertyCount) -// to prevent large property counts biasing results. Properties that match literal values are -// maximally awarded as literals are typically used as union discriminator fields. -// ---------------------------------------------------------------------------------------------- -var UnionCastCreate; -(function (UnionCastCreate) { - function Score(schema, references, value) { - if (schema[Types.Kind] === 'Object' && typeof value === 'object' && value !== null) { - const object = schema; - const keys = Object.keys(value); - const entries = globalThis.Object.entries(object.properties); - const [point, max] = [1 / entries.length, entries.length]; - return entries.reduce((acc, [key, schema]) => { - const literal = schema[Types.Kind] === 'Literal' && schema.const === value[key] ? max : 0; - const checks = check_1.ValueCheck.Check(schema, references, value[key]) ? point : 0; - const exists = keys.includes(key) ? point : 0; - return acc + (literal + checks + exists); - }, 0); - } - else { - return check_1.ValueCheck.Check(schema, references, value) ? 1 : 0; - } - } - function Select(union, references, value) { - let [select, best] = [union.anyOf[0], 0]; - for (const schema of union.anyOf) { - const score = Score(schema, references, value); - if (score > best) { - select = schema; - best = score; - } - } - return select; - } - function Create(union, references, value) { - if (union.default !== undefined) { - return union.default; - } - else { - const schema = Select(union, references, value); - return ValueCast.Cast(schema, references, value); - } - } - UnionCastCreate.Create = Create; -})(UnionCastCreate || (UnionCastCreate = {})); -var ValueCast; -(function (ValueCast) { - // ---------------------------------------------------------------------------------------------- - // Guards - // ---------------------------------------------------------------------------------------------- - function IsArray(value) { - return typeof value === 'object' && globalThis.Array.isArray(value); - } - function IsDate(value) { - return typeof value === 'object' && value instanceof globalThis.Date; - } - function IsString(value) { - return typeof value === 'string'; - } - function IsBoolean(value) { - return typeof value === 'boolean'; - } - function IsBigInt(value) { - return typeof value === 'bigint'; - } - function IsNumber(value) { - return typeof value === 'number' && !isNaN(value); - } - function IsStringNumeric(value) { - return IsString(value) && !isNaN(value) && !isNaN(parseFloat(value)); - } - function IsValueToString(value) { - return IsBigInt(value) || IsBoolean(value) || IsNumber(value); - } - function IsValueTrue(value) { - return value === true || (IsNumber(value) && value === 1) || (IsBigInt(value) && value === globalThis.BigInt('1')) || (IsString(value) && (value.toLowerCase() === 'true' || value === '1')); - } - function IsValueFalse(value) { - return value === false || (IsNumber(value) && value === 0) || (IsBigInt(value) && value === globalThis.BigInt('0')) || (IsString(value) && (value.toLowerCase() === 'false' || value === '0')); - } - function IsTimeStringWithTimeZone(value) { - return IsString(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value); - } - function IsTimeStringWithoutTimeZone(value) { - return IsString(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value); - } - function IsDateTimeStringWithTimeZone(value) { - return IsString(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value); - } - function IsDateTimeStringWithoutTimeZone(value) { - return IsString(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value); - } - function IsDateString(value) { - return IsString(value) && /^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(value); - } - // ---------------------------------------------------------------------------------------------- - // Convert - // ---------------------------------------------------------------------------------------------- - function TryConvertString(value) { - return IsValueToString(value) ? value.toString() : value; - } - function TryConvertNumber(value) { - return IsStringNumeric(value) ? parseFloat(value) : IsValueTrue(value) ? 1 : value; - } - function TryConvertInteger(value) { - return IsStringNumeric(value) ? parseInt(value) : IsValueTrue(value) ? 1 : value; - } - function TryConvertBoolean(value) { - return IsValueTrue(value) ? true : IsValueFalse(value) ? false : value; - } - function TryConvertDate(value) { - // note: this function may return an invalid dates for the regex tests - // above. Invalid dates will however be checked during the casting - // function and will return a epoch date if invalid. Consider better - // string parsing for the iso dates in future revisions. - return IsDate(value) - ? value - : IsNumber(value) - ? new globalThis.Date(value) - : IsValueTrue(value) - ? new globalThis.Date(1) - : IsStringNumeric(value) - ? new globalThis.Date(parseInt(value)) - : IsTimeStringWithoutTimeZone(value) - ? new globalThis.Date(`1970-01-01T${value}.000Z`) - : IsTimeStringWithTimeZone(value) - ? new globalThis.Date(`1970-01-01T${value}`) - : IsDateTimeStringWithoutTimeZone(value) - ? new globalThis.Date(`${value}.000Z`) - : IsDateTimeStringWithTimeZone(value) - ? new globalThis.Date(value) - : IsDateString(value) - ? new globalThis.Date(`${value}T00:00:00.000Z`) - : value; - } - // ---------------------------------------------------------------------------------------------- - // Cast - // ---------------------------------------------------------------------------------------------- - function Any(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references); - } - function Array(schema, references, value) { - if (check_1.ValueCheck.Check(schema, references, value)) - return clone_1.ValueClone.Clone(value); - const created = IsArray(value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references); - const minimum = IsNumber(schema.minItems) && created.length < schema.minItems ? [...created, ...globalThis.Array.from({ length: schema.minItems - created.length }, () => null)] : created; - const maximum = IsNumber(schema.maxItems) && minimum.length > schema.maxItems ? minimum.slice(0, schema.maxItems) : minimum; - const casted = maximum.map((value) => Visit(schema.items, references, value)); - if (schema.uniqueItems !== true) - return casted; - const unique = [...new Set(casted)]; - if (!check_1.ValueCheck.Check(schema, references, unique)) - throw new ValueCastArrayUniqueItemsTypeError(schema, unique); - return unique; - } - function Boolean(schema, references, value) { - const conversion = TryConvertBoolean(value); - return check_1.ValueCheck.Check(schema, references, conversion) ? conversion : create_1.ValueCreate.Create(schema, references); - } - function Constructor(schema, references, value) { - if (check_1.ValueCheck.Check(schema, references, value)) - return create_1.ValueCreate.Create(schema, references); - const required = new Set(schema.returns.required || []); - const result = function () { }; - for (const [key, property] of globalThis.Object.entries(schema.returns.properties)) { - if (!required.has(key) && value.prototype[key] === undefined) - continue; - result.prototype[key] = Visit(property, references, value.prototype[key]); - } - return result; - } - function Date(schema, references, value) { - const conversion = TryConvertDate(value); - return check_1.ValueCheck.Check(schema, references, conversion) ? clone_1.ValueClone.Clone(conversion) : create_1.ValueCreate.Create(schema, references); - } - function Function(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references); - } - function Integer(schema, references, value) { - const conversion = TryConvertInteger(value); - return check_1.ValueCheck.Check(schema, references, conversion) ? conversion : create_1.ValueCreate.Create(schema, references); - } - function Literal(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references); - } - function Never(schema, references, value) { - throw new ValueCastNeverTypeError(schema); - } - function Null(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references); - } - function Number(schema, references, value) { - const conversion = TryConvertNumber(value); - return check_1.ValueCheck.Check(schema, references, conversion) ? conversion : create_1.ValueCreate.Create(schema, references); - } - function Object(schema, references, value) { - if (check_1.ValueCheck.Check(schema, references, value)) - return clone_1.ValueClone.Clone(value); - if (value === null || typeof value !== 'object') - return create_1.ValueCreate.Create(schema, references); - const required = new Set(schema.required || []); - const result = {}; - for (const [key, property] of globalThis.Object.entries(schema.properties)) { - if (!required.has(key) && value[key] === undefined) - continue; - result[key] = Visit(property, references, value[key]); - } - // additional schema properties - if (typeof schema.additionalProperties === 'object') { - const propertyNames = globalThis.Object.getOwnPropertyNames(schema.properties); - for (const propertyName of globalThis.Object.getOwnPropertyNames(value)) { - if (propertyNames.includes(propertyName)) - continue; - result[propertyName] = Visit(schema.additionalProperties, references, value[propertyName]); - } - } - return result; - } - function Promise(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? value : create_1.ValueCreate.Create(schema, references); - } - function Record(schema, references, value) { - if (check_1.ValueCheck.Check(schema, references, value)) - return clone_1.ValueClone.Clone(value); - if (value === null || typeof value !== 'object' || globalThis.Array.isArray(value) || value instanceof globalThis.Date) - return create_1.ValueCreate.Create(schema, references); - const subschemaPropertyName = globalThis.Object.getOwnPropertyNames(schema.patternProperties)[0]; - const subschema = schema.patternProperties[subschemaPropertyName]; - const result = {}; - for (const [propKey, propValue] of globalThis.Object.entries(value)) { - result[propKey] = Visit(subschema, references, propValue); - } - return result; - } - function Ref(schema, references, value) { - const reference = references.find((reference) => reference.$id === schema.$ref); - if (reference === undefined) - throw new ValueCastReferenceTypeError(schema); - return Visit(reference, references, value); - } - function Self(schema, references, value) { - const reference = references.find((reference) => reference.$id === schema.$ref); - if (reference === undefined) - throw new ValueCastReferenceTypeError(schema); - return Visit(reference, references, value); - } - function String(schema, references, value) { - const conversion = TryConvertString(value); - return check_1.ValueCheck.Check(schema, references, conversion) ? conversion : create_1.ValueCreate.Create(schema, references); - } - function Tuple(schema, references, value) { - if (check_1.ValueCheck.Check(schema, references, value)) - return clone_1.ValueClone.Clone(value); - if (!globalThis.Array.isArray(value)) - return create_1.ValueCreate.Create(schema, references); - if (schema.items === undefined) - return []; - return schema.items.map((schema, index) => Visit(schema, references, value[index])); - } - function Undefined(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references); - } - function Union(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : UnionCastCreate.Create(schema, references, value); - } - function Uint8Array(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references); - } - function Unknown(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references); - } - function Void(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references); - } - function UserDefined(schema, references, value) { - return check_1.ValueCheck.Check(schema, references, value) ? clone_1.ValueClone.Clone(value) : create_1.ValueCreate.Create(schema, references); - } - function Visit(schema, references, value) { - const anyReferences = schema.$id === undefined ? references : [schema, ...references]; - const anySchema = schema; - switch (schema[Types.Kind]) { - case 'Any': - return Any(anySchema, anyReferences, value); - case 'Array': - return Array(anySchema, anyReferences, value); - case 'Boolean': - return Boolean(anySchema, anyReferences, value); - case 'Constructor': - return Constructor(anySchema, anyReferences, value); - case 'Date': - return Date(anySchema, anyReferences, value); - case 'Function': - return Function(anySchema, anyReferences, value); - case 'Integer': - return Integer(anySchema, anyReferences, value); - case 'Literal': - return Literal(anySchema, anyReferences, value); - case 'Never': - return Never(anySchema, anyReferences, value); - case 'Null': - return Null(anySchema, anyReferences, value); - case 'Number': - return Number(anySchema, anyReferences, value); - case 'Object': - return Object(anySchema, anyReferences, value); - case 'Promise': - return Promise(anySchema, anyReferences, value); - case 'Record': - return Record(anySchema, anyReferences, value); - case 'Ref': - return Ref(anySchema, anyReferences, value); - case 'Self': - return Self(anySchema, anyReferences, value); - case 'String': - return String(anySchema, anyReferences, value); - case 'Tuple': - return Tuple(anySchema, anyReferences, value); - case 'Undefined': - return Undefined(anySchema, anyReferences, value); - case 'Union': - return Union(anySchema, anyReferences, value); - case 'Uint8Array': - return Uint8Array(anySchema, anyReferences, value); - case 'Unknown': - return Unknown(anySchema, anyReferences, value); - case 'Void': - return Void(anySchema, anyReferences, value); - default: - if (!index_1.Custom.Has(anySchema[Types.Kind])) - throw new ValueCastUnknownTypeError(anySchema); - return UserDefined(anySchema, anyReferences, value); - } - } - ValueCast.Visit = Visit; - function Cast(schema, references, value) { - return schema.$id === undefined ? Visit(schema, references, value) : Visit(schema, [schema, ...references], value); - } - ValueCast.Cast = Cast; -})(ValueCast = exports.ValueCast || (exports.ValueCast = {})); diff --git a/node_modules/@sinclair/typebox/value/check.d.ts b/node_modules/@sinclair/typebox/value/check.d.ts deleted file mode 100644 index b1f774299..000000000 --- a/node_modules/@sinclair/typebox/value/check.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as Types from '../typebox'; -export declare class ValueCheckUnknownTypeError extends Error { - readonly schema: Types.TSchema; - constructor(schema: Types.TSchema); -} -export declare namespace ValueCheck { - function Check(schema: T, references: [...R], value: any): boolean; -} diff --git a/node_modules/@sinclair/typebox/value/check.js b/node_modules/@sinclair/typebox/value/check.js deleted file mode 100644 index 6deb2b135..000000000 --- a/node_modules/@sinclair/typebox/value/check.js +++ /dev/null @@ -1,405 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueCheck = exports.ValueCheckUnknownTypeError = void 0; -const Types = require("../typebox"); -const index_1 = require("../system/index"); -const extends_1 = require("../guard/extends"); -const index_2 = require("../format/index"); -const index_3 = require("../custom/index"); -const index_4 = require("../hash/index"); -class ValueCheckUnknownTypeError extends Error { - constructor(schema) { - super(`ValueCheck: ${schema[Types.Kind] ? `Unknown type '${schema[Types.Kind]}'` : 'Unknown type'}`); - this.schema = schema; - } -} -exports.ValueCheckUnknownTypeError = ValueCheckUnknownTypeError; -var ValueCheck; -(function (ValueCheck) { - // -------------------------------------------------------- - // Guards - // -------------------------------------------------------- - function IsNumber(value) { - return typeof value === 'number' && !isNaN(value); - } - // -------------------------------------------------------- - // Guards - // -------------------------------------------------------- - function Any(schema, references, value) { - return true; - } - function Array(schema, references, value) { - if (!globalThis.Array.isArray(value)) { - return false; - } - if (IsNumber(schema.minItems) && !(value.length >= schema.minItems)) { - return false; - } - if (IsNumber(schema.maxItems) && !(value.length <= schema.maxItems)) { - return false; - } - // prettier-ignore - if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) { - const hashed = index_4.ValueHash.Create(element); - if (set.has(hashed)) { - return false; - } - else { - set.add(hashed); - } - } return true; })())) { - return false; - } - return value.every((val) => Visit(schema.items, references, val)); - } - function Boolean(schema, references, value) { - return typeof value === 'boolean'; - } - function Constructor(schema, references, value) { - return Visit(schema.returns, references, value.prototype); - } - function Date(schema, references, value) { - if (!(value instanceof globalThis.Date)) { - return false; - } - if (isNaN(value.getTime())) { - return false; - } - if (IsNumber(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) { - return false; - } - if (IsNumber(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) { - return false; - } - if (IsNumber(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) { - return false; - } - if (IsNumber(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) { - return false; - } - return true; - } - function Function(schema, references, value) { - return typeof value === 'function'; - } - function Integer(schema, references, value) { - if (!(typeof value === 'number' && globalThis.Number.isInteger(value))) { - return false; - } - if (IsNumber(schema.multipleOf) && !(value % schema.multipleOf === 0)) { - return false; - } - if (IsNumber(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { - return false; - } - if (IsNumber(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { - return false; - } - if (IsNumber(schema.minimum) && !(value >= schema.minimum)) { - return false; - } - if (IsNumber(schema.maximum) && !(value <= schema.maximum)) { - return false; - } - return true; - } - function Literal(schema, references, value) { - return value === schema.const; - } - function Never(schema, references, value) { - return false; - } - function Null(schema, references, value) { - return value === null; - } - function Number(schema, references, value) { - if (index_1.TypeSystem.AllowNaN) { - if (!(typeof value === 'number')) { - return false; - } - } - else { - if (!(typeof value === 'number' && !isNaN(value))) { - return false; - } - } - if (IsNumber(schema.multipleOf) && !(value % schema.multipleOf === 0)) { - return false; - } - if (IsNumber(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { - return false; - } - if (IsNumber(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { - return false; - } - if (IsNumber(schema.minimum) && !(value >= schema.minimum)) { - return false; - } - if (IsNumber(schema.maximum) && !(value <= schema.maximum)) { - return false; - } - return true; - } - function Object(schema, references, value) { - if (index_1.TypeSystem.AllowArrayObjects) { - if (!(typeof value === 'object' && value !== null)) { - return false; - } - } - else { - if (!(typeof value === 'object' && value !== null && !globalThis.Array.isArray(value))) { - return false; - } - } - if (IsNumber(schema.minProperties) && !(globalThis.Object.getOwnPropertyNames(value).length >= schema.minProperties)) { - return false; - } - if (IsNumber(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { - return false; - } - const propertyKeys = globalThis.Object.getOwnPropertyNames(schema.properties); - if (schema.additionalProperties === false) { - // optimization: If the property key length matches the required keys length - // then we only need check that the values property key length matches that - // of the property key length. This is because exhaustive testing for values - // will occur in subsequent property tests. - if (schema.required && schema.required.length === propertyKeys.length && !(globalThis.Object.getOwnPropertyNames(value).length === propertyKeys.length)) { - return false; - } - else { - if (!globalThis.Object.getOwnPropertyNames(value).every((key) => propertyKeys.includes(key))) { - return false; - } - } - } - if (typeof schema.additionalProperties === 'object') { - for (const objectKey of globalThis.Object.getOwnPropertyNames(value)) { - if (propertyKeys.includes(objectKey)) - continue; - if (!Visit(schema.additionalProperties, references, value[objectKey])) { - return false; - } - } - } - for (const propertyKey of propertyKeys) { - const propertySchema = schema.properties[propertyKey]; - if (schema.required && schema.required.includes(propertyKey)) { - if (!Visit(propertySchema, references, value[propertyKey])) { - return false; - } - if (extends_1.TypeExtends.Undefined(propertySchema)) { - return propertyKey in value; - } - } - else { - if (value[propertyKey] !== undefined) { - if (!Visit(propertySchema, references, value[propertyKey])) { - return false; - } - } - } - } - return true; - } - function Promise(schema, references, value) { - return typeof value === 'object' && typeof value.then === 'function'; - } - function Record(schema, references, value) { - if (index_1.TypeSystem.AllowArrayObjects) { - if (!(typeof value === 'object' && value !== null && !(value instanceof globalThis.Date))) { - return false; - } - } - else { - if (!(typeof value === 'object' && value !== null && !(value instanceof globalThis.Date) && !globalThis.Array.isArray(value))) { - return false; - } - } - const [keyPattern, valueSchema] = globalThis.Object.entries(schema.patternProperties)[0]; - const regex = new RegExp(keyPattern); - if (!globalThis.Object.getOwnPropertyNames(value).every((key) => regex.test(key))) { - return false; - } - for (const propValue of globalThis.Object.values(value)) { - if (!Visit(valueSchema, references, propValue)) - return false; - } - return true; - } - function Ref(schema, references, value) { - const reference = references.find((reference) => reference.$id === schema.$ref); - if (reference === undefined) - throw new Error(`ValueCheck.Ref: Cannot find schema with $id '${schema.$ref}'.`); - return Visit(reference, references, value); - } - function Self(schema, references, value) { - const reference = references.find((reference) => reference.$id === schema.$ref); - if (reference === undefined) - throw new Error(`ValueCheck.Self: Cannot find schema with $id '${schema.$ref}'.`); - return Visit(reference, references, value); - } - function String(schema, references, value) { - if (!(typeof value === 'string')) { - return false; - } - if (IsNumber(schema.minLength)) { - if (!(value.length >= schema.minLength)) - return false; - } - if (IsNumber(schema.maxLength)) { - if (!(value.length <= schema.maxLength)) - return false; - } - if (schema.pattern !== undefined) { - const regex = new RegExp(schema.pattern); - if (!regex.test(value)) - return false; - } - if (schema.format !== undefined) { - if (!index_2.Format.Has(schema.format)) - return false; - const func = index_2.Format.Get(schema.format); - return func(value); - } - return true; - } - function Tuple(schema, references, value) { - if (!globalThis.Array.isArray(value)) { - return false; - } - if (schema.items === undefined && !(value.length === 0)) { - return false; - } - if (!(value.length === schema.maxItems)) { - return false; - } - if (!schema.items) { - return true; - } - for (let i = 0; i < schema.items.length; i++) { - if (!Visit(schema.items[i], references, value[i])) - return false; - } - return true; - } - function Undefined(schema, references, value) { - return value === undefined; - } - function Union(schema, references, value) { - return schema.anyOf.some((inner) => Visit(inner, references, value)); - } - function Uint8Array(schema, references, value) { - if (!(value instanceof globalThis.Uint8Array)) { - return false; - } - if (IsNumber(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) { - return false; - } - if (IsNumber(schema.minByteLength) && !(value.length >= schema.minByteLength)) { - return false; - } - return true; - } - function Unknown(schema, references, value) { - return true; - } - function Void(schema, references, value) { - return value === null; - } - function UserDefined(schema, references, value) { - if (!index_3.Custom.Has(schema[Types.Kind])) - return false; - const func = index_3.Custom.Get(schema[Types.Kind]); - return func(schema, value); - } - function Visit(schema, references, value) { - const anyReferences = schema.$id === undefined ? references : [schema, ...references]; - const anySchema = schema; - switch (anySchema[Types.Kind]) { - case 'Any': - return Any(anySchema, anyReferences, value); - case 'Array': - return Array(anySchema, anyReferences, value); - case 'Boolean': - return Boolean(anySchema, anyReferences, value); - case 'Constructor': - return Constructor(anySchema, anyReferences, value); - case 'Date': - return Date(anySchema, anyReferences, value); - case 'Function': - return Function(anySchema, anyReferences, value); - case 'Integer': - return Integer(anySchema, anyReferences, value); - case 'Literal': - return Literal(anySchema, anyReferences, value); - case 'Never': - return Never(anySchema, anyReferences, value); - case 'Null': - return Null(anySchema, anyReferences, value); - case 'Number': - return Number(anySchema, anyReferences, value); - case 'Object': - return Object(anySchema, anyReferences, value); - case 'Promise': - return Promise(anySchema, anyReferences, value); - case 'Record': - return Record(anySchema, anyReferences, value); - case 'Ref': - return Ref(anySchema, anyReferences, value); - case 'Self': - return Self(anySchema, anyReferences, value); - case 'String': - return String(anySchema, anyReferences, value); - case 'Tuple': - return Tuple(anySchema, anyReferences, value); - case 'Undefined': - return Undefined(anySchema, anyReferences, value); - case 'Union': - return Union(anySchema, anyReferences, value); - case 'Uint8Array': - return Uint8Array(anySchema, anyReferences, value); - case 'Unknown': - return Unknown(anySchema, anyReferences, value); - case 'Void': - return Void(anySchema, anyReferences, value); - default: - if (!index_3.Custom.Has(anySchema[Types.Kind])) - throw new ValueCheckUnknownTypeError(anySchema); - return UserDefined(anySchema, anyReferences, value); - } - } - // ------------------------------------------------------------------------- - // Check - // ------------------------------------------------------------------------- - function Check(schema, references, value) { - return schema.$id === undefined ? Visit(schema, references, value) : Visit(schema, [schema, ...references], value); - } - ValueCheck.Check = Check; -})(ValueCheck = exports.ValueCheck || (exports.ValueCheck = {})); diff --git a/node_modules/@sinclair/typebox/value/clone.d.ts b/node_modules/@sinclair/typebox/value/clone.d.ts deleted file mode 100644 index 5ca0adf13..000000000 --- a/node_modules/@sinclair/typebox/value/clone.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare namespace ValueClone { - function Clone(value: T): T; -} diff --git a/node_modules/@sinclair/typebox/value/clone.js b/node_modules/@sinclair/typebox/value/clone.js deleted file mode 100644 index 75e2685cd..000000000 --- a/node_modules/@sinclair/typebox/value/clone.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueClone = void 0; -const is_1 = require("./is"); -var ValueClone; -(function (ValueClone) { - function Array(value) { - return value.map((element) => Clone(element)); - } - function Date(value) { - return new globalThis.Date(value.toISOString()); - } - function Object(value) { - const keys = [...globalThis.Object.keys(value), ...globalThis.Object.getOwnPropertySymbols(value)]; - return keys.reduce((acc, key) => ({ ...acc, [key]: Clone(value[key]) }), {}); - } - function TypedArray(value) { - return value.slice(); - } - function Value(value) { - return value; - } - function Clone(value) { - if (is_1.Is.Date(value)) { - return Date(value); - } - else if (is_1.Is.Object(value)) { - return Object(value); - } - else if (is_1.Is.Array(value)) { - return Array(value); - } - else if (is_1.Is.TypedArray(value)) { - return TypedArray(value); - } - else if (is_1.Is.Value(value)) { - return Value(value); - } - else { - throw new Error('ValueClone: Unable to clone value'); - } - } - ValueClone.Clone = Clone; -})(ValueClone = exports.ValueClone || (exports.ValueClone = {})); diff --git a/node_modules/@sinclair/typebox/value/create.d.ts b/node_modules/@sinclair/typebox/value/create.d.ts deleted file mode 100644 index 9ac787898..000000000 --- a/node_modules/@sinclair/typebox/value/create.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as Types from '../typebox'; -export declare class ValueCreateUnknownTypeError extends Error { - readonly schema: Types.TSchema; - constructor(schema: Types.TSchema); -} -export declare class ValueCreateNeverTypeError extends Error { - readonly schema: Types.TSchema; - constructor(schema: Types.TSchema); -} -export declare namespace ValueCreate { - /** Creates a value from the given schema. If the schema specifies a default value, then that value is returned. */ - function Visit(schema: T, references: Types.TSchema[]): Types.Static; - function Create(schema: T, references: [...R]): Types.Static; -} diff --git a/node_modules/@sinclair/typebox/value/create.js b/node_modules/@sinclair/typebox/value/create.js deleted file mode 100644 index 324c1bf01..000000000 --- a/node_modules/@sinclair/typebox/value/create.js +++ /dev/null @@ -1,378 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueCreate = exports.ValueCreateNeverTypeError = exports.ValueCreateUnknownTypeError = void 0; -const Types = require("../typebox"); -const index_1 = require("../custom/index"); -class ValueCreateUnknownTypeError extends Error { - constructor(schema) { - super('ValueCreate: Unknown type'); - this.schema = schema; - } -} -exports.ValueCreateUnknownTypeError = ValueCreateUnknownTypeError; -class ValueCreateNeverTypeError extends Error { - constructor(schema) { - super('ValueCreate: Never types cannot be created'); - this.schema = schema; - } -} -exports.ValueCreateNeverTypeError = ValueCreateNeverTypeError; -var ValueCreate; -(function (ValueCreate) { - function Any(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - return {}; - } - } - function Array(schema, references) { - if (schema.uniqueItems === true && schema.default === undefined) { - throw new Error('ValueCreate.Array: Arrays with uniqueItems require a default value'); - } - else if (schema.default !== undefined) { - return schema.default; - } - else if (schema.minItems !== undefined) { - return globalThis.Array.from({ length: schema.minItems }).map((item) => { - return ValueCreate.Create(schema.items, references); - }); - } - else { - return []; - } - } - function Boolean(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - return false; - } - } - function Constructor(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - const value = ValueCreate.Create(schema.returns, references); - if (typeof value === 'object' && !globalThis.Array.isArray(value)) { - return class { - constructor() { - for (const [key, val] of globalThis.Object.entries(value)) { - const self = this; - self[key] = val; - } - } - }; - } - else { - return class { - }; - } - } - } - function Date(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else if (schema.minimumTimestamp !== undefined) { - return new globalThis.Date(schema.minimumTimestamp); - } - else { - return new globalThis.Date(0); - } - } - function Function(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - return () => ValueCreate.Create(schema.returns, references); - } - } - function Integer(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else if (schema.minimum !== undefined) { - return schema.minimum; - } - else { - return 0; - } - } - function Literal(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - return schema.const; - } - } - function Never(schema, references) { - throw new ValueCreateNeverTypeError(schema); - } - function Null(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - return null; - } - } - function Number(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else if (schema.minimum !== undefined) { - return schema.minimum; - } - else { - return 0; - } - } - function Object(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - const required = new Set(schema.required); - return (schema.default || - globalThis.Object.entries(schema.properties).reduce((acc, [key, schema]) => { - return required.has(key) ? { ...acc, [key]: ValueCreate.Create(schema, references) } : { ...acc }; - }, {})); - } - } - function Promise(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - return globalThis.Promise.resolve(ValueCreate.Create(schema.item, references)); - } - } - function Record(schema, references) { - const [keyPattern, valueSchema] = globalThis.Object.entries(schema.patternProperties)[0]; - if (schema.default !== undefined) { - return schema.default; - } - else if (!(keyPattern === '^.*$' || keyPattern === '^(0|[1-9][0-9]*)$')) { - const propertyKeys = keyPattern.slice(1, keyPattern.length - 1).split('|'); - return propertyKeys.reduce((acc, key) => { - return { ...acc, [key]: Create(valueSchema, references) }; - }, {}); - } - else { - return {}; - } - } - function Ref(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - const reference = references.find((reference) => reference.$id === schema.$ref); - if (reference === undefined) - throw new Error(`ValueCreate.Ref: Cannot find schema with $id '${schema.$ref}'.`); - return Visit(reference, references); - } - } - function Self(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - const reference = references.find((reference) => reference.$id === schema.$ref); - if (reference === undefined) - throw new Error(`ValueCreate.Self: Cannot locate schema with $id '${schema.$ref}'`); - return Visit(reference, references); - } - } - function String(schema, references) { - if (schema.pattern !== undefined) { - if (schema.default === undefined) { - throw new Error('ValueCreate.String: String types with patterns must specify a default value'); - } - else { - return schema.default; - } - } - else if (schema.format !== undefined) { - if (schema.default === undefined) { - throw new Error('ValueCreate.String: String types with formats must specify a default value'); - } - else { - return schema.default; - } - } - else { - if (schema.default !== undefined) { - return schema.default; - } - else if (schema.minLength !== undefined) { - return globalThis.Array.from({ length: schema.minLength }) - .map(() => '.') - .join(''); - } - else { - return ''; - } - } - } - function Tuple(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - if (schema.items === undefined) { - return []; - } - else { - return globalThis.Array.from({ length: schema.minItems }).map((_, index) => ValueCreate.Create(schema.items[index], references)); - } - } - function Undefined(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - return undefined; - } - } - function Union(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else if (schema.anyOf.length === 0) { - throw new Error('ValueCreate.Union: Cannot create Union with zero variants'); - } - else { - return ValueCreate.Create(schema.anyOf[0], references); - } - } - function Uint8Array(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else if (schema.minByteLength !== undefined) { - return new globalThis.Uint8Array(schema.minByteLength); - } - else { - return new globalThis.Uint8Array(0); - } - } - function Unknown(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - return {}; - } - } - function Void(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - return null; - } - } - function UserDefined(schema, references) { - if (schema.default !== undefined) { - return schema.default; - } - else { - throw new Error('ValueCreate.UserDefined: User defined types must specify a default value'); - } - } - /** Creates a value from the given schema. If the schema specifies a default value, then that value is returned. */ - function Visit(schema, references) { - const anyReferences = schema.$id === undefined ? references : [schema, ...references]; - const anySchema = schema; - switch (anySchema[Types.Kind]) { - case 'Any': - return Any(anySchema, anyReferences); - case 'Array': - return Array(anySchema, anyReferences); - case 'Boolean': - return Boolean(anySchema, anyReferences); - case 'Constructor': - return Constructor(anySchema, anyReferences); - case 'Date': - return Date(anySchema, anyReferences); - case 'Function': - return Function(anySchema, anyReferences); - case 'Integer': - return Integer(anySchema, anyReferences); - case 'Literal': - return Literal(anySchema, anyReferences); - case 'Never': - return Never(anySchema, anyReferences); - case 'Null': - return Null(anySchema, anyReferences); - case 'Number': - return Number(anySchema, anyReferences); - case 'Object': - return Object(anySchema, anyReferences); - case 'Promise': - return Promise(anySchema, anyReferences); - case 'Record': - return Record(anySchema, anyReferences); - case 'Ref': - return Ref(anySchema, anyReferences); - case 'Self': - return Self(anySchema, anyReferences); - case 'String': - return String(anySchema, anyReferences); - case 'Tuple': - return Tuple(anySchema, anyReferences); - case 'Undefined': - return Undefined(anySchema, anyReferences); - case 'Union': - return Union(anySchema, anyReferences); - case 'Uint8Array': - return Uint8Array(anySchema, anyReferences); - case 'Unknown': - return Unknown(anySchema, anyReferences); - case 'Void': - return Void(anySchema, anyReferences); - default: - if (!index_1.Custom.Has(anySchema[Types.Kind])) - throw new ValueCreateUnknownTypeError(anySchema); - return UserDefined(anySchema, anyReferences); - } - } - ValueCreate.Visit = Visit; - function Create(schema, references) { - return Visit(schema, references); - } - ValueCreate.Create = Create; -})(ValueCreate = exports.ValueCreate || (exports.ValueCreate = {})); diff --git a/node_modules/@sinclair/typebox/value/delta.d.ts b/node_modules/@sinclair/typebox/value/delta.d.ts deleted file mode 100644 index 3320fac79..000000000 --- a/node_modules/@sinclair/typebox/value/delta.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Static } from '../typebox'; -export type Insert = Static; -export declare const Insert: import("../typebox").TObject<{ - type: import("../typebox").TLiteral<"insert">; - path: import("../typebox").TString; - value: import("../typebox").TUnknown; -}>; -export type Update = Static; -export declare const Update: import("../typebox").TObject<{ - type: import("../typebox").TLiteral<"update">; - path: import("../typebox").TString; - value: import("../typebox").TUnknown; -}>; -export type Delete = Static; -export declare const Delete: import("../typebox").TObject<{ - type: import("../typebox").TLiteral<"delete">; - path: import("../typebox").TString; -}>; -export type Edit = Static; -export declare const Edit: import("../typebox").TUnion<[import("../typebox").TObject<{ - type: import("../typebox").TLiteral<"insert">; - path: import("../typebox").TString; - value: import("../typebox").TUnknown; -}>, import("../typebox").TObject<{ - type: import("../typebox").TLiteral<"update">; - path: import("../typebox").TString; - value: import("../typebox").TUnknown; -}>, import("../typebox").TObject<{ - type: import("../typebox").TLiteral<"delete">; - path: import("../typebox").TString; -}>]>; -export declare class ValueDeltaObjectWithSymbolKeyError extends Error { - readonly key: unknown; - constructor(key: unknown); -} -export declare class ValueDeltaUnableToDiffUnknownValue extends Error { - readonly value: unknown; - constructor(value: unknown); -} -export declare namespace ValueDelta { - function Diff(current: unknown, next: unknown): Edit[]; - function Patch(current: unknown, edits: Edit[]): T; -} diff --git a/node_modules/@sinclair/typebox/value/delta.js b/node_modules/@sinclair/typebox/value/delta.js deleted file mode 100644 index 89c06a0d8..000000000 --- a/node_modules/@sinclair/typebox/value/delta.js +++ /dev/null @@ -1,204 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueDelta = exports.ValueDeltaUnableToDiffUnknownValue = exports.ValueDeltaObjectWithSymbolKeyError = exports.Edit = exports.Delete = exports.Update = exports.Insert = void 0; -const typebox_1 = require("../typebox"); -const is_1 = require("./is"); -const clone_1 = require("./clone"); -const pointer_1 = require("./pointer"); -exports.Insert = typebox_1.Type.Object({ - type: typebox_1.Type.Literal('insert'), - path: typebox_1.Type.String(), - value: typebox_1.Type.Unknown(), -}); -exports.Update = typebox_1.Type.Object({ - type: typebox_1.Type.Literal('update'), - path: typebox_1.Type.String(), - value: typebox_1.Type.Unknown(), -}); -exports.Delete = typebox_1.Type.Object({ - type: typebox_1.Type.Literal('delete'), - path: typebox_1.Type.String(), -}); -exports.Edit = typebox_1.Type.Union([exports.Insert, exports.Update, exports.Delete]); -// --------------------------------------------------------------------- -// Errors -// --------------------------------------------------------------------- -class ValueDeltaObjectWithSymbolKeyError extends Error { - constructor(key) { - super('ValueDelta: Cannot diff objects with symbol keys'); - this.key = key; - } -} -exports.ValueDeltaObjectWithSymbolKeyError = ValueDeltaObjectWithSymbolKeyError; -class ValueDeltaUnableToDiffUnknownValue extends Error { - constructor(value) { - super('ValueDelta: Unable to create diff edits for unknown value'); - this.value = value; - } -} -exports.ValueDeltaUnableToDiffUnknownValue = ValueDeltaUnableToDiffUnknownValue; -// --------------------------------------------------------------------- -// ValueDelta -// --------------------------------------------------------------------- -var ValueDelta; -(function (ValueDelta) { - // --------------------------------------------------------------------- - // Edits - // --------------------------------------------------------------------- - function Update(path, value) { - return { type: 'update', path, value }; - } - function Insert(path, value) { - return { type: 'insert', path, value }; - } - function Delete(path) { - return { type: 'delete', path }; - } - // --------------------------------------------------------------------- - // Diff - // --------------------------------------------------------------------- - function* Object(path, current, next) { - if (!is_1.Is.Object(next)) - return yield Update(path, next); - const currentKeys = [...globalThis.Object.keys(current), ...globalThis.Object.getOwnPropertySymbols(current)]; - const nextKeys = [...globalThis.Object.keys(next), ...globalThis.Object.getOwnPropertySymbols(next)]; - for (const key of currentKeys) { - if (typeof key === 'symbol') - throw new ValueDeltaObjectWithSymbolKeyError(key); - if (next[key] === undefined && nextKeys.includes(key)) - yield Update(`${path}/${String(key)}`, undefined); - } - for (const key of nextKeys) { - if (current[key] === undefined || next[key] === undefined) - continue; - if (typeof key === 'symbol') - throw new ValueDeltaObjectWithSymbolKeyError(key); - yield* Visit(`${path}/${String(key)}`, current[key], next[key]); - } - for (const key of nextKeys) { - if (typeof key === 'symbol') - throw new ValueDeltaObjectWithSymbolKeyError(key); - if (current[key] === undefined) - yield Insert(`${path}/${String(key)}`, next[key]); - } - for (const key of currentKeys.reverse()) { - if (typeof key === 'symbol') - throw new ValueDeltaObjectWithSymbolKeyError(key); - if (next[key] === undefined && !nextKeys.includes(key)) - yield Delete(`${path}/${String(key)}`); - } - } - function* Array(path, current, next) { - if (!is_1.Is.Array(next)) - return yield Update(path, next); - for (let i = 0; i < Math.min(current.length, next.length); i++) { - yield* Visit(`${path}/${i}`, current[i], next[i]); - } - for (let i = 0; i < next.length; i++) { - if (i < current.length) - continue; - yield Insert(`${path}/${i}`, next[i]); - } - for (let i = current.length - 1; i >= 0; i--) { - if (i < next.length) - continue; - yield Delete(`${path}/${i}`); - } - } - function* TypedArray(path, current, next) { - if (!is_1.Is.TypedArray(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name) - return yield Update(path, next); - for (let i = 0; i < Math.min(current.length, next.length); i++) { - yield* Visit(`${path}/${i}`, current[i], next[i]); - } - } - function* Value(path, current, next) { - if (current === next) - return; - yield Update(path, next); - } - function* Visit(path, current, next) { - if (is_1.Is.Object(current)) { - return yield* Object(path, current, next); - } - else if (is_1.Is.Array(current)) { - return yield* Array(path, current, next); - } - else if (is_1.Is.TypedArray(current)) { - return yield* TypedArray(path, current, next); - } - else if (is_1.Is.Value(current)) { - return yield* Value(path, current, next); - } - else { - throw new ValueDeltaUnableToDiffUnknownValue(current); - } - } - function Diff(current, next) { - return [...Visit('', current, next)]; - } - ValueDelta.Diff = Diff; - // --------------------------------------------------------------------- - // Patch - // --------------------------------------------------------------------- - function IsRootUpdate(edits) { - return edits.length > 0 && edits[0].path === '' && edits[0].type === 'update'; - } - function IsIdentity(edits) { - return edits.length === 0; - } - function Patch(current, edits) { - if (IsRootUpdate(edits)) { - return clone_1.ValueClone.Clone(edits[0].value); - } - if (IsIdentity(edits)) { - return clone_1.ValueClone.Clone(current); - } - const clone = clone_1.ValueClone.Clone(current); - for (const edit of edits) { - switch (edit.type) { - case 'insert': { - pointer_1.ValuePointer.Set(clone, edit.path, edit.value); - break; - } - case 'update': { - pointer_1.ValuePointer.Set(clone, edit.path, edit.value); - break; - } - case 'delete': { - pointer_1.ValuePointer.Delete(clone, edit.path); - break; - } - } - } - return clone; - } - ValueDelta.Patch = Patch; -})(ValueDelta = exports.ValueDelta || (exports.ValueDelta = {})); diff --git a/node_modules/@sinclair/typebox/value/equal.d.ts b/node_modules/@sinclair/typebox/value/equal.d.ts deleted file mode 100644 index 785c2b8de..000000000 --- a/node_modules/@sinclair/typebox/value/equal.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare namespace ValueEqual { - function Equal(left: T, right: unknown): right is T; -} diff --git a/node_modules/@sinclair/typebox/value/equal.js b/node_modules/@sinclair/typebox/value/equal.js deleted file mode 100644 index ed9773b56..000000000 --- a/node_modules/@sinclair/typebox/value/equal.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueEqual = void 0; -const is_1 = require("./is"); -var ValueEqual; -(function (ValueEqual) { - function Object(left, right) { - if (!is_1.Is.Object(right)) - return false; - const leftKeys = [...globalThis.Object.keys(left), ...globalThis.Object.getOwnPropertySymbols(left)]; - const rightKeys = [...globalThis.Object.keys(right), ...globalThis.Object.getOwnPropertySymbols(right)]; - if (leftKeys.length !== rightKeys.length) - return false; - return leftKeys.every((key) => Equal(left[key], right[key])); - } - function Date(left, right) { - return is_1.Is.Date(right) && left.getTime() === right.getTime(); - } - function Array(left, right) { - if (!is_1.Is.Array(right) || left.length !== right.length) - return false; - return left.every((value, index) => Equal(value, right[index])); - } - function TypedArray(left, right) { - if (!is_1.Is.TypedArray(right) || left.length !== right.length || globalThis.Object.getPrototypeOf(left).constructor.name !== globalThis.Object.getPrototypeOf(right).constructor.name) - return false; - return left.every((value, index) => Equal(value, right[index])); - } - function Value(left, right) { - return left === right; - } - function Equal(left, right) { - if (is_1.Is.Object(left)) { - return Object(left, right); - } - else if (is_1.Is.Date(left)) { - return Date(left, right); - } - else if (is_1.Is.TypedArray(left)) { - return TypedArray(left, right); - } - else if (is_1.Is.Array(left)) { - return Array(left, right); - } - else if (is_1.Is.Value(left)) { - return Value(left, right); - } - else { - throw new Error('ValueEquals: Unable to compare value'); - } - } - ValueEqual.Equal = Equal; -})(ValueEqual = exports.ValueEqual || (exports.ValueEqual = {})); diff --git a/node_modules/@sinclair/typebox/value/index.d.ts b/node_modules/@sinclair/typebox/value/index.d.ts deleted file mode 100644 index 1e56ae773..000000000 --- a/node_modules/@sinclair/typebox/value/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { ValueError, ValueErrorType } from '../errors/index'; -export { Edit, Insert, Update, Delete } from './delta'; -export * from './pointer'; -export * from './value'; diff --git a/node_modules/@sinclair/typebox/value/index.js b/node_modules/@sinclair/typebox/value/index.js deleted file mode 100644 index a51cc3123..000000000 --- a/node_modules/@sinclair/typebox/value/index.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Delete = exports.Update = exports.Insert = exports.Edit = exports.ValueErrorType = void 0; -var index_1 = require("../errors/index"); -Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } }); -var delta_1 = require("./delta"); -Object.defineProperty(exports, "Edit", { enumerable: true, get: function () { return delta_1.Edit; } }); -Object.defineProperty(exports, "Insert", { enumerable: true, get: function () { return delta_1.Insert; } }); -Object.defineProperty(exports, "Update", { enumerable: true, get: function () { return delta_1.Update; } }); -Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return delta_1.Delete; } }); -__exportStar(require("./pointer"), exports); -__exportStar(require("./value"), exports); diff --git a/node_modules/@sinclair/typebox/value/is.d.ts b/node_modules/@sinclair/typebox/value/is.d.ts deleted file mode 100644 index b78ba9c25..000000000 --- a/node_modules/@sinclair/typebox/value/is.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type ValueType = null | undefined | Function | symbol | bigint | number | boolean | string; -export type ObjectType = Record; -export type TypedArrayType = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; -export type ArrayType = unknown[]; -export declare namespace Is { - function Object(value: unknown): value is ObjectType; - function Date(value: unknown): value is Date; - function Array(value: unknown): value is ArrayType; - function Value(value: unknown): value is ValueType; - function TypedArray(value: unknown): value is TypedArrayType; -} diff --git a/node_modules/@sinclair/typebox/value/is.js b/node_modules/@sinclair/typebox/value/is.js deleted file mode 100644 index fbe1ed43b..000000000 --- a/node_modules/@sinclair/typebox/value/is.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Is = void 0; -var Is; -(function (Is) { - function Object(value) { - return value !== null && typeof value === 'object' && !globalThis.Array.isArray(value) && !ArrayBuffer.isView(value) && !(value instanceof globalThis.Date); - } - Is.Object = Object; - function Date(value) { - return value instanceof globalThis.Date; - } - Is.Date = Date; - function Array(value) { - return globalThis.Array.isArray(value) && !ArrayBuffer.isView(value); - } - Is.Array = Array; - function Value(value) { - return value === null || value === undefined || typeof value === 'function' || typeof value === 'symbol' || typeof value === 'bigint' || typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string'; - } - Is.Value = Value; - function TypedArray(value) { - return ArrayBuffer.isView(value); - } - Is.TypedArray = TypedArray; -})(Is = exports.Is || (exports.Is = {})); diff --git a/node_modules/@sinclair/typebox/value/pointer.d.ts b/node_modules/@sinclair/typebox/value/pointer.d.ts deleted file mode 100644 index abae1e1c4..000000000 --- a/node_modules/@sinclair/typebox/value/pointer.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export declare class ValuePointerRootSetError extends Error { - readonly value: unknown; - readonly path: string; - readonly update: unknown; - constructor(value: unknown, path: string, update: unknown); -} -export declare class ValuePointerRootDeleteError extends Error { - readonly value: unknown; - readonly path: string; - constructor(value: unknown, path: string); -} -/** Provides functionality to update values through RFC6901 string pointers */ -export declare namespace ValuePointer { - /** Formats the given pointer into navigable key components */ - function Format(pointer: string): IterableIterator; - /** Sets the value at the given pointer. If the value at the pointer does not exist it is created */ - function Set(value: any, pointer: string, update: unknown): void; - /** Deletes a value at the given pointer */ - function Delete(value: any, pointer: string): void; - /** Returns true if a value exists at the given pointer */ - function Has(value: any, pointer: string): boolean; - /** Gets the value at the given pointer */ - function Get(value: any, pointer: string): any; -} diff --git a/node_modules/@sinclair/typebox/value/pointer.js b/node_modules/@sinclair/typebox/value/pointer.js deleted file mode 100644 index 981be6350..000000000 --- a/node_modules/@sinclair/typebox/value/pointer.js +++ /dev/null @@ -1,142 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValuePointer = exports.ValuePointerRootDeleteError = exports.ValuePointerRootSetError = void 0; -class ValuePointerRootSetError extends Error { - constructor(value, path, update) { - super('ValuePointer: Cannot set root value'); - this.value = value; - this.path = path; - this.update = update; - } -} -exports.ValuePointerRootSetError = ValuePointerRootSetError; -class ValuePointerRootDeleteError extends Error { - constructor(value, path) { - super('ValuePointer: Cannot delete root value'); - this.value = value; - this.path = path; - } -} -exports.ValuePointerRootDeleteError = ValuePointerRootDeleteError; -/** Provides functionality to update values through RFC6901 string pointers */ -var ValuePointer; -(function (ValuePointer) { - function Escape(component) { - return component.indexOf('~') === -1 ? component : component.replace(/~1/g, '/').replace(/~0/g, '~'); - } - /** Formats the given pointer into navigable key components */ - function* Format(pointer) { - if (pointer === '') - return; - let [start, end] = [0, 0]; - for (let i = 0; i < pointer.length; i++) { - const char = pointer.charAt(i); - if (char === '/') { - if (i === 0) { - start = i + 1; - } - else { - end = i; - yield Escape(pointer.slice(start, end)); - start = i + 1; - } - } - else { - end = i; - } - } - yield Escape(pointer.slice(start)); - } - ValuePointer.Format = Format; - /** Sets the value at the given pointer. If the value at the pointer does not exist it is created */ - function Set(value, pointer, update) { - if (pointer === '') - throw new ValuePointerRootSetError(value, pointer, update); - let [owner, next, key] = [null, value, '']; - for (const component of Format(pointer)) { - if (next[component] === undefined) - next[component] = {}; - owner = next; - next = next[component]; - key = component; - } - owner[key] = update; - } - ValuePointer.Set = Set; - /** Deletes a value at the given pointer */ - function Delete(value, pointer) { - if (pointer === '') - throw new ValuePointerRootDeleteError(value, pointer); - let [owner, next, key] = [null, value, '']; - for (const component of Format(pointer)) { - if (next[component] === undefined || next[component] === null) - return; - owner = next; - next = next[component]; - key = component; - } - if (globalThis.Array.isArray(owner)) { - const index = parseInt(key); - owner.splice(index, 1); - } - else { - delete owner[key]; - } - } - ValuePointer.Delete = Delete; - /** Returns true if a value exists at the given pointer */ - function Has(value, pointer) { - if (pointer === '') - return true; - let [owner, next, key] = [null, value, '']; - for (const component of Format(pointer)) { - if (next[component] === undefined) - return false; - owner = next; - next = next[component]; - key = component; - } - return globalThis.Object.getOwnPropertyNames(owner).includes(key); - } - ValuePointer.Has = Has; - /** Gets the value at the given pointer */ - function Get(value, pointer) { - if (pointer === '') - return value; - let current = value; - for (const component of Format(pointer)) { - if (current[component] === undefined) - return undefined; - current = current[component]; - } - return current; - } - ValuePointer.Get = Get; -})(ValuePointer = exports.ValuePointer || (exports.ValuePointer = {})); diff --git a/node_modules/@sinclair/typebox/value/value.d.ts b/node_modules/@sinclair/typebox/value/value.d.ts deleted file mode 100644 index 25dba15d0..000000000 --- a/node_modules/@sinclair/typebox/value/value.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import * as Types from '../typebox'; -import { ValueError } from '../errors/index'; -import { Edit } from './delta'; -/** Provides functions to perform structural updates to JavaScript values */ -export declare namespace Value { - /** Casts a value into a given type. The return value will retain as much information of the original value as possible. Cast will convert string, number, boolean and date values if a reasonable conversion is possible. */ - function Cast(schema: T, references: [...R], value: unknown): Types.Static; - /** Casts a value into a given type. The return value will retain as much information of the original value as possible. Cast will convert string, number, boolean and date values if a reasonable conversion is possible. */ - function Cast(schema: T, value: unknown): Types.Static; - /** Creates a value from the given type */ - function Create(schema: T, references: [...R]): Types.Static; - /** Creates a value from the given type */ - function Create(schema: T): Types.Static; - /** Returns true if the value matches the given type. */ - function Check(schema: T, references: [...R], value: unknown): value is Types.Static; - /** Returns true if the value matches the given type. */ - function Check(schema: T, value: unknown): value is Types.Static; - /** Returns a structural clone of the given value */ - function Clone(value: T): T; - /** Returns an iterator for each error in this value. */ - function Errors(schema: T, references: [...R], value: unknown): IterableIterator; - /** Returns an iterator for each error in this value. */ - function Errors(schema: T, value: unknown): IterableIterator; - /** Returns true if left and right values are structurally equal */ - function Equal(left: T, right: unknown): right is T; - /** Returns edits to transform the current value into the next value */ - function Diff(current: unknown, next: unknown): Edit[]; - /** Returns a FNV1A-64 non cryptographic hash of the given value */ - function Hash(value: unknown): bigint; - /** Returns a new value with edits applied to the given value */ - function Patch(current: unknown, edits: Edit[]): T; -} diff --git a/node_modules/@sinclair/typebox/value/value.js b/node_modules/@sinclair/typebox/value/value.js deleted file mode 100644 index f52a45847..000000000 --- a/node_modules/@sinclair/typebox/value/value.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -/*-------------------------------------------------------------------------- - -@sinclair/typebox/value - -The MIT License (MIT) - -Copyright (c) 2017-2023 Haydn Paterson (sinclair) - -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. - ----------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Value = void 0; -const index_1 = require("../errors/index"); -const index_2 = require("../hash/index"); -const equal_1 = require("./equal"); -const cast_1 = require("./cast"); -const clone_1 = require("./clone"); -const create_1 = require("./create"); -const check_1 = require("./check"); -const delta_1 = require("./delta"); -/** Provides functions to perform structural updates to JavaScript values */ -var Value; -(function (Value) { - function Cast(...args) { - const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]]; - return cast_1.ValueCast.Cast(schema, references, value); - } - Value.Cast = Cast; - function Create(...args) { - const [schema, references] = args.length === 2 ? [args[0], args[1]] : [args[0], []]; - return create_1.ValueCreate.Create(schema, references); - } - Value.Create = Create; - function Check(...args) { - const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]]; - return check_1.ValueCheck.Check(schema, references, value); - } - Value.Check = Check; - /** Returns a structural clone of the given value */ - function Clone(value) { - return clone_1.ValueClone.Clone(value); - } - Value.Clone = Clone; - function* Errors(...args) { - const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]]; - yield* index_1.ValueErrors.Errors(schema, references, value); - } - Value.Errors = Errors; - /** Returns true if left and right values are structurally equal */ - function Equal(left, right) { - return equal_1.ValueEqual.Equal(left, right); - } - Value.Equal = Equal; - /** Returns edits to transform the current value into the next value */ - function Diff(current, next) { - return delta_1.ValueDelta.Diff(current, next); - } - Value.Diff = Diff; - /** Returns a FNV1A-64 non cryptographic hash of the given value */ - function Hash(value) { - return index_2.ValueHash.Create(value); - } - Value.Hash = Hash; - /** Returns a new value with edits applied to the given value */ - function Patch(current, edits) { - return delta_1.ValueDelta.Patch(current, edits); - } - Value.Patch = Patch; -})(Value = exports.Value || (exports.Value = {})); diff --git a/node_modules/@sinonjs/commons/LICENSE b/node_modules/@sinonjs/commons/LICENSE deleted file mode 100644 index 5a77f0a2e..000000000 --- a/node_modules/@sinonjs/commons/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2018, Sinon.JS -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@sinonjs/commons/README.md b/node_modules/@sinonjs/commons/README.md deleted file mode 100644 index 9c420ba5d..000000000 --- a/node_modules/@sinonjs/commons/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# commons - -[![CircleCI](https://circleci.com/gh/sinonjs/commons.svg?style=svg)](https://circleci.com/gh/sinonjs/commons) -[![codecov](https://codecov.io/gh/sinonjs/commons/branch/master/graph/badge.svg)](https://codecov.io/gh/sinonjs/commons) -Contributor Covenant - -Simple functions shared among the sinon end user libraries - -## Rules - -- Follows the [Sinon.JS compatibility](https://github.com/sinonjs/sinon/blob/master/CONTRIBUTING.md#compatibility) -- 100% test coverage -- Code formatted using [Prettier](https://prettier.io) -- No side effects welcome! (only pure functions) -- No platform specific functions -- One export per file (any bundler can do tree shaking) diff --git a/node_modules/@sinonjs/commons/lib/called-in-order.js b/node_modules/@sinonjs/commons/lib/called-in-order.js deleted file mode 100644 index 4edb67fa5..000000000 --- a/node_modules/@sinonjs/commons/lib/called-in-order.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; - -var every = require("./prototypes/array").every; - -/** - * @private - */ -function hasCallsLeft(callMap, spy) { - if (callMap[spy.id] === undefined) { - callMap[spy.id] = 0; - } - - return callMap[spy.id] < spy.callCount; -} - -/** - * @private - */ -function checkAdjacentCalls(callMap, spy, index, spies) { - var calledBeforeNext = true; - - if (index !== spies.length - 1) { - calledBeforeNext = spy.calledBefore(spies[index + 1]); - } - - if (hasCallsLeft(callMap, spy) && calledBeforeNext) { - callMap[spy.id] += 1; - return true; - } - - return false; -} - -/** - * A Sinon proxy object (fake, spy, stub) - * - * @typedef {object} SinonProxy - * @property {Function} calledBefore - A method that determines if this proxy was called before another one - * @property {string} id - Some id - * @property {number} callCount - Number of times this proxy has been called - */ - -/** - * Returns true when the spies have been called in the order they were supplied in - * - * @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments - * @returns {boolean} true when spies are called in order, false otherwise - */ -function calledInOrder(spies) { - var callMap = {}; - // eslint-disable-next-line no-underscore-dangle - var _spies = arguments.length > 1 ? arguments : spies; - - return every(_spies, checkAdjacentCalls.bind(null, callMap)); -} - -module.exports = calledInOrder; diff --git a/node_modules/@sinonjs/commons/lib/called-in-order.test.js b/node_modules/@sinonjs/commons/lib/called-in-order.test.js deleted file mode 100644 index 5fe66118b..000000000 --- a/node_modules/@sinonjs/commons/lib/called-in-order.test.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; - -var assert = require("@sinonjs/referee-sinon").assert; -var calledInOrder = require("./called-in-order"); -var sinon = require("@sinonjs/referee-sinon").sinon; - -var testObject1 = { - someFunction: function () { - return; - }, -}; -var testObject2 = { - otherFunction: function () { - return; - }, -}; -var testObject3 = { - thirdFunction: function () { - return; - }, -}; - -function testMethod() { - testObject1.someFunction(); - testObject2.otherFunction(); - testObject2.otherFunction(); - testObject2.otherFunction(); - testObject3.thirdFunction(); -} - -describe("calledInOrder", function () { - beforeEach(function () { - sinon.stub(testObject1, "someFunction"); - sinon.stub(testObject2, "otherFunction"); - sinon.stub(testObject3, "thirdFunction"); - testMethod(); - }); - afterEach(function () { - testObject1.someFunction.restore(); - testObject2.otherFunction.restore(); - testObject3.thirdFunction.restore(); - }); - - describe("given single array argument", function () { - describe("when stubs were called in expected order", function () { - it("returns true", function () { - assert.isTrue( - calledInOrder([ - testObject1.someFunction, - testObject2.otherFunction, - ]) - ); - assert.isTrue( - calledInOrder([ - testObject1.someFunction, - testObject2.otherFunction, - testObject2.otherFunction, - testObject3.thirdFunction, - ]) - ); - }); - }); - - describe("when stubs were called in unexpected order", function () { - it("returns false", function () { - assert.isFalse( - calledInOrder([ - testObject2.otherFunction, - testObject1.someFunction, - ]) - ); - assert.isFalse( - calledInOrder([ - testObject2.otherFunction, - testObject1.someFunction, - testObject1.someFunction, - testObject3.thirdFunction, - ]) - ); - }); - }); - }); - - describe("given multiple arguments", function () { - describe("when stubs were called in expected order", function () { - it("returns true", function () { - assert.isTrue( - calledInOrder( - testObject1.someFunction, - testObject2.otherFunction - ) - ); - assert.isTrue( - calledInOrder( - testObject1.someFunction, - testObject2.otherFunction, - testObject3.thirdFunction - ) - ); - }); - }); - - describe("when stubs were called in unexpected order", function () { - it("returns false", function () { - assert.isFalse( - calledInOrder( - testObject2.otherFunction, - testObject1.someFunction - ) - ); - assert.isFalse( - calledInOrder( - testObject2.otherFunction, - testObject1.someFunction, - testObject3.thirdFunction - ) - ); - }); - }); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/class-name.js b/node_modules/@sinonjs/commons/lib/class-name.js deleted file mode 100644 index bcd26baea..000000000 --- a/node_modules/@sinonjs/commons/lib/class-name.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -var functionName = require("./function-name"); - -/** - * Returns a display name for a value from a constructor - * - * @param {object} value A value to examine - * @returns {(string|null)} A string or null - */ -function className(value) { - return ( - (value.constructor && value.constructor.name) || - // The next branch is for IE11 support only: - // Because the name property is not set on the prototype - // of the Function object, we finally try to grab the - // name from its definition. This will never be reached - // in node, so we are not able to test this properly. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name - (typeof value.constructor === "function" && - /* istanbul ignore next */ - functionName(value.constructor)) || - null - ); -} - -module.exports = className; diff --git a/node_modules/@sinonjs/commons/lib/class-name.test.js b/node_modules/@sinonjs/commons/lib/class-name.test.js deleted file mode 100644 index 994f21b81..000000000 --- a/node_modules/@sinonjs/commons/lib/class-name.test.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -/* eslint-disable no-empty-function */ - -var assert = require("@sinonjs/referee").assert; -var className = require("./class-name"); - -describe("className", function () { - it("returns the class name of an instance", function () { - // Because eslint-config-sinon disables es6, we can't - // use a class definition here - // https://github.com/sinonjs/eslint-config-sinon/blob/master/index.js - // var instance = new (class TestClass {})(); - var instance = new (function TestClass() {})(); - var name = className(instance); - assert.equals(name, "TestClass"); - }); - - it("returns 'Object' for {}", function () { - var name = className({}); - assert.equals(name, "Object"); - }); - - it("returns null for an object that has no prototype", function () { - var obj = Object.create(null); - var name = className(obj); - assert.equals(name, null); - }); - - it("returns null for an object whose prototype was mangled", function () { - // This is what Node v6 and v7 do for objects returned by querystring.parse() - function MangledObject() {} - MangledObject.prototype = Object.create(null); - var obj = new MangledObject(); - var name = className(obj); - assert.equals(name, null); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/deprecated.js b/node_modules/@sinonjs/commons/lib/deprecated.js deleted file mode 100644 index 422272542..000000000 --- a/node_modules/@sinonjs/commons/lib/deprecated.js +++ /dev/null @@ -1,51 +0,0 @@ -/* eslint-disable no-console */ -"use strict"; - -/** - * Returns a function that will invoke the supplied function and print a - * deprecation warning to the console each time it is called. - * - * @param {Function} func - * @param {string} msg - * @returns {Function} - */ -exports.wrap = function (func, msg) { - var wrapped = function () { - exports.printWarning(msg); - return func.apply(this, arguments); - }; - if (func.prototype) { - wrapped.prototype = func.prototype; - } - return wrapped; -}; - -/** - * Returns a string which can be supplied to `wrap()` to notify the user that a - * particular part of the sinon API has been deprecated. - * - * @param {string} packageName - * @param {string} funcName - * @returns {string} - */ -exports.defaultMsg = function (packageName, funcName) { - return `${packageName}.${funcName} is deprecated and will be removed from the public API in a future version of ${packageName}.`; -}; - -/** - * Prints a warning on the console, when it exists - * - * @param {string} msg - * @returns {undefined} - */ -exports.printWarning = function (msg) { - /* istanbul ignore next */ - if (typeof process === "object" && process.emitWarning) { - // Emit Warnings in Node - process.emitWarning(msg); - } else if (console.info) { - console.info(msg); - } else { - console.log(msg); - } -}; diff --git a/node_modules/@sinonjs/commons/lib/deprecated.test.js b/node_modules/@sinonjs/commons/lib/deprecated.test.js deleted file mode 100644 index 275d8b1c9..000000000 --- a/node_modules/@sinonjs/commons/lib/deprecated.test.js +++ /dev/null @@ -1,101 +0,0 @@ -/* eslint-disable no-console */ -"use strict"; - -var assert = require("@sinonjs/referee-sinon").assert; -var sinon = require("@sinonjs/referee-sinon").sinon; - -var deprecated = require("./deprecated"); - -var msg = "test"; - -describe("deprecated", function () { - describe("defaultMsg", function () { - it("should return a string", function () { - assert.equals( - deprecated.defaultMsg("sinon", "someFunc"), - "sinon.someFunc is deprecated and will be removed from the public API in a future version of sinon." - ); - }); - }); - - describe("printWarning", function () { - beforeEach(function () { - sinon.replace(process, "emitWarning", sinon.fake()); - }); - - afterEach(sinon.restore); - - describe("when `process.emitWarning` is defined", function () { - it("should call process.emitWarning with a msg", function () { - deprecated.printWarning(msg); - assert.calledOnceWith(process.emitWarning, msg); - }); - }); - - describe("when `process.emitWarning` is undefined", function () { - beforeEach(function () { - sinon.replace(console, "info", sinon.fake()); - sinon.replace(console, "log", sinon.fake()); - process.emitWarning = undefined; - }); - - afterEach(sinon.restore); - - describe("when `console.info` is defined", function () { - it("should call `console.info` with a message", function () { - deprecated.printWarning(msg); - assert.calledOnceWith(console.info, msg); - }); - }); - - describe("when `console.info` is undefined", function () { - it("should call `console.log` with a message", function () { - console.info = undefined; - deprecated.printWarning(msg); - assert.calledOnceWith(console.log, msg); - }); - }); - }); - }); - - describe("wrap", function () { - // eslint-disable-next-line mocha/no-setup-in-describe - var method = sinon.fake(); - var wrapped; - - beforeEach(function () { - wrapped = deprecated.wrap(method, msg); - }); - - it("should return a wrapper function", function () { - assert.match(wrapped, sinon.match.func); - }); - - it("should assign the prototype of the passed method", function () { - assert.equals(method.prototype, wrapped.prototype); - }); - - context("when the passed method has falsy prototype", function () { - it("should not be assigned to the wrapped method", function () { - method.prototype = null; - wrapped = deprecated.wrap(method, msg); - assert.match(wrapped.prototype, sinon.match.object); - }); - }); - - context("when invoking the wrapped function", function () { - before(function () { - sinon.replace(deprecated, "printWarning", sinon.fake()); - wrapped({}); - }); - - it("should call `printWarning` before invoking", function () { - assert.calledOnceWith(deprecated.printWarning, msg); - }); - - it("should invoke the passed method with the given arguments", function () { - assert.calledOnceWith(method, {}); - }); - }); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/every.js b/node_modules/@sinonjs/commons/lib/every.js deleted file mode 100644 index 00bf304e2..000000000 --- a/node_modules/@sinonjs/commons/lib/every.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -/** - * Returns true when fn returns true for all members of obj. - * This is an every implementation that works for all iterables - * - * @param {object} obj - * @param {Function} fn - * @returns {boolean} - */ -module.exports = function every(obj, fn) { - var pass = true; - - try { - // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods - obj.forEach(function () { - if (!fn.apply(this, arguments)) { - // Throwing an error is the only way to break `forEach` - throw new Error(); - } - }); - } catch (e) { - pass = false; - } - - return pass; -}; diff --git a/node_modules/@sinonjs/commons/lib/every.test.js b/node_modules/@sinonjs/commons/lib/every.test.js deleted file mode 100644 index e054a14de..000000000 --- a/node_modules/@sinonjs/commons/lib/every.test.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -var assert = require("@sinonjs/referee-sinon").assert; -var sinon = require("@sinonjs/referee-sinon").sinon; -var every = require("./every"); - -describe("util/core/every", function () { - it("returns true when the callback function returns true for every element in an iterable", function () { - var obj = [true, true, true, true]; - var allTrue = every(obj, function (val) { - return val; - }); - - assert(allTrue); - }); - - it("returns false when the callback function returns false for any element in an iterable", function () { - var obj = [true, true, true, false]; - var result = every(obj, function (val) { - return val; - }); - - assert.isFalse(result); - }); - - it("calls the given callback once for each item in an iterable until it returns false", function () { - var iterableOne = [true, true, true, true]; - var iterableTwo = [true, true, false, true]; - var callback = sinon.spy(function (val) { - return val; - }); - - every(iterableOne, callback); - assert.equals(callback.callCount, 4); - - callback.resetHistory(); - - every(iterableTwo, callback); - assert.equals(callback.callCount, 3); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/function-name.js b/node_modules/@sinonjs/commons/lib/function-name.js deleted file mode 100644 index 199b04e0d..000000000 --- a/node_modules/@sinonjs/commons/lib/function-name.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; - -/** - * Returns a display name for a function - * - * @param {Function} func - * @returns {string} - */ -module.exports = function functionName(func) { - if (!func) { - return ""; - } - - try { - return ( - func.displayName || - func.name || - // Use function decomposition as a last resort to get function - // name. Does not rely on function decomposition to work - if it - // doesn't debugging will be slightly less informative - // (i.e. toString will say 'spy' rather than 'myFunc'). - (String(func).match(/function ([^\s(]+)/) || [])[1] - ); - } catch (e) { - // Stringify may fail and we might get an exception, as a last-last - // resort fall back to empty string. - return ""; - } -}; diff --git a/node_modules/@sinonjs/commons/lib/function-name.test.js b/node_modules/@sinonjs/commons/lib/function-name.test.js deleted file mode 100644 index 0798b4e7f..000000000 --- a/node_modules/@sinonjs/commons/lib/function-name.test.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; - -var jsc = require("jsverify"); -var refute = require("@sinonjs/referee-sinon").refute; - -var functionName = require("./function-name"); - -describe("function-name", function () { - it("should return empty string if func is falsy", function () { - jsc.assertForall("falsy", function (fn) { - return functionName(fn) === ""; - }); - }); - - it("should use displayName by default", function () { - jsc.assertForall("nestring", function (displayName) { - var fn = { displayName: displayName }; - - return functionName(fn) === fn.displayName; - }); - }); - - it("should use name if displayName is not available", function () { - jsc.assertForall("nestring", function (name) { - var fn = { name: name }; - - return functionName(fn) === fn.name; - }); - }); - - it("should fallback to string parsing", function () { - jsc.assertForall("nat", function (naturalNumber) { - var name = `fn${naturalNumber}`; - var fn = { - toString: function () { - return `\nfunction ${name}`; - }, - }; - - return functionName(fn) === name; - }); - }); - - it("should not fail when a name cannot be found", function () { - refute.exception(function () { - var fn = { - toString: function () { - return "\nfunction ("; - }, - }; - - functionName(fn); - }); - }); - - it("should not fail when toString is undefined", function () { - refute.exception(function () { - functionName(Object.create(null)); - }); - }); - - it("should not fail when toString throws", function () { - refute.exception(function () { - var fn; - try { - // eslint-disable-next-line no-eval - fn = eval("(function*() {})")().constructor; - } catch (e) { - // env doesn't support generators - return; - } - - functionName(fn); - }); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/global.js b/node_modules/@sinonjs/commons/lib/global.js deleted file mode 100644 index 51715a27c..000000000 --- a/node_modules/@sinonjs/commons/lib/global.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -/** - * A reference to the global object - * - * @type {object} globalObject - */ -var globalObject; - -/* istanbul ignore else */ -if (typeof global !== "undefined") { - // Node - globalObject = global; -} else if (typeof window !== "undefined") { - // Browser - globalObject = window; -} else { - // WebWorker - globalObject = self; -} - -module.exports = globalObject; diff --git a/node_modules/@sinonjs/commons/lib/global.test.js b/node_modules/@sinonjs/commons/lib/global.test.js deleted file mode 100644 index 4fa73ebcf..000000000 --- a/node_modules/@sinonjs/commons/lib/global.test.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -var assert = require("@sinonjs/referee-sinon").assert; -var globalObject = require("./global"); - -describe("global", function () { - before(function () { - if (typeof global === "undefined") { - this.skip(); - } - }); - - it("is same as global", function () { - assert.same(globalObject, global); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/index.js b/node_modules/@sinonjs/commons/lib/index.js deleted file mode 100644 index 870df32c8..000000000 --- a/node_modules/@sinonjs/commons/lib/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -module.exports = { - global: require("./global"), - calledInOrder: require("./called-in-order"), - className: require("./class-name"), - deprecated: require("./deprecated"), - every: require("./every"), - functionName: require("./function-name"), - orderByFirstCall: require("./order-by-first-call"), - prototypes: require("./prototypes"), - typeOf: require("./type-of"), - valueToString: require("./value-to-string"), -}; diff --git a/node_modules/@sinonjs/commons/lib/index.test.js b/node_modules/@sinonjs/commons/lib/index.test.js deleted file mode 100644 index e79aa7ee0..000000000 --- a/node_modules/@sinonjs/commons/lib/index.test.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -var assert = require("@sinonjs/referee-sinon").assert; -var index = require("./index"); - -var expectedMethods = [ - "calledInOrder", - "className", - "every", - "functionName", - "orderByFirstCall", - "typeOf", - "valueToString", -]; -var expectedObjectProperties = ["deprecated", "prototypes"]; - -describe("package", function () { - // eslint-disable-next-line mocha/no-setup-in-describe - expectedMethods.forEach(function (name) { - it(`should export a method named ${name}`, function () { - assert.isFunction(index[name]); - }); - }); - - // eslint-disable-next-line mocha/no-setup-in-describe - expectedObjectProperties.forEach(function (name) { - it(`should export an object property named ${name}`, function () { - assert.isObject(index[name]); - }); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/order-by-first-call.js b/node_modules/@sinonjs/commons/lib/order-by-first-call.js deleted file mode 100644 index c3d47edfe..000000000 --- a/node_modules/@sinonjs/commons/lib/order-by-first-call.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -var sort = require("./prototypes/array").sort; -var slice = require("./prototypes/array").slice; - -/** - * @private - */ -function comparator(a, b) { - // uuid, won't ever be equal - var aCall = a.getCall(0); - var bCall = b.getCall(0); - var aId = (aCall && aCall.callId) || -1; - var bId = (bCall && bCall.callId) || -1; - - return aId < bId ? -1 : 1; -} - -/** - * A Sinon proxy object (fake, spy, stub) - * - * @typedef {object} SinonProxy - * @property {Function} getCall - A method that can return the first call - */ - -/** - * Sorts an array of SinonProxy instances (fake, spy, stub) by their first call - * - * @param {SinonProxy[] | SinonProxy} spies - * @returns {SinonProxy[]} - */ -function orderByFirstCall(spies) { - return sort(slice(spies), comparator); -} - -module.exports = orderByFirstCall; diff --git a/node_modules/@sinonjs/commons/lib/order-by-first-call.test.js b/node_modules/@sinonjs/commons/lib/order-by-first-call.test.js deleted file mode 100644 index cbc71beb2..000000000 --- a/node_modules/@sinonjs/commons/lib/order-by-first-call.test.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -var assert = require("@sinonjs/referee-sinon").assert; -var knuthShuffle = require("knuth-shuffle").knuthShuffle; -var sinon = require("@sinonjs/referee-sinon").sinon; -var orderByFirstCall = require("./order-by-first-call"); - -describe("orderByFirstCall", function () { - it("should order an Array of spies by the callId of the first call, ascending", function () { - // create an array of spies - var spies = [ - sinon.spy(), - sinon.spy(), - sinon.spy(), - sinon.spy(), - sinon.spy(), - sinon.spy(), - ]; - - // call all the spies - spies.forEach(function (spy) { - spy(); - }); - - // add a few uncalled spies - spies.push(sinon.spy()); - spies.push(sinon.spy()); - - // randomise the order of the spies - knuthShuffle(spies); - - var sortedSpies = orderByFirstCall(spies); - - assert.equals(sortedSpies.length, spies.length); - - var orderedByFirstCall = sortedSpies.every(function (spy, index) { - if (index + 1 === sortedSpies.length) { - return true; - } - var nextSpy = sortedSpies[index + 1]; - - // uncalled spies should be ordered first - if (!spy.called) { - return true; - } - - return spy.calledImmediatelyBefore(nextSpy); - }); - - assert.isTrue(orderedByFirstCall); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/prototypes/README.md b/node_modules/@sinonjs/commons/lib/prototypes/README.md deleted file mode 100644 index c3d92fe80..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Prototypes - -The functions in this folder are to be use for keeping cached references to the built-in prototypes, so that people can't inadvertently break the library by making mistakes in userland. - -See https://github.com/sinonjs/sinon/pull/1523 - -## Without cached references - -```js -// in userland, the library user needs to replace the filter method on -// Array.prototype -var array = [1, 2, 3]; -sinon.replace(array, "filter", sinon.fake.returns(2)); - -// in a sinon module, the library author needs to use the filter method -var someArray = ["a", "b", 42, "c"]; -var answer = filter(someArray, function (v) { - return v === 42; -}); - -console.log(answer); -// => 2 -``` - -## With cached references - -```js -// in userland, the library user needs to replace the filter method on -// Array.prototype -var array = [1, 2, 3]; -sinon.replace(array, "filter", sinon.fake.returns(2)); - -// in a sinon module, the library author needs to use the filter method -// get a reference to the original Array.prototype.filter -var filter = require("@sinonjs/commons").prototypes.array.filter; -var someArray = ["a", "b", 42, "c"]; -var answer = filter(someArray, function (v) { - return v === 42; -}); - -console.log(answer); -// => 42 -``` diff --git a/node_modules/@sinonjs/commons/lib/prototypes/array.js b/node_modules/@sinonjs/commons/lib/prototypes/array.js deleted file mode 100644 index 381a032a9..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/array.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -var copyPrototype = require("./copy-prototype-methods"); - -module.exports = copyPrototype(Array.prototype); diff --git a/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js b/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js deleted file mode 100644 index 38549c19d..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -var call = Function.call; -var throwsOnProto = require("./throws-on-proto"); - -var disallowedProperties = [ - // ignore size because it throws from Map - "size", - "caller", - "callee", - "arguments", -]; - -// This branch is covered when tests are run with `--disable-proto=throw`, -// however we can test both branches at the same time, so this is ignored -/* istanbul ignore next */ -if (throwsOnProto) { - disallowedProperties.push("__proto__"); -} - -module.exports = function copyPrototypeMethods(prototype) { - // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods - return Object.getOwnPropertyNames(prototype).reduce(function ( - result, - name - ) { - if (disallowedProperties.includes(name)) { - return result; - } - - if (typeof prototype[name] !== "function") { - return result; - } - - result[name] = call.bind(prototype[name]); - - return result; - }, - Object.create(null)); -}; diff --git a/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.test.js b/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.test.js deleted file mode 100644 index 31de7cd30..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.test.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -var refute = require("@sinonjs/referee-sinon").refute; -var copyPrototypeMethods = require("./copy-prototype-methods"); - -describe("copyPrototypeMethods", function () { - it("does not throw for Map", function () { - refute.exception(function () { - copyPrototypeMethods(Map.prototype); - }); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/prototypes/function.js b/node_modules/@sinonjs/commons/lib/prototypes/function.js deleted file mode 100644 index a75c25d81..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/function.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -var copyPrototype = require("./copy-prototype-methods"); - -module.exports = copyPrototype(Function.prototype); diff --git a/node_modules/@sinonjs/commons/lib/prototypes/index.js b/node_modules/@sinonjs/commons/lib/prototypes/index.js deleted file mode 100644 index ab766bf8d..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = { - array: require("./array"), - function: require("./function"), - map: require("./map"), - object: require("./object"), - set: require("./set"), - string: require("./string"), -}; diff --git a/node_modules/@sinonjs/commons/lib/prototypes/index.test.js b/node_modules/@sinonjs/commons/lib/prototypes/index.test.js deleted file mode 100644 index 2b3c2625f..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/index.test.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -var assert = require("@sinonjs/referee-sinon").assert; - -var arrayProto = require("./index").array; -var functionProto = require("./index").function; -var mapProto = require("./index").map; -var objectProto = require("./index").object; -var setProto = require("./index").set; -var stringProto = require("./index").string; -var throwsOnProto = require("./throws-on-proto"); - -describe("prototypes", function () { - describe(".array", function () { - // eslint-disable-next-line mocha/no-setup-in-describe - verifyProperties(arrayProto, Array); - }); - describe(".function", function () { - // eslint-disable-next-line mocha/no-setup-in-describe - verifyProperties(functionProto, Function); - }); - describe(".map", function () { - // eslint-disable-next-line mocha/no-setup-in-describe - verifyProperties(mapProto, Map); - }); - describe(".object", function () { - // eslint-disable-next-line mocha/no-setup-in-describe - verifyProperties(objectProto, Object); - }); - describe(".set", function () { - // eslint-disable-next-line mocha/no-setup-in-describe - verifyProperties(setProto, Set); - }); - describe(".string", function () { - // eslint-disable-next-line mocha/no-setup-in-describe - verifyProperties(stringProto, String); - }); -}); - -function verifyProperties(p, origin) { - var disallowedProperties = ["size", "caller", "callee", "arguments"]; - if (throwsOnProto) { - disallowedProperties.push("__proto__"); - } - - it("should have all the methods of the origin prototype", function () { - var methodNames = Object.getOwnPropertyNames(origin.prototype).filter( - function (name) { - if (disallowedProperties.includes(name)) { - return false; - } - - return typeof origin.prototype[name] === "function"; - } - ); - - methodNames.forEach(function (name) { - assert.isTrue(Object.prototype.hasOwnProperty.call(p, name), name); - }); - }); -} diff --git a/node_modules/@sinonjs/commons/lib/prototypes/map.js b/node_modules/@sinonjs/commons/lib/prototypes/map.js deleted file mode 100644 index 91ec65e23..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/map.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -var copyPrototype = require("./copy-prototype-methods"); - -module.exports = copyPrototype(Map.prototype); diff --git a/node_modules/@sinonjs/commons/lib/prototypes/object.js b/node_modules/@sinonjs/commons/lib/prototypes/object.js deleted file mode 100644 index eab7faa8f..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/object.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -var copyPrototype = require("./copy-prototype-methods"); - -module.exports = copyPrototype(Object.prototype); diff --git a/node_modules/@sinonjs/commons/lib/prototypes/set.js b/node_modules/@sinonjs/commons/lib/prototypes/set.js deleted file mode 100644 index 7495c3b96..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/set.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -var copyPrototype = require("./copy-prototype-methods"); - -module.exports = copyPrototype(Set.prototype); diff --git a/node_modules/@sinonjs/commons/lib/prototypes/string.js b/node_modules/@sinonjs/commons/lib/prototypes/string.js deleted file mode 100644 index 3917fe9b0..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/string.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -var copyPrototype = require("./copy-prototype-methods"); - -module.exports = copyPrototype(String.prototype); diff --git a/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js b/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js deleted file mode 100644 index eb7a189b1..000000000 --- a/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -/** - * Is true when the environment causes an error to be thrown for accessing the - * __proto__ property. - * - * This is necessary in order to support `node --disable-proto=throw`. - * - * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto - * - * @type {boolean} - */ -let throwsOnProto; -try { - const object = {}; - // eslint-disable-next-line no-proto, no-unused-expressions - object.__proto__; - throwsOnProto = false; -} catch (_) { - // This branch is covered when tests are run with `--disable-proto=throw`, - // however we can test both branches at the same time, so this is ignored - /* istanbul ignore next */ - throwsOnProto = true; -} - -module.exports = throwsOnProto; diff --git a/node_modules/@sinonjs/commons/lib/type-of.js b/node_modules/@sinonjs/commons/lib/type-of.js deleted file mode 100644 index 97a0bb9cb..000000000 --- a/node_modules/@sinonjs/commons/lib/type-of.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -var type = require("type-detect"); - -/** - * Returns the lower-case result of running type from type-detect on the value - * - * @param {*} value - * @returns {string} - */ -module.exports = function typeOf(value) { - return type(value).toLowerCase(); -}; diff --git a/node_modules/@sinonjs/commons/lib/type-of.test.js b/node_modules/@sinonjs/commons/lib/type-of.test.js deleted file mode 100644 index ba377b944..000000000 --- a/node_modules/@sinonjs/commons/lib/type-of.test.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; - -var assert = require("@sinonjs/referee-sinon").assert; -var typeOf = require("./type-of"); - -describe("typeOf", function () { - it("returns boolean", function () { - assert.equals(typeOf(false), "boolean"); - }); - - it("returns string", function () { - assert.equals(typeOf("Sinon.JS"), "string"); - }); - - it("returns number", function () { - assert.equals(typeOf(123), "number"); - }); - - it("returns object", function () { - assert.equals(typeOf({}), "object"); - }); - - it("returns function", function () { - assert.equals( - typeOf(function () { - return undefined; - }), - "function" - ); - }); - - it("returns undefined", function () { - assert.equals(typeOf(undefined), "undefined"); - }); - - it("returns null", function () { - assert.equals(typeOf(null), "null"); - }); - - it("returns array", function () { - assert.equals(typeOf([]), "array"); - }); - - it("returns regexp", function () { - assert.equals(typeOf(/.*/), "regexp"); - }); - - it("returns date", function () { - assert.equals(typeOf(new Date()), "date"); - }); -}); diff --git a/node_modules/@sinonjs/commons/lib/value-to-string.js b/node_modules/@sinonjs/commons/lib/value-to-string.js deleted file mode 100644 index fb14782be..000000000 --- a/node_modules/@sinonjs/commons/lib/value-to-string.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -/** - * Returns a string representation of the value - * - * @param {*} value - * @returns {string} - */ -function valueToString(value) { - if (value && value.toString) { - // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods - return value.toString(); - } - return String(value); -} - -module.exports = valueToString; diff --git a/node_modules/@sinonjs/commons/lib/value-to-string.test.js b/node_modules/@sinonjs/commons/lib/value-to-string.test.js deleted file mode 100644 index 645644714..000000000 --- a/node_modules/@sinonjs/commons/lib/value-to-string.test.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -var assert = require("@sinonjs/referee-sinon").assert; -var valueToString = require("./value-to-string"); - -describe("util/core/valueToString", function () { - it("returns string representation of an object", function () { - var obj = {}; - - assert.equals(valueToString(obj), obj.toString()); - }); - - it("returns 'null' for literal null'", function () { - assert.equals(valueToString(null), "null"); - }); - - it("returns 'undefined' for literal undefined", function () { - assert.equals(valueToString(undefined), "undefined"); - }); -}); diff --git a/node_modules/@sinonjs/commons/package.json b/node_modules/@sinonjs/commons/package.json deleted file mode 100644 index 2f80d025a..000000000 --- a/node_modules/@sinonjs/commons/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@sinonjs/commons", - "version": "3.0.0", - "description": "Simple functions shared among the sinon end user libraries", - "main": "lib/index.js", - "types": "./types/index.d.ts", - "scripts": { - "build": "rm -rf types && tsc", - "lint": "eslint .", - "precommit": "lint-staged", - "test": "mocha --recursive -R dot \"lib/**/*.test.js\"", - "test-check-coverage": "npm run test-coverage && nyc check-coverage --branches 100 --functions 100 --lines 100", - "test-coverage": "nyc --reporter text --reporter html --reporter lcovonly npm run test", - "prepublishOnly": "npm run build", - "prettier:check": "prettier --check '**/*.{js,css,md}'", - "prettier:write": "prettier --write '**/*.{js,css,md}'", - "preversion": "npm run test-check-coverage", - "version": "changes --commits --footer", - "postversion": "git push --follow-tags && npm publish", - "prepare": "husky install" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/sinonjs/commons.git" - }, - "files": [ - "lib", - "types" - ], - "author": "", - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/sinonjs/commons/issues" - }, - "homepage": "https://github.com/sinonjs/commons#readme", - "lint-staged": { - "*.{js,css,md}": "prettier --check", - "*.js": "eslint" - }, - "devDependencies": { - "@sinonjs/eslint-config": "^4.0.6", - "@sinonjs/eslint-plugin-no-prototype-methods": "^0.1.0", - "@sinonjs/referee-sinon": "^10.1.0", - "@studio/changes": "^2.2.0", - "husky": "^6.0.0", - "jsverify": "0.8.4", - "knuth-shuffle": "^1.0.8", - "lint-staged": "^13.0.3", - "mocha": "^10.1.0", - "nyc": "^15.1.0", - "prettier": "^2.7.1", - "typescript": "^4.8.4" - }, - "dependencies": { - "type-detect": "4.0.8" - } -} diff --git a/node_modules/@sinonjs/commons/types/called-in-order.d.ts b/node_modules/@sinonjs/commons/types/called-in-order.d.ts deleted file mode 100644 index 1a4508be9..000000000 --- a/node_modules/@sinonjs/commons/types/called-in-order.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -export = calledInOrder; -/** - * A Sinon proxy object (fake, spy, stub) - * - * @typedef {object} SinonProxy - * @property {Function} calledBefore - A method that determines if this proxy was called before another one - * @property {string} id - Some id - * @property {number} callCount - Number of times this proxy has been called - */ -/** - * Returns true when the spies have been called in the order they were supplied in - * - * @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments - * @returns {boolean} true when spies are called in order, false otherwise - */ -declare function calledInOrder(spies: SinonProxy[] | SinonProxy, ...args: any[]): boolean; -declare namespace calledInOrder { - export { SinonProxy }; -} -/** - * A Sinon proxy object (fake, spy, stub) - */ -type SinonProxy = { - /** - * - A method that determines if this proxy was called before another one - */ - calledBefore: Function; - /** - * - Some id - */ - id: string; - /** - * - Number of times this proxy has been called - */ - callCount: number; -}; diff --git a/node_modules/@sinonjs/commons/types/class-name.d.ts b/node_modules/@sinonjs/commons/types/class-name.d.ts deleted file mode 100644 index df3687b9b..000000000 --- a/node_modules/@sinonjs/commons/types/class-name.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export = className; -/** - * Returns a display name for a value from a constructor - * - * @param {object} value A value to examine - * @returns {(string|null)} A string or null - */ -declare function className(value: object): (string | null); diff --git a/node_modules/@sinonjs/commons/types/deprecated.d.ts b/node_modules/@sinonjs/commons/types/deprecated.d.ts deleted file mode 100644 index 81a35bf83..000000000 --- a/node_modules/@sinonjs/commons/types/deprecated.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function wrap(func: Function, msg: string): Function; -export function defaultMsg(packageName: string, funcName: string): string; -export function printWarning(msg: string): undefined; diff --git a/node_modules/@sinonjs/commons/types/every.d.ts b/node_modules/@sinonjs/commons/types/every.d.ts deleted file mode 100644 index bcfa64e01..000000000 --- a/node_modules/@sinonjs/commons/types/every.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare function _exports(obj: object, fn: Function): boolean; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/function-name.d.ts b/node_modules/@sinonjs/commons/types/function-name.d.ts deleted file mode 100644 index f27d519a9..000000000 --- a/node_modules/@sinonjs/commons/types/function-name.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare function _exports(func: Function): string; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/global.d.ts b/node_modules/@sinonjs/commons/types/global.d.ts deleted file mode 100644 index 0f54a635d..000000000 --- a/node_modules/@sinonjs/commons/types/global.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export = globalObject; -/** - * A reference to the global object - * - * @type {object} globalObject - */ -declare var globalObject: object; diff --git a/node_modules/@sinonjs/commons/types/index.d.ts b/node_modules/@sinonjs/commons/types/index.d.ts deleted file mode 100644 index 7d675b181..000000000 --- a/node_modules/@sinonjs/commons/types/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export const global: any; -export const calledInOrder: typeof import("./called-in-order"); -export const className: typeof import("./class-name"); -export const deprecated: typeof import("./deprecated"); -export const every: (obj: any, fn: Function) => boolean; -export const functionName: (func: Function) => string; -export const orderByFirstCall: typeof import("./order-by-first-call"); -export const prototypes: { - array: any; - function: any; - map: any; - object: any; - set: any; - string: any; -}; -export const typeOf: (value: any) => string; -export const valueToString: typeof import("./value-to-string"); diff --git a/node_modules/@sinonjs/commons/types/order-by-first-call.d.ts b/node_modules/@sinonjs/commons/types/order-by-first-call.d.ts deleted file mode 100644 index a9a6037d0..000000000 --- a/node_modules/@sinonjs/commons/types/order-by-first-call.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export = orderByFirstCall; -/** - * A Sinon proxy object (fake, spy, stub) - * - * @typedef {object} SinonProxy - * @property {Function} getCall - A method that can return the first call - */ -/** - * Sorts an array of SinonProxy instances (fake, spy, stub) by their first call - * - * @param {SinonProxy[] | SinonProxy} spies - * @returns {SinonProxy[]} - */ -declare function orderByFirstCall(spies: SinonProxy[] | SinonProxy): SinonProxy[]; -declare namespace orderByFirstCall { - export { SinonProxy }; -} -/** - * A Sinon proxy object (fake, spy, stub) - */ -type SinonProxy = { - /** - * - A method that can return the first call - */ - getCall: Function; -}; diff --git a/node_modules/@sinonjs/commons/types/prototypes/array.d.ts b/node_modules/@sinonjs/commons/types/prototypes/array.d.ts deleted file mode 100644 index 1cce63507..000000000 --- a/node_modules/@sinonjs/commons/types/prototypes/array.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _exports: any; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/prototypes/copy-prototype-methods.d.ts b/node_modules/@sinonjs/commons/types/prototypes/copy-prototype-methods.d.ts deleted file mode 100644 index 1479b93cf..000000000 --- a/node_modules/@sinonjs/commons/types/prototypes/copy-prototype-methods.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare function _exports(prototype: any): any; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/prototypes/function.d.ts b/node_modules/@sinonjs/commons/types/prototypes/function.d.ts deleted file mode 100644 index 1cce63507..000000000 --- a/node_modules/@sinonjs/commons/types/prototypes/function.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _exports: any; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/prototypes/index.d.ts b/node_modules/@sinonjs/commons/types/prototypes/index.d.ts deleted file mode 100644 index 0026d6c2f..000000000 --- a/node_modules/@sinonjs/commons/types/prototypes/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare const array: any; -declare const _function: any; -export { _function as function }; -export declare const map: any; -export declare const object: any; -export declare const set: any; -export declare const string: any; diff --git a/node_modules/@sinonjs/commons/types/prototypes/map.d.ts b/node_modules/@sinonjs/commons/types/prototypes/map.d.ts deleted file mode 100644 index 1cce63507..000000000 --- a/node_modules/@sinonjs/commons/types/prototypes/map.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _exports: any; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/prototypes/object.d.ts b/node_modules/@sinonjs/commons/types/prototypes/object.d.ts deleted file mode 100644 index 1cce63507..000000000 --- a/node_modules/@sinonjs/commons/types/prototypes/object.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _exports: any; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/prototypes/set.d.ts b/node_modules/@sinonjs/commons/types/prototypes/set.d.ts deleted file mode 100644 index 1cce63507..000000000 --- a/node_modules/@sinonjs/commons/types/prototypes/set.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _exports: any; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/prototypes/string.d.ts b/node_modules/@sinonjs/commons/types/prototypes/string.d.ts deleted file mode 100644 index 1cce63507..000000000 --- a/node_modules/@sinonjs/commons/types/prototypes/string.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _exports: any; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/prototypes/throws-on-proto.d.ts b/node_modules/@sinonjs/commons/types/prototypes/throws-on-proto.d.ts deleted file mode 100644 index 6cc97f4a1..000000000 --- a/node_modules/@sinonjs/commons/types/prototypes/throws-on-proto.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export = throwsOnProto; -/** - * Is true when the environment causes an error to be thrown for accessing the - * __proto__ property. - * - * This is necessary in order to support `node --disable-proto=throw`. - * - * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto - * - * @type {boolean} - */ -declare let throwsOnProto: boolean; diff --git a/node_modules/@sinonjs/commons/types/type-of.d.ts b/node_modules/@sinonjs/commons/types/type-of.d.ts deleted file mode 100644 index fc72887c0..000000000 --- a/node_modules/@sinonjs/commons/types/type-of.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare function _exports(value: any): string; -export = _exports; diff --git a/node_modules/@sinonjs/commons/types/value-to-string.d.ts b/node_modules/@sinonjs/commons/types/value-to-string.d.ts deleted file mode 100644 index 19b086cd2..000000000 --- a/node_modules/@sinonjs/commons/types/value-to-string.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export = valueToString; -/** - * Returns a string representation of the value - * - * @param {*} value - * @returns {string} - */ -declare function valueToString(value: any): string; diff --git a/node_modules/@sinonjs/fake-timers/LICENSE b/node_modules/@sinonjs/fake-timers/LICENSE deleted file mode 100644 index eb84755e1..000000000 --- a/node_modules/@sinonjs/fake-timers/LICENSE +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/node_modules/@sinonjs/fake-timers/README.md b/node_modules/@sinonjs/fake-timers/README.md deleted file mode 100644 index 049f06726..000000000 --- a/node_modules/@sinonjs/fake-timers/README.md +++ /dev/null @@ -1,358 +0,0 @@ -# `@sinonjs/fake-timers` - -[![codecov](https://codecov.io/gh/sinonjs/fake-timers/branch/main/graph/badge.svg)](https://codecov.io/gh/sinonjs/fake-timers) -Contributor Covenant - -JavaScript implementation of the timer APIs; `setTimeout`, `clearTimeout`, `setImmediate`, `clearImmediate`, `setInterval`, `clearInterval`, `requestAnimationFrame`, `cancelAnimationFrame`, `requestIdleCallback`, and `cancelIdleCallback`, along with a clock instance that controls the flow of time. FakeTimers also provides a `Date` implementation that gets its time from the clock. - -In addition in browser environment `@sinonjs/fake-timers` provides a `performance` implementation that gets its time from the clock. In Node environments FakeTimers provides a `nextTick` implementation that is synchronized with the clock - and a `process.hrtime` shim that works with the clock. - -`@sinonjs/fake-timers` can be used to simulate passing time in automated tests and other -situations where you want the scheduling semantics, but don't want to actually -wait. - -`@sinonjs/fake-timers` is extracted from [Sinon.JS](https://github.com/sinonjs/sinon.js) and targets the [same runtimes](https://sinonjs.org/releases/latest/#supported-runtimes). - -## Autocomplete, IntelliSense and TypeScript definitions - -Version 7 introduced JSDoc to the codebase. This should provide autocomplete and type suggestions in supporting IDEs. If you need more elaborate type support, TypeScript definitions for the Sinon projects are independently maintained by the Definitely Types community: - -``` -npm install -D @types/sinonjs__fake-timers -``` - -## Installation - -`@sinonjs/fake-timers` can be used in both Node and browser environments. Installation is as easy as - -```sh -npm install @sinonjs/fake-timers -``` - -If you want to use `@sinonjs/fake-timers` in a browser you can either build your own bundle or use [Skypack](https://www.skypack.dev). - -## Usage - -To use `@sinonjs/fake-timers`, create a new clock, schedule events on it using the timer -functions and pass time using the `tick` method. - -```js -// In the browser distribution, a global `FakeTimers` is already available -var FakeTimers = require("@sinonjs/fake-timers"); -var clock = FakeTimers.createClock(); - -clock.setTimeout(function () { - console.log( - "The poblano is a mild chili pepper originating in the state of Puebla, Mexico." - ); -}, 15); - -// ... - -clock.tick(15); -``` - -Upon executing the last line, an interesting fact about the -[Poblano](https://en.wikipedia.org/wiki/Poblano) will be printed synchronously to -the screen. If you want to simulate asynchronous behavior, please see the `async` function variants (eg `clock.tick(time)` vs `await clock.tickAsync(time)`). - -The `next`, `runAll`, `runToFrame`, and `runToLast` methods are available to advance the clock. See the -API Reference for more details. - -### Faking the native timers - -When using `@sinonjs/fake-timers` to test timers, you will most likely want to replace the native -timers such that calling `setTimeout` actually schedules a callback with your -clock instance, not the browser's internals. - -Calling `install` with no arguments achieves this. You can call `uninstall` -later to restore things as they were again. - -```js -// In the browser distribution, a global `FakeTimers` is already available -var FakeTimers = require("@sinonjs/fake-timers"); - -var clock = FakeTimers.install(); -// Equivalent to -// var clock = FakeTimers.install(typeof global !== "undefined" ? global : window); - -setTimeout(fn, 15); // Schedules with clock.setTimeout - -clock.uninstall(); -// setTimeout is restored to the native implementation -``` - -To hijack timers in another context pass it to the `install` method. - -```js -var FakeTimers = require("@sinonjs/fake-timers"); -var context = { - setTimeout: setTimeout, // By default context.setTimeout uses the global setTimeout -}; -var clock = FakeTimers.withGlobal(context).install(); - -context.setTimeout(fn, 15); // Schedules with clock.setTimeout - -clock.uninstall(); -// context.setTimeout is restored to the original implementation -``` - -Usually you want to install the timers onto the global object, so call `install` -without arguments. - -#### Automatically incrementing mocked time - -FakeTimers supports the possibility to attach the faked timers to any change -in the real system time. This means that there is no need to `tick()` the -clock in a situation where you won't know **when** to call `tick()`. - -Please note that this is achieved using the original setImmediate() API at a certain -configurable interval `config.advanceTimeDelta` (default: 20ms). Meaning time would -be incremented every 20ms, not in real time. - -An example would be: - -```js -var FakeTimers = require("@sinonjs/fake-timers"); -var clock = FakeTimers.install({ - shouldAdvanceTime: true, - advanceTimeDelta: 40, -}); - -setTimeout(() => { - console.log("this just timed out"); //executed after 40ms -}, 30); - -setImmediate(() => { - console.log("not so immediate"); //executed after 40ms -}); - -setTimeout(() => { - console.log("this timed out after"); //executed after 80ms - clock.uninstall(); -}, 50); -``` - -## API Reference - -### `var clock = FakeTimers.createClock([now[, loopLimit]])` - -Creates a clock. The default -[epoch](https://en.wikipedia.org/wiki/Epoch_%28reference_date%29) is `0`. - -The `now` argument may be a number (in milliseconds) or a Date object. - -The `loopLimit` argument sets the maximum number of timers that will be run when calling `runAll()` before assuming that we have an infinite loop and throwing an error. The default is `1000`. - -### `var clock = FakeTimers.install([config])` - -Installs FakeTimers using the specified config (otherwise with epoch `0` on the global scope). The following configuration options are available - -| Parameter | Type | Default | Description | -| -------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `config.now` | Number/Date | 0 | installs FakeTimers with the specified unix epoch | -| `config.toFake` | String[] | ["setTimeout", "clearTimeout", "setImmediate", "clearImmediate","setInterval", "clearInterval", "Date", "requestAnimationFrame", "cancelAnimationFrame", "requestIdleCallback", "cancelIdleCallback", "hrtime", "performance"] | an array with explicit function names (or objects, in the case of "performance") to hijack. _When not set, FakeTimers will automatically fake all methods **except** `nextTick`_ e.g., `FakeTimers.install({ toFake: ["setTimeout","nextTick"]})` will fake only `setTimeout` and `nextTick` | -| `config.loopLimit` | Number | 1000 | the maximum number of timers that will be run when calling runAll() | -| `config.shouldAdvanceTime` | Boolean | false | tells FakeTimers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by 20ms for every 20ms change in the real system time) | -| `config.advanceTimeDelta` | Number | 20 | relevant only when using with `shouldAdvanceTime: true`. increment mocked time by `advanceTimeDelta` ms every `advanceTimeDelta` ms change in the real system time. | -| `config.shouldClearNativeTimers` | Boolean | false | tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers. These are not cleared by default, leading to potentially unexpected behavior if timers existed prior to installing FakeTimers. | - -### `var id = clock.setTimeout(callback, timeout)` - -Schedules the callback to be fired once `timeout` milliseconds have ticked by. - -In Node.js `setTimeout` returns a timer object. FakeTimers will do the same, however -its `ref()` and `unref()` methods have no effect. - -In browsers a timer ID is returned. - -### `clock.clearTimeout(id)` - -Clears the timer given the ID or timer object, as long as it was created using -`setTimeout`. - -### `var id = clock.setInterval(callback, timeout)` - -Schedules the callback to be fired every time `timeout` milliseconds have ticked -by. - -In Node.js `setInterval` returns a timer object. FakeTimers will do the same, however -its `ref()` and `unref()` methods have no effect. - -In browsers a timer ID is returned. - -### `clock.clearInterval(id)` - -Clears the timer given the ID or timer object, as long as it was created using -`setInterval`. - -### `var id = clock.setImmediate(callback)` - -Schedules the callback to be fired once `0` milliseconds have ticked by. Note -that you'll still have to call `clock.tick()` for the callback to fire. If -called during a tick the callback won't fire until `1` millisecond has ticked -by. - -In Node.js `setImmediate` returns a timer object. FakeTimers will do the same, -however its `ref()` and `unref()` methods have no effect. - -In browsers a timer ID is returned. - -### `clock.clearImmediate(id)` - -Clears the timer given the ID or timer object, as long as it was created using -`setImmediate`. - -### `clock.requestAnimationFrame(callback)` - -Schedules the callback to be fired on the next animation frame, which runs every -16 ticks. Returns an `id` which can be used to cancel the callback. This is -available in both browser & node environments. - -### `clock.cancelAnimationFrame(id)` - -Cancels the callback scheduled by the provided id. - -### `clock.requestIdleCallback(callback[, timeout])` - -Queued the callback to be fired during idle periods to perform background and low priority work on the main event loop. Callbacks which have a timeout option will be fired no later than time in milliseconds. Returns an `id` which can be used to cancel the callback. - -### `clock.cancelIdleCallback(id)` - -Cancels the callback scheduled by the provided id. - -### `clock.countTimers()` - -Returns the number of waiting timers. This can be used to assert that a test -finishes without leaking any timers. - -### `clock.hrtime(prevTime?)` - -Only available in Node.js, mimicks process.hrtime(). - -### `clock.nextTick(callback)` - -Only available in Node.js, mimics `process.nextTick` to enable completely synchronous testing flows. - -### `clock.performance.now()` - -Only available in browser environments, mimicks performance.now(). - -### `clock.tick(time)` / `await clock.tickAsync(time)` - -Advance the clock, firing callbacks if necessary. `time` may be the number of -milliseconds to advance the clock by or a human-readable string. Valid string -formats are `"08"` for eight seconds, `"01:00"` for one minute and `"02:34:10"` -for two hours, 34 minutes and ten seconds. - -The `tickAsync()` will also break the event loop, allowing any scheduled promise -callbacks to execute _before_ running the timers. - -### `clock.next()` / `await clock.nextAsync()` - -Advances the clock to the the moment of the first scheduled timer, firing it. - -The `nextAsync()` will also break the event loop, allowing any scheduled promise -callbacks to execute _before_ running the timers. - -### `clock.jump(time)` - -Advance the clock by jumping forward in time, firing callbacks at most once. -`time` takes the same formats as [`clock.tick`](#clockticktime--await-clocktickasynctime). - -This can be used to simulate the JS engine (such as a browser) being put to sleep and resumed later, skipping intermediary timers. - -### `clock.reset()` - -Removes all timers and ticks without firing them, and sets `now` to `config.now` -that was provided to `FakeTimers.install` or to `0` if `config.now` was not provided. -Useful to reset the state of the clock without having to `uninstall` and `install` it. - -### `clock.runAll()` / `await clock.runAllAsync()` - -This runs all pending timers until there are none remaining. If new timers are added while it is executing they will be run as well. - -This makes it easier to run asynchronous tests to completion without worrying about the number of timers they use, or the delays in those timers. - -It runs a maximum of `loopLimit` times after which it assumes there is an infinite loop of timers and throws an error. - -The `runAllAsync()` will also break the event loop, allowing any scheduled promise -callbacks to execute _before_ running the timers. - -### `clock.runMicrotasks()` - -This runs all pending microtasks scheduled with `nextTick` but none of the timers and is mostly useful for libraries using FakeTimers underneath and for running `nextTick` items without any timers. - -### `clock.runToFrame()` - -Advances the clock to the next frame, firing all scheduled animation frame callbacks, -if any, for that frame as well as any other timers scheduled along the way. - -### `clock.runToLast()` / `await clock.runToLastAsync()` - -This takes note of the last scheduled timer when it is run, and advances the -clock to that time firing callbacks as necessary. - -If new timers are added while it is executing they will be run only if they -would occur before this time. - -This is useful when you want to run a test to completion, but the test recursively -sets timers that would cause `runAll` to trigger an infinite loop warning. - -The `runToLastAsync()` will also break the event loop, allowing any scheduled promise -callbacks to execute _before_ running the timers. - -### `clock.setSystemTime([now])` - -This simulates a user changing the system clock while your program is running. -It affects the current time but it does not in itself cause e.g. timers to fire; -they will fire exactly as they would have done without the call to -setSystemTime(). - -### `clock.uninstall()` - -Restores the original methods of the native timers or the methods on the object -that was passed to `FakeTimers.withGlobal` - -### `Date` - -Implements the `Date` object but using the clock to provide the correct time. - -### `Performance` - -Implements the `now` method of the [`Performance`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) object but using the clock to provide the correct time. Only available in environments that support the Performance object (browsers mostly). - -### `FakeTimers.withGlobal` - -In order to support creating clocks based on separate or sandboxed environments (such as JSDOM), FakeTimers exports a factory method which takes single argument `global`, which it inspects to figure out what to mock and what features to support. When invoking this function with a global, you will get back an object with `timers`, `createClock` and `install` - same as the regular FakeTimers exports only based on the passed in global instead of the global environment. - -## Running tests - -FakeTimers has a comprehensive test suite. If you're thinking of contributing bug -fixes or suggesting new features, you need to make sure you have not broken any -tests. You are also expected to add tests for any new behavior. - -### On node: - -```sh -npm test -``` - -Or, if you prefer more verbose output: - -``` -$(npm bin)/mocha ./test/fake-timers-test.js -``` - -### In the browser - -[Mochify](https://github.com/mantoni/mochify.js) is used to run the tests in -PhantomJS. Make sure you have `phantomjs` installed. Then: - -```sh -npm test-headless -``` - -## License - -BSD 3-clause "New" or "Revised" License (see LICENSE file) diff --git a/node_modules/@sinonjs/fake-timers/package.json b/node_modules/@sinonjs/fake-timers/package.json deleted file mode 100644 index 4fd91fcb9..000000000 --- a/node_modules/@sinonjs/fake-timers/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@sinonjs/fake-timers", - "description": "Fake JavaScript timers", - "version": "10.1.0", - "homepage": "https://github.com/sinonjs/fake-timers", - "author": "Christian Johansen", - "repository": { - "type": "git", - "url": "https://github.com/sinonjs/fake-timers.git" - }, - "bugs": { - "mail": "christian@cjohansen.no", - "url": "https://github.com/sinonjs/fake-timers/issues" - }, - "license": "BSD-3-Clause", - "scripts": { - "lint": "eslint .", - "test-node": "mocha --timeout 200 test/ integration-test/ -R dot --check-leaks", - "test-headless": "mochify --no-detect-globals --timeout=10000", - "test-check-coverage": "npm run test-coverage && nyc check-coverage", - "test-cloud": "mochify --wd --no-detect-globals --timeout=10000", - "test-coverage": "nyc --all --reporter text --reporter html --reporter lcovonly npm run test-node", - "test": "npm run test-node && npm run test-headless", - "prettier:check": "prettier --check '**/*.{js,css,md}'", - "prettier:write": "prettier --write '**/*.{js,css,md}'", - "preversion": "./scripts/preversion.sh", - "version": "./scripts/version.sh", - "postversion": "./scripts/postversion.sh", - "prepare": "husky install" - }, - "lint-staged": { - "*.{js,css,md}": "prettier --check", - "*.js": "eslint" - }, - "files": [ - "src/" - ], - "devDependencies": { - "@sinonjs/eslint-config": "^4.1.0", - "@sinonjs/referee-sinon": "11.0.0", - "husky": "^8.0.3", - "jsdom": "22.0.0", - "lint-staged": "13.2.2", - "mocha": "10.2.0", - "mochify": "9.2.0", - "nyc": "15.1.0", - "prettier": "2.8.8" - }, - "main": "./src/fake-timers-src.js", - "dependencies": { - "@sinonjs/commons": "^3.0.0" - }, - "nyc": { - "branches": 85, - "lines": 92, - "functions": 92, - "statements": 92, - "exclude": [ - "**/*-test.js", - "coverage/**", - "types/**", - "fake-timers.js" - ] - } -} diff --git a/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js b/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js deleted file mode 100644 index 607d91fb1..000000000 --- a/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js +++ /dev/null @@ -1,1787 +0,0 @@ -"use strict"; - -const globalObject = require("@sinonjs/commons").global; - -/** - * @typedef {object} IdleDeadline - * @property {boolean} didTimeout - whether or not the callback was called before reaching the optional timeout - * @property {function():number} timeRemaining - a floating-point value providing an estimate of the number of milliseconds remaining in the current idle period - */ - -/** - * Queues a function to be called during a browser's idle periods - * - * @callback RequestIdleCallback - * @param {function(IdleDeadline)} callback - * @param {{timeout: number}} options - an options object - * @returns {number} the id - */ - -/** - * @callback NextTick - * @param {VoidVarArgsFunc} callback - the callback to run - * @param {...*} arguments - optional arguments to call the callback with - * @returns {void} - */ - -/** - * @callback SetImmediate - * @param {VoidVarArgsFunc} callback - the callback to run - * @param {...*} arguments - optional arguments to call the callback with - * @returns {NodeImmediate} - */ - -/** - * @callback VoidVarArgsFunc - * @param {...*} callback - the callback to run - * @returns {void} - */ - -/** - * @typedef RequestAnimationFrame - * @property {function(number):void} requestAnimationFrame - * @returns {number} - the id - */ - -/** - * @typedef Performance - * @property {function(): number} now - */ - -/* eslint-disable jsdoc/require-property-description */ -/** - * @typedef {object} Clock - * @property {number} now - the current time - * @property {Date} Date - the Date constructor - * @property {number} loopLimit - the maximum number of timers before assuming an infinite loop - * @property {RequestIdleCallback} requestIdleCallback - * @property {function(number):void} cancelIdleCallback - * @property {setTimeout} setTimeout - * @property {clearTimeout} clearTimeout - * @property {NextTick} nextTick - * @property {queueMicrotask} queueMicrotask - * @property {setInterval} setInterval - * @property {clearInterval} clearInterval - * @property {SetImmediate} setImmediate - * @property {function(NodeImmediate):void} clearImmediate - * @property {function():number} countTimers - * @property {RequestAnimationFrame} requestAnimationFrame - * @property {function(number):void} cancelAnimationFrame - * @property {function():void} runMicrotasks - * @property {function(string | number): number} tick - * @property {function(string | number): Promise} tickAsync - * @property {function(): number} next - * @property {function(): Promise} nextAsync - * @property {function(): number} runAll - * @property {function(): number} runToFrame - * @property {function(): Promise} runAllAsync - * @property {function(): number} runToLast - * @property {function(): Promise} runToLastAsync - * @property {function(): void} reset - * @property {function(number | Date): void} setSystemTime - * @property {function(number): void} jump - * @property {Performance} performance - * @property {function(number[]): number[]} hrtime - process.hrtime (legacy) - * @property {function(): void} uninstall Uninstall the clock. - * @property {Function[]} methods - the methods that are faked - * @property {boolean} [shouldClearNativeTimers] inherited from config - */ -/* eslint-enable jsdoc/require-property-description */ - -/** - * Configuration object for the `install` method. - * - * @typedef {object} Config - * @property {number|Date} [now] a number (in milliseconds) or a Date object (default epoch) - * @property {string[]} [toFake] names of the methods that should be faked. - * @property {number} [loopLimit] the maximum number of timers that will be run when calling runAll() - * @property {boolean} [shouldAdvanceTime] tells FakeTimers to increment mocked time automatically (default false) - * @property {number} [advanceTimeDelta] increment mocked time every <> ms (default: 20ms) - * @property {boolean} [shouldClearNativeTimers] forwards clear timer calls to native functions if they are not fakes (default: false) - */ - -/* eslint-disable jsdoc/require-property-description */ -/** - * The internal structure to describe a scheduled fake timer - * - * @typedef {object} Timer - * @property {Function} func - * @property {*[]} args - * @property {number} delay - * @property {number} callAt - * @property {number} createdAt - * @property {boolean} immediate - * @property {number} id - * @property {Error} [error] - */ - -/** - * A Node timer - * - * @typedef {object} NodeImmediate - * @property {function(): boolean} hasRef - * @property {function(): NodeImmediate} ref - * @property {function(): NodeImmediate} unref - */ -/* eslint-enable jsdoc/require-property-description */ - -/* eslint-disable complexity */ - -/** - * Mocks available features in the specified global namespace. - * - * @param {*} _global Namespace to mock (e.g. `window`) - * @returns {FakeTimers} - */ -function withGlobal(_global) { - const userAgent = _global.navigator && _global.navigator.userAgent; - const isRunningInIE = userAgent && userAgent.indexOf("MSIE ") > -1; - const maxTimeout = Math.pow(2, 31) - 1; //see https://heycam.github.io/webidl/#abstract-opdef-converttoint - const idCounterStart = 1e12; // arbitrarily large number to avoid collisions with native timer IDs - const NOOP = function () { - return undefined; - }; - const NOOP_ARRAY = function () { - return []; - }; - const timeoutResult = _global.setTimeout(NOOP, 0); - const addTimerReturnsObject = typeof timeoutResult === "object"; - const hrtimePresent = - _global.process && typeof _global.process.hrtime === "function"; - const hrtimeBigintPresent = - hrtimePresent && typeof _global.process.hrtime.bigint === "function"; - const nextTickPresent = - _global.process && typeof _global.process.nextTick === "function"; - const utilPromisify = _global.process && require("util").promisify; - const performancePresent = - _global.performance && typeof _global.performance.now === "function"; - const hasPerformancePrototype = - _global.Performance && - (typeof _global.Performance).match(/^(function|object)$/); - const hasPerformanceConstructorPrototype = - _global.performance && - _global.performance.constructor && - _global.performance.constructor.prototype; - const queueMicrotaskPresent = _global.hasOwnProperty("queueMicrotask"); - const requestAnimationFramePresent = - _global.requestAnimationFrame && - typeof _global.requestAnimationFrame === "function"; - const cancelAnimationFramePresent = - _global.cancelAnimationFrame && - typeof _global.cancelAnimationFrame === "function"; - const requestIdleCallbackPresent = - _global.requestIdleCallback && - typeof _global.requestIdleCallback === "function"; - const cancelIdleCallbackPresent = - _global.cancelIdleCallback && - typeof _global.cancelIdleCallback === "function"; - const setImmediatePresent = - _global.setImmediate && typeof _global.setImmediate === "function"; - - // Make properties writable in IE, as per - // https://www.adequatelygood.com/Replacing-setTimeout-Globally.html - /* eslint-disable no-self-assign */ - if (isRunningInIE) { - _global.setTimeout = _global.setTimeout; - _global.clearTimeout = _global.clearTimeout; - _global.setInterval = _global.setInterval; - _global.clearInterval = _global.clearInterval; - _global.Date = _global.Date; - } - - // setImmediate is not a standard function - // avoid adding the prop to the window object if not present - if (setImmediatePresent) { - _global.setImmediate = _global.setImmediate; - _global.clearImmediate = _global.clearImmediate; - } - /* eslint-enable no-self-assign */ - - _global.clearTimeout(timeoutResult); - - const NativeDate = _global.Date; - let uniqueTimerId = idCounterStart; - - /** - * @param {number} num - * @returns {boolean} - */ - function isNumberFinite(num) { - if (Number.isFinite) { - return Number.isFinite(num); - } - - return isFinite(num); - } - - let isNearInfiniteLimit = false; - - /** - * @param {Clock} clock - * @param {number} i - */ - function checkIsNearInfiniteLimit(clock, i) { - if (clock.loopLimit && i === clock.loopLimit - 1) { - isNearInfiniteLimit = true; - } - } - - /** - * - */ - function resetIsNearInfiniteLimit() { - isNearInfiniteLimit = false; - } - - /** - * Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into - * number of milliseconds. This is used to support human-readable strings passed - * to clock.tick() - * - * @param {string} str - * @returns {number} - */ - function parseTime(str) { - if (!str) { - return 0; - } - - const strings = str.split(":"); - const l = strings.length; - let i = l; - let ms = 0; - let parsed; - - if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) { - throw new Error( - "tick only understands numbers, 'm:s' and 'h:m:s'. Each part must be two digits" - ); - } - - while (i--) { - parsed = parseInt(strings[i], 10); - - if (parsed >= 60) { - throw new Error(`Invalid time ${str}`); - } - - ms += parsed * Math.pow(60, l - i - 1); - } - - return ms * 1000; - } - - /** - * Get the decimal part of the millisecond value as nanoseconds - * - * @param {number} msFloat the number of milliseconds - * @returns {number} an integer number of nanoseconds in the range [0,1e6) - * - * Example: nanoRemainer(123.456789) -> 456789 - */ - function nanoRemainder(msFloat) { - const modulo = 1e6; - const remainder = (msFloat * 1e6) % modulo; - const positiveRemainder = - remainder < 0 ? remainder + modulo : remainder; - - return Math.floor(positiveRemainder); - } - - /** - * Used to grok the `now` parameter to createClock. - * - * @param {Date|number} epoch the system time - * @returns {number} - */ - function getEpoch(epoch) { - if (!epoch) { - return 0; - } - if (typeof epoch.getTime === "function") { - return epoch.getTime(); - } - if (typeof epoch === "number") { - return epoch; - } - throw new TypeError("now should be milliseconds since UNIX epoch"); - } - - /** - * @param {number} from - * @param {number} to - * @param {Timer} timer - * @returns {boolean} - */ - function inRange(from, to, timer) { - return timer && timer.callAt >= from && timer.callAt <= to; - } - - /** - * @param {Clock} clock - * @param {Timer} job - */ - function getInfiniteLoopError(clock, job) { - const infiniteLoopError = new Error( - `Aborting after running ${clock.loopLimit} timers, assuming an infinite loop!` - ); - - if (!job.error) { - return infiniteLoopError; - } - - // pattern never matched in Node - const computedTargetPattern = /target\.*[<|(|[].*?[>|\]|)]\s*/; - let clockMethodPattern = new RegExp( - String(Object.keys(clock).join("|")) - ); - - if (addTimerReturnsObject) { - // node.js environment - clockMethodPattern = new RegExp( - `\\s+at (Object\\.)?(?:${Object.keys(clock).join("|")})\\s+` - ); - } - - let matchedLineIndex = -1; - job.error.stack.split("\n").some(function (line, i) { - // If we've matched a computed target line (e.g. setTimeout) then we - // don't need to look any further. Return true to stop iterating. - const matchedComputedTarget = line.match(computedTargetPattern); - /* istanbul ignore if */ - if (matchedComputedTarget) { - matchedLineIndex = i; - return true; - } - - // If we've matched a clock method line, then there may still be - // others further down the trace. Return false to keep iterating. - const matchedClockMethod = line.match(clockMethodPattern); - if (matchedClockMethod) { - matchedLineIndex = i; - return false; - } - - // If we haven't matched anything on this line, but we matched - // previously and set the matched line index, then we can stop. - // If we haven't matched previously, then we should keep iterating. - return matchedLineIndex >= 0; - }); - - const stack = `${infiniteLoopError}\n${job.type || "Microtask"} - ${ - job.func.name || "anonymous" - }\n${job.error.stack - .split("\n") - .slice(matchedLineIndex + 1) - .join("\n")}`; - - try { - Object.defineProperty(infiniteLoopError, "stack", { - value: stack, - }); - } catch (e) { - // noop - } - - return infiniteLoopError; - } - - /** - * @param {Date} target - * @param {Date} source - * @returns {Date} the target after modifications - */ - function mirrorDateProperties(target, source) { - let prop; - for (prop in source) { - if (source.hasOwnProperty(prop)) { - target[prop] = source[prop]; - } - } - - // set special now implementation - if (source.now) { - target.now = function now() { - return target.clock.now; - }; - } else { - delete target.now; - } - - // set special toSource implementation - if (source.toSource) { - target.toSource = function toSource() { - return source.toSource(); - }; - } else { - delete target.toSource; - } - - // set special toString implementation - target.toString = function toString() { - return source.toString(); - }; - - target.prototype = source.prototype; - target.parse = source.parse; - target.UTC = source.UTC; - target.prototype.toUTCString = source.prototype.toUTCString; - target.isFake = true; - - return target; - } - - //eslint-disable-next-line jsdoc/require-jsdoc - function createDate() { - /** - * @param {number} year - * @param {number} month - * @param {number} date - * @param {number} hour - * @param {number} minute - * @param {number} second - * @param {number} ms - * @returns {Date} - */ - function ClockDate(year, month, date, hour, minute, second, ms) { - // the Date constructor called as a function, ref Ecma-262 Edition 5.1, section 15.9.2. - // This remains so in the 10th edition of 2019 as well. - if (!(this instanceof ClockDate)) { - return new NativeDate(ClockDate.clock.now).toString(); - } - - // if Date is called as a constructor with 'new' keyword - // Defensive and verbose to avoid potential harm in passing - // explicit undefined when user does not pass argument - switch (arguments.length) { - case 0: - return new NativeDate(ClockDate.clock.now); - case 1: - return new NativeDate(year); - case 2: - return new NativeDate(year, month); - case 3: - return new NativeDate(year, month, date); - case 4: - return new NativeDate(year, month, date, hour); - case 5: - return new NativeDate(year, month, date, hour, minute); - case 6: - return new NativeDate( - year, - month, - date, - hour, - minute, - second - ); - default: - return new NativeDate( - year, - month, - date, - hour, - minute, - second, - ms - ); - } - } - - return mirrorDateProperties(ClockDate, NativeDate); - } - - //eslint-disable-next-line jsdoc/require-jsdoc - function enqueueJob(clock, job) { - // enqueues a microtick-deferred task - ecma262/#sec-enqueuejob - if (!clock.jobs) { - clock.jobs = []; - } - clock.jobs.push(job); - } - - //eslint-disable-next-line jsdoc/require-jsdoc - function runJobs(clock) { - // runs all microtick-deferred tasks - ecma262/#sec-runjobs - if (!clock.jobs) { - return; - } - for (let i = 0; i < clock.jobs.length; i++) { - const job = clock.jobs[i]; - job.func.apply(null, job.args); - - checkIsNearInfiniteLimit(clock, i); - if (clock.loopLimit && i > clock.loopLimit) { - throw getInfiniteLoopError(clock, job); - } - } - resetIsNearInfiniteLimit(); - clock.jobs = []; - } - - /** - * @param {Clock} clock - * @param {Timer} timer - * @returns {number} id of the created timer - */ - function addTimer(clock, timer) { - if (timer.func === undefined) { - throw new Error("Callback must be provided to timer calls"); - } - - if (addTimerReturnsObject) { - // Node.js environment - if (typeof timer.func !== "function") { - throw new TypeError( - `[ERR_INVALID_CALLBACK]: Callback must be a function. Received ${ - timer.func - } of type ${typeof timer.func}` - ); - } - } - - if (isNearInfiniteLimit) { - timer.error = new Error(); - } - - timer.type = timer.immediate ? "Immediate" : "Timeout"; - - if (timer.hasOwnProperty("delay")) { - if (typeof timer.delay !== "number") { - timer.delay = parseInt(timer.delay, 10); - } - - if (!isNumberFinite(timer.delay)) { - timer.delay = 0; - } - timer.delay = timer.delay > maxTimeout ? 1 : timer.delay; - timer.delay = Math.max(0, timer.delay); - } - - if (timer.hasOwnProperty("interval")) { - timer.type = "Interval"; - timer.interval = timer.interval > maxTimeout ? 1 : timer.interval; - } - - if (timer.hasOwnProperty("animation")) { - timer.type = "AnimationFrame"; - timer.animation = true; - } - - if (timer.hasOwnProperty("idleCallback")) { - timer.type = "IdleCallback"; - timer.idleCallback = true; - } - - if (!clock.timers) { - clock.timers = {}; - } - - timer.id = uniqueTimerId++; - timer.createdAt = clock.now; - timer.callAt = - clock.now + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0)); - - clock.timers[timer.id] = timer; - - if (addTimerReturnsObject) { - const res = { - refed: true, - ref: function () { - this.refed = true; - return res; - }, - unref: function () { - this.refed = false; - return res; - }, - hasRef: function () { - return this.refed; - }, - refresh: function () { - timer.callAt = - clock.now + - (parseInt(timer.delay) || (clock.duringTick ? 1 : 0)); - - // it _might_ have been removed, but if not the assignment is perfectly fine - clock.timers[timer.id] = timer; - - return res; - }, - [Symbol.toPrimitive]: function () { - return timer.id; - }, - }; - return res; - } - - return timer.id; - } - - /* eslint consistent-return: "off" */ - /** - * Timer comparitor - * - * @param {Timer} a - * @param {Timer} b - * @returns {number} - */ - function compareTimers(a, b) { - // Sort first by absolute timing - if (a.callAt < b.callAt) { - return -1; - } - if (a.callAt > b.callAt) { - return 1; - } - - // Sort next by immediate, immediate timers take precedence - if (a.immediate && !b.immediate) { - return -1; - } - if (!a.immediate && b.immediate) { - return 1; - } - - // Sort next by creation time, earlier-created timers take precedence - if (a.createdAt < b.createdAt) { - return -1; - } - if (a.createdAt > b.createdAt) { - return 1; - } - - // Sort next by id, lower-id timers take precedence - if (a.id < b.id) { - return -1; - } - if (a.id > b.id) { - return 1; - } - - // As timer ids are unique, no fallback `0` is necessary - } - - /** - * @param {Clock} clock - * @param {number} from - * @param {number} to - * @returns {Timer} - */ - function firstTimerInRange(clock, from, to) { - const timers = clock.timers; - let timer = null; - let id, isInRange; - - for (id in timers) { - if (timers.hasOwnProperty(id)) { - isInRange = inRange(from, to, timers[id]); - - if ( - isInRange && - (!timer || compareTimers(timer, timers[id]) === 1) - ) { - timer = timers[id]; - } - } - } - - return timer; - } - - /** - * @param {Clock} clock - * @returns {Timer} - */ - function firstTimer(clock) { - const timers = clock.timers; - let timer = null; - let id; - - for (id in timers) { - if (timers.hasOwnProperty(id)) { - if (!timer || compareTimers(timer, timers[id]) === 1) { - timer = timers[id]; - } - } - } - - return timer; - } - - /** - * @param {Clock} clock - * @returns {Timer} - */ - function lastTimer(clock) { - const timers = clock.timers; - let timer = null; - let id; - - for (id in timers) { - if (timers.hasOwnProperty(id)) { - if (!timer || compareTimers(timer, timers[id]) === -1) { - timer = timers[id]; - } - } - } - - return timer; - } - - /** - * @param {Clock} clock - * @param {Timer} timer - */ - function callTimer(clock, timer) { - if (typeof timer.interval === "number") { - clock.timers[timer.id].callAt += timer.interval; - } else { - delete clock.timers[timer.id]; - } - - if (typeof timer.func === "function") { - timer.func.apply(null, timer.args); - } else { - /* eslint no-eval: "off" */ - const eval2 = eval; - (function () { - eval2(timer.func); - })(); - } - } - - /** - * Gets clear handler name for a given timer type - * - * @param {string} ttype - */ - function getClearHandler(ttype) { - if (ttype === "IdleCallback" || ttype === "AnimationFrame") { - return `cancel${ttype}`; - } - return `clear${ttype}`; - } - - /** - * Gets schedule handler name for a given timer type - * - * @param {string} ttype - */ - function getScheduleHandler(ttype) { - if (ttype === "IdleCallback" || ttype === "AnimationFrame") { - return `request${ttype}`; - } - return `set${ttype}`; - } - - /** - * Creates an anonymous function to warn only once - */ - function createWarnOnce() { - let calls = 0; - return function (msg) { - // eslint-disable-next-line - !calls++ && console.warn(msg); - }; - } - const warnOnce = createWarnOnce(); - - /** - * @param {Clock} clock - * @param {number} timerId - * @param {string} ttype - */ - function clearTimer(clock, timerId, ttype) { - if (!timerId) { - // null appears to be allowed in most browsers, and appears to be - // relied upon by some libraries, like Bootstrap carousel - return; - } - - if (!clock.timers) { - clock.timers = {}; - } - - // in Node, the ID is stored as the primitive value for `Timeout` objects - // for `Immediate` objects, no ID exists, so it gets coerced to NaN - const id = Number(timerId); - - if (Number.isNaN(id) || id < idCounterStart) { - const handlerName = getClearHandler(ttype); - - if (clock.shouldClearNativeTimers === true) { - const nativeHandler = clock[`_${handlerName}`]; - return typeof nativeHandler === "function" - ? nativeHandler(timerId) - : undefined; - } - warnOnce( - `FakeTimers: ${handlerName} was invoked to clear a native timer instead of one created by this library.` + - "\nTo automatically clean-up native timers, use `shouldClearNativeTimers`." - ); - } - - if (clock.timers.hasOwnProperty(id)) { - // check that the ID matches a timer of the correct type - const timer = clock.timers[id]; - if ( - timer.type === ttype || - (timer.type === "Timeout" && ttype === "Interval") || - (timer.type === "Interval" && ttype === "Timeout") - ) { - delete clock.timers[id]; - } else { - const clear = getClearHandler(ttype); - const schedule = getScheduleHandler(timer.type); - throw new Error( - `Cannot clear timer: timer created with ${schedule}() but cleared with ${clear}()` - ); - } - } - } - - /** - * @param {Clock} clock - * @param {Config} config - * @returns {Timer[]} - */ - function uninstall(clock, config) { - let method, i, l; - const installedHrTime = "_hrtime"; - const installedNextTick = "_nextTick"; - - for (i = 0, l = clock.methods.length; i < l; i++) { - method = clock.methods[i]; - if (method === "hrtime" && _global.process) { - _global.process.hrtime = clock[installedHrTime]; - } else if (method === "nextTick" && _global.process) { - _global.process.nextTick = clock[installedNextTick]; - } else if (method === "performance") { - const originalPerfDescriptor = Object.getOwnPropertyDescriptor( - clock, - `_${method}` - ); - if ( - originalPerfDescriptor && - originalPerfDescriptor.get && - !originalPerfDescriptor.set - ) { - Object.defineProperty( - _global, - method, - originalPerfDescriptor - ); - } else if (originalPerfDescriptor.configurable) { - _global[method] = clock[`_${method}`]; - } - } else { - if (_global[method] && _global[method].hadOwnProperty) { - _global[method] = clock[`_${method}`]; - } else { - try { - delete _global[method]; - } catch (ignore) { - /* eslint no-empty: "off" */ - } - } - } - } - - if (config.shouldAdvanceTime === true) { - _global.clearInterval(clock.attachedInterval); - } - - // Prevent multiple executions which will completely remove these props - clock.methods = []; - - // return pending timers, to enable checking what timers remained on uninstall - if (!clock.timers) { - return []; - } - return Object.keys(clock.timers).map(function mapper(key) { - return clock.timers[key]; - }); - } - - /** - * @param {object} target the target containing the method to replace - * @param {string} method the keyname of the method on the target - * @param {Clock} clock - */ - function hijackMethod(target, method, clock) { - clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call( - target, - method - ); - clock[`_${method}`] = target[method]; - - if (method === "Date") { - const date = mirrorDateProperties(clock[method], target[method]); - target[method] = date; - } else if (method === "performance") { - const originalPerfDescriptor = Object.getOwnPropertyDescriptor( - target, - method - ); - // JSDOM has a read only performance field so we have to save/copy it differently - if ( - originalPerfDescriptor && - originalPerfDescriptor.get && - !originalPerfDescriptor.set - ) { - Object.defineProperty( - clock, - `_${method}`, - originalPerfDescriptor - ); - - const perfDescriptor = Object.getOwnPropertyDescriptor( - clock, - method - ); - Object.defineProperty(target, method, perfDescriptor); - } else { - target[method] = clock[method]; - } - } else { - target[method] = function () { - return clock[method].apply(clock, arguments); - }; - - Object.defineProperties( - target[method], - Object.getOwnPropertyDescriptors(clock[method]) - ); - } - - target[method].clock = clock; - } - - /** - * @param {Clock} clock - * @param {number} advanceTimeDelta - */ - function doIntervalTick(clock, advanceTimeDelta) { - clock.tick(advanceTimeDelta); - } - - /** - * @typedef {object} Timers - * @property {setTimeout} setTimeout - * @property {clearTimeout} clearTimeout - * @property {setInterval} setInterval - * @property {clearInterval} clearInterval - * @property {Date} Date - * @property {SetImmediate=} setImmediate - * @property {function(NodeImmediate): void=} clearImmediate - * @property {function(number[]):number[]=} hrtime - * @property {NextTick=} nextTick - * @property {Performance=} performance - * @property {RequestAnimationFrame=} requestAnimationFrame - * @property {boolean=} queueMicrotask - * @property {function(number): void=} cancelAnimationFrame - * @property {RequestIdleCallback=} requestIdleCallback - * @property {function(number): void=} cancelIdleCallback - */ - - /** @type {Timers} */ - const timers = { - setTimeout: _global.setTimeout, - clearTimeout: _global.clearTimeout, - setInterval: _global.setInterval, - clearInterval: _global.clearInterval, - Date: _global.Date, - }; - - if (setImmediatePresent) { - timers.setImmediate = _global.setImmediate; - timers.clearImmediate = _global.clearImmediate; - } - - if (hrtimePresent) { - timers.hrtime = _global.process.hrtime; - } - - if (nextTickPresent) { - timers.nextTick = _global.process.nextTick; - } - - if (performancePresent) { - timers.performance = _global.performance; - } - - if (requestAnimationFramePresent) { - timers.requestAnimationFrame = _global.requestAnimationFrame; - } - - if (queueMicrotaskPresent) { - timers.queueMicrotask = true; - } - - if (cancelAnimationFramePresent) { - timers.cancelAnimationFrame = _global.cancelAnimationFrame; - } - - if (requestIdleCallbackPresent) { - timers.requestIdleCallback = _global.requestIdleCallback; - } - - if (cancelIdleCallbackPresent) { - timers.cancelIdleCallback = _global.cancelIdleCallback; - } - - const originalSetTimeout = _global.setImmediate || _global.setTimeout; - - /** - * @param {Date|number} [start] the system time - non-integer values are floored - * @param {number} [loopLimit] maximum number of timers that will be run when calling runAll() - * @returns {Clock} - */ - function createClock(start, loopLimit) { - // eslint-disable-next-line no-param-reassign - start = Math.floor(getEpoch(start)); - // eslint-disable-next-line no-param-reassign - loopLimit = loopLimit || 1000; - let nanos = 0; - const adjustedSystemTime = [0, 0]; // [millis, nanoremainder] - - if (NativeDate === undefined) { - throw new Error( - "The global scope doesn't have a `Date` object" + - " (see https://github.com/sinonjs/sinon/issues/1852#issuecomment-419622780)" - ); - } - - const clock = { - now: start, - Date: createDate(), - loopLimit: loopLimit, - }; - - clock.Date.clock = clock; - - //eslint-disable-next-line jsdoc/require-jsdoc - function getTimeToNextFrame() { - return 16 - ((clock.now - start) % 16); - } - - //eslint-disable-next-line jsdoc/require-jsdoc - function hrtime(prev) { - const millisSinceStart = clock.now - adjustedSystemTime[0] - start; - const secsSinceStart = Math.floor(millisSinceStart / 1000); - const remainderInNanos = - (millisSinceStart - secsSinceStart * 1e3) * 1e6 + - nanos - - adjustedSystemTime[1]; - - if (Array.isArray(prev)) { - if (prev[1] > 1e9) { - throw new TypeError( - "Number of nanoseconds can't exceed a billion" - ); - } - - const oldSecs = prev[0]; - let nanoDiff = remainderInNanos - prev[1]; - let secDiff = secsSinceStart - oldSecs; - - if (nanoDiff < 0) { - nanoDiff += 1e9; - secDiff -= 1; - } - - return [secDiff, nanoDiff]; - } - return [secsSinceStart, remainderInNanos]; - } - - function fakePerformanceNow() { - const hrt = hrtime(); - const millis = hrt[0] * 1000 + hrt[1] / 1e6; - return millis; - } - - if (hrtimeBigintPresent) { - hrtime.bigint = function () { - const parts = hrtime(); - return BigInt(parts[0]) * BigInt(1e9) + BigInt(parts[1]); // eslint-disable-line - }; - } - - clock.requestIdleCallback = function requestIdleCallback( - func, - timeout - ) { - let timeToNextIdlePeriod = 0; - - if (clock.countTimers() > 0) { - timeToNextIdlePeriod = 50; // const for now - } - - const result = addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 2), - delay: - typeof timeout === "undefined" - ? timeToNextIdlePeriod - : Math.min(timeout, timeToNextIdlePeriod), - idleCallback: true, - }); - - return Number(result); - }; - - clock.cancelIdleCallback = function cancelIdleCallback(timerId) { - return clearTimer(clock, timerId, "IdleCallback"); - }; - - clock.setTimeout = function setTimeout(func, timeout) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 2), - delay: timeout, - }); - }; - if (typeof _global.Promise !== "undefined" && utilPromisify) { - clock.setTimeout[utilPromisify.custom] = - function promisifiedSetTimeout(timeout, arg) { - return new _global.Promise(function setTimeoutExecutor( - resolve - ) { - addTimer(clock, { - func: resolve, - args: [arg], - delay: timeout, - }); - }); - }; - } - - clock.clearTimeout = function clearTimeout(timerId) { - return clearTimer(clock, timerId, "Timeout"); - }; - - clock.nextTick = function nextTick(func) { - return enqueueJob(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 1), - error: isNearInfiniteLimit ? new Error() : null, - }); - }; - - clock.queueMicrotask = function queueMicrotask(func) { - return clock.nextTick(func); // explicitly drop additional arguments - }; - - clock.setInterval = function setInterval(func, timeout) { - // eslint-disable-next-line no-param-reassign - timeout = parseInt(timeout, 10); - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 2), - delay: timeout, - interval: timeout, - }); - }; - - clock.clearInterval = function clearInterval(timerId) { - return clearTimer(clock, timerId, "Interval"); - }; - - if (setImmediatePresent) { - clock.setImmediate = function setImmediate(func) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 1), - immediate: true, - }); - }; - - if (typeof _global.Promise !== "undefined" && utilPromisify) { - clock.setImmediate[utilPromisify.custom] = - function promisifiedSetImmediate(arg) { - return new _global.Promise( - function setImmediateExecutor(resolve) { - addTimer(clock, { - func: resolve, - args: [arg], - immediate: true, - }); - } - ); - }; - } - - clock.clearImmediate = function clearImmediate(timerId) { - return clearTimer(clock, timerId, "Immediate"); - }; - } - - clock.countTimers = function countTimers() { - return ( - Object.keys(clock.timers || {}).length + - (clock.jobs || []).length - ); - }; - - clock.requestAnimationFrame = function requestAnimationFrame(func) { - const result = addTimer(clock, { - func: func, - delay: getTimeToNextFrame(), - get args() { - return [fakePerformanceNow()]; - }, - animation: true, - }); - - return Number(result); - }; - - clock.cancelAnimationFrame = function cancelAnimationFrame(timerId) { - return clearTimer(clock, timerId, "AnimationFrame"); - }; - - clock.runMicrotasks = function runMicrotasks() { - runJobs(clock); - }; - - /** - * @param {number|string} tickValue milliseconds or a string parseable by parseTime - * @param {boolean} isAsync - * @param {Function} resolve - * @param {Function} reject - * @returns {number|undefined} will return the new `now` value or nothing for async - */ - function doTick(tickValue, isAsync, resolve, reject) { - const msFloat = - typeof tickValue === "number" - ? tickValue - : parseTime(tickValue); - const ms = Math.floor(msFloat); - const remainder = nanoRemainder(msFloat); - let nanosTotal = nanos + remainder; - let tickTo = clock.now + ms; - - if (msFloat < 0) { - throw new TypeError("Negative ticks are not supported"); - } - - // adjust for positive overflow - if (nanosTotal >= 1e6) { - tickTo += 1; - nanosTotal -= 1e6; - } - - nanos = nanosTotal; - let tickFrom = clock.now; - let previous = clock.now; - // ESLint fails to detect this correctly - /* eslint-disable prefer-const */ - let timer, - firstException, - oldNow, - nextPromiseTick, - compensationCheck, - postTimerCall; - /* eslint-enable prefer-const */ - - clock.duringTick = true; - - // perform microtasks - oldNow = clock.now; - runJobs(clock); - if (oldNow !== clock.now) { - // compensate for any setSystemTime() call during microtask callback - tickFrom += clock.now - oldNow; - tickTo += clock.now - oldNow; - } - - //eslint-disable-next-line jsdoc/require-jsdoc - function doTickInner() { - // perform each timer in the requested range - timer = firstTimerInRange(clock, tickFrom, tickTo); - // eslint-disable-next-line no-unmodified-loop-condition - while (timer && tickFrom <= tickTo) { - if (clock.timers[timer.id]) { - tickFrom = timer.callAt; - clock.now = timer.callAt; - oldNow = clock.now; - try { - runJobs(clock); - callTimer(clock, timer); - } catch (e) { - firstException = firstException || e; - } - - if (isAsync) { - // finish up after native setImmediate callback to allow - // all native es6 promises to process their callbacks after - // each timer fires. - originalSetTimeout(nextPromiseTick); - return; - } - - compensationCheck(); - } - - postTimerCall(); - } - - // perform process.nextTick()s again - oldNow = clock.now; - runJobs(clock); - if (oldNow !== clock.now) { - // compensate for any setSystemTime() call during process.nextTick() callback - tickFrom += clock.now - oldNow; - tickTo += clock.now - oldNow; - } - clock.duringTick = false; - - // corner case: during runJobs new timers were scheduled which could be in the range [clock.now, tickTo] - timer = firstTimerInRange(clock, tickFrom, tickTo); - if (timer) { - try { - clock.tick(tickTo - clock.now); // do it all again - for the remainder of the requested range - } catch (e) { - firstException = firstException || e; - } - } else { - // no timers remaining in the requested range: move the clock all the way to the end - clock.now = tickTo; - - // update nanos - nanos = nanosTotal; - } - if (firstException) { - throw firstException; - } - - if (isAsync) { - resolve(clock.now); - } else { - return clock.now; - } - } - - nextPromiseTick = - isAsync && - function () { - try { - compensationCheck(); - postTimerCall(); - doTickInner(); - } catch (e) { - reject(e); - } - }; - - compensationCheck = function () { - // compensate for any setSystemTime() call during timer callback - if (oldNow !== clock.now) { - tickFrom += clock.now - oldNow; - tickTo += clock.now - oldNow; - previous += clock.now - oldNow; - } - }; - - postTimerCall = function () { - timer = firstTimerInRange(clock, previous, tickTo); - previous = tickFrom; - }; - - return doTickInner(); - } - - /** - * @param {string|number} tickValue number of milliseconds or a human-readable value like "01:11:15" - * @returns {number} will return the new `now` value - */ - clock.tick = function tick(tickValue) { - return doTick(tickValue, false); - }; - - if (typeof _global.Promise !== "undefined") { - /** - * @param {string|number} tickValue number of milliseconds or a human-readable value like "01:11:15" - * @returns {Promise} - */ - clock.tickAsync = function tickAsync(tickValue) { - return new _global.Promise(function (resolve, reject) { - originalSetTimeout(function () { - try { - doTick(tickValue, true, resolve, reject); - } catch (e) { - reject(e); - } - }); - }); - }; - } - - clock.next = function next() { - runJobs(clock); - const timer = firstTimer(clock); - if (!timer) { - return clock.now; - } - - clock.duringTick = true; - try { - clock.now = timer.callAt; - callTimer(clock, timer); - runJobs(clock); - return clock.now; - } finally { - clock.duringTick = false; - } - }; - - if (typeof _global.Promise !== "undefined") { - clock.nextAsync = function nextAsync() { - return new _global.Promise(function (resolve, reject) { - originalSetTimeout(function () { - try { - const timer = firstTimer(clock); - if (!timer) { - resolve(clock.now); - return; - } - - let err; - clock.duringTick = true; - clock.now = timer.callAt; - try { - callTimer(clock, timer); - } catch (e) { - err = e; - } - clock.duringTick = false; - - originalSetTimeout(function () { - if (err) { - reject(err); - } else { - resolve(clock.now); - } - }); - } catch (e) { - reject(e); - } - }); - }); - }; - } - - clock.runAll = function runAll() { - let numTimers, i; - runJobs(clock); - for (i = 0; i < clock.loopLimit; i++) { - if (!clock.timers) { - resetIsNearInfiniteLimit(); - return clock.now; - } - - numTimers = Object.keys(clock.timers).length; - if (numTimers === 0) { - resetIsNearInfiniteLimit(); - return clock.now; - } - - clock.next(); - checkIsNearInfiniteLimit(clock, i); - } - - const excessJob = firstTimer(clock); - throw getInfiniteLoopError(clock, excessJob); - }; - - clock.runToFrame = function runToFrame() { - return clock.tick(getTimeToNextFrame()); - }; - - if (typeof _global.Promise !== "undefined") { - clock.runAllAsync = function runAllAsync() { - return new _global.Promise(function (resolve, reject) { - let i = 0; - /** - * - */ - function doRun() { - originalSetTimeout(function () { - try { - let numTimers; - if (i < clock.loopLimit) { - if (!clock.timers) { - resetIsNearInfiniteLimit(); - resolve(clock.now); - return; - } - - numTimers = Object.keys( - clock.timers - ).length; - if (numTimers === 0) { - resetIsNearInfiniteLimit(); - resolve(clock.now); - return; - } - - clock.next(); - - i++; - - doRun(); - checkIsNearInfiniteLimit(clock, i); - return; - } - - const excessJob = firstTimer(clock); - reject(getInfiniteLoopError(clock, excessJob)); - } catch (e) { - reject(e); - } - }); - } - doRun(); - }); - }; - } - - clock.runToLast = function runToLast() { - const timer = lastTimer(clock); - if (!timer) { - runJobs(clock); - return clock.now; - } - - return clock.tick(timer.callAt - clock.now); - }; - - if (typeof _global.Promise !== "undefined") { - clock.runToLastAsync = function runToLastAsync() { - return new _global.Promise(function (resolve, reject) { - originalSetTimeout(function () { - try { - const timer = lastTimer(clock); - if (!timer) { - resolve(clock.now); - } - - resolve(clock.tickAsync(timer.callAt - clock.now)); - } catch (e) { - reject(e); - } - }); - }); - }; - } - - clock.reset = function reset() { - nanos = 0; - clock.timers = {}; - clock.jobs = []; - clock.now = start; - }; - - clock.setSystemTime = function setSystemTime(systemTime) { - // determine time difference - const newNow = getEpoch(systemTime); - const difference = newNow - clock.now; - let id, timer; - - adjustedSystemTime[0] = adjustedSystemTime[0] + difference; - adjustedSystemTime[1] = adjustedSystemTime[1] + nanos; - // update 'system clock' - clock.now = newNow; - nanos = 0; - - // update timers and intervals to keep them stable - for (id in clock.timers) { - if (clock.timers.hasOwnProperty(id)) { - timer = clock.timers[id]; - timer.createdAt += difference; - timer.callAt += difference; - } - } - }; - - /** - * @param {string|number} tickValue number of milliseconds or a human-readable value like "01:11:15" - * @returns {number} will return the new `now` value - */ - clock.jump = function jump(tickValue) { - const msFloat = - typeof tickValue === "number" - ? tickValue - : parseTime(tickValue); - const ms = Math.floor(msFloat); - - for (const timer of Object.values(clock.timers)) { - if (clock.now + ms > timer.callAt) { - timer.callAt = clock.now + ms; - } - } - clock.tick(ms); - }; - - if (performancePresent) { - clock.performance = Object.create(null); - clock.performance.now = fakePerformanceNow; - } - - if (hrtimePresent) { - clock.hrtime = hrtime; - } - - return clock; - } - - /* eslint-disable complexity */ - - /** - * @param {Config=} [config] Optional config - * @returns {Clock} - */ - function install(config) { - if ( - arguments.length > 1 || - config instanceof Date || - Array.isArray(config) || - typeof config === "number" - ) { - throw new TypeError( - `FakeTimers.install called with ${String( - config - )} install requires an object parameter` - ); - } - - if (_global.Date.isFake === true) { - // Timers are already faked; this is a problem. - // Make the user reset timers before continuing. - throw new TypeError( - "Can't install fake timers twice on the same global object." - ); - } - - // eslint-disable-next-line no-param-reassign - config = typeof config !== "undefined" ? config : {}; - config.shouldAdvanceTime = config.shouldAdvanceTime || false; - config.advanceTimeDelta = config.advanceTimeDelta || 20; - config.shouldClearNativeTimers = - config.shouldClearNativeTimers || false; - - if (config.target) { - throw new TypeError( - "config.target is no longer supported. Use `withGlobal(target)` instead." - ); - } - - let i, l; - const clock = createClock(config.now, config.loopLimit); - clock.shouldClearNativeTimers = config.shouldClearNativeTimers; - - clock.uninstall = function () { - return uninstall(clock, config); - }; - - clock.methods = config.toFake || []; - - if (clock.methods.length === 0) { - // do not fake nextTick by default - GitHub#126 - clock.methods = Object.keys(timers).filter(function (key) { - return key !== "nextTick" && key !== "queueMicrotask"; - }); - } - - if (config.shouldAdvanceTime === true) { - const intervalTick = doIntervalTick.bind( - null, - clock, - config.advanceTimeDelta - ); - const intervalId = _global.setInterval( - intervalTick, - config.advanceTimeDelta - ); - clock.attachedInterval = intervalId; - } - - if (clock.methods.includes("performance")) { - const proto = (() => { - if (hasPerformancePrototype) { - return _global.Performance.prototype; - } - if (hasPerformanceConstructorPrototype) { - return _global.performance.constructor.prototype; - } - })(); - if (proto) { - Object.getOwnPropertyNames(proto).forEach(function (name) { - if (name !== "now") { - clock.performance[name] = - name.indexOf("getEntries") === 0 - ? NOOP_ARRAY - : NOOP; - } - }); - } else if ((config.toFake || []).includes("performance")) { - // user explicitly tried to fake performance when not present - throw new ReferenceError( - "non-existent performance object cannot be faked" - ); - } - } - - for (i = 0, l = clock.methods.length; i < l; i++) { - const nameOfMethodToReplace = clock.methods[i]; - if (nameOfMethodToReplace === "hrtime") { - if ( - _global.process && - typeof _global.process.hrtime === "function" - ) { - hijackMethod(_global.process, nameOfMethodToReplace, clock); - } - } else if (nameOfMethodToReplace === "nextTick") { - if ( - _global.process && - typeof _global.process.nextTick === "function" - ) { - hijackMethod(_global.process, nameOfMethodToReplace, clock); - } - } else { - hijackMethod(_global, nameOfMethodToReplace, clock); - } - } - - return clock; - } - - /* eslint-enable complexity */ - - return { - timers: timers, - createClock: createClock, - install: install, - withGlobal: withGlobal, - }; -} - -/** - * @typedef {object} FakeTimers - * @property {Timers} timers - * @property {createClock} createClock - * @property {Function} install - * @property {withGlobal} withGlobal - */ - -/* eslint-enable complexity */ - -/** @type {FakeTimers} */ -const defaultImplementation = withGlobal(globalObject); - -exports.timers = defaultImplementation.timers; -exports.createClock = defaultImplementation.createClock; -exports.install = defaultImplementation.install; -exports.withGlobal = withGlobal; diff --git a/node_modules/@types/babel__core/LICENSE b/node_modules/@types/babel__core/LICENSE deleted file mode 100755 index 9e841e7a2..000000000 --- a/node_modules/@types/babel__core/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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/@types/babel__core/README.md b/node_modules/@types/babel__core/README.md deleted file mode 100755 index dec6aaa17..000000000 --- a/node_modules/@types/babel__core/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/babel__core` - -# Summary -This package contains type definitions for @babel/core (https://github.com/babel/babel/tree/master/packages/babel-core). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__core. - -### Additional Details - * Last updated: Wed, 18 Jan 2023 18:32:45 GMT - * Dependencies: [@types/babel__generator](https://npmjs.com/package/@types/babel__generator), [@types/babel__parser](https://npmjs.com/package/@types/babel__parser), [@types/babel__template](https://npmjs.com/package/@types/babel__template), [@types/babel__traverse](https://npmjs.com/package/@types/babel__traverse), [@types/babel__types](https://npmjs.com/package/@types/babel__types) - * Global values: `babel` - -# Credits -These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Melvin Groenhoff](https://github.com/mgroenhoff), [Jessica Franco](https://github.com/Jessidhia), and [Ifiok Jr.](https://github.com/ifiokjr). diff --git a/node_modules/@types/babel__core/index.d.ts b/node_modules/@types/babel__core/index.d.ts deleted file mode 100755 index 8358fee45..000000000 --- a/node_modules/@types/babel__core/index.d.ts +++ /dev/null @@ -1,841 +0,0 @@ -// Type definitions for @babel/core 7.20 -// Project: https://github.com/babel/babel/tree/master/packages/babel-core, https://babeljs.io -// Definitions by: Troy Gerwien -// Marvin Hagemeister -// Melvin Groenhoff -// Jessica Franco -// Ifiok Jr. -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Minimum TypeScript Version: 3.4 - -import { GeneratorOptions } from '@babel/generator'; -import { ParserOptions } from '@babel/parser'; -import template from '@babel/template'; -import traverse, { Hub, NodePath, Scope, Visitor } from '@babel/traverse'; -import * as t from '@babel/types'; - -export { ParserOptions, GeneratorOptions, t as types, template, traverse, NodePath, Visitor }; - -export type Node = t.Node; -export type ParseResult = ReturnType; -export const version: string; -export const DEFAULT_EXTENSIONS: ['.js', '.jsx', '.es6', '.es', '.mjs']; - -/** - * Source map standard format as to revision 3 - * @see {@link https://sourcemaps.info/spec.html} - * @see {@link https://github.com/mozilla/source-map/blob/HEAD/source-map.d.ts} - */ -interface InputSourceMap { - version: number; - sources: string[]; - names: string[]; - sourceRoot?: string | undefined; - sourcesContent?: string[] | undefined; - mappings: string; - file: string; -} - -export interface TransformOptions { - /** - * Specify which assumptions it can make about your code, to better optimize the compilation result. **NOTE**: This replaces the various `loose` options in plugins in favor of - * top-level options that can apply to multiple plugins - * - * @see https://babeljs.io/docs/en/assumptions - */ - assumptions?: { [name: string]: boolean } | null | undefined; - - /** - * Include the AST in the returned object - * - * Default: `false` - */ - ast?: boolean | null | undefined; - - /** - * Attach a comment after all non-user injected code - * - * Default: `null` - */ - auxiliaryCommentAfter?: string | null | undefined; - - /** - * Attach a comment before all non-user injected code - * - * Default: `null` - */ - auxiliaryCommentBefore?: string | null | undefined; - - /** - * Specify the "root" folder that defines the location to search for "babel.config.js", and the default folder to allow `.babelrc` files inside of. - * - * Default: `"."` - */ - root?: string | null | undefined; - - /** - * This option, combined with the "root" value, defines how Babel chooses its project root. - * The different modes define different ways that Babel can process the "root" value to get - * the final project root. - * - * @see https://babeljs.io/docs/en/next/options#rootmode - */ - rootMode?: 'root' | 'upward' | 'upward-optional' | undefined; - - /** - * The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files. - * - * Default: `undefined` - */ - configFile?: string | boolean | null | undefined; - - /** - * Specify whether or not to use .babelrc and - * .babelignore files. - * - * Default: `true` - */ - babelrc?: boolean | null | undefined; - - /** - * Specify which packages should be search for .babelrc files when they are being compiled. `true` to always search, or a path string or an array of paths to packages to search - * inside of. Defaults to only searching the "root" package. - * - * Default: `(root)` - */ - babelrcRoots?: boolean | MatchPattern | MatchPattern[] | null | undefined; - - /** - * Toggles whether or not browserslist config sources are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json. - * This is useful for projects that use a browserslist config for files that won't be compiled with Babel. - * - * If a string is specified, it must represent the path of a browserslist configuration file. Relative paths are resolved relative to the configuration file which specifies - * this option, or to `cwd` when it's passed as part of the programmatic options. - * - * Default: `true` - */ - browserslistConfigFile?: boolean | null | undefined; - - /** - * The Browserslist environment to use. - * - * Default: `undefined` - */ - browserslistEnv?: string | null | undefined; - - /** - * By default `babel.transformFromAst` will clone the input AST to avoid mutations. - * Specifying `cloneInputAst: false` can improve parsing performance if the input AST is not used elsewhere. - * - * Default: `true` - */ - cloneInputAst?: boolean | null | undefined; - - /** - * Defaults to environment variable `BABEL_ENV` if set, or else `NODE_ENV` if set, or else it defaults to `"development"` - * - * Default: env vars - */ - envName?: string | undefined; - - /** - * If any of patterns match, the current configuration object is considered inactive and is ignored during config processing. - */ - exclude?: MatchPattern | MatchPattern[] | undefined; - - /** - * Enable code generation - * - * Default: `true` - */ - code?: boolean | null | undefined; - - /** - * Output comments in generated output - * - * Default: `true` - */ - comments?: boolean | null | undefined; - - /** - * Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB - * - * Default: `"auto"` - */ - compact?: boolean | 'auto' | null | undefined; - - /** - * The working directory that Babel's programmatic options are loaded relative to. - * - * Default: `"."` - */ - cwd?: string | null | undefined; - - /** - * Utilities may pass a caller object to identify themselves to Babel and - * pass capability-related flags for use by configs, presets and plugins. - * - * @see https://babeljs.io/docs/en/next/options#caller - */ - caller?: TransformCaller | undefined; - - /** - * This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { \/* specific options *\/ } } }` - * which will use those options when the `envName` is `production` - * - * Default: `{}` - */ - env?: { [index: string]: TransformOptions | null | undefined } | null | undefined; - - /** - * A path to a `.babelrc` file to extend - * - * Default: `null` - */ - extends?: string | null | undefined; - - /** - * Filename for use in errors etc - * - * Default: `"unknown"` - */ - filename?: string | null | undefined; - - /** - * Filename relative to `sourceRoot` - * - * Default: `(filename)` - */ - filenameRelative?: string | null | undefined; - - /** - * An object containing the options to be passed down to the babel code generator, @babel/generator - * - * Default: `{}` - */ - generatorOpts?: GeneratorOptions | null | undefined; - - /** - * Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used - * - * Default: `null` - */ - getModuleId?: ((moduleName: string) => string | null | undefined) | null | undefined; - - /** - * ANSI highlight syntax error code frames - * - * Default: `true` - */ - highlightCode?: boolean | null | undefined; - - /** - * Opposite to the `only` option. `ignore` is disregarded if `only` is specified - * - * Default: `null` - */ - ignore?: MatchPattern[] | null | undefined; - - /** - * This option is a synonym for "test" - */ - include?: MatchPattern | MatchPattern[] | undefined; - - /** - * A source map object that the output source map will be based on - * - * Default: `null` - */ - inputSourceMap?: InputSourceMap | null | undefined; - - /** - * Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) - * - * Default: `false` - */ - minified?: boolean | null | undefined; - - /** - * Specify a custom name for module ids - * - * Default: `null` - */ - moduleId?: string | null | undefined; - - /** - * If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) - * - * Default: `false` - */ - moduleIds?: boolean | null | undefined; - - /** - * Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions - * - * Default: `(sourceRoot)` - */ - moduleRoot?: string | null | undefined; - - /** - * A glob, regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile - * a non-matching file it's returned verbatim - * - * Default: `null` - */ - only?: MatchPattern[] | null | undefined; - - /** - * Allows users to provide an array of options that will be merged into the current configuration one at a time. - * This feature is best used alongside the "test"/"include"/"exclude" options to provide conditions for which an override should apply - */ - overrides?: TransformOptions[] | undefined; - - /** - * An object containing the options to be passed down to the babel parser, @babel/parser - * - * Default: `{}` - */ - parserOpts?: ParserOptions | null | undefined; - - /** - * List of plugins to load and use - * - * Default: `[]` - */ - plugins?: PluginItem[] | null | undefined; - - /** - * List of presets (a set of plugins) to load and use - * - * Default: `[]` - */ - presets?: PluginItem[] | null | undefined; - - /** - * Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE**: This will not retain the columns) - * - * Default: `false` - */ - retainLines?: boolean | null | undefined; - - /** - * An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE**: This overrides the `comment` option when used - * - * Default: `null` - */ - shouldPrintComment?: ((commentContents: string) => boolean) | null | undefined; - - /** - * Set `sources[0]` on returned source map - * - * Default: `(filenameRelative)` - */ - sourceFileName?: string | null | undefined; - - /** - * If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` - * then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** - * - * Default: `false` - */ - sourceMaps?: boolean | 'inline' | 'both' | null | undefined; - - /** - * The root from which all sources are relative - * - * Default: `(moduleRoot)` - */ - sourceRoot?: string | null | undefined; - - /** - * Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". `"unambiguous"` will make Babel attempt to guess, based on the presence of ES6 - * `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`. - * - * Default: `("module")` - */ - sourceType?: 'script' | 'module' | 'unambiguous' | null | undefined; - - /** - * If all patterns fail to match, the current configuration object is considered inactive and is ignored during config processing. - */ - test?: MatchPattern | MatchPattern[] | undefined; - - /** - * Describes the environments you support/target for your project. - * This can either be a [browserslist-compatible](https://github.com/ai/browserslist) query (with [caveats](https://babeljs.io/docs/en/babel-preset-env#ineffective-browserslist-queries)) - * - * Default: `{}` - */ - targets?: - | string - | string[] - | { - esmodules?: boolean; - node?: Omit | 'current' | true; - safari?: Omit | 'tp'; - browsers?: string | string[]; - android?: string; - chrome?: string; - deno?: string; - edge?: string; - electron?: string; - firefox?: string; - ie?: string; - ios?: string; - opera?: string; - rhino?: string; - samsung?: string; - }; - - /** - * An optional callback that can be used to wrap visitor methods. **NOTE**: This is useful for things like introspection, and not really needed for implementing anything. Called as - * `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`. - */ - wrapPluginVisitorMethod?: - | (( - pluginAlias: string, - visitorType: 'enter' | 'exit', - callback: (path: NodePath, state: any) => void, - ) => (path: NodePath, state: any) => void) - | null - | undefined; -} - -export interface TransformCaller { - // the only required property - name: string; - // e.g. set to true by `babel-loader` and false by `babel-jest` - supportsStaticESM?: boolean | undefined; - supportsDynamicImport?: boolean | undefined; - supportsExportNamespaceFrom?: boolean | undefined; - supportsTopLevelAwait?: boolean | undefined; - // augment this with a "declare module '@babel/core' { ... }" if you need more keys -} - -export type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any; - -export interface MatchPatternContext { - envName: string; - dirname: string; - caller: TransformCaller | undefined; -} -export type MatchPattern = string | RegExp | ((filename: string | undefined, context: MatchPatternContext) => boolean); - -/** - * Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST. - */ -export function transform(code: string, callback: FileResultCallback): void; - -/** - * Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST. - */ -export function transform(code: string, opts: TransformOptions | undefined, callback: FileResultCallback): void; - -/** - * Here for backward-compatibility. Ideally use `transformSync` if you want a synchronous API. - */ -export function transform(code: string, opts?: TransformOptions): BabelFileResult | null; - -/** - * Transforms the passed in code. Returning an object with the generated code, source map, and AST. - */ -export function transformSync(code: string, opts?: TransformOptions): BabelFileResult | null; - -/** - * Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST. - */ -export function transformAsync(code: string, opts?: TransformOptions): Promise; - -/** - * Asynchronously transforms the entire contents of a file. - */ -export function transformFile(filename: string, callback: FileResultCallback): void; - -/** - * Asynchronously transforms the entire contents of a file. - */ -export function transformFile(filename: string, opts: TransformOptions | undefined, callback: FileResultCallback): void; - -/** - * Synchronous version of `babel.transformFile`. Returns the transformed contents of the `filename`. - */ -export function transformFileSync(filename: string, opts?: TransformOptions): BabelFileResult | null; - -/** - * Asynchronously transforms the entire contents of a file. - */ -export function transformFileAsync(filename: string, opts?: TransformOptions): Promise; - -/** - * Given an AST, transform it. - */ -export function transformFromAst(ast: Node, code: string | undefined, callback: FileResultCallback): void; - -/** - * Given an AST, transform it. - */ -export function transformFromAst( - ast: Node, - code: string | undefined, - opts: TransformOptions | undefined, - callback: FileResultCallback, -): void; - -/** - * Here for backward-compatibility. Ideally use ".transformSync" if you want a synchronous API. - */ -export function transformFromAstSync(ast: Node, code?: string, opts?: TransformOptions): BabelFileResult | null; - -/** - * Given an AST, transform it. - */ -export function transformFromAstAsync( - ast: Node, - code?: string, - opts?: TransformOptions, -): Promise; - -// A babel plugin is a simple function which must return an object matching -// the following interface. Babel will throw if it finds unknown properties. -// The list of allowed plugin keys is here: -// https://github.com/babel/babel/blob/4e50b2d9d9c376cee7a2cbf56553fe5b982ea53c/packages/babel-core/src/config/option-manager.js#L71 -export interface PluginObj { - name?: string | undefined; - manipulateOptions?(opts: any, parserOpts: any): void; - pre?(this: S, file: BabelFile): void; - visitor: Visitor; - post?(this: S, file: BabelFile): void; - inherits?: any; -} - -export interface BabelFile { - ast: t.File; - opts: TransformOptions; - hub: Hub; - metadata: object; - path: NodePath; - scope: Scope; - inputMap: object | null; - code: string; -} - -export interface PluginPass { - file: BabelFile; - key: string; - opts: object; - cwd: string; - filename: string | undefined; - get(key: unknown): any; - set(key: unknown, value: unknown): void; - [key: string]: unknown; -} - -export interface BabelFileResult { - ast?: t.File | null | undefined; - code?: string | null | undefined; - ignored?: boolean | undefined; - map?: - | { - version: number; - sources: string[]; - names: string[]; - sourceRoot?: string | undefined; - sourcesContent?: string[] | undefined; - mappings: string; - file: string; - } - | null - | undefined; - metadata?: BabelFileMetadata | undefined; -} - -export interface BabelFileMetadata { - usedHelpers: string[]; - marked: Array<{ - type: string; - message: string; - loc: object; - }>; - modules: BabelFileModulesMetadata; -} - -export interface BabelFileModulesMetadata { - imports: object[]; - exports: { - exported: object[]; - specifiers: object[]; - }; -} - -export type FileParseCallback = (err: Error | null, result: ParseResult | null) => any; - -/** - * Given some code, parse it using Babel's standard behavior. - * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. - */ -export function parse(code: string, callback: FileParseCallback): void; - -/** - * Given some code, parse it using Babel's standard behavior. - * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. - */ -export function parse(code: string, options: TransformOptions | undefined, callback: FileParseCallback): void; - -/** - * Given some code, parse it using Babel's standard behavior. - * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. - */ -export function parse(code: string, options?: TransformOptions): ParseResult | null; - -/** - * Given some code, parse it using Babel's standard behavior. - * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. - */ -export function parseSync(code: string, options?: TransformOptions): ParseResult | null; - -/** - * Given some code, parse it using Babel's standard behavior. - * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. - */ -export function parseAsync(code: string, options?: TransformOptions): Promise; - -/** - * Resolve Babel's options fully, resulting in an options object where: - * - * * opts.plugins is a full list of Plugin instances. - * * opts.presets is empty and all presets are flattened into opts. - * * It can be safely passed back to Babel. Fields like babelrc have been set to false so that later calls to Babel - * will not make a second attempt to load config files. - * - * Plugin instances aren't meant to be manipulated directly, but often callers will serialize this opts to JSON to - * use it as a cache key representing the options Babel has received. Caching on this isn't 100% guaranteed to - * invalidate properly, but it is the best we have at the moment. - */ -export function loadOptions(options?: TransformOptions): object | null; - -/** - * To allow systems to easily manipulate and validate a user's config, this function resolves the plugins and - * presets and proceeds no further. The expectation is that callers will take the config's .options, manipulate it - * as then see fit and pass it back to Babel again. - * - * * `babelrc: string | void` - The path of the `.babelrc` file, if there was one. - * * `babelignore: string | void` - The path of the `.babelignore` file, if there was one. - * * `options: ValidatedOptions` - The partially resolved options, which can be manipulated and passed back - * to Babel again. - * * `plugins: Array` - See below. - * * `presets: Array` - See below. - * * It can be safely passed back to Babel. Fields like `babelrc` have been set to false so that later calls to - * Babel will not make a second attempt to load config files. - * - * `ConfigItem` instances expose properties to introspect the values, but each item should be treated as - * immutable. If changes are desired, the item should be removed from the list and replaced with either a normal - * Babel config value, or with a replacement item created by `babel.createConfigItem`. See that function for - * information about `ConfigItem` fields. - */ -export function loadPartialConfig(options?: TransformOptions): Readonly | null; -export function loadPartialConfigAsync(options?: TransformOptions): Promise | null>; - -export interface PartialConfig { - options: TransformOptions; - babelrc?: string | undefined; - babelignore?: string | undefined; - config?: string | undefined; - hasFilesystemConfig: () => boolean; -} - -export interface ConfigItem { - /** - * The name that the user gave the plugin instance, e.g. `plugins: [ ['env', {}, 'my-env'] ]` - */ - name?: string | undefined; - - /** - * The resolved value of the plugin. - */ - value: object | ((...args: any[]) => any); - - /** - * The options object passed to the plugin. - */ - options?: object | false | undefined; - - /** - * The path that the options are relative to. - */ - dirname: string; - - /** - * Information about the plugin's file, if Babel knows it. - * * - */ - file?: - | { - /** - * The file that the user requested, e.g. `"@babel/env"` - */ - request: string; - - /** - * The full path of the resolved file, e.g. `"/tmp/node_modules/@babel/preset-env/lib/index.js"` - */ - resolved: string; - } - | null - | undefined; -} - -export type PluginOptions = object | undefined | false; - -export type PluginTarget = string | object | ((...args: any[]) => any); - -export type PluginItem = - | ConfigItem - | PluginObj - | PluginTarget - | [PluginTarget, PluginOptions] - | [PluginTarget, PluginOptions, string | undefined]; - -export function resolvePlugin(name: string, dirname: string): string | null; -export function resolvePreset(name: string, dirname: string): string | null; - -export interface CreateConfigItemOptions { - dirname?: string | undefined; - type?: 'preset' | 'plugin' | undefined; -} - -/** - * Allows build tooling to create and cache config items up front. If this function is called multiple times for a - * given plugin, Babel will call the plugin's function itself multiple times. If you have a clear set of expected - * plugins and presets to inject, pre-constructing the config items would be recommended. - */ -export function createConfigItem( - value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined], - options?: CreateConfigItemOptions, -): ConfigItem; - -// NOTE: the documentation says the ConfigAPI also exposes @babel/core's exports, but it actually doesn't -/** - * @see https://babeljs.io/docs/en/next/config-files#config-function-api - */ -export interface ConfigAPI { - /** - * The version string for the Babel version that is loading the config file. - * - * @see https://babeljs.io/docs/en/next/config-files#apiversion - */ - version: string; - /** - * @see https://babeljs.io/docs/en/next/config-files#apicache - */ - cache: SimpleCacheConfigurator; - /** - * @see https://babeljs.io/docs/en/next/config-files#apienv - */ - env: EnvFunction; - // undocumented; currently hardcoded to return 'false' - // async(): boolean - /** - * This API is used as a way to access the `caller` data that has been passed to Babel. - * Since many instances of Babel may be running in the same process with different `caller` values, - * this API is designed to automatically configure `api.cache`, the same way `api.env()` does. - * - * The `caller` value is available as the first parameter of the callback function. - * It is best used with something like this to toggle configuration behavior - * based on a specific environment: - * - * @example - * function isBabelRegister(caller?: { name: string }) { - * return !!(caller && caller.name === "@babel/register") - * } - * api.caller(isBabelRegister) - * - * @see https://babeljs.io/docs/en/next/config-files#apicallercb - */ - caller(callerCallback: (caller: TransformOptions['caller']) => T): T; - /** - * While `api.version` can be useful in general, it's sometimes nice to just declare your version. - * This API exposes a simple way to do that with: - * - * @example - * api.assertVersion(7) // major version only - * api.assertVersion("^7.2") - * - * @see https://babeljs.io/docs/en/next/config-files#apiassertversionrange - */ - assertVersion(versionRange: number | string): boolean; - // NOTE: this is an undocumented reexport from "@babel/parser" but it's missing from its types - // tokTypes: typeof tokTypes -} - -/** - * JS configs are great because they can compute a config on the fly, - * but the downside there is that it makes caching harder. - * Babel wants to avoid re-executing the config function every time a file is compiled, - * because then it would also need to re-execute any plugin and preset functions - * referenced in that config. - * - * To avoid this, Babel expects users of config functions to tell it how to manage caching - * within a config file. - * - * @see https://babeljs.io/docs/en/next/config-files#apicache - */ -export interface SimpleCacheConfigurator { - // there is an undocumented call signature that is a shorthand for forever()/never()/using(). - // (ever: boolean): void - // (callback: CacheCallback): T - /** - * Permacache the computed config and never call the function again. - */ - forever(): void; - /** - * Do not cache this config, and re-execute the function every time. - */ - never(): void; - /** - * Any time the using callback returns a value other than the one that was expected, - * the overall config function will be called again and a new entry will be added to the cache. - * - * @example - * api.cache.using(() => process.env.NODE_ENV) - */ - using(callback: SimpleCacheCallback): T; - /** - * Any time the using callback returns a value other than the one that was expected, - * the overall config function will be called again and all entries in the cache will - * be replaced with the result. - * - * @example - * api.cache.invalidate(() => process.env.NODE_ENV) - */ - invalidate(callback: SimpleCacheCallback): T; -} - -// https://github.com/babel/babel/blob/v7.3.3/packages/babel-core/src/config/caching.js#L231 -export type SimpleCacheKey = string | boolean | number | null | undefined; -export type SimpleCacheCallback = () => T; - -/** - * Since `NODE_ENV` is a fairly common way to toggle behavior, Babel also includes an API function - * meant specifically for that. This API is used as a quick way to check the `"envName"` that Babel - * was loaded with, which takes `NODE_ENV` into account if no other overriding environment is set. - * - * @see https://babeljs.io/docs/en/next/config-files#apienv - */ -export interface EnvFunction { - /** - * @returns the current `envName` string - */ - (): string; - /** - * @returns `true` if the `envName` is `===` any of the given strings - */ - (envName: string | ReadonlyArray): boolean; - // the official documentation is misleading for this one... - // this just passes the callback to `cache.using` but with an additional argument. - // it returns its result instead of necessarily returning a boolean. - (envCallback: (envName: NonNullable) => T): T; -} - -export type ConfigFunction = (api: ConfigAPI) => TransformOptions; - -export as namespace babel; diff --git a/node_modules/@types/babel__core/package.json b/node_modules/@types/babel__core/package.json deleted file mode 100755 index 03271ae20..000000000 --- a/node_modules/@types/babel__core/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "@types/babel__core", - "version": "7.20.0", - "description": "TypeScript definitions for @babel/core", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__core", - "license": "MIT", - "contributors": [ - { - "name": "Troy Gerwien", - "url": "https://github.com/yortus", - "githubUsername": "yortus" - }, - { - "name": "Marvin Hagemeister", - "url": "https://github.com/marvinhagemeister", - "githubUsername": "marvinhagemeister" - }, - { - "name": "Melvin Groenhoff", - "url": "https://github.com/mgroenhoff", - "githubUsername": "mgroenhoff" - }, - { - "name": "Jessica Franco", - "url": "https://github.com/Jessidhia", - "githubUsername": "Jessidhia" - }, - { - "name": "Ifiok Jr.", - "url": "https://github.com/ifiokjr", - "githubUsername": "ifiokjr" - } - ], - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/babel__core" - }, - "scripts": {}, - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - }, - "typesPublisherContentHash": "5f7ac35ea0366e8fe844535c52b8a802863f6047af2f052830c5b75a78d9b55c", - "typeScriptVersion": "4.2" -} \ No newline at end of file diff --git a/node_modules/@types/babel__generator/LICENSE b/node_modules/@types/babel__generator/LICENSE deleted file mode 100755 index 9e841e7a2..000000000 --- a/node_modules/@types/babel__generator/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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/@types/babel__generator/README.md b/node_modules/@types/babel__generator/README.md deleted file mode 100755 index a9c68c9d1..000000000 --- a/node_modules/@types/babel__generator/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/babel__generator` - -# Summary -This package contains type definitions for @babel/generator (https://github.com/babel/babel/tree/master/packages/babel-generator). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__generator. - -### Additional Details - * Last updated: Thu, 23 Dec 2021 23:34:17 GMT - * Dependencies: [@types/babel__types](https://npmjs.com/package/@types/babel__types) - * Global values: none - -# Credits -These definitions were written by [Troy Gerwien](https://github.com/yortus), [Melvin Groenhoff](https://github.com/mgroenhoff), [Cameron Yan](https://github.com/khell), and [Lyanbin](https://github.com/Lyanbin). diff --git a/node_modules/@types/babel__generator/index.d.ts b/node_modules/@types/babel__generator/index.d.ts deleted file mode 100755 index 61317bf84..000000000 --- a/node_modules/@types/babel__generator/index.d.ts +++ /dev/null @@ -1,211 +0,0 @@ -// Type definitions for @babel/generator 7.6 -// Project: https://github.com/babel/babel/tree/master/packages/babel-generator, https://babeljs.io -// Definitions by: Troy Gerwien -// Melvin Groenhoff -// Cameron Yan -// Lyanbin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.9 - -import * as t from '@babel/types'; - -export interface GeneratorOptions { - /** - * Optional string to add as a block comment at the start of the output file. - */ - auxiliaryCommentBefore?: string | undefined; - - /** - * Optional string to add as a block comment at the end of the output file. - */ - auxiliaryCommentAfter?: string | undefined; - - /** - * Function that takes a comment (as a string) and returns true if the comment should be included in the output. - * By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment - * contains `@preserve` or `@license`. - */ - shouldPrintComment?(comment: string): boolean; - - /** - * Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces). - * Defaults to `false`. - */ - retainLines?: boolean | undefined; - - /** - * Retain parens around function expressions (could be used to change engine parsing behavior) - * Defaults to `false`. - */ - retainFunctionParens?: boolean | undefined; - - /** - * Should comments be included in output? Defaults to `true`. - */ - comments?: boolean | undefined; - - /** - * Set to true to avoid adding whitespace for formatting. Defaults to the value of `opts.minified`. - */ - compact?: boolean | 'auto' | undefined; - - /** - * Should the output be minified. Defaults to `false`. - */ - minified?: boolean | undefined; - - /** - * Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`. - */ - concise?: boolean | undefined; - - /** - * Used in warning messages - */ - filename?: string | undefined; - - /** - * Enable generating source maps. Defaults to `false`. - */ - sourceMaps?: boolean | undefined; - - /** - * A root for all relative URLs in the source map. - */ - sourceRoot?: string | undefined; - - /** - * The filename for the source code (i.e. the code in the `code` argument). - * This will only be used if `code` is a string. - */ - sourceFileName?: string | undefined; - - /** - * Set to true to run jsesc with "json": true to print "\u00A9" vs. "©"; - */ - jsonCompatibleStrings?: boolean | undefined; - - /** - * Set to true to enable support for experimental decorators syntax before module exports. - * Defaults to `false`. - */ - decoratorsBeforeExport?: boolean | undefined; - - /** - * Options for outputting jsesc representation. - */ - jsescOption?: { - /** - * The default value for the quotes option is 'single'. This means that any occurrences of ' in the input - * string are escaped as \', so that the output can be used in a string literal wrapped in single quotes. - */ - quotes?: 'single' | 'double' | 'backtick' | undefined; - - /** - * The default value for the numbers option is 'decimal'. This means that any numeric values are represented - * using decimal integer literals. Other valid options are binary, octal, and hexadecimal, which result in - * binary integer literals, octal integer literals, and hexadecimal integer literals, respectively. - */ - numbers?: 'binary' | 'octal' | 'decimal' | 'hexadecimal' | undefined; - - /** - * The wrap option takes a boolean value (true or false), and defaults to false (disabled). When enabled, the - * output is a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified through - * the quotes setting. - */ - wrap?: boolean | undefined; - - /** - * The es6 option takes a boolean value (true or false), and defaults to false (disabled). When enabled, any - * astral Unicode symbols in the input are escaped using ECMAScript 6 Unicode code point escape sequences - * instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5 - * environments is a concern, don’t enable this setting. If the json setting is enabled, the value for the es6 - * setting is ignored (as if it was false). - */ - es6?: boolean | undefined; - - /** - * The escapeEverything option takes a boolean value (true or false), and defaults to false (disabled). When - * enabled, all the symbols in the output are escaped — even printable ASCII symbols. - */ - escapeEverything?: boolean | undefined; - - /** - * The minimal option takes a boolean value (true or false), and defaults to false (disabled). When enabled, - * only a limited set of symbols in the output are escaped: \0, \b, \t, \n, \f, \r, \\, \u2028, \u2029. - */ - minimal?: boolean | undefined; - - /** - * The isScriptContext option takes a boolean value (true or false), and defaults to false (disabled). When - * enabled, occurrences of or - - -
-

ESLint Report

-
- ${reportSummary} - Generated on ${date} -
-
- - - ${results} - -
- - - -`.trimStart(); -} - -/** - * Given a word and a count, append an s if count is not one. - * @param {string} word A word in its singular form. - * @param {int} count A number controlling whether word should be pluralized. - * @returns {string} The original word with an s on the end if count is not one. - */ -function pluralize(word, count) { - return (count === 1 ? word : `${word}s`); -} - -/** - * Renders text along the template of x problems (x errors, x warnings) - * @param {string} totalErrors Total errors - * @param {string} totalWarnings Total warnings - * @returns {string} The formatted string, pluralized where necessary - */ -function renderSummary(totalErrors, totalWarnings) { - const totalProblems = totalErrors + totalWarnings; - let renderedText = `${totalProblems} ${pluralize("problem", totalProblems)}`; - - if (totalProblems !== 0) { - renderedText += ` (${totalErrors} ${pluralize("error", totalErrors)}, ${totalWarnings} ${pluralize("warning", totalWarnings)})`; - } - return renderedText; -} - -/** - * Get the color based on whether there are errors/warnings... - * @param {string} totalErrors Total errors - * @param {string} totalWarnings Total warnings - * @returns {int} The color code (0 = green, 1 = yellow, 2 = red) - */ -function renderColor(totalErrors, totalWarnings) { - if (totalErrors !== 0) { - return 2; - } - if (totalWarnings !== 0) { - return 1; - } - return 0; -} - -/** - * Get HTML (table row) describing a single message. - * @param {Object} it data for the message. - * @returns {string} HTML (table row) describing the message. - */ -function messageTemplate(it) { - const { - parentIndex, - lineNumber, - columnNumber, - severityNumber, - severityName, - message, - ruleUrl, - ruleId - } = it; - - return ` - - ${lineNumber}:${columnNumber} - ${severityName} - ${encodeHTML(message)} - - ${ruleId ? ruleId : ""} - - -`.trimStart(); -} - -/** - * Get HTML (table rows) describing the messages. - * @param {Array} messages Messages. - * @param {int} parentIndex Index of the parent HTML row. - * @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis. - * @returns {string} HTML (table rows) describing the messages. - */ -function renderMessages(messages, parentIndex, rulesMeta) { - - /** - * Get HTML (table row) describing a message. - * @param {Object} message Message. - * @returns {string} HTML (table row) describing a message. - */ - return messages.map(message => { - const lineNumber = message.line || 0; - const columnNumber = message.column || 0; - let ruleUrl; - - if (rulesMeta) { - const meta = rulesMeta[message.ruleId]; - - if (meta && meta.docs && meta.docs.url) { - ruleUrl = meta.docs.url; - } - } - - return messageTemplate({ - parentIndex, - lineNumber, - columnNumber, - severityNumber: message.severity, - severityName: message.severity === 1 ? "Warning" : "Error", - message: message.message, - ruleId: message.ruleId, - ruleUrl - }); - }).join("\n"); -} - -/** - * Get HTML (table row) describing the result for a single file. - * @param {Object} it data for the file. - * @returns {string} HTML (table row) describing the result for the file. - */ -function resultTemplate(it) { - const { color, index, filePath, summary } = it; - - return ` - - - [+] ${encodeHTML(filePath)} - ${encodeHTML(summary)} - - -`.trimStart(); -} - -/** - * Render the results. - * @param {Array} results Test results. - * @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis. - * @returns {string} HTML string describing the results. - */ -function renderResults(results, rulesMeta) { - return results.map((result, index) => resultTemplate({ - index, - color: renderColor(result.errorCount, result.warningCount), - filePath: result.filePath, - summary: renderSummary(result.errorCount, result.warningCount) - }) + renderMessages(result.messages, index, rulesMeta)).join("\n"); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results, data) { - let totalErrors, - totalWarnings; - - const metaData = data ? data.rulesMeta : {}; - - totalErrors = 0; - totalWarnings = 0; - - // Iterate over results to get totals - results.forEach(result => { - totalErrors += result.errorCount; - totalWarnings += result.warningCount; - }); - - return pageTemplate({ - date: new Date(), - reportColor: renderColor(totalErrors, totalWarnings), - reportSummary: renderSummary(totalErrors, totalWarnings), - results: renderResults(results, metaData) - }); -}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/jslint-xml.js b/node_modules/eslint/lib/cli-engine/formatters/jslint-xml.js deleted file mode 100644 index 0ca1cbaed..000000000 --- a/node_modules/eslint/lib/cli-engine/formatters/jslint-xml.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @fileoverview JSLint XML reporter - * @author Ian Christian Myers - */ -"use strict"; - -const xmlEscape = require("../xml-escape"); - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results) { - - let output = ""; - - output += ""; - output += ""; - - results.forEach(result => { - const messages = result.messages; - - output += ``; - - messages.forEach(message => { - output += [ - `` - ].join(" "); - }); - - output += ""; - - }); - - output += ""; - - return output; -}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js b/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js deleted file mode 100644 index 689947154..000000000 --- a/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @fileoverview JSON reporter, including rules metadata - * @author Chris Meyer - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results, data) { - return JSON.stringify({ - results, - metadata: data - }); -}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/json.js b/node_modules/eslint/lib/cli-engine/formatters/json.js deleted file mode 100644 index 82138af18..000000000 --- a/node_modules/eslint/lib/cli-engine/formatters/json.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @fileoverview JSON reporter - * @author Burak Yigit Kaya aka BYK - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results) { - return JSON.stringify(results); -}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/junit.js b/node_modules/eslint/lib/cli-engine/formatters/junit.js deleted file mode 100644 index a994b4b19..000000000 --- a/node_modules/eslint/lib/cli-engine/formatters/junit.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @fileoverview jUnit Reporter - * @author Jamund Ferguson - */ -"use strict"; - -const xmlEscape = require("../xml-escape"); -const path = require("path"); - -//------------------------------------------------------------------------------ -// Helper Functions -//------------------------------------------------------------------------------ - -/** - * Returns the severity of warning or error - * @param {Object} message message object to examine - * @returns {string} severity level - * @private - */ -function getMessageType(message) { - if (message.fatal || message.severity === 2) { - return "Error"; - } - return "Warning"; - -} - -/** - * Returns a full file path without extension - * @param {string} filePath input file path - * @returns {string} file path without extension - * @private - */ -function pathWithoutExt(filePath) { - return path.join(path.dirname(filePath), path.basename(filePath, path.extname(filePath))); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results) { - - let output = ""; - - output += "\n"; - output += "\n"; - - results.forEach(result => { - - const messages = result.messages; - const classname = pathWithoutExt(result.filePath); - - if (messages.length > 0) { - output += `\n`; - messages.forEach(message => { - const type = message.fatal ? "error" : "failure"; - - output += ``; - output += `<${type} message="${xmlEscape(message.message || "")}">`; - output += ""; - output += ``; - output += "\n"; - }); - output += "\n"; - } else { - output += `\n`; - output += `\n`; - output += "\n"; - } - - }); - - output += "\n"; - - return output; -}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/stylish.js b/node_modules/eslint/lib/cli-engine/formatters/stylish.js deleted file mode 100644 index a808448b6..000000000 --- a/node_modules/eslint/lib/cli-engine/formatters/stylish.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @fileoverview Stylish reporter - * @author Sindre Sorhus - */ -"use strict"; - -const chalk = require("chalk"), - stripAnsi = require("strip-ansi"), - table = require("text-table"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Given a word and a count, append an s if count is not one. - * @param {string} word A word in its singular form. - * @param {int} count A number controlling whether word should be pluralized. - * @returns {string} The original word with an s on the end if count is not one. - */ -function pluralize(word, count) { - return (count === 1 ? word : `${word}s`); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results) { - - let output = "\n", - errorCount = 0, - warningCount = 0, - fixableErrorCount = 0, - fixableWarningCount = 0, - summaryColor = "yellow"; - - results.forEach(result => { - const messages = result.messages; - - if (messages.length === 0) { - return; - } - - errorCount += result.errorCount; - warningCount += result.warningCount; - fixableErrorCount += result.fixableErrorCount; - fixableWarningCount += result.fixableWarningCount; - - output += `${chalk.underline(result.filePath)}\n`; - - output += `${table( - messages.map(message => { - let messageType; - - if (message.fatal || message.severity === 2) { - messageType = chalk.red("error"); - summaryColor = "red"; - } else { - messageType = chalk.yellow("warning"); - } - - return [ - "", - message.line || 0, - message.column || 0, - messageType, - message.message.replace(/([^ ])\.$/u, "$1"), - chalk.dim(message.ruleId || "") - ]; - }), - { - align: ["", "r", "l"], - stringLength(str) { - return stripAnsi(str).length; - } - } - ).split("\n").map(el => el.replace(/(\d+)\s+(\d+)/u, (m, p1, p2) => chalk.dim(`${p1}:${p2}`))).join("\n")}\n\n`; - }); - - const total = errorCount + warningCount; - - if (total > 0) { - output += chalk[summaryColor].bold([ - "\u2716 ", total, pluralize(" problem", total), - " (", errorCount, pluralize(" error", errorCount), ", ", - warningCount, pluralize(" warning", warningCount), ")\n" - ].join("")); - - if (fixableErrorCount > 0 || fixableWarningCount > 0) { - output += chalk[summaryColor].bold([ - " ", fixableErrorCount, pluralize(" error", fixableErrorCount), " and ", - fixableWarningCount, pluralize(" warning", fixableWarningCount), - " potentially fixable with the `--fix` option.\n" - ].join("")); - } - } - - // Resets output color, for prevent change on top level - return total > 0 ? chalk.reset(output) : ""; -}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/tap.js b/node_modules/eslint/lib/cli-engine/formatters/tap.js deleted file mode 100644 index e4148a3b3..000000000 --- a/node_modules/eslint/lib/cli-engine/formatters/tap.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @fileoverview TAP reporter - * @author Jonathan Kingston - */ -"use strict"; - -const yaml = require("js-yaml"); - -//------------------------------------------------------------------------------ -// Helper Functions -//------------------------------------------------------------------------------ - -/** - * Returns a canonical error level string based upon the error message passed in. - * @param {Object} message Individual error message provided by eslint - * @returns {string} Error level string - */ -function getMessageType(message) { - if (message.fatal || message.severity === 2) { - return "error"; - } - return "warning"; -} - -/** - * Takes in a JavaScript object and outputs a TAP diagnostics string - * @param {Object} diagnostic JavaScript object to be embedded as YAML into output. - * @returns {string} diagnostics string with YAML embedded - TAP version 13 compliant - */ -function outputDiagnostics(diagnostic) { - const prefix = " "; - let output = `${prefix}---\n`; - - output += prefix + yaml.dump(diagnostic).split("\n").join(`\n${prefix}`); - output += "...\n"; - return output; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results) { - let output = `TAP version 13\n1..${results.length}\n`; - - results.forEach((result, id) => { - const messages = result.messages; - let testResult = "ok"; - let diagnostics = {}; - - if (messages.length > 0) { - messages.forEach(message => { - const severity = getMessageType(message); - const diagnostic = { - message: message.message, - severity, - data: { - line: message.line || 0, - column: message.column || 0, - ruleId: message.ruleId || "" - } - }; - - // This ensures a warning message is not flagged as error - if (severity === "error") { - testResult = "not ok"; - } - - /* - * If we have multiple messages place them under a messages key - * The first error will be logged as message key - * This is to adhere to TAP 13 loosely defined specification of having a message key - */ - if ("message" in diagnostics) { - if (typeof diagnostics.messages === "undefined") { - diagnostics.messages = []; - } - diagnostics.messages.push(diagnostic); - } else { - diagnostics = diagnostic; - } - }); - } - - output += `${testResult} ${id + 1} - ${result.filePath}\n`; - - // If we have an error include diagnostics - if (messages.length > 0) { - output += outputDiagnostics(diagnostics); - } - - }); - - return output; -}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/unix.js b/node_modules/eslint/lib/cli-engine/formatters/unix.js deleted file mode 100644 index c6c4ebbdb..000000000 --- a/node_modules/eslint/lib/cli-engine/formatters/unix.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @fileoverview unix-style formatter. - * @author oshi-shinobu - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Helper Functions -//------------------------------------------------------------------------------ - -/** - * Returns a canonical error level string based upon the error message passed in. - * @param {Object} message Individual error message provided by eslint - * @returns {string} Error level string - */ -function getMessageType(message) { - if (message.fatal || message.severity === 2) { - return "Error"; - } - return "Warning"; - -} - - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results) { - - let output = "", - total = 0; - - results.forEach(result => { - - const messages = result.messages; - - total += messages.length; - - messages.forEach(message => { - - output += `${result.filePath}:`; - output += `${message.line || 0}:`; - output += `${message.column || 0}:`; - output += ` ${message.message} `; - output += `[${getMessageType(message)}${message.ruleId ? `/${message.ruleId}` : ""}]`; - output += "\n"; - - }); - - }); - - if (total > 0) { - output += `\n${total} problem${total !== 1 ? "s" : ""}`; - } - - return output; -}; diff --git a/node_modules/eslint/lib/cli-engine/formatters/visualstudio.js b/node_modules/eslint/lib/cli-engine/formatters/visualstudio.js deleted file mode 100644 index 0d49431db..000000000 --- a/node_modules/eslint/lib/cli-engine/formatters/visualstudio.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @fileoverview Visual Studio compatible formatter - * @author Ronald Pijnacker - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helper Functions -//------------------------------------------------------------------------------ - -/** - * Returns the severity of warning or error - * @param {Object} message message object to examine - * @returns {string} severity level - * @private - */ -function getMessageType(message) { - if (message.fatal || message.severity === 2) { - return "error"; - } - return "warning"; - -} - - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = function(results) { - - let output = "", - total = 0; - - results.forEach(result => { - - const messages = result.messages; - - total += messages.length; - - messages.forEach(message => { - - output += result.filePath; - output += `(${message.line || 0}`; - output += message.column ? `,${message.column}` : ""; - output += `): ${getMessageType(message)}`; - output += message.ruleId ? ` ${message.ruleId}` : ""; - output += ` : ${message.message}`; - output += "\n"; - - }); - - }); - - if (total === 0) { - output += "no problems"; - } else { - output += `\n${total} problem${total !== 1 ? "s" : ""}`; - } - - return output; -}; diff --git a/node_modules/eslint/lib/cli-engine/hash.js b/node_modules/eslint/lib/cli-engine/hash.js deleted file mode 100644 index 8e467734a..000000000 --- a/node_modules/eslint/lib/cli-engine/hash.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @fileoverview Defining the hashing function in one place. - * @author Michael Ficarra - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const murmur = require("imurmurhash"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -/** - * hash the given string - * @param {string} str the string to hash - * @returns {string} the hash - */ -function hash(str) { - return murmur(str).result().toString(36); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = hash; diff --git a/node_modules/eslint/lib/cli-engine/index.js b/node_modules/eslint/lib/cli-engine/index.js deleted file mode 100644 index 52e45a6d7..000000000 --- a/node_modules/eslint/lib/cli-engine/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -const { CLIEngine } = require("./cli-engine"); - -module.exports = { - CLIEngine -}; diff --git a/node_modules/eslint/lib/cli-engine/lint-result-cache.js b/node_modules/eslint/lib/cli-engine/lint-result-cache.js deleted file mode 100644 index e36eb74ba..000000000 --- a/node_modules/eslint/lib/cli-engine/lint-result-cache.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * @fileoverview Utility for caching lint results. - * @author Kevin Partington - */ -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const assert = require("assert"); -const fs = require("fs"); -const fileEntryCache = require("file-entry-cache"); -const stringify = require("json-stable-stringify-without-jsonify"); -const pkg = require("../../package.json"); -const hash = require("./hash"); - -const debug = require("debug")("eslint:lint-result-cache"); - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const configHashCache = new WeakMap(); -const nodeVersion = process && process.version; - -const validCacheStrategies = ["metadata", "content"]; -const invalidCacheStrategyErrorMessage = `Cache strategy must be one of: ${validCacheStrategies - .map(strategy => `"${strategy}"`) - .join(", ")}`; - -/** - * Tests whether a provided cacheStrategy is valid - * @param {string} cacheStrategy The cache strategy to use - * @returns {boolean} true if `cacheStrategy` is one of `validCacheStrategies`; false otherwise - */ -function isValidCacheStrategy(cacheStrategy) { - return ( - validCacheStrategies.includes(cacheStrategy) - ); -} - -/** - * Calculates the hash of the config - * @param {ConfigArray} config The config. - * @returns {string} The hash of the config - */ -function hashOfConfigFor(config) { - if (!configHashCache.has(config)) { - configHashCache.set(config, hash(`${pkg.version}_${nodeVersion}_${stringify(config)}`)); - } - - return configHashCache.get(config); -} - -//----------------------------------------------------------------------------- -// Public Interface -//----------------------------------------------------------------------------- - -/** - * Lint result cache. This wraps around the file-entry-cache module, - * transparently removing properties that are difficult or expensive to - * serialize and adding them back in on retrieval. - */ -class LintResultCache { - - /** - * Creates a new LintResultCache instance. - * @param {string} cacheFileLocation The cache file location. - * @param {"metadata" | "content"} cacheStrategy The cache strategy to use. - */ - constructor(cacheFileLocation, cacheStrategy) { - assert(cacheFileLocation, "Cache file location is required"); - assert(cacheStrategy, "Cache strategy is required"); - assert( - isValidCacheStrategy(cacheStrategy), - invalidCacheStrategyErrorMessage - ); - - debug(`Caching results to ${cacheFileLocation}`); - - const useChecksum = cacheStrategy === "content"; - - debug( - `Using "${cacheStrategy}" strategy to detect changes` - ); - - this.fileEntryCache = fileEntryCache.create( - cacheFileLocation, - void 0, - useChecksum - ); - this.cacheFileLocation = cacheFileLocation; - } - - /** - * Retrieve cached lint results for a given file path, if present in the - * cache. If the file is present and has not been changed, rebuild any - * missing result information. - * @param {string} filePath The file for which to retrieve lint results. - * @param {ConfigArray} config The config of the file. - * @returns {Object|null} The rebuilt lint results, or null if the file is - * changed or not in the filesystem. - */ - getCachedLintResults(filePath, config) { - - /* - * Cached lint results are valid if and only if: - * 1. The file is present in the filesystem - * 2. The file has not changed since the time it was previously linted - * 3. The ESLint configuration has not changed since the time the file - * was previously linted - * If any of these are not true, we will not reuse the lint results. - */ - const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath); - const hashOfConfig = hashOfConfigFor(config); - const changed = - fileDescriptor.changed || - fileDescriptor.meta.hashOfConfig !== hashOfConfig; - - if (fileDescriptor.notFound) { - debug(`File not found on the file system: ${filePath}`); - return null; - } - - if (changed) { - debug(`Cache entry not found or no longer valid: ${filePath}`); - return null; - } - - // If source is present but null, need to reread the file from the filesystem. - if ( - fileDescriptor.meta.results && - fileDescriptor.meta.results.source === null - ) { - debug(`Rereading cached result source from filesystem: ${filePath}`); - fileDescriptor.meta.results.source = fs.readFileSync(filePath, "utf-8"); - } - - return fileDescriptor.meta.results; - } - - /** - * Set the cached lint results for a given file path, after removing any - * information that will be both unnecessary and difficult to serialize. - * Avoids caching results with an "output" property (meaning fixes were - * applied), to prevent potentially incorrect results if fixes are not - * written to disk. - * @param {string} filePath The file for which to set lint results. - * @param {ConfigArray} config The config of the file. - * @param {Object} result The lint result to be set for the file. - * @returns {void} - */ - setCachedLintResults(filePath, config, result) { - if (result && Object.prototype.hasOwnProperty.call(result, "output")) { - return; - } - - const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath); - - if (fileDescriptor && !fileDescriptor.notFound) { - debug(`Updating cached result: ${filePath}`); - - // Serialize the result, except that we want to remove the file source if present. - const resultToSerialize = Object.assign({}, result); - - /* - * Set result.source to null. - * In `getCachedLintResults`, if source is explicitly null, we will - * read the file from the filesystem to set the value again. - */ - if (Object.prototype.hasOwnProperty.call(resultToSerialize, "source")) { - resultToSerialize.source = null; - } - - fileDescriptor.meta.results = resultToSerialize; - fileDescriptor.meta.hashOfConfig = hashOfConfigFor(config); - } - } - - /** - * Persists the in-memory cache to disk. - * @returns {void} - */ - reconcile() { - debug(`Persisting cached results: ${this.cacheFileLocation}`); - this.fileEntryCache.reconcile(); - } -} - -module.exports = LintResultCache; diff --git a/node_modules/eslint/lib/cli-engine/load-rules.js b/node_modules/eslint/lib/cli-engine/load-rules.js deleted file mode 100644 index 81bab63fa..000000000 --- a/node_modules/eslint/lib/cli-engine/load-rules.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @fileoverview Module for loading rules from files and directories. - * @author Michael Ficarra - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const fs = require("fs"), - path = require("path"); - -const rulesDirCache = {}; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Load all rule modules from specified directory. - * @param {string} relativeRulesDir Path to rules directory, may be relative. - * @param {string} cwd Current working directory - * @returns {Object} Loaded rule modules. - */ -module.exports = function(relativeRulesDir, cwd) { - const rulesDir = path.resolve(cwd, relativeRulesDir); - - // cache will help performance as IO operation are expensive - if (rulesDirCache[rulesDir]) { - return rulesDirCache[rulesDir]; - } - - const rules = Object.create(null); - - fs.readdirSync(rulesDir).forEach(file => { - if (path.extname(file) !== ".js") { - return; - } - rules[file.slice(0, -3)] = require(path.join(rulesDir, file)); - }); - rulesDirCache[rulesDir] = rules; - - return rules; -}; diff --git a/node_modules/eslint/lib/cli-engine/xml-escape.js b/node_modules/eslint/lib/cli-engine/xml-escape.js deleted file mode 100644 index 2e52dbaac..000000000 --- a/node_modules/eslint/lib/cli-engine/xml-escape.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @fileoverview XML character escaper - * @author George Chung - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Returns the escaped value for a character - * @param {string} s string to examine - * @returns {string} severity level - * @private - */ -module.exports = function(s) { - return (`${s}`).replace(/[<>&"'\x00-\x1F\x7F\u0080-\uFFFF]/gu, c => { // eslint-disable-line no-control-regex -- Converting controls to entities - switch (c) { - case "<": - return "<"; - case ">": - return ">"; - case "&": - return "&"; - case "\"": - return """; - case "'": - return "'"; - default: - return `&#${c.charCodeAt(0)};`; - } - }); -}; diff --git a/node_modules/eslint/lib/cli.js b/node_modules/eslint/lib/cli.js deleted file mode 100644 index a14930e9b..000000000 --- a/node_modules/eslint/lib/cli.js +++ /dev/null @@ -1,441 +0,0 @@ -/** - * @fileoverview Main CLI object. - * @author Nicholas C. Zakas - */ - -"use strict"; - -/* - * NOTE: The CLI object should *not* call process.exit() directly. It should only return - * exit codes. This allows other programs to use the CLI object and still control - * when the program exits. - */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const fs = require("fs"), - path = require("path"), - { promisify } = require("util"), - { ESLint } = require("./eslint"), - { FlatESLint, shouldUseFlatConfig } = require("./eslint/flat-eslint"), - createCLIOptions = require("./options"), - log = require("./shared/logging"), - RuntimeInfo = require("./shared/runtime-info"); -const { Legacy: { naming } } = require("@eslint/eslintrc"); -const { ModuleImporter } = require("@humanwhocodes/module-importer"); - -const debug = require("debug")("eslint:cli"); - -//------------------------------------------------------------------------------ -// Types -//------------------------------------------------------------------------------ - -/** @typedef {import("./eslint/eslint").ESLintOptions} ESLintOptions */ -/** @typedef {import("./eslint/eslint").LintMessage} LintMessage */ -/** @typedef {import("./eslint/eslint").LintResult} LintResult */ -/** @typedef {import("./options").ParsedCLIOptions} ParsedCLIOptions */ -/** @typedef {import("./shared/types").ResultsMeta} ResultsMeta */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const mkdir = promisify(fs.mkdir); -const stat = promisify(fs.stat); -const writeFile = promisify(fs.writeFile); - -/** - * Predicate function for whether or not to apply fixes in quiet mode. - * If a message is a warning, do not apply a fix. - * @param {LintMessage} message The lint result. - * @returns {boolean} True if the lint message is an error (and thus should be - * autofixed), false otherwise. - */ -function quietFixPredicate(message) { - return message.severity === 2; -} - -/** - * Translates the CLI options into the options expected by the ESLint constructor. - * @param {ParsedCLIOptions} cliOptions The CLI options to translate. - * @param {"flat"|"eslintrc"} [configType="eslintrc"] The format of the - * config to generate. - * @returns {Promise} The options object for the ESLint constructor. - * @private - */ -async function translateOptions({ - cache, - cacheFile, - cacheLocation, - cacheStrategy, - config, - configLookup, - env, - errorOnUnmatchedPattern, - eslintrc, - ext, - fix, - fixDryRun, - fixType, - global, - ignore, - ignorePath, - ignorePattern, - inlineConfig, - parser, - parserOptions, - plugin, - quiet, - reportUnusedDisableDirectives, - resolvePluginsRelativeTo, - rule, - rulesdir -}, configType) { - - let overrideConfig, overrideConfigFile; - const importer = new ModuleImporter(); - - if (configType === "flat") { - overrideConfigFile = (typeof config === "string") ? config : !configLookup; - if (overrideConfigFile === false) { - overrideConfigFile = void 0; - } - - let globals = {}; - - if (global) { - globals = global.reduce((obj, name) => { - if (name.endsWith(":true")) { - obj[name.slice(0, -5)] = "writable"; - } else { - obj[name] = "readonly"; - } - return obj; - }, globals); - } - - overrideConfig = [{ - languageOptions: { - globals, - parserOptions: parserOptions || {} - }, - rules: rule ? rule : {} - }]; - - if (parser) { - overrideConfig[0].languageOptions.parser = await importer.import(parser); - } - - if (plugin) { - const plugins = {}; - - for (const pluginName of plugin) { - - const shortName = naming.getShorthandName(pluginName, "eslint-plugin"); - const longName = naming.normalizePackageName(pluginName, "eslint-plugin"); - - plugins[shortName] = await importer.import(longName); - } - - overrideConfig[0].plugins = plugins; - } - - } else { - overrideConfigFile = config; - - overrideConfig = { - env: env && env.reduce((obj, name) => { - obj[name] = true; - return obj; - }, {}), - globals: global && global.reduce((obj, name) => { - if (name.endsWith(":true")) { - obj[name.slice(0, -5)] = "writable"; - } else { - obj[name] = "readonly"; - } - return obj; - }, {}), - ignorePatterns: ignorePattern, - parser, - parserOptions, - plugins: plugin, - rules: rule - }; - } - - const options = { - allowInlineConfig: inlineConfig, - cache, - cacheLocation: cacheLocation || cacheFile, - cacheStrategy, - errorOnUnmatchedPattern, - fix: (fix || fixDryRun) && (quiet ? quietFixPredicate : true), - fixTypes: fixType, - ignore, - overrideConfig, - overrideConfigFile, - reportUnusedDisableDirectives: reportUnusedDisableDirectives ? "error" : void 0 - }; - - if (configType === "flat") { - options.ignorePatterns = ignorePattern; - } else { - options.resolvePluginsRelativeTo = resolvePluginsRelativeTo; - options.rulePaths = rulesdir; - options.useEslintrc = eslintrc; - options.extensions = ext; - options.ignorePath = ignorePath; - } - - return options; -} - -/** - * Count error messages. - * @param {LintResult[]} results The lint results. - * @returns {{errorCount:number;fatalErrorCount:number,warningCount:number}} The number of error messages. - */ -function countErrors(results) { - let errorCount = 0; - let fatalErrorCount = 0; - let warningCount = 0; - - for (const result of results) { - errorCount += result.errorCount; - fatalErrorCount += result.fatalErrorCount; - warningCount += result.warningCount; - } - - return { errorCount, fatalErrorCount, warningCount }; -} - -/** - * Check if a given file path is a directory or not. - * @param {string} filePath The path to a file to check. - * @returns {Promise} `true` if the given path is a directory. - */ -async function isDirectory(filePath) { - try { - return (await stat(filePath)).isDirectory(); - } catch (error) { - if (error.code === "ENOENT" || error.code === "ENOTDIR") { - return false; - } - throw error; - } -} - -/** - * Outputs the results of the linting. - * @param {ESLint} engine The ESLint instance to use. - * @param {LintResult[]} results The results to print. - * @param {string} format The name of the formatter to use or the path to the formatter. - * @param {string} outputFile The path for the output file. - * @param {ResultsMeta} resultsMeta Warning count and max threshold. - * @returns {Promise} True if the printing succeeds, false if not. - * @private - */ -async function printResults(engine, results, format, outputFile, resultsMeta) { - let formatter; - - try { - formatter = await engine.loadFormatter(format); - } catch (e) { - log.error(e.message); - return false; - } - - const output = await formatter.format(results, resultsMeta); - - if (output) { - if (outputFile) { - const filePath = path.resolve(process.cwd(), outputFile); - - if (await isDirectory(filePath)) { - log.error("Cannot write to output file path, it is a directory: %s", outputFile); - return false; - } - - try { - await mkdir(path.dirname(filePath), { recursive: true }); - await writeFile(filePath, output); - } catch (ex) { - log.error("There was a problem writing the output file:\n%s", ex); - return false; - } - } else { - log.info(output); - } - } - - return true; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Encapsulates all CLI behavior for eslint. Makes it easier to test as well as - * for other Node.js programs to effectively run the CLI. - */ -const cli = { - - /** - * Executes the CLI based on an array of arguments that is passed in. - * @param {string|Array|Object} args The arguments to process. - * @param {string} [text] The text to lint (used for TTY). - * @param {boolean} [allowFlatConfig] Whether or not to allow flat config. - * @returns {Promise} The exit code for the operation. - */ - async execute(args, text, allowFlatConfig) { - if (Array.isArray(args)) { - debug("CLI args: %o", args.slice(2)); - } - - /* - * Before doing anything, we need to see if we are using a - * flat config file. If so, then we need to change the way command - * line args are parsed. This is temporary, and when we fully - * switch to flat config we can remove this logic. - */ - - const usingFlatConfig = allowFlatConfig && await shouldUseFlatConfig(); - - debug("Using flat config?", usingFlatConfig); - - const CLIOptions = createCLIOptions(usingFlatConfig); - - /** @type {ParsedCLIOptions} */ - let options; - - try { - options = CLIOptions.parse(args); - } catch (error) { - debug("Error parsing CLI options:", error.message); - log.error(error.message); - return 2; - } - - const files = options._; - const useStdin = typeof text === "string"; - - if (options.help) { - log.info(CLIOptions.generateHelp()); - return 0; - } - if (options.version) { - log.info(RuntimeInfo.version()); - return 0; - } - if (options.envInfo) { - try { - log.info(RuntimeInfo.environment()); - return 0; - } catch (err) { - debug("Error retrieving environment info"); - log.error(err.message); - return 2; - } - } - - if (options.printConfig) { - if (files.length) { - log.error("The --print-config option must be used with exactly one file name."); - return 2; - } - if (useStdin) { - log.error("The --print-config option is not available for piped-in code."); - return 2; - } - - const engine = usingFlatConfig - ? new FlatESLint(await translateOptions(options, "flat")) - : new ESLint(await translateOptions(options)); - const fileConfig = - await engine.calculateConfigForFile(options.printConfig); - - log.info(JSON.stringify(fileConfig, null, " ")); - return 0; - } - - debug(`Running on ${useStdin ? "text" : "files"}`); - - if (options.fix && options.fixDryRun) { - log.error("The --fix option and the --fix-dry-run option cannot be used together."); - return 2; - } - if (useStdin && options.fix) { - log.error("The --fix option is not available for piped-in code; use --fix-dry-run instead."); - return 2; - } - if (options.fixType && !options.fix && !options.fixDryRun) { - log.error("The --fix-type option requires either --fix or --fix-dry-run."); - return 2; - } - - const ActiveESLint = usingFlatConfig ? FlatESLint : ESLint; - - const engine = new ActiveESLint(await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc")); - let results; - - if (useStdin) { - results = await engine.lintText(text, { - filePath: options.stdinFilename, - warnIgnored: true - }); - } else { - results = await engine.lintFiles(files); - } - - if (options.fix) { - debug("Fix mode enabled - applying fixes"); - await ActiveESLint.outputFixes(results); - } - - let resultsToPrint = results; - - if (options.quiet) { - debug("Quiet mode enabled - filtering out warnings"); - resultsToPrint = ActiveESLint.getErrorResults(resultsToPrint); - } - - const resultCounts = countErrors(results); - const tooManyWarnings = options.maxWarnings >= 0 && resultCounts.warningCount > options.maxWarnings; - const resultsMeta = tooManyWarnings - ? { - maxWarningsExceeded: { - maxWarnings: options.maxWarnings, - foundWarnings: resultCounts.warningCount - } - } - : {}; - - if (await printResults(engine, resultsToPrint, options.format, options.outputFile, resultsMeta)) { - - // Errors and warnings from the original unfiltered results should determine the exit code - const shouldExitForFatalErrors = - options.exitOnFatalError && resultCounts.fatalErrorCount > 0; - - if (!resultCounts.errorCount && tooManyWarnings) { - log.error( - "ESLint found too many warnings (maximum: %s).", - options.maxWarnings - ); - } - - if (shouldExitForFatalErrors) { - return 2; - } - - return (resultCounts.errorCount || tooManyWarnings) ? 1 : 0; - } - - return 2; - } -}; - -module.exports = cli; diff --git a/node_modules/eslint/lib/config/default-config.js b/node_modules/eslint/lib/config/default-config.js deleted file mode 100644 index 8a6ff8200..000000000 --- a/node_modules/eslint/lib/config/default-config.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @fileoverview Default configuration - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const Rules = require("../rules"); - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -exports.defaultConfig = [ - { - plugins: { - "@": { - - /* - * Because we try to delay loading rules until absolutely - * necessary, a proxy allows us to hook into the lazy-loading - * aspect of the rules map while still keeping all of the - * relevant configuration inside of the config array. - */ - rules: new Proxy({}, { - get(target, property) { - return Rules.get(property); - }, - - has(target, property) { - return Rules.has(property); - } - }) - } - }, - languageOptions: { - sourceType: "module", - ecmaVersion: "latest", - parser: require("espree"), - parserOptions: {} - } - }, - - // default ignores are listed here - { - ignores: [ - "**/node_modules/", - ".git/" - ] - }, - - // intentionally empty config to ensure these files are globbed by default - { - files: ["**/*.js", "**/*.mjs"] - }, - { - files: ["**/*.cjs"], - languageOptions: { - sourceType: "commonjs", - ecmaVersion: "latest" - } - } -]; diff --git a/node_modules/eslint/lib/config/flat-config-array.js b/node_modules/eslint/lib/config/flat-config-array.js deleted file mode 100644 index 689dc429f..000000000 --- a/node_modules/eslint/lib/config/flat-config-array.js +++ /dev/null @@ -1,274 +0,0 @@ -/** - * @fileoverview Flat Config Array - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const { ConfigArray, ConfigArraySymbol } = require("@humanwhocodes/config-array"); -const { flatConfigSchema } = require("./flat-config-schema"); -const { RuleValidator } = require("./rule-validator"); -const { defaultConfig } = require("./default-config"); -const jsPlugin = require("@eslint/js"); - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const ruleValidator = new RuleValidator(); - -/** - * Splits a plugin identifier in the form a/b/c into two parts: a/b and c. - * @param {string} identifier The identifier to parse. - * @returns {{objectName: string, pluginName: string}} The parts of the plugin - * name. - */ -function splitPluginIdentifier(identifier) { - const parts = identifier.split("/"); - - return { - objectName: parts.pop(), - pluginName: parts.join("/") - }; -} - -/** - * Returns the name of an object in the config by reading its `meta` key. - * @param {Object} object The object to check. - * @returns {string?} The name of the object if found or `null` if there - * is no name. - */ -function getObjectId(object) { - - // first check old-style name - let name = object.name; - - if (!name) { - - if (!object.meta) { - return null; - } - - name = object.meta.name; - - if (!name) { - return null; - } - } - - // now check for old-style version - let version = object.version; - - if (!version) { - version = object.meta && object.meta.version; - } - - // if there's a version then append that - if (version) { - return `${name}@${version}`; - } - - return name; -} - -const originalBaseConfig = Symbol("originalBaseConfig"); - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * Represents an array containing configuration information for ESLint. - */ -class FlatConfigArray extends ConfigArray { - - /** - * Creates a new instance. - * @param {*[]} configs An array of configuration information. - * @param {{basePath: string, shouldIgnore: boolean, baseConfig: FlatConfig}} options The options - * to use for the config array instance. - */ - constructor(configs, { - basePath, - shouldIgnore = true, - baseConfig = defaultConfig - } = {}) { - super(configs, { - basePath, - schema: flatConfigSchema - }); - - if (baseConfig[Symbol.iterator]) { - this.unshift(...baseConfig); - } else { - this.unshift(baseConfig); - } - - /** - * The base config used to build the config array. - * @type {Array} - */ - this[originalBaseConfig] = baseConfig; - Object.defineProperty(this, originalBaseConfig, { writable: false }); - - /** - * Determines if `ignores` fields should be honored. - * If true, then all `ignores` fields are honored. - * if false, then only `ignores` fields in the baseConfig are honored. - * @type {boolean} - */ - this.shouldIgnore = shouldIgnore; - Object.defineProperty(this, "shouldIgnore", { writable: false }); - } - - /* eslint-disable class-methods-use-this -- Desired as instance method */ - /** - * Replaces a config with another config to allow us to put strings - * in the config array that will be replaced by objects before - * normalization. - * @param {Object} config The config to preprocess. - * @returns {Object} The preprocessed config. - */ - [ConfigArraySymbol.preprocessConfig](config) { - if (config === "eslint:recommended") { - - // if we are in a Node.js environment warn the user - if (typeof process !== "undefined" && process.emitWarning) { - process.emitWarning("The 'eslint:recommended' string configuration is deprecated and will be replaced by the @eslint/js package's 'recommended' config."); - } - - return jsPlugin.configs.recommended; - } - - if (config === "eslint:all") { - - // if we are in a Node.js environment warn the user - if (typeof process !== "undefined" && process.emitWarning) { - process.emitWarning("The 'eslint:all' string configuration is deprecated and will be replaced by the @eslint/js package's 'all' config."); - } - - return jsPlugin.configs.all; - } - - /* - * If `shouldIgnore` is false, we remove any ignore patterns specified - * in the config so long as it's not a default config and it doesn't - * have a `files` entry. - */ - if ( - !this.shouldIgnore && - !this[originalBaseConfig].includes(config) && - config.ignores && - !config.files - ) { - /* eslint-disable-next-line no-unused-vars -- need to strip off other keys */ - const { ignores, ...otherKeys } = config; - - return otherKeys; - } - - return config; - } - - /** - * Finalizes the config by replacing plugin references with their objects - * and validating rule option schemas. - * @param {Object} config The config to finalize. - * @returns {Object} The finalized config. - * @throws {TypeError} If the config is invalid. - */ - [ConfigArraySymbol.finalizeConfig](config) { - - const { plugins, languageOptions, processor } = config; - let parserName, processorName; - let invalidParser = false, - invalidProcessor = false; - - // Check parser value - if (languageOptions && languageOptions.parser) { - const { parser } = languageOptions; - - if (typeof parser === "object") { - parserName = getObjectId(parser); - - if (!parserName) { - invalidParser = true; - } - - } else { - invalidParser = true; - } - } - - // Check processor value - if (processor) { - if (typeof processor === "string") { - const { pluginName, objectName: localProcessorName } = splitPluginIdentifier(processor); - - processorName = processor; - - if (!plugins || !plugins[pluginName] || !plugins[pluginName].processors || !plugins[pluginName].processors[localProcessorName]) { - throw new TypeError(`Key "processor": Could not find "${localProcessorName}" in plugin "${pluginName}".`); - } - - config.processor = plugins[pluginName].processors[localProcessorName]; - } else if (typeof processor === "object") { - processorName = getObjectId(processor); - - if (!processorName) { - invalidProcessor = true; - } - - } else { - invalidProcessor = true; - } - } - - ruleValidator.validate(config); - - // apply special logic for serialization into JSON - /* eslint-disable object-shorthand -- shorthand would change "this" value */ - Object.defineProperty(config, "toJSON", { - value: function() { - - if (invalidParser) { - throw new Error("Could not serialize parser object (missing 'meta' object)."); - } - - if (invalidProcessor) { - throw new Error("Could not serialize processor object (missing 'meta' object)."); - } - - return { - ...this, - plugins: Object.entries(plugins).map(([namespace, plugin]) => { - - const pluginId = getObjectId(plugin); - - if (!pluginId) { - return namespace; - } - - return `${namespace}:${pluginId}`; - }), - languageOptions: { - ...languageOptions, - parser: parserName - }, - processor: processorName - }; - } - }); - /* eslint-enable object-shorthand -- ok to enable now */ - - return config; - } - /* eslint-enable class-methods-use-this -- Desired as instance method */ - -} - -exports.FlatConfigArray = FlatConfigArray; diff --git a/node_modules/eslint/lib/config/flat-config-helpers.js b/node_modules/eslint/lib/config/flat-config-helpers.js deleted file mode 100644 index e00c56434..000000000 --- a/node_modules/eslint/lib/config/flat-config-helpers.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @fileoverview Shared functions to work with configs. - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Functions -//----------------------------------------------------------------------------- - -/** - * Parses a ruleId into its plugin and rule parts. - * @param {string} ruleId The rule ID to parse. - * @returns {{pluginName:string,ruleName:string}} The plugin and rule - * parts of the ruleId; - */ -function parseRuleId(ruleId) { - let pluginName, ruleName; - - // distinguish between core rules and plugin rules - if (ruleId.includes("/")) { - - // mimic scoped npm packages - if (ruleId.startsWith("@")) { - pluginName = ruleId.slice(0, ruleId.lastIndexOf("/")); - } else { - pluginName = ruleId.slice(0, ruleId.indexOf("/")); - } - - ruleName = ruleId.slice(pluginName.length + 1); - } else { - pluginName = "@"; - ruleName = ruleId; - } - - return { - pluginName, - ruleName - }; -} - -/** - * Retrieves a rule instance from a given config based on the ruleId. - * @param {string} ruleId The rule ID to look for. - * @param {FlatConfig} config The config to search. - * @returns {import("../shared/types").Rule|undefined} The rule if found - * or undefined if not. - */ -function getRuleFromConfig(ruleId, config) { - - const { pluginName, ruleName } = parseRuleId(ruleId); - - const plugin = config.plugins && config.plugins[pluginName]; - let rule = plugin && plugin.rules && plugin.rules[ruleName]; - - - // normalize function rules into objects - if (rule && typeof rule === "function") { - rule = { - create: rule - }; - } - - return rule; -} - -/** - * Gets a complete options schema for a rule. - * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object - * @returns {Object} JSON Schema for the rule's options. - */ -function getRuleOptionsSchema(rule) { - - if (!rule) { - return null; - } - - const schema = rule.schema || rule.meta && rule.meta.schema; - - if (Array.isArray(schema)) { - if (schema.length) { - return { - type: "array", - items: schema, - minItems: 0, - maxItems: schema.length - }; - } - return { - type: "array", - minItems: 0, - maxItems: 0 - }; - - } - - // Given a full schema, leave it alone - return schema || null; -} - - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -module.exports = { - parseRuleId, - getRuleFromConfig, - getRuleOptionsSchema -}; diff --git a/node_modules/eslint/lib/config/flat-config-schema.js b/node_modules/eslint/lib/config/flat-config-schema.js deleted file mode 100644 index 10d6b50ef..000000000 --- a/node_modules/eslint/lib/config/flat-config-schema.js +++ /dev/null @@ -1,465 +0,0 @@ -/** - * @fileoverview Flat config schema - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Type Definitions -//----------------------------------------------------------------------------- - -/** - * @typedef ObjectPropertySchema - * @property {Function|string} merge The function or name of the function to call - * to merge multiple objects with this property. - * @property {Function|string} validate The function or name of the function to call - * to validate the value of this property. - */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const ruleSeverities = new Map([ - [0, 0], ["off", 0], - [1, 1], ["warn", 1], - [2, 2], ["error", 2] -]); - -const globalVariablesValues = new Set([ - true, "true", "writable", "writeable", - false, "false", "readonly", "readable", null, - "off" -]); - -/** - * Check if a value is a non-null object. - * @param {any} value The value to check. - * @returns {boolean} `true` if the value is a non-null object. - */ -function isNonNullObject(value) { - return typeof value === "object" && value !== null; -} - -/** - * Check if a value is undefined. - * @param {any} value The value to check. - * @returns {boolean} `true` if the value is undefined. - */ -function isUndefined(value) { - return typeof value === "undefined"; -} - -/** - * Deeply merges two objects. - * @param {Object} first The base object. - * @param {Object} second The overrides object. - * @returns {Object} An object with properties from both first and second. - */ -function deepMerge(first = {}, second = {}) { - - /* - * If the second value is an array, just return it. We don't merge - * arrays because order matters and we can't know the correct order. - */ - if (Array.isArray(second)) { - return second; - } - - /* - * First create a result object where properties from the second object - * overwrite properties from the first. This sets up a baseline to use - * later rather than needing to inspect and change every property - * individually. - */ - const result = { - ...first, - ...second - }; - - for (const key of Object.keys(second)) { - - // avoid hairy edge case - if (key === "__proto__") { - continue; - } - - const firstValue = first[key]; - const secondValue = second[key]; - - if (isNonNullObject(firstValue)) { - result[key] = deepMerge(firstValue, secondValue); - } else if (isUndefined(firstValue)) { - if (isNonNullObject(secondValue)) { - result[key] = deepMerge( - Array.isArray(secondValue) ? [] : {}, - secondValue - ); - } else if (!isUndefined(secondValue)) { - result[key] = secondValue; - } - } - } - - return result; - -} - -/** - * Normalizes the rule options config for a given rule by ensuring that - * it is an array and that the first item is 0, 1, or 2. - * @param {Array|string|number} ruleOptions The rule options config. - * @returns {Array} An array of rule options. - */ -function normalizeRuleOptions(ruleOptions) { - - const finalOptions = Array.isArray(ruleOptions) - ? ruleOptions.slice(0) - : [ruleOptions]; - - finalOptions[0] = ruleSeverities.get(finalOptions[0]); - return finalOptions; -} - -//----------------------------------------------------------------------------- -// Assertions -//----------------------------------------------------------------------------- - -/** - * The error type when a rule's options are configured with an invalid type. - */ -class InvalidRuleOptionsError extends Error { - - /** - * @param {string} ruleId Rule name being configured. - * @param {any} value The invalid value. - */ - constructor(ruleId, value) { - super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`); - this.messageTemplate = "invalid-rule-options"; - this.messageData = { ruleId, value }; - } -} - -/** - * Validates that a value is a valid rule options entry. - * @param {string} ruleId Rule name being configured. - * @param {any} value The value to check. - * @returns {void} - * @throws {InvalidRuleOptionsError} If the value isn't a valid rule options. - */ -function assertIsRuleOptions(ruleId, value) { - if (typeof value !== "string" && typeof value !== "number" && !Array.isArray(value)) { - throw new InvalidRuleOptionsError(ruleId, value); - } -} - -/** - * The error type when a rule's severity is invalid. - */ -class InvalidRuleSeverityError extends Error { - - /** - * @param {string} ruleId Rule name being configured. - * @param {any} value The invalid value. - */ - constructor(ruleId, value) { - super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`); - this.messageTemplate = "invalid-rule-severity"; - this.messageData = { ruleId, value }; - } -} - -/** - * Validates that a value is valid rule severity. - * @param {string} ruleId Rule name being configured. - * @param {any} value The value to check. - * @returns {void} - * @throws {InvalidRuleSeverityError} If the value isn't a valid rule severity. - */ -function assertIsRuleSeverity(ruleId, value) { - const severity = typeof value === "string" - ? ruleSeverities.get(value.toLowerCase()) - : ruleSeverities.get(value); - - if (typeof severity === "undefined") { - throw new InvalidRuleSeverityError(ruleId, value); - } -} - -/** - * Validates that a given string is the form pluginName/objectName. - * @param {string} value The string to check. - * @returns {void} - * @throws {TypeError} If the string isn't in the correct format. - */ -function assertIsPluginMemberName(value) { - if (!/[@a-z0-9-_$]+(?:\/(?:[a-z0-9-_$]+))+$/iu.test(value)) { - throw new TypeError(`Expected string in the form "pluginName/objectName" but found "${value}".`); - } -} - -/** - * Validates that a value is an object. - * @param {any} value The value to check. - * @returns {void} - * @throws {TypeError} If the value isn't an object. - */ -function assertIsObject(value) { - if (!isNonNullObject(value)) { - throw new TypeError("Expected an object."); - } -} - -//----------------------------------------------------------------------------- -// Low-Level Schemas -//----------------------------------------------------------------------------- - -/** @type {ObjectPropertySchema} */ -const booleanSchema = { - merge: "replace", - validate: "boolean" -}; - -/** @type {ObjectPropertySchema} */ -const deepObjectAssignSchema = { - merge(first = {}, second = {}) { - return deepMerge(first, second); - }, - validate: "object" -}; - -//----------------------------------------------------------------------------- -// High-Level Schemas -//----------------------------------------------------------------------------- - -/** @type {ObjectPropertySchema} */ -const globalsSchema = { - merge: "assign", - validate(value) { - - assertIsObject(value); - - for (const key of Object.keys(value)) { - - // avoid hairy edge case - if (key === "__proto__") { - continue; - } - - if (key !== key.trim()) { - throw new TypeError(`Global "${key}" has leading or trailing whitespace.`); - } - - if (!globalVariablesValues.has(value[key])) { - throw new TypeError(`Key "${key}": Expected "readonly", "writable", or "off".`); - } - } - } -}; - -/** @type {ObjectPropertySchema} */ -const parserSchema = { - merge: "replace", - validate(value) { - - if (!value || typeof value !== "object" || - (typeof value.parse !== "function" && typeof value.parseForESLint !== "function") - ) { - throw new TypeError("Expected object with parse() or parseForESLint() method."); - } - - } -}; - -/** @type {ObjectPropertySchema} */ -const pluginsSchema = { - merge(first = {}, second = {}) { - const keys = new Set([...Object.keys(first), ...Object.keys(second)]); - const result = {}; - - // manually validate that plugins are not redefined - for (const key of keys) { - - // avoid hairy edge case - if (key === "__proto__") { - continue; - } - - if (key in first && key in second && first[key] !== second[key]) { - throw new TypeError(`Cannot redefine plugin "${key}".`); - } - - result[key] = second[key] || first[key]; - } - - return result; - }, - validate(value) { - - // first check the value to be sure it's an object - if (value === null || typeof value !== "object") { - throw new TypeError("Expected an object."); - } - - // second check the keys to make sure they are objects - for (const key of Object.keys(value)) { - - // avoid hairy edge case - if (key === "__proto__") { - continue; - } - - if (value[key] === null || typeof value[key] !== "object") { - throw new TypeError(`Key "${key}": Expected an object.`); - } - } - } -}; - -/** @type {ObjectPropertySchema} */ -const processorSchema = { - merge: "replace", - validate(value) { - if (typeof value === "string") { - assertIsPluginMemberName(value); - } else if (value && typeof value === "object") { - if (typeof value.preprocess !== "function" || typeof value.postprocess !== "function") { - throw new TypeError("Object must have a preprocess() and a postprocess() method."); - } - } else { - throw new TypeError("Expected an object or a string."); - } - } -}; - -/** @type {ObjectPropertySchema} */ -const rulesSchema = { - merge(first = {}, second = {}) { - - const result = { - ...first, - ...second - }; - - for (const ruleId of Object.keys(result)) { - - // avoid hairy edge case - if (ruleId === "__proto__") { - - /* eslint-disable-next-line no-proto -- Though deprecated, may still be present */ - delete result.__proto__; - continue; - } - - result[ruleId] = normalizeRuleOptions(result[ruleId]); - - /* - * If either rule config is missing, then the correct - * config is already present and we just need to normalize - * the severity. - */ - if (!(ruleId in first) || !(ruleId in second)) { - continue; - } - - const firstRuleOptions = normalizeRuleOptions(first[ruleId]); - const secondRuleOptions = normalizeRuleOptions(second[ruleId]); - - /* - * If the second rule config only has a severity (length of 1), - * then use that severity and keep the rest of the options from - * the first rule config. - */ - if (secondRuleOptions.length === 1) { - result[ruleId] = [secondRuleOptions[0], ...firstRuleOptions.slice(1)]; - continue; - } - - /* - * In any other situation, then the second rule config takes - * precedence. That means the value at `result[ruleId]` is - * already correct and no further work is necessary. - */ - } - - return result; - }, - - validate(value) { - assertIsObject(value); - - /* - * We are not checking the rule schema here because there is no - * guarantee that the rule definition is present at this point. Instead - * we wait and check the rule schema during the finalization step - * of calculating a config. - */ - for (const ruleId of Object.keys(value)) { - - // avoid hairy edge case - if (ruleId === "__proto__") { - continue; - } - - const ruleOptions = value[ruleId]; - - assertIsRuleOptions(ruleId, ruleOptions); - - if (Array.isArray(ruleOptions)) { - assertIsRuleSeverity(ruleId, ruleOptions[0]); - } else { - assertIsRuleSeverity(ruleId, ruleOptions); - } - } - } -}; - -/** @type {ObjectPropertySchema} */ -const ecmaVersionSchema = { - merge: "replace", - validate(value) { - if (typeof value === "number" || value === "latest") { - return; - } - - throw new TypeError("Expected a number or \"latest\"."); - } -}; - -/** @type {ObjectPropertySchema} */ -const sourceTypeSchema = { - merge: "replace", - validate(value) { - if (typeof value !== "string" || !/^(?:script|module|commonjs)$/u.test(value)) { - throw new TypeError("Expected \"script\", \"module\", or \"commonjs\"."); - } - } -}; - -//----------------------------------------------------------------------------- -// Full schema -//----------------------------------------------------------------------------- - -exports.flatConfigSchema = { - settings: deepObjectAssignSchema, - linterOptions: { - schema: { - noInlineConfig: booleanSchema, - reportUnusedDisableDirectives: booleanSchema - } - }, - languageOptions: { - schema: { - ecmaVersion: ecmaVersionSchema, - sourceType: sourceTypeSchema, - globals: globalsSchema, - parser: parserSchema, - parserOptions: deepObjectAssignSchema - } - }, - processor: processorSchema, - plugins: pluginsSchema, - rules: rulesSchema -}; diff --git a/node_modules/eslint/lib/config/rule-validator.js b/node_modules/eslint/lib/config/rule-validator.js deleted file mode 100644 index 0b5858fb3..000000000 --- a/node_modules/eslint/lib/config/rule-validator.js +++ /dev/null @@ -1,157 +0,0 @@ -/** - * @fileoverview Rule Validator - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const ajv = require("../shared/ajv")(); -const { - parseRuleId, - getRuleFromConfig, - getRuleOptionsSchema -} = require("./flat-config-helpers"); -const ruleReplacements = require("../../conf/replacements.json"); - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/** - * Throws a helpful error when a rule cannot be found. - * @param {Object} ruleId The rule identifier. - * @param {string} ruleId.pluginName The ID of the rule to find. - * @param {string} ruleId.ruleName The ID of the rule to find. - * @param {Object} config The config to search in. - * @throws {TypeError} For missing plugin or rule. - * @returns {void} - */ -function throwRuleNotFoundError({ pluginName, ruleName }, config) { - - const ruleId = pluginName === "@" ? ruleName : `${pluginName}/${ruleName}`; - - const errorMessageHeader = `Key "rules": Key "${ruleId}"`; - let errorMessage = `${errorMessageHeader}: Could not find plugin "${pluginName}".`; - - // if the plugin exists then we need to check if the rule exists - if (config.plugins && config.plugins[pluginName]) { - const replacementRuleName = ruleReplacements.rules[ruleName]; - - if (pluginName === "@" && replacementRuleName) { - - errorMessage = `${errorMessageHeader}: Rule "${ruleName}" was removed and replaced by "${replacementRuleName}".`; - - } else { - - errorMessage = `${errorMessageHeader}: Could not find "${ruleName}" in plugin "${pluginName}".`; - - // otherwise, let's see if we can find the rule name elsewhere - for (const [otherPluginName, otherPlugin] of Object.entries(config.plugins)) { - if (otherPlugin.rules && otherPlugin.rules[ruleName]) { - errorMessage += ` Did you mean "${otherPluginName}/${ruleName}"?`; - break; - } - } - - } - - // falls through to throw error - } - - throw new TypeError(errorMessage); -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * Implements validation functionality for the rules portion of a config. - */ -class RuleValidator { - - /** - * Creates a new instance. - */ - constructor() { - - /** - * A collection of compiled validators for rules that have already - * been validated. - * @type {WeakMap} - */ - this.validators = new WeakMap(); - } - - /** - * Validates all of the rule configurations in a config against each - * rule's schema. - * @param {Object} config The full config to validate. This object must - * contain both the rules section and the plugins section. - * @returns {void} - * @throws {Error} If a rule's configuration does not match its schema. - */ - validate(config) { - - if (!config.rules) { - return; - } - - for (const [ruleId, ruleOptions] of Object.entries(config.rules)) { - - // check for edge case - if (ruleId === "__proto__") { - continue; - } - - /* - * If a rule is disabled, we don't do any validation. This allows - * users to safely set any value to 0 or "off" without worrying - * that it will cause a validation error. - * - * Note: ruleOptions is always an array at this point because - * this validation occurs after FlatConfigArray has merged and - * normalized values. - */ - if (ruleOptions[0] === 0) { - continue; - } - - const rule = getRuleFromConfig(ruleId, config); - - if (!rule) { - throwRuleNotFoundError(parseRuleId(ruleId), config); - } - - // Precompile and cache validator the first time - if (!this.validators.has(rule)) { - const schema = getRuleOptionsSchema(rule); - - if (schema) { - this.validators.set(rule, ajv.compile(schema)); - } - } - - const validateRule = this.validators.get(rule); - - if (validateRule) { - - validateRule(ruleOptions.slice(1)); - - if (validateRule.errors) { - throw new Error(`Key "rules": Key "${ruleId}": ${ - validateRule.errors.map( - error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` - ).join("") - }`); - } - } - } - } -} - -exports.RuleValidator = RuleValidator; diff --git a/node_modules/eslint/lib/eslint/eslint-helpers.js b/node_modules/eslint/lib/eslint/eslint-helpers.js deleted file mode 100644 index ff3695dc6..000000000 --- a/node_modules/eslint/lib/eslint/eslint-helpers.js +++ /dev/null @@ -1,904 +0,0 @@ -/** - * @fileoverview Helper functions for ESLint class - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const path = require("path"); -const fs = require("fs"); -const fsp = fs.promises; -const isGlob = require("is-glob"); -const hash = require("../cli-engine/hash"); -const minimatch = require("minimatch"); -const util = require("util"); -const fswalk = require("@nodelib/fs.walk"); -const globParent = require("glob-parent"); -const isPathInside = require("is-path-inside"); - -//----------------------------------------------------------------------------- -// Fixup references -//----------------------------------------------------------------------------- - -const doFsWalk = util.promisify(fswalk.walk); -const Minimatch = minimatch.Minimatch; -const MINIMATCH_OPTIONS = { dot: true }; - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** - * @typedef {Object} GlobSearch - * @property {Array} patterns The normalized patterns to use for a search. - * @property {Array} rawPatterns The patterns as entered by the user - * before doing any normalization. - */ - -//----------------------------------------------------------------------------- -// Errors -//----------------------------------------------------------------------------- - -/** - * The error type when no files match a glob. - */ -class NoFilesFoundError extends Error { - - /** - * @param {string} pattern The glob pattern which was not found. - * @param {boolean} globEnabled If `false` then the pattern was a glob pattern, but glob was disabled. - */ - constructor(pattern, globEnabled) { - super(`No files matching '${pattern}' were found${!globEnabled ? " (glob was disabled)" : ""}.`); - this.messageTemplate = "file-not-found"; - this.messageData = { pattern, globDisabled: !globEnabled }; - } -} - -/** - * The error type when a search fails to match multiple patterns. - */ -class UnmatchedSearchPatternsError extends Error { - - /** - * @param {Object} options The options for the error. - * @param {string} options.basePath The directory that was searched. - * @param {Array} options.unmatchedPatterns The glob patterns - * which were not found. - * @param {Array} options.patterns The glob patterns that were - * searched. - * @param {Array} options.rawPatterns The raw glob patterns that - * were searched. - */ - constructor({ basePath, unmatchedPatterns, patterns, rawPatterns }) { - super(`No files matching '${rawPatterns}' in '${basePath}' were found.`); - this.basePath = basePath; - this.unmatchedPatterns = unmatchedPatterns; - this.patterns = patterns; - this.rawPatterns = rawPatterns; - } -} - -/** - * The error type when there are files matched by a glob, but all of them have been ignored. - */ -class AllFilesIgnoredError extends Error { - - /** - * @param {string} pattern The glob pattern which was not found. - */ - constructor(pattern) { - super(`All files matched by '${pattern}' are ignored.`); - this.messageTemplate = "all-files-ignored"; - this.messageData = { pattern }; - } -} - - -//----------------------------------------------------------------------------- -// General Helpers -//----------------------------------------------------------------------------- - -/** - * Check if a given value is a non-empty string or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if `x` is a non-empty string. - */ -function isNonEmptyString(x) { - return typeof x === "string" && x.trim() !== ""; -} - -/** - * Check if a given value is an array of non-empty strings or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if `x` is an array of non-empty strings. - */ -function isArrayOfNonEmptyString(x) { - return Array.isArray(x) && x.every(isNonEmptyString); -} - -//----------------------------------------------------------------------------- -// File-related Helpers -//----------------------------------------------------------------------------- - -/** - * Normalizes slashes in a file pattern to posix-style. - * @param {string} pattern The pattern to replace slashes in. - * @returns {string} The pattern with slashes normalized. - */ -function normalizeToPosix(pattern) { - return pattern.replace(/\\/gu, "/"); -} - -/** - * Check if a string is a glob pattern or not. - * @param {string} pattern A glob pattern. - * @returns {boolean} `true` if the string is a glob pattern. - */ -function isGlobPattern(pattern) { - return isGlob(path.sep === "\\" ? normalizeToPosix(pattern) : pattern); -} - - -/** - * Determines if a given glob pattern will return any results. - * Used primarily to help with useful error messages. - * @param {Object} options The options for the function. - * @param {string} options.basePath The directory to search. - * @param {string} options.pattern A glob pattern to match. - * @returns {Promise} True if there is a glob match, false if not. - */ -function globMatch({ basePath, pattern }) { - - let found = false; - const patternToUse = path.isAbsolute(pattern) - ? normalizeToPosix(path.relative(basePath, pattern)) - : pattern; - - const matcher = new Minimatch(patternToUse, MINIMATCH_OPTIONS); - - const fsWalkSettings = { - - deepFilter(entry) { - const relativePath = normalizeToPosix(path.relative(basePath, entry.path)); - - return !found && matcher.match(relativePath, true); - }, - - entryFilter(entry) { - if (found || entry.dirent.isDirectory()) { - return false; - } - - const relativePath = normalizeToPosix(path.relative(basePath, entry.path)); - - if (matcher.match(relativePath)) { - found = true; - return true; - } - - return false; - } - }; - - return new Promise(resolve => { - - // using a stream so we can exit early because we just need one match - const globStream = fswalk.walkStream(basePath, fsWalkSettings); - - globStream.on("data", () => { - globStream.destroy(); - resolve(true); - }); - - // swallow errors as they're not important here - globStream.on("error", () => { }); - - globStream.on("end", () => { - resolve(false); - }); - globStream.read(); - }); - -} - -/** - * Searches a directory looking for matching glob patterns. This uses - * the config array's logic to determine if a directory or file should - * be ignored, so it is consistent with how ignoring works throughout - * ESLint. - * @param {Object} options The options for this function. - * @param {string} options.basePath The directory to search. - * @param {Array} options.patterns An array of glob patterns - * to match. - * @param {Array} options.rawPatterns An array of glob patterns - * as the user inputted them. Used for errors. - * @param {FlatConfigArray} options.configs The config array to use for - * determining what to ignore. - * @param {boolean} options.errorOnUnmatchedPattern Determines if an error - * should be thrown when a pattern is unmatched. - * @returns {Promise>} An array of matching file paths - * or an empty array if there are no matches. - * @throws {UnmatchedSearchPatternsError} If there is a pattern that doesn't - * match any files. - */ -async function globSearch({ - basePath, - patterns, - rawPatterns, - configs, - errorOnUnmatchedPattern -}) { - - if (patterns.length === 0) { - return []; - } - - /* - * In this section we are converting the patterns into Minimatch - * instances for performance reasons. Because we are doing the same - * matches repeatedly, it's best to compile those patterns once and - * reuse them multiple times. - * - * To do that, we convert any patterns with an absolute path into a - * relative path and normalize it to Posix-style slashes. We also keep - * track of the relative patterns to map them back to the original - * patterns, which we need in order to throw an error if there are any - * unmatched patterns. - */ - const relativeToPatterns = new Map(); - const matchers = patterns.map((pattern, i) => { - const patternToUse = path.isAbsolute(pattern) - ? normalizeToPosix(path.relative(basePath, pattern)) - : pattern; - - relativeToPatterns.set(patternToUse, patterns[i]); - - return new Minimatch(patternToUse, MINIMATCH_OPTIONS); - }); - - /* - * We track unmatched patterns because we may want to throw an error when - * they occur. To start, this set is initialized with all of the patterns. - * Every time a match occurs, the pattern is removed from the set, making - * it easy to tell if we have any unmatched patterns left at the end of - * search. - */ - const unmatchedPatterns = new Set([...relativeToPatterns.keys()]); - - const filePaths = (await doFsWalk(basePath, { - - deepFilter(entry) { - const relativePath = normalizeToPosix(path.relative(basePath, entry.path)); - const matchesPattern = matchers.some(matcher => matcher.match(relativePath, true)); - - return matchesPattern && !configs.isDirectoryIgnored(entry.path); - }, - entryFilter(entry) { - const relativePath = normalizeToPosix(path.relative(basePath, entry.path)); - - // entries may be directories or files so filter out directories - if (entry.dirent.isDirectory()) { - return false; - } - - /* - * Optimization: We need to track when patterns are left unmatched - * and so we use `unmatchedPatterns` to do that. There is a bit of - * complexity here because the same file can be matched by more than - * one pattern. So, when we start, we actually need to test every - * pattern against every file. Once we know there are no remaining - * unmatched patterns, then we can switch to just looking for the - * first matching pattern for improved speed. - */ - const matchesPattern = unmatchedPatterns.size > 0 - ? matchers.reduce((previousValue, matcher) => { - const pathMatches = matcher.match(relativePath); - - /* - * We updated the unmatched patterns set only if the path - * matches and the file isn't ignored. If the file is - * ignored, that means there wasn't a match for the - * pattern so it should not be removed. - * - * Performance note: isFileIgnored() aggressively caches - * results so there is no performance penalty for calling - * it twice with the same argument. - */ - if (pathMatches && !configs.isFileIgnored(entry.path)) { - unmatchedPatterns.delete(matcher.pattern); - } - - return pathMatches || previousValue; - }, false) - : matchers.some(matcher => matcher.match(relativePath)); - - return matchesPattern && !configs.isFileIgnored(entry.path); - } - - })).map(entry => entry.path); - - // now check to see if we have any unmatched patterns - if (errorOnUnmatchedPattern && unmatchedPatterns.size > 0) { - throw new UnmatchedSearchPatternsError({ - basePath, - unmatchedPatterns: [...unmatchedPatterns].map( - pattern => relativeToPatterns.get(pattern) - ), - patterns, - rawPatterns - }); - } - - return filePaths; -} - -/** - * Throws an error for unmatched patterns. The error will only contain information about the first one. - * Checks to see if there are any ignored results for a given search. - * @param {Object} options The options for this function. - * @param {string} options.basePath The directory to search. - * @param {Array} options.patterns An array of glob patterns - * that were used in the original search. - * @param {Array} options.rawPatterns An array of glob patterns - * as the user inputted them. Used for errors. - * @param {Array} options.unmatchedPatterns A non-empty array of glob patterns - * that were unmatched in the original search. - * @returns {void} Always throws an error. - * @throws {NoFilesFoundError} If the first unmatched pattern - * doesn't match any files even when there are no ignores. - * @throws {AllFilesIgnoredError} If the first unmatched pattern - * matches some files when there are no ignores. - */ -async function throwErrorForUnmatchedPatterns({ - basePath, - patterns, - rawPatterns, - unmatchedPatterns -}) { - - const pattern = unmatchedPatterns[0]; - const rawPattern = rawPatterns[patterns.indexOf(pattern)]; - - const patternHasMatch = await globMatch({ - basePath, - pattern - }); - - if (patternHasMatch) { - throw new AllFilesIgnoredError(rawPattern); - } - - // if we get here there are truly no matches - throw new NoFilesFoundError(rawPattern, true); -} - -/** - * Performs multiple glob searches in parallel. - * @param {Object} options The options for this function. - * @param {Map} options.searches - * An array of glob patterns to match. - * @param {FlatConfigArray} options.configs The config array to use for - * determining what to ignore. - * @param {boolean} options.errorOnUnmatchedPattern Determines if an - * unmatched glob pattern should throw an error. - * @returns {Promise>} An array of matching file paths - * or an empty array if there are no matches. - */ -async function globMultiSearch({ searches, configs, errorOnUnmatchedPattern }) { - - /* - * For convenience, we normalized the search map into an array of objects. - * Next, we filter out all searches that have no patterns. This happens - * primarily for the cwd, which is prepopulated in the searches map as an - * optimization. However, if it has no patterns, it means all patterns - * occur outside of the cwd and we can safely filter out that search. - */ - const normalizedSearches = [...searches].map( - ([basePath, { patterns, rawPatterns }]) => ({ basePath, patterns, rawPatterns }) - ).filter(({ patterns }) => patterns.length > 0); - - const results = await Promise.allSettled( - normalizedSearches.map( - ({ basePath, patterns, rawPatterns }) => globSearch({ - basePath, - patterns, - rawPatterns, - configs, - errorOnUnmatchedPattern - }) - ) - ); - - const filePaths = []; - - for (let i = 0; i < results.length; i++) { - - const result = results[i]; - const currentSearch = normalizedSearches[i]; - - if (result.status === "fulfilled") { - - // if the search was successful just add the results - if (result.value.length > 0) { - filePaths.push(...result.value); - } - - continue; - } - - // if we make it here then there was an error - const error = result.reason; - - // unexpected errors should be re-thrown - if (!error.basePath) { - throw error; - } - - if (errorOnUnmatchedPattern) { - - await throwErrorForUnmatchedPatterns({ - ...currentSearch, - unmatchedPatterns: error.unmatchedPatterns - }); - - } - - } - - return [...new Set(filePaths)]; - -} - -/** - * Finds all files matching the options specified. - * @param {Object} args The arguments objects. - * @param {Array} args.patterns An array of glob patterns. - * @param {boolean} args.globInputPaths true to interpret glob patterns, - * false to not interpret glob patterns. - * @param {string} args.cwd The current working directory to find from. - * @param {FlatConfigArray} args.configs The configs for the current run. - * @param {boolean} args.errorOnUnmatchedPattern Determines if an unmatched pattern - * should throw an error. - * @returns {Promise>} The fully resolved file paths. - * @throws {AllFilesIgnoredError} If there are no results due to an ignore pattern. - * @throws {NoFilesFoundError} If no files matched the given patterns. - */ -async function findFiles({ - patterns, - globInputPaths, - cwd, - configs, - errorOnUnmatchedPattern -}) { - - const results = []; - const missingPatterns = []; - let globbyPatterns = []; - let rawPatterns = []; - const searches = new Map([[cwd, { patterns: globbyPatterns, rawPatterns: [] }]]); - - // check to see if we have explicit files and directories - const filePaths = patterns.map(filePath => path.resolve(cwd, filePath)); - const stats = await Promise.all( - filePaths.map( - filePath => fsp.stat(filePath).catch(() => { }) - ) - ); - - stats.forEach((stat, index) => { - - const filePath = filePaths[index]; - const pattern = normalizeToPosix(patterns[index]); - - if (stat) { - - // files are added directly to the list - if (stat.isFile()) { - results.push({ - filePath, - ignored: configs.isFileIgnored(filePath) - }); - } - - // directories need extensions attached - if (stat.isDirectory()) { - - // group everything in cwd together and split out others - if (isPathInside(filePath, cwd)) { - ({ patterns: globbyPatterns, rawPatterns } = searches.get(cwd)); - } else { - if (!searches.has(filePath)) { - searches.set(filePath, { patterns: [], rawPatterns: [] }); - } - ({ patterns: globbyPatterns, rawPatterns } = searches.get(filePath)); - } - - globbyPatterns.push(`${normalizeToPosix(filePath)}/**`); - rawPatterns.push(pattern); - } - - return; - } - - // save patterns for later use based on whether globs are enabled - if (globInputPaths && isGlobPattern(pattern)) { - - const basePath = path.resolve(cwd, globParent(pattern)); - - // group in cwd if possible and split out others - if (isPathInside(basePath, cwd)) { - ({ patterns: globbyPatterns, rawPatterns } = searches.get(cwd)); - } else { - if (!searches.has(basePath)) { - searches.set(basePath, { patterns: [], rawPatterns: [] }); - } - ({ patterns: globbyPatterns, rawPatterns } = searches.get(basePath)); - } - - globbyPatterns.push(filePath); - rawPatterns.push(pattern); - } else { - missingPatterns.push(pattern); - } - }); - - // there were patterns that didn't match anything, tell the user - if (errorOnUnmatchedPattern && missingPatterns.length) { - throw new NoFilesFoundError(missingPatterns[0], globInputPaths); - } - - // now we are safe to do the search - const globbyResults = await globMultiSearch({ - searches, - configs, - errorOnUnmatchedPattern - }); - - return [ - ...results, - ...globbyResults.map(filePath => ({ - filePath: path.resolve(filePath), - ignored: false - })) - ]; -} - -//----------------------------------------------------------------------------- -// Results-related Helpers -//----------------------------------------------------------------------------- - -/** - * Checks if the given message is an error message. - * @param {LintMessage} message The message to check. - * @returns {boolean} Whether or not the message is an error message. - * @private - */ -function isErrorMessage(message) { - return message.severity === 2; -} - -/** - * Returns result with warning by ignore settings - * @param {string} filePath File path of checked code - * @param {string} baseDir Absolute path of base directory - * @returns {LintResult} Result with single warning - * @private - */ -function createIgnoreResult(filePath, baseDir) { - let message; - const isInNodeModules = baseDir && path.relative(baseDir, filePath).startsWith("node_modules"); - - if (isInNodeModules) { - message = "File ignored by default because it is located under the node_modules directory. Use ignore pattern \"!**/node_modules/\" to override."; - } else { - message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override."; - } - - return { - filePath: path.resolve(filePath), - messages: [ - { - ruleId: null, - fatal: false, - severity: 1, - message, - nodeType: null - } - ], - suppressedMessages: [], - errorCount: 0, - warningCount: 1, - fatalErrorCount: 0, - fixableErrorCount: 0, - fixableWarningCount: 0 - }; -} - -//----------------------------------------------------------------------------- -// Options-related Helpers -//----------------------------------------------------------------------------- - - -/** - * Check if a given value is a valid fix type or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if `x` is valid fix type. - */ -function isFixType(x) { - return x === "directive" || x === "problem" || x === "suggestion" || x === "layout"; -} - -/** - * Check if a given value is an array of fix types or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if `x` is an array of fix types. - */ -function isFixTypeArray(x) { - return Array.isArray(x) && x.every(isFixType); -} - -/** - * The error for invalid options. - */ -class ESLintInvalidOptionsError extends Error { - constructor(messages) { - super(`Invalid Options:\n- ${messages.join("\n- ")}`); - this.code = "ESLINT_INVALID_OPTIONS"; - Error.captureStackTrace(this, ESLintInvalidOptionsError); - } -} - -/** - * Validates and normalizes options for the wrapped CLIEngine instance. - * @param {FlatESLintOptions} options The options to process. - * @throws {ESLintInvalidOptionsError} If of any of a variety of type errors. - * @returns {FlatESLintOptions} The normalized options. - */ -function processOptions({ - allowInlineConfig = true, // ← we cannot use `overrideConfig.noInlineConfig` instead because `allowInlineConfig` has side-effect that suppress warnings that show inline configs are ignored. - baseConfig = null, - cache = false, - cacheLocation = ".eslintcache", - cacheStrategy = "metadata", - cwd = process.cwd(), - errorOnUnmatchedPattern = true, - fix = false, - fixTypes = null, // ← should be null by default because if it's an array then it suppresses rules that don't have the `meta.type` property. - globInputPaths = true, - ignore = true, - ignorePatterns = null, - overrideConfig = null, - overrideConfigFile = null, - plugins = {}, - reportUnusedDisableDirectives = null, // ← should be null by default because if it's a string then it overrides the 'reportUnusedDisableDirectives' setting in config files. And we cannot use `overrideConfig.reportUnusedDisableDirectives` instead because we cannot configure the `error` severity with that. - ...unknownOptions -}) { - const errors = []; - const unknownOptionKeys = Object.keys(unknownOptions); - - if (unknownOptionKeys.length >= 1) { - errors.push(`Unknown options: ${unknownOptionKeys.join(", ")}`); - if (unknownOptionKeys.includes("cacheFile")) { - errors.push("'cacheFile' has been removed. Please use the 'cacheLocation' option instead."); - } - if (unknownOptionKeys.includes("configFile")) { - errors.push("'configFile' has been removed. Please use the 'overrideConfigFile' option instead."); - } - if (unknownOptionKeys.includes("envs")) { - errors.push("'envs' has been removed."); - } - if (unknownOptionKeys.includes("extensions")) { - errors.push("'extensions' has been removed."); - } - if (unknownOptionKeys.includes("resolvePluginsRelativeTo")) { - errors.push("'resolvePluginsRelativeTo' has been removed."); - } - if (unknownOptionKeys.includes("globals")) { - errors.push("'globals' has been removed. Please use the 'overrideConfig.languageOptions.globals' option instead."); - } - if (unknownOptionKeys.includes("ignorePath")) { - errors.push("'ignorePath' has been removed."); - } - if (unknownOptionKeys.includes("ignorePattern")) { - errors.push("'ignorePattern' has been removed. Please use the 'overrideConfig.ignorePatterns' option instead."); - } - if (unknownOptionKeys.includes("parser")) { - errors.push("'parser' has been removed. Please use the 'overrideConfig.languageOptions.parser' option instead."); - } - if (unknownOptionKeys.includes("parserOptions")) { - errors.push("'parserOptions' has been removed. Please use the 'overrideConfig.languageOptions.parserOptions' option instead."); - } - if (unknownOptionKeys.includes("rules")) { - errors.push("'rules' has been removed. Please use the 'overrideConfig.rules' option instead."); - } - if (unknownOptionKeys.includes("rulePaths")) { - errors.push("'rulePaths' has been removed. Please define your rules using plugins."); - } - } - if (typeof allowInlineConfig !== "boolean") { - errors.push("'allowInlineConfig' must be a boolean."); - } - if (typeof baseConfig !== "object") { - errors.push("'baseConfig' must be an object or null."); - } - if (typeof cache !== "boolean") { - errors.push("'cache' must be a boolean."); - } - if (!isNonEmptyString(cacheLocation)) { - errors.push("'cacheLocation' must be a non-empty string."); - } - if ( - cacheStrategy !== "metadata" && - cacheStrategy !== "content" - ) { - errors.push("'cacheStrategy' must be any of \"metadata\", \"content\"."); - } - if (!isNonEmptyString(cwd) || !path.isAbsolute(cwd)) { - errors.push("'cwd' must be an absolute path."); - } - if (typeof errorOnUnmatchedPattern !== "boolean") { - errors.push("'errorOnUnmatchedPattern' must be a boolean."); - } - if (typeof fix !== "boolean" && typeof fix !== "function") { - errors.push("'fix' must be a boolean or a function."); - } - if (fixTypes !== null && !isFixTypeArray(fixTypes)) { - errors.push("'fixTypes' must be an array of any of \"directive\", \"problem\", \"suggestion\", and \"layout\"."); - } - if (typeof globInputPaths !== "boolean") { - errors.push("'globInputPaths' must be a boolean."); - } - if (typeof ignore !== "boolean") { - errors.push("'ignore' must be a boolean."); - } - if (!isArrayOfNonEmptyString(ignorePatterns) && ignorePatterns !== null) { - errors.push("'ignorePatterns' must be an array of non-empty strings or null."); - } - if (typeof overrideConfig !== "object") { - errors.push("'overrideConfig' must be an object or null."); - } - if (!isNonEmptyString(overrideConfigFile) && overrideConfigFile !== null && overrideConfigFile !== true) { - errors.push("'overrideConfigFile' must be a non-empty string, null, or true."); - } - if (typeof plugins !== "object") { - errors.push("'plugins' must be an object or null."); - } else if (plugins !== null && Object.keys(plugins).includes("")) { - errors.push("'plugins' must not include an empty string."); - } - if (Array.isArray(plugins)) { - errors.push("'plugins' doesn't add plugins to configuration to load. Please use the 'overrideConfig.plugins' option instead."); - } - if ( - reportUnusedDisableDirectives !== "error" && - reportUnusedDisableDirectives !== "warn" && - reportUnusedDisableDirectives !== "off" && - reportUnusedDisableDirectives !== null - ) { - errors.push("'reportUnusedDisableDirectives' must be any of \"error\", \"warn\", \"off\", and null."); - } - if (errors.length > 0) { - throw new ESLintInvalidOptionsError(errors); - } - - return { - allowInlineConfig, - baseConfig, - cache, - cacheLocation, - cacheStrategy, - - // when overrideConfigFile is true that means don't do config file lookup - configFile: overrideConfigFile === true ? false : overrideConfigFile, - overrideConfig, - cwd, - errorOnUnmatchedPattern, - fix, - fixTypes, - globInputPaths, - ignore, - ignorePatterns, - reportUnusedDisableDirectives - }; -} - - -//----------------------------------------------------------------------------- -// Cache-related helpers -//----------------------------------------------------------------------------- - -/** - * return the cacheFile to be used by eslint, based on whether the provided parameter is - * a directory or looks like a directory (ends in `path.sep`), in which case the file - * name will be the `cacheFile/.cache_hashOfCWD` - * - * if cacheFile points to a file or looks like a file then in will just use that file - * @param {string} cacheFile The name of file to be used to store the cache - * @param {string} cwd Current working directory - * @returns {string} the resolved path to the cache file - */ -function getCacheFile(cacheFile, cwd) { - - /* - * make sure the path separators are normalized for the environment/os - * keeping the trailing path separator if present - */ - const normalizedCacheFile = path.normalize(cacheFile); - - const resolvedCacheFile = path.resolve(cwd, normalizedCacheFile); - const looksLikeADirectory = normalizedCacheFile.slice(-1) === path.sep; - - /** - * return the name for the cache file in case the provided parameter is a directory - * @returns {string} the resolved path to the cacheFile - */ - function getCacheFileForDirectory() { - return path.join(resolvedCacheFile, `.cache_${hash(cwd)}`); - } - - let fileStats; - - try { - fileStats = fs.lstatSync(resolvedCacheFile); - } catch { - fileStats = null; - } - - - /* - * in case the file exists we need to verify if the provided path - * is a directory or a file. If it is a directory we want to create a file - * inside that directory - */ - if (fileStats) { - - /* - * is a directory or is a file, but the original file the user provided - * looks like a directory but `path.resolve` removed the `last path.sep` - * so we need to still treat this like a directory - */ - if (fileStats.isDirectory() || looksLikeADirectory) { - return getCacheFileForDirectory(); - } - - // is file so just use that file - return resolvedCacheFile; - } - - /* - * here we known the file or directory doesn't exist, - * so we will try to infer if its a directory if it looks like a directory - * for the current operating system. - */ - - // if the last character passed is a path separator we assume is a directory - if (looksLikeADirectory) { - return getCacheFileForDirectory(); - } - - return resolvedCacheFile; -} - - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -module.exports = { - isGlobPattern, - findFiles, - - isNonEmptyString, - isArrayOfNonEmptyString, - - createIgnoreResult, - isErrorMessage, - - processOptions, - - getCacheFile -}; diff --git a/node_modules/eslint/lib/eslint/eslint.js b/node_modules/eslint/lib/eslint/eslint.js deleted file mode 100644 index e1d211694..000000000 --- a/node_modules/eslint/lib/eslint/eslint.js +++ /dev/null @@ -1,700 +0,0 @@ -/** - * @fileoverview Main API Class - * @author Kai Cataldo - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const path = require("path"); -const fs = require("fs"); -const { promisify } = require("util"); -const { CLIEngine, getCLIEngineInternalSlots } = require("../cli-engine/cli-engine"); -const BuiltinRules = require("../rules"); -const { - Legacy: { - ConfigOps: { - getRuleSeverity - } - } -} = require("@eslint/eslintrc"); -const { version } = require("../../package.json"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../cli-engine/cli-engine").LintReport} CLIEngineLintReport */ -/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */ -/** @typedef {import("../shared/types").ConfigData} ConfigData */ -/** @typedef {import("../shared/types").LintMessage} LintMessage */ -/** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */ -/** @typedef {import("../shared/types").Plugin} Plugin */ -/** @typedef {import("../shared/types").Rule} Rule */ -/** @typedef {import("../shared/types").LintResult} LintResult */ -/** @typedef {import("../shared/types").ResultsMeta} ResultsMeta */ - -/** - * The main formatter object. - * @typedef LoadedFormatter - * @property {(results: LintResult[], resultsMeta: ResultsMeta) => string | Promise} format format function. - */ - -/** - * The options with which to configure the ESLint instance. - * @typedef {Object} ESLintOptions - * @property {boolean} [allowInlineConfig] Enable or disable inline configuration comments. - * @property {ConfigData} [baseConfig] Base config object, extended by all configs used with this instance - * @property {boolean} [cache] Enable result caching. - * @property {string} [cacheLocation] The cache file to use instead of .eslintcache. - * @property {"metadata" | "content"} [cacheStrategy] The strategy used to detect changed files. - * @property {string} [cwd] The value to use for the current working directory. - * @property {boolean} [errorOnUnmatchedPattern] If `false` then `ESLint#lintFiles()` doesn't throw even if no target files found. Defaults to `true`. - * @property {string[]} [extensions] An array of file extensions to check. - * @property {boolean|Function} [fix] Execute in autofix mode. If a function, should return a boolean. - * @property {string[]} [fixTypes] Array of rule types to apply fixes for. - * @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file. - * @property {boolean} [ignore] False disables use of .eslintignore. - * @property {string} [ignorePath] The ignore file to use instead of .eslintignore. - * @property {ConfigData} [overrideConfig] Override config object, overrides all configs used with this instance - * @property {string} [overrideConfigFile] The configuration file to use. - * @property {Record|null} [plugins] Preloaded plugins. This is a map-like object, keys are plugin IDs and each value is implementation. - * @property {"error" | "warn" | "off"} [reportUnusedDisableDirectives] the severity to report unused eslint-disable directives. - * @property {string} [resolvePluginsRelativeTo] The folder where plugins should be resolved from, defaulting to the CWD. - * @property {string[]} [rulePaths] An array of directories to load custom rules from. - * @property {boolean} [useEslintrc] False disables looking for .eslintrc.* files. - */ - -/** - * A rules metadata object. - * @typedef {Object} RulesMeta - * @property {string} id The plugin ID. - * @property {Object} definition The plugin definition. - */ - -/** - * Private members for the `ESLint` instance. - * @typedef {Object} ESLintPrivateMembers - * @property {CLIEngine} cliEngine The wrapped CLIEngine instance. - * @property {ESLintOptions} options The options used to instantiate the ESLint instance. - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const writeFile = promisify(fs.writeFile); - -/** - * The map with which to store private class members. - * @type {WeakMap} - */ -const privateMembersMap = new WeakMap(); - -/** - * Check if a given value is a non-empty string or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if `x` is a non-empty string. - */ -function isNonEmptyString(x) { - return typeof x === "string" && x.trim() !== ""; -} - -/** - * Check if a given value is an array of non-empty strings or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if `x` is an array of non-empty strings. - */ -function isArrayOfNonEmptyString(x) { - return Array.isArray(x) && x.every(isNonEmptyString); -} - -/** - * Check if a given value is a valid fix type or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if `x` is valid fix type. - */ -function isFixType(x) { - return x === "directive" || x === "problem" || x === "suggestion" || x === "layout"; -} - -/** - * Check if a given value is an array of fix types or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if `x` is an array of fix types. - */ -function isFixTypeArray(x) { - return Array.isArray(x) && x.every(isFixType); -} - -/** - * The error for invalid options. - */ -class ESLintInvalidOptionsError extends Error { - constructor(messages) { - super(`Invalid Options:\n- ${messages.join("\n- ")}`); - this.code = "ESLINT_INVALID_OPTIONS"; - Error.captureStackTrace(this, ESLintInvalidOptionsError); - } -} - -/** - * Validates and normalizes options for the wrapped CLIEngine instance. - * @param {ESLintOptions} options The options to process. - * @throws {ESLintInvalidOptionsError} If of any of a variety of type errors. - * @returns {ESLintOptions} The normalized options. - */ -function processOptions({ - allowInlineConfig = true, // ← we cannot use `overrideConfig.noInlineConfig` instead because `allowInlineConfig` has side-effect that suppress warnings that show inline configs are ignored. - baseConfig = null, - cache = false, - cacheLocation = ".eslintcache", - cacheStrategy = "metadata", - cwd = process.cwd(), - errorOnUnmatchedPattern = true, - extensions = null, // ← should be null by default because if it's an array then it suppresses RFC20 feature. - fix = false, - fixTypes = null, // ← should be null by default because if it's an array then it suppresses rules that don't have the `meta.type` property. - globInputPaths = true, - ignore = true, - ignorePath = null, // ← should be null by default because if it's a string then it may throw ENOENT. - overrideConfig = null, - overrideConfigFile = null, - plugins = {}, - reportUnusedDisableDirectives = null, // ← should be null by default because if it's a string then it overrides the 'reportUnusedDisableDirectives' setting in config files. And we cannot use `overrideConfig.reportUnusedDisableDirectives` instead because we cannot configure the `error` severity with that. - resolvePluginsRelativeTo = null, // ← should be null by default because if it's a string then it suppresses RFC47 feature. - rulePaths = [], - useEslintrc = true, - ...unknownOptions -}) { - const errors = []; - const unknownOptionKeys = Object.keys(unknownOptions); - - if (unknownOptionKeys.length >= 1) { - errors.push(`Unknown options: ${unknownOptionKeys.join(", ")}`); - if (unknownOptionKeys.includes("cacheFile")) { - errors.push("'cacheFile' has been removed. Please use the 'cacheLocation' option instead."); - } - if (unknownOptionKeys.includes("configFile")) { - errors.push("'configFile' has been removed. Please use the 'overrideConfigFile' option instead."); - } - if (unknownOptionKeys.includes("envs")) { - errors.push("'envs' has been removed. Please use the 'overrideConfig.env' option instead."); - } - if (unknownOptionKeys.includes("globals")) { - errors.push("'globals' has been removed. Please use the 'overrideConfig.globals' option instead."); - } - if (unknownOptionKeys.includes("ignorePattern")) { - errors.push("'ignorePattern' has been removed. Please use the 'overrideConfig.ignorePatterns' option instead."); - } - if (unknownOptionKeys.includes("parser")) { - errors.push("'parser' has been removed. Please use the 'overrideConfig.parser' option instead."); - } - if (unknownOptionKeys.includes("parserOptions")) { - errors.push("'parserOptions' has been removed. Please use the 'overrideConfig.parserOptions' option instead."); - } - if (unknownOptionKeys.includes("rules")) { - errors.push("'rules' has been removed. Please use the 'overrideConfig.rules' option instead."); - } - } - if (typeof allowInlineConfig !== "boolean") { - errors.push("'allowInlineConfig' must be a boolean."); - } - if (typeof baseConfig !== "object") { - errors.push("'baseConfig' must be an object or null."); - } - if (typeof cache !== "boolean") { - errors.push("'cache' must be a boolean."); - } - if (!isNonEmptyString(cacheLocation)) { - errors.push("'cacheLocation' must be a non-empty string."); - } - if ( - cacheStrategy !== "metadata" && - cacheStrategy !== "content" - ) { - errors.push("'cacheStrategy' must be any of \"metadata\", \"content\"."); - } - if (!isNonEmptyString(cwd) || !path.isAbsolute(cwd)) { - errors.push("'cwd' must be an absolute path."); - } - if (typeof errorOnUnmatchedPattern !== "boolean") { - errors.push("'errorOnUnmatchedPattern' must be a boolean."); - } - if (!isArrayOfNonEmptyString(extensions) && extensions !== null) { - errors.push("'extensions' must be an array of non-empty strings or null."); - } - if (typeof fix !== "boolean" && typeof fix !== "function") { - errors.push("'fix' must be a boolean or a function."); - } - if (fixTypes !== null && !isFixTypeArray(fixTypes)) { - errors.push("'fixTypes' must be an array of any of \"directive\", \"problem\", \"suggestion\", and \"layout\"."); - } - if (typeof globInputPaths !== "boolean") { - errors.push("'globInputPaths' must be a boolean."); - } - if (typeof ignore !== "boolean") { - errors.push("'ignore' must be a boolean."); - } - if (!isNonEmptyString(ignorePath) && ignorePath !== null) { - errors.push("'ignorePath' must be a non-empty string or null."); - } - if (typeof overrideConfig !== "object") { - errors.push("'overrideConfig' must be an object or null."); - } - if (!isNonEmptyString(overrideConfigFile) && overrideConfigFile !== null) { - errors.push("'overrideConfigFile' must be a non-empty string or null."); - } - if (typeof plugins !== "object") { - errors.push("'plugins' must be an object or null."); - } else if (plugins !== null && Object.keys(plugins).includes("")) { - errors.push("'plugins' must not include an empty string."); - } - if (Array.isArray(plugins)) { - errors.push("'plugins' doesn't add plugins to configuration to load. Please use the 'overrideConfig.plugins' option instead."); - } - if ( - reportUnusedDisableDirectives !== "error" && - reportUnusedDisableDirectives !== "warn" && - reportUnusedDisableDirectives !== "off" && - reportUnusedDisableDirectives !== null - ) { - errors.push("'reportUnusedDisableDirectives' must be any of \"error\", \"warn\", \"off\", and null."); - } - if ( - !isNonEmptyString(resolvePluginsRelativeTo) && - resolvePluginsRelativeTo !== null - ) { - errors.push("'resolvePluginsRelativeTo' must be a non-empty string or null."); - } - if (!isArrayOfNonEmptyString(rulePaths)) { - errors.push("'rulePaths' must be an array of non-empty strings."); - } - if (typeof useEslintrc !== "boolean") { - errors.push("'useEslintrc' must be a boolean."); - } - - if (errors.length > 0) { - throw new ESLintInvalidOptionsError(errors); - } - - return { - allowInlineConfig, - baseConfig, - cache, - cacheLocation, - cacheStrategy, - configFile: overrideConfigFile, - cwd, - errorOnUnmatchedPattern, - extensions, - fix, - fixTypes, - globInputPaths, - ignore, - ignorePath, - reportUnusedDisableDirectives, - resolvePluginsRelativeTo, - rulePaths, - useEslintrc - }; -} - -/** - * Check if a value has one or more properties and that value is not undefined. - * @param {any} obj The value to check. - * @returns {boolean} `true` if `obj` has one or more properties that that value is not undefined. - */ -function hasDefinedProperty(obj) { - if (typeof obj === "object" && obj !== null) { - for (const key in obj) { - if (typeof obj[key] !== "undefined") { - return true; - } - } - } - return false; -} - -/** - * Create rulesMeta object. - * @param {Map} rules a map of rules from which to generate the object. - * @returns {Object} metadata for all enabled rules. - */ -function createRulesMeta(rules) { - return Array.from(rules).reduce((retVal, [id, rule]) => { - retVal[id] = rule.meta; - return retVal; - }, {}); -} - -/** @type {WeakMap} */ -const usedDeprecatedRulesCache = new WeakMap(); - -/** - * Create used deprecated rule list. - * @param {CLIEngine} cliEngine The CLIEngine instance. - * @param {string} maybeFilePath The absolute path to a lint target file or `""`. - * @returns {DeprecatedRuleInfo[]} The used deprecated rule list. - */ -function getOrFindUsedDeprecatedRules(cliEngine, maybeFilePath) { - const { - configArrayFactory, - options: { cwd } - } = getCLIEngineInternalSlots(cliEngine); - const filePath = path.isAbsolute(maybeFilePath) - ? maybeFilePath - : path.join(cwd, "__placeholder__.js"); - const configArray = configArrayFactory.getConfigArrayForFile(filePath); - const config = configArray.extractConfig(filePath); - - // Most files use the same config, so cache it. - if (!usedDeprecatedRulesCache.has(config)) { - const pluginRules = configArray.pluginRules; - const retv = []; - - for (const [ruleId, ruleConf] of Object.entries(config.rules)) { - if (getRuleSeverity(ruleConf) === 0) { - continue; - } - const rule = pluginRules.get(ruleId) || BuiltinRules.get(ruleId); - const meta = rule && rule.meta; - - if (meta && meta.deprecated) { - retv.push({ ruleId, replacedBy: meta.replacedBy || [] }); - } - } - - usedDeprecatedRulesCache.set(config, Object.freeze(retv)); - } - - return usedDeprecatedRulesCache.get(config); -} - -/** - * Processes the linting results generated by a CLIEngine linting report to - * match the ESLint class's API. - * @param {CLIEngine} cliEngine The CLIEngine instance. - * @param {CLIEngineLintReport} report The CLIEngine linting report to process. - * @returns {LintResult[]} The processed linting results. - */ -function processCLIEngineLintReport(cliEngine, { results }) { - const descriptor = { - configurable: true, - enumerable: true, - get() { - return getOrFindUsedDeprecatedRules(cliEngine, this.filePath); - } - }; - - for (const result of results) { - Object.defineProperty(result, "usedDeprecatedRules", descriptor); - } - - return results; -} - -/** - * An Array.prototype.sort() compatible compare function to order results by their file path. - * @param {LintResult} a The first lint result. - * @param {LintResult} b The second lint result. - * @returns {number} An integer representing the order in which the two results should occur. - */ -function compareResultsByFilePath(a, b) { - if (a.filePath < b.filePath) { - return -1; - } - - if (a.filePath > b.filePath) { - return 1; - } - - return 0; -} - -/** - * Main API. - */ -class ESLint { - - /** - * Creates a new instance of the main ESLint API. - * @param {ESLintOptions} options The options for this instance. - */ - constructor(options = {}) { - const processedOptions = processOptions(options); - const cliEngine = new CLIEngine(processedOptions, { preloadedPlugins: options.plugins }); - const { - configArrayFactory, - lastConfigArrays - } = getCLIEngineInternalSlots(cliEngine); - let updated = false; - - /* - * Address `overrideConfig` to set override config. - * Operate the `configArrayFactory` internal slot directly because this - * functionality doesn't exist as the public API of CLIEngine. - */ - if (hasDefinedProperty(options.overrideConfig)) { - configArrayFactory.setOverrideConfig(options.overrideConfig); - updated = true; - } - - // Update caches. - if (updated) { - configArrayFactory.clearCache(); - lastConfigArrays[0] = configArrayFactory.getConfigArrayForFile(); - } - - // Initialize private properties. - privateMembersMap.set(this, { - cliEngine, - options: processedOptions - }); - } - - /** - * The version text. - * @type {string} - */ - static get version() { - return version; - } - - /** - * Outputs fixes from the given results to files. - * @param {LintResult[]} results The lint results. - * @returns {Promise} Returns a promise that is used to track side effects. - */ - static async outputFixes(results) { - if (!Array.isArray(results)) { - throw new Error("'results' must be an array"); - } - - await Promise.all( - results - .filter(result => { - if (typeof result !== "object" || result === null) { - throw new Error("'results' must include only objects"); - } - return ( - typeof result.output === "string" && - path.isAbsolute(result.filePath) - ); - }) - .map(r => writeFile(r.filePath, r.output)) - ); - } - - /** - * Returns results that only contains errors. - * @param {LintResult[]} results The results to filter. - * @returns {LintResult[]} The filtered results. - */ - static getErrorResults(results) { - return CLIEngine.getErrorResults(results); - } - - /** - * Returns meta objects for each rule represented in the lint results. - * @param {LintResult[]} results The results to fetch rules meta for. - * @returns {Object} A mapping of ruleIds to rule meta objects. - */ - getRulesMetaForResults(results) { - - const resultRuleIds = new Set(); - - // first gather all ruleIds from all results - - for (const result of results) { - for (const { ruleId } of result.messages) { - resultRuleIds.add(ruleId); - } - for (const { ruleId } of result.suppressedMessages) { - resultRuleIds.add(ruleId); - } - } - - // create a map of all rules in the results - - const { cliEngine } = privateMembersMap.get(this); - const rules = cliEngine.getRules(); - const resultRules = new Map(); - - for (const [ruleId, rule] of rules) { - if (resultRuleIds.has(ruleId)) { - resultRules.set(ruleId, rule); - } - } - - return createRulesMeta(resultRules); - - } - - /** - * Executes the current configuration on an array of file and directory names. - * @param {string[]} patterns An array of file and directory names. - * @returns {Promise} The results of linting the file patterns given. - */ - async lintFiles(patterns) { - if (!isNonEmptyString(patterns) && !isArrayOfNonEmptyString(patterns)) { - throw new Error("'patterns' must be a non-empty string or an array of non-empty strings"); - } - const { cliEngine } = privateMembersMap.get(this); - - return processCLIEngineLintReport( - cliEngine, - cliEngine.executeOnFiles(patterns) - ); - } - - /** - * Executes the current configuration on text. - * @param {string} code A string of JavaScript code to lint. - * @param {Object} [options] The options. - * @param {string} [options.filePath] The path to the file of the source code. - * @param {boolean} [options.warnIgnored] When set to true, warn if given filePath is an ignored path. - * @returns {Promise} The results of linting the string of code given. - */ - async lintText(code, options = {}) { - if (typeof code !== "string") { - throw new Error("'code' must be a string"); - } - if (typeof options !== "object") { - throw new Error("'options' must be an object, null, or undefined"); - } - const { - filePath, - warnIgnored = false, - ...unknownOptions - } = options || {}; - - const unknownOptionKeys = Object.keys(unknownOptions); - - if (unknownOptionKeys.length > 0) { - throw new Error(`'options' must not include the unknown option(s): ${unknownOptionKeys.join(", ")}`); - } - - if (filePath !== void 0 && !isNonEmptyString(filePath)) { - throw new Error("'options.filePath' must be a non-empty string or undefined"); - } - if (typeof warnIgnored !== "boolean") { - throw new Error("'options.warnIgnored' must be a boolean or undefined"); - } - - const { cliEngine } = privateMembersMap.get(this); - - return processCLIEngineLintReport( - cliEngine, - cliEngine.executeOnText(code, filePath, warnIgnored) - ); - } - - /** - * Returns the formatter representing the given formatter name. - * @param {string} [name] The name of the formatter to load. - * The following values are allowed: - * - `undefined` ... Load `stylish` builtin formatter. - * - A builtin formatter name ... Load the builtin formatter. - * - A third-party formatter name: - * - `foo` → `eslint-formatter-foo` - * - `@foo` → `@foo/eslint-formatter` - * - `@foo/bar` → `@foo/eslint-formatter-bar` - * - A file path ... Load the file. - * @returns {Promise} A promise resolving to the formatter object. - * This promise will be rejected if the given formatter was not found or not - * a function. - */ - async loadFormatter(name = "stylish") { - if (typeof name !== "string") { - throw new Error("'name' must be a string"); - } - - const { cliEngine, options } = privateMembersMap.get(this); - const formatter = cliEngine.getFormatter(name); - - if (typeof formatter !== "function") { - throw new Error(`Formatter must be a function, but got a ${typeof formatter}.`); - } - - return { - - /** - * The main formatter method. - * @param {LintResult[]} results The lint results to format. - * @param {ResultsMeta} resultsMeta Warning count and max threshold. - * @returns {string | Promise} The formatted lint results. - */ - format(results, resultsMeta) { - let rulesMeta = null; - - results.sort(compareResultsByFilePath); - - return formatter(results, { - ...resultsMeta, - get cwd() { - return options.cwd; - }, - get rulesMeta() { - if (!rulesMeta) { - rulesMeta = createRulesMeta(cliEngine.getRules()); - } - - return rulesMeta; - } - }); - } - }; - } - - /** - * Returns a configuration object for the given file based on the CLI options. - * This is the same logic used by the ESLint CLI executable to determine - * configuration for each file it processes. - * @param {string} filePath The path of the file to retrieve a config object for. - * @returns {Promise} A configuration object for the file. - */ - async calculateConfigForFile(filePath) { - if (!isNonEmptyString(filePath)) { - throw new Error("'filePath' must be a non-empty string"); - } - const { cliEngine } = privateMembersMap.get(this); - - return cliEngine.getConfigForFile(filePath); - } - - /** - * Checks if a given path is ignored by ESLint. - * @param {string} filePath The path of the file to check. - * @returns {Promise} Whether or not the given path is ignored. - */ - async isPathIgnored(filePath) { - if (!isNonEmptyString(filePath)) { - throw new Error("'filePath' must be a non-empty string"); - } - const { cliEngine } = privateMembersMap.get(this); - - return cliEngine.isPathIgnored(filePath); - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - ESLint, - - /** - * Get the private class members of a given ESLint instance for tests. - * @param {ESLint} instance The ESLint instance to get. - * @returns {ESLintPrivateMembers} The instance's private class members. - */ - getESLintPrivateMembers(instance) { - return privateMembersMap.get(instance); - } -}; diff --git a/node_modules/eslint/lib/eslint/flat-eslint.js b/node_modules/eslint/lib/eslint/flat-eslint.js deleted file mode 100644 index f615ae171..000000000 --- a/node_modules/eslint/lib/eslint/flat-eslint.js +++ /dev/null @@ -1,1237 +0,0 @@ -/** - * @fileoverview Main class using flat config - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// Note: Node.js 12 does not support fs/promises. -const fs = require("fs").promises; -const path = require("path"); -const findUp = require("find-up"); -const { version } = require("../../package.json"); -const { Linter } = require("../linter"); -const { getRuleFromConfig } = require("../config/flat-config-helpers"); -const { - Legacy: { - ConfigOps: { - getRuleSeverity - }, - ModuleResolver, - naming - } -} = require("@eslint/eslintrc"); - -const { - findFiles, - getCacheFile, - - isNonEmptyString, - isArrayOfNonEmptyString, - - createIgnoreResult, - isErrorMessage, - - processOptions -} = require("./eslint-helpers"); -const { pathToFileURL } = require("url"); -const { FlatConfigArray } = require("../config/flat-config-array"); -const LintResultCache = require("../cli-engine/lint-result-cache"); - -/* - * This is necessary to allow overwriting writeFile for testing purposes. - * We can just use fs/promises once we drop Node.js 12 support. - */ - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -// For VSCode IntelliSense -/** @typedef {import("../shared/types").ConfigData} ConfigData */ -/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */ -/** @typedef {import("../shared/types").LintMessage} LintMessage */ -/** @typedef {import("../shared/types").LintResult} LintResult */ -/** @typedef {import("../shared/types").ParserOptions} ParserOptions */ -/** @typedef {import("../shared/types").Plugin} Plugin */ -/** @typedef {import("../shared/types").ResultsMeta} ResultsMeta */ -/** @typedef {import("../shared/types").RuleConf} RuleConf */ -/** @typedef {import("../shared/types").Rule} Rule */ -/** @typedef {ReturnType} ExtractedConfig */ - -/** - * The options with which to configure the ESLint instance. - * @typedef {Object} FlatESLintOptions - * @property {boolean} [allowInlineConfig] Enable or disable inline configuration comments. - * @property {ConfigData} [baseConfig] Base config object, extended by all configs used with this instance - * @property {boolean} [cache] Enable result caching. - * @property {string} [cacheLocation] The cache file to use instead of .eslintcache. - * @property {"metadata" | "content"} [cacheStrategy] The strategy used to detect changed files. - * @property {string} [cwd] The value to use for the current working directory. - * @property {boolean} [errorOnUnmatchedPattern] If `false` then `ESLint#lintFiles()` doesn't throw even if no target files found. Defaults to `true`. - * @property {boolean|Function} [fix] Execute in autofix mode. If a function, should return a boolean. - * @property {string[]} [fixTypes] Array of rule types to apply fixes for. - * @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file. - * @property {boolean} [ignore] False disables all ignore patterns except for the default ones. - * @property {string[]} [ignorePatterns] Ignore file patterns to use in addition to config ignores. These patterns are relative to `cwd`. - * @property {ConfigData} [overrideConfig] Override config object, overrides all configs used with this instance - * @property {boolean|string} [overrideConfigFile] Searches for default config file when falsy; - * doesn't do any config file lookup when `true`; considered to be a config filename - * when a string. - * @property {Record} [plugins] An array of plugin implementations. - * @property {"error" | "warn" | "off"} [reportUnusedDisableDirectives] the severity to report unused eslint-disable directives. - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const FLAT_CONFIG_FILENAME = "eslint.config.js"; -const debug = require("debug")("eslint:flat-eslint"); -const removedFormatters = new Set(["table", "codeframe"]); -const privateMembers = new WeakMap(); -const importedConfigFileModificationTime = new Map(); - -/** - * It will calculate the error and warning count for collection of messages per file - * @param {LintMessage[]} messages Collection of messages - * @returns {Object} Contains the stats - * @private - */ -function calculateStatsPerFile(messages) { - return messages.reduce((stat, message) => { - if (message.fatal || message.severity === 2) { - stat.errorCount++; - if (message.fatal) { - stat.fatalErrorCount++; - } - if (message.fix) { - stat.fixableErrorCount++; - } - } else { - stat.warningCount++; - if (message.fix) { - stat.fixableWarningCount++; - } - } - return stat; - }, { - errorCount: 0, - fatalErrorCount: 0, - warningCount: 0, - fixableErrorCount: 0, - fixableWarningCount: 0 - }); -} - -/** - * It will calculate the error and warning count for collection of results from all files - * @param {LintResult[]} results Collection of messages from all the files - * @returns {Object} Contains the stats - * @private - */ -function calculateStatsPerRun(results) { - return results.reduce((stat, result) => { - stat.errorCount += result.errorCount; - stat.fatalErrorCount += result.fatalErrorCount; - stat.warningCount += result.warningCount; - stat.fixableErrorCount += result.fixableErrorCount; - stat.fixableWarningCount += result.fixableWarningCount; - return stat; - }, { - errorCount: 0, - fatalErrorCount: 0, - warningCount: 0, - fixableErrorCount: 0, - fixableWarningCount: 0 - }); -} - -/** - * Create rulesMeta object. - * @param {Map} rules a map of rules from which to generate the object. - * @returns {Object} metadata for all enabled rules. - */ -function createRulesMeta(rules) { - return Array.from(rules).reduce((retVal, [id, rule]) => { - retVal[id] = rule.meta; - return retVal; - }, {}); -} - -/** - * Return the absolute path of a file named `"__placeholder__.js"` in a given directory. - * This is used as a replacement for a missing file path. - * @param {string} cwd An absolute directory path. - * @returns {string} The absolute path of a file named `"__placeholder__.js"` in the given directory. - */ -function getPlaceholderPath(cwd) { - return path.join(cwd, "__placeholder__.js"); -} - -/** @type {WeakMap} */ -const usedDeprecatedRulesCache = new WeakMap(); - -/** - * Create used deprecated rule list. - * @param {CLIEngine} eslint The CLIEngine instance. - * @param {string} maybeFilePath The absolute path to a lint target file or `""`. - * @returns {DeprecatedRuleInfo[]} The used deprecated rule list. - */ -function getOrFindUsedDeprecatedRules(eslint, maybeFilePath) { - const { - configs, - options: { cwd } - } = privateMembers.get(eslint); - const filePath = path.isAbsolute(maybeFilePath) - ? maybeFilePath - : getPlaceholderPath(cwd); - const config = configs.getConfig(filePath); - - // Most files use the same config, so cache it. - if (config && !usedDeprecatedRulesCache.has(config)) { - const retv = []; - - if (config.rules) { - for (const [ruleId, ruleConf] of Object.entries(config.rules)) { - if (getRuleSeverity(ruleConf) === 0) { - continue; - } - const rule = getRuleFromConfig(ruleId, config); - const meta = rule && rule.meta; - - if (meta && meta.deprecated) { - retv.push({ ruleId, replacedBy: meta.replacedBy || [] }); - } - } - } - - - usedDeprecatedRulesCache.set(config, Object.freeze(retv)); - } - - return config ? usedDeprecatedRulesCache.get(config) : Object.freeze([]); -} - -/** - * Processes the linting results generated by a CLIEngine linting report to - * match the ESLint class's API. - * @param {CLIEngine} eslint The CLIEngine instance. - * @param {CLIEngineLintReport} report The CLIEngine linting report to process. - * @returns {LintResult[]} The processed linting results. - */ -function processLintReport(eslint, { results }) { - const descriptor = { - configurable: true, - enumerable: true, - get() { - return getOrFindUsedDeprecatedRules(eslint, this.filePath); - } - }; - - for (const result of results) { - Object.defineProperty(result, "usedDeprecatedRules", descriptor); - } - - return results; -} - -/** - * An Array.prototype.sort() compatible compare function to order results by their file path. - * @param {LintResult} a The first lint result. - * @param {LintResult} b The second lint result. - * @returns {number} An integer representing the order in which the two results should occur. - */ -function compareResultsByFilePath(a, b) { - if (a.filePath < b.filePath) { - return -1; - } - - if (a.filePath > b.filePath) { - return 1; - } - - return 0; -} - -/** - * Searches from the current working directory up until finding the - * given flat config filename. - * @param {string} cwd The current working directory to search from. - * @returns {Promise} The filename if found or `undefined` if not. - */ -function findFlatConfigFile(cwd) { - return findUp( - FLAT_CONFIG_FILENAME, - { cwd } - ); -} - -/** - * Load the config array from the given filename. - * @param {string} filePath The filename to load from. - * @returns {Promise} The config loaded from the config file. - */ -async function loadFlatConfigFile(filePath) { - debug(`Loading config from ${filePath}`); - - const fileURL = pathToFileURL(filePath); - - debug(`Config file URL is ${fileURL}`); - - const mtime = (await fs.stat(filePath)).mtime.getTime(); - - /* - * Append a query with the config file's modification time (`mtime`) in order - * to import the current version of the config file. Without the query, `import()` would - * cache the config file module by the pathname only, and then always return - * the same version (the one that was actual when the module was imported for the first time). - * - * This ensures that the config file module is loaded and executed again - * if it has been changed since the last time it was imported. - * If it hasn't been changed, `import()` will just return the cached version. - * - * Note that we should not overuse queries (e.g., by appending the current time - * to always reload the config file module) as that could cause memory leaks - * because entries are never removed from the import cache. - */ - fileURL.searchParams.append("mtime", mtime); - - /* - * With queries, we can bypass the import cache. However, when import-ing a CJS module, - * Node.js uses the require infrastructure under the hood. That includes the require cache, - * which caches the config file module by its file path (queries have no effect). - * Therefore, we also need to clear the require cache before importing the config file module. - * In order to get the same behavior with ESM and CJS config files, in particular - to reload - * the config file only if it has been changed, we track file modification times and clear - * the require cache only if the file has been changed. - */ - if (importedConfigFileModificationTime.get(filePath) !== mtime) { - delete require.cache[filePath]; - } - - const config = (await import(fileURL)).default; - - importedConfigFileModificationTime.set(filePath, mtime); - - return config; -} - -/** - * Determines which config file to use. This is determined by seeing if an - * override config file was passed, and if so, using it; otherwise, as long - * as override config file is not explicitly set to `false`, it will search - * upwards from the cwd for a file named `eslint.config.js`. - * @param {import("./eslint").ESLintOptions} options The ESLint instance options. - * @returns {{configFilePath:string|undefined,basePath:string,error:Error|null}} Location information for - * the config file. - */ -async function locateConfigFileToUse({ configFile, cwd }) { - - // determine where to load config file from - let configFilePath; - let basePath = cwd; - let error = null; - - if (typeof configFile === "string") { - debug(`Override config file path is ${configFile}`); - configFilePath = path.resolve(cwd, configFile); - } else if (configFile !== false) { - debug("Searching for eslint.config.js"); - configFilePath = await findFlatConfigFile(cwd); - - if (configFilePath) { - basePath = path.resolve(path.dirname(configFilePath)); - } else { - error = new Error("Could not find config file."); - } - - } - - return { - configFilePath, - basePath, - error - }; - -} - -/** - * Calculates the config array for this run based on inputs. - * @param {FlatESLint} eslint The instance to create the config array for. - * @param {import("./eslint").ESLintOptions} options The ESLint instance options. - * @returns {FlatConfigArray} The config array for `eslint``. - */ -async function calculateConfigArray(eslint, { - cwd, - baseConfig, - overrideConfig, - configFile, - ignore: shouldIgnore, - ignorePatterns -}) { - - // check for cached instance - const slots = privateMembers.get(eslint); - - if (slots.configs) { - return slots.configs; - } - - const { configFilePath, basePath, error } = await locateConfigFileToUse({ configFile, cwd }); - - // config file is required to calculate config - if (error) { - throw error; - } - - const configs = new FlatConfigArray(baseConfig || [], { basePath, shouldIgnore }); - - // load config file - if (configFilePath) { - const fileConfig = await loadFlatConfigFile(configFilePath); - - if (Array.isArray(fileConfig)) { - configs.push(...fileConfig); - } else { - configs.push(fileConfig); - } - } - - // add in any configured defaults - configs.push(...slots.defaultConfigs); - - // append command line ignore patterns - if (ignorePatterns && ignorePatterns.length > 0) { - - let relativeIgnorePatterns; - - /* - * If the config file basePath is different than the cwd, then - * the ignore patterns won't work correctly. Here, we adjust the - * ignore pattern to include the correct relative path. Patterns - * passed as `ignorePatterns` are relative to the cwd, whereas - * the config file basePath can be an ancestor of the cwd. - */ - if (basePath === cwd) { - relativeIgnorePatterns = ignorePatterns; - } else { - - const relativeIgnorePath = path.relative(basePath, cwd); - - relativeIgnorePatterns = ignorePatterns.map(pattern => { - const negated = pattern.startsWith("!"); - const basePattern = negated ? pattern.slice(1) : pattern; - - return (negated ? "!" : "") + - path.posix.join(relativeIgnorePath, basePattern); - }); - } - - /* - * Ignore patterns are added to the end of the config array - * so they can override default ignores. - */ - configs.push({ - ignores: relativeIgnorePatterns - }); - } - - if (overrideConfig) { - if (Array.isArray(overrideConfig)) { - configs.push(...overrideConfig); - } else { - configs.push(overrideConfig); - } - } - - await configs.normalize(); - - // cache the config array for this instance - slots.configs = configs; - - return configs; -} - -/** - * Processes an source code using ESLint. - * @param {Object} config The config object. - * @param {string} config.text The source code to verify. - * @param {string} config.cwd The path to the current working directory. - * @param {string|undefined} config.filePath The path to the file of `text`. If this is undefined, it uses ``. - * @param {FlatConfigArray} config.configs The config. - * @param {boolean} config.fix If `true` then it does fix. - * @param {boolean} config.allowInlineConfig If `true` then it uses directive comments. - * @param {boolean} config.reportUnusedDisableDirectives If `true` then it reports unused `eslint-disable` comments. - * @param {Linter} config.linter The linter instance to verify. - * @returns {LintResult} The result of linting. - * @private - */ -function verifyText({ - text, - cwd, - filePath: providedFilePath, - configs, - fix, - allowInlineConfig, - reportUnusedDisableDirectives, - linter -}) { - const filePath = providedFilePath || ""; - - debug(`Lint ${filePath}`); - - /* - * Verify. - * `config.extractConfig(filePath)` requires an absolute path, but `linter` - * doesn't know CWD, so it gives `linter` an absolute path always. - */ - const filePathToVerify = filePath === "" ? getPlaceholderPath(cwd) : filePath; - const { fixed, messages, output } = linter.verifyAndFix( - text, - configs, - { - allowInlineConfig, - filename: filePathToVerify, - fix, - reportUnusedDisableDirectives, - - /** - * Check if the linter should adopt a given code block or not. - * @param {string} blockFilename The virtual filename of a code block. - * @returns {boolean} `true` if the linter should adopt the code block. - */ - filterCodeBlock(blockFilename) { - return configs.isExplicitMatch(blockFilename); - } - } - ); - - // Tweak and return. - const result = { - filePath: filePath === "" ? filePath : path.resolve(filePath), - messages, - suppressedMessages: linter.getSuppressedMessages(), - ...calculateStatsPerFile(messages) - }; - - if (fixed) { - result.output = output; - } - - if ( - result.errorCount + result.warningCount > 0 && - typeof result.output === "undefined" - ) { - result.source = text; - } - - return result; -} - -/** - * Checks whether a message's rule type should be fixed. - * @param {LintMessage} message The message to check. - * @param {FlatConfig} config The config for the file that generated the message. - * @param {string[]} fixTypes An array of fix types to check. - * @returns {boolean} Whether the message should be fixed. - */ -function shouldMessageBeFixed(message, config, fixTypes) { - if (!message.ruleId) { - return fixTypes.has("directive"); - } - - const rule = message.ruleId && getRuleFromConfig(message.ruleId, config); - - return Boolean(rule && rule.meta && fixTypes.has(rule.meta.type)); -} - -/** - * Collect used deprecated rules. - * @param {Array} configs The configs to evaluate. - * @returns {IterableIterator} Used deprecated rules. - */ -function *iterateRuleDeprecationWarnings(configs) { - const processedRuleIds = new Set(); - - for (const config of configs) { - for (const [ruleId, ruleConfig] of Object.entries(config.rules)) { - - // Skip if it was processed. - if (processedRuleIds.has(ruleId)) { - continue; - } - processedRuleIds.add(ruleId); - - // Skip if it's not used. - if (!getRuleSeverity(ruleConfig)) { - continue; - } - const rule = getRuleFromConfig(ruleId, config); - - // Skip if it's not deprecated. - if (!(rule && rule.meta && rule.meta.deprecated)) { - continue; - } - - // This rule was used and deprecated. - yield { - ruleId, - replacedBy: rule.meta.replacedBy || [] - }; - } - } -} - -/** - * Creates an error to be thrown when an array of results passed to `getRulesMetaForResults` was not created by the current engine. - * @returns {TypeError} An error object. - */ -function createExtraneousResultsError() { - return new TypeError("Results object was not created from this ESLint instance."); -} - -//----------------------------------------------------------------------------- -// Main API -//----------------------------------------------------------------------------- - -/** - * Primary Node.js API for ESLint. - */ -class FlatESLint { - - /** - * Creates a new instance of the main ESLint API. - * @param {FlatESLintOptions} options The options for this instance. - */ - constructor(options = {}) { - - const defaultConfigs = []; - const processedOptions = processOptions(options); - const linter = new Linter({ - cwd: processedOptions.cwd, - configType: "flat" - }); - - const cacheFilePath = getCacheFile( - processedOptions.cacheLocation, - processedOptions.cwd - ); - - const lintResultCache = processedOptions.cache - ? new LintResultCache(cacheFilePath, processedOptions.cacheStrategy) - : null; - - privateMembers.set(this, { - options: processedOptions, - linter, - cacheFilePath, - lintResultCache, - defaultConfigs, - defaultIgnores: () => false, - configs: null - }); - - /** - * If additional plugins are passed in, add that to the default - * configs for this instance. - */ - if (options.plugins) { - - const plugins = {}; - - for (const [pluginName, plugin] of Object.entries(options.plugins)) { - plugins[naming.getShorthandName(pluginName, "eslint-plugin")] = plugin; - } - - defaultConfigs.push({ - plugins - }); - } - - } - - /** - * The version text. - * @type {string} - */ - static get version() { - return version; - } - - /** - * Outputs fixes from the given results to files. - * @param {LintResult[]} results The lint results. - * @returns {Promise} Returns a promise that is used to track side effects. - */ - static async outputFixes(results) { - if (!Array.isArray(results)) { - throw new Error("'results' must be an array"); - } - - await Promise.all( - results - .filter(result => { - if (typeof result !== "object" || result === null) { - throw new Error("'results' must include only objects"); - } - return ( - typeof result.output === "string" && - path.isAbsolute(result.filePath) - ); - }) - .map(r => fs.writeFile(r.filePath, r.output)) - ); - } - - /** - * Returns results that only contains errors. - * @param {LintResult[]} results The results to filter. - * @returns {LintResult[]} The filtered results. - */ - static getErrorResults(results) { - const filtered = []; - - results.forEach(result => { - const filteredMessages = result.messages.filter(isErrorMessage); - const filteredSuppressedMessages = result.suppressedMessages.filter(isErrorMessage); - - if (filteredMessages.length > 0) { - filtered.push({ - ...result, - messages: filteredMessages, - suppressedMessages: filteredSuppressedMessages, - errorCount: filteredMessages.length, - warningCount: 0, - fixableErrorCount: result.fixableErrorCount, - fixableWarningCount: 0 - }); - } - }); - - return filtered; - } - - /** - * Returns meta objects for each rule represented in the lint results. - * @param {LintResult[]} results The results to fetch rules meta for. - * @returns {Object} A mapping of ruleIds to rule meta objects. - * @throws {TypeError} When the results object wasn't created from this ESLint instance. - * @throws {TypeError} When a plugin or rule is missing. - */ - getRulesMetaForResults(results) { - - // short-circuit simple case - if (results.length === 0) { - return {}; - } - - const resultRules = new Map(); - const { - configs, - options: { cwd } - } = privateMembers.get(this); - - /* - * We can only accurately return rules meta information for linting results if the - * results were created by this instance. Otherwise, the necessary rules data is - * not available. So if the config array doesn't already exist, just throw an error - * to let the user know we can't do anything here. - */ - if (!configs) { - throw createExtraneousResultsError(); - } - - for (const result of results) { - - /* - * Normalize filename for . - */ - const filePath = result.filePath === "" - ? getPlaceholderPath(cwd) : result.filePath; - const allMessages = result.messages.concat(result.suppressedMessages); - - for (const { ruleId } of allMessages) { - if (!ruleId) { - continue; - } - - /* - * All of the plugin and rule information is contained within the - * calculated config for the given file. - */ - const config = configs.getConfig(filePath); - - if (!config) { - throw createExtraneousResultsError(); - } - const rule = getRuleFromConfig(ruleId, config); - - // ensure the rule exists - if (!rule) { - throw new TypeError(`Could not find the rule "${ruleId}".`); - } - - resultRules.set(ruleId, rule); - } - } - - return createRulesMeta(resultRules); - } - - /** - * Executes the current configuration on an array of file and directory names. - * @param {string|string[]} patterns An array of file and directory names. - * @returns {Promise} The results of linting the file patterns given. - */ - async lintFiles(patterns) { - if (!isNonEmptyString(patterns) && !isArrayOfNonEmptyString(patterns)) { - throw new Error("'patterns' must be a non-empty string or an array of non-empty strings"); - } - - const { - cacheFilePath, - lintResultCache, - linter, - options: eslintOptions - } = privateMembers.get(this); - const configs = await calculateConfigArray(this, eslintOptions); - const { - allowInlineConfig, - cache, - cwd, - fix, - fixTypes, - reportUnusedDisableDirectives, - globInputPaths, - errorOnUnmatchedPattern - } = eslintOptions; - const startTime = Date.now(); - const usedConfigs = []; - const fixTypesSet = fixTypes ? new Set(fixTypes) : null; - - // Delete cache file; should this be done here? - if (!cache && cacheFilePath) { - debug(`Deleting cache file at ${cacheFilePath}`); - - try { - await fs.unlink(cacheFilePath); - } catch (error) { - const errorCode = error && error.code; - - // Ignore errors when no such file exists or file system is read only (and cache file does not exist) - if (errorCode !== "ENOENT" && !(errorCode === "EROFS" && !(await fs.exists(cacheFilePath)))) { - throw error; - } - } - } - - const filePaths = await findFiles({ - patterns: typeof patterns === "string" ? [patterns] : patterns, - cwd, - globInputPaths, - configs, - errorOnUnmatchedPattern - }); - - debug(`${filePaths.length} files found in: ${Date.now() - startTime}ms`); - - /* - * Because we need to process multiple files, including reading from disk, - * it is most efficient to start by reading each file via promises so that - * they can be done in parallel. Then, we can lint the returned text. This - * ensures we are waiting the minimum amount of time in between lints. - */ - const results = await Promise.all( - - filePaths.map(({ filePath, ignored }) => { - - /* - * If a filename was entered that matches an ignore - * pattern, then notify the user. - */ - if (ignored) { - return createIgnoreResult(filePath, cwd); - } - - const config = configs.getConfig(filePath); - - /* - * Sometimes a file found through a glob pattern will - * be ignored. In this case, `config` will be undefined - * and we just silently ignore the file. - */ - if (!config) { - return void 0; - } - - /* - * Store used configs for: - * - this method uses to collect used deprecated rules. - * - `--fix-type` option uses to get the loaded rule's meta data. - */ - if (!usedConfigs.includes(config)) { - usedConfigs.push(config); - } - - // Skip if there is cached result. - if (lintResultCache) { - const cachedResult = - lintResultCache.getCachedLintResults(filePath, config); - - if (cachedResult) { - const hadMessages = - cachedResult.messages && - cachedResult.messages.length > 0; - - if (hadMessages && fix) { - debug(`Reprocessing cached file to allow autofix: ${filePath}`); - } else { - debug(`Skipping file since it hasn't changed: ${filePath}`); - return cachedResult; - } - } - } - - - // set up fixer for fixTypes if necessary - let fixer = fix; - - if (fix && fixTypesSet) { - - // save original value of options.fix in case it's a function - const originalFix = (typeof fix === "function") - ? fix : () => true; - - fixer = message => shouldMessageBeFixed(message, config, fixTypesSet) && originalFix(message); - } - - return fs.readFile(filePath, "utf8") - .then(text => { - - // do the linting - const result = verifyText({ - text, - filePath, - configs, - cwd, - fix: fixer, - allowInlineConfig, - reportUnusedDisableDirectives, - linter - }); - - /* - * Store the lint result in the LintResultCache. - * NOTE: The LintResultCache will remove the file source and any - * other properties that are difficult to serialize, and will - * hydrate those properties back in on future lint runs. - */ - if (lintResultCache) { - lintResultCache.setCachedLintResults(filePath, config, result); - } - - return result; - }); - - }) - ); - - // Persist the cache to disk. - if (lintResultCache) { - lintResultCache.reconcile(); - } - - let usedDeprecatedRules; - const finalResults = results.filter(result => !!result); - - return processLintReport(this, { - results: finalResults, - ...calculateStatsPerRun(finalResults), - - // Initialize it lazily because CLI and `ESLint` API don't use it. - get usedDeprecatedRules() { - if (!usedDeprecatedRules) { - usedDeprecatedRules = Array.from( - iterateRuleDeprecationWarnings(usedConfigs) - ); - } - return usedDeprecatedRules; - } - }); - } - - /** - * Executes the current configuration on text. - * @param {string} code A string of JavaScript code to lint. - * @param {Object} [options] The options. - * @param {string} [options.filePath] The path to the file of the source code. - * @param {boolean} [options.warnIgnored] When set to true, warn if given filePath is an ignored path. - * @returns {Promise} The results of linting the string of code given. - */ - async lintText(code, options = {}) { - - // Parameter validation - - if (typeof code !== "string") { - throw new Error("'code' must be a string"); - } - - if (typeof options !== "object") { - throw new Error("'options' must be an object, null, or undefined"); - } - - // Options validation - - const { - filePath, - warnIgnored = false, - ...unknownOptions - } = options || {}; - - const unknownOptionKeys = Object.keys(unknownOptions); - - if (unknownOptionKeys.length > 0) { - throw new Error(`'options' must not include the unknown option(s): ${unknownOptionKeys.join(", ")}`); - } - - if (filePath !== void 0 && !isNonEmptyString(filePath)) { - throw new Error("'options.filePath' must be a non-empty string or undefined"); - } - - if (typeof warnIgnored !== "boolean") { - throw new Error("'options.warnIgnored' must be a boolean or undefined"); - } - - // Now we can get down to linting - - const { - linter, - options: eslintOptions - } = privateMembers.get(this); - const configs = await calculateConfigArray(this, eslintOptions); - const { - allowInlineConfig, - cwd, - fix, - reportUnusedDisableDirectives - } = eslintOptions; - const results = []; - const startTime = Date.now(); - const resolvedFilename = path.resolve(cwd, filePath || "__placeholder__.js"); - let config; - - // Clear the last used config arrays. - if (resolvedFilename && await this.isPathIgnored(resolvedFilename)) { - if (warnIgnored) { - results.push(createIgnoreResult(resolvedFilename, cwd)); - } - } else { - - // TODO: Needed? - config = configs.getConfig(resolvedFilename); - - // Do lint. - results.push(verifyText({ - text: code, - filePath: resolvedFilename.endsWith("__placeholder__.js") ? "" : resolvedFilename, - configs, - cwd, - fix, - allowInlineConfig, - reportUnusedDisableDirectives, - linter - })); - } - - debug(`Linting complete in: ${Date.now() - startTime}ms`); - let usedDeprecatedRules; - - return processLintReport(this, { - results, - ...calculateStatsPerRun(results), - - // Initialize it lazily because CLI and `ESLint` API don't use it. - get usedDeprecatedRules() { - if (!usedDeprecatedRules) { - usedDeprecatedRules = Array.from( - iterateRuleDeprecationWarnings(config) - ); - } - return usedDeprecatedRules; - } - }); - - } - - /** - * Returns the formatter representing the given formatter name. - * @param {string} [name] The name of the formatter to load. - * The following values are allowed: - * - `undefined` ... Load `stylish` builtin formatter. - * - A builtin formatter name ... Load the builtin formatter. - * - A third-party formatter name: - * - `foo` → `eslint-formatter-foo` - * - `@foo` → `@foo/eslint-formatter` - * - `@foo/bar` → `@foo/eslint-formatter-bar` - * - A file path ... Load the file. - * @returns {Promise} A promise resolving to the formatter object. - * This promise will be rejected if the given formatter was not found or not - * a function. - */ - async loadFormatter(name = "stylish") { - if (typeof name !== "string") { - throw new Error("'name' must be a string"); - } - - // replace \ with / for Windows compatibility - const normalizedFormatName = name.replace(/\\/gu, "/"); - const namespace = naming.getNamespaceFromTerm(normalizedFormatName); - - // grab our options - const { cwd } = privateMembers.get(this).options; - - - let formatterPath; - - // if there's a slash, then it's a file (TODO: this check seems dubious for scoped npm packages) - if (!namespace && normalizedFormatName.includes("/")) { - formatterPath = path.resolve(cwd, normalizedFormatName); - } else { - try { - const npmFormat = naming.normalizePackageName(normalizedFormatName, "eslint-formatter"); - - // TODO: This is pretty dirty...would be nice to clean up at some point. - formatterPath = ModuleResolver.resolve(npmFormat, getPlaceholderPath(cwd)); - } catch { - formatterPath = path.resolve(__dirname, "../", "cli-engine", "formatters", `${normalizedFormatName}.js`); - } - } - - let formatter; - - try { - formatter = (await import(pathToFileURL(formatterPath))).default; - } catch (ex) { - - // check for formatters that have been removed - if (removedFormatters.has(name)) { - ex.message = `The ${name} formatter is no longer part of core ESLint. Install it manually with \`npm install -D eslint-formatter-${name}\``; - } else { - ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`; - } - - throw ex; - } - - - if (typeof formatter !== "function") { - throw new TypeError(`Formatter must be a function, but got a ${typeof formatter}.`); - } - - const eslint = this; - - return { - - /** - * The main formatter method. - * @param {LintResults[]} results The lint results to format. - * @param {ResultsMeta} resultsMeta Warning count and max threshold. - * @returns {string} The formatted lint results. - */ - format(results, resultsMeta) { - let rulesMeta = null; - - results.sort(compareResultsByFilePath); - - return formatter(results, { - ...resultsMeta, - cwd, - get rulesMeta() { - if (!rulesMeta) { - rulesMeta = eslint.getRulesMetaForResults(results); - } - - return rulesMeta; - } - }); - } - }; - } - - /** - * Returns a configuration object for the given file based on the CLI options. - * This is the same logic used by the ESLint CLI executable to determine - * configuration for each file it processes. - * @param {string} filePath The path of the file to retrieve a config object for. - * @returns {Promise} A configuration object for the file - * or `undefined` if there is no configuration data for the object. - */ - async calculateConfigForFile(filePath) { - if (!isNonEmptyString(filePath)) { - throw new Error("'filePath' must be a non-empty string"); - } - const options = privateMembers.get(this).options; - const absolutePath = path.resolve(options.cwd, filePath); - const configs = await calculateConfigArray(this, options); - - return configs.getConfig(absolutePath); - } - - /** - * Finds the config file being used by this instance based on the options - * passed to the constructor. - * @returns {string|undefined} The path to the config file being used or - * `undefined` if no config file is being used. - */ - async findConfigFile() { - const options = privateMembers.get(this).options; - const { configFilePath } = await locateConfigFileToUse(options); - - return configFilePath; - } - - /** - * Checks if a given path is ignored by ESLint. - * @param {string} filePath The path of the file to check. - * @returns {Promise} Whether or not the given path is ignored. - */ - async isPathIgnored(filePath) { - const config = await this.calculateConfigForFile(filePath); - - return config === void 0; - } -} - -/** - * Returns whether flat config should be used. - * @returns {Promise} Whether flat config should be used. - */ -async function shouldUseFlatConfig() { - switch (process.env.ESLINT_USE_FLAT_CONFIG) { - case "true": - return true; - case "false": - return false; - default: - - /* - * If neither explicitly enabled nor disabled, then use the presence - * of a flat config file to determine enablement. - */ - return !!(await findFlatConfigFile(process.cwd())); - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - FlatESLint, - shouldUseFlatConfig -}; diff --git a/node_modules/eslint/lib/eslint/index.js b/node_modules/eslint/lib/eslint/index.js deleted file mode 100644 index 017b768ec..000000000 --- a/node_modules/eslint/lib/eslint/index.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const { ESLint } = require("./eslint"); -const { FlatESLint } = require("./flat-eslint"); - -module.exports = { - ESLint, - FlatESLint -}; diff --git a/node_modules/eslint/lib/linter/apply-disable-directives.js b/node_modules/eslint/lib/linter/apply-disable-directives.js deleted file mode 100644 index 13ced990f..000000000 --- a/node_modules/eslint/lib/linter/apply-disable-directives.js +++ /dev/null @@ -1,351 +0,0 @@ -/** - * @fileoverview A module that filters reported problems based on `eslint-disable` and `eslint-enable` comments - * @author Teddy Katz - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").LintMessage} LintMessage */ - -//------------------------------------------------------------------------------ -// Module Definition -//------------------------------------------------------------------------------ - -const escapeRegExp = require("escape-string-regexp"); - -/** - * Compares the locations of two objects in a source file - * @param {{line: number, column: number}} itemA The first object - * @param {{line: number, column: number}} itemB The second object - * @returns {number} A value less than 1 if itemA appears before itemB in the source file, greater than 1 if - * itemA appears after itemB in the source file, or 0 if itemA and itemB have the same location. - */ -function compareLocations(itemA, itemB) { - return itemA.line - itemB.line || itemA.column - itemB.column; -} - -/** - * Groups a set of directives into sub-arrays by their parent comment. - * @param {Directive[]} directives Unused directives to be removed. - * @returns {Directive[][]} Directives grouped by their parent comment. - */ -function groupByParentComment(directives) { - const groups = new Map(); - - for (const directive of directives) { - const { unprocessedDirective: { parentComment } } = directive; - - if (groups.has(parentComment)) { - groups.get(parentComment).push(directive); - } else { - groups.set(parentComment, [directive]); - } - } - - return [...groups.values()]; -} - -/** - * Creates removal details for a set of directives within the same comment. - * @param {Directive[]} directives Unused directives to be removed. - * @param {Token} commentToken The backing Comment token. - * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems. - */ -function createIndividualDirectivesRemoval(directives, commentToken) { - - /* - * `commentToken.value` starts right after `//` or `/*`. - * All calculated offsets will be relative to this index. - */ - const commentValueStart = commentToken.range[0] + "//".length; - - // Find where the list of rules starts. `\S+` matches with the directive name (e.g. `eslint-disable-line`) - const listStartOffset = /^\s*\S+\s+/u.exec(commentToken.value)[0].length; - - /* - * Get the list text without any surrounding whitespace. In order to preserve the original - * formatting, we don't want to change that whitespace. - * - * // eslint-disable-line rule-one , rule-two , rule-three -- comment - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ - const listText = commentToken.value - .slice(listStartOffset) // remove directive name and all whitespace before the list - .split(/\s-{2,}\s/u)[0] // remove `-- comment`, if it exists - .trimEnd(); // remove all whitespace after the list - - /* - * We can assume that `listText` contains multiple elements. - * Otherwise, this function wouldn't be called - if there is - * only one rule in the list, then the whole comment must be removed. - */ - - return directives.map(directive => { - const { ruleId } = directive; - - const regex = new RegExp(String.raw`(?:^|\s*,\s*)${escapeRegExp(ruleId)}(?:\s*,\s*|$)`, "u"); - const match = regex.exec(listText); - const matchedText = match[0]; - const matchStartOffset = listStartOffset + match.index; - const matchEndOffset = matchStartOffset + matchedText.length; - - const firstIndexOfComma = matchedText.indexOf(","); - const lastIndexOfComma = matchedText.lastIndexOf(","); - - let removalStartOffset, removalEndOffset; - - if (firstIndexOfComma !== lastIndexOfComma) { - - /* - * Since there are two commas, this must one of the elements in the middle of the list. - * Matched range starts where the previous rule name ends, and ends where the next rule name starts. - * - * // eslint-disable-line rule-one , rule-two , rule-three -- comment - * ^^^^^^^^^^^^^^ - * - * We want to remove only the content between the two commas, and also one of the commas. - * - * // eslint-disable-line rule-one , rule-two , rule-three -- comment - * ^^^^^^^^^^^ - */ - removalStartOffset = matchStartOffset + firstIndexOfComma; - removalEndOffset = matchStartOffset + lastIndexOfComma; - - } else { - - /* - * This is either the first element or the last element. - * - * If this is the first element, matched range starts where the first rule name starts - * and ends where the second rule name starts. This is exactly the range we want - * to remove so that the second rule name will start where the first one was starting - * and thus preserve the original formatting. - * - * // eslint-disable-line rule-one , rule-two , rule-three -- comment - * ^^^^^^^^^^^ - * - * Similarly, if this is the last element, we've already matched the range we want to - * remove. The previous rule name will end where the last one was ending, relative - * to the content on the right side. - * - * // eslint-disable-line rule-one , rule-two , rule-three -- comment - * ^^^^^^^^^^^^^ - */ - removalStartOffset = matchStartOffset; - removalEndOffset = matchEndOffset; - } - - return { - description: `'${ruleId}'`, - fix: { - range: [ - commentValueStart + removalStartOffset, - commentValueStart + removalEndOffset - ], - text: "" - }, - unprocessedDirective: directive.unprocessedDirective - }; - }); -} - -/** - * Creates a description of deleting an entire unused disable comment. - * @param {Directive[]} directives Unused directives to be removed. - * @param {Token} commentToken The backing Comment token. - * @returns {{ description, fix, unprocessedDirective }} Details for later creation of an output Problem. - */ -function createCommentRemoval(directives, commentToken) { - const { range } = commentToken; - const ruleIds = directives.filter(directive => directive.ruleId).map(directive => `'${directive.ruleId}'`); - - return { - description: ruleIds.length <= 2 - ? ruleIds.join(" or ") - : `${ruleIds.slice(0, ruleIds.length - 1).join(", ")}, or ${ruleIds[ruleIds.length - 1]}`, - fix: { - range, - text: " " - }, - unprocessedDirective: directives[0].unprocessedDirective - }; -} - -/** - * Parses details from directives to create output Problems. - * @param {Directive[]} allDirectives Unused directives to be removed. - * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems. - */ -function processUnusedDisableDirectives(allDirectives) { - const directiveGroups = groupByParentComment(allDirectives); - - return directiveGroups.flatMap( - directives => { - const { parentComment } = directives[0].unprocessedDirective; - const remainingRuleIds = new Set(parentComment.ruleIds); - - for (const directive of directives) { - remainingRuleIds.delete(directive.ruleId); - } - - return remainingRuleIds.size - ? createIndividualDirectivesRemoval(directives, parentComment.commentToken) - : [createCommentRemoval(directives, parentComment.commentToken)]; - } - ); -} - -/** - * This is the same as the exported function, except that it - * doesn't handle disable-line and disable-next-line directives, and it always reports unused - * disable directives. - * @param {Object} options options for applying directives. This is the same as the options - * for the exported function, except that `reportUnusedDisableDirectives` is not supported - * (this function always reports unused disable directives). - * @returns {{problems: LintMessage[], unusedDisableDirectives: LintMessage[]}} An object with a list - * of problems (including suppressed ones) and unused eslint-disable directives - */ -function applyDirectives(options) { - const problems = []; - const usedDisableDirectives = new Set(); - - for (const problem of options.problems) { - let disableDirectivesForProblem = []; - let nextDirectiveIndex = 0; - - while ( - nextDirectiveIndex < options.directives.length && - compareLocations(options.directives[nextDirectiveIndex], problem) <= 0 - ) { - const directive = options.directives[nextDirectiveIndex++]; - - if (directive.ruleId === null || directive.ruleId === problem.ruleId) { - switch (directive.type) { - case "disable": - disableDirectivesForProblem.push(directive); - break; - - case "enable": - disableDirectivesForProblem = []; - break; - - // no default - } - } - } - - if (disableDirectivesForProblem.length > 0) { - const suppressions = disableDirectivesForProblem.map(directive => ({ - kind: "directive", - justification: directive.unprocessedDirective.justification - })); - - if (problem.suppressions) { - problem.suppressions = problem.suppressions.concat(suppressions); - } else { - problem.suppressions = suppressions; - usedDisableDirectives.add(disableDirectivesForProblem[disableDirectivesForProblem.length - 1]); - } - } - - problems.push(problem); - } - - const unusedDisableDirectivesToReport = options.directives - .filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive)); - - const processed = processUnusedDisableDirectives(unusedDisableDirectivesToReport); - - const unusedDisableDirectives = processed - .map(({ description, fix, unprocessedDirective }) => { - const { parentComment, type, line, column } = unprocessedDirective; - - return { - ruleId: null, - message: description - ? `Unused eslint-disable directive (no problems were reported from ${description}).` - : "Unused eslint-disable directive (no problems were reported).", - line: type === "disable-next-line" ? parentComment.commentToken.loc.start.line : line, - column: type === "disable-next-line" ? parentComment.commentToken.loc.start.column + 1 : column, - severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2, - nodeType: null, - ...options.disableFixes ? {} : { fix } - }; - }); - - return { problems, unusedDisableDirectives }; -} - -/** - * Given a list of directive comments (i.e. metadata about eslint-disable and eslint-enable comments) and a list - * of reported problems, adds the suppression information to the problems. - * @param {Object} options Information about directives and problems - * @param {{ - * type: ("disable"|"enable"|"disable-line"|"disable-next-line"), - * ruleId: (string|null), - * line: number, - * column: number, - * justification: string - * }} options.directives Directive comments found in the file, with one-based columns. - * Two directive comments can only have the same location if they also have the same type (e.g. a single eslint-disable - * comment for two different rules is represented as two directives). - * @param {{ruleId: (string|null), line: number, column: number}[]} options.problems - * A list of problems reported by rules, sorted by increasing location in the file, with one-based columns. - * @param {"off" | "warn" | "error"} options.reportUnusedDisableDirectives If `"warn"` or `"error"`, adds additional problems for unused directives - * @param {boolean} options.disableFixes If true, it doesn't make `fix` properties. - * @returns {{ruleId: (string|null), line: number, column: number, suppressions?: {kind: string, justification: string}}[]} - * An object with a list of reported problems, the suppressed of which contain the suppression information. - */ -module.exports = ({ directives, disableFixes, problems, reportUnusedDisableDirectives = "off" }) => { - const blockDirectives = directives - .filter(directive => directive.type === "disable" || directive.type === "enable") - .map(directive => Object.assign({}, directive, { unprocessedDirective: directive })) - .sort(compareLocations); - - const lineDirectives = directives.flatMap(directive => { - switch (directive.type) { - case "disable": - case "enable": - return []; - - case "disable-line": - return [ - { type: "disable", line: directive.line, column: 1, ruleId: directive.ruleId, unprocessedDirective: directive }, - { type: "enable", line: directive.line + 1, column: 0, ruleId: directive.ruleId, unprocessedDirective: directive } - ]; - - case "disable-next-line": - return [ - { type: "disable", line: directive.line + 1, column: 1, ruleId: directive.ruleId, unprocessedDirective: directive }, - { type: "enable", line: directive.line + 2, column: 0, ruleId: directive.ruleId, unprocessedDirective: directive } - ]; - - default: - throw new TypeError(`Unrecognized directive type '${directive.type}'`); - } - }).sort(compareLocations); - - const blockDirectivesResult = applyDirectives({ - problems, - directives: blockDirectives, - disableFixes, - reportUnusedDisableDirectives - }); - const lineDirectivesResult = applyDirectives({ - problems: blockDirectivesResult.problems, - directives: lineDirectives, - disableFixes, - reportUnusedDisableDirectives - }); - - return reportUnusedDisableDirectives !== "off" - ? lineDirectivesResult.problems - .concat(blockDirectivesResult.unusedDisableDirectives) - .concat(lineDirectivesResult.unusedDisableDirectives) - .sort(compareLocations) - : lineDirectivesResult.problems; -}; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js b/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js deleted file mode 100644 index 2dcc27348..000000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js +++ /dev/null @@ -1,844 +0,0 @@ -/** - * @fileoverview A class of the code path analyzer. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const assert = require("assert"), - { breakableTypePattern } = require("../../shared/ast-utils"), - CodePath = require("./code-path"), - CodePathSegment = require("./code-path-segment"), - IdGenerator = require("./id-generator"), - debug = require("./debug-helpers"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a given node is a `case` node (not `default` node). - * @param {ASTNode} node A `SwitchCase` node to check. - * @returns {boolean} `true` if the node is a `case` node (not `default` node). - */ -function isCaseNode(node) { - return Boolean(node.test); -} - -/** - * Checks if a given node appears as the value of a PropertyDefinition node. - * @param {ASTNode} node THe node to check. - * @returns {boolean} `true` if the node is a PropertyDefinition value, - * false if not. - */ -function isPropertyDefinitionValue(node) { - const parent = node.parent; - - return parent && parent.type === "PropertyDefinition" && parent.value === node; -} - -/** - * Checks whether the given logical operator is taken into account for the code - * path analysis. - * @param {string} operator The operator found in the LogicalExpression node - * @returns {boolean} `true` if the operator is "&&" or "||" or "??" - */ -function isHandledLogicalOperator(operator) { - return operator === "&&" || operator === "||" || operator === "??"; -} - -/** - * Checks whether the given assignment operator is a logical assignment operator. - * Logical assignments are taken into account for the code path analysis - * because of their short-circuiting semantics. - * @param {string} operator The operator found in the AssignmentExpression node - * @returns {boolean} `true` if the operator is "&&=" or "||=" or "??=" - */ -function isLogicalAssignmentOperator(operator) { - return operator === "&&=" || operator === "||=" || operator === "??="; -} - -/** - * Gets the label if the parent node of a given node is a LabeledStatement. - * @param {ASTNode} node A node to get. - * @returns {string|null} The label or `null`. - */ -function getLabel(node) { - if (node.parent.type === "LabeledStatement") { - return node.parent.label.name; - } - return null; -} - -/** - * Checks whether or not a given logical expression node goes different path - * between the `true` case and the `false` case. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is a test of a choice statement. - */ -function isForkingByTrueOrFalse(node) { - const parent = node.parent; - - switch (parent.type) { - case "ConditionalExpression": - case "IfStatement": - case "WhileStatement": - case "DoWhileStatement": - case "ForStatement": - return parent.test === node; - - case "LogicalExpression": - return isHandledLogicalOperator(parent.operator); - - case "AssignmentExpression": - return isLogicalAssignmentOperator(parent.operator); - - default: - return false; - } -} - -/** - * Gets the boolean value of a given literal node. - * - * This is used to detect infinity loops (e.g. `while (true) {}`). - * Statements preceded by an infinity loop are unreachable if the loop didn't - * have any `break` statement. - * @param {ASTNode} node A node to get. - * @returns {boolean|undefined} a boolean value if the node is a Literal node, - * otherwise `undefined`. - */ -function getBooleanValueIfSimpleConstant(node) { - if (node.type === "Literal") { - return Boolean(node.value); - } - return void 0; -} - -/** - * Checks that a given identifier node is a reference or not. - * - * This is used to detect the first throwable node in a `try` block. - * @param {ASTNode} node An Identifier node to check. - * @returns {boolean} `true` if the node is a reference. - */ -function isIdentifierReference(node) { - const parent = node.parent; - - switch (parent.type) { - case "LabeledStatement": - case "BreakStatement": - case "ContinueStatement": - case "ArrayPattern": - case "RestElement": - case "ImportSpecifier": - case "ImportDefaultSpecifier": - case "ImportNamespaceSpecifier": - case "CatchClause": - return false; - - case "FunctionDeclaration": - case "FunctionExpression": - case "ArrowFunctionExpression": - case "ClassDeclaration": - case "ClassExpression": - case "VariableDeclarator": - return parent.id !== node; - - case "Property": - case "PropertyDefinition": - case "MethodDefinition": - return ( - parent.key !== node || - parent.computed || - parent.shorthand - ); - - case "AssignmentPattern": - return parent.key !== node; - - default: - return true; - } -} - -/** - * Updates the current segment with the head segment. - * This is similar to local branches and tracking branches of git. - * - * To separate the current and the head is in order to not make useless segments. - * - * In this process, both "onCodePathSegmentStart" and "onCodePathSegmentEnd" - * events are fired. - * @param {CodePathAnalyzer} analyzer The instance. - * @param {ASTNode} node The current AST node. - * @returns {void} - */ -function forwardCurrentToHead(analyzer, node) { - const codePath = analyzer.codePath; - const state = CodePath.getState(codePath); - const currentSegments = state.currentSegments; - const headSegments = state.headSegments; - const end = Math.max(currentSegments.length, headSegments.length); - let i, currentSegment, headSegment; - - // Fires leaving events. - for (i = 0; i < end; ++i) { - currentSegment = currentSegments[i]; - headSegment = headSegments[i]; - - if (currentSegment !== headSegment && currentSegment) { - debug.dump(`onCodePathSegmentEnd ${currentSegment.id}`); - - if (currentSegment.reachable) { - analyzer.emitter.emit( - "onCodePathSegmentEnd", - currentSegment, - node - ); - } - } - } - - // Update state. - state.currentSegments = headSegments; - - // Fires entering events. - for (i = 0; i < end; ++i) { - currentSegment = currentSegments[i]; - headSegment = headSegments[i]; - - if (currentSegment !== headSegment && headSegment) { - debug.dump(`onCodePathSegmentStart ${headSegment.id}`); - - CodePathSegment.markUsed(headSegment); - if (headSegment.reachable) { - analyzer.emitter.emit( - "onCodePathSegmentStart", - headSegment, - node - ); - } - } - } - -} - -/** - * Updates the current segment with empty. - * This is called at the last of functions or the program. - * @param {CodePathAnalyzer} analyzer The instance. - * @param {ASTNode} node The current AST node. - * @returns {void} - */ -function leaveFromCurrentSegment(analyzer, node) { - const state = CodePath.getState(analyzer.codePath); - const currentSegments = state.currentSegments; - - for (let i = 0; i < currentSegments.length; ++i) { - const currentSegment = currentSegments[i]; - - debug.dump(`onCodePathSegmentEnd ${currentSegment.id}`); - if (currentSegment.reachable) { - analyzer.emitter.emit( - "onCodePathSegmentEnd", - currentSegment, - node - ); - } - } - - state.currentSegments = []; -} - -/** - * Updates the code path due to the position of a given node in the parent node - * thereof. - * - * For example, if the node is `parent.consequent`, this creates a fork from the - * current path. - * @param {CodePathAnalyzer} analyzer The instance. - * @param {ASTNode} node The current AST node. - * @returns {void} - */ -function preprocess(analyzer, node) { - const codePath = analyzer.codePath; - const state = CodePath.getState(codePath); - const parent = node.parent; - - switch (parent.type) { - - // The `arguments.length == 0` case is in `postprocess` function. - case "CallExpression": - if (parent.optional === true && parent.arguments.length >= 1 && parent.arguments[0] === node) { - state.makeOptionalRight(); - } - break; - case "MemberExpression": - if (parent.optional === true && parent.property === node) { - state.makeOptionalRight(); - } - break; - - case "LogicalExpression": - if ( - parent.right === node && - isHandledLogicalOperator(parent.operator) - ) { - state.makeLogicalRight(); - } - break; - - case "AssignmentExpression": - if ( - parent.right === node && - isLogicalAssignmentOperator(parent.operator) - ) { - state.makeLogicalRight(); - } - break; - - case "ConditionalExpression": - case "IfStatement": - - /* - * Fork if this node is at `consequent`/`alternate`. - * `popForkContext()` exists at `IfStatement:exit` and - * `ConditionalExpression:exit`. - */ - if (parent.consequent === node) { - state.makeIfConsequent(); - } else if (parent.alternate === node) { - state.makeIfAlternate(); - } - break; - - case "SwitchCase": - if (parent.consequent[0] === node) { - state.makeSwitchCaseBody(false, !parent.test); - } - break; - - case "TryStatement": - if (parent.handler === node) { - state.makeCatchBlock(); - } else if (parent.finalizer === node) { - state.makeFinallyBlock(); - } - break; - - case "WhileStatement": - if (parent.test === node) { - state.makeWhileTest(getBooleanValueIfSimpleConstant(node)); - } else { - assert(parent.body === node); - state.makeWhileBody(); - } - break; - - case "DoWhileStatement": - if (parent.body === node) { - state.makeDoWhileBody(); - } else { - assert(parent.test === node); - state.makeDoWhileTest(getBooleanValueIfSimpleConstant(node)); - } - break; - - case "ForStatement": - if (parent.test === node) { - state.makeForTest(getBooleanValueIfSimpleConstant(node)); - } else if (parent.update === node) { - state.makeForUpdate(); - } else if (parent.body === node) { - state.makeForBody(); - } - break; - - case "ForInStatement": - case "ForOfStatement": - if (parent.left === node) { - state.makeForInOfLeft(); - } else if (parent.right === node) { - state.makeForInOfRight(); - } else { - assert(parent.body === node); - state.makeForInOfBody(); - } - break; - - case "AssignmentPattern": - - /* - * Fork if this node is at `right`. - * `left` is executed always, so it uses the current path. - * `popForkContext()` exists at `AssignmentPattern:exit`. - */ - if (parent.right === node) { - state.pushForkContext(); - state.forkBypassPath(); - state.forkPath(); - } - break; - - default: - break; - } -} - -/** - * Updates the code path due to the type of a given node in entering. - * @param {CodePathAnalyzer} analyzer The instance. - * @param {ASTNode} node The current AST node. - * @returns {void} - */ -function processCodePathToEnter(analyzer, node) { - let codePath = analyzer.codePath; - let state = codePath && CodePath.getState(codePath); - const parent = node.parent; - - /** - * Creates a new code path and trigger the onCodePathStart event - * based on the currently selected node. - * @param {string} origin The reason the code path was started. - * @returns {void} - */ - function startCodePath(origin) { - if (codePath) { - - // Emits onCodePathSegmentStart events if updated. - forwardCurrentToHead(analyzer, node); - debug.dumpState(node, state, false); - } - - // Create the code path of this scope. - codePath = analyzer.codePath = new CodePath({ - id: analyzer.idGenerator.next(), - origin, - upper: codePath, - onLooped: analyzer.onLooped - }); - state = CodePath.getState(codePath); - - // Emits onCodePathStart events. - debug.dump(`onCodePathStart ${codePath.id}`); - analyzer.emitter.emit("onCodePathStart", codePath, node); - } - - /* - * Special case: The right side of class field initializer is considered - * to be its own function, so we need to start a new code path in this - * case. - */ - if (isPropertyDefinitionValue(node)) { - startCodePath("class-field-initializer"); - - /* - * Intentional fall through because `node` needs to also be - * processed by the code below. For example, if we have: - * - * class Foo { - * a = () => {} - * } - * - * In this case, we also need start a second code path. - */ - - } - - switch (node.type) { - case "Program": - startCodePath("program"); - break; - - case "FunctionDeclaration": - case "FunctionExpression": - case "ArrowFunctionExpression": - startCodePath("function"); - break; - - case "StaticBlock": - startCodePath("class-static-block"); - break; - - case "ChainExpression": - state.pushChainContext(); - break; - case "CallExpression": - if (node.optional === true) { - state.makeOptionalNode(); - } - break; - case "MemberExpression": - if (node.optional === true) { - state.makeOptionalNode(); - } - break; - - case "LogicalExpression": - if (isHandledLogicalOperator(node.operator)) { - state.pushChoiceContext( - node.operator, - isForkingByTrueOrFalse(node) - ); - } - break; - - case "AssignmentExpression": - if (isLogicalAssignmentOperator(node.operator)) { - state.pushChoiceContext( - node.operator.slice(0, -1), // removes `=` from the end - isForkingByTrueOrFalse(node) - ); - } - break; - - case "ConditionalExpression": - case "IfStatement": - state.pushChoiceContext("test", false); - break; - - case "SwitchStatement": - state.pushSwitchContext( - node.cases.some(isCaseNode), - getLabel(node) - ); - break; - - case "TryStatement": - state.pushTryContext(Boolean(node.finalizer)); - break; - - case "SwitchCase": - - /* - * Fork if this node is after the 2st node in `cases`. - * It's similar to `else` blocks. - * The next `test` node is processed in this path. - */ - if (parent.discriminant !== node && parent.cases[0] !== node) { - state.forkPath(); - } - break; - - case "WhileStatement": - case "DoWhileStatement": - case "ForStatement": - case "ForInStatement": - case "ForOfStatement": - state.pushLoopContext(node.type, getLabel(node)); - break; - - case "LabeledStatement": - if (!breakableTypePattern.test(node.body.type)) { - state.pushBreakContext(false, node.label.name); - } - break; - - default: - break; - } - - // Emits onCodePathSegmentStart events if updated. - forwardCurrentToHead(analyzer, node); - debug.dumpState(node, state, false); -} - -/** - * Updates the code path due to the type of a given node in leaving. - * @param {CodePathAnalyzer} analyzer The instance. - * @param {ASTNode} node The current AST node. - * @returns {void} - */ -function processCodePathToExit(analyzer, node) { - - const codePath = analyzer.codePath; - const state = CodePath.getState(codePath); - let dontForward = false; - - switch (node.type) { - case "ChainExpression": - state.popChainContext(); - break; - - case "IfStatement": - case "ConditionalExpression": - state.popChoiceContext(); - break; - - case "LogicalExpression": - if (isHandledLogicalOperator(node.operator)) { - state.popChoiceContext(); - } - break; - - case "AssignmentExpression": - if (isLogicalAssignmentOperator(node.operator)) { - state.popChoiceContext(); - } - break; - - case "SwitchStatement": - state.popSwitchContext(); - break; - - case "SwitchCase": - - /* - * This is the same as the process at the 1st `consequent` node in - * `preprocess` function. - * Must do if this `consequent` is empty. - */ - if (node.consequent.length === 0) { - state.makeSwitchCaseBody(true, !node.test); - } - if (state.forkContext.reachable) { - dontForward = true; - } - break; - - case "TryStatement": - state.popTryContext(); - break; - - case "BreakStatement": - forwardCurrentToHead(analyzer, node); - state.makeBreak(node.label && node.label.name); - dontForward = true; - break; - - case "ContinueStatement": - forwardCurrentToHead(analyzer, node); - state.makeContinue(node.label && node.label.name); - dontForward = true; - break; - - case "ReturnStatement": - forwardCurrentToHead(analyzer, node); - state.makeReturn(); - dontForward = true; - break; - - case "ThrowStatement": - forwardCurrentToHead(analyzer, node); - state.makeThrow(); - dontForward = true; - break; - - case "Identifier": - if (isIdentifierReference(node)) { - state.makeFirstThrowablePathInTryBlock(); - dontForward = true; - } - break; - - case "CallExpression": - case "ImportExpression": - case "MemberExpression": - case "NewExpression": - case "YieldExpression": - state.makeFirstThrowablePathInTryBlock(); - break; - - case "WhileStatement": - case "DoWhileStatement": - case "ForStatement": - case "ForInStatement": - case "ForOfStatement": - state.popLoopContext(); - break; - - case "AssignmentPattern": - state.popForkContext(); - break; - - case "LabeledStatement": - if (!breakableTypePattern.test(node.body.type)) { - state.popBreakContext(); - } - break; - - default: - break; - } - - // Emits onCodePathSegmentStart events if updated. - if (!dontForward) { - forwardCurrentToHead(analyzer, node); - } - debug.dumpState(node, state, true); -} - -/** - * Updates the code path to finalize the current code path. - * @param {CodePathAnalyzer} analyzer The instance. - * @param {ASTNode} node The current AST node. - * @returns {void} - */ -function postprocess(analyzer, node) { - - /** - * Ends the code path for the current node. - * @returns {void} - */ - function endCodePath() { - let codePath = analyzer.codePath; - - // Mark the current path as the final node. - CodePath.getState(codePath).makeFinal(); - - // Emits onCodePathSegmentEnd event of the current segments. - leaveFromCurrentSegment(analyzer, node); - - // Emits onCodePathEnd event of this code path. - debug.dump(`onCodePathEnd ${codePath.id}`); - analyzer.emitter.emit("onCodePathEnd", codePath, node); - debug.dumpDot(codePath); - - codePath = analyzer.codePath = analyzer.codePath.upper; - if (codePath) { - debug.dumpState(node, CodePath.getState(codePath), true); - } - - } - - switch (node.type) { - case "Program": - case "FunctionDeclaration": - case "FunctionExpression": - case "ArrowFunctionExpression": - case "StaticBlock": { - endCodePath(); - break; - } - - // The `arguments.length >= 1` case is in `preprocess` function. - case "CallExpression": - if (node.optional === true && node.arguments.length === 0) { - CodePath.getState(analyzer.codePath).makeOptionalRight(); - } - break; - - default: - break; - } - - /* - * Special case: The right side of class field initializer is considered - * to be its own function, so we need to end a code path in this - * case. - * - * We need to check after the other checks in order to close the - * code paths in the correct order for code like this: - * - * - * class Foo { - * a = () => {} - * } - * - * In this case, The ArrowFunctionExpression code path is closed first - * and then we need to close the code path for the PropertyDefinition - * value. - */ - if (isPropertyDefinitionValue(node)) { - endCodePath(); - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * The class to analyze code paths. - * This class implements the EventGenerator interface. - */ -class CodePathAnalyzer { - - /** - * @param {EventGenerator} eventGenerator An event generator to wrap. - */ - constructor(eventGenerator) { - this.original = eventGenerator; - this.emitter = eventGenerator.emitter; - this.codePath = null; - this.idGenerator = new IdGenerator("s"); - this.currentNode = null; - this.onLooped = this.onLooped.bind(this); - } - - /** - * Does the process to enter a given AST node. - * This updates state of analysis and calls `enterNode` of the wrapped. - * @param {ASTNode} node A node which is entering. - * @returns {void} - */ - enterNode(node) { - this.currentNode = node; - - // Updates the code path due to node's position in its parent node. - if (node.parent) { - preprocess(this, node); - } - - /* - * Updates the code path. - * And emits onCodePathStart/onCodePathSegmentStart events. - */ - processCodePathToEnter(this, node); - - // Emits node events. - this.original.enterNode(node); - - this.currentNode = null; - } - - /** - * Does the process to leave a given AST node. - * This updates state of analysis and calls `leaveNode` of the wrapped. - * @param {ASTNode} node A node which is leaving. - * @returns {void} - */ - leaveNode(node) { - this.currentNode = node; - - /* - * Updates the code path. - * And emits onCodePathStart/onCodePathSegmentStart events. - */ - processCodePathToExit(this, node); - - // Emits node events. - this.original.leaveNode(node); - - // Emits the last onCodePathStart/onCodePathSegmentStart events. - postprocess(this, node); - - this.currentNode = null; - } - - /** - * This is called on a code path looped. - * Then this raises a looped event. - * @param {CodePathSegment} fromSegment A segment of prev. - * @param {CodePathSegment} toSegment A segment of next. - * @returns {void} - */ - onLooped(fromSegment, toSegment) { - if (fromSegment.reachable && toSegment.reachable) { - debug.dump(`onCodePathSegmentLoop ${fromSegment.id} -> ${toSegment.id}`); - this.emitter.emit( - "onCodePathSegmentLoop", - fromSegment, - toSegment, - this.currentNode - ); - } - } -} - -module.exports = CodePathAnalyzer; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js b/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js deleted file mode 100644 index fd2726a99..000000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js +++ /dev/null @@ -1,235 +0,0 @@ -/** - * @fileoverview A class of the code path segment. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const debug = require("./debug-helpers"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a given segment is reachable. - * @param {CodePathSegment} segment A segment to check. - * @returns {boolean} `true` if the segment is reachable. - */ -function isReachable(segment) { - return segment.reachable; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * A code path segment. - */ -class CodePathSegment { - - /** - * @param {string} id An identifier. - * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. - * This array includes unreachable segments. - * @param {boolean} reachable A flag which shows this is reachable. - */ - constructor(id, allPrevSegments, reachable) { - - /** - * The identifier of this code path. - * Rules use it to store additional information of each rule. - * @type {string} - */ - this.id = id; - - /** - * An array of the next segments. - * @type {CodePathSegment[]} - */ - this.nextSegments = []; - - /** - * An array of the previous segments. - * @type {CodePathSegment[]} - */ - this.prevSegments = allPrevSegments.filter(isReachable); - - /** - * An array of the next segments. - * This array includes unreachable segments. - * @type {CodePathSegment[]} - */ - this.allNextSegments = []; - - /** - * An array of the previous segments. - * This array includes unreachable segments. - * @type {CodePathSegment[]} - */ - this.allPrevSegments = allPrevSegments; - - /** - * A flag which shows this is reachable. - * @type {boolean} - */ - this.reachable = reachable; - - // Internal data. - Object.defineProperty(this, "internal", { - value: { - used: false, - loopedPrevSegments: [] - } - }); - - /* c8 ignore start */ - if (debug.enabled) { - this.internal.nodes = []; - }/* c8 ignore stop */ - } - - /** - * Checks a given previous segment is coming from the end of a loop. - * @param {CodePathSegment} segment A previous segment to check. - * @returns {boolean} `true` if the segment is coming from the end of a loop. - */ - isLoopedPrevSegment(segment) { - return this.internal.loopedPrevSegments.includes(segment); - } - - /** - * Creates the root segment. - * @param {string} id An identifier. - * @returns {CodePathSegment} The created segment. - */ - static newRoot(id) { - return new CodePathSegment(id, [], true); - } - - /** - * Creates a segment that follows given segments. - * @param {string} id An identifier. - * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. - * @returns {CodePathSegment} The created segment. - */ - static newNext(id, allPrevSegments) { - return new CodePathSegment( - id, - CodePathSegment.flattenUnusedSegments(allPrevSegments), - allPrevSegments.some(isReachable) - ); - } - - /** - * Creates an unreachable segment that follows given segments. - * @param {string} id An identifier. - * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. - * @returns {CodePathSegment} The created segment. - */ - static newUnreachable(id, allPrevSegments) { - const segment = new CodePathSegment(id, CodePathSegment.flattenUnusedSegments(allPrevSegments), false); - - /* - * In `if (a) return a; foo();` case, the unreachable segment preceded by - * the return statement is not used but must not be remove. - */ - CodePathSegment.markUsed(segment); - - return segment; - } - - /** - * Creates a segment that follows given segments. - * This factory method does not connect with `allPrevSegments`. - * But this inherits `reachable` flag. - * @param {string} id An identifier. - * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. - * @returns {CodePathSegment} The created segment. - */ - static newDisconnected(id, allPrevSegments) { - return new CodePathSegment(id, [], allPrevSegments.some(isReachable)); - } - - /** - * Makes a given segment being used. - * - * And this function registers the segment into the previous segments as a next. - * @param {CodePathSegment} segment A segment to mark. - * @returns {void} - */ - static markUsed(segment) { - if (segment.internal.used) { - return; - } - segment.internal.used = true; - - let i; - - if (segment.reachable) { - for (i = 0; i < segment.allPrevSegments.length; ++i) { - const prevSegment = segment.allPrevSegments[i]; - - prevSegment.allNextSegments.push(segment); - prevSegment.nextSegments.push(segment); - } - } else { - for (i = 0; i < segment.allPrevSegments.length; ++i) { - segment.allPrevSegments[i].allNextSegments.push(segment); - } - } - } - - /** - * Marks a previous segment as looped. - * @param {CodePathSegment} segment A segment. - * @param {CodePathSegment} prevSegment A previous segment to mark. - * @returns {void} - */ - static markPrevSegmentAsLooped(segment, prevSegment) { - segment.internal.loopedPrevSegments.push(prevSegment); - } - - /** - * Replaces unused segments with the previous segments of each unused segment. - * @param {CodePathSegment[]} segments An array of segments to replace. - * @returns {CodePathSegment[]} The replaced array. - */ - static flattenUnusedSegments(segments) { - const done = Object.create(null); - const retv = []; - - for (let i = 0; i < segments.length; ++i) { - const segment = segments[i]; - - // Ignores duplicated. - if (done[segment.id]) { - continue; - } - - // Use previous segments if unused. - if (!segment.internal.used) { - for (let j = 0; j < segment.allPrevSegments.length; ++j) { - const prevSegment = segment.allPrevSegments[j]; - - if (!done[prevSegment.id]) { - done[prevSegment.id] = true; - retv.push(prevSegment); - } - } - } else { - done[segment.id] = true; - retv.push(segment); - } - } - - return retv; - } -} - -module.exports = CodePathSegment; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js b/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js deleted file mode 100644 index d187297d3..000000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js +++ /dev/null @@ -1,1483 +0,0 @@ -/** - * @fileoverview A class to manage state of generating a code path. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const CodePathSegment = require("./code-path-segment"), - ForkContext = require("./fork-context"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Adds given segments into the `dest` array. - * If the `others` array does not includes the given segments, adds to the `all` - * array as well. - * - * This adds only reachable and used segments. - * @param {CodePathSegment[]} dest A destination array (`returnedSegments` or `thrownSegments`). - * @param {CodePathSegment[]} others Another destination array (`returnedSegments` or `thrownSegments`). - * @param {CodePathSegment[]} all The unified destination array (`finalSegments`). - * @param {CodePathSegment[]} segments Segments to add. - * @returns {void} - */ -function addToReturnedOrThrown(dest, others, all, segments) { - for (let i = 0; i < segments.length; ++i) { - const segment = segments[i]; - - dest.push(segment); - if (!others.includes(segment)) { - all.push(segment); - } - } -} - -/** - * Gets a loop-context for a `continue` statement. - * @param {CodePathState} state A state to get. - * @param {string} label The label of a `continue` statement. - * @returns {LoopContext} A loop-context for a `continue` statement. - */ -function getContinueContext(state, label) { - if (!label) { - return state.loopContext; - } - - let context = state.loopContext; - - while (context) { - if (context.label === label) { - return context; - } - context = context.upper; - } - - /* c8 ignore next */ - return null; -} - -/** - * Gets a context for a `break` statement. - * @param {CodePathState} state A state to get. - * @param {string} label The label of a `break` statement. - * @returns {LoopContext|SwitchContext} A context for a `break` statement. - */ -function getBreakContext(state, label) { - let context = state.breakContext; - - while (context) { - if (label ? context.label === label : context.breakable) { - return context; - } - context = context.upper; - } - - /* c8 ignore next */ - return null; -} - -/** - * Gets a context for a `return` statement. - * @param {CodePathState} state A state to get. - * @returns {TryContext|CodePathState} A context for a `return` statement. - */ -function getReturnContext(state) { - let context = state.tryContext; - - while (context) { - if (context.hasFinalizer && context.position !== "finally") { - return context; - } - context = context.upper; - } - - return state; -} - -/** - * Gets a context for a `throw` statement. - * @param {CodePathState} state A state to get. - * @returns {TryContext|CodePathState} A context for a `throw` statement. - */ -function getThrowContext(state) { - let context = state.tryContext; - - while (context) { - if (context.position === "try" || - (context.hasFinalizer && context.position === "catch") - ) { - return context; - } - context = context.upper; - } - - return state; -} - -/** - * Removes a given element from a given array. - * @param {any[]} xs An array to remove the specific element. - * @param {any} x An element to be removed. - * @returns {void} - */ -function remove(xs, x) { - xs.splice(xs.indexOf(x), 1); -} - -/** - * Disconnect given segments. - * - * This is used in a process for switch statements. - * If there is the "default" chunk before other cases, the order is different - * between node's and running's. - * @param {CodePathSegment[]} prevSegments Forward segments to disconnect. - * @param {CodePathSegment[]} nextSegments Backward segments to disconnect. - * @returns {void} - */ -function removeConnection(prevSegments, nextSegments) { - for (let i = 0; i < prevSegments.length; ++i) { - const prevSegment = prevSegments[i]; - const nextSegment = nextSegments[i]; - - remove(prevSegment.nextSegments, nextSegment); - remove(prevSegment.allNextSegments, nextSegment); - remove(nextSegment.prevSegments, prevSegment); - remove(nextSegment.allPrevSegments, prevSegment); - } -} - -/** - * Creates looping path. - * @param {CodePathState} state The instance. - * @param {CodePathSegment[]} unflattenedFromSegments Segments which are source. - * @param {CodePathSegment[]} unflattenedToSegments Segments which are destination. - * @returns {void} - */ -function makeLooped(state, unflattenedFromSegments, unflattenedToSegments) { - const fromSegments = CodePathSegment.flattenUnusedSegments(unflattenedFromSegments); - const toSegments = CodePathSegment.flattenUnusedSegments(unflattenedToSegments); - - const end = Math.min(fromSegments.length, toSegments.length); - - for (let i = 0; i < end; ++i) { - const fromSegment = fromSegments[i]; - const toSegment = toSegments[i]; - - if (toSegment.reachable) { - fromSegment.nextSegments.push(toSegment); - } - if (fromSegment.reachable) { - toSegment.prevSegments.push(fromSegment); - } - fromSegment.allNextSegments.push(toSegment); - toSegment.allPrevSegments.push(fromSegment); - - if (toSegment.allPrevSegments.length >= 2) { - CodePathSegment.markPrevSegmentAsLooped(toSegment, fromSegment); - } - - state.notifyLooped(fromSegment, toSegment); - } -} - -/** - * Finalizes segments of `test` chunk of a ForStatement. - * - * - Adds `false` paths to paths which are leaving from the loop. - * - Sets `true` paths to paths which go to the body. - * @param {LoopContext} context A loop context to modify. - * @param {ChoiceContext} choiceContext A choice context of this loop. - * @param {CodePathSegment[]} head The current head paths. - * @returns {void} - */ -function finalizeTestSegmentsOfFor(context, choiceContext, head) { - if (!choiceContext.processed) { - choiceContext.trueForkContext.add(head); - choiceContext.falseForkContext.add(head); - choiceContext.qqForkContext.add(head); - } - - if (context.test !== true) { - context.brokenForkContext.addAll(choiceContext.falseForkContext); - } - context.endOfTestSegments = choiceContext.trueForkContext.makeNext(0, -1); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * A class which manages state to analyze code paths. - */ -class CodePathState { - - /** - * @param {IdGenerator} idGenerator An id generator to generate id for code - * path segments. - * @param {Function} onLooped A callback function to notify looping. - */ - constructor(idGenerator, onLooped) { - this.idGenerator = idGenerator; - this.notifyLooped = onLooped; - this.forkContext = ForkContext.newRoot(idGenerator); - this.choiceContext = null; - this.switchContext = null; - this.tryContext = null; - this.loopContext = null; - this.breakContext = null; - this.chainContext = null; - - this.currentSegments = []; - this.initialSegment = this.forkContext.head[0]; - - // returnedSegments and thrownSegments push elements into finalSegments also. - const final = this.finalSegments = []; - const returned = this.returnedForkContext = []; - const thrown = this.thrownForkContext = []; - - returned.add = addToReturnedOrThrown.bind(null, returned, thrown, final); - thrown.add = addToReturnedOrThrown.bind(null, thrown, returned, final); - } - - /** - * The head segments. - * @type {CodePathSegment[]} - */ - get headSegments() { - return this.forkContext.head; - } - - /** - * The parent forking context. - * This is used for the root of new forks. - * @type {ForkContext} - */ - get parentForkContext() { - const current = this.forkContext; - - return current && current.upper; - } - - /** - * Creates and stacks new forking context. - * @param {boolean} forkLeavingPath A flag which shows being in a - * "finally" block. - * @returns {ForkContext} The created context. - */ - pushForkContext(forkLeavingPath) { - this.forkContext = ForkContext.newEmpty( - this.forkContext, - forkLeavingPath - ); - - return this.forkContext; - } - - /** - * Pops and merges the last forking context. - * @returns {ForkContext} The last context. - */ - popForkContext() { - const lastContext = this.forkContext; - - this.forkContext = lastContext.upper; - this.forkContext.replaceHead(lastContext.makeNext(0, -1)); - - return lastContext; - } - - /** - * Creates a new path. - * @returns {void} - */ - forkPath() { - this.forkContext.add(this.parentForkContext.makeNext(-1, -1)); - } - - /** - * Creates a bypass path. - * This is used for such as IfStatement which does not have "else" chunk. - * @returns {void} - */ - forkBypassPath() { - this.forkContext.add(this.parentForkContext.head); - } - - //-------------------------------------------------------------------------- - // ConditionalExpression, LogicalExpression, IfStatement - //-------------------------------------------------------------------------- - - /** - * Creates a context for ConditionalExpression, LogicalExpression, AssignmentExpression (logical assignments only), - * IfStatement, WhileStatement, DoWhileStatement, or ForStatement. - * - * LogicalExpressions have cases that it goes different paths between the - * `true` case and the `false` case. - * - * For Example: - * - * if (a || b) { - * foo(); - * } else { - * bar(); - * } - * - * In this case, `b` is evaluated always in the code path of the `else` - * block, but it's not so in the code path of the `if` block. - * So there are 3 paths. - * - * a -> foo(); - * a -> b -> foo(); - * a -> b -> bar(); - * @param {string} kind A kind string. - * If the new context is LogicalExpression's or AssignmentExpression's, this is `"&&"` or `"||"` or `"??"`. - * If it's IfStatement's or ConditionalExpression's, this is `"test"`. - * Otherwise, this is `"loop"`. - * @param {boolean} isForkingAsResult A flag that shows that goes different - * paths between `true` and `false`. - * @returns {void} - */ - pushChoiceContext(kind, isForkingAsResult) { - this.choiceContext = { - upper: this.choiceContext, - kind, - isForkingAsResult, - trueForkContext: ForkContext.newEmpty(this.forkContext), - falseForkContext: ForkContext.newEmpty(this.forkContext), - qqForkContext: ForkContext.newEmpty(this.forkContext), - processed: false - }; - } - - /** - * Pops the last choice context and finalizes it. - * @throws {Error} (Unreachable.) - * @returns {ChoiceContext} The popped context. - */ - popChoiceContext() { - const context = this.choiceContext; - - this.choiceContext = context.upper; - - const forkContext = this.forkContext; - const headSegments = forkContext.head; - - switch (context.kind) { - case "&&": - case "||": - case "??": - - /* - * If any result were not transferred from child contexts, - * this sets the head segments to both cases. - * The head segments are the path of the right-hand operand. - */ - if (!context.processed) { - context.trueForkContext.add(headSegments); - context.falseForkContext.add(headSegments); - context.qqForkContext.add(headSegments); - } - - /* - * Transfers results to upper context if this context is in - * test chunk. - */ - if (context.isForkingAsResult) { - const parentContext = this.choiceContext; - - parentContext.trueForkContext.addAll(context.trueForkContext); - parentContext.falseForkContext.addAll(context.falseForkContext); - parentContext.qqForkContext.addAll(context.qqForkContext); - parentContext.processed = true; - - return context; - } - - break; - - case "test": - if (!context.processed) { - - /* - * The head segments are the path of the `if` block here. - * Updates the `true` path with the end of the `if` block. - */ - context.trueForkContext.clear(); - context.trueForkContext.add(headSegments); - } else { - - /* - * The head segments are the path of the `else` block here. - * Updates the `false` path with the end of the `else` - * block. - */ - context.falseForkContext.clear(); - context.falseForkContext.add(headSegments); - } - - break; - - case "loop": - - /* - * Loops are addressed in popLoopContext(). - * This is called from popLoopContext(). - */ - return context; - - /* c8 ignore next */ - default: - throw new Error("unreachable"); - } - - // Merges all paths. - const prevForkContext = context.trueForkContext; - - prevForkContext.addAll(context.falseForkContext); - forkContext.replaceHead(prevForkContext.makeNext(0, -1)); - - return context; - } - - /** - * Makes a code path segment of the right-hand operand of a logical - * expression. - * @throws {Error} (Unreachable.) - * @returns {void} - */ - makeLogicalRight() { - const context = this.choiceContext; - const forkContext = this.forkContext; - - if (context.processed) { - - /* - * This got segments already from the child choice context. - * Creates the next path from own true/false fork context. - */ - let prevForkContext; - - switch (context.kind) { - case "&&": // if true then go to the right-hand side. - prevForkContext = context.trueForkContext; - break; - case "||": // if false then go to the right-hand side. - prevForkContext = context.falseForkContext; - break; - case "??": // Both true/false can short-circuit, so needs the third path to go to the right-hand side. That's qqForkContext. - prevForkContext = context.qqForkContext; - break; - default: - throw new Error("unreachable"); - } - - forkContext.replaceHead(prevForkContext.makeNext(0, -1)); - prevForkContext.clear(); - context.processed = false; - } else { - - /* - * This did not get segments from the child choice context. - * So addresses the head segments. - * The head segments are the path of the left-hand operand. - */ - switch (context.kind) { - case "&&": // the false path can short-circuit. - context.falseForkContext.add(forkContext.head); - break; - case "||": // the true path can short-circuit. - context.trueForkContext.add(forkContext.head); - break; - case "??": // both can short-circuit. - context.trueForkContext.add(forkContext.head); - context.falseForkContext.add(forkContext.head); - break; - default: - throw new Error("unreachable"); - } - - forkContext.replaceHead(forkContext.makeNext(-1, -1)); - } - } - - /** - * Makes a code path segment of the `if` block. - * @returns {void} - */ - makeIfConsequent() { - const context = this.choiceContext; - const forkContext = this.forkContext; - - /* - * If any result were not transferred from child contexts, - * this sets the head segments to both cases. - * The head segments are the path of the test expression. - */ - if (!context.processed) { - context.trueForkContext.add(forkContext.head); - context.falseForkContext.add(forkContext.head); - context.qqForkContext.add(forkContext.head); - } - - context.processed = false; - - // Creates new path from the `true` case. - forkContext.replaceHead( - context.trueForkContext.makeNext(0, -1) - ); - } - - /** - * Makes a code path segment of the `else` block. - * @returns {void} - */ - makeIfAlternate() { - const context = this.choiceContext; - const forkContext = this.forkContext; - - /* - * The head segments are the path of the `if` block. - * Updates the `true` path with the end of the `if` block. - */ - context.trueForkContext.clear(); - context.trueForkContext.add(forkContext.head); - context.processed = true; - - // Creates new path from the `false` case. - forkContext.replaceHead( - context.falseForkContext.makeNext(0, -1) - ); - } - - //-------------------------------------------------------------------------- - // ChainExpression - //-------------------------------------------------------------------------- - - /** - * Push a new `ChainExpression` context to the stack. - * This method is called on entering to each `ChainExpression` node. - * This context is used to count forking in the optional chain then merge them on the exiting from the `ChainExpression` node. - * @returns {void} - */ - pushChainContext() { - this.chainContext = { - upper: this.chainContext, - countChoiceContexts: 0 - }; - } - - /** - * Pop a `ChainExpression` context from the stack. - * This method is called on exiting from each `ChainExpression` node. - * This merges all forks of the last optional chaining. - * @returns {void} - */ - popChainContext() { - const context = this.chainContext; - - this.chainContext = context.upper; - - // pop all choice contexts of this. - for (let i = context.countChoiceContexts; i > 0; --i) { - this.popChoiceContext(); - } - } - - /** - * Create a choice context for optional access. - * This method is called on entering to each `(Call|Member)Expression[optional=true]` node. - * This creates a choice context as similar to `LogicalExpression[operator="??"]` node. - * @returns {void} - */ - makeOptionalNode() { - if (this.chainContext) { - this.chainContext.countChoiceContexts += 1; - this.pushChoiceContext("??", false); - } - } - - /** - * Create a fork. - * This method is called on entering to the `arguments|property` property of each `(Call|Member)Expression` node. - * @returns {void} - */ - makeOptionalRight() { - if (this.chainContext) { - this.makeLogicalRight(); - } - } - - //-------------------------------------------------------------------------- - // SwitchStatement - //-------------------------------------------------------------------------- - - /** - * Creates a context object of SwitchStatement and stacks it. - * @param {boolean} hasCase `true` if the switch statement has one or more - * case parts. - * @param {string|null} label The label text. - * @returns {void} - */ - pushSwitchContext(hasCase, label) { - this.switchContext = { - upper: this.switchContext, - hasCase, - defaultSegments: null, - defaultBodySegments: null, - foundDefault: false, - lastIsDefault: false, - countForks: 0 - }; - - this.pushBreakContext(true, label); - } - - /** - * Pops the last context of SwitchStatement and finalizes it. - * - * - Disposes all forking stack for `case` and `default`. - * - Creates the next code path segment from `context.brokenForkContext`. - * - If the last `SwitchCase` node is not a `default` part, creates a path - * to the `default` body. - * @returns {void} - */ - popSwitchContext() { - const context = this.switchContext; - - this.switchContext = context.upper; - - const forkContext = this.forkContext; - const brokenForkContext = this.popBreakContext().brokenForkContext; - - if (context.countForks === 0) { - - /* - * When there is only one `default` chunk and there is one or more - * `break` statements, even if forks are nothing, it needs to merge - * those. - */ - if (!brokenForkContext.empty) { - brokenForkContext.add(forkContext.makeNext(-1, -1)); - forkContext.replaceHead(brokenForkContext.makeNext(0, -1)); - } - - return; - } - - const lastSegments = forkContext.head; - - this.forkBypassPath(); - const lastCaseSegments = forkContext.head; - - /* - * `brokenForkContext` is used to make the next segment. - * It must add the last segment into `brokenForkContext`. - */ - brokenForkContext.add(lastSegments); - - /* - * A path which is failed in all case test should be connected to path - * of `default` chunk. - */ - if (!context.lastIsDefault) { - if (context.defaultBodySegments) { - - /* - * Remove a link from `default` label to its chunk. - * It's false route. - */ - removeConnection(context.defaultSegments, context.defaultBodySegments); - makeLooped(this, lastCaseSegments, context.defaultBodySegments); - } else { - - /* - * It handles the last case body as broken if `default` chunk - * does not exist. - */ - brokenForkContext.add(lastCaseSegments); - } - } - - // Pops the segment context stack until the entry segment. - for (let i = 0; i < context.countForks; ++i) { - this.forkContext = this.forkContext.upper; - } - - /* - * Creates a path from all brokenForkContext paths. - * This is a path after switch statement. - */ - this.forkContext.replaceHead(brokenForkContext.makeNext(0, -1)); - } - - /** - * Makes a code path segment for a `SwitchCase` node. - * @param {boolean} isEmpty `true` if the body is empty. - * @param {boolean} isDefault `true` if the body is the default case. - * @returns {void} - */ - makeSwitchCaseBody(isEmpty, isDefault) { - const context = this.switchContext; - - if (!context.hasCase) { - return; - } - - /* - * Merge forks. - * The parent fork context has two segments. - * Those are from the current case and the body of the previous case. - */ - const parentForkContext = this.forkContext; - const forkContext = this.pushForkContext(); - - forkContext.add(parentForkContext.makeNext(0, -1)); - - /* - * Save `default` chunk info. - * If the `default` label is not at the last, we must make a path from - * the last `case` to the `default` chunk. - */ - if (isDefault) { - context.defaultSegments = parentForkContext.head; - if (isEmpty) { - context.foundDefault = true; - } else { - context.defaultBodySegments = forkContext.head; - } - } else { - if (!isEmpty && context.foundDefault) { - context.foundDefault = false; - context.defaultBodySegments = forkContext.head; - } - } - - context.lastIsDefault = isDefault; - context.countForks += 1; - } - - //-------------------------------------------------------------------------- - // TryStatement - //-------------------------------------------------------------------------- - - /** - * Creates a context object of TryStatement and stacks it. - * @param {boolean} hasFinalizer `true` if the try statement has a - * `finally` block. - * @returns {void} - */ - pushTryContext(hasFinalizer) { - this.tryContext = { - upper: this.tryContext, - position: "try", - hasFinalizer, - - returnedForkContext: hasFinalizer - ? ForkContext.newEmpty(this.forkContext) - : null, - - thrownForkContext: ForkContext.newEmpty(this.forkContext), - lastOfTryIsReachable: false, - lastOfCatchIsReachable: false - }; - } - - /** - * Pops the last context of TryStatement and finalizes it. - * @returns {void} - */ - popTryContext() { - const context = this.tryContext; - - this.tryContext = context.upper; - - if (context.position === "catch") { - - // Merges two paths from the `try` block and `catch` block merely. - this.popForkContext(); - return; - } - - /* - * The following process is executed only when there is the `finally` - * block. - */ - - const returned = context.returnedForkContext; - const thrown = context.thrownForkContext; - - if (returned.empty && thrown.empty) { - return; - } - - // Separate head to normal paths and leaving paths. - const headSegments = this.forkContext.head; - - this.forkContext = this.forkContext.upper; - const normalSegments = headSegments.slice(0, headSegments.length / 2 | 0); - const leavingSegments = headSegments.slice(headSegments.length / 2 | 0); - - // Forwards the leaving path to upper contexts. - if (!returned.empty) { - getReturnContext(this).returnedForkContext.add(leavingSegments); - } - if (!thrown.empty) { - getThrowContext(this).thrownForkContext.add(leavingSegments); - } - - // Sets the normal path as the next. - this.forkContext.replaceHead(normalSegments); - - /* - * If both paths of the `try` block and the `catch` block are - * unreachable, the next path becomes unreachable as well. - */ - if (!context.lastOfTryIsReachable && !context.lastOfCatchIsReachable) { - this.forkContext.makeUnreachable(); - } - } - - /** - * Makes a code path segment for a `catch` block. - * @returns {void} - */ - makeCatchBlock() { - const context = this.tryContext; - const forkContext = this.forkContext; - const thrown = context.thrownForkContext; - - // Update state. - context.position = "catch"; - context.thrownForkContext = ForkContext.newEmpty(forkContext); - context.lastOfTryIsReachable = forkContext.reachable; - - // Merge thrown paths. - thrown.add(forkContext.head); - const thrownSegments = thrown.makeNext(0, -1); - - // Fork to a bypass and the merged thrown path. - this.pushForkContext(); - this.forkBypassPath(); - this.forkContext.add(thrownSegments); - } - - /** - * Makes a code path segment for a `finally` block. - * - * In the `finally` block, parallel paths are created. The parallel paths - * are used as leaving-paths. The leaving-paths are paths from `return` - * statements and `throw` statements in a `try` block or a `catch` block. - * @returns {void} - */ - makeFinallyBlock() { - const context = this.tryContext; - let forkContext = this.forkContext; - const returned = context.returnedForkContext; - const thrown = context.thrownForkContext; - const headOfLeavingSegments = forkContext.head; - - // Update state. - if (context.position === "catch") { - - // Merges two paths from the `try` block and `catch` block. - this.popForkContext(); - forkContext = this.forkContext; - - context.lastOfCatchIsReachable = forkContext.reachable; - } else { - context.lastOfTryIsReachable = forkContext.reachable; - } - context.position = "finally"; - - if (returned.empty && thrown.empty) { - - // This path does not leave. - return; - } - - /* - * Create a parallel segment from merging returned and thrown. - * This segment will leave at the end of this finally block. - */ - const segments = forkContext.makeNext(-1, -1); - - for (let i = 0; i < forkContext.count; ++i) { - const prevSegsOfLeavingSegment = [headOfLeavingSegments[i]]; - - for (let j = 0; j < returned.segmentsList.length; ++j) { - prevSegsOfLeavingSegment.push(returned.segmentsList[j][i]); - } - for (let j = 0; j < thrown.segmentsList.length; ++j) { - prevSegsOfLeavingSegment.push(thrown.segmentsList[j][i]); - } - - segments.push( - CodePathSegment.newNext( - this.idGenerator.next(), - prevSegsOfLeavingSegment - ) - ); - } - - this.pushForkContext(true); - this.forkContext.add(segments); - } - - /** - * Makes a code path segment from the first throwable node to the `catch` - * block or the `finally` block. - * @returns {void} - */ - makeFirstThrowablePathInTryBlock() { - const forkContext = this.forkContext; - - if (!forkContext.reachable) { - return; - } - - const context = getThrowContext(this); - - if (context === this || - context.position !== "try" || - !context.thrownForkContext.empty - ) { - return; - } - - context.thrownForkContext.add(forkContext.head); - forkContext.replaceHead(forkContext.makeNext(-1, -1)); - } - - //-------------------------------------------------------------------------- - // Loop Statements - //-------------------------------------------------------------------------- - - /** - * Creates a context object of a loop statement and stacks it. - * @param {string} type The type of the node which was triggered. One of - * `WhileStatement`, `DoWhileStatement`, `ForStatement`, `ForInStatement`, - * and `ForStatement`. - * @param {string|null} label A label of the node which was triggered. - * @throws {Error} (Unreachable - unknown type.) - * @returns {void} - */ - pushLoopContext(type, label) { - const forkContext = this.forkContext; - const breakContext = this.pushBreakContext(true, label); - - switch (type) { - case "WhileStatement": - this.pushChoiceContext("loop", false); - this.loopContext = { - upper: this.loopContext, - type, - label, - test: void 0, - continueDestSegments: null, - brokenForkContext: breakContext.brokenForkContext - }; - break; - - case "DoWhileStatement": - this.pushChoiceContext("loop", false); - this.loopContext = { - upper: this.loopContext, - type, - label, - test: void 0, - entrySegments: null, - continueForkContext: ForkContext.newEmpty(forkContext), - brokenForkContext: breakContext.brokenForkContext - }; - break; - - case "ForStatement": - this.pushChoiceContext("loop", false); - this.loopContext = { - upper: this.loopContext, - type, - label, - test: void 0, - endOfInitSegments: null, - testSegments: null, - endOfTestSegments: null, - updateSegments: null, - endOfUpdateSegments: null, - continueDestSegments: null, - brokenForkContext: breakContext.brokenForkContext - }; - break; - - case "ForInStatement": - case "ForOfStatement": - this.loopContext = { - upper: this.loopContext, - type, - label, - prevSegments: null, - leftSegments: null, - endOfLeftSegments: null, - continueDestSegments: null, - brokenForkContext: breakContext.brokenForkContext - }; - break; - - /* c8 ignore next */ - default: - throw new Error(`unknown type: "${type}"`); - } - } - - /** - * Pops the last context of a loop statement and finalizes it. - * @throws {Error} (Unreachable - unknown type.) - * @returns {void} - */ - popLoopContext() { - const context = this.loopContext; - - this.loopContext = context.upper; - - const forkContext = this.forkContext; - const brokenForkContext = this.popBreakContext().brokenForkContext; - - // Creates a looped path. - switch (context.type) { - case "WhileStatement": - case "ForStatement": - this.popChoiceContext(); - makeLooped( - this, - forkContext.head, - context.continueDestSegments - ); - break; - - case "DoWhileStatement": { - const choiceContext = this.popChoiceContext(); - - if (!choiceContext.processed) { - choiceContext.trueForkContext.add(forkContext.head); - choiceContext.falseForkContext.add(forkContext.head); - } - if (context.test !== true) { - brokenForkContext.addAll(choiceContext.falseForkContext); - } - - // `true` paths go to looping. - const segmentsList = choiceContext.trueForkContext.segmentsList; - - for (let i = 0; i < segmentsList.length; ++i) { - makeLooped( - this, - segmentsList[i], - context.entrySegments - ); - } - break; - } - - case "ForInStatement": - case "ForOfStatement": - brokenForkContext.add(forkContext.head); - makeLooped( - this, - forkContext.head, - context.leftSegments - ); - break; - - /* c8 ignore next */ - default: - throw new Error("unreachable"); - } - - // Go next. - if (brokenForkContext.empty) { - forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); - } else { - forkContext.replaceHead(brokenForkContext.makeNext(0, -1)); - } - } - - /** - * Makes a code path segment for the test part of a WhileStatement. - * @param {boolean|undefined} test The test value (only when constant). - * @returns {void} - */ - makeWhileTest(test) { - const context = this.loopContext; - const forkContext = this.forkContext; - const testSegments = forkContext.makeNext(0, -1); - - // Update state. - context.test = test; - context.continueDestSegments = testSegments; - forkContext.replaceHead(testSegments); - } - - /** - * Makes a code path segment for the body part of a WhileStatement. - * @returns {void} - */ - makeWhileBody() { - const context = this.loopContext; - const choiceContext = this.choiceContext; - const forkContext = this.forkContext; - - if (!choiceContext.processed) { - choiceContext.trueForkContext.add(forkContext.head); - choiceContext.falseForkContext.add(forkContext.head); - } - - // Update state. - if (context.test !== true) { - context.brokenForkContext.addAll(choiceContext.falseForkContext); - } - forkContext.replaceHead(choiceContext.trueForkContext.makeNext(0, -1)); - } - - /** - * Makes a code path segment for the body part of a DoWhileStatement. - * @returns {void} - */ - makeDoWhileBody() { - const context = this.loopContext; - const forkContext = this.forkContext; - const bodySegments = forkContext.makeNext(-1, -1); - - // Update state. - context.entrySegments = bodySegments; - forkContext.replaceHead(bodySegments); - } - - /** - * Makes a code path segment for the test part of a DoWhileStatement. - * @param {boolean|undefined} test The test value (only when constant). - * @returns {void} - */ - makeDoWhileTest(test) { - const context = this.loopContext; - const forkContext = this.forkContext; - - context.test = test; - - // Creates paths of `continue` statements. - if (!context.continueForkContext.empty) { - context.continueForkContext.add(forkContext.head); - const testSegments = context.continueForkContext.makeNext(0, -1); - - forkContext.replaceHead(testSegments); - } - } - - /** - * Makes a code path segment for the test part of a ForStatement. - * @param {boolean|undefined} test The test value (only when constant). - * @returns {void} - */ - makeForTest(test) { - const context = this.loopContext; - const forkContext = this.forkContext; - const endOfInitSegments = forkContext.head; - const testSegments = forkContext.makeNext(-1, -1); - - // Update state. - context.test = test; - context.endOfInitSegments = endOfInitSegments; - context.continueDestSegments = context.testSegments = testSegments; - forkContext.replaceHead(testSegments); - } - - /** - * Makes a code path segment for the update part of a ForStatement. - * @returns {void} - */ - makeForUpdate() { - const context = this.loopContext; - const choiceContext = this.choiceContext; - const forkContext = this.forkContext; - - // Make the next paths of the test. - if (context.testSegments) { - finalizeTestSegmentsOfFor( - context, - choiceContext, - forkContext.head - ); - } else { - context.endOfInitSegments = forkContext.head; - } - - // Update state. - const updateSegments = forkContext.makeDisconnected(-1, -1); - - context.continueDestSegments = context.updateSegments = updateSegments; - forkContext.replaceHead(updateSegments); - } - - /** - * Makes a code path segment for the body part of a ForStatement. - * @returns {void} - */ - makeForBody() { - const context = this.loopContext; - const choiceContext = this.choiceContext; - const forkContext = this.forkContext; - - // Update state. - if (context.updateSegments) { - context.endOfUpdateSegments = forkContext.head; - - // `update` -> `test` - if (context.testSegments) { - makeLooped( - this, - context.endOfUpdateSegments, - context.testSegments - ); - } - } else if (context.testSegments) { - finalizeTestSegmentsOfFor( - context, - choiceContext, - forkContext.head - ); - } else { - context.endOfInitSegments = forkContext.head; - } - - let bodySegments = context.endOfTestSegments; - - if (!bodySegments) { - - /* - * If there is not the `test` part, the `body` path comes from the - * `init` part and the `update` part. - */ - const prevForkContext = ForkContext.newEmpty(forkContext); - - prevForkContext.add(context.endOfInitSegments); - if (context.endOfUpdateSegments) { - prevForkContext.add(context.endOfUpdateSegments); - } - - bodySegments = prevForkContext.makeNext(0, -1); - } - context.continueDestSegments = context.continueDestSegments || bodySegments; - forkContext.replaceHead(bodySegments); - } - - /** - * Makes a code path segment for the left part of a ForInStatement and a - * ForOfStatement. - * @returns {void} - */ - makeForInOfLeft() { - const context = this.loopContext; - const forkContext = this.forkContext; - const leftSegments = forkContext.makeDisconnected(-1, -1); - - // Update state. - context.prevSegments = forkContext.head; - context.leftSegments = context.continueDestSegments = leftSegments; - forkContext.replaceHead(leftSegments); - } - - /** - * Makes a code path segment for the right part of a ForInStatement and a - * ForOfStatement. - * @returns {void} - */ - makeForInOfRight() { - const context = this.loopContext; - const forkContext = this.forkContext; - const temp = ForkContext.newEmpty(forkContext); - - temp.add(context.prevSegments); - const rightSegments = temp.makeNext(-1, -1); - - // Update state. - context.endOfLeftSegments = forkContext.head; - forkContext.replaceHead(rightSegments); - } - - /** - * Makes a code path segment for the body part of a ForInStatement and a - * ForOfStatement. - * @returns {void} - */ - makeForInOfBody() { - const context = this.loopContext; - const forkContext = this.forkContext; - const temp = ForkContext.newEmpty(forkContext); - - temp.add(context.endOfLeftSegments); - const bodySegments = temp.makeNext(-1, -1); - - // Make a path: `right` -> `left`. - makeLooped(this, forkContext.head, context.leftSegments); - - // Update state. - context.brokenForkContext.add(forkContext.head); - forkContext.replaceHead(bodySegments); - } - - //-------------------------------------------------------------------------- - // Control Statements - //-------------------------------------------------------------------------- - - /** - * Creates new context for BreakStatement. - * @param {boolean} breakable The flag to indicate it can break by - * an unlabeled BreakStatement. - * @param {string|null} label The label of this context. - * @returns {Object} The new context. - */ - pushBreakContext(breakable, label) { - this.breakContext = { - upper: this.breakContext, - breakable, - label, - brokenForkContext: ForkContext.newEmpty(this.forkContext) - }; - return this.breakContext; - } - - /** - * Removes the top item of the break context stack. - * @returns {Object} The removed context. - */ - popBreakContext() { - const context = this.breakContext; - const forkContext = this.forkContext; - - this.breakContext = context.upper; - - // Process this context here for other than switches and loops. - if (!context.breakable) { - const brokenForkContext = context.brokenForkContext; - - if (!brokenForkContext.empty) { - brokenForkContext.add(forkContext.head); - forkContext.replaceHead(brokenForkContext.makeNext(0, -1)); - } - } - - return context; - } - - /** - * Makes a path for a `break` statement. - * - * It registers the head segment to a context of `break`. - * It makes new unreachable segment, then it set the head with the segment. - * @param {string} label A label of the break statement. - * @returns {void} - */ - makeBreak(label) { - const forkContext = this.forkContext; - - if (!forkContext.reachable) { - return; - } - - const context = getBreakContext(this, label); - - - if (context) { - context.brokenForkContext.add(forkContext.head); - } - - /* c8 ignore next */ - forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); - } - - /** - * Makes a path for a `continue` statement. - * - * It makes a looping path. - * It makes new unreachable segment, then it set the head with the segment. - * @param {string} label A label of the continue statement. - * @returns {void} - */ - makeContinue(label) { - const forkContext = this.forkContext; - - if (!forkContext.reachable) { - return; - } - - const context = getContinueContext(this, label); - - if (context) { - if (context.continueDestSegments) { - makeLooped(this, forkContext.head, context.continueDestSegments); - - // If the context is a for-in/of loop, this effects a break also. - if (context.type === "ForInStatement" || - context.type === "ForOfStatement" - ) { - context.brokenForkContext.add(forkContext.head); - } - } else { - context.continueForkContext.add(forkContext.head); - } - } - forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); - } - - /** - * Makes a path for a `return` statement. - * - * It registers the head segment to a context of `return`. - * It makes new unreachable segment, then it set the head with the segment. - * @returns {void} - */ - makeReturn() { - const forkContext = this.forkContext; - - if (forkContext.reachable) { - getReturnContext(this).returnedForkContext.add(forkContext.head); - forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); - } - } - - /** - * Makes a path for a `throw` statement. - * - * It registers the head segment to a context of `throw`. - * It makes new unreachable segment, then it set the head with the segment. - * @returns {void} - */ - makeThrow() { - const forkContext = this.forkContext; - - if (forkContext.reachable) { - getThrowContext(this).thrownForkContext.add(forkContext.head); - forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); - } - } - - /** - * Makes the final path. - * @returns {void} - */ - makeFinal() { - const segments = this.currentSegments; - - if (segments.length > 0 && segments[0].reachable) { - this.returnedForkContext.add(segments); - } - } -} - -module.exports = CodePathState; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/code-path.js b/node_modules/eslint/lib/linter/code-path-analysis/code-path.js deleted file mode 100644 index a028ca694..000000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/code-path.js +++ /dev/null @@ -1,247 +0,0 @@ -/** - * @fileoverview A class of the code path. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const CodePathState = require("./code-path-state"); -const IdGenerator = require("./id-generator"); - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * A code path. - */ -class CodePath { - - /** - * Creates a new instance. - * @param {Object} options Options for the function (see below). - * @param {string} options.id An identifier. - * @param {string} options.origin The type of code path origin. - * @param {CodePath|null} options.upper The code path of the upper function scope. - * @param {Function} options.onLooped A callback function to notify looping. - */ - constructor({ id, origin, upper, onLooped }) { - - /** - * The identifier of this code path. - * Rules use it to store additional information of each rule. - * @type {string} - */ - this.id = id; - - /** - * The reason that this code path was started. May be "program", - * "function", "class-field-initializer", or "class-static-block". - * @type {string} - */ - this.origin = origin; - - /** - * The code path of the upper function scope. - * @type {CodePath|null} - */ - this.upper = upper; - - /** - * The code paths of nested function scopes. - * @type {CodePath[]} - */ - this.childCodePaths = []; - - // Initializes internal state. - Object.defineProperty( - this, - "internal", - { value: new CodePathState(new IdGenerator(`${id}_`), onLooped) } - ); - - // Adds this into `childCodePaths` of `upper`. - if (upper) { - upper.childCodePaths.push(this); - } - } - - /** - * Gets the state of a given code path. - * @param {CodePath} codePath A code path to get. - * @returns {CodePathState} The state of the code path. - */ - static getState(codePath) { - return codePath.internal; - } - - /** - * The initial code path segment. - * @type {CodePathSegment} - */ - get initialSegment() { - return this.internal.initialSegment; - } - - /** - * Final code path segments. - * This array is a mix of `returnedSegments` and `thrownSegments`. - * @type {CodePathSegment[]} - */ - get finalSegments() { - return this.internal.finalSegments; - } - - /** - * Final code path segments which is with `return` statements. - * This array contains the last path segment if it's reachable. - * Since the reachable last path returns `undefined`. - * @type {CodePathSegment[]} - */ - get returnedSegments() { - return this.internal.returnedForkContext; - } - - /** - * Final code path segments which is with `throw` statements. - * @type {CodePathSegment[]} - */ - get thrownSegments() { - return this.internal.thrownForkContext; - } - - /** - * Current code path segments. - * @type {CodePathSegment[]} - */ - get currentSegments() { - return this.internal.currentSegments; - } - - /** - * Traverses all segments in this code path. - * - * codePath.traverseSegments(function(segment, controller) { - * // do something. - * }); - * - * This method enumerates segments in order from the head. - * - * The `controller` object has two methods. - * - * - `controller.skip()` - Skip the following segments in this branch. - * - `controller.break()` - Skip all following segments. - * @param {Object} [options] Omittable. - * @param {CodePathSegment} [options.first] The first segment to traverse. - * @param {CodePathSegment} [options.last] The last segment to traverse. - * @param {Function} callback A callback function. - * @returns {void} - */ - traverseSegments(options, callback) { - let resolvedOptions; - let resolvedCallback; - - if (typeof options === "function") { - resolvedCallback = options; - resolvedOptions = {}; - } else { - resolvedOptions = options || {}; - resolvedCallback = callback; - } - - const startSegment = resolvedOptions.first || this.internal.initialSegment; - const lastSegment = resolvedOptions.last; - - let item = null; - let index = 0; - let end = 0; - let segment = null; - const visited = Object.create(null); - const stack = [[startSegment, 0]]; - let skippedSegment = null; - let broken = false; - const controller = { - skip() { - if (stack.length <= 1) { - broken = true; - } else { - skippedSegment = stack[stack.length - 2][0]; - } - }, - break() { - broken = true; - } - }; - - /** - * Checks a given previous segment has been visited. - * @param {CodePathSegment} prevSegment A previous segment to check. - * @returns {boolean} `true` if the segment has been visited. - */ - function isVisited(prevSegment) { - return ( - visited[prevSegment.id] || - segment.isLoopedPrevSegment(prevSegment) - ); - } - - while (stack.length > 0) { - item = stack[stack.length - 1]; - segment = item[0]; - index = item[1]; - - if (index === 0) { - - // Skip if this segment has been visited already. - if (visited[segment.id]) { - stack.pop(); - continue; - } - - // Skip if all previous segments have not been visited. - if (segment !== startSegment && - segment.prevSegments.length > 0 && - !segment.prevSegments.every(isVisited) - ) { - stack.pop(); - continue; - } - - // Reset the flag of skipping if all branches have been skipped. - if (skippedSegment && segment.prevSegments.includes(skippedSegment)) { - skippedSegment = null; - } - visited[segment.id] = true; - - // Call the callback when the first time. - if (!skippedSegment) { - resolvedCallback.call(this, segment, controller); - if (segment === lastSegment) { - controller.skip(); - } - if (broken) { - break; - } - } - } - - // Update the stack. - end = segment.nextSegments.length - 1; - if (index < end) { - item[1] += 1; - stack.push([segment.nextSegments[index], 0]); - } else if (index === end) { - item[0] = segment.nextSegments[index]; - item[1] = 0; - } else { - stack.pop(); - } - } - } -} - -module.exports = CodePath; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js b/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js deleted file mode 100644 index e06b6cde5..000000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * @fileoverview Helpers to debug for code path analysis. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const debug = require("debug")("eslint:code-path"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Gets id of a given segment. - * @param {CodePathSegment} segment A segment to get. - * @returns {string} Id of the segment. - */ -/* c8 ignore next */ -function getId(segment) { // eslint-disable-line jsdoc/require-jsdoc -- Ignoring - return segment.id + (segment.reachable ? "" : "!"); -} - -/** - * Get string for the given node and operation. - * @param {ASTNode} node The node to convert. - * @param {"enter" | "exit" | undefined} label The operation label. - * @returns {string} The string representation. - */ -function nodeToString(node, label) { - const suffix = label ? `:${label}` : ""; - - switch (node.type) { - case "Identifier": return `${node.type}${suffix} (${node.name})`; - case "Literal": return `${node.type}${suffix} (${node.value})`; - default: return `${node.type}${suffix}`; - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - - /** - * A flag that debug dumping is enabled or not. - * @type {boolean} - */ - enabled: debug.enabled, - - /** - * Dumps given objects. - * @param {...any} args objects to dump. - * @returns {void} - */ - dump: debug, - - /** - * Dumps the current analyzing state. - * @param {ASTNode} node A node to dump. - * @param {CodePathState} state A state to dump. - * @param {boolean} leaving A flag whether or not it's leaving - * @returns {void} - */ - dumpState: !debug.enabled ? debug : /* c8 ignore next */ function(node, state, leaving) { - for (let i = 0; i < state.currentSegments.length; ++i) { - const segInternal = state.currentSegments[i].internal; - - if (leaving) { - const last = segInternal.nodes.length - 1; - - if (last >= 0 && segInternal.nodes[last] === nodeToString(node, "enter")) { - segInternal.nodes[last] = nodeToString(node, void 0); - } else { - segInternal.nodes.push(nodeToString(node, "exit")); - } - } else { - segInternal.nodes.push(nodeToString(node, "enter")); - } - } - - debug([ - `${state.currentSegments.map(getId).join(",")})`, - `${node.type}${leaving ? ":exit" : ""}` - ].join(" ")); - }, - - /** - * Dumps a DOT code of a given code path. - * The DOT code can be visualized with Graphvis. - * @param {CodePath} codePath A code path to dump. - * @returns {void} - * @see http://www.graphviz.org - * @see http://www.webgraphviz.com - */ - dumpDot: !debug.enabled ? debug : /* c8 ignore next */ function(codePath) { - let text = - "\n" + - "digraph {\n" + - "node[shape=box,style=\"rounded,filled\",fillcolor=white];\n" + - "initial[label=\"\",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];\n"; - - if (codePath.returnedSegments.length > 0) { - text += "final[label=\"\",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];\n"; - } - if (codePath.thrownSegments.length > 0) { - text += "thrown[label=\"✘\",shape=circle,width=0.3,height=0.3,fixedsize];\n"; - } - - const traceMap = Object.create(null); - const arrows = this.makeDotArrows(codePath, traceMap); - - for (const id in traceMap) { // eslint-disable-line guard-for-in -- Want ability to traverse prototype - const segment = traceMap[id]; - - text += `${id}[`; - - if (segment.reachable) { - text += "label=\""; - } else { - text += "style=\"rounded,dashed,filled\",fillcolor=\"#FF9800\",label=\"<>\\n"; - } - - if (segment.internal.nodes.length > 0) { - text += segment.internal.nodes.join("\\n"); - } else { - text += "????"; - } - - text += "\"];\n"; - } - - text += `${arrows}\n`; - text += "}"; - debug("DOT", text); - }, - - /** - * Makes a DOT code of a given code path. - * The DOT code can be visualized with Graphvis. - * @param {CodePath} codePath A code path to make DOT. - * @param {Object} traceMap Optional. A map to check whether or not segments had been done. - * @returns {string} A DOT code of the code path. - */ - makeDotArrows(codePath, traceMap) { - const stack = [[codePath.initialSegment, 0]]; - const done = traceMap || Object.create(null); - let lastId = codePath.initialSegment.id; - let text = `initial->${codePath.initialSegment.id}`; - - while (stack.length > 0) { - const item = stack.pop(); - const segment = item[0]; - const index = item[1]; - - if (done[segment.id] && index === 0) { - continue; - } - done[segment.id] = segment; - - const nextSegment = segment.allNextSegments[index]; - - if (!nextSegment) { - continue; - } - - if (lastId === segment.id) { - text += `->${nextSegment.id}`; - } else { - text += `;\n${segment.id}->${nextSegment.id}`; - } - lastId = nextSegment.id; - - stack.unshift([segment, 1 + index]); - stack.push([nextSegment, 0]); - } - - codePath.returnedSegments.forEach(finalSegment => { - if (lastId === finalSegment.id) { - text += "->final"; - } else { - text += `;\n${finalSegment.id}->final`; - } - lastId = null; - }); - - codePath.thrownSegments.forEach(finalSegment => { - if (lastId === finalSegment.id) { - text += "->thrown"; - } else { - text += `;\n${finalSegment.id}->thrown`; - } - lastId = null; - }); - - return `${text};`; - } -}; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js b/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js deleted file mode 100644 index 04c59b5e4..000000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js +++ /dev/null @@ -1,248 +0,0 @@ -/** - * @fileoverview A class to operate forking. - * - * This is state of forking. - * This has a fork list and manages it. - * - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const assert = require("assert"), - CodePathSegment = require("./code-path-segment"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Gets whether or not a given segment is reachable. - * @param {CodePathSegment} segment A segment to get. - * @returns {boolean} `true` if the segment is reachable. - */ -function isReachable(segment) { - return segment.reachable; -} - -/** - * Creates new segments from the specific range of `context.segmentsList`. - * - * When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and - * `end` is `-1`, this creates `[g, h]`. This `g` is from `a`, `c`, and `e`. - * This `h` is from `b`, `d`, and `f`. - * @param {ForkContext} context An instance. - * @param {number} begin The first index of the previous segments. - * @param {number} end The last index of the previous segments. - * @param {Function} create A factory function of new segments. - * @returns {CodePathSegment[]} New segments. - */ -function makeSegments(context, begin, end, create) { - const list = context.segmentsList; - - const normalizedBegin = begin >= 0 ? begin : list.length + begin; - const normalizedEnd = end >= 0 ? end : list.length + end; - - const segments = []; - - for (let i = 0; i < context.count; ++i) { - const allPrevSegments = []; - - for (let j = normalizedBegin; j <= normalizedEnd; ++j) { - allPrevSegments.push(list[j][i]); - } - - segments.push(create(context.idGenerator.next(), allPrevSegments)); - } - - return segments; -} - -/** - * `segments` becomes doubly in a `finally` block. Then if a code path exits by a - * control statement (such as `break`, `continue`) from the `finally` block, the - * destination's segments may be half of the source segments. In that case, this - * merges segments. - * @param {ForkContext} context An instance. - * @param {CodePathSegment[]} segments Segments to merge. - * @returns {CodePathSegment[]} The merged segments. - */ -function mergeExtraSegments(context, segments) { - let currentSegments = segments; - - while (currentSegments.length > context.count) { - const merged = []; - - for (let i = 0, length = currentSegments.length / 2 | 0; i < length; ++i) { - merged.push(CodePathSegment.newNext( - context.idGenerator.next(), - [currentSegments[i], currentSegments[i + length]] - )); - } - currentSegments = merged; - } - return currentSegments; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * A class to manage forking. - */ -class ForkContext { - - /** - * @param {IdGenerator} idGenerator An identifier generator for segments. - * @param {ForkContext|null} upper An upper fork context. - * @param {number} count A number of parallel segments. - */ - constructor(idGenerator, upper, count) { - this.idGenerator = idGenerator; - this.upper = upper; - this.count = count; - this.segmentsList = []; - } - - /** - * The head segments. - * @type {CodePathSegment[]} - */ - get head() { - const list = this.segmentsList; - - return list.length === 0 ? [] : list[list.length - 1]; - } - - /** - * A flag which shows empty. - * @type {boolean} - */ - get empty() { - return this.segmentsList.length === 0; - } - - /** - * A flag which shows reachable. - * @type {boolean} - */ - get reachable() { - const segments = this.head; - - return segments.length > 0 && segments.some(isReachable); - } - - /** - * Creates new segments from this context. - * @param {number} begin The first index of previous segments. - * @param {number} end The last index of previous segments. - * @returns {CodePathSegment[]} New segments. - */ - makeNext(begin, end) { - return makeSegments(this, begin, end, CodePathSegment.newNext); - } - - /** - * Creates new segments from this context. - * The new segments is always unreachable. - * @param {number} begin The first index of previous segments. - * @param {number} end The last index of previous segments. - * @returns {CodePathSegment[]} New segments. - */ - makeUnreachable(begin, end) { - return makeSegments(this, begin, end, CodePathSegment.newUnreachable); - } - - /** - * Creates new segments from this context. - * The new segments don't have connections for previous segments. - * But these inherit the reachable flag from this context. - * @param {number} begin The first index of previous segments. - * @param {number} end The last index of previous segments. - * @returns {CodePathSegment[]} New segments. - */ - makeDisconnected(begin, end) { - return makeSegments(this, begin, end, CodePathSegment.newDisconnected); - } - - /** - * Adds segments into this context. - * The added segments become the head. - * @param {CodePathSegment[]} segments Segments to add. - * @returns {void} - */ - add(segments) { - assert(segments.length >= this.count, `${segments.length} >= ${this.count}`); - - this.segmentsList.push(mergeExtraSegments(this, segments)); - } - - /** - * Replaces the head segments with given segments. - * The current head segments are removed. - * @param {CodePathSegment[]} segments Segments to add. - * @returns {void} - */ - replaceHead(segments) { - assert(segments.length >= this.count, `${segments.length} >= ${this.count}`); - - this.segmentsList.splice(-1, 1, mergeExtraSegments(this, segments)); - } - - /** - * Adds all segments of a given fork context into this context. - * @param {ForkContext} context A fork context to add. - * @returns {void} - */ - addAll(context) { - assert(context.count === this.count); - - const source = context.segmentsList; - - for (let i = 0; i < source.length; ++i) { - this.segmentsList.push(source[i]); - } - } - - /** - * Clears all segments in this context. - * @returns {void} - */ - clear() { - this.segmentsList = []; - } - - /** - * Creates the root fork context. - * @param {IdGenerator} idGenerator An identifier generator for segments. - * @returns {ForkContext} New fork context. - */ - static newRoot(idGenerator) { - const context = new ForkContext(idGenerator, null, 1); - - context.add([CodePathSegment.newRoot(idGenerator.next())]); - - return context; - } - - /** - * Creates an empty fork context preceded by a given context. - * @param {ForkContext} parentContext The parent fork context. - * @param {boolean} forkLeavingPath A flag which shows inside of `finally` block. - * @returns {ForkContext} New fork context. - */ - static newEmpty(parentContext, forkLeavingPath) { - return new ForkContext( - parentContext.idGenerator, - parentContext, - (forkLeavingPath ? 2 : 1) * parentContext.count - ); - } -} - -module.exports = ForkContext; diff --git a/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js b/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js deleted file mode 100644 index b580104e1..000000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @fileoverview A class of identifiers generator for code path segments. - * - * Each rule uses the identifier of code path segments to store additional - * information of the code path. - * - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * A generator for unique ids. - */ -class IdGenerator { - - /** - * @param {string} prefix Optional. A prefix of generated ids. - */ - constructor(prefix) { - this.prefix = String(prefix); - this.n = 0; - } - - /** - * Generates id. - * @returns {string} A generated id. - */ - next() { - this.n = 1 + this.n | 0; - - /* c8 ignore start */ - if (this.n < 0) { - this.n = 1; - }/* c8 ignore stop */ - - return this.prefix + this.n; - } -} - -module.exports = IdGenerator; diff --git a/node_modules/eslint/lib/linter/config-comment-parser.js b/node_modules/eslint/lib/linter/config-comment-parser.js deleted file mode 100644 index 9aab3c444..000000000 --- a/node_modules/eslint/lib/linter/config-comment-parser.js +++ /dev/null @@ -1,151 +0,0 @@ -/** - * @fileoverview Config Comment Parser - * @author Nicholas C. Zakas - */ - -/* eslint class-methods-use-this: off -- Methods desired on instance */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const levn = require("levn"), - { - Legacy: { - ConfigOps - } - } = require("@eslint/eslintrc/universal"); - -const debug = require("debug")("eslint:config-comment-parser"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").LintMessage} LintMessage */ - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Object to parse ESLint configuration comments inside JavaScript files. - * @name ConfigCommentParser - */ -module.exports = class ConfigCommentParser { - - /** - * Parses a list of "name:string_value" or/and "name" options divided by comma or - * whitespace. Used for "global" and "exported" comments. - * @param {string} string The string to parse. - * @param {Comment} comment The comment node which has the string. - * @returns {Object} Result map object of names and string values, or null values if no value was provided - */ - parseStringConfig(string, comment) { - debug("Parsing String config"); - - const items = {}; - - // Collapse whitespace around `:` and `,` to make parsing easier - const trimmedString = string.replace(/\s*([:,])\s*/gu, "$1"); - - trimmedString.split(/\s|,+/u).forEach(name => { - if (!name) { - return; - } - - // value defaults to null (if not provided), e.g: "foo" => ["foo", null] - const [key, value = null] = name.split(":"); - - items[key] = { value, comment }; - }); - return items; - } - - /** - * Parses a JSON-like config. - * @param {string} string The string to parse. - * @param {Object} location Start line and column of comments for potential error message. - * @returns {({success: true, config: Object}|{success: false, error: LintMessage})} Result map object - */ - parseJsonConfig(string, location) { - debug("Parsing JSON config"); - - let items = {}; - - // Parses a JSON-like comment by the same way as parsing CLI option. - try { - items = levn.parse("Object", string) || {}; - - // Some tests say that it should ignore invalid comments such as `/*eslint no-alert:abc*/`. - // Also, commaless notations have invalid severity: - // "no-alert: 2 no-console: 2" --> {"no-alert": "2 no-console: 2"} - // Should ignore that case as well. - if (ConfigOps.isEverySeverityValid(items)) { - return { - success: true, - config: items - }; - } - } catch { - - debug("Levn parsing failed; falling back to manual parsing."); - - // ignore to parse the string by a fallback. - } - - /* - * Optionator cannot parse commaless notations. - * But we are supporting that. So this is a fallback for that. - */ - items = {}; - const normalizedString = string.replace(/([-a-zA-Z0-9/]+):/gu, "\"$1\":").replace(/(\]|[0-9])\s+(?=")/u, "$1,"); - - try { - items = JSON.parse(`{${normalizedString}}`); - } catch (ex) { - debug("Manual parsing failed."); - - return { - success: false, - error: { - ruleId: null, - fatal: true, - severity: 2, - message: `Failed to parse JSON from '${normalizedString}': ${ex.message}`, - line: location.start.line, - column: location.start.column + 1, - nodeType: null - } - }; - - } - - return { - success: true, - config: items - }; - } - - /** - * Parses a config of values separated by comma. - * @param {string} string The string to parse. - * @returns {Object} Result map of values and true values - */ - parseListConfig(string) { - debug("Parsing list config"); - - const items = {}; - - string.split(",").forEach(name => { - const trimmedName = name.trim(); - - if (trimmedName) { - items[trimmedName] = true; - } - }); - return items; - } - -}; diff --git a/node_modules/eslint/lib/linter/index.js b/node_modules/eslint/lib/linter/index.js deleted file mode 100644 index 25fd769bd..000000000 --- a/node_modules/eslint/lib/linter/index.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -const { Linter } = require("./linter"); -const interpolate = require("./interpolate"); -const SourceCodeFixer = require("./source-code-fixer"); - -module.exports = { - Linter, - - // For testers. - SourceCodeFixer, - interpolate -}; diff --git a/node_modules/eslint/lib/linter/interpolate.js b/node_modules/eslint/lib/linter/interpolate.js deleted file mode 100644 index 87e06a023..000000000 --- a/node_modules/eslint/lib/linter/interpolate.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @fileoverview Interpolate keys from an object into a string with {{ }} markers. - * @author Jed Fox - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = (text, data) => { - if (!data) { - return text; - } - - // Substitution content for any {{ }} markers. - return text.replace(/\{\{([^{}]+?)\}\}/gu, (fullMatch, termWithWhitespace) => { - const term = termWithWhitespace.trim(); - - if (term in data) { - return data[term]; - } - - // Preserve old behavior: If parameter name not provided, don't replace it. - return fullMatch; - }); -}; diff --git a/node_modules/eslint/lib/linter/linter.js b/node_modules/eslint/lib/linter/linter.js deleted file mode 100644 index 233cbed5b..000000000 --- a/node_modules/eslint/lib/linter/linter.js +++ /dev/null @@ -1,2018 +0,0 @@ -/** - * @fileoverview Main Linter Class - * @author Gyandeep Singh - * @author aladdin-add - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const - path = require("path"), - eslintScope = require("eslint-scope"), - evk = require("eslint-visitor-keys"), - espree = require("espree"), - merge = require("lodash.merge"), - pkg = require("../../package.json"), - astUtils = require("../shared/ast-utils"), - { - directivesPattern - } = require("../shared/directives"), - { - Legacy: { - ConfigOps, - ConfigValidator, - environments: BuiltInEnvironments - } - } = require("@eslint/eslintrc/universal"), - Traverser = require("../shared/traverser"), - { SourceCode } = require("../source-code"), - CodePathAnalyzer = require("./code-path-analysis/code-path-analyzer"), - applyDisableDirectives = require("./apply-disable-directives"), - ConfigCommentParser = require("./config-comment-parser"), - NodeEventGenerator = require("./node-event-generator"), - createReportTranslator = require("./report-translator"), - Rules = require("./rules"), - createEmitter = require("./safe-emitter"), - SourceCodeFixer = require("./source-code-fixer"), - timing = require("./timing"), - ruleReplacements = require("../../conf/replacements.json"); -const { getRuleFromConfig } = require("../config/flat-config-helpers"); -const { FlatConfigArray } = require("../config/flat-config-array"); - -const debug = require("debug")("eslint:linter"); -const MAX_AUTOFIX_PASSES = 10; -const DEFAULT_PARSER_NAME = "espree"; -const DEFAULT_ECMA_VERSION = 5; -const commentParser = new ConfigCommentParser(); -const DEFAULT_ERROR_LOC = { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } }; -const parserSymbol = Symbol.for("eslint.RuleTester.parser"); -const globals = require("../../conf/globals"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {InstanceType} ConfigArray */ -/** @typedef {InstanceType} ExtractedConfig */ -/** @typedef {import("../shared/types").ConfigData} ConfigData */ -/** @typedef {import("../shared/types").Environment} Environment */ -/** @typedef {import("../shared/types").GlobalConf} GlobalConf */ -/** @typedef {import("../shared/types").LintMessage} LintMessage */ -/** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */ -/** @typedef {import("../shared/types").ParserOptions} ParserOptions */ -/** @typedef {import("../shared/types").LanguageOptions} LanguageOptions */ -/** @typedef {import("../shared/types").Processor} Processor */ -/** @typedef {import("../shared/types").Rule} Rule */ - -/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ -/** - * @template T - * @typedef {{ [P in keyof T]-?: T[P] }} Required - */ -/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ - -/** - * @typedef {Object} DisableDirective - * @property {("disable"|"enable"|"disable-line"|"disable-next-line")} type Type of directive - * @property {number} line The line number - * @property {number} column The column number - * @property {(string|null)} ruleId The rule ID - * @property {string} justification The justification of directive - */ - -/** - * The private data for `Linter` instance. - * @typedef {Object} LinterInternalSlots - * @property {ConfigArray|null} lastConfigArray The `ConfigArray` instance that the last `verify()` call used. - * @property {SourceCode|null} lastSourceCode The `SourceCode` instance that the last `verify()` call used. - * @property {SuppressedLintMessage[]} lastSuppressedMessages The `SuppressedLintMessage[]` instance that the last `verify()` call produced. - * @property {Map} parserMap The loaded parsers. - * @property {Rules} ruleMap The loaded rules. - */ - -/** - * @typedef {Object} VerifyOptions - * @property {boolean} [allowInlineConfig] Allow/disallow inline comments' ability - * to change config once it is set. Defaults to true if not supplied. - * Useful if you want to validate JS without comments overriding rules. - * @property {boolean} [disableFixes] if `true` then the linter doesn't make `fix` - * properties into the lint result. - * @property {string} [filename] the filename of the source code. - * @property {boolean | "off" | "warn" | "error"} [reportUnusedDisableDirectives] Adds reported errors for - * unused `eslint-disable` directives. - */ - -/** - * @typedef {Object} ProcessorOptions - * @property {(filename:string, text:string) => boolean} [filterCodeBlock] the - * predicate function that selects adopt code blocks. - * @property {Processor.postprocess} [postprocess] postprocessor for report - * messages. If provided, this should accept an array of the message lists - * for each code block returned from the preprocessor, apply a mapping to - * the messages as appropriate, and return a one-dimensional array of - * messages. - * @property {Processor.preprocess} [preprocess] preprocessor for source text. - * If provided, this should accept a string of source text, and return an - * array of code blocks to lint. - */ - -/** - * @typedef {Object} FixOptions - * @property {boolean | ((message: LintMessage) => boolean)} [fix] Determines - * whether fixes should be applied. - */ - -/** - * @typedef {Object} InternalOptions - * @property {string | null} warnInlineConfig The config name what `noInlineConfig` setting came from. If `noInlineConfig` setting didn't exist, this is null. If this is a config name, then the linter warns directive comments. - * @property {"off" | "warn" | "error"} reportUnusedDisableDirectives (boolean values were normalized) - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines if a given object is Espree. - * @param {Object} parser The parser to check. - * @returns {boolean} True if the parser is Espree or false if not. - */ -function isEspree(parser) { - return !!(parser === espree || parser[parserSymbol] === espree); -} - -/** - * Retrieves globals for the given ecmaVersion. - * @param {number} ecmaVersion The version to retrieve globals for. - * @returns {Object} The globals for the given ecmaVersion. - */ -function getGlobalsForEcmaVersion(ecmaVersion) { - - switch (ecmaVersion) { - case 3: - return globals.es3; - - case 5: - return globals.es5; - - default: - if (ecmaVersion < 2015) { - return globals[`es${ecmaVersion + 2009}`]; - } - - return globals[`es${ecmaVersion}`]; - } -} - -/** - * Ensures that variables representing built-in properties of the Global Object, - * and any globals declared by special block comments, are present in the global - * scope. - * @param {Scope} globalScope The global scope. - * @param {Object} configGlobals The globals declared in configuration - * @param {{exportedVariables: Object, enabledGlobals: Object}} commentDirectives Directives from comment configuration - * @returns {void} - */ -function addDeclaredGlobals(globalScope, configGlobals, { exportedVariables, enabledGlobals }) { - - // Define configured global variables. - for (const id of new Set([...Object.keys(configGlobals), ...Object.keys(enabledGlobals)])) { - - /* - * `ConfigOps.normalizeConfigGlobal` will throw an error if a configured global value is invalid. However, these errors would - * typically be caught when validating a config anyway (validity for inline global comments is checked separately). - */ - const configValue = configGlobals[id] === void 0 ? void 0 : ConfigOps.normalizeConfigGlobal(configGlobals[id]); - const commentValue = enabledGlobals[id] && enabledGlobals[id].value; - const value = commentValue || configValue; - const sourceComments = enabledGlobals[id] && enabledGlobals[id].comments; - - if (value === "off") { - continue; - } - - let variable = globalScope.set.get(id); - - if (!variable) { - variable = new eslintScope.Variable(id, globalScope); - - globalScope.variables.push(variable); - globalScope.set.set(id, variable); - } - - variable.eslintImplicitGlobalSetting = configValue; - variable.eslintExplicitGlobal = sourceComments !== void 0; - variable.eslintExplicitGlobalComments = sourceComments; - variable.writeable = (value === "writable"); - } - - // mark all exported variables as such - Object.keys(exportedVariables).forEach(name => { - const variable = globalScope.set.get(name); - - if (variable) { - variable.eslintUsed = true; - variable.eslintExported = true; - } - }); - - /* - * "through" contains all references which definitions cannot be found. - * Since we augment the global scope using configuration, we need to update - * references and remove the ones that were added by configuration. - */ - globalScope.through = globalScope.through.filter(reference => { - const name = reference.identifier.name; - const variable = globalScope.set.get(name); - - if (variable) { - - /* - * Links the variable and the reference. - * And this reference is removed from `Scope#through`. - */ - reference.resolved = variable; - variable.references.push(reference); - - return false; - } - - return true; - }); -} - -/** - * creates a missing-rule message. - * @param {string} ruleId the ruleId to create - * @returns {string} created error message - * @private - */ -function createMissingRuleMessage(ruleId) { - return Object.prototype.hasOwnProperty.call(ruleReplacements.rules, ruleId) - ? `Rule '${ruleId}' was removed and replaced by: ${ruleReplacements.rules[ruleId].join(", ")}` - : `Definition for rule '${ruleId}' was not found.`; -} - -/** - * creates a linting problem - * @param {Object} options to create linting error - * @param {string} [options.ruleId] the ruleId to report - * @param {Object} [options.loc] the loc to report - * @param {string} [options.message] the error message to report - * @param {string} [options.severity] the error message to report - * @returns {LintMessage} created problem, returns a missing-rule problem if only provided ruleId. - * @private - */ -function createLintingProblem(options) { - const { - ruleId = null, - loc = DEFAULT_ERROR_LOC, - message = createMissingRuleMessage(options.ruleId), - severity = 2 - } = options; - - return { - ruleId, - message, - line: loc.start.line, - column: loc.start.column + 1, - endLine: loc.end.line, - endColumn: loc.end.column + 1, - severity, - nodeType: null - }; -} - -/** - * Creates a collection of disable directives from a comment - * @param {Object} options to create disable directives - * @param {("disable"|"enable"|"disable-line"|"disable-next-line")} options.type The type of directive comment - * @param {token} options.commentToken The Comment token - * @param {string} options.value The value after the directive in the comment - * comment specified no specific rules, so it applies to all rules (e.g. `eslint-disable`) - * @param {string} options.justification The justification of the directive - * @param {function(string): {create: Function}} options.ruleMapper A map from rule IDs to defined rules - * @returns {Object} Directives and problems from the comment - */ -function createDisableDirectives(options) { - const { commentToken, type, value, justification, ruleMapper } = options; - const ruleIds = Object.keys(commentParser.parseListConfig(value)); - const directiveRules = ruleIds.length ? ruleIds : [null]; - const result = { - directives: [], // valid disable directives - directiveProblems: [] // problems in directives - }; - - const parentComment = { commentToken, ruleIds }; - - for (const ruleId of directiveRules) { - - // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/) - if (ruleId === null || !!ruleMapper(ruleId)) { - if (type === "disable-next-line") { - result.directives.push({ - parentComment, - type, - line: commentToken.loc.end.line, - column: commentToken.loc.end.column + 1, - ruleId, - justification - }); - } else { - result.directives.push({ - parentComment, - type, - line: commentToken.loc.start.line, - column: commentToken.loc.start.column + 1, - ruleId, - justification - }); - } - } else { - result.directiveProblems.push(createLintingProblem({ ruleId, loc: commentToken.loc })); - } - } - return result; -} - -/** - * Extract the directive and the justification from a given directive comment and trim them. - * @param {string} value The comment text to extract. - * @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification. - */ -function extractDirectiveComment(value) { - const match = /\s-{2,}\s/u.exec(value); - - if (!match) { - return { directivePart: value.trim(), justificationPart: "" }; - } - - const directive = value.slice(0, match.index).trim(); - const justification = value.slice(match.index + match[0].length).trim(); - - return { directivePart: directive, justificationPart: justification }; -} - -/** - * Parses comments in file to extract file-specific config of rules, globals - * and environments and merges them with global config; also code blocks - * where reporting is disabled or enabled and merges them with reporting config. - * @param {ASTNode} ast The top node of the AST. - * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules - * @param {string|null} warnInlineConfig If a string then it should warn directive comments as disabled. The string value is the config name what the setting came from. - * @returns {{configuredRules: Object, enabledGlobals: {value:string,comment:Token}[], exportedVariables: Object, problems: LintMessage[], disableDirectives: DisableDirective[]}} - * A collection of the directive comments that were found, along with any problems that occurred when parsing - */ -function getDirectiveComments(ast, ruleMapper, warnInlineConfig) { - const configuredRules = {}; - const enabledGlobals = Object.create(null); - const exportedVariables = {}; - const problems = []; - const disableDirectives = []; - const validator = new ConfigValidator({ - builtInRules: Rules - }); - - ast.comments.filter(token => token.type !== "Shebang").forEach(comment => { - const { directivePart, justificationPart } = extractDirectiveComment(comment.value); - - const match = directivesPattern.exec(directivePart); - - if (!match) { - return; - } - const directiveText = match[1]; - const lineCommentSupported = /^eslint-disable-(next-)?line$/u.test(directiveText); - - if (comment.type === "Line" && !lineCommentSupported) { - return; - } - - if (warnInlineConfig) { - const kind = comment.type === "Block" ? `/*${directiveText}*/` : `//${directiveText}`; - - problems.push(createLintingProblem({ - ruleId: null, - message: `'${kind}' has no effect because you have 'noInlineConfig' setting in ${warnInlineConfig}.`, - loc: comment.loc, - severity: 1 - })); - return; - } - - if (directiveText === "eslint-disable-line" && comment.loc.start.line !== comment.loc.end.line) { - const message = `${directiveText} comment should not span multiple lines.`; - - problems.push(createLintingProblem({ - ruleId: null, - message, - loc: comment.loc - })); - return; - } - - const directiveValue = directivePart.slice(match.index + directiveText.length); - - switch (directiveText) { - case "eslint-disable": - case "eslint-enable": - case "eslint-disable-next-line": - case "eslint-disable-line": { - const directiveType = directiveText.slice("eslint-".length); - const options = { commentToken: comment, type: directiveType, value: directiveValue, justification: justificationPart, ruleMapper }; - const { directives, directiveProblems } = createDisableDirectives(options); - - disableDirectives.push(...directives); - problems.push(...directiveProblems); - break; - } - - case "exported": - Object.assign(exportedVariables, commentParser.parseStringConfig(directiveValue, comment)); - break; - - case "globals": - case "global": - for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) { - let normalizedValue; - - try { - normalizedValue = ConfigOps.normalizeConfigGlobal(value); - } catch (err) { - problems.push(createLintingProblem({ - ruleId: null, - loc: comment.loc, - message: err.message - })); - continue; - } - - if (enabledGlobals[id]) { - enabledGlobals[id].comments.push(comment); - enabledGlobals[id].value = normalizedValue; - } else { - enabledGlobals[id] = { - comments: [comment], - value: normalizedValue - }; - } - } - break; - - case "eslint": { - const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc); - - if (parseResult.success) { - Object.keys(parseResult.config).forEach(name => { - const rule = ruleMapper(name); - const ruleValue = parseResult.config[name]; - - if (!rule) { - problems.push(createLintingProblem({ ruleId: name, loc: comment.loc })); - return; - } - - try { - validator.validateRuleOptions(rule, name, ruleValue); - } catch (err) { - problems.push(createLintingProblem({ - ruleId: name, - message: err.message, - loc: comment.loc - })); - - // do not apply the config, if found invalid options. - return; - } - - configuredRules[name] = ruleValue; - }); - } else { - problems.push(parseResult.error); - } - - break; - } - - // no default - } - }); - - return { - configuredRules, - enabledGlobals, - exportedVariables, - problems, - disableDirectives - }; -} - -/** - * Normalize ECMAScript version from the initial config - * @param {Parser} parser The parser which uses this options. - * @param {number} ecmaVersion ECMAScript version from the initial config - * @returns {number} normalized ECMAScript version - */ -function normalizeEcmaVersion(parser, ecmaVersion) { - - if (isEspree(parser)) { - if (ecmaVersion === "latest") { - return espree.latestEcmaVersion; - } - } - - /* - * Calculate ECMAScript edition number from official year version starting with - * ES2015, which corresponds with ES6 (or a difference of 2009). - */ - return ecmaVersion >= 2015 ? ecmaVersion - 2009 : ecmaVersion; -} - -/** - * Normalize ECMAScript version from the initial config into languageOptions (year) - * format. - * @param {any} [ecmaVersion] ECMAScript version from the initial config - * @returns {number} normalized ECMAScript version - */ -function normalizeEcmaVersionForLanguageOptions(ecmaVersion) { - - switch (ecmaVersion) { - case 3: - return 3; - - // void 0 = no ecmaVersion specified so use the default - case 5: - case void 0: - return 5; - - default: - if (typeof ecmaVersion === "number") { - return ecmaVersion >= 2015 ? ecmaVersion : ecmaVersion + 2009; - } - } - - /* - * We default to the latest supported ecmaVersion for everything else. - * Remember, this is for languageOptions.ecmaVersion, which sets the version - * that is used for a number of processes inside of ESLint. It's normally - * safe to assume people want the latest unless otherwise specified. - */ - return espree.latestEcmaVersion + 2009; -} - -const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)(?:\*\/|$)/gsu; - -/** - * Checks whether or not there is a comment which has "eslint-env *" in a given text. - * @param {string} text A source code text to check. - * @returns {Object|null} A result of parseListConfig() with "eslint-env *" comment. - */ -function findEslintEnv(text) { - let match, retv; - - eslintEnvPattern.lastIndex = 0; - - while ((match = eslintEnvPattern.exec(text)) !== null) { - if (match[0].endsWith("*/")) { - retv = Object.assign( - retv || {}, - commentParser.parseListConfig(extractDirectiveComment(match[1]).directivePart) - ); - } - } - - return retv; -} - -/** - * Convert "/path/to/" to "". - * `CLIEngine#executeOnText()` method gives "/path/to/" if the filename - * was omitted because `configArray.extractConfig()` requires an absolute path. - * But the linter should pass `` to `RuleContext#filename` in that - * case. - * Also, code blocks can have their virtual filename. If the parent filename was - * ``, the virtual filename is `/0_foo.js` or something like (i.e., - * it's not an absolute path). - * @param {string} filename The filename to normalize. - * @returns {string} The normalized filename. - */ -function normalizeFilename(filename) { - const parts = filename.split(path.sep); - const index = parts.lastIndexOf(""); - - return index === -1 ? filename : parts.slice(index).join(path.sep); -} - -/** - * Normalizes the possible options for `linter.verify` and `linter.verifyAndFix` to a - * consistent shape. - * @param {VerifyOptions} providedOptions Options - * @param {ConfigData} config Config. - * @returns {Required & InternalOptions} Normalized options - */ -function normalizeVerifyOptions(providedOptions, config) { - - const linterOptions = config.linterOptions || config; - - // .noInlineConfig for eslintrc, .linterOptions.noInlineConfig for flat - const disableInlineConfig = linterOptions.noInlineConfig === true; - const ignoreInlineConfig = providedOptions.allowInlineConfig === false; - const configNameOfNoInlineConfig = config.configNameOfNoInlineConfig - ? ` (${config.configNameOfNoInlineConfig})` - : ""; - - let reportUnusedDisableDirectives = providedOptions.reportUnusedDisableDirectives; - - if (typeof reportUnusedDisableDirectives === "boolean") { - reportUnusedDisableDirectives = reportUnusedDisableDirectives ? "error" : "off"; - } - if (typeof reportUnusedDisableDirectives !== "string") { - reportUnusedDisableDirectives = - linterOptions.reportUnusedDisableDirectives - ? "warn" : "off"; - } - - return { - filename: normalizeFilename(providedOptions.filename || ""), - allowInlineConfig: !ignoreInlineConfig, - warnInlineConfig: disableInlineConfig && !ignoreInlineConfig - ? `your config${configNameOfNoInlineConfig}` - : null, - reportUnusedDisableDirectives, - disableFixes: Boolean(providedOptions.disableFixes) - }; -} - -/** - * Combines the provided parserOptions with the options from environments - * @param {Parser} parser The parser which uses this options. - * @param {ParserOptions} providedOptions The provided 'parserOptions' key in a config - * @param {Environment[]} enabledEnvironments The environments enabled in configuration and with inline comments - * @returns {ParserOptions} Resulting parser options after merge - */ -function resolveParserOptions(parser, providedOptions, enabledEnvironments) { - - const parserOptionsFromEnv = enabledEnvironments - .filter(env => env.parserOptions) - .reduce((parserOptions, env) => merge(parserOptions, env.parserOptions), {}); - const mergedParserOptions = merge(parserOptionsFromEnv, providedOptions || {}); - const isModule = mergedParserOptions.sourceType === "module"; - - if (isModule) { - - /* - * can't have global return inside of modules - * TODO: espree validate parserOptions.globalReturn when sourceType is setting to module.(@aladdin-add) - */ - mergedParserOptions.ecmaFeatures = Object.assign({}, mergedParserOptions.ecmaFeatures, { globalReturn: false }); - } - - mergedParserOptions.ecmaVersion = normalizeEcmaVersion(parser, mergedParserOptions.ecmaVersion); - - return mergedParserOptions; -} - -/** - * Converts parserOptions to languageOptions for backwards compatibility with eslintrc. - * @param {ConfigData} config Config object. - * @param {Object} config.globals Global variable definitions. - * @param {Parser} config.parser The parser to use. - * @param {ParserOptions} config.parserOptions The parserOptions to use. - * @returns {LanguageOptions} The languageOptions equivalent. - */ -function createLanguageOptions({ globals: configuredGlobals, parser, parserOptions }) { - - const { - ecmaVersion, - sourceType - } = parserOptions; - - return { - globals: configuredGlobals, - ecmaVersion: normalizeEcmaVersionForLanguageOptions(ecmaVersion), - sourceType, - parser, - parserOptions - }; -} - -/** - * Combines the provided globals object with the globals from environments - * @param {Record} providedGlobals The 'globals' key in a config - * @param {Environment[]} enabledEnvironments The environments enabled in configuration and with inline comments - * @returns {Record} The resolved globals object - */ -function resolveGlobals(providedGlobals, enabledEnvironments) { - return Object.assign( - {}, - ...enabledEnvironments.filter(env => env.globals).map(env => env.globals), - providedGlobals - ); -} - -/** - * Strips Unicode BOM from a given text. - * @param {string} text A text to strip. - * @returns {string} The stripped text. - */ -function stripUnicodeBOM(text) { - - /* - * Check Unicode BOM. - * In JavaScript, string data is stored as UTF-16, so BOM is 0xFEFF. - * http://www.ecma-international.org/ecma-262/6.0/#sec-unicode-format-control-characters - */ - if (text.charCodeAt(0) === 0xFEFF) { - return text.slice(1); - } - return text; -} - -/** - * Get the options for a rule (not including severity), if any - * @param {Array|number} ruleConfig rule configuration - * @returns {Array} of rule options, empty Array if none - */ -function getRuleOptions(ruleConfig) { - if (Array.isArray(ruleConfig)) { - return ruleConfig.slice(1); - } - return []; - -} - -/** - * Analyze scope of the given AST. - * @param {ASTNode} ast The `Program` node to analyze. - * @param {LanguageOptions} languageOptions The parser options. - * @param {Record} visitorKeys The visitor keys. - * @returns {ScopeManager} The analysis result. - */ -function analyzeScope(ast, languageOptions, visitorKeys) { - const parserOptions = languageOptions.parserOptions; - const ecmaFeatures = parserOptions.ecmaFeatures || {}; - const ecmaVersion = languageOptions.ecmaVersion || DEFAULT_ECMA_VERSION; - - return eslintScope.analyze(ast, { - ignoreEval: true, - nodejsScope: ecmaFeatures.globalReturn, - impliedStrict: ecmaFeatures.impliedStrict, - ecmaVersion: typeof ecmaVersion === "number" ? ecmaVersion : 6, - sourceType: languageOptions.sourceType || "script", - childVisitorKeys: visitorKeys || evk.KEYS, - fallback: Traverser.getKeys - }); -} - -/** - * Parses text into an AST. Moved out here because the try-catch prevents - * optimization of functions, so it's best to keep the try-catch as isolated - * as possible - * @param {string} text The text to parse. - * @param {LanguageOptions} languageOptions Options to pass to the parser - * @param {string} filePath The path to the file being parsed. - * @returns {{success: false, error: LintMessage}|{success: true, sourceCode: SourceCode}} - * An object containing the AST and parser services if parsing was successful, or the error if parsing failed - * @private - */ -function parse(text, languageOptions, filePath) { - const textToParse = stripUnicodeBOM(text).replace(astUtils.shebangPattern, (match, captured) => `//${captured}`); - const { ecmaVersion, sourceType, parser } = languageOptions; - const parserOptions = Object.assign( - { ecmaVersion, sourceType }, - languageOptions.parserOptions, - { - loc: true, - range: true, - raw: true, - tokens: true, - comment: true, - eslintVisitorKeys: true, - eslintScopeManager: true, - filePath - } - ); - - /* - * Check for parsing errors first. If there's a parsing error, nothing - * else can happen. However, a parsing error does not throw an error - * from this method - it's just considered a fatal error message, a - * problem that ESLint identified just like any other. - */ - try { - debug("Parsing:", filePath); - const parseResult = (typeof parser.parseForESLint === "function") - ? parser.parseForESLint(textToParse, parserOptions) - : { ast: parser.parse(textToParse, parserOptions) }; - - debug("Parsing successful:", filePath); - const ast = parseResult.ast; - const parserServices = parseResult.services || {}; - const visitorKeys = parseResult.visitorKeys || evk.KEYS; - - debug("Scope analysis:", filePath); - const scopeManager = parseResult.scopeManager || analyzeScope(ast, languageOptions, visitorKeys); - - debug("Scope analysis successful:", filePath); - - return { - success: true, - - /* - * Save all values that `parseForESLint()` returned. - * If a `SourceCode` object is given as the first parameter instead of source code text, - * linter skips the parsing process and reuses the source code object. - * In that case, linter needs all the values that `parseForESLint()` returned. - */ - sourceCode: new SourceCode({ - text, - ast, - parserServices, - scopeManager, - visitorKeys - }) - }; - } catch (ex) { - - // If the message includes a leading line number, strip it: - const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`; - - debug("%s\n%s", message, ex.stack); - - return { - success: false, - error: { - ruleId: null, - fatal: true, - severity: 2, - message, - line: ex.lineNumber, - column: ex.column, - nodeType: null - } - }; - } -} - -/** - * Runs a rule, and gets its listeners - * @param {Rule} rule A normalized rule with a `create` method - * @param {Context} ruleContext The context that should be passed to the rule - * @throws {any} Any error during the rule's `create` - * @returns {Object} A map of selector listeners provided by the rule - */ -function createRuleListeners(rule, ruleContext) { - try { - return rule.create(ruleContext); - } catch (ex) { - ex.message = `Error while loading rule '${ruleContext.id}': ${ex.message}`; - throw ex; - } -} - -// methods that exist on SourceCode object -const DEPRECATED_SOURCECODE_PASSTHROUGHS = { - getSource: "getText", - getSourceLines: "getLines", - getAllComments: "getAllComments", - getNodeByRangeIndex: "getNodeByRangeIndex", - getComments: "getComments", - getCommentsBefore: "getCommentsBefore", - getCommentsAfter: "getCommentsAfter", - getCommentsInside: "getCommentsInside", - getJSDocComment: "getJSDocComment", - getFirstToken: "getFirstToken", - getFirstTokens: "getFirstTokens", - getLastToken: "getLastToken", - getLastTokens: "getLastTokens", - getTokenAfter: "getTokenAfter", - getTokenBefore: "getTokenBefore", - getTokenByRangeStart: "getTokenByRangeStart", - getTokens: "getTokens", - getTokensAfter: "getTokensAfter", - getTokensBefore: "getTokensBefore", - getTokensBetween: "getTokensBetween" -}; - -const BASE_TRAVERSAL_CONTEXT = Object.freeze( - Object.keys(DEPRECATED_SOURCECODE_PASSTHROUGHS).reduce( - (contextInfo, methodName) => - Object.assign(contextInfo, { - [methodName](...args) { - return this.sourceCode[DEPRECATED_SOURCECODE_PASSTHROUGHS[methodName]](...args); - } - }), - {} - ) -); - -/** - * Runs the given rules on the given SourceCode object - * @param {SourceCode} sourceCode A SourceCode object for the given text - * @param {Object} configuredRules The rules configuration - * @param {function(string): Rule} ruleMapper A mapper function from rule names to rules - * @param {string | undefined} parserName The name of the parser in the config - * @param {LanguageOptions} languageOptions The options for parsing the code. - * @param {Object} settings The settings that were enabled in the config - * @param {string} filename The reported filename of the code - * @param {boolean} disableFixes If true, it doesn't make `fix` properties. - * @param {string | undefined} cwd cwd of the cli - * @param {string} physicalFilename The full path of the file on disk without any code block information - * @returns {LintMessage[]} An array of reported problems - */ -function runRules(sourceCode, configuredRules, ruleMapper, parserName, languageOptions, settings, filename, disableFixes, cwd, physicalFilename) { - const emitter = createEmitter(); - const nodeQueue = []; - let currentNode = sourceCode.ast; - - Traverser.traverse(sourceCode.ast, { - enter(node, parent) { - node.parent = parent; - nodeQueue.push({ isEntering: true, node }); - }, - leave(node) { - nodeQueue.push({ isEntering: false, node }); - }, - visitorKeys: sourceCode.visitorKeys - }); - - /* - * Create a frozen object with the ruleContext properties and methods that are shared by all rules. - * All rule contexts will inherit from this object. This avoids the performance penalty of copying all the - * properties once for each rule. - */ - const sharedTraversalContext = Object.freeze( - Object.assign( - Object.create(BASE_TRAVERSAL_CONTEXT), - { - getAncestors: () => sourceCode.getAncestors(currentNode), - getDeclaredVariables: node => sourceCode.getDeclaredVariables(node), - getCwd: () => cwd, - cwd, - getFilename: () => filename, - filename, - getPhysicalFilename: () => physicalFilename || filename, - physicalFilename: physicalFilename || filename, - getScope: () => sourceCode.getScope(currentNode), - getSourceCode: () => sourceCode, - sourceCode, - markVariableAsUsed: name => sourceCode.markVariableAsUsed(name, currentNode), - parserOptions: { - ...languageOptions.parserOptions - }, - parserPath: parserName, - languageOptions, - parserServices: sourceCode.parserServices, - settings - } - ) - ); - - const lintingProblems = []; - - Object.keys(configuredRules).forEach(ruleId => { - const severity = ConfigOps.getRuleSeverity(configuredRules[ruleId]); - - // not load disabled rules - if (severity === 0) { - return; - } - - const rule = ruleMapper(ruleId); - - if (!rule) { - lintingProblems.push(createLintingProblem({ ruleId })); - return; - } - - const messageIds = rule.meta && rule.meta.messages; - let reportTranslator = null; - const ruleContext = Object.freeze( - Object.assign( - Object.create(sharedTraversalContext), - { - id: ruleId, - options: getRuleOptions(configuredRules[ruleId]), - report(...args) { - - /* - * Create a report translator lazily. - * In a vast majority of cases, any given rule reports zero errors on a given - * piece of code. Creating a translator lazily avoids the performance cost of - * creating a new translator function for each rule that usually doesn't get - * called. - * - * Using lazy report translators improves end-to-end performance by about 3% - * with Node 8.4.0. - */ - if (reportTranslator === null) { - reportTranslator = createReportTranslator({ - ruleId, - severity, - sourceCode, - messageIds, - disableFixes - }); - } - const problem = reportTranslator(...args); - - if (problem.fix && !(rule.meta && rule.meta.fixable)) { - throw new Error("Fixable rules must set the `meta.fixable` property to \"code\" or \"whitespace\"."); - } - if (problem.suggestions && !(rule.meta && rule.meta.hasSuggestions === true)) { - if (rule.meta && rule.meta.docs && typeof rule.meta.docs.suggestion !== "undefined") { - - // Encourage migration from the former property name. - throw new Error("Rules with suggestions must set the `meta.hasSuggestions` property to `true`. `meta.docs.suggestion` is ignored by ESLint."); - } - throw new Error("Rules with suggestions must set the `meta.hasSuggestions` property to `true`."); - } - lintingProblems.push(problem); - } - } - ) - ); - - const ruleListeners = timing.enabled ? timing.time(ruleId, createRuleListeners)(rule, ruleContext) : createRuleListeners(rule, ruleContext); - - /** - * Include `ruleId` in error logs - * @param {Function} ruleListener A rule method that listens for a node. - * @returns {Function} ruleListener wrapped in error handler - */ - function addRuleErrorHandler(ruleListener) { - return function ruleErrorHandler(...listenerArgs) { - try { - return ruleListener(...listenerArgs); - } catch (e) { - e.ruleId = ruleId; - throw e; - } - }; - } - - if (typeof ruleListeners === "undefined" || ruleListeners === null) { - throw new Error(`The create() function for rule '${ruleId}' did not return an object.`); - } - - // add all the selectors from the rule as listeners - Object.keys(ruleListeners).forEach(selector => { - const ruleListener = timing.enabled - ? timing.time(ruleId, ruleListeners[selector]) - : ruleListeners[selector]; - - emitter.on( - selector, - addRuleErrorHandler(ruleListener) - ); - }); - }); - - // only run code path analyzer if the top level node is "Program", skip otherwise - const eventGenerator = nodeQueue[0].node.type === "Program" - ? new CodePathAnalyzer(new NodeEventGenerator(emitter, { visitorKeys: sourceCode.visitorKeys, fallback: Traverser.getKeys })) - : new NodeEventGenerator(emitter, { visitorKeys: sourceCode.visitorKeys, fallback: Traverser.getKeys }); - - nodeQueue.forEach(traversalInfo => { - currentNode = traversalInfo.node; - - try { - if (traversalInfo.isEntering) { - eventGenerator.enterNode(currentNode); - } else { - eventGenerator.leaveNode(currentNode); - } - } catch (err) { - err.currentNode = currentNode; - throw err; - } - }); - - return lintingProblems; -} - -/** - * Ensure the source code to be a string. - * @param {string|SourceCode} textOrSourceCode The text or source code object. - * @returns {string} The source code text. - */ -function ensureText(textOrSourceCode) { - if (typeof textOrSourceCode === "object") { - const { hasBOM, text } = textOrSourceCode; - const bom = hasBOM ? "\uFEFF" : ""; - - return bom + text; - } - - return String(textOrSourceCode); -} - -/** - * Get an environment. - * @param {LinterInternalSlots} slots The internal slots of Linter. - * @param {string} envId The environment ID to get. - * @returns {Environment|null} The environment. - */ -function getEnv(slots, envId) { - return ( - (slots.lastConfigArray && slots.lastConfigArray.pluginEnvironments.get(envId)) || - BuiltInEnvironments.get(envId) || - null - ); -} - -/** - * Get a rule. - * @param {LinterInternalSlots} slots The internal slots of Linter. - * @param {string} ruleId The rule ID to get. - * @returns {Rule|null} The rule. - */ -function getRule(slots, ruleId) { - return ( - (slots.lastConfigArray && slots.lastConfigArray.pluginRules.get(ruleId)) || - slots.ruleMap.get(ruleId) - ); -} - -/** - * Normalize the value of the cwd - * @param {string | undefined} cwd raw value of the cwd, path to a directory that should be considered as the current working directory, can be undefined. - * @returns {string | undefined} normalized cwd - */ -function normalizeCwd(cwd) { - if (cwd) { - return cwd; - } - if (typeof process === "object") { - return process.cwd(); - } - - // It's more explicit to assign the undefined - // eslint-disable-next-line no-undefined -- Consistently returning a value - return undefined; -} - -/** - * The map to store private data. - * @type {WeakMap} - */ -const internalSlotsMap = new WeakMap(); - -/** - * Throws an error when the given linter is in flat config mode. - * @param {Linter} linter The linter to check. - * @returns {void} - * @throws {Error} If the linter is in flat config mode. - */ -function assertEslintrcConfig(linter) { - const { configType } = internalSlotsMap.get(linter); - - if (configType === "flat") { - throw new Error("This method cannot be used with flat config. Add your entries directly into the config array."); - } -} - - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Object that is responsible for verifying JavaScript text - * @name Linter - */ -class Linter { - - /** - * Initialize the Linter. - * @param {Object} [config] the config object - * @param {string} [config.cwd] path to a directory that should be considered as the current working directory, can be undefined. - * @param {"flat"|"eslintrc"} [config.configType="eslintrc"] the type of config used. - */ - constructor({ cwd, configType } = {}) { - internalSlotsMap.set(this, { - cwd: normalizeCwd(cwd), - lastConfigArray: null, - lastSourceCode: null, - lastSuppressedMessages: [], - configType, // TODO: Remove after flat config conversion - parserMap: new Map([["espree", espree]]), - ruleMap: new Rules() - }); - - this.version = pkg.version; - } - - /** - * Getter for package version. - * @static - * @returns {string} The version from package.json. - */ - static get version() { - return pkg.version; - } - - /** - * Same as linter.verify, except without support for processors. - * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object. - * @param {ConfigData} providedConfig An ESLintConfig instance to configure everything. - * @param {VerifyOptions} [providedOptions] The optional filename of the file being checked. - * @throws {Error} If during rule execution. - * @returns {(LintMessage|SuppressedLintMessage)[]} The results as an array of messages or an empty array if no messages. - */ - _verifyWithoutProcessors(textOrSourceCode, providedConfig, providedOptions) { - const slots = internalSlotsMap.get(this); - const config = providedConfig || {}; - const options = normalizeVerifyOptions(providedOptions, config); - let text; - - // evaluate arguments - if (typeof textOrSourceCode === "string") { - slots.lastSourceCode = null; - text = textOrSourceCode; - } else { - slots.lastSourceCode = textOrSourceCode; - text = textOrSourceCode.text; - } - - // Resolve parser. - let parserName = DEFAULT_PARSER_NAME; - let parser = espree; - - if (typeof config.parser === "object" && config.parser !== null) { - parserName = config.parser.filePath; - parser = config.parser.definition; - } else if (typeof config.parser === "string") { - if (!slots.parserMap.has(config.parser)) { - return [{ - ruleId: null, - fatal: true, - severity: 2, - message: `Configured parser '${config.parser}' was not found.`, - line: 0, - column: 0, - nodeType: null - }]; - } - parserName = config.parser; - parser = slots.parserMap.get(config.parser); - } - - // search and apply "eslint-env *". - const envInFile = options.allowInlineConfig && !options.warnInlineConfig - ? findEslintEnv(text) - : {}; - const resolvedEnvConfig = Object.assign({ builtin: true }, config.env, envInFile); - const enabledEnvs = Object.keys(resolvedEnvConfig) - .filter(envName => resolvedEnvConfig[envName]) - .map(envName => getEnv(slots, envName)) - .filter(env => env); - - const parserOptions = resolveParserOptions(parser, config.parserOptions || {}, enabledEnvs); - const configuredGlobals = resolveGlobals(config.globals || {}, enabledEnvs); - const settings = config.settings || {}; - const languageOptions = createLanguageOptions({ - globals: config.globals, - parser, - parserOptions - }); - - if (!slots.lastSourceCode) { - const parseResult = parse( - text, - languageOptions, - options.filename - ); - - if (!parseResult.success) { - return [parseResult.error]; - } - - slots.lastSourceCode = parseResult.sourceCode; - } else { - - /* - * If the given source code object as the first argument does not have scopeManager, analyze the scope. - * This is for backward compatibility (SourceCode is frozen so it cannot rebind). - */ - if (!slots.lastSourceCode.scopeManager) { - slots.lastSourceCode = new SourceCode({ - text: slots.lastSourceCode.text, - ast: slots.lastSourceCode.ast, - parserServices: slots.lastSourceCode.parserServices, - visitorKeys: slots.lastSourceCode.visitorKeys, - scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions) - }); - } - } - - const sourceCode = slots.lastSourceCode; - const commentDirectives = options.allowInlineConfig - ? getDirectiveComments(sourceCode.ast, ruleId => getRule(slots, ruleId), options.warnInlineConfig) - : { configuredRules: {}, enabledGlobals: {}, exportedVariables: {}, problems: [], disableDirectives: [] }; - - // augment global scope with declared global variables - addDeclaredGlobals( - sourceCode.scopeManager.scopes[0], - configuredGlobals, - { exportedVariables: commentDirectives.exportedVariables, enabledGlobals: commentDirectives.enabledGlobals } - ); - - const configuredRules = Object.assign({}, config.rules, commentDirectives.configuredRules); - - let lintingProblems; - - try { - lintingProblems = runRules( - sourceCode, - configuredRules, - ruleId => getRule(slots, ruleId), - parserName, - languageOptions, - settings, - options.filename, - options.disableFixes, - slots.cwd, - providedOptions.physicalFilename - ); - } catch (err) { - err.message += `\nOccurred while linting ${options.filename}`; - debug("An error occurred while traversing"); - debug("Filename:", options.filename); - if (err.currentNode) { - const { line } = err.currentNode.loc.start; - - debug("Line:", line); - err.message += `:${line}`; - } - debug("Parser Options:", parserOptions); - debug("Parser Path:", parserName); - debug("Settings:", settings); - - if (err.ruleId) { - err.message += `\nRule: "${err.ruleId}"`; - } - - throw err; - } - - return applyDisableDirectives({ - directives: commentDirectives.disableDirectives, - disableFixes: options.disableFixes, - problems: lintingProblems - .concat(commentDirectives.problems) - .sort((problemA, problemB) => problemA.line - problemB.line || problemA.column - problemB.column), - reportUnusedDisableDirectives: options.reportUnusedDisableDirectives - }); - } - - /** - * Verifies the text against the rules specified by the second argument. - * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object. - * @param {ConfigData|ConfigArray} config An ESLintConfig instance to configure everything. - * @param {(string|(VerifyOptions&ProcessorOptions))} [filenameOrOptions] The optional filename of the file being checked. - * If this is not set, the filename will default to '' in the rule context. If - * an object, then it has "filename", "allowInlineConfig", and some properties. - * @returns {LintMessage[]} The results as an array of messages or an empty array if no messages. - */ - verify(textOrSourceCode, config, filenameOrOptions) { - debug("Verify"); - - const { configType } = internalSlotsMap.get(this); - - const options = typeof filenameOrOptions === "string" - ? { filename: filenameOrOptions } - : filenameOrOptions || {}; - - if (config) { - if (configType === "flat") { - - /* - * Because of how Webpack packages up the files, we can't - * compare directly to `FlatConfigArray` using `instanceof` - * because it's not the same `FlatConfigArray` as in the tests. - * So, we work around it by assuming an array is, in fact, a - * `FlatConfigArray` if it has a `getConfig()` method. - */ - let configArray = config; - - if (!Array.isArray(config) || typeof config.getConfig !== "function") { - configArray = new FlatConfigArray(config); - configArray.normalizeSync(); - } - - return this._distinguishSuppressedMessages(this._verifyWithFlatConfigArray(textOrSourceCode, configArray, options, true)); - } - - if (typeof config.extractConfig === "function") { - return this._distinguishSuppressedMessages(this._verifyWithConfigArray(textOrSourceCode, config, options)); - } - } - - /* - * If we get to here, it means `config` is just an object rather - * than a config array so we can go right into linting. - */ - - /* - * `Linter` doesn't support `overrides` property in configuration. - * So we cannot apply multiple processors. - */ - if (options.preprocess || options.postprocess) { - return this._distinguishSuppressedMessages(this._verifyWithProcessor(textOrSourceCode, config, options)); - } - return this._distinguishSuppressedMessages(this._verifyWithoutProcessors(textOrSourceCode, config, options)); - } - - /** - * Verify with a processor. - * @param {string|SourceCode} textOrSourceCode The source code. - * @param {FlatConfig} config The config array. - * @param {VerifyOptions&ProcessorOptions} options The options. - * @param {FlatConfigArray} [configForRecursive] The `ConfigArray` object to apply multiple processors recursively. - * @returns {(LintMessage|SuppressedLintMessage)[]} The found problems. - */ - _verifyWithFlatConfigArrayAndProcessor(textOrSourceCode, config, options, configForRecursive) { - const filename = options.filename || ""; - const filenameToExpose = normalizeFilename(filename); - const physicalFilename = options.physicalFilename || filenameToExpose; - const text = ensureText(textOrSourceCode); - const preprocess = options.preprocess || (rawText => [rawText]); - const postprocess = options.postprocess || (messagesList => messagesList.flat()); - const filterCodeBlock = - options.filterCodeBlock || - (blockFilename => blockFilename.endsWith(".js")); - const originalExtname = path.extname(filename); - - let blocks; - - try { - blocks = preprocess(text, filenameToExpose); - } catch (ex) { - - // If the message includes a leading line number, strip it: - const message = `Preprocessing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`; - - debug("%s\n%s", message, ex.stack); - - return [ - { - ruleId: null, - fatal: true, - severity: 2, - message, - line: ex.lineNumber, - column: ex.column, - nodeType: null - } - ]; - } - - const messageLists = blocks.map((block, i) => { - debug("A code block was found: %o", block.filename || "(unnamed)"); - - // Keep the legacy behavior. - if (typeof block === "string") { - return this._verifyWithFlatConfigArrayAndWithoutProcessors(block, config, options); - } - - const blockText = block.text; - const blockName = path.join(filename, `${i}_${block.filename}`); - - // Skip this block if filtered. - if (!filterCodeBlock(blockName, blockText)) { - debug("This code block was skipped."); - return []; - } - - // Resolve configuration again if the file content or extension was changed. - if (configForRecursive && (text !== blockText || path.extname(blockName) !== originalExtname)) { - debug("Resolving configuration again because the file content or extension was changed."); - return this._verifyWithFlatConfigArray( - blockText, - configForRecursive, - { ...options, filename: blockName, physicalFilename } - ); - } - - // Does lint. - return this._verifyWithFlatConfigArrayAndWithoutProcessors( - blockText, - config, - { ...options, filename: blockName, physicalFilename } - ); - }); - - return postprocess(messageLists, filenameToExpose); - } - - /** - * Same as linter.verify, except without support for processors. - * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object. - * @param {FlatConfig} providedConfig An ESLintConfig instance to configure everything. - * @param {VerifyOptions} [providedOptions] The optional filename of the file being checked. - * @throws {Error} If during rule execution. - * @returns {(LintMessage|SuppressedLintMessage)[]} The results as an array of messages or an empty array if no messages. - */ - _verifyWithFlatConfigArrayAndWithoutProcessors(textOrSourceCode, providedConfig, providedOptions) { - const slots = internalSlotsMap.get(this); - const config = providedConfig || {}; - const options = normalizeVerifyOptions(providedOptions, config); - let text; - - // evaluate arguments - if (typeof textOrSourceCode === "string") { - slots.lastSourceCode = null; - text = textOrSourceCode; - } else { - slots.lastSourceCode = textOrSourceCode; - text = textOrSourceCode.text; - } - - const languageOptions = config.languageOptions; - - languageOptions.ecmaVersion = normalizeEcmaVersionForLanguageOptions( - languageOptions.ecmaVersion - ); - - /* - * add configured globals and language globals - * - * using Object.assign instead of object spread for performance reasons - * https://github.com/eslint/eslint/issues/16302 - */ - const configuredGlobals = Object.assign( - {}, - getGlobalsForEcmaVersion(languageOptions.ecmaVersion), - languageOptions.sourceType === "commonjs" ? globals.commonjs : void 0, - languageOptions.globals - ); - - // double check that there is a parser to avoid mysterious error messages - if (!languageOptions.parser) { - throw new TypeError(`No parser specified for ${options.filename}`); - } - - // Espree expects this information to be passed in - if (isEspree(languageOptions.parser)) { - const parserOptions = languageOptions.parserOptions; - - if (languageOptions.sourceType) { - - parserOptions.sourceType = languageOptions.sourceType; - - if ( - parserOptions.sourceType === "module" && - parserOptions.ecmaFeatures && - parserOptions.ecmaFeatures.globalReturn - ) { - parserOptions.ecmaFeatures.globalReturn = false; - } - } - } - - const settings = config.settings || {}; - - if (!slots.lastSourceCode) { - const parseResult = parse( - text, - languageOptions, - options.filename - ); - - if (!parseResult.success) { - return [parseResult.error]; - } - - slots.lastSourceCode = parseResult.sourceCode; - } else { - - /* - * If the given source code object as the first argument does not have scopeManager, analyze the scope. - * This is for backward compatibility (SourceCode is frozen so it cannot rebind). - */ - if (!slots.lastSourceCode.scopeManager) { - slots.lastSourceCode = new SourceCode({ - text: slots.lastSourceCode.text, - ast: slots.lastSourceCode.ast, - parserServices: slots.lastSourceCode.parserServices, - visitorKeys: slots.lastSourceCode.visitorKeys, - scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions) - }); - } - } - - const sourceCode = slots.lastSourceCode; - const commentDirectives = options.allowInlineConfig - ? getDirectiveComments( - sourceCode.ast, - ruleId => getRuleFromConfig(ruleId, config), - options.warnInlineConfig - ) - : { configuredRules: {}, enabledGlobals: {}, exportedVariables: {}, problems: [], disableDirectives: [] }; - - // augment global scope with declared global variables - addDeclaredGlobals( - sourceCode.scopeManager.scopes[0], - configuredGlobals, - { exportedVariables: commentDirectives.exportedVariables, enabledGlobals: commentDirectives.enabledGlobals } - ); - - const configuredRules = Object.assign({}, config.rules, commentDirectives.configuredRules); - - let lintingProblems; - - try { - lintingProblems = runRules( - sourceCode, - configuredRules, - ruleId => getRuleFromConfig(ruleId, config), - void 0, - languageOptions, - settings, - options.filename, - options.disableFixes, - slots.cwd, - providedOptions.physicalFilename - ); - } catch (err) { - err.message += `\nOccurred while linting ${options.filename}`; - debug("An error occurred while traversing"); - debug("Filename:", options.filename); - if (err.currentNode) { - const { line } = err.currentNode.loc.start; - - debug("Line:", line); - err.message += `:${line}`; - } - debug("Parser Options:", languageOptions.parserOptions); - - // debug("Parser Path:", parserName); - debug("Settings:", settings); - - if (err.ruleId) { - err.message += `\nRule: "${err.ruleId}"`; - } - - throw err; - } - - return applyDisableDirectives({ - directives: commentDirectives.disableDirectives, - disableFixes: options.disableFixes, - problems: lintingProblems - .concat(commentDirectives.problems) - .sort((problemA, problemB) => problemA.line - problemB.line || problemA.column - problemB.column), - reportUnusedDisableDirectives: options.reportUnusedDisableDirectives - }); - } - - /** - * Verify a given code with `ConfigArray`. - * @param {string|SourceCode} textOrSourceCode The source code. - * @param {ConfigArray} configArray The config array. - * @param {VerifyOptions&ProcessorOptions} options The options. - * @returns {(LintMessage|SuppressedLintMessage)[]} The found problems. - */ - _verifyWithConfigArray(textOrSourceCode, configArray, options) { - debug("With ConfigArray: %s", options.filename); - - // Store the config array in order to get plugin envs and rules later. - internalSlotsMap.get(this).lastConfigArray = configArray; - - // Extract the final config for this file. - const config = configArray.extractConfig(options.filename); - const processor = - config.processor && - configArray.pluginProcessors.get(config.processor); - - // Verify. - if (processor) { - debug("Apply the processor: %o", config.processor); - const { preprocess, postprocess, supportsAutofix } = processor; - const disableFixes = options.disableFixes || !supportsAutofix; - - return this._verifyWithProcessor( - textOrSourceCode, - config, - { ...options, disableFixes, postprocess, preprocess }, - configArray - ); - } - return this._verifyWithoutProcessors(textOrSourceCode, config, options); - } - - /** - * Verify a given code with a flat config. - * @param {string|SourceCode} textOrSourceCode The source code. - * @param {FlatConfigArray} configArray The config array. - * @param {VerifyOptions&ProcessorOptions} options The options. - * @param {boolean} [firstCall=false] Indicates if this is being called directly - * from verify(). (TODO: Remove once eslintrc is removed.) - * @returns {(LintMessage|SuppressedLintMessage)[]} The found problems. - */ - _verifyWithFlatConfigArray(textOrSourceCode, configArray, options, firstCall = false) { - debug("With flat config: %s", options.filename); - - // we need a filename to match configs against - const filename = options.filename || "__placeholder__.js"; - - // Store the config array in order to get plugin envs and rules later. - internalSlotsMap.get(this).lastConfigArray = configArray; - const config = configArray.getConfig(filename); - - if (!config) { - return [ - { - ruleId: null, - severity: 1, - message: `No matching configuration found for ${filename}.`, - line: 0, - column: 0, - nodeType: null - } - ]; - } - - // Verify. - if (config.processor) { - debug("Apply the processor: %o", config.processor); - const { preprocess, postprocess, supportsAutofix } = config.processor; - const disableFixes = options.disableFixes || !supportsAutofix; - - return this._verifyWithFlatConfigArrayAndProcessor( - textOrSourceCode, - config, - { ...options, filename, disableFixes, postprocess, preprocess }, - configArray - ); - } - - // check for options-based processing - if (firstCall && (options.preprocess || options.postprocess)) { - return this._verifyWithFlatConfigArrayAndProcessor(textOrSourceCode, config, options); - } - - return this._verifyWithFlatConfigArrayAndWithoutProcessors(textOrSourceCode, config, options); - } - - /** - * Verify with a processor. - * @param {string|SourceCode} textOrSourceCode The source code. - * @param {ConfigData|ExtractedConfig} config The config array. - * @param {VerifyOptions&ProcessorOptions} options The options. - * @param {ConfigArray} [configForRecursive] The `ConfigArray` object to apply multiple processors recursively. - * @returns {(LintMessage|SuppressedLintMessage)[]} The found problems. - */ - _verifyWithProcessor(textOrSourceCode, config, options, configForRecursive) { - const filename = options.filename || ""; - const filenameToExpose = normalizeFilename(filename); - const physicalFilename = options.physicalFilename || filenameToExpose; - const text = ensureText(textOrSourceCode); - const preprocess = options.preprocess || (rawText => [rawText]); - const postprocess = options.postprocess || (messagesList => messagesList.flat()); - const filterCodeBlock = - options.filterCodeBlock || - (blockFilename => blockFilename.endsWith(".js")); - const originalExtname = path.extname(filename); - - let blocks; - - try { - blocks = preprocess(text, filenameToExpose); - } catch (ex) { - - // If the message includes a leading line number, strip it: - const message = `Preprocessing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`; - - debug("%s\n%s", message, ex.stack); - - return [ - { - ruleId: null, - fatal: true, - severity: 2, - message, - line: ex.lineNumber, - column: ex.column, - nodeType: null - } - ]; - } - - const messageLists = blocks.map((block, i) => { - debug("A code block was found: %o", block.filename || "(unnamed)"); - - // Keep the legacy behavior. - if (typeof block === "string") { - return this._verifyWithoutProcessors(block, config, options); - } - - const blockText = block.text; - const blockName = path.join(filename, `${i}_${block.filename}`); - - // Skip this block if filtered. - if (!filterCodeBlock(blockName, blockText)) { - debug("This code block was skipped."); - return []; - } - - // Resolve configuration again if the file content or extension was changed. - if (configForRecursive && (text !== blockText || path.extname(blockName) !== originalExtname)) { - debug("Resolving configuration again because the file content or extension was changed."); - return this._verifyWithConfigArray( - blockText, - configForRecursive, - { ...options, filename: blockName, physicalFilename } - ); - } - - // Does lint. - return this._verifyWithoutProcessors( - blockText, - config, - { ...options, filename: blockName, physicalFilename } - ); - }); - - return postprocess(messageLists, filenameToExpose); - } - - /** - * Given a list of reported problems, distinguish problems between normal messages and suppressed messages. - * The normal messages will be returned and the suppressed messages will be stored as lastSuppressedMessages. - * @param {Array} problems A list of reported problems. - * @returns {LintMessage[]} A list of LintMessage. - */ - _distinguishSuppressedMessages(problems) { - const messages = []; - const suppressedMessages = []; - const slots = internalSlotsMap.get(this); - - for (const problem of problems) { - if (problem.suppressions) { - suppressedMessages.push(problem); - } else { - messages.push(problem); - } - } - - slots.lastSuppressedMessages = suppressedMessages; - - return messages; - } - - /** - * Gets the SourceCode object representing the parsed source. - * @returns {SourceCode} The SourceCode object. - */ - getSourceCode() { - return internalSlotsMap.get(this).lastSourceCode; - } - - /** - * Gets the list of SuppressedLintMessage produced in the last running. - * @returns {SuppressedLintMessage[]} The list of SuppressedLintMessage - */ - getSuppressedMessages() { - return internalSlotsMap.get(this).lastSuppressedMessages; - } - - /** - * Defines a new linting rule. - * @param {string} ruleId A unique rule identifier - * @param {Function | Rule} ruleModule Function from context to object mapping AST node types to event handlers - * @returns {void} - */ - defineRule(ruleId, ruleModule) { - assertEslintrcConfig(this); - internalSlotsMap.get(this).ruleMap.define(ruleId, ruleModule); - } - - /** - * Defines many new linting rules. - * @param {Record} rulesToDefine map from unique rule identifier to rule - * @returns {void} - */ - defineRules(rulesToDefine) { - assertEslintrcConfig(this); - Object.getOwnPropertyNames(rulesToDefine).forEach(ruleId => { - this.defineRule(ruleId, rulesToDefine[ruleId]); - }); - } - - /** - * Gets an object with all loaded rules. - * @returns {Map} All loaded rules - */ - getRules() { - assertEslintrcConfig(this); - const { lastConfigArray, ruleMap } = internalSlotsMap.get(this); - - return new Map(function *() { - yield* ruleMap; - - if (lastConfigArray) { - yield* lastConfigArray.pluginRules; - } - }()); - } - - /** - * Define a new parser module - * @param {string} parserId Name of the parser - * @param {Parser} parserModule The parser object - * @returns {void} - */ - defineParser(parserId, parserModule) { - assertEslintrcConfig(this); - internalSlotsMap.get(this).parserMap.set(parserId, parserModule); - } - - /** - * Performs multiple autofix passes over the text until as many fixes as possible - * have been applied. - * @param {string} text The source text to apply fixes to. - * @param {ConfigData|ConfigArray|FlatConfigArray} config The ESLint config object to use. - * @param {VerifyOptions&ProcessorOptions&FixOptions} options The ESLint options object to use. - * @returns {{fixed:boolean,messages:LintMessage[],output:string}} The result of the fix operation as returned from the - * SourceCodeFixer. - */ - verifyAndFix(text, config, options) { - let messages = [], - fixedResult, - fixed = false, - passNumber = 0, - currentText = text; - const debugTextDescription = options && options.filename || `${text.slice(0, 10)}...`; - const shouldFix = options && typeof options.fix !== "undefined" ? options.fix : true; - - /** - * This loop continues until one of the following is true: - * - * 1. No more fixes have been applied. - * 2. Ten passes have been made. - * - * That means anytime a fix is successfully applied, there will be another pass. - * Essentially, guaranteeing a minimum of two passes. - */ - do { - passNumber++; - - debug(`Linting code for ${debugTextDescription} (pass ${passNumber})`); - messages = this.verify(currentText, config, options); - - debug(`Generating fixed text for ${debugTextDescription} (pass ${passNumber})`); - fixedResult = SourceCodeFixer.applyFixes(currentText, messages, shouldFix); - - /* - * stop if there are any syntax errors. - * 'fixedResult.output' is a empty string. - */ - if (messages.length === 1 && messages[0].fatal) { - break; - } - - // keep track if any fixes were ever applied - important for return value - fixed = fixed || fixedResult.fixed; - - // update to use the fixed output instead of the original text - currentText = fixedResult.output; - - } while ( - fixedResult.fixed && - passNumber < MAX_AUTOFIX_PASSES - ); - - /* - * If the last result had fixes, we need to lint again to be sure we have - * the most up-to-date information. - */ - if (fixedResult.fixed) { - fixedResult.messages = this.verify(currentText, config, options); - } - - // ensure the last result properly reflects if fixes were done - fixedResult.fixed = fixed; - fixedResult.output = currentText; - - return fixedResult; - } -} - -module.exports = { - Linter, - - /** - * Get the internal slots of a given Linter instance for tests. - * @param {Linter} instance The Linter instance to get. - * @returns {LinterInternalSlots} The internal slots. - */ - getLinterInternalSlots(instance) { - return internalSlotsMap.get(instance); - } -}; diff --git a/node_modules/eslint/lib/linter/node-event-generator.js b/node_modules/eslint/lib/linter/node-event-generator.js deleted file mode 100644 index d56bef2fa..000000000 --- a/node_modules/eslint/lib/linter/node-event-generator.js +++ /dev/null @@ -1,354 +0,0 @@ -/** - * @fileoverview The event generator for AST nodes. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const esquery = require("esquery"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** - * An object describing an AST selector - * @typedef {Object} ASTSelector - * @property {string} rawSelector The string that was parsed into this selector - * @property {boolean} isExit `true` if this should be emitted when exiting the node rather than when entering - * @property {Object} parsedSelector An object (from esquery) describing the matching behavior of the selector - * @property {string[]|null} listenerTypes A list of node types that could possibly cause the selector to match, - * or `null` if all node types could cause a match - * @property {number} attributeCount The total number of classes, pseudo-classes, and attribute queries in this selector - * @property {number} identifierCount The total number of identifier queries in this selector - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Computes the union of one or more arrays - * @param {...any[]} arrays One or more arrays to union - * @returns {any[]} The union of the input arrays - */ -function union(...arrays) { - return [...new Set(arrays.flat())]; -} - -/** - * Computes the intersection of one or more arrays - * @param {...any[]} arrays One or more arrays to intersect - * @returns {any[]} The intersection of the input arrays - */ -function intersection(...arrays) { - if (arrays.length === 0) { - return []; - } - - let result = [...new Set(arrays[0])]; - - for (const array of arrays.slice(1)) { - result = result.filter(x => array.includes(x)); - } - return result; -} - -/** - * Gets the possible types of a selector - * @param {Object} parsedSelector An object (from esquery) describing the matching behavior of the selector - * @returns {string[]|null} The node types that could possibly trigger this selector, or `null` if all node types could trigger it - */ -function getPossibleTypes(parsedSelector) { - switch (parsedSelector.type) { - case "identifier": - return [parsedSelector.value]; - - case "matches": { - const typesForComponents = parsedSelector.selectors.map(getPossibleTypes); - - if (typesForComponents.every(Boolean)) { - return union(...typesForComponents); - } - return null; - } - - case "compound": { - const typesForComponents = parsedSelector.selectors.map(getPossibleTypes).filter(typesForComponent => typesForComponent); - - // If all of the components could match any type, then the compound could also match any type. - if (!typesForComponents.length) { - return null; - } - - /* - * If at least one of the components could only match a particular type, the compound could only match - * the intersection of those types. - */ - return intersection(...typesForComponents); - } - - case "child": - case "descendant": - case "sibling": - case "adjacent": - return getPossibleTypes(parsedSelector.right); - - case "class": - if (parsedSelector.name === "function") { - return ["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]; - } - - return null; - - default: - return null; - - } -} - -/** - * Counts the number of class, pseudo-class, and attribute queries in this selector - * @param {Object} parsedSelector An object (from esquery) describing the selector's matching behavior - * @returns {number} The number of class, pseudo-class, and attribute queries in this selector - */ -function countClassAttributes(parsedSelector) { - switch (parsedSelector.type) { - case "child": - case "descendant": - case "sibling": - case "adjacent": - return countClassAttributes(parsedSelector.left) + countClassAttributes(parsedSelector.right); - - case "compound": - case "not": - case "matches": - return parsedSelector.selectors.reduce((sum, childSelector) => sum + countClassAttributes(childSelector), 0); - - case "attribute": - case "field": - case "nth-child": - case "nth-last-child": - return 1; - - default: - return 0; - } -} - -/** - * Counts the number of identifier queries in this selector - * @param {Object} parsedSelector An object (from esquery) describing the selector's matching behavior - * @returns {number} The number of identifier queries - */ -function countIdentifiers(parsedSelector) { - switch (parsedSelector.type) { - case "child": - case "descendant": - case "sibling": - case "adjacent": - return countIdentifiers(parsedSelector.left) + countIdentifiers(parsedSelector.right); - - case "compound": - case "not": - case "matches": - return parsedSelector.selectors.reduce((sum, childSelector) => sum + countIdentifiers(childSelector), 0); - - case "identifier": - return 1; - - default: - return 0; - } -} - -/** - * Compares the specificity of two selector objects, with CSS-like rules. - * @param {ASTSelector} selectorA An AST selector descriptor - * @param {ASTSelector} selectorB Another AST selector descriptor - * @returns {number} - * a value less than 0 if selectorA is less specific than selectorB - * a value greater than 0 if selectorA is more specific than selectorB - * a value less than 0 if selectorA and selectorB have the same specificity, and selectorA <= selectorB alphabetically - * a value greater than 0 if selectorA and selectorB have the same specificity, and selectorA > selectorB alphabetically - */ -function compareSpecificity(selectorA, selectorB) { - return selectorA.attributeCount - selectorB.attributeCount || - selectorA.identifierCount - selectorB.identifierCount || - (selectorA.rawSelector <= selectorB.rawSelector ? -1 : 1); -} - -/** - * Parses a raw selector string, and throws a useful error if parsing fails. - * @param {string} rawSelector A raw AST selector - * @returns {Object} An object (from esquery) describing the matching behavior of this selector - * @throws {Error} An error if the selector is invalid - */ -function tryParseSelector(rawSelector) { - try { - return esquery.parse(rawSelector.replace(/:exit$/u, "")); - } catch (err) { - if (err.location && err.location.start && typeof err.location.start.offset === "number") { - throw new SyntaxError(`Syntax error in selector "${rawSelector}" at position ${err.location.start.offset}: ${err.message}`); - } - throw err; - } -} - -const selectorCache = new Map(); - -/** - * Parses a raw selector string, and returns the parsed selector along with specificity and type information. - * @param {string} rawSelector A raw AST selector - * @returns {ASTSelector} A selector descriptor - */ -function parseSelector(rawSelector) { - if (selectorCache.has(rawSelector)) { - return selectorCache.get(rawSelector); - } - - const parsedSelector = tryParseSelector(rawSelector); - - const result = { - rawSelector, - isExit: rawSelector.endsWith(":exit"), - parsedSelector, - listenerTypes: getPossibleTypes(parsedSelector), - attributeCount: countClassAttributes(parsedSelector), - identifierCount: countIdentifiers(parsedSelector) - }; - - selectorCache.set(rawSelector, result); - return result; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * The event generator for AST nodes. - * This implements below interface. - * - * ```ts - * interface EventGenerator { - * emitter: SafeEmitter; - * enterNode(node: ASTNode): void; - * leaveNode(node: ASTNode): void; - * } - * ``` - */ -class NodeEventGenerator { - - /** - * @param {SafeEmitter} emitter - * An SafeEmitter which is the destination of events. This emitter must already - * have registered listeners for all of the events that it needs to listen for. - * (See lib/linter/safe-emitter.js for more details on `SafeEmitter`.) - * @param {ESQueryOptions} esqueryOptions `esquery` options for traversing custom nodes. - * @returns {NodeEventGenerator} new instance - */ - constructor(emitter, esqueryOptions) { - this.emitter = emitter; - this.esqueryOptions = esqueryOptions; - this.currentAncestry = []; - this.enterSelectorsByNodeType = new Map(); - this.exitSelectorsByNodeType = new Map(); - this.anyTypeEnterSelectors = []; - this.anyTypeExitSelectors = []; - - emitter.eventNames().forEach(rawSelector => { - const selector = parseSelector(rawSelector); - - if (selector.listenerTypes) { - const typeMap = selector.isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType; - - selector.listenerTypes.forEach(nodeType => { - if (!typeMap.has(nodeType)) { - typeMap.set(nodeType, []); - } - typeMap.get(nodeType).push(selector); - }); - return; - } - const selectors = selector.isExit ? this.anyTypeExitSelectors : this.anyTypeEnterSelectors; - - selectors.push(selector); - }); - - this.anyTypeEnterSelectors.sort(compareSpecificity); - this.anyTypeExitSelectors.sort(compareSpecificity); - this.enterSelectorsByNodeType.forEach(selectorList => selectorList.sort(compareSpecificity)); - this.exitSelectorsByNodeType.forEach(selectorList => selectorList.sort(compareSpecificity)); - } - - /** - * Checks a selector against a node, and emits it if it matches - * @param {ASTNode} node The node to check - * @param {ASTSelector} selector An AST selector descriptor - * @returns {void} - */ - applySelector(node, selector) { - if (esquery.matches(node, selector.parsedSelector, this.currentAncestry, this.esqueryOptions)) { - this.emitter.emit(selector.rawSelector, node); - } - } - - /** - * Applies all appropriate selectors to a node, in specificity order - * @param {ASTNode} node The node to check - * @param {boolean} isExit `false` if the node is currently being entered, `true` if it's currently being exited - * @returns {void} - */ - applySelectors(node, isExit) { - const selectorsByNodeType = (isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType).get(node.type) || []; - const anyTypeSelectors = isExit ? this.anyTypeExitSelectors : this.anyTypeEnterSelectors; - - /* - * selectorsByNodeType and anyTypeSelectors were already sorted by specificity in the constructor. - * Iterate through each of them, applying selectors in the right order. - */ - let selectorsByTypeIndex = 0; - let anyTypeSelectorsIndex = 0; - - while (selectorsByTypeIndex < selectorsByNodeType.length || anyTypeSelectorsIndex < anyTypeSelectors.length) { - if ( - selectorsByTypeIndex >= selectorsByNodeType.length || - anyTypeSelectorsIndex < anyTypeSelectors.length && - compareSpecificity(anyTypeSelectors[anyTypeSelectorsIndex], selectorsByNodeType[selectorsByTypeIndex]) < 0 - ) { - this.applySelector(node, anyTypeSelectors[anyTypeSelectorsIndex++]); - } else { - this.applySelector(node, selectorsByNodeType[selectorsByTypeIndex++]); - } - } - } - - /** - * Emits an event of entering AST node. - * @param {ASTNode} node A node which was entered. - * @returns {void} - */ - enterNode(node) { - if (node.parent) { - this.currentAncestry.unshift(node.parent); - } - this.applySelectors(node, false); - } - - /** - * Emits an event of leaving AST node. - * @param {ASTNode} node A node which was left. - * @returns {void} - */ - leaveNode(node) { - this.applySelectors(node, true); - this.currentAncestry.shift(); - } -} - -module.exports = NodeEventGenerator; diff --git a/node_modules/eslint/lib/linter/report-translator.js b/node_modules/eslint/lib/linter/report-translator.js deleted file mode 100644 index 7d2705206..000000000 --- a/node_modules/eslint/lib/linter/report-translator.js +++ /dev/null @@ -1,353 +0,0 @@ -/** - * @fileoverview A helper that translates context.report() calls from the rule API into generic problem objects - * @author Teddy Katz - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const assert = require("assert"); -const ruleFixer = require("./rule-fixer"); -const interpolate = require("./interpolate"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").LintMessage} LintMessage */ - -/** - * An error message description - * @typedef {Object} MessageDescriptor - * @property {ASTNode} [node] The reported node - * @property {Location} loc The location of the problem. - * @property {string} message The problem message. - * @property {Object} [data] Optional data to use to fill in placeholders in the - * message. - * @property {Function} [fix] The function to call that creates a fix command. - * @property {Array<{desc?: string, messageId?: string, fix: Function}>} suggest Suggestion descriptions and functions to create a the associated fixes. - */ - -//------------------------------------------------------------------------------ -// Module Definition -//------------------------------------------------------------------------------ - - -/** - * Translates a multi-argument context.report() call into a single object argument call - * @param {...*} args A list of arguments passed to `context.report` - * @returns {MessageDescriptor} A normalized object containing report information - */ -function normalizeMultiArgReportCall(...args) { - - // If there is one argument, it is considered to be a new-style call already. - if (args.length === 1) { - - // Shallow clone the object to avoid surprises if reusing the descriptor - return Object.assign({}, args[0]); - } - - // If the second argument is a string, the arguments are interpreted as [node, message, data, fix]. - if (typeof args[1] === "string") { - return { - node: args[0], - message: args[1], - data: args[2], - fix: args[3] - }; - } - - // Otherwise, the arguments are interpreted as [node, loc, message, data, fix]. - return { - node: args[0], - loc: args[1], - message: args[2], - data: args[3], - fix: args[4] - }; -} - -/** - * Asserts that either a loc or a node was provided, and the node is valid if it was provided. - * @param {MessageDescriptor} descriptor A descriptor to validate - * @returns {void} - * @throws AssertionError if neither a node nor a loc was provided, or if the node is not an object - */ -function assertValidNodeInfo(descriptor) { - if (descriptor.node) { - assert(typeof descriptor.node === "object", "Node must be an object"); - } else { - assert(descriptor.loc, "Node must be provided when reporting error if location is not provided"); - } -} - -/** - * Normalizes a MessageDescriptor to always have a `loc` with `start` and `end` properties - * @param {MessageDescriptor} descriptor A descriptor for the report from a rule. - * @returns {{start: Location, end: (Location|null)}} An updated location that infers the `start` and `end` properties - * from the `node` of the original descriptor, or infers the `start` from the `loc` of the original descriptor. - */ -function normalizeReportLoc(descriptor) { - if (descriptor.loc) { - if (descriptor.loc.start) { - return descriptor.loc; - } - return { start: descriptor.loc, end: null }; - } - return descriptor.node.loc; -} - -/** - * Check that a fix has a valid range. - * @param {Fix|null} fix The fix to validate. - * @returns {void} - */ -function assertValidFix(fix) { - if (fix) { - assert(fix.range && typeof fix.range[0] === "number" && typeof fix.range[1] === "number", `Fix has invalid range: ${JSON.stringify(fix, null, 2)}`); - } -} - -/** - * Compares items in a fixes array by range. - * @param {Fix} a The first message. - * @param {Fix} b The second message. - * @returns {int} -1 if a comes before b, 1 if a comes after b, 0 if equal. - * @private - */ -function compareFixesByRange(a, b) { - return a.range[0] - b.range[0] || a.range[1] - b.range[1]; -} - -/** - * Merges the given fixes array into one. - * @param {Fix[]} fixes The fixes to merge. - * @param {SourceCode} sourceCode The source code object to get the text between fixes. - * @returns {{text: string, range: number[]}} The merged fixes - */ -function mergeFixes(fixes, sourceCode) { - for (const fix of fixes) { - assertValidFix(fix); - } - - if (fixes.length === 0) { - return null; - } - if (fixes.length === 1) { - return fixes[0]; - } - - fixes.sort(compareFixesByRange); - - const originalText = sourceCode.text; - const start = fixes[0].range[0]; - const end = fixes[fixes.length - 1].range[1]; - let text = ""; - let lastPos = Number.MIN_SAFE_INTEGER; - - for (const fix of fixes) { - assert(fix.range[0] >= lastPos, "Fix objects must not be overlapped in a report."); - - if (fix.range[0] >= 0) { - text += originalText.slice(Math.max(0, start, lastPos), fix.range[0]); - } - text += fix.text; - lastPos = fix.range[1]; - } - text += originalText.slice(Math.max(0, start, lastPos), end); - - return { range: [start, end], text }; -} - -/** - * Gets one fix object from the given descriptor. - * If the descriptor retrieves multiple fixes, this merges those to one. - * @param {MessageDescriptor} descriptor The report descriptor. - * @param {SourceCode} sourceCode The source code object to get text between fixes. - * @returns {({text: string, range: number[]}|null)} The fix for the descriptor - */ -function normalizeFixes(descriptor, sourceCode) { - if (typeof descriptor.fix !== "function") { - return null; - } - - // @type {null | Fix | Fix[] | IterableIterator} - const fix = descriptor.fix(ruleFixer); - - // Merge to one. - if (fix && Symbol.iterator in fix) { - return mergeFixes(Array.from(fix), sourceCode); - } - - assertValidFix(fix); - return fix; -} - -/** - * Gets an array of suggestion objects from the given descriptor. - * @param {MessageDescriptor} descriptor The report descriptor. - * @param {SourceCode} sourceCode The source code object to get text between fixes. - * @param {Object} messages Object of meta messages for the rule. - * @returns {Array} The suggestions for the descriptor - */ -function mapSuggestions(descriptor, sourceCode, messages) { - if (!descriptor.suggest || !Array.isArray(descriptor.suggest)) { - return []; - } - - return descriptor.suggest - .map(suggestInfo => { - const computedDesc = suggestInfo.desc || messages[suggestInfo.messageId]; - - return { - ...suggestInfo, - desc: interpolate(computedDesc, suggestInfo.data), - fix: normalizeFixes(suggestInfo, sourceCode) - }; - }) - - // Remove suggestions that didn't provide a fix - .filter(({ fix }) => fix); -} - -/** - * Creates information about the report from a descriptor - * @param {Object} options Information about the problem - * @param {string} options.ruleId Rule ID - * @param {(0|1|2)} options.severity Rule severity - * @param {(ASTNode|null)} options.node Node - * @param {string} options.message Error message - * @param {string} [options.messageId] The error message ID. - * @param {{start: SourceLocation, end: (SourceLocation|null)}} options.loc Start and end location - * @param {{text: string, range: (number[]|null)}} options.fix The fix object - * @param {Array<{text: string, range: (number[]|null)}>} options.suggestions The array of suggestions objects - * @returns {LintMessage} Information about the report - */ -function createProblem(options) { - const problem = { - ruleId: options.ruleId, - severity: options.severity, - message: options.message, - line: options.loc.start.line, - column: options.loc.start.column + 1, - nodeType: options.node && options.node.type || null - }; - - /* - * If this isn’t in the conditional, some of the tests fail - * because `messageId` is present in the problem object - */ - if (options.messageId) { - problem.messageId = options.messageId; - } - - if (options.loc.end) { - problem.endLine = options.loc.end.line; - problem.endColumn = options.loc.end.column + 1; - } - - if (options.fix) { - problem.fix = options.fix; - } - - if (options.suggestions && options.suggestions.length > 0) { - problem.suggestions = options.suggestions; - } - - return problem; -} - -/** - * Validates that suggestions are properly defined. Throws if an error is detected. - * @param {Array<{ desc?: string, messageId?: string }>} suggest The incoming suggest data. - * @param {Object} messages Object of meta messages for the rule. - * @returns {void} - */ -function validateSuggestions(suggest, messages) { - if (suggest && Array.isArray(suggest)) { - suggest.forEach(suggestion => { - if (suggestion.messageId) { - const { messageId } = suggestion; - - if (!messages) { - throw new TypeError(`context.report() called with a suggest option with a messageId '${messageId}', but no messages were present in the rule metadata.`); - } - - if (!messages[messageId]) { - throw new TypeError(`context.report() called with a suggest option with a messageId '${messageId}' which is not present in the 'messages' config: ${JSON.stringify(messages, null, 2)}`); - } - - if (suggestion.desc) { - throw new TypeError("context.report() called with a suggest option that defines both a 'messageId' and an 'desc'. Please only pass one."); - } - } else if (!suggestion.desc) { - throw new TypeError("context.report() called with a suggest option that doesn't have either a `desc` or `messageId`"); - } - - if (typeof suggestion.fix !== "function") { - throw new TypeError(`context.report() called with a suggest option without a fix function. See: ${suggestion}`); - } - }); - } -} - -/** - * Returns a function that converts the arguments of a `context.report` call from a rule into a reported - * problem for the Node.js API. - * @param {{ruleId: string, severity: number, sourceCode: SourceCode, messageIds: Object, disableFixes: boolean}} metadata Metadata for the reported problem - * @param {SourceCode} sourceCode The `SourceCode` instance for the text being linted - * @returns {function(...args): LintMessage} Function that returns information about the report - */ - -module.exports = function createReportTranslator(metadata) { - - /* - * `createReportTranslator` gets called once per enabled rule per file. It needs to be very performant. - * The report translator itself (i.e. the function that `createReportTranslator` returns) gets - * called every time a rule reports a problem, which happens much less frequently (usually, the vast - * majority of rules don't report any problems for a given file). - */ - return (...args) => { - const descriptor = normalizeMultiArgReportCall(...args); - const messages = metadata.messageIds; - - assertValidNodeInfo(descriptor); - - let computedMessage; - - if (descriptor.messageId) { - if (!messages) { - throw new TypeError("context.report() called with a messageId, but no messages were present in the rule metadata."); - } - const id = descriptor.messageId; - - if (descriptor.message) { - throw new TypeError("context.report() called with a message and a messageId. Please only pass one."); - } - if (!messages || !Object.prototype.hasOwnProperty.call(messages, id)) { - throw new TypeError(`context.report() called with a messageId of '${id}' which is not present in the 'messages' config: ${JSON.stringify(messages, null, 2)}`); - } - computedMessage = messages[id]; - } else if (descriptor.message) { - computedMessage = descriptor.message; - } else { - throw new TypeError("Missing `message` property in report() call; add a message that describes the linting problem."); - } - - validateSuggestions(descriptor.suggest, messages); - - return createProblem({ - ruleId: metadata.ruleId, - severity: metadata.severity, - node: descriptor.node, - message: interpolate(computedMessage, descriptor.data), - messageId: descriptor.messageId, - loc: normalizeReportLoc(descriptor), - fix: metadata.disableFixes ? null : normalizeFixes(descriptor, metadata.sourceCode), - suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, metadata.sourceCode, messages) - }); - }; -}; diff --git a/node_modules/eslint/lib/linter/rule-fixer.js b/node_modules/eslint/lib/linter/rule-fixer.js deleted file mode 100644 index bdd80d13b..000000000 --- a/node_modules/eslint/lib/linter/rule-fixer.js +++ /dev/null @@ -1,140 +0,0 @@ -/** - * @fileoverview An object that creates fix commands for rules. - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// none! - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Creates a fix command that inserts text at the specified index in the source text. - * @param {int} index The 0-based index at which to insert the new text. - * @param {string} text The text to insert. - * @returns {Object} The fix command. - * @private - */ -function insertTextAt(index, text) { - return { - range: [index, index], - text - }; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Creates code fixing commands for rules. - */ - -const ruleFixer = Object.freeze({ - - /** - * Creates a fix command that inserts text after the given node or token. - * The fix is not applied until applyFixes() is called. - * @param {ASTNode|Token} nodeOrToken The node or token to insert after. - * @param {string} text The text to insert. - * @returns {Object} The fix command. - */ - insertTextAfter(nodeOrToken, text) { - return this.insertTextAfterRange(nodeOrToken.range, text); - }, - - /** - * Creates a fix command that inserts text after the specified range in the source text. - * The fix is not applied until applyFixes() is called. - * @param {int[]} range The range to replace, first item is start of range, second - * is end of range. - * @param {string} text The text to insert. - * @returns {Object} The fix command. - */ - insertTextAfterRange(range, text) { - return insertTextAt(range[1], text); - }, - - /** - * Creates a fix command that inserts text before the given node or token. - * The fix is not applied until applyFixes() is called. - * @param {ASTNode|Token} nodeOrToken The node or token to insert before. - * @param {string} text The text to insert. - * @returns {Object} The fix command. - */ - insertTextBefore(nodeOrToken, text) { - return this.insertTextBeforeRange(nodeOrToken.range, text); - }, - - /** - * Creates a fix command that inserts text before the specified range in the source text. - * The fix is not applied until applyFixes() is called. - * @param {int[]} range The range to replace, first item is start of range, second - * is end of range. - * @param {string} text The text to insert. - * @returns {Object} The fix command. - */ - insertTextBeforeRange(range, text) { - return insertTextAt(range[0], text); - }, - - /** - * Creates a fix command that replaces text at the node or token. - * The fix is not applied until applyFixes() is called. - * @param {ASTNode|Token} nodeOrToken The node or token to remove. - * @param {string} text The text to insert. - * @returns {Object} The fix command. - */ - replaceText(nodeOrToken, text) { - return this.replaceTextRange(nodeOrToken.range, text); - }, - - /** - * Creates a fix command that replaces text at the specified range in the source text. - * The fix is not applied until applyFixes() is called. - * @param {int[]} range The range to replace, first item is start of range, second - * is end of range. - * @param {string} text The text to insert. - * @returns {Object} The fix command. - */ - replaceTextRange(range, text) { - return { - range, - text - }; - }, - - /** - * Creates a fix command that removes the node or token from the source. - * The fix is not applied until applyFixes() is called. - * @param {ASTNode|Token} nodeOrToken The node or token to remove. - * @returns {Object} The fix command. - */ - remove(nodeOrToken) { - return this.removeRange(nodeOrToken.range); - }, - - /** - * Creates a fix command that removes the specified range of text from the source. - * The fix is not applied until applyFixes() is called. - * @param {int[]} range The range to remove, first item is start of range, second - * is end of range. - * @returns {Object} The fix command. - */ - removeRange(range) { - return { - range, - text: "" - }; - } - -}); - - -module.exports = ruleFixer; diff --git a/node_modules/eslint/lib/linter/rules.js b/node_modules/eslint/lib/linter/rules.js deleted file mode 100644 index 647bab687..000000000 --- a/node_modules/eslint/lib/linter/rules.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @fileoverview Defines a storage for rules. - * @author Nicholas C. Zakas - * @author aladdin-add - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const builtInRules = require("../rules"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Normalizes a rule module to the new-style API - * @param {(Function|{create: Function})} rule A rule object, which can either be a function - * ("old-style") or an object with a `create` method ("new-style") - * @returns {{create: Function}} A new-style rule. - */ -function normalizeRule(rule) { - return typeof rule === "function" ? Object.assign({ create: rule }, rule) : rule; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * A storage for rules. - */ -class Rules { - constructor() { - this._rules = Object.create(null); - } - - /** - * Registers a rule module for rule id in storage. - * @param {string} ruleId Rule id (file name). - * @param {Function} ruleModule Rule handler. - * @returns {void} - */ - define(ruleId, ruleModule) { - this._rules[ruleId] = normalizeRule(ruleModule); - } - - /** - * Access rule handler by id (file name). - * @param {string} ruleId Rule id (file name). - * @returns {{create: Function, schema: JsonSchema[]}} - * A rule. This is normalized to always have the new-style shape with a `create` method. - */ - get(ruleId) { - if (typeof this._rules[ruleId] === "string") { - this.define(ruleId, require(this._rules[ruleId])); - } - if (this._rules[ruleId]) { - return this._rules[ruleId]; - } - if (builtInRules.has(ruleId)) { - return builtInRules.get(ruleId); - } - - return null; - } - - *[Symbol.iterator]() { - yield* builtInRules; - - for (const ruleId of Object.keys(this._rules)) { - yield [ruleId, this.get(ruleId)]; - } - } -} - -module.exports = Rules; diff --git a/node_modules/eslint/lib/linter/safe-emitter.js b/node_modules/eslint/lib/linter/safe-emitter.js deleted file mode 100644 index f4837c1dd..000000000 --- a/node_modules/eslint/lib/linter/safe-emitter.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @fileoverview A variant of EventEmitter which does not give listeners information about each other - * @author Teddy Katz - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** - * An event emitter - * @typedef {Object} SafeEmitter - * @property {(eventName: string, listenerFunc: Function) => void} on Adds a listener for a given event name - * @property {(eventName: string, arg1?: any, arg2?: any, arg3?: any) => void} emit Emits an event with a given name. - * This calls all the listeners that were listening for that name, with `arg1`, `arg2`, and `arg3` as arguments. - * @property {function(): string[]} eventNames Gets the list of event names that have registered listeners. - */ - -/** - * Creates an object which can listen for and emit events. - * This is similar to the EventEmitter API in Node's standard library, but it has a few differences. - * The goal is to allow multiple modules to attach arbitrary listeners to the same emitter, without - * letting the modules know about each other at all. - * 1. It has no special keys like `error` and `newListener`, which would allow modules to detect when - * another module throws an error or registers a listener. - * 2. It calls listener functions without any `this` value. (`EventEmitter` calls listeners with a - * `this` value of the emitter instance, which would give listeners access to other listeners.) - * @returns {SafeEmitter} An emitter - */ -module.exports = () => { - const listeners = Object.create(null); - - return Object.freeze({ - on(eventName, listener) { - if (eventName in listeners) { - listeners[eventName].push(listener); - } else { - listeners[eventName] = [listener]; - } - }, - emit(eventName, ...args) { - if (eventName in listeners) { - listeners[eventName].forEach(listener => listener(...args)); - } - }, - eventNames() { - return Object.keys(listeners); - } - }); -}; diff --git a/node_modules/eslint/lib/linter/source-code-fixer.js b/node_modules/eslint/lib/linter/source-code-fixer.js deleted file mode 100644 index 15386c926..000000000 --- a/node_modules/eslint/lib/linter/source-code-fixer.js +++ /dev/null @@ -1,152 +0,0 @@ -/** - * @fileoverview An object that caches and applies source code fixes. - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const debug = require("debug")("eslint:source-code-fixer"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const BOM = "\uFEFF"; - -/** - * Compares items in a messages array by range. - * @param {Message} a The first message. - * @param {Message} b The second message. - * @returns {int} -1 if a comes before b, 1 if a comes after b, 0 if equal. - * @private - */ -function compareMessagesByFixRange(a, b) { - return a.fix.range[0] - b.fix.range[0] || a.fix.range[1] - b.fix.range[1]; -} - -/** - * Compares items in a messages array by line and column. - * @param {Message} a The first message. - * @param {Message} b The second message. - * @returns {int} -1 if a comes before b, 1 if a comes after b, 0 if equal. - * @private - */ -function compareMessagesByLocation(a, b) { - return a.line - b.line || a.column - b.column; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Utility for apply fixes to source code. - * @constructor - */ -function SourceCodeFixer() { - Object.freeze(this); -} - -/** - * Applies the fixes specified by the messages to the given text. Tries to be - * smart about the fixes and won't apply fixes over the same area in the text. - * @param {string} sourceText The text to apply the changes to. - * @param {Message[]} messages The array of messages reported by ESLint. - * @param {boolean|Function} [shouldFix=true] Determines whether each message should be fixed - * @returns {Object} An object containing the fixed text and any unfixed messages. - */ -SourceCodeFixer.applyFixes = function(sourceText, messages, shouldFix) { - debug("Applying fixes"); - - if (shouldFix === false) { - debug("shouldFix parameter was false, not attempting fixes"); - return { - fixed: false, - messages, - output: sourceText - }; - } - - // clone the array - const remainingMessages = [], - fixes = [], - bom = sourceText.startsWith(BOM) ? BOM : "", - text = bom ? sourceText.slice(1) : sourceText; - let lastPos = Number.NEGATIVE_INFINITY, - output = bom; - - /** - * Try to use the 'fix' from a problem. - * @param {Message} problem The message object to apply fixes from - * @returns {boolean} Whether fix was successfully applied - */ - function attemptFix(problem) { - const fix = problem.fix; - const start = fix.range[0]; - const end = fix.range[1]; - - // Remain it as a problem if it's overlapped or it's a negative range - if (lastPos >= start || start > end) { - remainingMessages.push(problem); - return false; - } - - // Remove BOM. - if ((start < 0 && end >= 0) || (start === 0 && fix.text.startsWith(BOM))) { - output = ""; - } - - // Make output to this fix. - output += text.slice(Math.max(0, lastPos), Math.max(0, start)); - output += fix.text; - lastPos = end; - return true; - } - - messages.forEach(problem => { - if (Object.prototype.hasOwnProperty.call(problem, "fix")) { - fixes.push(problem); - } else { - remainingMessages.push(problem); - } - }); - - if (fixes.length) { - debug("Found fixes to apply"); - let fixesWereApplied = false; - - for (const problem of fixes.sort(compareMessagesByFixRange)) { - if (typeof shouldFix !== "function" || shouldFix(problem)) { - attemptFix(problem); - - /* - * The only time attemptFix will fail is if a previous fix was - * applied which conflicts with it. So we can mark this as true. - */ - fixesWereApplied = true; - } else { - remainingMessages.push(problem); - } - } - output += text.slice(Math.max(0, lastPos)); - - return { - fixed: fixesWereApplied, - messages: remainingMessages.sort(compareMessagesByLocation), - output - }; - } - - debug("No fixes to apply"); - return { - fixed: false, - messages, - output: bom + text - }; - -}; - -module.exports = SourceCodeFixer; diff --git a/node_modules/eslint/lib/linter/timing.js b/node_modules/eslint/lib/linter/timing.js deleted file mode 100644 index 1076ff258..000000000 --- a/node_modules/eslint/lib/linter/timing.js +++ /dev/null @@ -1,161 +0,0 @@ -/** - * @fileoverview Tracks performance of individual rules. - * @author Brandon Mills - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/* c8 ignore next */ -/** - * Align the string to left - * @param {string} str string to evaluate - * @param {int} len length of the string - * @param {string} ch delimiter character - * @returns {string} modified string - * @private - */ -function alignLeft(str, len, ch) { - return str + new Array(len - str.length + 1).join(ch || " "); -} - -/* c8 ignore next */ -/** - * Align the string to right - * @param {string} str string to evaluate - * @param {int} len length of the string - * @param {string} ch delimiter character - * @returns {string} modified string - * @private - */ -function alignRight(str, len, ch) { - return new Array(len - str.length + 1).join(ch || " ") + str; -} - -//------------------------------------------------------------------------------ -// Module definition -//------------------------------------------------------------------------------ - -const enabled = !!process.env.TIMING; - -const HEADERS = ["Rule", "Time (ms)", "Relative"]; -const ALIGN = [alignLeft, alignRight, alignRight]; - -/** - * Decide how many rules to show in the output list. - * @returns {number} the number of rules to show - */ -function getListSize() { - const MINIMUM_SIZE = 10; - - if (typeof process.env.TIMING !== "string") { - return MINIMUM_SIZE; - } - - if (process.env.TIMING.toLowerCase() === "all") { - return Number.POSITIVE_INFINITY; - } - - const TIMING_ENV_VAR_AS_INTEGER = Number.parseInt(process.env.TIMING, 10); - - return TIMING_ENV_VAR_AS_INTEGER > 10 ? TIMING_ENV_VAR_AS_INTEGER : MINIMUM_SIZE; -} - -/* c8 ignore next */ -/** - * display the data - * @param {Object} data Data object to be displayed - * @returns {void} prints modified string with console.log - * @private - */ -function display(data) { - let total = 0; - const rows = Object.keys(data) - .map(key => { - const time = data[key]; - - total += time; - return [key, time]; - }) - .sort((a, b) => b[1] - a[1]) - .slice(0, getListSize()); - - rows.forEach(row => { - row.push(`${(row[1] * 100 / total).toFixed(1)}%`); - row[1] = row[1].toFixed(3); - }); - - rows.unshift(HEADERS); - - const widths = []; - - rows.forEach(row => { - const len = row.length; - - for (let i = 0; i < len; i++) { - const n = row[i].length; - - if (!widths[i] || n > widths[i]) { - widths[i] = n; - } - } - }); - - const table = rows.map(row => ( - row - .map((cell, index) => ALIGN[index](cell, widths[index])) - .join(" | ") - )); - - table.splice(1, 0, widths.map((width, index) => { - const extraAlignment = index !== 0 && index !== widths.length - 1 ? 2 : 1; - - return ALIGN[index](":", width + extraAlignment, "-"); - }).join("|")); - - console.log(table.join("\n")); // eslint-disable-line no-console -- Debugging function -} - -/* c8 ignore next */ -module.exports = (function() { - - const data = Object.create(null); - - /** - * Time the run - * @param {any} key key from the data object - * @param {Function} fn function to be called - * @returns {Function} function to be executed - * @private - */ - function time(key, fn) { - if (typeof data[key] === "undefined") { - data[key] = 0; - } - - return function(...args) { - let t = process.hrtime(); - const result = fn(...args); - - t = process.hrtime(t); - data[key] += t[0] * 1e3 + t[1] / 1e6; - return result; - }; - } - - if (enabled) { - process.on("exit", () => { - display(data); - }); - } - - return { - time, - enabled, - getListSize - }; - -}()); diff --git a/node_modules/eslint/lib/options.js b/node_modules/eslint/lib/options.js deleted file mode 100644 index 2bc4018af..000000000 --- a/node_modules/eslint/lib/options.js +++ /dev/null @@ -1,377 +0,0 @@ -/** - * @fileoverview Options configuration for optionator. - * @author George Zahariev - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const optionator = require("optionator"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** - * The options object parsed by Optionator. - * @typedef {Object} ParsedCLIOptions - * @property {boolean} cache Only check changed files - * @property {string} cacheFile Path to the cache file. Deprecated: use --cache-location - * @property {string} [cacheLocation] Path to the cache file or directory - * @property {"metadata" | "content"} cacheStrategy Strategy to use for detecting changed files in the cache - * @property {boolean} [color] Force enabling/disabling of color - * @property {string} [config] Use this configuration, overriding .eslintrc.* config options if present - * @property {boolean} debug Output debugging information - * @property {string[]} [env] Specify environments - * @property {boolean} envInfo Output execution environment information - * @property {boolean} errorOnUnmatchedPattern Prevent errors when pattern is unmatched - * @property {boolean} eslintrc Disable use of configuration from .eslintrc.* - * @property {string[]} [ext] Specify JavaScript file extensions - * @property {boolean} fix Automatically fix problems - * @property {boolean} fixDryRun Automatically fix problems without saving the changes to the file system - * @property {("directive" | "problem" | "suggestion" | "layout")[]} [fixType] Specify the types of fixes to apply (directive, problem, suggestion, layout) - * @property {string} format Use a specific output format - * @property {string[]} [global] Define global variables - * @property {boolean} [help] Show help - * @property {boolean} ignore Disable use of ignore files and patterns - * @property {string} [ignorePath] Specify path of ignore file - * @property {string[]} [ignorePattern] Pattern of files to ignore (in addition to those in .eslintignore) - * @property {boolean} init Run config initialization wizard - * @property {boolean} inlineConfig Prevent comments from changing config or rules - * @property {number} maxWarnings Number of warnings to trigger nonzero exit code - * @property {string} [outputFile] Specify file to write report to - * @property {string} [parser] Specify the parser to be used - * @property {Object} [parserOptions] Specify parser options - * @property {string[]} [plugin] Specify plugins - * @property {string} [printConfig] Print the configuration for the given file - * @property {boolean | undefined} reportUnusedDisableDirectives Adds reported errors for unused eslint-disable directives - * @property {string} [resolvePluginsRelativeTo] A folder where plugins should be resolved from, CWD by default - * @property {Object} [rule] Specify rules - * @property {string[]} [rulesdir] Load additional rules from this directory. Deprecated: Use rules from plugins - * @property {boolean} stdin Lint code provided on - * @property {string} [stdinFilename] Specify filename to process STDIN as - * @property {boolean} quiet Report errors only - * @property {boolean} [version] Output the version number - * @property {string[]} _ Positional filenames or patterns - */ - -//------------------------------------------------------------------------------ -// Initialization and Public Interface -//------------------------------------------------------------------------------ - -// exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)" - -/** - * Creates the CLI options for ESLint. - * @param {boolean} usingFlatConfig Indicates if flat config is being used. - * @returns {Object} The optionator instance. - */ -module.exports = function(usingFlatConfig) { - - let lookupFlag; - - if (usingFlatConfig) { - lookupFlag = { - option: "config-lookup", - type: "Boolean", - default: "true", - description: "Disable look up for eslint.config.js" - }; - } else { - lookupFlag = { - option: "eslintrc", - type: "Boolean", - default: "true", - description: "Disable use of configuration from .eslintrc.*" - }; - } - - let envFlag; - - if (!usingFlatConfig) { - envFlag = { - option: "env", - type: "[String]", - description: "Specify environments" - }; - } - - let extFlag; - - if (!usingFlatConfig) { - extFlag = { - option: "ext", - type: "[String]", - description: "Specify JavaScript file extensions" - }; - } - - let resolvePluginsFlag; - - if (!usingFlatConfig) { - resolvePluginsFlag = { - option: "resolve-plugins-relative-to", - type: "path::String", - description: "A folder where plugins should be resolved from, CWD by default" - }; - } - - let rulesDirFlag; - - if (!usingFlatConfig) { - rulesDirFlag = { - option: "rulesdir", - type: "[path::String]", - description: "Load additional rules from this directory. Deprecated: Use rules from plugins" - }; - } - - let ignorePathFlag; - - if (!usingFlatConfig) { - ignorePathFlag = { - option: "ignore-path", - type: "path::String", - description: "Specify path of ignore file" - }; - } - - return optionator({ - prepend: "eslint [options] file.js [file.js] [dir]", - defaults: { - concatRepeatedArrays: true, - mergeRepeatedObjects: true - }, - options: [ - { - heading: "Basic configuration" - }, - lookupFlag, - { - option: "config", - alias: "c", - type: "path::String", - description: usingFlatConfig - ? "Use this configuration instead of eslint.config.js" - : "Use this configuration, overriding .eslintrc.* config options if present" - }, - envFlag, - extFlag, - { - option: "global", - type: "[String]", - description: "Define global variables" - }, - { - option: "parser", - type: "String", - description: "Specify the parser to be used" - }, - { - option: "parser-options", - type: "Object", - description: "Specify parser options" - }, - resolvePluginsFlag, - { - heading: "Specify Rules and Plugins" - }, - { - option: "plugin", - type: "[String]", - description: "Specify plugins" - }, - { - option: "rule", - type: "Object", - description: "Specify rules" - }, - rulesDirFlag, - { - heading: "Fix Problems" - }, - { - option: "fix", - type: "Boolean", - default: false, - description: "Automatically fix problems" - }, - { - option: "fix-dry-run", - type: "Boolean", - default: false, - description: "Automatically fix problems without saving the changes to the file system" - }, - { - option: "fix-type", - type: "Array", - description: "Specify the types of fixes to apply (directive, problem, suggestion, layout)" - }, - { - heading: "Ignore Files" - }, - ignorePathFlag, - { - option: "ignore", - type: "Boolean", - default: "true", - description: "Disable use of ignore files and patterns" - }, - { - option: "ignore-pattern", - type: "[String]", - description: "Pattern of files to ignore (in addition to those in .eslintignore)", - concatRepeatedArrays: [true, { - oneValuePerFlag: true - }] - }, - { - heading: "Use stdin" - }, - { - option: "stdin", - type: "Boolean", - default: "false", - description: "Lint code provided on " - }, - { - option: "stdin-filename", - type: "String", - description: "Specify filename to process STDIN as" - }, - { - heading: "Handle Warnings" - }, - { - option: "quiet", - type: "Boolean", - default: "false", - description: "Report errors only" - }, - { - option: "max-warnings", - type: "Int", - default: "-1", - description: "Number of warnings to trigger nonzero exit code" - }, - { - heading: "Output" - }, - { - option: "output-file", - alias: "o", - type: "path::String", - description: "Specify file to write report to" - }, - { - option: "format", - alias: "f", - type: "String", - default: "stylish", - description: "Use a specific output format" - }, - { - option: "color", - type: "Boolean", - alias: "no-color", - description: "Force enabling/disabling of color" - }, - { - heading: "Inline configuration comments" - }, - { - option: "inline-config", - type: "Boolean", - default: "true", - description: "Prevent comments from changing config or rules" - }, - { - option: "report-unused-disable-directives", - type: "Boolean", - default: void 0, - description: "Adds reported errors for unused eslint-disable directives" - }, - { - heading: "Caching" - }, - { - option: "cache", - type: "Boolean", - default: "false", - description: "Only check changed files" - }, - { - option: "cache-file", - type: "path::String", - default: ".eslintcache", - description: "Path to the cache file. Deprecated: use --cache-location" - }, - { - option: "cache-location", - type: "path::String", - description: "Path to the cache file or directory" - }, - { - option: "cache-strategy", - dependsOn: ["cache"], - type: "String", - default: "metadata", - enum: ["metadata", "content"], - description: "Strategy to use for detecting changed files in the cache" - }, - { - heading: "Miscellaneous" - }, - { - option: "init", - type: "Boolean", - default: "false", - description: "Run config initialization wizard" - }, - { - option: "env-info", - type: "Boolean", - default: "false", - description: "Output execution environment information" - }, - { - option: "error-on-unmatched-pattern", - type: "Boolean", - default: "true", - description: "Prevent errors when pattern is unmatched" - }, - { - option: "exit-on-fatal-error", - type: "Boolean", - default: "false", - description: "Exit with exit code 2 in case of fatal error" - }, - { - option: "debug", - type: "Boolean", - default: false, - description: "Output debugging information" - }, - { - option: "help", - alias: "h", - type: "Boolean", - description: "Show help" - }, - { - option: "version", - alias: "v", - type: "Boolean", - description: "Output the version number" - }, - { - option: "print-config", - type: "path::String", - description: "Print the configuration for the given file" - } - ].filter(value => !!value) - }); -}; diff --git a/node_modules/eslint/lib/rule-tester/flat-rule-tester.js b/node_modules/eslint/lib/rule-tester/flat-rule-tester.js deleted file mode 100644 index 97055d104..000000000 --- a/node_modules/eslint/lib/rule-tester/flat-rule-tester.js +++ /dev/null @@ -1,1044 +0,0 @@ -/** - * @fileoverview Mocha/Jest test wrapper - * @author Ilya Volodin - */ -"use strict"; - -/* globals describe, it -- Mocha globals */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const - assert = require("assert"), - util = require("util"), - equal = require("fast-deep-equal"), - Traverser = require("../shared/traverser"), - { getRuleOptionsSchema } = require("../config/flat-config-helpers"), - { Linter, SourceCodeFixer, interpolate } = require("../linter"); -const { FlatConfigArray } = require("../config/flat-config-array"); -const { defaultConfig } = require("../config/default-config"); - -const ajv = require("../shared/ajv")({ strictDefaults: true }); - -const parserSymbol = Symbol.for("eslint.RuleTester.parser"); -const { SourceCode } = require("../source-code"); -const { ConfigArraySymbol } = require("@humanwhocodes/config-array"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").Parser} Parser */ -/** @typedef {import("../shared/types").LanguageOptions} LanguageOptions */ - -/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ -/** - * A test case that is expected to pass lint. - * @typedef {Object} ValidTestCase - * @property {string} [name] Name for the test case. - * @property {string} code Code for the test case. - * @property {any[]} [options] Options for the test case. - * @property {LanguageOptions} [languageOptions] The language options to use in the test case. - * @property {{ [name: string]: any }} [settings] Settings for the test case. - * @property {string} [filename] The fake filename for the test case. Useful for rules that make assertion about filenames. - * @property {boolean} [only] Run only this test case or the subset of test cases with this property. - */ - -/** - * A test case that is expected to fail lint. - * @typedef {Object} InvalidTestCase - * @property {string} [name] Name for the test case. - * @property {string} code Code for the test case. - * @property {number | Array} errors Expected errors. - * @property {string | null} [output] The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested. - * @property {any[]} [options] Options for the test case. - * @property {{ [name: string]: any }} [settings] Settings for the test case. - * @property {string} [filename] The fake filename for the test case. Useful for rules that make assertion about filenames. - * @property {LanguageOptions} [languageOptions] The language options to use in the test case. - * @property {boolean} [only] Run only this test case or the subset of test cases with this property. - */ - -/** - * A description of a reported error used in a rule tester test. - * @typedef {Object} TestCaseError - * @property {string | RegExp} [message] Message. - * @property {string} [messageId] Message ID. - * @property {string} [type] The type of the reported AST node. - * @property {{ [name: string]: string }} [data] The data used to fill the message template. - * @property {number} [line] The 1-based line number of the reported start location. - * @property {number} [column] The 1-based column number of the reported start location. - * @property {number} [endLine] The 1-based line number of the reported end location. - * @property {number} [endColumn] The 1-based column number of the reported end location. - */ -/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ - -//------------------------------------------------------------------------------ -// Private Members -//------------------------------------------------------------------------------ - -/* - * testerDefaultConfig must not be modified as it allows to reset the tester to - * the initial default configuration - */ -const testerDefaultConfig = { rules: {} }; - -/* - * RuleTester uses this config as its default. This can be overwritten via - * setDefaultConfig(). - */ -let sharedDefaultConfig = { rules: {} }; - -/* - * List every parameters possible on a test case that are not related to eslint - * configuration - */ -const RuleTesterParameters = [ - "name", - "code", - "filename", - "options", - "errors", - "output", - "only" -]; - -/* - * All allowed property names in error objects. - */ -const errorObjectParameters = new Set([ - "message", - "messageId", - "data", - "type", - "line", - "column", - "endLine", - "endColumn", - "suggestions" -]); -const friendlyErrorObjectParameterList = `[${[...errorObjectParameters].map(key => `'${key}'`).join(", ")}]`; - -/* - * All allowed property names in suggestion objects. - */ -const suggestionObjectParameters = new Set([ - "desc", - "messageId", - "data", - "output" -]); -const friendlySuggestionObjectParameterList = `[${[...suggestionObjectParameters].map(key => `'${key}'`).join(", ")}]`; - -const hasOwnProperty = Function.call.bind(Object.hasOwnProperty); - -/** - * Clones a given value deeply. - * Note: This ignores `parent` property. - * @param {any} x A value to clone. - * @returns {any} A cloned value. - */ -function cloneDeeplyExcludesParent(x) { - if (typeof x === "object" && x !== null) { - if (Array.isArray(x)) { - return x.map(cloneDeeplyExcludesParent); - } - - const retv = {}; - - for (const key in x) { - if (key !== "parent" && hasOwnProperty(x, key)) { - retv[key] = cloneDeeplyExcludesParent(x[key]); - } - } - - return retv; - } - - return x; -} - -/** - * Freezes a given value deeply. - * @param {any} x A value to freeze. - * @returns {void} - */ -function freezeDeeply(x) { - if (typeof x === "object" && x !== null) { - if (Array.isArray(x)) { - x.forEach(freezeDeeply); - } else { - for (const key in x) { - if (key !== "parent" && hasOwnProperty(x, key)) { - freezeDeeply(x[key]); - } - } - } - Object.freeze(x); - } -} - -/** - * Replace control characters by `\u00xx` form. - * @param {string} text The text to sanitize. - * @returns {string} The sanitized text. - */ -function sanitize(text) { - if (typeof text !== "string") { - return ""; - } - return text.replace( - /[\u0000-\u0009\u000b-\u001a]/gu, // eslint-disable-line no-control-regex -- Escaping controls - c => `\\u${c.codePointAt(0).toString(16).padStart(4, "0")}` - ); -} - -/** - * Define `start`/`end` properties as throwing error. - * @param {string} objName Object name used for error messages. - * @param {ASTNode} node The node to define. - * @returns {void} - */ -function defineStartEndAsError(objName, node) { - Object.defineProperties(node, { - start: { - get() { - throw new Error(`Use ${objName}.range[0] instead of ${objName}.start`); - }, - configurable: true, - enumerable: false - }, - end: { - get() { - throw new Error(`Use ${objName}.range[1] instead of ${objName}.end`); - }, - configurable: true, - enumerable: false - } - }); -} - - -/** - * Define `start`/`end` properties of all nodes of the given AST as throwing error. - * @param {ASTNode} ast The root node to errorize `start`/`end` properties. - * @param {Object} [visitorKeys] Visitor keys to be used for traversing the given ast. - * @returns {void} - */ -function defineStartEndAsErrorInTree(ast, visitorKeys) { - Traverser.traverse(ast, { visitorKeys, enter: defineStartEndAsError.bind(null, "node") }); - ast.tokens.forEach(defineStartEndAsError.bind(null, "token")); - ast.comments.forEach(defineStartEndAsError.bind(null, "token")); -} - -/** - * Wraps the given parser in order to intercept and modify return values from the `parse` and `parseForESLint` methods, for test purposes. - * In particular, to modify ast nodes, tokens and comments to throw on access to their `start` and `end` properties. - * @param {Parser} parser Parser object. - * @returns {Parser} Wrapped parser object. - */ -function wrapParser(parser) { - - if (typeof parser.parseForESLint === "function") { - return { - [parserSymbol]: parser, - parseForESLint(...args) { - const ret = parser.parseForESLint(...args); - - defineStartEndAsErrorInTree(ret.ast, ret.visitorKeys); - return ret; - } - }; - } - - return { - [parserSymbol]: parser, - parse(...args) { - const ast = parser.parse(...args); - - defineStartEndAsErrorInTree(ast); - return ast; - } - }; -} - -/** - * Function to replace `SourceCode.prototype.getComments`. - * @returns {void} - * @throws {Error} Deprecation message. - */ -function getCommentsDeprecation() { - throw new Error( - "`SourceCode#getComments()` is deprecated and will be removed in a future major version. Use `getCommentsBefore()`, `getCommentsAfter()`, and `getCommentsInside()` instead." - ); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -// default separators for testing -const DESCRIBE = Symbol("describe"); -const IT = Symbol("it"); -const IT_ONLY = Symbol("itOnly"); - -/** - * This is `it` default handler if `it` don't exist. - * @this {Mocha} - * @param {string} text The description of the test case. - * @param {Function} method The logic of the test case. - * @throws {Error} Any error upon execution of `method`. - * @returns {any} Returned value of `method`. - */ -function itDefaultHandler(text, method) { - try { - return method.call(this); - } catch (err) { - if (err instanceof assert.AssertionError) { - err.message += ` (${util.inspect(err.actual)} ${err.operator} ${util.inspect(err.expected)})`; - } - throw err; - } -} - -/** - * This is `describe` default handler if `describe` don't exist. - * @this {Mocha} - * @param {string} text The description of the test case. - * @param {Function} method The logic of the test case. - * @returns {any} Returned value of `method`. - */ -function describeDefaultHandler(text, method) { - return method.call(this); -} - -/** - * Mocha test wrapper. - */ -class FlatRuleTester { - - /** - * Creates a new instance of RuleTester. - * @param {Object} [testerConfig] Optional, extra configuration for the tester - */ - constructor(testerConfig = {}) { - - /** - * The configuration to use for this tester. Combination of the tester - * configuration and the default configuration. - * @type {Object} - */ - this.testerConfig = [ - sharedDefaultConfig, - testerConfig, - { rules: { "rule-tester/validate-ast": "error" } } - ]; - - this.linter = new Linter({ configType: "flat" }); - } - - /** - * Set the configuration to use for all future tests - * @param {Object} config the configuration to use. - * @throws {TypeError} If non-object config. - * @returns {void} - */ - static setDefaultConfig(config) { - if (typeof config !== "object" || config === null) { - throw new TypeError("FlatRuleTester.setDefaultConfig: config must be an object"); - } - sharedDefaultConfig = config; - - // Make sure the rules object exists since it is assumed to exist later - sharedDefaultConfig.rules = sharedDefaultConfig.rules || {}; - } - - /** - * Get the current configuration used for all tests - * @returns {Object} the current configuration - */ - static getDefaultConfig() { - return sharedDefaultConfig; - } - - /** - * Reset the configuration to the initial configuration of the tester removing - * any changes made until now. - * @returns {void} - */ - static resetDefaultConfig() { - sharedDefaultConfig = { - rules: { - ...testerDefaultConfig.rules - } - }; - } - - - /* - * If people use `mocha test.js --watch` command, `describe` and `it` function - * instances are different for each execution. So `describe` and `it` should get fresh instance - * always. - */ - static get describe() { - return ( - this[DESCRIBE] || - (typeof describe === "function" ? describe : describeDefaultHandler) - ); - } - - static set describe(value) { - this[DESCRIBE] = value; - } - - static get it() { - return ( - this[IT] || - (typeof it === "function" ? it : itDefaultHandler) - ); - } - - static set it(value) { - this[IT] = value; - } - - /** - * Adds the `only` property to a test to run it in isolation. - * @param {string | ValidTestCase | InvalidTestCase} item A single test to run by itself. - * @returns {ValidTestCase | InvalidTestCase} The test with `only` set. - */ - static only(item) { - if (typeof item === "string") { - return { code: item, only: true }; - } - - return { ...item, only: true }; - } - - static get itOnly() { - if (typeof this[IT_ONLY] === "function") { - return this[IT_ONLY]; - } - if (typeof this[IT] === "function" && typeof this[IT].only === "function") { - return Function.bind.call(this[IT].only, this[IT]); - } - if (typeof it === "function" && typeof it.only === "function") { - return Function.bind.call(it.only, it); - } - - if (typeof this[DESCRIBE] === "function" || typeof this[IT] === "function") { - throw new Error( - "Set `RuleTester.itOnly` to use `only` with a custom test framework.\n" + - "See https://eslint.org/docs/latest/integrate/nodejs-api#customizing-ruletester for more." - ); - } - if (typeof it === "function") { - throw new Error("The current test framework does not support exclusive tests with `only`."); - } - throw new Error("To use `only`, use RuleTester with a test framework that provides `it.only()` like Mocha."); - } - - static set itOnly(value) { - this[IT_ONLY] = value; - } - - - /** - * Adds a new rule test to execute. - * @param {string} ruleName The name of the rule to run. - * @param {Function} rule The rule to test. - * @param {{ - * valid: (ValidTestCase | string)[], - * invalid: InvalidTestCase[] - * }} test The collection of tests to run. - * @throws {TypeError|Error} If non-object `test`, or if a required - * scenario of the given type is missing. - * @returns {void} - */ - run(ruleName, rule, test) { - - const testerConfig = this.testerConfig, - requiredScenarios = ["valid", "invalid"], - scenarioErrors = [], - linter = this.linter, - ruleId = `rule-to-test/${ruleName}`; - - if (!test || typeof test !== "object") { - throw new TypeError(`Test Scenarios for rule ${ruleName} : Could not find test scenario object`); - } - - requiredScenarios.forEach(scenarioType => { - if (!test[scenarioType]) { - scenarioErrors.push(`Could not find any ${scenarioType} test scenarios`); - } - }); - - if (scenarioErrors.length > 0) { - throw new Error([ - `Test Scenarios for rule ${ruleName} is invalid:` - ].concat(scenarioErrors).join("\n")); - } - - const baseConfig = [ - { - plugins: { - - // copy root plugin over - "@": { - - /* - * Parsers are wrapped to detect more errors, so this needs - * to be a new object for each call to run(), otherwise the - * parsers will be wrapped multiple times. - */ - parsers: { - ...defaultConfig[0].plugins["@"].parsers - }, - - /* - * The rules key on the default plugin is a proxy to lazy-load - * just the rules that are needed. So, don't create a new object - * here, just use the default one to keep that performance - * enhancement. - */ - rules: defaultConfig[0].plugins["@"].rules - }, - "rule-to-test": { - rules: { - [ruleName]: Object.assign({}, rule, { - - // Create a wrapper rule that freezes the `context` properties. - create(context) { - freezeDeeply(context.options); - freezeDeeply(context.settings); - freezeDeeply(context.parserOptions); - - // freezeDeeply(context.languageOptions); - - return (typeof rule === "function" ? rule : rule.create)(context); - } - }) - } - } - }, - languageOptions: { - ...defaultConfig[0].languageOptions - } - }, - ...defaultConfig.slice(1) - ]; - - /** - * Run the rule for the given item - * @param {string|Object} item Item to run the rule against - * @throws {Error} If an invalid schema. - * @returns {Object} Eslint run result - * @private - */ - function runRuleForItem(item) { - const configs = new FlatConfigArray(testerConfig, { baseConfig }); - - /* - * Modify the returned config so that the parser is wrapped to catch - * access of the start/end properties. This method is called just - * once per code snippet being tested, so each test case gets a clean - * parser. - */ - configs[ConfigArraySymbol.finalizeConfig] = function(...args) { - - // can't do super here :( - const proto = Object.getPrototypeOf(this); - const calculatedConfig = proto[ConfigArraySymbol.finalizeConfig].apply(this, args); - - // wrap the parser to catch start/end property access - calculatedConfig.languageOptions.parser = wrapParser(calculatedConfig.languageOptions.parser); - return calculatedConfig; - }; - - let code, filename, output, beforeAST, afterAST; - - if (typeof item === "string") { - code = item; - } else { - code = item.code; - - /* - * Assumes everything on the item is a config except for the - * parameters used by this tester - */ - const itemConfig = { ...item }; - - for (const parameter of RuleTesterParameters) { - delete itemConfig[parameter]; - } - - // wrap any parsers - if (itemConfig.languageOptions && itemConfig.languageOptions.parser) { - - const parser = itemConfig.languageOptions.parser; - - if (parser && typeof parser !== "object") { - throw new Error("Parser must be an object with a parse() or parseForESLint() method."); - } - - } - - /* - * Create the config object from the tester config and this item - * specific configurations. - */ - configs.push(itemConfig); - } - - if (item.filename) { - filename = item.filename; - } - - let ruleConfig = 1; - - if (hasOwnProperty(item, "options")) { - assert(Array.isArray(item.options), "options must be an array"); - ruleConfig = [1, ...item.options]; - } - - configs.push({ - rules: { - [ruleId]: ruleConfig - } - }); - - const schema = getRuleOptionsSchema(rule); - - /* - * Setup AST getters. - * The goal is to check whether or not AST was modified when - * running the rule under test. - */ - configs.push({ - plugins: { - "rule-tester": { - rules: { - "validate-ast": { - create() { - return { - Program(node) { - beforeAST = cloneDeeplyExcludesParent(node); - }, - "Program:exit"(node) { - afterAST = node; - } - }; - } - } - } - } - } - }); - - if (schema) { - ajv.validateSchema(schema); - - if (ajv.errors) { - const errors = ajv.errors.map(error => { - const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; - - return `\t${field}: ${error.message}`; - }).join("\n"); - - throw new Error([`Schema for rule ${ruleName} is invalid:`, errors]); - } - - /* - * `ajv.validateSchema` checks for errors in the structure of the schema (by comparing the schema against a "meta-schema"), - * and it reports those errors individually. However, there are other types of schema errors that only occur when compiling - * the schema (e.g. using invalid defaults in a schema), and only one of these errors can be reported at a time. As a result, - * the schema is compiled here separately from checking for `validateSchema` errors. - */ - try { - ajv.compile(schema); - } catch (err) { - throw new Error(`Schema for rule ${ruleName} is invalid: ${err.message}`); - } - } - - // Verify the code. - const { getComments } = SourceCode.prototype; - let messages; - - // check for validation errors - try { - configs.normalizeSync(); - configs.getConfig("test.js"); - } catch (error) { - error.message = `ESLint configuration in rule-tester is invalid: ${error.message}`; - throw error; - } - - try { - SourceCode.prototype.getComments = getCommentsDeprecation; - messages = linter.verify(code, configs, filename); - } finally { - SourceCode.prototype.getComments = getComments; - } - - const fatalErrorMessage = messages.find(m => m.fatal); - - assert(!fatalErrorMessage, `A fatal parsing error occurred: ${fatalErrorMessage && fatalErrorMessage.message}`); - - // Verify if autofix makes a syntax error or not. - if (messages.some(m => m.fix)) { - output = SourceCodeFixer.applyFixes(code, messages).output; - const errorMessageInFix = linter.verify(output, configs, filename).find(m => m.fatal); - - assert(!errorMessageInFix, [ - "A fatal parsing error occurred in autofix.", - `Error: ${errorMessageInFix && errorMessageInFix.message}`, - "Autofix output:", - output - ].join("\n")); - } else { - output = code; - } - - return { - messages, - output, - beforeAST, - afterAST: cloneDeeplyExcludesParent(afterAST) - }; - } - - /** - * Check if the AST was changed - * @param {ASTNode} beforeAST AST node before running - * @param {ASTNode} afterAST AST node after running - * @returns {void} - * @private - */ - function assertASTDidntChange(beforeAST, afterAST) { - if (!equal(beforeAST, afterAST)) { - assert.fail("Rule should not modify AST."); - } - } - - /** - * Check if the template is valid or not - * all valid cases go through this - * @param {string|Object} item Item to run the rule against - * @returns {void} - * @private - */ - function testValidTemplate(item) { - const code = typeof item === "object" ? item.code : item; - - assert.ok(typeof code === "string", "Test case must specify a string value for 'code'"); - if (item.name) { - assert.ok(typeof item.name === "string", "Optional test case property 'name' must be a string"); - } - - const result = runRuleForItem(item); - const messages = result.messages; - - assert.strictEqual(messages.length, 0, util.format("Should have no errors but had %d: %s", - messages.length, - util.inspect(messages))); - - assertASTDidntChange(result.beforeAST, result.afterAST); - } - - /** - * Asserts that the message matches its expected value. If the expected - * value is a regular expression, it is checked against the actual - * value. - * @param {string} actual Actual value - * @param {string|RegExp} expected Expected value - * @returns {void} - * @private - */ - function assertMessageMatches(actual, expected) { - if (expected instanceof RegExp) { - - // assert.js doesn't have a built-in RegExp match function - assert.ok( - expected.test(actual), - `Expected '${actual}' to match ${expected}` - ); - } else { - assert.strictEqual(actual, expected); - } - } - - /** - * Check if the template is invalid or not - * all invalid cases go through this. - * @param {string|Object} item Item to run the rule against - * @returns {void} - * @private - */ - function testInvalidTemplate(item) { - assert.ok(typeof item.code === "string", "Test case must specify a string value for 'code'"); - if (item.name) { - assert.ok(typeof item.name === "string", "Optional test case property 'name' must be a string"); - } - assert.ok(item.errors || item.errors === 0, - `Did not specify errors for an invalid test of ${ruleName}`); - - if (Array.isArray(item.errors) && item.errors.length === 0) { - assert.fail("Invalid cases must have at least one error"); - } - - const ruleHasMetaMessages = hasOwnProperty(rule, "meta") && hasOwnProperty(rule.meta, "messages"); - const friendlyIDList = ruleHasMetaMessages ? `[${Object.keys(rule.meta.messages).map(key => `'${key}'`).join(", ")}]` : null; - - const result = runRuleForItem(item); - const messages = result.messages; - - if (typeof item.errors === "number") { - - if (item.errors === 0) { - assert.fail("Invalid cases must have 'error' value greater than 0"); - } - - assert.strictEqual(messages.length, item.errors, util.format("Should have %d error%s but had %d: %s", - item.errors, - item.errors === 1 ? "" : "s", - messages.length, - util.inspect(messages))); - } else { - assert.strictEqual( - messages.length, item.errors.length, util.format( - "Should have %d error%s but had %d: %s", - item.errors.length, - item.errors.length === 1 ? "" : "s", - messages.length, - util.inspect(messages) - ) - ); - - const hasMessageOfThisRule = messages.some(m => m.ruleId === ruleId); - - for (let i = 0, l = item.errors.length; i < l; i++) { - const error = item.errors[i]; - const message = messages[i]; - - assert(hasMessageOfThisRule, "Error rule name should be the same as the name of the rule being tested"); - - if (typeof error === "string" || error instanceof RegExp) { - - // Just an error message. - assertMessageMatches(message.message, error); - } else if (typeof error === "object" && error !== null) { - - /* - * Error object. - * This may have a message, messageId, data, node type, line, and/or - * column. - */ - - Object.keys(error).forEach(propertyName => { - assert.ok( - errorObjectParameters.has(propertyName), - `Invalid error property name '${propertyName}'. Expected one of ${friendlyErrorObjectParameterList}.` - ); - }); - - if (hasOwnProperty(error, "message")) { - assert.ok(!hasOwnProperty(error, "messageId"), "Error should not specify both 'message' and a 'messageId'."); - assert.ok(!hasOwnProperty(error, "data"), "Error should not specify both 'data' and 'message'."); - assertMessageMatches(message.message, error.message); - } else if (hasOwnProperty(error, "messageId")) { - assert.ok( - ruleHasMetaMessages, - "Error can not use 'messageId' if rule under test doesn't define 'meta.messages'." - ); - if (!hasOwnProperty(rule.meta.messages, error.messageId)) { - assert(false, `Invalid messageId '${error.messageId}'. Expected one of ${friendlyIDList}.`); - } - assert.strictEqual( - message.messageId, - error.messageId, - `messageId '${message.messageId}' does not match expected messageId '${error.messageId}'.` - ); - if (hasOwnProperty(error, "data")) { - - /* - * if data was provided, then directly compare the returned message to a synthetic - * interpolated message using the same message ID and data provided in the test. - * See https://github.com/eslint/eslint/issues/9890 for context. - */ - const unformattedOriginalMessage = rule.meta.messages[error.messageId]; - const rehydratedMessage = interpolate(unformattedOriginalMessage, error.data); - - assert.strictEqual( - message.message, - rehydratedMessage, - `Hydrated message "${rehydratedMessage}" does not match "${message.message}"` - ); - } - } - - assert.ok( - hasOwnProperty(error, "data") ? hasOwnProperty(error, "messageId") : true, - "Error must specify 'messageId' if 'data' is used." - ); - - if (error.type) { - assert.strictEqual(message.nodeType, error.type, `Error type should be ${error.type}, found ${message.nodeType}`); - } - - if (hasOwnProperty(error, "line")) { - assert.strictEqual(message.line, error.line, `Error line should be ${error.line}`); - } - - if (hasOwnProperty(error, "column")) { - assert.strictEqual(message.column, error.column, `Error column should be ${error.column}`); - } - - if (hasOwnProperty(error, "endLine")) { - assert.strictEqual(message.endLine, error.endLine, `Error endLine should be ${error.endLine}`); - } - - if (hasOwnProperty(error, "endColumn")) { - assert.strictEqual(message.endColumn, error.endColumn, `Error endColumn should be ${error.endColumn}`); - } - - if (hasOwnProperty(error, "suggestions")) { - - // Support asserting there are no suggestions - if (!error.suggestions || (Array.isArray(error.suggestions) && error.suggestions.length === 0)) { - if (Array.isArray(message.suggestions) && message.suggestions.length > 0) { - assert.fail(`Error should have no suggestions on error with message: "${message.message}"`); - } - } else { - assert.strictEqual(Array.isArray(message.suggestions), true, `Error should have an array of suggestions. Instead received "${message.suggestions}" on error with message: "${message.message}"`); - assert.strictEqual(message.suggestions.length, error.suggestions.length, `Error should have ${error.suggestions.length} suggestions. Instead found ${message.suggestions.length} suggestions`); - - error.suggestions.forEach((expectedSuggestion, index) => { - assert.ok( - typeof expectedSuggestion === "object" && expectedSuggestion !== null, - "Test suggestion in 'suggestions' array must be an object." - ); - Object.keys(expectedSuggestion).forEach(propertyName => { - assert.ok( - suggestionObjectParameters.has(propertyName), - `Invalid suggestion property name '${propertyName}'. Expected one of ${friendlySuggestionObjectParameterList}.` - ); - }); - - const actualSuggestion = message.suggestions[index]; - const suggestionPrefix = `Error Suggestion at index ${index} :`; - - if (hasOwnProperty(expectedSuggestion, "desc")) { - assert.ok( - !hasOwnProperty(expectedSuggestion, "data"), - `${suggestionPrefix} Test should not specify both 'desc' and 'data'.` - ); - assert.strictEqual( - actualSuggestion.desc, - expectedSuggestion.desc, - `${suggestionPrefix} desc should be "${expectedSuggestion.desc}" but got "${actualSuggestion.desc}" instead.` - ); - } - - if (hasOwnProperty(expectedSuggestion, "messageId")) { - assert.ok( - ruleHasMetaMessages, - `${suggestionPrefix} Test can not use 'messageId' if rule under test doesn't define 'meta.messages'.` - ); - assert.ok( - hasOwnProperty(rule.meta.messages, expectedSuggestion.messageId), - `${suggestionPrefix} Test has invalid messageId '${expectedSuggestion.messageId}', the rule under test allows only one of ${friendlyIDList}.` - ); - assert.strictEqual( - actualSuggestion.messageId, - expectedSuggestion.messageId, - `${suggestionPrefix} messageId should be '${expectedSuggestion.messageId}' but got '${actualSuggestion.messageId}' instead.` - ); - if (hasOwnProperty(expectedSuggestion, "data")) { - const unformattedMetaMessage = rule.meta.messages[expectedSuggestion.messageId]; - const rehydratedDesc = interpolate(unformattedMetaMessage, expectedSuggestion.data); - - assert.strictEqual( - actualSuggestion.desc, - rehydratedDesc, - `${suggestionPrefix} Hydrated test desc "${rehydratedDesc}" does not match received desc "${actualSuggestion.desc}".` - ); - } - } else { - assert.ok( - !hasOwnProperty(expectedSuggestion, "data"), - `${suggestionPrefix} Test must specify 'messageId' if 'data' is used.` - ); - } - - if (hasOwnProperty(expectedSuggestion, "output")) { - const codeWithAppliedSuggestion = SourceCodeFixer.applyFixes(item.code, [actualSuggestion]).output; - - assert.strictEqual(codeWithAppliedSuggestion, expectedSuggestion.output, `Expected the applied suggestion fix to match the test suggestion output for suggestion at index: ${index} on error with message: "${message.message}"`); - } - }); - } - } - } else { - - // Message was an unexpected type - assert.fail(`Error should be a string, object, or RegExp, but found (${util.inspect(message)})`); - } - } - } - - if (hasOwnProperty(item, "output")) { - if (item.output === null) { - assert.strictEqual( - result.output, - item.code, - "Expected no autofixes to be suggested" - ); - } else { - assert.strictEqual(result.output, item.output, "Output is incorrect."); - } - } else { - assert.strictEqual( - result.output, - item.code, - "The rule fixed the code. Please add 'output' property." - ); - } - - assertASTDidntChange(result.beforeAST, result.afterAST); - } - - /* - * This creates a mocha test suite and pipes all supplied info through - * one of the templates above. - */ - this.constructor.describe(ruleName, () => { - this.constructor.describe("valid", () => { - test.valid.forEach(valid => { - this.constructor[valid.only ? "itOnly" : "it"]( - sanitize(typeof valid === "object" ? valid.name || valid.code : valid), - () => { - testValidTemplate(valid); - } - ); - }); - }); - - this.constructor.describe("invalid", () => { - test.invalid.forEach(invalid => { - this.constructor[invalid.only ? "itOnly" : "it"]( - sanitize(invalid.name || invalid.code), - () => { - testInvalidTemplate(invalid); - } - ); - }); - }); - }); - } -} - -FlatRuleTester[DESCRIBE] = FlatRuleTester[IT] = FlatRuleTester[IT_ONLY] = null; - -module.exports = FlatRuleTester; diff --git a/node_modules/eslint/lib/rule-tester/index.js b/node_modules/eslint/lib/rule-tester/index.js deleted file mode 100644 index f52d14027..000000000 --- a/node_modules/eslint/lib/rule-tester/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -module.exports = { - RuleTester: require("./rule-tester") -}; diff --git a/node_modules/eslint/lib/rule-tester/rule-tester.js b/node_modules/eslint/lib/rule-tester/rule-tester.js deleted file mode 100644 index 8518299d0..000000000 --- a/node_modules/eslint/lib/rule-tester/rule-tester.js +++ /dev/null @@ -1,1054 +0,0 @@ -/** - * @fileoverview Mocha test wrapper - * @author Ilya Volodin - */ -"use strict"; - -/* globals describe, it -- Mocha globals */ - -/* - * This is a wrapper around mocha to allow for DRY unittests for eslint - * Format: - * RuleTester.run("{ruleName}", { - * valid: [ - * "{code}", - * { code: "{code}", options: {options}, globals: {globals}, parser: "{parser}", settings: {settings} } - * ], - * invalid: [ - * { code: "{code}", errors: {numErrors} }, - * { code: "{code}", errors: ["{errorMessage}"] }, - * { code: "{code}", options: {options}, globals: {globals}, parser: "{parser}", settings: {settings}, errors: [{ message: "{errorMessage}", type: "{errorNodeType}"}] } - * ] - * }); - * - * Variables: - * {code} - String that represents the code to be tested - * {options} - Arguments that are passed to the configurable rules. - * {globals} - An object representing a list of variables that are - * registered as globals - * {parser} - String representing the parser to use - * {settings} - An object representing global settings for all rules - * {numErrors} - If failing case doesn't need to check error message, - * this integer will specify how many errors should be - * received - * {errorMessage} - Message that is returned by the rule on failure - * {errorNodeType} - AST node type that is returned by they rule as - * a cause of the failure. - */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const - assert = require("assert"), - path = require("path"), - util = require("util"), - merge = require("lodash.merge"), - equal = require("fast-deep-equal"), - Traverser = require("../../lib/shared/traverser"), - { getRuleOptionsSchema, validate } = require("../shared/config-validator"), - { Linter, SourceCodeFixer, interpolate } = require("../linter"); - -const ajv = require("../shared/ajv")({ strictDefaults: true }); - -const espreePath = require.resolve("espree"); -const parserSymbol = Symbol.for("eslint.RuleTester.parser"); - -const { SourceCode } = require("../source-code"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").Parser} Parser */ - -/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ -/** - * A test case that is expected to pass lint. - * @typedef {Object} ValidTestCase - * @property {string} [name] Name for the test case. - * @property {string} code Code for the test case. - * @property {any[]} [options] Options for the test case. - * @property {{ [name: string]: any }} [settings] Settings for the test case. - * @property {string} [filename] The fake filename for the test case. Useful for rules that make assertion about filenames. - * @property {string} [parser] The absolute path for the parser. - * @property {{ [name: string]: any }} [parserOptions] Options for the parser. - * @property {{ [name: string]: "readonly" | "writable" | "off" }} [globals] The additional global variables. - * @property {{ [name: string]: boolean }} [env] Environments for the test case. - * @property {boolean} [only] Run only this test case or the subset of test cases with this property. - */ - -/** - * A test case that is expected to fail lint. - * @typedef {Object} InvalidTestCase - * @property {string} [name] Name for the test case. - * @property {string} code Code for the test case. - * @property {number | Array} errors Expected errors. - * @property {string | null} [output] The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested. - * @property {any[]} [options] Options for the test case. - * @property {{ [name: string]: any }} [settings] Settings for the test case. - * @property {string} [filename] The fake filename for the test case. Useful for rules that make assertion about filenames. - * @property {string} [parser] The absolute path for the parser. - * @property {{ [name: string]: any }} [parserOptions] Options for the parser. - * @property {{ [name: string]: "readonly" | "writable" | "off" }} [globals] The additional global variables. - * @property {{ [name: string]: boolean }} [env] Environments for the test case. - * @property {boolean} [only] Run only this test case or the subset of test cases with this property. - */ - -/** - * A description of a reported error used in a rule tester test. - * @typedef {Object} TestCaseError - * @property {string | RegExp} [message] Message. - * @property {string} [messageId] Message ID. - * @property {string} [type] The type of the reported AST node. - * @property {{ [name: string]: string }} [data] The data used to fill the message template. - * @property {number} [line] The 1-based line number of the reported start location. - * @property {number} [column] The 1-based column number of the reported start location. - * @property {number} [endLine] The 1-based line number of the reported end location. - * @property {number} [endColumn] The 1-based column number of the reported end location. - */ -/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ - -//------------------------------------------------------------------------------ -// Private Members -//------------------------------------------------------------------------------ - -/* - * testerDefaultConfig must not be modified as it allows to reset the tester to - * the initial default configuration - */ -const testerDefaultConfig = { rules: {} }; -let defaultConfig = { rules: {} }; - -/* - * List every parameters possible on a test case that are not related to eslint - * configuration - */ -const RuleTesterParameters = [ - "name", - "code", - "filename", - "options", - "errors", - "output", - "only" -]; - -/* - * All allowed property names in error objects. - */ -const errorObjectParameters = new Set([ - "message", - "messageId", - "data", - "type", - "line", - "column", - "endLine", - "endColumn", - "suggestions" -]); -const friendlyErrorObjectParameterList = `[${[...errorObjectParameters].map(key => `'${key}'`).join(", ")}]`; - -/* - * All allowed property names in suggestion objects. - */ -const suggestionObjectParameters = new Set([ - "desc", - "messageId", - "data", - "output" -]); -const friendlySuggestionObjectParameterList = `[${[...suggestionObjectParameters].map(key => `'${key}'`).join(", ")}]`; - -const hasOwnProperty = Function.call.bind(Object.hasOwnProperty); - -/** - * Clones a given value deeply. - * Note: This ignores `parent` property. - * @param {any} x A value to clone. - * @returns {any} A cloned value. - */ -function cloneDeeplyExcludesParent(x) { - if (typeof x === "object" && x !== null) { - if (Array.isArray(x)) { - return x.map(cloneDeeplyExcludesParent); - } - - const retv = {}; - - for (const key in x) { - if (key !== "parent" && hasOwnProperty(x, key)) { - retv[key] = cloneDeeplyExcludesParent(x[key]); - } - } - - return retv; - } - - return x; -} - -/** - * Freezes a given value deeply. - * @param {any} x A value to freeze. - * @returns {void} - */ -function freezeDeeply(x) { - if (typeof x === "object" && x !== null) { - if (Array.isArray(x)) { - x.forEach(freezeDeeply); - } else { - for (const key in x) { - if (key !== "parent" && hasOwnProperty(x, key)) { - freezeDeeply(x[key]); - } - } - } - Object.freeze(x); - } -} - -/** - * Replace control characters by `\u00xx` form. - * @param {string} text The text to sanitize. - * @returns {string} The sanitized text. - */ -function sanitize(text) { - if (typeof text !== "string") { - return ""; - } - return text.replace( - /[\u0000-\u0009\u000b-\u001a]/gu, // eslint-disable-line no-control-regex -- Escaping controls - c => `\\u${c.codePointAt(0).toString(16).padStart(4, "0")}` - ); -} - -/** - * Define `start`/`end` properties as throwing error. - * @param {string} objName Object name used for error messages. - * @param {ASTNode} node The node to define. - * @returns {void} - */ -function defineStartEndAsError(objName, node) { - Object.defineProperties(node, { - start: { - get() { - throw new Error(`Use ${objName}.range[0] instead of ${objName}.start`); - }, - configurable: true, - enumerable: false - }, - end: { - get() { - throw new Error(`Use ${objName}.range[1] instead of ${objName}.end`); - }, - configurable: true, - enumerable: false - } - }); -} - - -/** - * Define `start`/`end` properties of all nodes of the given AST as throwing error. - * @param {ASTNode} ast The root node to errorize `start`/`end` properties. - * @param {Object} [visitorKeys] Visitor keys to be used for traversing the given ast. - * @returns {void} - */ -function defineStartEndAsErrorInTree(ast, visitorKeys) { - Traverser.traverse(ast, { visitorKeys, enter: defineStartEndAsError.bind(null, "node") }); - ast.tokens.forEach(defineStartEndAsError.bind(null, "token")); - ast.comments.forEach(defineStartEndAsError.bind(null, "token")); -} - -/** - * Wraps the given parser in order to intercept and modify return values from the `parse` and `parseForESLint` methods, for test purposes. - * In particular, to modify ast nodes, tokens and comments to throw on access to their `start` and `end` properties. - * @param {Parser} parser Parser object. - * @returns {Parser} Wrapped parser object. - */ -function wrapParser(parser) { - - if (typeof parser.parseForESLint === "function") { - return { - [parserSymbol]: parser, - parseForESLint(...args) { - const ret = parser.parseForESLint(...args); - - defineStartEndAsErrorInTree(ret.ast, ret.visitorKeys); - return ret; - } - }; - } - - return { - [parserSymbol]: parser, - parse(...args) { - const ast = parser.parse(...args); - - defineStartEndAsErrorInTree(ast); - return ast; - } - }; -} - -/** - * Function to replace `SourceCode.prototype.getComments`. - * @returns {void} - * @throws {Error} Deprecation message. - */ -function getCommentsDeprecation() { - throw new Error( - "`SourceCode#getComments()` is deprecated and will be removed in a future major version. Use `getCommentsBefore()`, `getCommentsAfter()`, and `getCommentsInside()` instead." - ); -} - -/** - * Emit a deprecation warning if function-style format is being used. - * @param {string} ruleName Name of the rule. - * @returns {void} - */ -function emitLegacyRuleAPIWarning(ruleName) { - if (!emitLegacyRuleAPIWarning[`warned-${ruleName}`]) { - emitLegacyRuleAPIWarning[`warned-${ruleName}`] = true; - process.emitWarning( - `"${ruleName}" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/latest/extend/custom-rules`, - "DeprecationWarning" - ); - } -} - -/** - * Emit a deprecation warning if rule has options but is missing the "meta.schema" property - * @param {string} ruleName Name of the rule. - * @returns {void} - */ -function emitMissingSchemaWarning(ruleName) { - if (!emitMissingSchemaWarning[`warned-${ruleName}`]) { - emitMissingSchemaWarning[`warned-${ruleName}`] = true; - process.emitWarning( - `"${ruleName}" rule has options but is missing the "meta.schema" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas`, - "DeprecationWarning" - ); - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -// default separators for testing -const DESCRIBE = Symbol("describe"); -const IT = Symbol("it"); -const IT_ONLY = Symbol("itOnly"); - -/** - * This is `it` default handler if `it` don't exist. - * @this {Mocha} - * @param {string} text The description of the test case. - * @param {Function} method The logic of the test case. - * @throws {Error} Any error upon execution of `method`. - * @returns {any} Returned value of `method`. - */ -function itDefaultHandler(text, method) { - try { - return method.call(this); - } catch (err) { - if (err instanceof assert.AssertionError) { - err.message += ` (${util.inspect(err.actual)} ${err.operator} ${util.inspect(err.expected)})`; - } - throw err; - } -} - -/** - * This is `describe` default handler if `describe` don't exist. - * @this {Mocha} - * @param {string} text The description of the test case. - * @param {Function} method The logic of the test case. - * @returns {any} Returned value of `method`. - */ -function describeDefaultHandler(text, method) { - return method.call(this); -} - -/** - * Mocha test wrapper. - */ -class RuleTester { - - /** - * Creates a new instance of RuleTester. - * @param {Object} [testerConfig] Optional, extra configuration for the tester - */ - constructor(testerConfig) { - - /** - * The configuration to use for this tester. Combination of the tester - * configuration and the default configuration. - * @type {Object} - */ - this.testerConfig = merge( - {}, - defaultConfig, - testerConfig, - { rules: { "rule-tester/validate-ast": "error" } } - ); - - /** - * Rule definitions to define before tests. - * @type {Object} - */ - this.rules = {}; - this.linter = new Linter(); - } - - /** - * Set the configuration to use for all future tests - * @param {Object} config the configuration to use. - * @throws {TypeError} If non-object config. - * @returns {void} - */ - static setDefaultConfig(config) { - if (typeof config !== "object" || config === null) { - throw new TypeError("RuleTester.setDefaultConfig: config must be an object"); - } - defaultConfig = config; - - // Make sure the rules object exists since it is assumed to exist later - defaultConfig.rules = defaultConfig.rules || {}; - } - - /** - * Get the current configuration used for all tests - * @returns {Object} the current configuration - */ - static getDefaultConfig() { - return defaultConfig; - } - - /** - * Reset the configuration to the initial configuration of the tester removing - * any changes made until now. - * @returns {void} - */ - static resetDefaultConfig() { - defaultConfig = merge({}, testerDefaultConfig); - } - - - /* - * If people use `mocha test.js --watch` command, `describe` and `it` function - * instances are different for each execution. So `describe` and `it` should get fresh instance - * always. - */ - static get describe() { - return ( - this[DESCRIBE] || - (typeof describe === "function" ? describe : describeDefaultHandler) - ); - } - - static set describe(value) { - this[DESCRIBE] = value; - } - - static get it() { - return ( - this[IT] || - (typeof it === "function" ? it : itDefaultHandler) - ); - } - - static set it(value) { - this[IT] = value; - } - - /** - * Adds the `only` property to a test to run it in isolation. - * @param {string | ValidTestCase | InvalidTestCase} item A single test to run by itself. - * @returns {ValidTestCase | InvalidTestCase} The test with `only` set. - */ - static only(item) { - if (typeof item === "string") { - return { code: item, only: true }; - } - - return { ...item, only: true }; - } - - static get itOnly() { - if (typeof this[IT_ONLY] === "function") { - return this[IT_ONLY]; - } - if (typeof this[IT] === "function" && typeof this[IT].only === "function") { - return Function.bind.call(this[IT].only, this[IT]); - } - if (typeof it === "function" && typeof it.only === "function") { - return Function.bind.call(it.only, it); - } - - if (typeof this[DESCRIBE] === "function" || typeof this[IT] === "function") { - throw new Error( - "Set `RuleTester.itOnly` to use `only` with a custom test framework.\n" + - "See https://eslint.org/docs/latest/integrate/nodejs-api#customizing-ruletester for more." - ); - } - if (typeof it === "function") { - throw new Error("The current test framework does not support exclusive tests with `only`."); - } - throw new Error("To use `only`, use RuleTester with a test framework that provides `it.only()` like Mocha."); - } - - static set itOnly(value) { - this[IT_ONLY] = value; - } - - /** - * Define a rule for one particular run of tests. - * @param {string} name The name of the rule to define. - * @param {Function} rule The rule definition. - * @returns {void} - */ - defineRule(name, rule) { - this.rules[name] = rule; - } - - /** - * Adds a new rule test to execute. - * @param {string} ruleName The name of the rule to run. - * @param {Function} rule The rule to test. - * @param {{ - * valid: (ValidTestCase | string)[], - * invalid: InvalidTestCase[] - * }} test The collection of tests to run. - * @throws {TypeError|Error} If non-object `test`, or if a required - * scenario of the given type is missing. - * @returns {void} - */ - run(ruleName, rule, test) { - - const testerConfig = this.testerConfig, - requiredScenarios = ["valid", "invalid"], - scenarioErrors = [], - linter = this.linter; - - if (!test || typeof test !== "object") { - throw new TypeError(`Test Scenarios for rule ${ruleName} : Could not find test scenario object`); - } - - requiredScenarios.forEach(scenarioType => { - if (!test[scenarioType]) { - scenarioErrors.push(`Could not find any ${scenarioType} test scenarios`); - } - }); - - if (scenarioErrors.length > 0) { - throw new Error([ - `Test Scenarios for rule ${ruleName} is invalid:` - ].concat(scenarioErrors).join("\n")); - } - - if (typeof rule === "function") { - emitLegacyRuleAPIWarning(ruleName); - } - - linter.defineRule(ruleName, Object.assign({}, rule, { - - // Create a wrapper rule that freezes the `context` properties. - create(context) { - freezeDeeply(context.options); - freezeDeeply(context.settings); - freezeDeeply(context.parserOptions); - - return (typeof rule === "function" ? rule : rule.create)(context); - } - })); - - linter.defineRules(this.rules); - - /** - * Run the rule for the given item - * @param {string|Object} item Item to run the rule against - * @throws {Error} If an invalid schema. - * @returns {Object} Eslint run result - * @private - */ - function runRuleForItem(item) { - let config = merge({}, testerConfig), - code, filename, output, beforeAST, afterAST; - - if (typeof item === "string") { - code = item; - } else { - code = item.code; - - /* - * Assumes everything on the item is a config except for the - * parameters used by this tester - */ - const itemConfig = { ...item }; - - for (const parameter of RuleTesterParameters) { - delete itemConfig[parameter]; - } - - /* - * Create the config object from the tester config and this item - * specific configurations. - */ - config = merge( - config, - itemConfig - ); - } - - if (item.filename) { - filename = item.filename; - } - - if (hasOwnProperty(item, "options")) { - assert(Array.isArray(item.options), "options must be an array"); - if ( - item.options.length > 0 && - typeof rule === "object" && - ( - !rule.meta || (rule.meta && (typeof rule.meta.schema === "undefined" || rule.meta.schema === null)) - ) - ) { - emitMissingSchemaWarning(ruleName); - } - config.rules[ruleName] = [1].concat(item.options); - } else { - config.rules[ruleName] = 1; - } - - const schema = getRuleOptionsSchema(rule); - - /* - * Setup AST getters. - * The goal is to check whether or not AST was modified when - * running the rule under test. - */ - linter.defineRule("rule-tester/validate-ast", { - create() { - return { - Program(node) { - beforeAST = cloneDeeplyExcludesParent(node); - }, - "Program:exit"(node) { - afterAST = node; - } - }; - } - }); - - if (typeof config.parser === "string") { - assert(path.isAbsolute(config.parser), "Parsers provided as strings to RuleTester must be absolute paths"); - } else { - config.parser = espreePath; - } - - linter.defineParser(config.parser, wrapParser(require(config.parser))); - - if (schema) { - ajv.validateSchema(schema); - - if (ajv.errors) { - const errors = ajv.errors.map(error => { - const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; - - return `\t${field}: ${error.message}`; - }).join("\n"); - - throw new Error([`Schema for rule ${ruleName} is invalid:`, errors]); - } - - /* - * `ajv.validateSchema` checks for errors in the structure of the schema (by comparing the schema against a "meta-schema"), - * and it reports those errors individually. However, there are other types of schema errors that only occur when compiling - * the schema (e.g. using invalid defaults in a schema), and only one of these errors can be reported at a time. As a result, - * the schema is compiled here separately from checking for `validateSchema` errors. - */ - try { - ajv.compile(schema); - } catch (err) { - throw new Error(`Schema for rule ${ruleName} is invalid: ${err.message}`); - } - } - - validate(config, "rule-tester", id => (id === ruleName ? rule : null)); - - // Verify the code. - const { getComments } = SourceCode.prototype; - let messages; - - try { - SourceCode.prototype.getComments = getCommentsDeprecation; - messages = linter.verify(code, config, filename); - } finally { - SourceCode.prototype.getComments = getComments; - } - - const fatalErrorMessage = messages.find(m => m.fatal); - - assert(!fatalErrorMessage, `A fatal parsing error occurred: ${fatalErrorMessage && fatalErrorMessage.message}`); - - // Verify if autofix makes a syntax error or not. - if (messages.some(m => m.fix)) { - output = SourceCodeFixer.applyFixes(code, messages).output; - const errorMessageInFix = linter.verify(output, config, filename).find(m => m.fatal); - - assert(!errorMessageInFix, [ - "A fatal parsing error occurred in autofix.", - `Error: ${errorMessageInFix && errorMessageInFix.message}`, - "Autofix output:", - output - ].join("\n")); - } else { - output = code; - } - - return { - messages, - output, - beforeAST, - afterAST: cloneDeeplyExcludesParent(afterAST) - }; - } - - /** - * Check if the AST was changed - * @param {ASTNode} beforeAST AST node before running - * @param {ASTNode} afterAST AST node after running - * @returns {void} - * @private - */ - function assertASTDidntChange(beforeAST, afterAST) { - if (!equal(beforeAST, afterAST)) { - assert.fail("Rule should not modify AST."); - } - } - - /** - * Check if the template is valid or not - * all valid cases go through this - * @param {string|Object} item Item to run the rule against - * @returns {void} - * @private - */ - function testValidTemplate(item) { - const code = typeof item === "object" ? item.code : item; - - assert.ok(typeof code === "string", "Test case must specify a string value for 'code'"); - if (item.name) { - assert.ok(typeof item.name === "string", "Optional test case property 'name' must be a string"); - } - - const result = runRuleForItem(item); - const messages = result.messages; - - assert.strictEqual(messages.length, 0, util.format("Should have no errors but had %d: %s", - messages.length, - util.inspect(messages))); - - assertASTDidntChange(result.beforeAST, result.afterAST); - } - - /** - * Asserts that the message matches its expected value. If the expected - * value is a regular expression, it is checked against the actual - * value. - * @param {string} actual Actual value - * @param {string|RegExp} expected Expected value - * @returns {void} - * @private - */ - function assertMessageMatches(actual, expected) { - if (expected instanceof RegExp) { - - // assert.js doesn't have a built-in RegExp match function - assert.ok( - expected.test(actual), - `Expected '${actual}' to match ${expected}` - ); - } else { - assert.strictEqual(actual, expected); - } - } - - /** - * Check if the template is invalid or not - * all invalid cases go through this. - * @param {string|Object} item Item to run the rule against - * @returns {void} - * @private - */ - function testInvalidTemplate(item) { - assert.ok(typeof item.code === "string", "Test case must specify a string value for 'code'"); - if (item.name) { - assert.ok(typeof item.name === "string", "Optional test case property 'name' must be a string"); - } - assert.ok(item.errors || item.errors === 0, - `Did not specify errors for an invalid test of ${ruleName}`); - - if (Array.isArray(item.errors) && item.errors.length === 0) { - assert.fail("Invalid cases must have at least one error"); - } - - const ruleHasMetaMessages = hasOwnProperty(rule, "meta") && hasOwnProperty(rule.meta, "messages"); - const friendlyIDList = ruleHasMetaMessages ? `[${Object.keys(rule.meta.messages).map(key => `'${key}'`).join(", ")}]` : null; - - const result = runRuleForItem(item); - const messages = result.messages; - - if (typeof item.errors === "number") { - - if (item.errors === 0) { - assert.fail("Invalid cases must have 'error' value greater than 0"); - } - - assert.strictEqual(messages.length, item.errors, util.format("Should have %d error%s but had %d: %s", - item.errors, - item.errors === 1 ? "" : "s", - messages.length, - util.inspect(messages))); - } else { - assert.strictEqual( - messages.length, item.errors.length, util.format( - "Should have %d error%s but had %d: %s", - item.errors.length, - item.errors.length === 1 ? "" : "s", - messages.length, - util.inspect(messages) - ) - ); - - const hasMessageOfThisRule = messages.some(m => m.ruleId === ruleName); - - for (let i = 0, l = item.errors.length; i < l; i++) { - const error = item.errors[i]; - const message = messages[i]; - - assert(hasMessageOfThisRule, "Error rule name should be the same as the name of the rule being tested"); - - if (typeof error === "string" || error instanceof RegExp) { - - // Just an error message. - assertMessageMatches(message.message, error); - } else if (typeof error === "object" && error !== null) { - - /* - * Error object. - * This may have a message, messageId, data, node type, line, and/or - * column. - */ - - Object.keys(error).forEach(propertyName => { - assert.ok( - errorObjectParameters.has(propertyName), - `Invalid error property name '${propertyName}'. Expected one of ${friendlyErrorObjectParameterList}.` - ); - }); - - if (hasOwnProperty(error, "message")) { - assert.ok(!hasOwnProperty(error, "messageId"), "Error should not specify both 'message' and a 'messageId'."); - assert.ok(!hasOwnProperty(error, "data"), "Error should not specify both 'data' and 'message'."); - assertMessageMatches(message.message, error.message); - } else if (hasOwnProperty(error, "messageId")) { - assert.ok( - ruleHasMetaMessages, - "Error can not use 'messageId' if rule under test doesn't define 'meta.messages'." - ); - if (!hasOwnProperty(rule.meta.messages, error.messageId)) { - assert(false, `Invalid messageId '${error.messageId}'. Expected one of ${friendlyIDList}.`); - } - assert.strictEqual( - message.messageId, - error.messageId, - `messageId '${message.messageId}' does not match expected messageId '${error.messageId}'.` - ); - if (hasOwnProperty(error, "data")) { - - /* - * if data was provided, then directly compare the returned message to a synthetic - * interpolated message using the same message ID and data provided in the test. - * See https://github.com/eslint/eslint/issues/9890 for context. - */ - const unformattedOriginalMessage = rule.meta.messages[error.messageId]; - const rehydratedMessage = interpolate(unformattedOriginalMessage, error.data); - - assert.strictEqual( - message.message, - rehydratedMessage, - `Hydrated message "${rehydratedMessage}" does not match "${message.message}"` - ); - } - } - - assert.ok( - hasOwnProperty(error, "data") ? hasOwnProperty(error, "messageId") : true, - "Error must specify 'messageId' if 'data' is used." - ); - - if (error.type) { - assert.strictEqual(message.nodeType, error.type, `Error type should be ${error.type}, found ${message.nodeType}`); - } - - if (hasOwnProperty(error, "line")) { - assert.strictEqual(message.line, error.line, `Error line should be ${error.line}`); - } - - if (hasOwnProperty(error, "column")) { - assert.strictEqual(message.column, error.column, `Error column should be ${error.column}`); - } - - if (hasOwnProperty(error, "endLine")) { - assert.strictEqual(message.endLine, error.endLine, `Error endLine should be ${error.endLine}`); - } - - if (hasOwnProperty(error, "endColumn")) { - assert.strictEqual(message.endColumn, error.endColumn, `Error endColumn should be ${error.endColumn}`); - } - - if (hasOwnProperty(error, "suggestions")) { - - // Support asserting there are no suggestions - if (!error.suggestions || (Array.isArray(error.suggestions) && error.suggestions.length === 0)) { - if (Array.isArray(message.suggestions) && message.suggestions.length > 0) { - assert.fail(`Error should have no suggestions on error with message: "${message.message}"`); - } - } else { - assert.strictEqual(Array.isArray(message.suggestions), true, `Error should have an array of suggestions. Instead received "${message.suggestions}" on error with message: "${message.message}"`); - assert.strictEqual(message.suggestions.length, error.suggestions.length, `Error should have ${error.suggestions.length} suggestions. Instead found ${message.suggestions.length} suggestions`); - - error.suggestions.forEach((expectedSuggestion, index) => { - assert.ok( - typeof expectedSuggestion === "object" && expectedSuggestion !== null, - "Test suggestion in 'suggestions' array must be an object." - ); - Object.keys(expectedSuggestion).forEach(propertyName => { - assert.ok( - suggestionObjectParameters.has(propertyName), - `Invalid suggestion property name '${propertyName}'. Expected one of ${friendlySuggestionObjectParameterList}.` - ); - }); - - const actualSuggestion = message.suggestions[index]; - const suggestionPrefix = `Error Suggestion at index ${index} :`; - - if (hasOwnProperty(expectedSuggestion, "desc")) { - assert.ok( - !hasOwnProperty(expectedSuggestion, "data"), - `${suggestionPrefix} Test should not specify both 'desc' and 'data'.` - ); - assert.strictEqual( - actualSuggestion.desc, - expectedSuggestion.desc, - `${suggestionPrefix} desc should be "${expectedSuggestion.desc}" but got "${actualSuggestion.desc}" instead.` - ); - } - - if (hasOwnProperty(expectedSuggestion, "messageId")) { - assert.ok( - ruleHasMetaMessages, - `${suggestionPrefix} Test can not use 'messageId' if rule under test doesn't define 'meta.messages'.` - ); - assert.ok( - hasOwnProperty(rule.meta.messages, expectedSuggestion.messageId), - `${suggestionPrefix} Test has invalid messageId '${expectedSuggestion.messageId}', the rule under test allows only one of ${friendlyIDList}.` - ); - assert.strictEqual( - actualSuggestion.messageId, - expectedSuggestion.messageId, - `${suggestionPrefix} messageId should be '${expectedSuggestion.messageId}' but got '${actualSuggestion.messageId}' instead.` - ); - if (hasOwnProperty(expectedSuggestion, "data")) { - const unformattedMetaMessage = rule.meta.messages[expectedSuggestion.messageId]; - const rehydratedDesc = interpolate(unformattedMetaMessage, expectedSuggestion.data); - - assert.strictEqual( - actualSuggestion.desc, - rehydratedDesc, - `${suggestionPrefix} Hydrated test desc "${rehydratedDesc}" does not match received desc "${actualSuggestion.desc}".` - ); - } - } else { - assert.ok( - !hasOwnProperty(expectedSuggestion, "data"), - `${suggestionPrefix} Test must specify 'messageId' if 'data' is used.` - ); - } - - if (hasOwnProperty(expectedSuggestion, "output")) { - const codeWithAppliedSuggestion = SourceCodeFixer.applyFixes(item.code, [actualSuggestion]).output; - - assert.strictEqual(codeWithAppliedSuggestion, expectedSuggestion.output, `Expected the applied suggestion fix to match the test suggestion output for suggestion at index: ${index} on error with message: "${message.message}"`); - } - }); - } - } - } else { - - // Message was an unexpected type - assert.fail(`Error should be a string, object, or RegExp, but found (${util.inspect(message)})`); - } - } - } - - if (hasOwnProperty(item, "output")) { - if (item.output === null) { - assert.strictEqual( - result.output, - item.code, - "Expected no autofixes to be suggested" - ); - } else { - assert.strictEqual(result.output, item.output, "Output is incorrect."); - } - } else { - assert.strictEqual( - result.output, - item.code, - "The rule fixed the code. Please add 'output' property." - ); - } - - assertASTDidntChange(result.beforeAST, result.afterAST); - } - - /* - * This creates a mocha test suite and pipes all supplied info through - * one of the templates above. - */ - this.constructor.describe(ruleName, () => { - this.constructor.describe("valid", () => { - test.valid.forEach(valid => { - this.constructor[valid.only ? "itOnly" : "it"]( - sanitize(typeof valid === "object" ? valid.name || valid.code : valid), - () => { - testValidTemplate(valid); - } - ); - }); - }); - - this.constructor.describe("invalid", () => { - test.invalid.forEach(invalid => { - this.constructor[invalid.only ? "itOnly" : "it"]( - sanitize(invalid.name || invalid.code), - () => { - testInvalidTemplate(invalid); - } - ); - }); - }); - }); - } -} - -RuleTester[DESCRIBE] = RuleTester[IT] = RuleTester[IT_ONLY] = null; - -module.exports = RuleTester; diff --git a/node_modules/eslint/lib/rules/accessor-pairs.js b/node_modules/eslint/lib/rules/accessor-pairs.js deleted file mode 100644 index 03b51e461..000000000 --- a/node_modules/eslint/lib/rules/accessor-pairs.js +++ /dev/null @@ -1,354 +0,0 @@ -/** - * @fileoverview Rule to enforce getter and setter pairs in objects and classes. - * @author Gyandeep Singh - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** - * Property name if it can be computed statically, otherwise the list of the tokens of the key node. - * @typedef {string|Token[]} Key - */ - -/** - * Accessor nodes with the same key. - * @typedef {Object} AccessorData - * @property {Key} key Accessor's key - * @property {ASTNode[]} getters List of getter nodes. - * @property {ASTNode[]} setters List of setter nodes. - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not the given lists represent the equal tokens in the same order. - * Tokens are compared by their properties, not by instance. - * @param {Token[]} left First list of tokens. - * @param {Token[]} right Second list of tokens. - * @returns {boolean} `true` if the lists have same tokens. - */ -function areEqualTokenLists(left, right) { - if (left.length !== right.length) { - return false; - } - - for (let i = 0; i < left.length; i++) { - const leftToken = left[i], - rightToken = right[i]; - - if (leftToken.type !== rightToken.type || leftToken.value !== rightToken.value) { - return false; - } - } - - return true; -} - -/** - * Checks whether or not the given keys are equal. - * @param {Key} left First key. - * @param {Key} right Second key. - * @returns {boolean} `true` if the keys are equal. - */ -function areEqualKeys(left, right) { - if (typeof left === "string" && typeof right === "string") { - - // Statically computed names. - return left === right; - } - if (Array.isArray(left) && Array.isArray(right)) { - - // Token lists. - return areEqualTokenLists(left, right); - } - - return false; -} - -/** - * Checks whether or not a given node is of an accessor kind ('get' or 'set'). - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is of an accessor kind. - */ -function isAccessorKind(node) { - return node.kind === "get" || node.kind === "set"; -} - -/** - * Checks whether or not a given node is an argument of a specified method call. - * @param {ASTNode} node A node to check. - * @param {number} index An expected index of the node in arguments. - * @param {string} object An expected name of the object of the method. - * @param {string} property An expected name of the method. - * @returns {boolean} `true` if the node is an argument of the specified method call. - */ -function isArgumentOfMethodCall(node, index, object, property) { - const parent = node.parent; - - return ( - parent.type === "CallExpression" && - astUtils.isSpecificMemberAccess(parent.callee, object, property) && - parent.arguments[index] === node - ); -} - -/** - * Checks whether or not a given node is a property descriptor. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is a property descriptor. - */ -function isPropertyDescriptor(node) { - - // Object.defineProperty(obj, "foo", {set: ...}) - if (isArgumentOfMethodCall(node, 2, "Object", "defineProperty") || - isArgumentOfMethodCall(node, 2, "Reflect", "defineProperty") - ) { - return true; - } - - /* - * Object.defineProperties(obj, {foo: {set: ...}}) - * Object.create(proto, {foo: {set: ...}}) - */ - const grandparent = node.parent.parent; - - return grandparent.type === "ObjectExpression" && ( - isArgumentOfMethodCall(grandparent, 1, "Object", "create") || - isArgumentOfMethodCall(grandparent, 1, "Object", "defineProperties") - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce getter and setter pairs in objects and classes", - recommended: false, - url: "https://eslint.org/docs/latest/rules/accessor-pairs" - }, - - schema: [{ - type: "object", - properties: { - getWithoutSet: { - type: "boolean", - default: false - }, - setWithoutGet: { - type: "boolean", - default: true - }, - enforceForClassMembers: { - type: "boolean", - default: true - } - }, - additionalProperties: false - }], - - messages: { - missingGetterInPropertyDescriptor: "Getter is not present in property descriptor.", - missingSetterInPropertyDescriptor: "Setter is not present in property descriptor.", - missingGetterInObjectLiteral: "Getter is not present for {{ name }}.", - missingSetterInObjectLiteral: "Setter is not present for {{ name }}.", - missingGetterInClass: "Getter is not present for class {{ name }}.", - missingSetterInClass: "Setter is not present for class {{ name }}." - } - }, - create(context) { - const config = context.options[0] || {}; - const checkGetWithoutSet = config.getWithoutSet === true; - const checkSetWithoutGet = config.setWithoutGet !== false; - const enforceForClassMembers = config.enforceForClassMembers !== false; - const sourceCode = context.sourceCode; - - /** - * Reports the given node. - * @param {ASTNode} node The node to report. - * @param {string} messageKind "missingGetter" or "missingSetter". - * @returns {void} - * @private - */ - function report(node, messageKind) { - if (node.type === "Property") { - context.report({ - node, - messageId: `${messageKind}InObjectLiteral`, - loc: astUtils.getFunctionHeadLoc(node.value, sourceCode), - data: { name: astUtils.getFunctionNameWithKind(node.value) } - }); - } else if (node.type === "MethodDefinition") { - context.report({ - node, - messageId: `${messageKind}InClass`, - loc: astUtils.getFunctionHeadLoc(node.value, sourceCode), - data: { name: astUtils.getFunctionNameWithKind(node.value) } - }); - } else { - context.report({ - node, - messageId: `${messageKind}InPropertyDescriptor` - }); - } - } - - /** - * Reports each of the nodes in the given list using the same messageId. - * @param {ASTNode[]} nodes Nodes to report. - * @param {string} messageKind "missingGetter" or "missingSetter". - * @returns {void} - * @private - */ - function reportList(nodes, messageKind) { - for (const node of nodes) { - report(node, messageKind); - } - } - - /** - * Creates a new `AccessorData` object for the given getter or setter node. - * @param {ASTNode} node A getter or setter node. - * @returns {AccessorData} New `AccessorData` object that contains the given node. - * @private - */ - function createAccessorData(node) { - const name = astUtils.getStaticPropertyName(node); - const key = (name !== null) ? name : sourceCode.getTokens(node.key); - - return { - key, - getters: node.kind === "get" ? [node] : [], - setters: node.kind === "set" ? [node] : [] - }; - } - - /** - * Merges the given `AccessorData` object into the given accessors list. - * @param {AccessorData[]} accessors The list to merge into. - * @param {AccessorData} accessorData The object to merge. - * @returns {AccessorData[]} The same instance with the merged object. - * @private - */ - function mergeAccessorData(accessors, accessorData) { - const equalKeyElement = accessors.find(a => areEqualKeys(a.key, accessorData.key)); - - if (equalKeyElement) { - equalKeyElement.getters.push(...accessorData.getters); - equalKeyElement.setters.push(...accessorData.setters); - } else { - accessors.push(accessorData); - } - - return accessors; - } - - /** - * Checks accessor pairs in the given list of nodes. - * @param {ASTNode[]} nodes The list to check. - * @returns {void} - * @private - */ - function checkList(nodes) { - const accessors = nodes - .filter(isAccessorKind) - .map(createAccessorData) - .reduce(mergeAccessorData, []); - - for (const { getters, setters } of accessors) { - if (checkSetWithoutGet && setters.length && !getters.length) { - reportList(setters, "missingGetter"); - } - if (checkGetWithoutSet && getters.length && !setters.length) { - reportList(getters, "missingSetter"); - } - } - } - - /** - * Checks accessor pairs in an object literal. - * @param {ASTNode} node `ObjectExpression` node to check. - * @returns {void} - * @private - */ - function checkObjectLiteral(node) { - checkList(node.properties.filter(p => p.type === "Property")); - } - - /** - * Checks accessor pairs in a property descriptor. - * @param {ASTNode} node Property descriptor `ObjectExpression` node to check. - * @returns {void} - * @private - */ - function checkPropertyDescriptor(node) { - const namesToCheck = new Set(node.properties - .filter(p => p.type === "Property" && p.kind === "init" && !p.computed) - .map(({ key }) => key.name)); - - const hasGetter = namesToCheck.has("get"); - const hasSetter = namesToCheck.has("set"); - - if (checkSetWithoutGet && hasSetter && !hasGetter) { - report(node, "missingGetter"); - } - if (checkGetWithoutSet && hasGetter && !hasSetter) { - report(node, "missingSetter"); - } - } - - /** - * Checks the given object expression as an object literal and as a possible property descriptor. - * @param {ASTNode} node `ObjectExpression` node to check. - * @returns {void} - * @private - */ - function checkObjectExpression(node) { - checkObjectLiteral(node); - if (isPropertyDescriptor(node)) { - checkPropertyDescriptor(node); - } - } - - /** - * Checks the given class body. - * @param {ASTNode} node `ClassBody` node to check. - * @returns {void} - * @private - */ - function checkClassBody(node) { - const methodDefinitions = node.body.filter(m => m.type === "MethodDefinition"); - - checkList(methodDefinitions.filter(m => m.static)); - checkList(methodDefinitions.filter(m => !m.static)); - } - - const listeners = {}; - - if (checkSetWithoutGet || checkGetWithoutSet) { - listeners.ObjectExpression = checkObjectExpression; - if (enforceForClassMembers) { - listeners.ClassBody = checkClassBody; - } - } - - return listeners; - } -}; diff --git a/node_modules/eslint/lib/rules/array-bracket-newline.js b/node_modules/eslint/lib/rules/array-bracket-newline.js deleted file mode 100644 index c3676bf4d..000000000 --- a/node_modules/eslint/lib/rules/array-bracket-newline.js +++ /dev/null @@ -1,258 +0,0 @@ -/** - * @fileoverview Rule to enforce linebreaks after open and before close array brackets - * @author Jan Peer Stöcklmair - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce linebreaks after opening and before closing array brackets", - recommended: false, - url: "https://eslint.org/docs/latest/rules/array-bracket-newline" - }, - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - { - enum: ["always", "never", "consistent"] - }, - { - type: "object", - properties: { - multiline: { - type: "boolean" - }, - minItems: { - type: ["integer", "null"], - minimum: 0 - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - unexpectedOpeningLinebreak: "There should be no linebreak after '['.", - unexpectedClosingLinebreak: "There should be no linebreak before ']'.", - missingOpeningLinebreak: "A linebreak is required after '['.", - missingClosingLinebreak: "A linebreak is required before ']'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - - //---------------------------------------------------------------------- - // Helpers - //---------------------------------------------------------------------- - - /** - * Normalizes a given option value. - * @param {string|Object|undefined} option An option value to parse. - * @returns {{multiline: boolean, minItems: number}} Normalized option object. - */ - function normalizeOptionValue(option) { - let consistent = false; - let multiline = false; - let minItems = 0; - - if (option) { - if (option === "consistent") { - consistent = true; - minItems = Number.POSITIVE_INFINITY; - } else if (option === "always" || option.minItems === 0) { - minItems = 0; - } else if (option === "never") { - minItems = Number.POSITIVE_INFINITY; - } else { - multiline = Boolean(option.multiline); - minItems = option.minItems || Number.POSITIVE_INFINITY; - } - } else { - consistent = false; - multiline = true; - minItems = Number.POSITIVE_INFINITY; - } - - return { consistent, multiline, minItems }; - } - - /** - * Normalizes a given option value. - * @param {string|Object|undefined} options An option value to parse. - * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object. - */ - function normalizeOptions(options) { - const value = normalizeOptionValue(options); - - return { ArrayExpression: value, ArrayPattern: value }; - } - - /** - * Reports that there shouldn't be a linebreak after the first token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportNoBeginningLinebreak(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "unexpectedOpeningLinebreak", - fix(fixer) { - const nextToken = sourceCode.getTokenAfter(token, { includeComments: true }); - - if (astUtils.isCommentToken(nextToken)) { - return null; - } - - return fixer.removeRange([token.range[1], nextToken.range[0]]); - } - }); - } - - /** - * Reports that there shouldn't be a linebreak before the last token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportNoEndingLinebreak(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "unexpectedClosingLinebreak", - fix(fixer) { - const previousToken = sourceCode.getTokenBefore(token, { includeComments: true }); - - if (astUtils.isCommentToken(previousToken)) { - return null; - } - - return fixer.removeRange([previousToken.range[1], token.range[0]]); - } - }); - } - - /** - * Reports that there should be a linebreak after the first token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportRequiredBeginningLinebreak(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "missingOpeningLinebreak", - fix(fixer) { - return fixer.insertTextAfter(token, "\n"); - } - }); - } - - /** - * Reports that there should be a linebreak before the last token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportRequiredEndingLinebreak(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "missingClosingLinebreak", - fix(fixer) { - return fixer.insertTextBefore(token, "\n"); - } - }); - } - - /** - * Reports a given node if it violated this rule. - * @param {ASTNode} node A node to check. This is an ArrayExpression node or an ArrayPattern node. - * @returns {void} - */ - function check(node) { - const elements = node.elements; - const normalizedOptions = normalizeOptions(context.options[0]); - const options = normalizedOptions[node.type]; - const openBracket = sourceCode.getFirstToken(node); - const closeBracket = sourceCode.getLastToken(node); - const firstIncComment = sourceCode.getTokenAfter(openBracket, { includeComments: true }); - const lastIncComment = sourceCode.getTokenBefore(closeBracket, { includeComments: true }); - const first = sourceCode.getTokenAfter(openBracket); - const last = sourceCode.getTokenBefore(closeBracket); - - const needsLinebreaks = ( - elements.length >= options.minItems || - ( - options.multiline && - elements.length > 0 && - firstIncComment.loc.start.line !== lastIncComment.loc.end.line - ) || - ( - elements.length === 0 && - firstIncComment.type === "Block" && - firstIncComment.loc.start.line !== lastIncComment.loc.end.line && - firstIncComment === lastIncComment - ) || - ( - options.consistent && - openBracket.loc.end.line !== first.loc.start.line - ) - ); - - /* - * Use tokens or comments to check multiline or not. - * But use only tokens to check whether linebreaks are needed. - * This allows: - * var arr = [ // eslint-disable-line foo - * 'a' - * ] - */ - - if (needsLinebreaks) { - if (astUtils.isTokenOnSameLine(openBracket, first)) { - reportRequiredBeginningLinebreak(node, openBracket); - } - if (astUtils.isTokenOnSameLine(last, closeBracket)) { - reportRequiredEndingLinebreak(node, closeBracket); - } - } else { - if (!astUtils.isTokenOnSameLine(openBracket, first)) { - reportNoBeginningLinebreak(node, openBracket); - } - if (!astUtils.isTokenOnSameLine(last, closeBracket)) { - reportNoEndingLinebreak(node, closeBracket); - } - } - } - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - ArrayPattern: check, - ArrayExpression: check - }; - } -}; diff --git a/node_modules/eslint/lib/rules/array-bracket-spacing.js b/node_modules/eslint/lib/rules/array-bracket-spacing.js deleted file mode 100644 index e3a46d822..000000000 --- a/node_modules/eslint/lib/rules/array-bracket-spacing.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside of array brackets. - * @author Jamund Ferguson - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing inside array brackets", - recommended: false, - url: "https://eslint.org/docs/latest/rules/array-bracket-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - singleValue: { - type: "boolean" - }, - objectsInArrays: { - type: "boolean" - }, - arraysInArrays: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.", - unexpectedSpaceBefore: "There should be no space before '{{tokenValue}}'.", - missingSpaceAfter: "A space is required after '{{tokenValue}}'.", - missingSpaceBefore: "A space is required before '{{tokenValue}}'." - } - }, - create(context) { - const spaced = context.options[0] === "always", - sourceCode = context.sourceCode; - - /** - * Determines whether an option is set, relative to the spacing option. - * If spaced is "always", then check whether option is set to false. - * If spaced is "never", then check whether option is set to true. - * @param {Object} option The option to exclude. - * @returns {boolean} Whether or not the property is excluded. - */ - function isOptionSet(option) { - return context.options[1] ? context.options[1][option] === !spaced : false; - } - - const options = { - spaced, - singleElementException: isOptionSet("singleValue"), - objectsInArraysException: isOptionSet("objectsInArrays"), - arraysInArraysException: isOptionSet("arraysInArrays") - }; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportNoBeginningSpace(node, token) { - const nextToken = sourceCode.getTokenAfter(token); - - context.report({ - node, - loc: { start: token.loc.end, end: nextToken.loc.start }, - messageId: "unexpectedSpaceAfter", - data: { - tokenValue: token.value - }, - fix(fixer) { - return fixer.removeRange([token.range[1], nextToken.range[0]]); - } - }); - } - - /** - * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportNoEndingSpace(node, token) { - const previousToken = sourceCode.getTokenBefore(token); - - context.report({ - node, - loc: { start: previousToken.loc.end, end: token.loc.start }, - messageId: "unexpectedSpaceBefore", - data: { - tokenValue: token.value - }, - fix(fixer) { - return fixer.removeRange([previousToken.range[1], token.range[0]]); - } - }); - } - - /** - * Reports that there should be a space after the first token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportRequiredBeginningSpace(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "missingSpaceAfter", - data: { - tokenValue: token.value - }, - fix(fixer) { - return fixer.insertTextAfter(token, " "); - } - }); - } - - /** - * Reports that there should be a space before the last token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportRequiredEndingSpace(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "missingSpaceBefore", - data: { - tokenValue: token.value - }, - fix(fixer) { - return fixer.insertTextBefore(token, " "); - } - }); - } - - /** - * Determines if a node is an object type - * @param {ASTNode} node The node to check. - * @returns {boolean} Whether or not the node is an object type. - */ - function isObjectType(node) { - return node && (node.type === "ObjectExpression" || node.type === "ObjectPattern"); - } - - /** - * Determines if a node is an array type - * @param {ASTNode} node The node to check. - * @returns {boolean} Whether or not the node is an array type. - */ - function isArrayType(node) { - return node && (node.type === "ArrayExpression" || node.type === "ArrayPattern"); - } - - /** - * Validates the spacing around array brackets - * @param {ASTNode} node The node we're checking for spacing - * @returns {void} - */ - function validateArraySpacing(node) { - if (options.spaced && node.elements.length === 0) { - return; - } - - const first = sourceCode.getFirstToken(node), - second = sourceCode.getFirstToken(node, 1), - last = node.typeAnnotation - ? sourceCode.getTokenBefore(node.typeAnnotation) - : sourceCode.getLastToken(node), - penultimate = sourceCode.getTokenBefore(last), - firstElement = node.elements[0], - lastElement = node.elements[node.elements.length - 1]; - - const openingBracketMustBeSpaced = - options.objectsInArraysException && isObjectType(firstElement) || - options.arraysInArraysException && isArrayType(firstElement) || - options.singleElementException && node.elements.length === 1 - ? !options.spaced : options.spaced; - - const closingBracketMustBeSpaced = - options.objectsInArraysException && isObjectType(lastElement) || - options.arraysInArraysException && isArrayType(lastElement) || - options.singleElementException && node.elements.length === 1 - ? !options.spaced : options.spaced; - - if (astUtils.isTokenOnSameLine(first, second)) { - if (openingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(first, second)) { - reportRequiredBeginningSpace(node, first); - } - if (!openingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(first, second)) { - reportNoBeginningSpace(node, first); - } - } - - if (first !== penultimate && astUtils.isTokenOnSameLine(penultimate, last)) { - if (closingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(penultimate, last)) { - reportRequiredEndingSpace(node, last); - } - if (!closingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(penultimate, last)) { - reportNoEndingSpace(node, last); - } - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - ArrayPattern: validateArraySpacing, - ArrayExpression: validateArraySpacing - }; - } -}; diff --git a/node_modules/eslint/lib/rules/array-callback-return.js b/node_modules/eslint/lib/rules/array-callback-return.js deleted file mode 100644 index 05cd4ede9..000000000 --- a/node_modules/eslint/lib/rules/array-callback-return.js +++ /dev/null @@ -1,296 +0,0 @@ -/** - * @fileoverview Rule to enforce return statements in callbacks of array's methods - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const TARGET_NODE_TYPE = /^(?:Arrow)?FunctionExpression$/u; -const TARGET_METHODS = /^(?:every|filter|find(?:Last)?(?:Index)?|flatMap|forEach|map|reduce(?:Right)?|some|sort|toSorted)$/u; - -/** - * Checks a given code path segment is reachable. - * @param {CodePathSegment} segment A segment to check. - * @returns {boolean} `true` if the segment is reachable. - */ -function isReachable(segment) { - return segment.reachable; -} - -/** - * Checks a given node is a member access which has the specified name's - * property. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is a member access which has - * the specified name's property. The node may be a `(Chain|Member)Expression` node. - */ -function isTargetMethod(node) { - return astUtils.isSpecificMemberAccess(node, null, TARGET_METHODS); -} - -/** - * Returns a human-legible description of an array method - * @param {string} arrayMethodName A method name to fully qualify - * @returns {string} the method name prefixed with `Array.` if it is a class method, - * or else `Array.prototype.` if it is an instance method. - */ -function fullMethodName(arrayMethodName) { - if (["from", "of", "isArray"].includes(arrayMethodName)) { - return "Array.".concat(arrayMethodName); - } - return "Array.prototype.".concat(arrayMethodName); -} - -/** - * Checks whether or not a given node is a function expression which is the - * callback of an array method, returning the method name. - * @param {ASTNode} node A node to check. This is one of - * FunctionExpression or ArrowFunctionExpression. - * @returns {string} The method name if the node is a callback method, - * null otherwise. - */ -function getArrayMethodName(node) { - let currentNode = node; - - while (currentNode) { - const parent = currentNode.parent; - - switch (parent.type) { - - /* - * Looks up the destination. e.g., - * foo.every(nativeFoo || function foo() { ... }); - */ - case "LogicalExpression": - case "ConditionalExpression": - case "ChainExpression": - currentNode = parent; - break; - - /* - * If the upper function is IIFE, checks the destination of the return value. - * e.g. - * foo.every((function() { - * // setup... - * return function callback() { ... }; - * })()); - */ - case "ReturnStatement": { - const func = astUtils.getUpperFunction(parent); - - if (func === null || !astUtils.isCallee(func)) { - return null; - } - currentNode = func.parent; - break; - } - - /* - * e.g. - * Array.from([], function() {}); - * list.every(function() {}); - */ - case "CallExpression": - if (astUtils.isArrayFromMethod(parent.callee)) { - if ( - parent.arguments.length >= 2 && - parent.arguments[1] === currentNode - ) { - return "from"; - } - } - if (isTargetMethod(parent.callee)) { - if ( - parent.arguments.length >= 1 && - parent.arguments[0] === currentNode - ) { - return astUtils.getStaticPropertyName(parent.callee); - } - } - return null; - - // Otherwise this node is not target. - default: - return null; - } - } - - /* c8 ignore next */ - return null; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Enforce `return` statements in callbacks of array methods", - recommended: false, - url: "https://eslint.org/docs/latest/rules/array-callback-return" - }, - - schema: [ - { - type: "object", - properties: { - allowImplicit: { - type: "boolean", - default: false - }, - checkForEach: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - expectedAtEnd: "{{arrayMethodName}}() expects a value to be returned at the end of {{name}}.", - expectedInside: "{{arrayMethodName}}() expects a return value from {{name}}.", - expectedReturnValue: "{{arrayMethodName}}() expects a return value from {{name}}.", - expectedNoReturnValue: "{{arrayMethodName}}() expects no useless return value from {{name}}." - } - }, - - create(context) { - - const options = context.options[0] || { allowImplicit: false, checkForEach: false }; - const sourceCode = context.sourceCode; - - let funcInfo = { - arrayMethodName: null, - upper: null, - codePath: null, - hasReturn: false, - shouldCheck: false, - node: null - }; - - /** - * Checks whether or not the last code path segment is reachable. - * Then reports this function if the segment is reachable. - * - * If the last code path segment is reachable, there are paths which are not - * returned or thrown. - * @param {ASTNode} node A node to check. - * @returns {void} - */ - function checkLastSegment(node) { - - if (!funcInfo.shouldCheck) { - return; - } - - let messageId = null; - - if (funcInfo.arrayMethodName === "forEach") { - if (options.checkForEach && node.type === "ArrowFunctionExpression" && node.expression) { - messageId = "expectedNoReturnValue"; - } - } else { - if (node.body.type === "BlockStatement" && funcInfo.codePath.currentSegments.some(isReachable)) { - messageId = funcInfo.hasReturn ? "expectedAtEnd" : "expectedInside"; - } - } - - if (messageId) { - const name = astUtils.getFunctionNameWithKind(node); - - context.report({ - node, - loc: astUtils.getFunctionHeadLoc(node, sourceCode), - messageId, - data: { name, arrayMethodName: fullMethodName(funcInfo.arrayMethodName) } - }); - } - } - - return { - - // Stacks this function's information. - onCodePathStart(codePath, node) { - - let methodName = null; - - if (TARGET_NODE_TYPE.test(node.type)) { - methodName = getArrayMethodName(node); - } - - funcInfo = { - arrayMethodName: methodName, - upper: funcInfo, - codePath, - hasReturn: false, - shouldCheck: - methodName && - !node.async && - !node.generator, - node - }; - }, - - // Pops this function's information. - onCodePathEnd() { - funcInfo = funcInfo.upper; - }, - - // Checks the return statement is valid. - ReturnStatement(node) { - - if (!funcInfo.shouldCheck) { - return; - } - - funcInfo.hasReturn = true; - - let messageId = null; - - if (funcInfo.arrayMethodName === "forEach") { - - // if checkForEach: true, returning a value at any path inside a forEach is not allowed - if (options.checkForEach && node.argument) { - messageId = "expectedNoReturnValue"; - } - } else { - - // if allowImplicit: false, should also check node.argument - if (!options.allowImplicit && !node.argument) { - messageId = "expectedReturnValue"; - } - } - - if (messageId) { - context.report({ - node, - messageId, - data: { - name: astUtils.getFunctionNameWithKind(funcInfo.node), - arrayMethodName: fullMethodName(funcInfo.arrayMethodName) - } - }); - } - }, - - // Reports a given function if the last path is reachable. - "FunctionExpression:exit": checkLastSegment, - "ArrowFunctionExpression:exit": checkLastSegment - }; - } -}; diff --git a/node_modules/eslint/lib/rules/array-element-newline.js b/node_modules/eslint/lib/rules/array-element-newline.js deleted file mode 100644 index be547ec36..000000000 --- a/node_modules/eslint/lib/rules/array-element-newline.js +++ /dev/null @@ -1,302 +0,0 @@ -/** - * @fileoverview Rule to enforce line breaks after each array element - * @author Jan Peer Stöcklmair - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce line breaks after each array element", - recommended: false, - url: "https://eslint.org/docs/latest/rules/array-element-newline" - }, - - fixable: "whitespace", - - schema: { - definitions: { - basicConfig: { - oneOf: [ - { - enum: ["always", "never", "consistent"] - }, - { - type: "object", - properties: { - multiline: { - type: "boolean" - }, - minItems: { - type: ["integer", "null"], - minimum: 0 - } - }, - additionalProperties: false - } - ] - } - }, - type: "array", - items: [ - { - oneOf: [ - { - $ref: "#/definitions/basicConfig" - }, - { - type: "object", - properties: { - ArrayExpression: { - $ref: "#/definitions/basicConfig" - }, - ArrayPattern: { - $ref: "#/definitions/basicConfig" - } - }, - additionalProperties: false, - minProperties: 1 - } - ] - } - ] - }, - - messages: { - unexpectedLineBreak: "There should be no linebreak here.", - missingLineBreak: "There should be a linebreak after this element." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - //---------------------------------------------------------------------- - // Helpers - //---------------------------------------------------------------------- - - /** - * Normalizes a given option value. - * @param {string|Object|undefined} providedOption An option value to parse. - * @returns {{multiline: boolean, minItems: number}} Normalized option object. - */ - function normalizeOptionValue(providedOption) { - let consistent = false; - let multiline = false; - let minItems; - - const option = providedOption || "always"; - - if (!option || option === "always" || option.minItems === 0) { - minItems = 0; - } else if (option === "never") { - minItems = Number.POSITIVE_INFINITY; - } else if (option === "consistent") { - consistent = true; - minItems = Number.POSITIVE_INFINITY; - } else { - multiline = Boolean(option.multiline); - minItems = option.minItems || Number.POSITIVE_INFINITY; - } - - return { consistent, multiline, minItems }; - } - - /** - * Normalizes a given option value. - * @param {string|Object|undefined} options An option value to parse. - * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object. - */ - function normalizeOptions(options) { - if (options && (options.ArrayExpression || options.ArrayPattern)) { - let expressionOptions, patternOptions; - - if (options.ArrayExpression) { - expressionOptions = normalizeOptionValue(options.ArrayExpression); - } - - if (options.ArrayPattern) { - patternOptions = normalizeOptionValue(options.ArrayPattern); - } - - return { ArrayExpression: expressionOptions, ArrayPattern: patternOptions }; - } - - const value = normalizeOptionValue(options); - - return { ArrayExpression: value, ArrayPattern: value }; - } - - /** - * Reports that there shouldn't be a line break after the first token - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportNoLineBreak(token) { - const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true }); - - context.report({ - loc: { - start: tokenBefore.loc.end, - end: token.loc.start - }, - messageId: "unexpectedLineBreak", - fix(fixer) { - if (astUtils.isCommentToken(tokenBefore)) { - return null; - } - - if (!astUtils.isTokenOnSameLine(tokenBefore, token)) { - return fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], " "); - } - - /* - * This will check if the comma is on the same line as the next element - * Following array: - * [ - * 1 - * , 2 - * , 3 - * ] - * - * will be fixed to: - * [ - * 1, 2, 3 - * ] - */ - const twoTokensBefore = sourceCode.getTokenBefore(tokenBefore, { includeComments: true }); - - if (astUtils.isCommentToken(twoTokensBefore)) { - return null; - } - - return fixer.replaceTextRange([twoTokensBefore.range[1], tokenBefore.range[0]], ""); - - } - }); - } - - /** - * Reports that there should be a line break after the first token - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportRequiredLineBreak(token) { - const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true }); - - context.report({ - loc: { - start: tokenBefore.loc.end, - end: token.loc.start - }, - messageId: "missingLineBreak", - fix(fixer) { - return fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], "\n"); - } - }); - } - - /** - * Reports a given node if it violated this rule. - * @param {ASTNode} node A node to check. This is an ObjectExpression node or an ObjectPattern node. - * @returns {void} - */ - function check(node) { - const elements = node.elements; - const normalizedOptions = normalizeOptions(context.options[0]); - const options = normalizedOptions[node.type]; - - if (!options) { - return; - } - - let elementBreak = false; - - /* - * MULTILINE: true - * loop through every element and check - * if at least one element has linebreaks inside - * this ensures that following is not valid (due to elements are on the same line): - * - * [ - * 1, - * 2, - * 3 - * ] - */ - if (options.multiline) { - elementBreak = elements - .filter(element => element !== null) - .some(element => element.loc.start.line !== element.loc.end.line); - } - - const linebreaksCount = node.elements.map((element, i) => { - const previousElement = elements[i - 1]; - - if (i === 0 || element === null || previousElement === null) { - return false; - } - - const commaToken = sourceCode.getFirstTokenBetween(previousElement, element, astUtils.isCommaToken); - const lastTokenOfPreviousElement = sourceCode.getTokenBefore(commaToken); - const firstTokenOfCurrentElement = sourceCode.getTokenAfter(commaToken); - - return !astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement); - }).filter(isBreak => isBreak === true).length; - - const needsLinebreaks = ( - elements.length >= options.minItems || - ( - options.multiline && - elementBreak - ) || - ( - options.consistent && - linebreaksCount > 0 && - linebreaksCount < node.elements.length - ) - ); - - elements.forEach((element, i) => { - const previousElement = elements[i - 1]; - - if (i === 0 || element === null || previousElement === null) { - return; - } - - const commaToken = sourceCode.getFirstTokenBetween(previousElement, element, astUtils.isCommaToken); - const lastTokenOfPreviousElement = sourceCode.getTokenBefore(commaToken); - const firstTokenOfCurrentElement = sourceCode.getTokenAfter(commaToken); - - if (needsLinebreaks) { - if (astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement)) { - reportRequiredLineBreak(firstTokenOfCurrentElement); - } - } else { - if (!astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement)) { - reportNoLineBreak(firstTokenOfCurrentElement); - } - } - }); - } - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - ArrayPattern: check, - ArrayExpression: check - }; - } -}; diff --git a/node_modules/eslint/lib/rules/arrow-body-style.js b/node_modules/eslint/lib/rules/arrow-body-style.js deleted file mode 100644 index 759070454..000000000 --- a/node_modules/eslint/lib/rules/arrow-body-style.js +++ /dev/null @@ -1,296 +0,0 @@ -/** - * @fileoverview Rule to require braces in arrow function body. - * @author Alberto Rodríguez - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require braces around arrow function bodies", - recommended: false, - url: "https://eslint.org/docs/latest/rules/arrow-body-style" - }, - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["always", "never"] - } - ], - minItems: 0, - maxItems: 1 - }, - { - type: "array", - items: [ - { - enum: ["as-needed"] - }, - { - type: "object", - properties: { - requireReturnForObjectLiteral: { type: "boolean" } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - } - ] - }, - - fixable: "code", - - messages: { - unexpectedOtherBlock: "Unexpected block statement surrounding arrow body.", - unexpectedEmptyBlock: "Unexpected block statement surrounding arrow body; put a value of `undefined` immediately after the `=>`.", - unexpectedObjectBlock: "Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the `=>`.", - unexpectedSingleBlock: "Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`.", - expectedBlock: "Expected block statement surrounding arrow body." - } - }, - - create(context) { - const options = context.options; - const always = options[0] === "always"; - const asNeeded = !options[0] || options[0] === "as-needed"; - const never = options[0] === "never"; - const requireReturnForObjectLiteral = options[1] && options[1].requireReturnForObjectLiteral; - const sourceCode = context.sourceCode; - let funcInfo = null; - - /** - * Checks whether the given node has ASI problem or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if it changes semantics if `;` or `}` followed by the token are removed. - */ - function hasASIProblem(token) { - return token && token.type === "Punctuator" && /^[([/`+-]/u.test(token.value); - } - - /** - * Gets the closing parenthesis by the given node. - * @param {ASTNode} node first node after an opening parenthesis. - * @returns {Token} The found closing parenthesis token. - */ - function findClosingParen(node) { - let nodeToCheck = node; - - while (!astUtils.isParenthesised(sourceCode, nodeToCheck)) { - nodeToCheck = nodeToCheck.parent; - } - return sourceCode.getTokenAfter(nodeToCheck); - } - - /** - * Check whether the node is inside of a for loop's init - * @param {ASTNode} node node is inside for loop - * @returns {boolean} `true` if the node is inside of a for loop, else `false` - */ - function isInsideForLoopInitializer(node) { - if (node && node.parent) { - if (node.parent.type === "ForStatement" && node.parent.init === node) { - return true; - } - return isInsideForLoopInitializer(node.parent); - } - return false; - } - - /** - * Determines whether a arrow function body needs braces - * @param {ASTNode} node The arrow function node. - * @returns {void} - */ - function validate(node) { - const arrowBody = node.body; - - if (arrowBody.type === "BlockStatement") { - const blockBody = arrowBody.body; - - if (blockBody.length !== 1 && !never) { - return; - } - - if (asNeeded && requireReturnForObjectLiteral && blockBody[0].type === "ReturnStatement" && - blockBody[0].argument && blockBody[0].argument.type === "ObjectExpression") { - return; - } - - if (never || asNeeded && blockBody[0].type === "ReturnStatement") { - let messageId; - - if (blockBody.length === 0) { - messageId = "unexpectedEmptyBlock"; - } else if (blockBody.length > 1) { - messageId = "unexpectedOtherBlock"; - } else if (blockBody[0].argument === null) { - messageId = "unexpectedSingleBlock"; - } else if (astUtils.isOpeningBraceToken(sourceCode.getFirstToken(blockBody[0], { skip: 1 }))) { - messageId = "unexpectedObjectBlock"; - } else { - messageId = "unexpectedSingleBlock"; - } - - context.report({ - node, - loc: arrowBody.loc, - messageId, - fix(fixer) { - const fixes = []; - - if (blockBody.length !== 1 || - blockBody[0].type !== "ReturnStatement" || - !blockBody[0].argument || - hasASIProblem(sourceCode.getTokenAfter(arrowBody)) - ) { - return fixes; - } - - const openingBrace = sourceCode.getFirstToken(arrowBody); - const closingBrace = sourceCode.getLastToken(arrowBody); - const firstValueToken = sourceCode.getFirstToken(blockBody[0], 1); - const lastValueToken = sourceCode.getLastToken(blockBody[0]); - const commentsExist = - sourceCode.commentsExistBetween(openingBrace, firstValueToken) || - sourceCode.commentsExistBetween(lastValueToken, closingBrace); - - /* - * Remove tokens around the return value. - * If comments don't exist, remove extra spaces as well. - */ - if (commentsExist) { - fixes.push( - fixer.remove(openingBrace), - fixer.remove(closingBrace), - fixer.remove(sourceCode.getTokenAfter(openingBrace)) // return keyword - ); - } else { - fixes.push( - fixer.removeRange([openingBrace.range[0], firstValueToken.range[0]]), - fixer.removeRange([lastValueToken.range[1], closingBrace.range[1]]) - ); - } - - /* - * If the first token of the return value is `{` or the return value is a sequence expression, - * enclose the return value by parentheses to avoid syntax error. - */ - if (astUtils.isOpeningBraceToken(firstValueToken) || blockBody[0].argument.type === "SequenceExpression" || (funcInfo.hasInOperator && isInsideForLoopInitializer(node))) { - if (!astUtils.isParenthesised(sourceCode, blockBody[0].argument)) { - fixes.push( - fixer.insertTextBefore(firstValueToken, "("), - fixer.insertTextAfter(lastValueToken, ")") - ); - } - } - - /* - * If the last token of the return statement is semicolon, remove it. - * Non-block arrow body is an expression, not a statement. - */ - if (astUtils.isSemicolonToken(lastValueToken)) { - fixes.push(fixer.remove(lastValueToken)); - } - - return fixes; - } - }); - } - } else { - if (always || (asNeeded && requireReturnForObjectLiteral && arrowBody.type === "ObjectExpression")) { - context.report({ - node, - loc: arrowBody.loc, - messageId: "expectedBlock", - fix(fixer) { - const fixes = []; - const arrowToken = sourceCode.getTokenBefore(arrowBody, astUtils.isArrowToken); - const [firstTokenAfterArrow, secondTokenAfterArrow] = sourceCode.getTokensAfter(arrowToken, { count: 2 }); - const lastToken = sourceCode.getLastToken(node); - - let parenthesisedObjectLiteral = null; - - if ( - astUtils.isOpeningParenToken(firstTokenAfterArrow) && - astUtils.isOpeningBraceToken(secondTokenAfterArrow) - ) { - const braceNode = sourceCode.getNodeByRangeIndex(secondTokenAfterArrow.range[0]); - - if (braceNode.type === "ObjectExpression") { - parenthesisedObjectLiteral = braceNode; - } - } - - // If the value is object literal, remove parentheses which were forced by syntax. - if (parenthesisedObjectLiteral) { - const openingParenToken = firstTokenAfterArrow; - const openingBraceToken = secondTokenAfterArrow; - - if (astUtils.isTokenOnSameLine(openingParenToken, openingBraceToken)) { - fixes.push(fixer.replaceText(openingParenToken, "{return ")); - } else { - - // Avoid ASI - fixes.push( - fixer.replaceText(openingParenToken, "{"), - fixer.insertTextBefore(openingBraceToken, "return ") - ); - } - - // Closing paren for the object doesn't have to be lastToken, e.g.: () => ({}).foo() - fixes.push(fixer.remove(findClosingParen(parenthesisedObjectLiteral))); - fixes.push(fixer.insertTextAfter(lastToken, "}")); - - } else { - fixes.push(fixer.insertTextBefore(firstTokenAfterArrow, "{return ")); - fixes.push(fixer.insertTextAfter(lastToken, "}")); - } - - return fixes; - } - }); - } - } - } - - return { - "BinaryExpression[operator='in']"() { - let info = funcInfo; - - while (info) { - info.hasInOperator = true; - info = info.upper; - } - }, - ArrowFunctionExpression() { - funcInfo = { - upper: funcInfo, - hasInOperator: false - }; - }, - "ArrowFunctionExpression:exit"(node) { - validate(node); - funcInfo = funcInfo.upper; - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/arrow-parens.js b/node_modules/eslint/lib/rules/arrow-parens.js deleted file mode 100644 index 046332317..000000000 --- a/node_modules/eslint/lib/rules/arrow-parens.js +++ /dev/null @@ -1,183 +0,0 @@ -/** - * @fileoverview Rule to require parens in arrow function arguments. - * @author Jxck - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines if the given arrow function has block body. - * @param {ASTNode} node `ArrowFunctionExpression` node. - * @returns {boolean} `true` if the function has block body. - */ -function hasBlockBody(node) { - return node.body.type === "BlockStatement"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require parentheses around arrow function arguments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/arrow-parens" - }, - - fixable: "code", - - schema: [ - { - enum: ["always", "as-needed"] - }, - { - type: "object", - properties: { - requireForBlockBody: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedParens: "Unexpected parentheses around single function argument.", - expectedParens: "Expected parentheses around arrow function argument.", - - unexpectedParensInline: "Unexpected parentheses around single function argument having a body with no curly braces.", - expectedParensBlock: "Expected parentheses around arrow function argument having a body with curly braces." - } - }, - - create(context) { - const asNeeded = context.options[0] === "as-needed"; - const requireForBlockBody = asNeeded && context.options[1] && context.options[1].requireForBlockBody === true; - - const sourceCode = context.sourceCode; - - /** - * Finds opening paren of parameters for the given arrow function, if it exists. - * It is assumed that the given arrow function has exactly one parameter. - * @param {ASTNode} node `ArrowFunctionExpression` node. - * @returns {Token|null} the opening paren, or `null` if the given arrow function doesn't have parens of parameters. - */ - function findOpeningParenOfParams(node) { - const tokenBeforeParams = sourceCode.getTokenBefore(node.params[0]); - - if ( - tokenBeforeParams && - astUtils.isOpeningParenToken(tokenBeforeParams) && - node.range[0] <= tokenBeforeParams.range[0] - ) { - return tokenBeforeParams; - } - - return null; - } - - /** - * Finds closing paren of parameters for the given arrow function. - * It is assumed that the given arrow function has parens of parameters and that it has exactly one parameter. - * @param {ASTNode} node `ArrowFunctionExpression` node. - * @returns {Token} the closing paren of parameters. - */ - function getClosingParenOfParams(node) { - return sourceCode.getTokenAfter(node.params[0], astUtils.isClosingParenToken); - } - - /** - * Determines whether the given arrow function has comments inside parens of parameters. - * It is assumed that the given arrow function has parens of parameters. - * @param {ASTNode} node `ArrowFunctionExpression` node. - * @param {Token} openingParen Opening paren of parameters. - * @returns {boolean} `true` if the function has at least one comment inside of parens of parameters. - */ - function hasCommentsInParensOfParams(node, openingParen) { - return sourceCode.commentsExistBetween(openingParen, getClosingParenOfParams(node)); - } - - /** - * Determines whether the given arrow function has unexpected tokens before opening paren of parameters, - * in which case it will be assumed that the existing parens of parameters are necessary. - * Only tokens within the range of the arrow function (tokens that are part of the arrow function) are taken into account. - * Example: (a) => b - * @param {ASTNode} node `ArrowFunctionExpression` node. - * @param {Token} openingParen Opening paren of parameters. - * @returns {boolean} `true` if the function has at least one unexpected token. - */ - function hasUnexpectedTokensBeforeOpeningParen(node, openingParen) { - const expectedCount = node.async ? 1 : 0; - - return sourceCode.getFirstToken(node, { skip: expectedCount }) !== openingParen; - } - - return { - "ArrowFunctionExpression[params.length=1]"(node) { - const shouldHaveParens = !asNeeded || requireForBlockBody && hasBlockBody(node); - const openingParen = findOpeningParenOfParams(node); - const hasParens = openingParen !== null; - const [param] = node.params; - - if (shouldHaveParens && !hasParens) { - context.report({ - node, - messageId: requireForBlockBody ? "expectedParensBlock" : "expectedParens", - loc: param.loc, - *fix(fixer) { - yield fixer.insertTextBefore(param, "("); - yield fixer.insertTextAfter(param, ")"); - } - }); - } - - if ( - !shouldHaveParens && - hasParens && - param.type === "Identifier" && - !param.typeAnnotation && - !node.returnType && - !hasCommentsInParensOfParams(node, openingParen) && - !hasUnexpectedTokensBeforeOpeningParen(node, openingParen) - ) { - context.report({ - node, - messageId: requireForBlockBody ? "unexpectedParensInline" : "unexpectedParens", - loc: param.loc, - *fix(fixer) { - const tokenBeforeOpeningParen = sourceCode.getTokenBefore(openingParen); - const closingParen = getClosingParenOfParams(node); - - if ( - tokenBeforeOpeningParen && - tokenBeforeOpeningParen.range[1] === openingParen.range[0] && - !astUtils.canTokensBeAdjacent(tokenBeforeOpeningParen, sourceCode.getFirstToken(param)) - ) { - yield fixer.insertTextBefore(openingParen, " "); - } - - // remove parens, whitespace inside parens, and possible trailing comma - yield fixer.removeRange([openingParen.range[0], param.range[0]]); - yield fixer.removeRange([param.range[1], closingParen.range[1]]); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/arrow-spacing.js b/node_modules/eslint/lib/rules/arrow-spacing.js deleted file mode 100644 index fb74d2cb2..000000000 --- a/node_modules/eslint/lib/rules/arrow-spacing.js +++ /dev/null @@ -1,161 +0,0 @@ -/** - * @fileoverview Rule to define spacing before/after arrow function's arrow. - * @author Jxck - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing before and after the arrow in arrow functions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/arrow-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - before: { - type: "boolean", - default: true - }, - after: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - messages: { - expectedBefore: "Missing space before =>.", - unexpectedBefore: "Unexpected space before =>.", - - expectedAfter: "Missing space after =>.", - unexpectedAfter: "Unexpected space after =>." - } - }, - - create(context) { - - // merge rules with default - const rule = Object.assign({}, context.options[0]); - - rule.before = rule.before !== false; - rule.after = rule.after !== false; - - const sourceCode = context.sourceCode; - - /** - * Get tokens of arrow(`=>`) and before/after arrow. - * @param {ASTNode} node The arrow function node. - * @returns {Object} Tokens of arrow and before/after arrow. - */ - function getTokens(node) { - const arrow = sourceCode.getTokenBefore(node.body, astUtils.isArrowToken); - - return { - before: sourceCode.getTokenBefore(arrow), - arrow, - after: sourceCode.getTokenAfter(arrow) - }; - } - - /** - * Count spaces before/after arrow(`=>`) token. - * @param {Object} tokens Tokens before/after arrow. - * @returns {Object} count of space before/after arrow. - */ - function countSpaces(tokens) { - const before = tokens.arrow.range[0] - tokens.before.range[1]; - const after = tokens.after.range[0] - tokens.arrow.range[1]; - - return { before, after }; - } - - /** - * Determines whether space(s) before after arrow(`=>`) is satisfy rule. - * if before/after value is `true`, there should be space(s). - * if before/after value is `false`, there should be no space. - * @param {ASTNode} node The arrow function node. - * @returns {void} - */ - function spaces(node) { - const tokens = getTokens(node); - const countSpace = countSpaces(tokens); - - if (rule.before) { - - // should be space(s) before arrow - if (countSpace.before === 0) { - context.report({ - node: tokens.before, - messageId: "expectedBefore", - fix(fixer) { - return fixer.insertTextBefore(tokens.arrow, " "); - } - }); - } - } else { - - // should be no space before arrow - if (countSpace.before > 0) { - context.report({ - node: tokens.before, - messageId: "unexpectedBefore", - fix(fixer) { - return fixer.removeRange([tokens.before.range[1], tokens.arrow.range[0]]); - } - }); - } - } - - if (rule.after) { - - // should be space(s) after arrow - if (countSpace.after === 0) { - context.report({ - node: tokens.after, - messageId: "expectedAfter", - fix(fixer) { - return fixer.insertTextAfter(tokens.arrow, " "); - } - }); - } - } else { - - // should be no space after arrow - if (countSpace.after > 0) { - context.report({ - node: tokens.after, - messageId: "unexpectedAfter", - fix(fixer) { - return fixer.removeRange([tokens.arrow.range[1], tokens.after.range[0]]); - } - }); - } - } - } - - return { - ArrowFunctionExpression: spaces - }; - } -}; diff --git a/node_modules/eslint/lib/rules/block-scoped-var.js b/node_modules/eslint/lib/rules/block-scoped-var.js deleted file mode 100644 index 5a951276c..000000000 --- a/node_modules/eslint/lib/rules/block-scoped-var.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * @fileoverview Rule to check for "block scoped" variables by binding context - * @author Matt DuVall - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce the use of variables within the scope they are defined", - recommended: false, - url: "https://eslint.org/docs/latest/rules/block-scoped-var" - }, - - schema: [], - - messages: { - outOfScope: "'{{name}}' used outside of binding context." - } - }, - - create(context) { - let stack = []; - const sourceCode = context.sourceCode; - - /** - * Makes a block scope. - * @param {ASTNode} node A node of a scope. - * @returns {void} - */ - function enterScope(node) { - stack.push(node.range); - } - - /** - * Pops the last block scope. - * @returns {void} - */ - function exitScope() { - stack.pop(); - } - - /** - * Reports a given reference. - * @param {eslint-scope.Reference} reference A reference to report. - * @returns {void} - */ - function report(reference) { - const identifier = reference.identifier; - - context.report({ node: identifier, messageId: "outOfScope", data: { name: identifier.name } }); - } - - /** - * Finds and reports references which are outside of valid scopes. - * @param {ASTNode} node A node to get variables. - * @returns {void} - */ - function checkForVariables(node) { - if (node.kind !== "var") { - return; - } - - // Defines a predicate to check whether or not a given reference is outside of valid scope. - const scopeRange = stack[stack.length - 1]; - - /** - * Check if a reference is out of scope - * @param {ASTNode} reference node to examine - * @returns {boolean} True is its outside the scope - * @private - */ - function isOutsideOfScope(reference) { - const idRange = reference.identifier.range; - - return idRange[0] < scopeRange[0] || idRange[1] > scopeRange[1]; - } - - // Gets declared variables, and checks its references. - const variables = sourceCode.getDeclaredVariables(node); - - for (let i = 0; i < variables.length; ++i) { - - // Reports. - variables[i] - .references - .filter(isOutsideOfScope) - .forEach(report); - } - } - - return { - Program(node) { - stack = [node.range]; - }, - - // Manages scopes. - BlockStatement: enterScope, - "BlockStatement:exit": exitScope, - ForStatement: enterScope, - "ForStatement:exit": exitScope, - ForInStatement: enterScope, - "ForInStatement:exit": exitScope, - ForOfStatement: enterScope, - "ForOfStatement:exit": exitScope, - SwitchStatement: enterScope, - "SwitchStatement:exit": exitScope, - CatchClause: enterScope, - "CatchClause:exit": exitScope, - StaticBlock: enterScope, - "StaticBlock:exit": exitScope, - - // Finds and reports references which are outside of valid scope. - VariableDeclaration: checkForVariables - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/block-spacing.js b/node_modules/eslint/lib/rules/block-spacing.js deleted file mode 100644 index dd4851c68..000000000 --- a/node_modules/eslint/lib/rules/block-spacing.js +++ /dev/null @@ -1,171 +0,0 @@ -/** - * @fileoverview A rule to disallow or enforce spaces inside of single line blocks. - * @author Toru Nagashima - */ - -"use strict"; - -const util = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Disallow or enforce spaces inside of blocks after opening block and before closing block", - recommended: false, - url: "https://eslint.org/docs/latest/rules/block-spacing" - }, - - fixable: "whitespace", - - schema: [ - { enum: ["always", "never"] } - ], - - messages: { - missing: "Requires a space {{location}} '{{token}}'.", - extra: "Unexpected space(s) {{location}} '{{token}}'." - } - }, - - create(context) { - const always = (context.options[0] !== "never"), - messageId = always ? "missing" : "extra", - sourceCode = context.sourceCode; - - /** - * Gets the open brace token from a given node. - * @param {ASTNode} node A BlockStatement/StaticBlock/SwitchStatement node to get. - * @returns {Token} The token of the open brace. - */ - function getOpenBrace(node) { - if (node.type === "SwitchStatement") { - if (node.cases.length > 0) { - return sourceCode.getTokenBefore(node.cases[0]); - } - return sourceCode.getLastToken(node, 1); - } - - if (node.type === "StaticBlock") { - return sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token - } - - // "BlockStatement" - return sourceCode.getFirstToken(node); - } - - /** - * Checks whether or not: - * - given tokens are on same line. - * - there is/isn't a space between given tokens. - * @param {Token} left A token to check. - * @param {Token} right The token which is next to `left`. - * @returns {boolean} - * When the option is `"always"`, `true` if there are one or more spaces between given tokens. - * When the option is `"never"`, `true` if there are not any spaces between given tokens. - * If given tokens are not on same line, it's always `true`. - */ - function isValid(left, right) { - return ( - !util.isTokenOnSameLine(left, right) || - sourceCode.isSpaceBetweenTokens(left, right) === always - ); - } - - /** - * Checks and reports invalid spacing style inside braces. - * @param {ASTNode} node A BlockStatement/StaticBlock/SwitchStatement node to check. - * @returns {void} - */ - function checkSpacingInsideBraces(node) { - - // Gets braces and the first/last token of content. - const openBrace = getOpenBrace(node); - const closeBrace = sourceCode.getLastToken(node); - const firstToken = sourceCode.getTokenAfter(openBrace, { includeComments: true }); - const lastToken = sourceCode.getTokenBefore(closeBrace, { includeComments: true }); - - // Skip if the node is invalid or empty. - if (openBrace.type !== "Punctuator" || - openBrace.value !== "{" || - closeBrace.type !== "Punctuator" || - closeBrace.value !== "}" || - firstToken === closeBrace - ) { - return; - } - - // Skip line comments for option never - if (!always && firstToken.type === "Line") { - return; - } - - // Check. - if (!isValid(openBrace, firstToken)) { - let loc = openBrace.loc; - - if (messageId === "extra") { - loc = { - start: openBrace.loc.end, - end: firstToken.loc.start - }; - } - - context.report({ - node, - loc, - messageId, - data: { - location: "after", - token: openBrace.value - }, - fix(fixer) { - if (always) { - return fixer.insertTextBefore(firstToken, " "); - } - - return fixer.removeRange([openBrace.range[1], firstToken.range[0]]); - } - }); - } - if (!isValid(lastToken, closeBrace)) { - let loc = closeBrace.loc; - - if (messageId === "extra") { - loc = { - start: lastToken.loc.end, - end: closeBrace.loc.start - }; - } - context.report({ - node, - loc, - messageId, - data: { - location: "before", - token: closeBrace.value - }, - fix(fixer) { - if (always) { - return fixer.insertTextAfter(lastToken, " "); - } - - return fixer.removeRange([lastToken.range[1], closeBrace.range[0]]); - } - }); - } - } - - return { - BlockStatement: checkSpacingInsideBraces, - StaticBlock: checkSpacingInsideBraces, - SwitchStatement: checkSpacingInsideBraces - }; - } -}; diff --git a/node_modules/eslint/lib/rules/brace-style.js b/node_modules/eslint/lib/rules/brace-style.js deleted file mode 100644 index 59758c909..000000000 --- a/node_modules/eslint/lib/rules/brace-style.js +++ /dev/null @@ -1,194 +0,0 @@ -/** - * @fileoverview Rule to flag block statements that do not use the one true brace style - * @author Ian Christian Myers - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent brace style for blocks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/brace-style" - }, - - schema: [ - { - enum: ["1tbs", "stroustrup", "allman"] - }, - { - type: "object", - properties: { - allowSingleLine: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - fixable: "whitespace", - - messages: { - nextLineOpen: "Opening curly brace does not appear on the same line as controlling statement.", - sameLineOpen: "Opening curly brace appears on the same line as controlling statement.", - blockSameLine: "Statement inside of curly braces should be on next line.", - nextLineClose: "Closing curly brace does not appear on the same line as the subsequent block.", - singleLineClose: "Closing curly brace should be on the same line as opening curly brace or on the line after the previous block.", - sameLineClose: "Closing curly brace appears on the same line as the subsequent block." - } - }, - - create(context) { - const style = context.options[0] || "1tbs", - params = context.options[1] || {}, - sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Fixes a place where a newline unexpectedly appears - * @param {Token} firstToken The token before the unexpected newline - * @param {Token} secondToken The token after the unexpected newline - * @returns {Function} A fixer function to remove the newlines between the tokens - */ - function removeNewlineBetween(firstToken, secondToken) { - const textRange = [firstToken.range[1], secondToken.range[0]]; - const textBetween = sourceCode.text.slice(textRange[0], textRange[1]); - - // Don't do a fix if there is a comment between the tokens - if (textBetween.trim()) { - return null; - } - return fixer => fixer.replaceTextRange(textRange, " "); - } - - /** - * Validates a pair of curly brackets based on the user's config - * @param {Token} openingCurly The opening curly bracket - * @param {Token} closingCurly The closing curly bracket - * @returns {void} - */ - function validateCurlyPair(openingCurly, closingCurly) { - const tokenBeforeOpeningCurly = sourceCode.getTokenBefore(openingCurly); - const tokenAfterOpeningCurly = sourceCode.getTokenAfter(openingCurly); - const tokenBeforeClosingCurly = sourceCode.getTokenBefore(closingCurly); - const singleLineException = params.allowSingleLine && astUtils.isTokenOnSameLine(openingCurly, closingCurly); - - if (style !== "allman" && !astUtils.isTokenOnSameLine(tokenBeforeOpeningCurly, openingCurly)) { - context.report({ - node: openingCurly, - messageId: "nextLineOpen", - fix: removeNewlineBetween(tokenBeforeOpeningCurly, openingCurly) - }); - } - - if (style === "allman" && astUtils.isTokenOnSameLine(tokenBeforeOpeningCurly, openingCurly) && !singleLineException) { - context.report({ - node: openingCurly, - messageId: "sameLineOpen", - fix: fixer => fixer.insertTextBefore(openingCurly, "\n") - }); - } - - if (astUtils.isTokenOnSameLine(openingCurly, tokenAfterOpeningCurly) && tokenAfterOpeningCurly !== closingCurly && !singleLineException) { - context.report({ - node: openingCurly, - messageId: "blockSameLine", - fix: fixer => fixer.insertTextAfter(openingCurly, "\n") - }); - } - - if (tokenBeforeClosingCurly !== openingCurly && !singleLineException && astUtils.isTokenOnSameLine(tokenBeforeClosingCurly, closingCurly)) { - context.report({ - node: closingCurly, - messageId: "singleLineClose", - fix: fixer => fixer.insertTextBefore(closingCurly, "\n") - }); - } - } - - /** - * Validates the location of a token that appears before a keyword (e.g. a newline before `else`) - * @param {Token} curlyToken The closing curly token. This is assumed to precede a keyword token (such as `else` or `finally`). - * @returns {void} - */ - function validateCurlyBeforeKeyword(curlyToken) { - const keywordToken = sourceCode.getTokenAfter(curlyToken); - - if (style === "1tbs" && !astUtils.isTokenOnSameLine(curlyToken, keywordToken)) { - context.report({ - node: curlyToken, - messageId: "nextLineClose", - fix: removeNewlineBetween(curlyToken, keywordToken) - }); - } - - if (style !== "1tbs" && astUtils.isTokenOnSameLine(curlyToken, keywordToken)) { - context.report({ - node: curlyToken, - messageId: "sameLineClose", - fix: fixer => fixer.insertTextAfter(curlyToken, "\n") - }); - } - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - BlockStatement(node) { - if (!astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type)) { - validateCurlyPair(sourceCode.getFirstToken(node), sourceCode.getLastToken(node)); - } - }, - StaticBlock(node) { - validateCurlyPair( - sourceCode.getFirstToken(node, { skip: 1 }), // skip the `static` token - sourceCode.getLastToken(node) - ); - }, - ClassBody(node) { - validateCurlyPair(sourceCode.getFirstToken(node), sourceCode.getLastToken(node)); - }, - SwitchStatement(node) { - const closingCurly = sourceCode.getLastToken(node); - const openingCurly = sourceCode.getTokenBefore(node.cases.length ? node.cases[0] : closingCurly); - - validateCurlyPair(openingCurly, closingCurly); - }, - IfStatement(node) { - if (node.consequent.type === "BlockStatement" && node.alternate) { - - // Handle the keyword after the `if` block (before `else`) - validateCurlyBeforeKeyword(sourceCode.getLastToken(node.consequent)); - } - }, - TryStatement(node) { - - // Handle the keyword after the `try` block (before `catch` or `finally`) - validateCurlyBeforeKeyword(sourceCode.getLastToken(node.block)); - - if (node.handler && node.finalizer) { - - // Handle the keyword after the `catch` block (before `finally`) - validateCurlyBeforeKeyword(sourceCode.getLastToken(node.handler.body)); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/callback-return.js b/node_modules/eslint/lib/rules/callback-return.js deleted file mode 100644 index 5d441bdd9..000000000 --- a/node_modules/eslint/lib/rules/callback-return.js +++ /dev/null @@ -1,187 +0,0 @@ -/** - * @fileoverview Enforce return after a callback. - * @author Jamund Ferguson - * @deprecated in ESLint v7.0.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Require `return` statements after callbacks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/callback-return" - }, - - schema: [{ - type: "array", - items: { type: "string" } - }], - - messages: { - missingReturn: "Expected return with your callback function." - } - }, - - create(context) { - - const callbacks = context.options[0] || ["callback", "cb", "next"], - sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Find the closest parent matching a list of types. - * @param {ASTNode} node The node whose parents we are searching - * @param {Array} types The node types to match - * @returns {ASTNode} The matched node or undefined. - */ - function findClosestParentOfType(node, types) { - if (!node.parent) { - return null; - } - if (!types.includes(node.parent.type)) { - return findClosestParentOfType(node.parent, types); - } - return node.parent; - } - - /** - * Check to see if a node contains only identifiers - * @param {ASTNode} node The node to check - * @returns {boolean} Whether or not the node contains only identifiers - */ - function containsOnlyIdentifiers(node) { - if (node.type === "Identifier") { - return true; - } - - if (node.type === "MemberExpression") { - if (node.object.type === "Identifier") { - return true; - } - if (node.object.type === "MemberExpression") { - return containsOnlyIdentifiers(node.object); - } - } - - return false; - } - - /** - * Check to see if a CallExpression is in our callback list. - * @param {ASTNode} node The node to check against our callback names list. - * @returns {boolean} Whether or not this function matches our callback name. - */ - function isCallback(node) { - return containsOnlyIdentifiers(node.callee) && callbacks.includes(sourceCode.getText(node.callee)); - } - - /** - * Determines whether or not the callback is part of a callback expression. - * @param {ASTNode} node The callback node - * @param {ASTNode} parentNode The expression node - * @returns {boolean} Whether or not this is part of a callback expression - */ - function isCallbackExpression(node, parentNode) { - - // ensure the parent node exists and is an expression - if (!parentNode || parentNode.type !== "ExpressionStatement") { - return false; - } - - // cb() - if (parentNode.expression === node) { - return true; - } - - // special case for cb && cb() and similar - if (parentNode.expression.type === "BinaryExpression" || parentNode.expression.type === "LogicalExpression") { - if (parentNode.expression.right === node) { - return true; - } - } - - return false; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - CallExpression(node) { - - // if we're not a callback we can return - if (!isCallback(node)) { - return; - } - - // find the closest block, return or loop - const closestBlock = findClosestParentOfType(node, ["BlockStatement", "ReturnStatement", "ArrowFunctionExpression"]) || {}; - - // if our parent is a return we know we're ok - if (closestBlock.type === "ReturnStatement") { - return; - } - - // arrow functions don't always have blocks and implicitly return - if (closestBlock.type === "ArrowFunctionExpression") { - return; - } - - // block statements are part of functions and most if statements - if (closestBlock.type === "BlockStatement") { - - // find the last item in the block - const lastItem = closestBlock.body[closestBlock.body.length - 1]; - - // if the callback is the last thing in a block that might be ok - if (isCallbackExpression(node, lastItem)) { - - const parentType = closestBlock.parent.type; - - // but only if the block is part of a function - if (parentType === "FunctionExpression" || - parentType === "FunctionDeclaration" || - parentType === "ArrowFunctionExpression" - ) { - return; - } - - } - - // ending a block with a return is also ok - if (lastItem.type === "ReturnStatement") { - - // but only if the callback is immediately before - if (isCallbackExpression(node, closestBlock.body[closestBlock.body.length - 2])) { - return; - } - } - - } - - // as long as you're the child of a function at this point you should be asked to return - if (findClosestParentOfType(node, ["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"])) { - context.report({ node, messageId: "missingReturn" }); - } - - } - - }; - } -}; diff --git a/node_modules/eslint/lib/rules/camelcase.js b/node_modules/eslint/lib/rules/camelcase.js deleted file mode 100644 index 51bb4122d..000000000 --- a/node_modules/eslint/lib/rules/camelcase.js +++ /dev/null @@ -1,399 +0,0 @@ -/** - * @fileoverview Rule to flag non-camelcased identifiers - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce camelcase naming convention", - recommended: false, - url: "https://eslint.org/docs/latest/rules/camelcase" - }, - - schema: [ - { - type: "object", - properties: { - ignoreDestructuring: { - type: "boolean", - default: false - }, - ignoreImports: { - type: "boolean", - default: false - }, - ignoreGlobals: { - type: "boolean", - default: false - }, - properties: { - enum: ["always", "never"] - }, - allow: { - type: "array", - items: [ - { - type: "string" - } - ], - minItems: 0, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - notCamelCase: "Identifier '{{name}}' is not in camel case.", - notCamelCasePrivate: "#{{name}} is not in camel case." - } - }, - - create(context) { - const options = context.options[0] || {}; - const properties = options.properties === "never" ? "never" : "always"; - const ignoreDestructuring = options.ignoreDestructuring; - const ignoreImports = options.ignoreImports; - const ignoreGlobals = options.ignoreGlobals; - const allow = options.allow || []; - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - // contains reported nodes to avoid reporting twice on destructuring with shorthand notation - const reported = new Set(); - - /** - * Checks if a string contains an underscore and isn't all upper-case - * @param {string} name The string to check. - * @returns {boolean} if the string is underscored - * @private - */ - function isUnderscored(name) { - const nameBody = name.replace(/^_+|_+$/gu, ""); - - // if there's an underscore, it might be A_CONSTANT, which is okay - return nameBody.includes("_") && nameBody !== nameBody.toUpperCase(); - } - - /** - * Checks if a string match the ignore list - * @param {string} name The string to check. - * @returns {boolean} if the string is ignored - * @private - */ - function isAllowed(name) { - return allow.some( - entry => name === entry || name.match(new RegExp(entry, "u")) - ); - } - - /** - * Checks if a given name is good or not. - * @param {string} name The name to check. - * @returns {boolean} `true` if the name is good. - * @private - */ - function isGoodName(name) { - return !isUnderscored(name) || isAllowed(name); - } - - /** - * Checks if a given identifier reference or member expression is an assignment - * target. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is an assignment target. - */ - function isAssignmentTarget(node) { - const parent = node.parent; - - switch (parent.type) { - case "AssignmentExpression": - case "AssignmentPattern": - return parent.left === node; - - case "Property": - return ( - parent.parent.type === "ObjectPattern" && - parent.value === node - ); - case "ArrayPattern": - case "RestElement": - return true; - - default: - return false; - } - } - - /** - * Checks if a given binding identifier uses the original name as-is. - * - If it's in object destructuring or object expression, the original name is its property name. - * - If it's in import declaration, the original name is its exported name. - * @param {ASTNode} node The `Identifier` node to check. - * @returns {boolean} `true` if the identifier uses the original name as-is. - */ - function equalsToOriginalName(node) { - const localName = node.name; - const valueNode = node.parent.type === "AssignmentPattern" - ? node.parent - : node; - const parent = valueNode.parent; - - switch (parent.type) { - case "Property": - return ( - (parent.parent.type === "ObjectPattern" || parent.parent.type === "ObjectExpression") && - parent.value === valueNode && - !parent.computed && - parent.key.type === "Identifier" && - parent.key.name === localName - ); - - case "ImportSpecifier": - return ( - parent.local === node && - astUtils.getModuleExportName(parent.imported) === localName - ); - - default: - return false; - } - } - - /** - * Reports an AST node as a rule violation. - * @param {ASTNode} node The node to report. - * @returns {void} - * @private - */ - function report(node) { - if (reported.has(node.range[0])) { - return; - } - reported.add(node.range[0]); - - // Report it. - context.report({ - node, - messageId: node.type === "PrivateIdentifier" - ? "notCamelCasePrivate" - : "notCamelCase", - data: { name: node.name } - }); - } - - /** - * Reports an identifier reference or a binding identifier. - * @param {ASTNode} node The `Identifier` node to report. - * @returns {void} - */ - function reportReferenceId(node) { - - /* - * For backward compatibility, if it's in callings then ignore it. - * Not sure why it is. - */ - if ( - node.parent.type === "CallExpression" || - node.parent.type === "NewExpression" - ) { - return; - } - - /* - * For backward compatibility, if it's a default value of - * destructuring/parameters then ignore it. - * Not sure why it is. - */ - if ( - node.parent.type === "AssignmentPattern" && - node.parent.right === node - ) { - return; - } - - /* - * The `ignoreDestructuring` flag skips the identifiers that uses - * the property name as-is. - */ - if (ignoreDestructuring && equalsToOriginalName(node)) { - return; - } - - report(node); - } - - return { - - // Report camelcase of global variable references ------------------ - Program(node) { - const scope = sourceCode.getScope(node); - - if (!ignoreGlobals) { - - // Defined globals in config files or directive comments. - for (const variable of scope.variables) { - if ( - variable.identifiers.length > 0 || - isGoodName(variable.name) - ) { - continue; - } - for (const reference of variable.references) { - - /* - * For backward compatibility, this rule reports read-only - * references as well. - */ - reportReferenceId(reference.identifier); - } - } - } - - // Undefined globals. - for (const reference of scope.through) { - const id = reference.identifier; - - if (isGoodName(id.name)) { - continue; - } - - /* - * For backward compatibility, this rule reports read-only - * references as well. - */ - reportReferenceId(id); - } - }, - - // Report camelcase of declared variables -------------------------- - [[ - "VariableDeclaration", - "FunctionDeclaration", - "FunctionExpression", - "ArrowFunctionExpression", - "ClassDeclaration", - "ClassExpression", - "CatchClause" - ]](node) { - for (const variable of sourceCode.getDeclaredVariables(node)) { - if (isGoodName(variable.name)) { - continue; - } - const id = variable.identifiers[0]; - - // Report declaration. - if (!(ignoreDestructuring && equalsToOriginalName(id))) { - report(id); - } - - /* - * For backward compatibility, report references as well. - * It looks unnecessary because declarations are reported. - */ - for (const reference of variable.references) { - if (reference.init) { - continue; // Skip the write references of initializers. - } - reportReferenceId(reference.identifier); - } - } - }, - - // Report camelcase in properties ---------------------------------- - [[ - "ObjectExpression > Property[computed!=true] > Identifier.key", - "MethodDefinition[computed!=true] > Identifier.key", - "PropertyDefinition[computed!=true] > Identifier.key", - "MethodDefinition > PrivateIdentifier.key", - "PropertyDefinition > PrivateIdentifier.key" - ]](node) { - if (properties === "never" || isGoodName(node.name)) { - return; - } - report(node); - }, - "MemberExpression[computed!=true] > Identifier.property"(node) { - if ( - properties === "never" || - !isAssignmentTarget(node.parent) || // ← ignore read-only references. - isGoodName(node.name) - ) { - return; - } - report(node); - }, - - // Report camelcase in import -------------------------------------- - ImportDeclaration(node) { - for (const variable of sourceCode.getDeclaredVariables(node)) { - if (isGoodName(variable.name)) { - continue; - } - const id = variable.identifiers[0]; - - // Report declaration. - if (!(ignoreImports && equalsToOriginalName(id))) { - report(id); - } - - /* - * For backward compatibility, report references as well. - * It looks unnecessary because declarations are reported. - */ - for (const reference of variable.references) { - reportReferenceId(reference.identifier); - } - } - }, - - // Report camelcase in re-export ----------------------------------- - [[ - "ExportAllDeclaration > Identifier.exported", - "ExportSpecifier > Identifier.exported" - ]](node) { - if (isGoodName(node.name)) { - return; - } - report(node); - }, - - // Report camelcase in labels -------------------------------------- - [[ - "LabeledStatement > Identifier.label", - - /* - * For backward compatibility, report references as well. - * It looks unnecessary because declarations are reported. - */ - "BreakStatement > Identifier.label", - "ContinueStatement > Identifier.label" - ]](node) { - if (isGoodName(node.name)) { - return; - } - report(node); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/capitalized-comments.js b/node_modules/eslint/lib/rules/capitalized-comments.js deleted file mode 100644 index 3a17b0566..000000000 --- a/node_modules/eslint/lib/rules/capitalized-comments.js +++ /dev/null @@ -1,300 +0,0 @@ -/** - * @fileoverview enforce or disallow capitalization of the first letter of a comment - * @author Kevin Partington - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const LETTER_PATTERN = require("./utils/patterns/letters"); -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const DEFAULT_IGNORE_PATTERN = astUtils.COMMENTS_IGNORE_PATTERN, - WHITESPACE = /\s/gu, - MAYBE_URL = /^\s*[^:/?#\s]+:\/\/[^?#]/u; // TODO: Combine w/ max-len pattern? - -/* - * Base schema body for defining the basic capitalization rule, ignorePattern, - * and ignoreInlineComments values. - * This can be used in a few different ways in the actual schema. - */ -const SCHEMA_BODY = { - type: "object", - properties: { - ignorePattern: { - type: "string" - }, - ignoreInlineComments: { - type: "boolean" - }, - ignoreConsecutiveComments: { - type: "boolean" - } - }, - additionalProperties: false -}; -const DEFAULTS = { - ignorePattern: "", - ignoreInlineComments: false, - ignoreConsecutiveComments: false -}; - -/** - * Get normalized options for either block or line comments from the given - * user-provided options. - * - If the user-provided options is just a string, returns a normalized - * set of options using default values for all other options. - * - If the user-provided options is an object, then a normalized option - * set is returned. Options specified in overrides will take priority - * over options specified in the main options object, which will in - * turn take priority over the rule's defaults. - * @param {Object|string} rawOptions The user-provided options. - * @param {string} which Either "line" or "block". - * @returns {Object} The normalized options. - */ -function getNormalizedOptions(rawOptions, which) { - return Object.assign({}, DEFAULTS, rawOptions[which] || rawOptions); -} - -/** - * Get normalized options for block and line comments. - * @param {Object|string} rawOptions The user-provided options. - * @returns {Object} An object with "Line" and "Block" keys and corresponding - * normalized options objects. - */ -function getAllNormalizedOptions(rawOptions = {}) { - return { - Line: getNormalizedOptions(rawOptions, "line"), - Block: getNormalizedOptions(rawOptions, "block") - }; -} - -/** - * Creates a regular expression for each ignorePattern defined in the rule - * options. - * - * This is done in order to avoid invoking the RegExp constructor repeatedly. - * @param {Object} normalizedOptions The normalized rule options. - * @returns {void} - */ -function createRegExpForIgnorePatterns(normalizedOptions) { - Object.keys(normalizedOptions).forEach(key => { - const ignorePatternStr = normalizedOptions[key].ignorePattern; - - if (ignorePatternStr) { - const regExp = RegExp(`^\\s*(?:${ignorePatternStr})`, "u"); - - normalizedOptions[key].ignorePatternRegExp = regExp; - } - }); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce or disallow capitalization of the first letter of a comment", - recommended: false, - url: "https://eslint.org/docs/latest/rules/capitalized-comments" - }, - - fixable: "code", - - schema: [ - { enum: ["always", "never"] }, - { - oneOf: [ - SCHEMA_BODY, - { - type: "object", - properties: { - line: SCHEMA_BODY, - block: SCHEMA_BODY - }, - additionalProperties: false - } - ] - } - ], - - messages: { - unexpectedLowercaseComment: "Comments should not begin with a lowercase character.", - unexpectedUppercaseComment: "Comments should not begin with an uppercase character." - } - }, - - create(context) { - - const capitalize = context.options[0] || "always", - normalizedOptions = getAllNormalizedOptions(context.options[1]), - sourceCode = context.sourceCode; - - createRegExpForIgnorePatterns(normalizedOptions); - - //---------------------------------------------------------------------- - // Helpers - //---------------------------------------------------------------------- - - /** - * Checks whether a comment is an inline comment. - * - * For the purpose of this rule, a comment is inline if: - * 1. The comment is preceded by a token on the same line; and - * 2. The command is followed by a token on the same line. - * - * Note that the comment itself need not be single-line! - * - * Also, it follows from this definition that only block comments can - * be considered as possibly inline. This is because line comments - * would consume any following tokens on the same line as the comment. - * @param {ASTNode} comment The comment node to check. - * @returns {boolean} True if the comment is an inline comment, false - * otherwise. - */ - function isInlineComment(comment) { - const previousToken = sourceCode.getTokenBefore(comment, { includeComments: true }), - nextToken = sourceCode.getTokenAfter(comment, { includeComments: true }); - - return Boolean( - previousToken && - nextToken && - comment.loc.start.line === previousToken.loc.end.line && - comment.loc.end.line === nextToken.loc.start.line - ); - } - - /** - * Determine if a comment follows another comment. - * @param {ASTNode} comment The comment to check. - * @returns {boolean} True if the comment follows a valid comment. - */ - function isConsecutiveComment(comment) { - const previousTokenOrComment = sourceCode.getTokenBefore(comment, { includeComments: true }); - - return Boolean( - previousTokenOrComment && - ["Block", "Line"].includes(previousTokenOrComment.type) - ); - } - - /** - * Check a comment to determine if it is valid for this rule. - * @param {ASTNode} comment The comment node to process. - * @param {Object} options The options for checking this comment. - * @returns {boolean} True if the comment is valid, false otherwise. - */ - function isCommentValid(comment, options) { - - // 1. Check for default ignore pattern. - if (DEFAULT_IGNORE_PATTERN.test(comment.value)) { - return true; - } - - // 2. Check for custom ignore pattern. - const commentWithoutAsterisks = comment.value - .replace(/\*/gu, ""); - - if (options.ignorePatternRegExp && options.ignorePatternRegExp.test(commentWithoutAsterisks)) { - return true; - } - - // 3. Check for inline comments. - if (options.ignoreInlineComments && isInlineComment(comment)) { - return true; - } - - // 4. Is this a consecutive comment (and are we tolerating those)? - if (options.ignoreConsecutiveComments && isConsecutiveComment(comment)) { - return true; - } - - // 5. Does the comment start with a possible URL? - if (MAYBE_URL.test(commentWithoutAsterisks)) { - return true; - } - - // 6. Is the initial word character a letter? - const commentWordCharsOnly = commentWithoutAsterisks - .replace(WHITESPACE, ""); - - if (commentWordCharsOnly.length === 0) { - return true; - } - - const firstWordChar = commentWordCharsOnly[0]; - - if (!LETTER_PATTERN.test(firstWordChar)) { - return true; - } - - // 7. Check the case of the initial word character. - const isUppercase = firstWordChar !== firstWordChar.toLocaleLowerCase(), - isLowercase = firstWordChar !== firstWordChar.toLocaleUpperCase(); - - if (capitalize === "always" && isLowercase) { - return false; - } - if (capitalize === "never" && isUppercase) { - return false; - } - - return true; - } - - /** - * Process a comment to determine if it needs to be reported. - * @param {ASTNode} comment The comment node to process. - * @returns {void} - */ - function processComment(comment) { - const options = normalizedOptions[comment.type], - commentValid = isCommentValid(comment, options); - - if (!commentValid) { - const messageId = capitalize === "always" - ? "unexpectedLowercaseComment" - : "unexpectedUppercaseComment"; - - context.report({ - node: null, // Intentionally using loc instead - loc: comment.loc, - messageId, - fix(fixer) { - const match = comment.value.match(LETTER_PATTERN); - - return fixer.replaceTextRange( - - // Offset match.index by 2 to account for the first 2 characters that start the comment (// or /*) - [comment.range[0] + match.index + 2, comment.range[0] + match.index + 3], - capitalize === "always" ? match[0].toLocaleUpperCase() : match[0].toLocaleLowerCase() - ); - } - }); - } - } - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - Program() { - const comments = sourceCode.getAllComments(); - - comments.filter(token => token.type !== "Shebang").forEach(processComment); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/class-methods-use-this.js b/node_modules/eslint/lib/rules/class-methods-use-this.js deleted file mode 100644 index 9cf8a1b8a..000000000 --- a/node_modules/eslint/lib/rules/class-methods-use-this.js +++ /dev/null @@ -1,187 +0,0 @@ -/** - * @fileoverview Rule to enforce that all class methods use 'this'. - * @author Patrick Williams - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce that class methods utilize `this`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/class-methods-use-this" - }, - - schema: [{ - type: "object", - properties: { - exceptMethods: { - type: "array", - items: { - type: "string" - } - }, - enforceForClassFields: { - type: "boolean", - default: true - } - }, - additionalProperties: false - }], - - messages: { - missingThis: "Expected 'this' to be used by class {{name}}." - } - }, - create(context) { - const config = Object.assign({}, context.options[0]); - const enforceForClassFields = config.enforceForClassFields !== false; - const exceptMethods = new Set(config.exceptMethods || []); - - const stack = []; - - /** - * Push `this` used flag initialized with `false` onto the stack. - * @returns {void} - */ - function pushContext() { - stack.push(false); - } - - /** - * Pop `this` used flag from the stack. - * @returns {boolean | undefined} `this` used flag - */ - function popContext() { - return stack.pop(); - } - - /** - * Initializes the current context to false and pushes it onto the stack. - * These booleans represent whether 'this' has been used in the context. - * @returns {void} - * @private - */ - function enterFunction() { - pushContext(); - } - - /** - * Check if the node is an instance method - * @param {ASTNode} node node to check - * @returns {boolean} True if its an instance method - * @private - */ - function isInstanceMethod(node) { - switch (node.type) { - case "MethodDefinition": - return !node.static && node.kind !== "constructor"; - case "PropertyDefinition": - return !node.static && enforceForClassFields; - default: - return false; - } - } - - /** - * Check if the node is an instance method not excluded by config - * @param {ASTNode} node node to check - * @returns {boolean} True if it is an instance method, and not excluded by config - * @private - */ - function isIncludedInstanceMethod(node) { - if (isInstanceMethod(node)) { - if (node.computed) { - return true; - } - - const hashIfNeeded = node.key.type === "PrivateIdentifier" ? "#" : ""; - const name = node.key.type === "Literal" - ? astUtils.getStaticStringValue(node.key) - : (node.key.name || ""); - - return !exceptMethods.has(hashIfNeeded + name); - } - return false; - } - - /** - * Checks if we are leaving a function that is a method, and reports if 'this' has not been used. - * Static methods and the constructor are exempt. - * Then pops the context off the stack. - * @param {ASTNode} node A function node that was entered. - * @returns {void} - * @private - */ - function exitFunction(node) { - const methodUsesThis = popContext(); - - if (isIncludedInstanceMethod(node.parent) && !methodUsesThis) { - context.report({ - node, - loc: astUtils.getFunctionHeadLoc(node, context.sourceCode), - messageId: "missingThis", - data: { - name: astUtils.getFunctionNameWithKind(node) - } - }); - } - } - - /** - * Mark the current context as having used 'this'. - * @returns {void} - * @private - */ - function markThisUsed() { - if (stack.length) { - stack[stack.length - 1] = true; - } - } - - return { - FunctionDeclaration: enterFunction, - "FunctionDeclaration:exit": exitFunction, - FunctionExpression: enterFunction, - "FunctionExpression:exit": exitFunction, - - /* - * Class field value are implicit functions. - */ - "PropertyDefinition > *.key:exit": pushContext, - "PropertyDefinition:exit": popContext, - - /* - * Class static blocks are implicit functions. They aren't required to use `this`, - * but we have to push context so that it captures any use of `this` in the static block - * separately from enclosing contexts, because static blocks have their own `this` and it - * shouldn't count as used `this` in enclosing contexts. - */ - StaticBlock: pushContext, - "StaticBlock:exit": popContext, - - ThisExpression: markThisUsed, - Super: markThisUsed, - ...( - enforceForClassFields && { - "PropertyDefinition > ArrowFunctionExpression.value": enterFunction, - "PropertyDefinition > ArrowFunctionExpression.value:exit": exitFunction - } - ) - }; - } -}; diff --git a/node_modules/eslint/lib/rules/comma-dangle.js b/node_modules/eslint/lib/rules/comma-dangle.js deleted file mode 100644 index e49983b72..000000000 --- a/node_modules/eslint/lib/rules/comma-dangle.js +++ /dev/null @@ -1,370 +0,0 @@ -/** - * @fileoverview Rule to forbid or enforce dangling commas. - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const DEFAULT_OPTIONS = Object.freeze({ - arrays: "never", - objects: "never", - imports: "never", - exports: "never", - functions: "never" -}); - -/** - * Checks whether or not a trailing comma is allowed in a given node. - * If the `lastItem` is `RestElement` or `RestProperty`, it disallows trailing commas. - * @param {ASTNode} lastItem The node of the last element in the given node. - * @returns {boolean} `true` if a trailing comma is allowed. - */ -function isTrailingCommaAllowed(lastItem) { - return !( - lastItem.type === "RestElement" || - lastItem.type === "RestProperty" || - lastItem.type === "ExperimentalRestProperty" - ); -} - -/** - * Normalize option value. - * @param {string|Object|undefined} optionValue The 1st option value to normalize. - * @param {number} ecmaVersion The normalized ECMAScript version. - * @returns {Object} The normalized option value. - */ -function normalizeOptions(optionValue, ecmaVersion) { - if (typeof optionValue === "string") { - return { - arrays: optionValue, - objects: optionValue, - imports: optionValue, - exports: optionValue, - functions: ecmaVersion < 2017 ? "ignore" : optionValue - }; - } - if (typeof optionValue === "object" && optionValue !== null) { - return { - arrays: optionValue.arrays || DEFAULT_OPTIONS.arrays, - objects: optionValue.objects || DEFAULT_OPTIONS.objects, - imports: optionValue.imports || DEFAULT_OPTIONS.imports, - exports: optionValue.exports || DEFAULT_OPTIONS.exports, - functions: optionValue.functions || DEFAULT_OPTIONS.functions - }; - } - - return DEFAULT_OPTIONS; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow trailing commas", - recommended: false, - url: "https://eslint.org/docs/latest/rules/comma-dangle" - }, - - fixable: "code", - - schema: { - definitions: { - value: { - enum: [ - "always-multiline", - "always", - "never", - "only-multiline" - ] - }, - valueWithIgnore: { - enum: [ - "always-multiline", - "always", - "ignore", - "never", - "only-multiline" - ] - } - }, - type: "array", - items: [ - { - oneOf: [ - { - $ref: "#/definitions/value" - }, - { - type: "object", - properties: { - arrays: { $ref: "#/definitions/valueWithIgnore" }, - objects: { $ref: "#/definitions/valueWithIgnore" }, - imports: { $ref: "#/definitions/valueWithIgnore" }, - exports: { $ref: "#/definitions/valueWithIgnore" }, - functions: { $ref: "#/definitions/valueWithIgnore" } - }, - additionalProperties: false - } - ] - } - ], - additionalItems: false - }, - - messages: { - unexpected: "Unexpected trailing comma.", - missing: "Missing trailing comma." - } - }, - - create(context) { - const options = normalizeOptions(context.options[0], context.languageOptions.ecmaVersion); - - const sourceCode = context.sourceCode; - - /** - * Gets the last item of the given node. - * @param {ASTNode} node The node to get. - * @returns {ASTNode|null} The last node or null. - */ - function getLastItem(node) { - - /** - * Returns the last element of an array - * @param {any[]} array The input array - * @returns {any} The last element - */ - function last(array) { - return array[array.length - 1]; - } - - switch (node.type) { - case "ObjectExpression": - case "ObjectPattern": - return last(node.properties); - case "ArrayExpression": - case "ArrayPattern": - return last(node.elements); - case "ImportDeclaration": - case "ExportNamedDeclaration": - return last(node.specifiers); - case "FunctionDeclaration": - case "FunctionExpression": - case "ArrowFunctionExpression": - return last(node.params); - case "CallExpression": - case "NewExpression": - return last(node.arguments); - default: - return null; - } - } - - /** - * Gets the trailing comma token of the given node. - * If the trailing comma does not exist, this returns the token which is - * the insertion point of the trailing comma token. - * @param {ASTNode} node The node to get. - * @param {ASTNode} lastItem The last item of the node. - * @returns {Token} The trailing comma token or the insertion point. - */ - function getTrailingToken(node, lastItem) { - switch (node.type) { - case "ObjectExpression": - case "ArrayExpression": - case "CallExpression": - case "NewExpression": - return sourceCode.getLastToken(node, 1); - default: { - const nextToken = sourceCode.getTokenAfter(lastItem); - - if (astUtils.isCommaToken(nextToken)) { - return nextToken; - } - return sourceCode.getLastToken(lastItem); - } - } - } - - /** - * Checks whether or not a given node is multiline. - * This rule handles a given node as multiline when the closing parenthesis - * and the last element are not on the same line. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is multiline. - */ - function isMultiline(node) { - const lastItem = getLastItem(node); - - if (!lastItem) { - return false; - } - - const penultimateToken = getTrailingToken(node, lastItem); - const lastToken = sourceCode.getTokenAfter(penultimateToken); - - return lastToken.loc.end.line !== penultimateToken.loc.end.line; - } - - /** - * Reports a trailing comma if it exists. - * @param {ASTNode} node A node to check. Its type is one of - * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, - * ImportDeclaration, and ExportNamedDeclaration. - * @returns {void} - */ - function forbidTrailingComma(node) { - const lastItem = getLastItem(node); - - if (!lastItem || (node.type === "ImportDeclaration" && lastItem.type !== "ImportSpecifier")) { - return; - } - - const trailingToken = getTrailingToken(node, lastItem); - - if (astUtils.isCommaToken(trailingToken)) { - context.report({ - node: lastItem, - loc: trailingToken.loc, - messageId: "unexpected", - *fix(fixer) { - yield fixer.remove(trailingToken); - - /* - * Extend the range of the fix to include surrounding tokens to ensure - * that the element after which the comma is removed stays _last_. - * This intentionally makes conflicts in fix ranges with rules that may be - * adding or removing elements in the same autofix pass. - * https://github.com/eslint/eslint/issues/15660 - */ - yield fixer.insertTextBefore(sourceCode.getTokenBefore(trailingToken), ""); - yield fixer.insertTextAfter(sourceCode.getTokenAfter(trailingToken), ""); - } - }); - } - } - - /** - * Reports the last element of a given node if it does not have a trailing - * comma. - * - * If a given node is `ArrayPattern` which has `RestElement`, the trailing - * comma is disallowed, so report if it exists. - * @param {ASTNode} node A node to check. Its type is one of - * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, - * ImportDeclaration, and ExportNamedDeclaration. - * @returns {void} - */ - function forceTrailingComma(node) { - const lastItem = getLastItem(node); - - if (!lastItem || (node.type === "ImportDeclaration" && lastItem.type !== "ImportSpecifier")) { - return; - } - if (!isTrailingCommaAllowed(lastItem)) { - forbidTrailingComma(node); - return; - } - - const trailingToken = getTrailingToken(node, lastItem); - - if (trailingToken.value !== ",") { - context.report({ - node: lastItem, - loc: { - start: trailingToken.loc.end, - end: astUtils.getNextLocation(sourceCode, trailingToken.loc.end) - }, - messageId: "missing", - *fix(fixer) { - yield fixer.insertTextAfter(trailingToken, ","); - - /* - * Extend the range of the fix to include surrounding tokens to ensure - * that the element after which the comma is inserted stays _last_. - * This intentionally makes conflicts in fix ranges with rules that may be - * adding or removing elements in the same autofix pass. - * https://github.com/eslint/eslint/issues/15660 - */ - yield fixer.insertTextBefore(trailingToken, ""); - yield fixer.insertTextAfter(sourceCode.getTokenAfter(trailingToken), ""); - } - }); - } - } - - /** - * If a given node is multiline, reports the last element of a given node - * when it does not have a trailing comma. - * Otherwise, reports a trailing comma if it exists. - * @param {ASTNode} node A node to check. Its type is one of - * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, - * ImportDeclaration, and ExportNamedDeclaration. - * @returns {void} - */ - function forceTrailingCommaIfMultiline(node) { - if (isMultiline(node)) { - forceTrailingComma(node); - } else { - forbidTrailingComma(node); - } - } - - /** - * Only if a given node is not multiline, reports the last element of a given node - * when it does not have a trailing comma. - * Otherwise, reports a trailing comma if it exists. - * @param {ASTNode} node A node to check. Its type is one of - * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, - * ImportDeclaration, and ExportNamedDeclaration. - * @returns {void} - */ - function allowTrailingCommaIfMultiline(node) { - if (!isMultiline(node)) { - forbidTrailingComma(node); - } - } - - const predicate = { - always: forceTrailingComma, - "always-multiline": forceTrailingCommaIfMultiline, - "only-multiline": allowTrailingCommaIfMultiline, - never: forbidTrailingComma, - ignore() {} - }; - - return { - ObjectExpression: predicate[options.objects], - ObjectPattern: predicate[options.objects], - - ArrayExpression: predicate[options.arrays], - ArrayPattern: predicate[options.arrays], - - ImportDeclaration: predicate[options.imports], - - ExportNamedDeclaration: predicate[options.exports], - - FunctionDeclaration: predicate[options.functions], - FunctionExpression: predicate[options.functions], - ArrowFunctionExpression: predicate[options.functions], - CallExpression: predicate[options.functions], - NewExpression: predicate[options.functions] - }; - } -}; diff --git a/node_modules/eslint/lib/rules/comma-spacing.js b/node_modules/eslint/lib/rules/comma-spacing.js deleted file mode 100644 index 96015ef67..000000000 --- a/node_modules/eslint/lib/rules/comma-spacing.js +++ /dev/null @@ -1,189 +0,0 @@ -/** - * @fileoverview Comma spacing - validates spacing before and after comma - * @author Vignesh Anand aka vegetableman. - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing before and after commas", - recommended: false, - url: "https://eslint.org/docs/latest/rules/comma-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - before: { - type: "boolean", - default: false - }, - after: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - messages: { - missing: "A space is required {{loc}} ','.", - unexpected: "There should be no space {{loc}} ','." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - const tokensAndComments = sourceCode.tokensAndComments; - - const options = { - before: context.options[0] ? context.options[0].before : false, - after: context.options[0] ? context.options[0].after : true - }; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - // list of comma tokens to ignore for the check of leading whitespace - const commaTokensToIgnore = []; - - /** - * Reports a spacing error with an appropriate message. - * @param {ASTNode} node The binary expression node to report. - * @param {string} loc Is the error "before" or "after" the comma? - * @param {ASTNode} otherNode The node at the left or right of `node` - * @returns {void} - * @private - */ - function report(node, loc, otherNode) { - context.report({ - node, - fix(fixer) { - if (options[loc]) { - if (loc === "before") { - return fixer.insertTextBefore(node, " "); - } - return fixer.insertTextAfter(node, " "); - - } - let start, end; - const newText = ""; - - if (loc === "before") { - start = otherNode.range[1]; - end = node.range[0]; - } else { - start = node.range[1]; - end = otherNode.range[0]; - } - - return fixer.replaceTextRange([start, end], newText); - - }, - messageId: options[loc] ? "missing" : "unexpected", - data: { - loc - } - }); - } - - /** - * Adds null elements of the given ArrayExpression or ArrayPattern node to the ignore list. - * @param {ASTNode} node An ArrayExpression or ArrayPattern node. - * @returns {void} - */ - function addNullElementsToIgnoreList(node) { - let previousToken = sourceCode.getFirstToken(node); - - node.elements.forEach(element => { - let token; - - if (element === null) { - token = sourceCode.getTokenAfter(previousToken); - - if (astUtils.isCommaToken(token)) { - commaTokensToIgnore.push(token); - } - } else { - token = sourceCode.getTokenAfter(element); - } - - previousToken = token; - }); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - "Program:exit"() { - tokensAndComments.forEach((token, i) => { - - if (!astUtils.isCommaToken(token)) { - return; - } - - const previousToken = tokensAndComments[i - 1]; - const nextToken = tokensAndComments[i + 1]; - - if ( - previousToken && - !astUtils.isCommaToken(previousToken) && // ignore spacing between two commas - - /* - * `commaTokensToIgnore` are ending commas of `null` elements (array holes/elisions). - * In addition to spacing between two commas, this can also ignore: - * - * - Spacing after `[` (controlled by array-bracket-spacing) - * Example: [ , ] - * ^ - * - Spacing after a comment (for backwards compatibility, this was possibly unintentional) - * Example: [a, /* * / ,] - * ^ - */ - !commaTokensToIgnore.includes(token) && - - astUtils.isTokenOnSameLine(previousToken, token) && - options.before !== sourceCode.isSpaceBetweenTokens(previousToken, token) - ) { - report(token, "before", previousToken); - } - - if ( - nextToken && - !astUtils.isCommaToken(nextToken) && // ignore spacing between two commas - !astUtils.isClosingParenToken(nextToken) && // controlled by space-in-parens - !astUtils.isClosingBracketToken(nextToken) && // controlled by array-bracket-spacing - !astUtils.isClosingBraceToken(nextToken) && // controlled by object-curly-spacing - !(!options.after && nextToken.type === "Line") && // special case, allow space before line comment - astUtils.isTokenOnSameLine(token, nextToken) && - options.after !== sourceCode.isSpaceBetweenTokens(token, nextToken) - ) { - report(token, "after", nextToken); - } - }); - }, - ArrayExpression: addNullElementsToIgnoreList, - ArrayPattern: addNullElementsToIgnoreList - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/comma-style.js b/node_modules/eslint/lib/rules/comma-style.js deleted file mode 100644 index bc69de469..000000000 --- a/node_modules/eslint/lib/rules/comma-style.js +++ /dev/null @@ -1,311 +0,0 @@ -/** - * @fileoverview Comma style - enforces comma styles of two types: last and first - * @author Vignesh Anand aka vegetableman - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent comma style", - recommended: false, - url: "https://eslint.org/docs/latest/rules/comma-style" - }, - - fixable: "code", - - schema: [ - { - enum: ["first", "last"] - }, - { - type: "object", - properties: { - exceptions: { - type: "object", - additionalProperties: { - type: "boolean" - } - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedLineBeforeAndAfterComma: "Bad line breaking before and after ','.", - expectedCommaFirst: "',' should be placed first.", - expectedCommaLast: "',' should be placed last." - } - }, - - create(context) { - const style = context.options[0] || "last", - sourceCode = context.sourceCode; - const exceptions = { - ArrayPattern: true, - ArrowFunctionExpression: true, - CallExpression: true, - FunctionDeclaration: true, - FunctionExpression: true, - ImportDeclaration: true, - ObjectPattern: true, - NewExpression: true - }; - - if (context.options.length === 2 && Object.prototype.hasOwnProperty.call(context.options[1], "exceptions")) { - const keys = Object.keys(context.options[1].exceptions); - - for (let i = 0; i < keys.length; i++) { - exceptions[keys[i]] = context.options[1].exceptions[keys[i]]; - } - } - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Modified text based on the style - * @param {string} styleType Style type - * @param {string} text Source code text - * @returns {string} modified text - * @private - */ - function getReplacedText(styleType, text) { - switch (styleType) { - case "between": - return `,${text.replace(astUtils.LINEBREAK_MATCHER, "")}`; - - case "first": - return `${text},`; - - case "last": - return `,${text}`; - - default: - return ""; - } - } - - /** - * Determines the fixer function for a given style. - * @param {string} styleType comma style - * @param {ASTNode} previousItemToken The token to check. - * @param {ASTNode} commaToken The token to check. - * @param {ASTNode} currentItemToken The token to check. - * @returns {Function} Fixer function - * @private - */ - function getFixerFunction(styleType, previousItemToken, commaToken, currentItemToken) { - const text = - sourceCode.text.slice(previousItemToken.range[1], commaToken.range[0]) + - sourceCode.text.slice(commaToken.range[1], currentItemToken.range[0]); - const range = [previousItemToken.range[1], currentItemToken.range[0]]; - - return function(fixer) { - return fixer.replaceTextRange(range, getReplacedText(styleType, text)); - }; - } - - /** - * Validates the spacing around single items in lists. - * @param {Token} previousItemToken The last token from the previous item. - * @param {Token} commaToken The token representing the comma. - * @param {Token} currentItemToken The first token of the current item. - * @param {Token} reportItem The item to use when reporting an error. - * @returns {void} - * @private - */ - function validateCommaItemSpacing(previousItemToken, commaToken, currentItemToken, reportItem) { - - // if single line - if (astUtils.isTokenOnSameLine(commaToken, currentItemToken) && - astUtils.isTokenOnSameLine(previousItemToken, commaToken)) { - - // do nothing. - - } else if (!astUtils.isTokenOnSameLine(commaToken, currentItemToken) && - !astUtils.isTokenOnSameLine(previousItemToken, commaToken)) { - - const comment = sourceCode.getCommentsAfter(commaToken)[0]; - const styleType = comment && comment.type === "Block" && astUtils.isTokenOnSameLine(commaToken, comment) - ? style - : "between"; - - // lone comma - context.report({ - node: reportItem, - loc: commaToken.loc, - messageId: "unexpectedLineBeforeAndAfterComma", - fix: getFixerFunction(styleType, previousItemToken, commaToken, currentItemToken) - }); - - } else if (style === "first" && !astUtils.isTokenOnSameLine(commaToken, currentItemToken)) { - - context.report({ - node: reportItem, - loc: commaToken.loc, - messageId: "expectedCommaFirst", - fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken) - }); - - } else if (style === "last" && astUtils.isTokenOnSameLine(commaToken, currentItemToken)) { - - context.report({ - node: reportItem, - loc: commaToken.loc, - messageId: "expectedCommaLast", - fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken) - }); - } - } - - /** - * Checks the comma placement with regards to a declaration/property/element - * @param {ASTNode} node The binary expression node to check - * @param {string} property The property of the node containing child nodes. - * @private - * @returns {void} - */ - function validateComma(node, property) { - const items = node[property], - arrayLiteral = (node.type === "ArrayExpression" || node.type === "ArrayPattern"); - - if (items.length > 1 || arrayLiteral) { - - // seed as opening [ - let previousItemToken = sourceCode.getFirstToken(node); - - items.forEach(item => { - const commaToken = item ? sourceCode.getTokenBefore(item) : previousItemToken, - currentItemToken = item ? sourceCode.getFirstToken(item) : sourceCode.getTokenAfter(commaToken), - reportItem = item || currentItemToken; - - /* - * This works by comparing three token locations: - * - previousItemToken is the last token of the previous item - * - commaToken is the location of the comma before the current item - * - currentItemToken is the first token of the current item - * - * These values get switched around if item is undefined. - * previousItemToken will refer to the last token not belonging - * to the current item, which could be a comma or an opening - * square bracket. currentItemToken could be a comma. - * - * All comparisons are done based on these tokens directly, so - * they are always valid regardless of an undefined item. - */ - if (astUtils.isCommaToken(commaToken)) { - validateCommaItemSpacing(previousItemToken, commaToken, currentItemToken, reportItem); - } - - if (item) { - const tokenAfterItem = sourceCode.getTokenAfter(item, astUtils.isNotClosingParenToken); - - previousItemToken = tokenAfterItem - ? sourceCode.getTokenBefore(tokenAfterItem) - : sourceCode.ast.tokens[sourceCode.ast.tokens.length - 1]; - } else { - previousItemToken = currentItemToken; - } - }); - - /* - * Special case for array literals that have empty last items, such - * as [ 1, 2, ]. These arrays only have two items show up in the - * AST, so we need to look at the token to verify that there's no - * dangling comma. - */ - if (arrayLiteral) { - - const lastToken = sourceCode.getLastToken(node), - nextToLastToken = sourceCode.getTokenBefore(lastToken); - - if (astUtils.isCommaToken(nextToLastToken)) { - validateCommaItemSpacing( - sourceCode.getTokenBefore(nextToLastToken), - nextToLastToken, - lastToken, - lastToken - ); - } - } - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - const nodes = {}; - - if (!exceptions.VariableDeclaration) { - nodes.VariableDeclaration = function(node) { - validateComma(node, "declarations"); - }; - } - if (!exceptions.ObjectExpression) { - nodes.ObjectExpression = function(node) { - validateComma(node, "properties"); - }; - } - if (!exceptions.ObjectPattern) { - nodes.ObjectPattern = function(node) { - validateComma(node, "properties"); - }; - } - if (!exceptions.ArrayExpression) { - nodes.ArrayExpression = function(node) { - validateComma(node, "elements"); - }; - } - if (!exceptions.ArrayPattern) { - nodes.ArrayPattern = function(node) { - validateComma(node, "elements"); - }; - } - if (!exceptions.FunctionDeclaration) { - nodes.FunctionDeclaration = function(node) { - validateComma(node, "params"); - }; - } - if (!exceptions.FunctionExpression) { - nodes.FunctionExpression = function(node) { - validateComma(node, "params"); - }; - } - if (!exceptions.ArrowFunctionExpression) { - nodes.ArrowFunctionExpression = function(node) { - validateComma(node, "params"); - }; - } - if (!exceptions.CallExpression) { - nodes.CallExpression = function(node) { - validateComma(node, "arguments"); - }; - } - if (!exceptions.ImportDeclaration) { - nodes.ImportDeclaration = function(node) { - validateComma(node, "specifiers"); - }; - } - if (!exceptions.NewExpression) { - nodes.NewExpression = function(node) { - validateComma(node, "arguments"); - }; - } - - return nodes; - } -}; diff --git a/node_modules/eslint/lib/rules/complexity.js b/node_modules/eslint/lib/rules/complexity.js deleted file mode 100644 index b7925074d..000000000 --- a/node_modules/eslint/lib/rules/complexity.js +++ /dev/null @@ -1,165 +0,0 @@ -/** - * @fileoverview Counts the cyclomatic complexity of each function of the script. See http://en.wikipedia.org/wiki/Cyclomatic_complexity. - * Counts the number of if, conditional, for, while, try, switch/case, - * @author Patrick Brosset - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { upperCaseFirst } = require("../shared/string-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce a maximum cyclomatic complexity allowed in a program", - recommended: false, - url: "https://eslint.org/docs/latest/rules/complexity" - }, - - schema: [ - { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - type: "object", - properties: { - maximum: { - type: "integer", - minimum: 0 - }, - max: { - type: "integer", - minimum: 0 - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - complex: "{{name}} has a complexity of {{complexity}}. Maximum allowed is {{max}}." - } - }, - - create(context) { - const option = context.options[0]; - let THRESHOLD = 20; - - if ( - typeof option === "object" && - (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) - ) { - THRESHOLD = option.maximum || option.max; - } else if (typeof option === "number") { - THRESHOLD = option; - } - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - // Using a stack to store complexity per code path - const complexities = []; - - /** - * Increase the complexity of the code path in context - * @returns {void} - * @private - */ - function increaseComplexity() { - complexities[complexities.length - 1]++; - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - - onCodePathStart() { - - // The initial complexity is 1, representing one execution path in the CodePath - complexities.push(1); - }, - - // Each branching in the code adds 1 to the complexity - CatchClause: increaseComplexity, - ConditionalExpression: increaseComplexity, - LogicalExpression: increaseComplexity, - ForStatement: increaseComplexity, - ForInStatement: increaseComplexity, - ForOfStatement: increaseComplexity, - IfStatement: increaseComplexity, - WhileStatement: increaseComplexity, - DoWhileStatement: increaseComplexity, - - // Avoid `default` - "SwitchCase[test]": increaseComplexity, - - // Logical assignment operators have short-circuiting behavior - AssignmentExpression(node) { - if (astUtils.isLogicalAssignmentOperator(node.operator)) { - increaseComplexity(); - } - }, - - onCodePathEnd(codePath, node) { - const complexity = complexities.pop(); - - /* - * This rule only evaluates complexity of functions, so "program" is excluded. - * Class field initializers and class static blocks are implicit functions. Therefore, - * they shouldn't contribute to the enclosing function's complexity, but their - * own complexity should be evaluated. - */ - if ( - codePath.origin !== "function" && - codePath.origin !== "class-field-initializer" && - codePath.origin !== "class-static-block" - ) { - return; - } - - if (complexity > THRESHOLD) { - let name; - - if (codePath.origin === "class-field-initializer") { - name = "class field initializer"; - } else if (codePath.origin === "class-static-block") { - name = "class static block"; - } else { - name = astUtils.getFunctionNameWithKind(node); - } - - context.report({ - node, - messageId: "complex", - data: { - name: upperCaseFirst(name), - complexity, - max: THRESHOLD - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/computed-property-spacing.js b/node_modules/eslint/lib/rules/computed-property-spacing.js deleted file mode 100644 index 1e4e17c6c..000000000 --- a/node_modules/eslint/lib/rules/computed-property-spacing.js +++ /dev/null @@ -1,205 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside computed properties. - * @author Jamund Ferguson - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing inside computed property brackets", - recommended: false, - url: "https://eslint.org/docs/latest/rules/computed-property-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - enforceForClassMembers: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedSpaceBefore: "There should be no space before '{{tokenValue}}'.", - unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.", - - missingSpaceBefore: "A space is required before '{{tokenValue}}'.", - missingSpaceAfter: "A space is required after '{{tokenValue}}'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const propertyNameMustBeSpaced = context.options[0] === "always"; // default is "never" - const enforceForClassMembers = !context.options[1] || context.options[1].enforceForClassMembers; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @param {Token} tokenAfter The token after `token`. - * @returns {void} - */ - function reportNoBeginningSpace(node, token, tokenAfter) { - context.report({ - node, - loc: { start: token.loc.end, end: tokenAfter.loc.start }, - messageId: "unexpectedSpaceAfter", - data: { - tokenValue: token.value - }, - fix(fixer) { - return fixer.removeRange([token.range[1], tokenAfter.range[0]]); - } - }); - } - - /** - * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @param {Token} tokenBefore The token before `token`. - * @returns {void} - */ - function reportNoEndingSpace(node, token, tokenBefore) { - context.report({ - node, - loc: { start: tokenBefore.loc.end, end: token.loc.start }, - messageId: "unexpectedSpaceBefore", - data: { - tokenValue: token.value - }, - fix(fixer) { - return fixer.removeRange([tokenBefore.range[1], token.range[0]]); - } - }); - } - - /** - * Reports that there should be a space after the first token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportRequiredBeginningSpace(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "missingSpaceAfter", - data: { - tokenValue: token.value - }, - fix(fixer) { - return fixer.insertTextAfter(token, " "); - } - }); - } - - /** - * Reports that there should be a space before the last token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportRequiredEndingSpace(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "missingSpaceBefore", - data: { - tokenValue: token.value - }, - fix(fixer) { - return fixer.insertTextBefore(token, " "); - } - }); - } - - /** - * Returns a function that checks the spacing of a node on the property name - * that was passed in. - * @param {string} propertyName The property on the node to check for spacing - * @returns {Function} A function that will check spacing on a node - */ - function checkSpacing(propertyName) { - return function(node) { - if (!node.computed) { - return; - } - - const property = node[propertyName]; - - const before = sourceCode.getTokenBefore(property, astUtils.isOpeningBracketToken), - first = sourceCode.getTokenAfter(before, { includeComments: true }), - after = sourceCode.getTokenAfter(property, astUtils.isClosingBracketToken), - last = sourceCode.getTokenBefore(after, { includeComments: true }); - - if (astUtils.isTokenOnSameLine(before, first)) { - if (propertyNameMustBeSpaced) { - if (!sourceCode.isSpaceBetweenTokens(before, first) && astUtils.isTokenOnSameLine(before, first)) { - reportRequiredBeginningSpace(node, before); - } - } else { - if (sourceCode.isSpaceBetweenTokens(before, first)) { - reportNoBeginningSpace(node, before, first); - } - } - } - - if (astUtils.isTokenOnSameLine(last, after)) { - if (propertyNameMustBeSpaced) { - if (!sourceCode.isSpaceBetweenTokens(last, after) && astUtils.isTokenOnSameLine(last, after)) { - reportRequiredEndingSpace(node, after); - } - } else { - if (sourceCode.isSpaceBetweenTokens(last, after)) { - reportNoEndingSpace(node, after, last); - } - } - } - }; - } - - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - const listeners = { - Property: checkSpacing("key"), - MemberExpression: checkSpacing("property") - }; - - if (enforceForClassMembers) { - listeners.MethodDefinition = - listeners.PropertyDefinition = listeners.Property; - } - - return listeners; - - } -}; diff --git a/node_modules/eslint/lib/rules/consistent-return.js b/node_modules/eslint/lib/rules/consistent-return.js deleted file mode 100644 index e2d3f0782..000000000 --- a/node_modules/eslint/lib/rules/consistent-return.js +++ /dev/null @@ -1,185 +0,0 @@ -/** - * @fileoverview Rule to flag consistent return values - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { upperCaseFirst } = require("../shared/string-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a given code path segment is unreachable. - * @param {CodePathSegment} segment A CodePathSegment to check. - * @returns {boolean} `true` if the segment is unreachable. - */ -function isUnreachable(segment) { - return !segment.reachable; -} - -/** - * Checks whether a given node is a `constructor` method in an ES6 class - * @param {ASTNode} node A node to check - * @returns {boolean} `true` if the node is a `constructor` method - */ -function isClassConstructor(node) { - return node.type === "FunctionExpression" && - node.parent && - node.parent.type === "MethodDefinition" && - node.parent.kind === "constructor"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require `return` statements to either always or never specify values", - recommended: false, - url: "https://eslint.org/docs/latest/rules/consistent-return" - }, - - schema: [{ - type: "object", - properties: { - treatUndefinedAsUnspecified: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - - messages: { - missingReturn: "Expected to return a value at the end of {{name}}.", - missingReturnValue: "{{name}} expected a return value.", - unexpectedReturnValue: "{{name}} expected no return value." - } - }, - - create(context) { - const options = context.options[0] || {}; - const treatUndefinedAsUnspecified = options.treatUndefinedAsUnspecified === true; - let funcInfo = null; - - /** - * Checks whether of not the implicit returning is consistent if the last - * code path segment is reachable. - * @param {ASTNode} node A program/function node to check. - * @returns {void} - */ - function checkLastSegment(node) { - let loc, name; - - /* - * Skip if it expected no return value or unreachable. - * When unreachable, all paths are returned or thrown. - */ - if (!funcInfo.hasReturnValue || - funcInfo.codePath.currentSegments.every(isUnreachable) || - astUtils.isES5Constructor(node) || - isClassConstructor(node) - ) { - return; - } - - // Adjust a location and a message. - if (node.type === "Program") { - - // The head of program. - loc = { line: 1, column: 0 }; - name = "program"; - } else if (node.type === "ArrowFunctionExpression") { - - // `=>` token - loc = context.sourceCode.getTokenBefore(node.body, astUtils.isArrowToken).loc; - } else if ( - node.parent.type === "MethodDefinition" || - (node.parent.type === "Property" && node.parent.method) - ) { - - // Method name. - loc = node.parent.key.loc; - } else { - - // Function name or `function` keyword. - loc = (node.id || context.sourceCode.getFirstToken(node)).loc; - } - - if (!name) { - name = astUtils.getFunctionNameWithKind(node); - } - - // Reports. - context.report({ - node, - loc, - messageId: "missingReturn", - data: { name } - }); - } - - return { - - // Initializes/Disposes state of each code path. - onCodePathStart(codePath, node) { - funcInfo = { - upper: funcInfo, - codePath, - hasReturn: false, - hasReturnValue: false, - messageId: "", - node - }; - }, - onCodePathEnd() { - funcInfo = funcInfo.upper; - }, - - // Reports a given return statement if it's inconsistent. - ReturnStatement(node) { - const argument = node.argument; - let hasReturnValue = Boolean(argument); - - if (treatUndefinedAsUnspecified && hasReturnValue) { - hasReturnValue = !astUtils.isSpecificId(argument, "undefined") && argument.operator !== "void"; - } - - if (!funcInfo.hasReturn) { - funcInfo.hasReturn = true; - funcInfo.hasReturnValue = hasReturnValue; - funcInfo.messageId = hasReturnValue ? "missingReturnValue" : "unexpectedReturnValue"; - funcInfo.data = { - name: funcInfo.node.type === "Program" - ? "Program" - : upperCaseFirst(astUtils.getFunctionNameWithKind(funcInfo.node)) - }; - } else if (funcInfo.hasReturnValue !== hasReturnValue) { - context.report({ - node, - messageId: funcInfo.messageId, - data: funcInfo.data - }); - } - }, - - // Reports a given program/function if the implicit returning is not consistent. - "Program:exit": checkLastSegment, - "FunctionDeclaration:exit": checkLastSegment, - "FunctionExpression:exit": checkLastSegment, - "ArrowFunctionExpression:exit": checkLastSegment - }; - } -}; diff --git a/node_modules/eslint/lib/rules/consistent-this.js b/node_modules/eslint/lib/rules/consistent-this.js deleted file mode 100644 index 658957ae2..000000000 --- a/node_modules/eslint/lib/rules/consistent-this.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * @fileoverview Rule to enforce consistent naming of "this" context variables - * @author Raphael Pigulla - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce consistent naming when capturing the current execution context", - recommended: false, - url: "https://eslint.org/docs/latest/rules/consistent-this" - }, - - schema: { - type: "array", - items: { - type: "string", - minLength: 1 - }, - uniqueItems: true - }, - - messages: { - aliasNotAssignedToThis: "Designated alias '{{name}}' is not assigned to 'this'.", - unexpectedAlias: "Unexpected alias '{{name}}' for 'this'." - } - }, - - create(context) { - let aliases = []; - const sourceCode = context.sourceCode; - - if (context.options.length === 0) { - aliases.push("that"); - } else { - aliases = context.options; - } - - /** - * Reports that a variable declarator or assignment expression is assigning - * a non-'this' value to the specified alias. - * @param {ASTNode} node The assigning node. - * @param {string} name the name of the alias that was incorrectly used. - * @returns {void} - */ - function reportBadAssignment(node, name) { - context.report({ node, messageId: "aliasNotAssignedToThis", data: { name } }); - } - - /** - * Checks that an assignment to an identifier only assigns 'this' to the - * appropriate alias, and the alias is only assigned to 'this'. - * @param {ASTNode} node The assigning node. - * @param {Identifier} name The name of the variable assigned to. - * @param {Expression} value The value of the assignment. - * @returns {void} - */ - function checkAssignment(node, name, value) { - const isThis = value.type === "ThisExpression"; - - if (aliases.includes(name)) { - if (!isThis || node.operator && node.operator !== "=") { - reportBadAssignment(node, name); - } - } else if (isThis) { - context.report({ node, messageId: "unexpectedAlias", data: { name } }); - } - } - - /** - * Ensures that a variable declaration of the alias in a program or function - * is assigned to the correct value. - * @param {string} alias alias the check the assignment of. - * @param {Object} scope scope of the current code we are checking. - * @private - * @returns {void} - */ - function checkWasAssigned(alias, scope) { - const variable = scope.set.get(alias); - - if (!variable) { - return; - } - - if (variable.defs.some(def => def.node.type === "VariableDeclarator" && - def.node.init !== null)) { - return; - } - - /* - * The alias has been declared and not assigned: check it was - * assigned later in the same scope. - */ - if (!variable.references.some(reference => { - const write = reference.writeExpr; - - return ( - reference.from === scope && - write && write.type === "ThisExpression" && - write.parent.operator === "=" - ); - })) { - variable.defs.map(def => def.node).forEach(node => { - reportBadAssignment(node, alias); - }); - } - } - - /** - * Check each alias to ensure that is was assigned to the correct value. - * @param {ASTNode} node The node that represents the scope to check. - * @returns {void} - */ - function ensureWasAssigned(node) { - const scope = sourceCode.getScope(node); - - aliases.forEach(alias => { - checkWasAssigned(alias, scope); - }); - } - - return { - "Program:exit": ensureWasAssigned, - "FunctionExpression:exit": ensureWasAssigned, - "FunctionDeclaration:exit": ensureWasAssigned, - - VariableDeclarator(node) { - const id = node.id; - const isDestructuring = - id.type === "ArrayPattern" || id.type === "ObjectPattern"; - - if (node.init !== null && !isDestructuring) { - checkAssignment(node, id.name, node.init); - } - }, - - AssignmentExpression(node) { - if (node.left.type === "Identifier") { - checkAssignment(node, node.left.name, node.right); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/constructor-super.js b/node_modules/eslint/lib/rules/constructor-super.js deleted file mode 100644 index 5f4058812..000000000 --- a/node_modules/eslint/lib/rules/constructor-super.js +++ /dev/null @@ -1,423 +0,0 @@ -/** - * @fileoverview A rule to verify `super()` callings in constructor. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether a given code path segment is reachable or not. - * @param {CodePathSegment} segment A code path segment to check. - * @returns {boolean} `true` if the segment is reachable. - */ -function isReachable(segment) { - return segment.reachable; -} - -/** - * Checks whether or not a given node is a constructor. - * @param {ASTNode} node A node to check. This node type is one of - * `Program`, `FunctionDeclaration`, `FunctionExpression`, and - * `ArrowFunctionExpression`. - * @returns {boolean} `true` if the node is a constructor. - */ -function isConstructorFunction(node) { - return ( - node.type === "FunctionExpression" && - node.parent.type === "MethodDefinition" && - node.parent.kind === "constructor" - ); -} - -/** - * Checks whether a given node can be a constructor or not. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node can be a constructor. - */ -function isPossibleConstructor(node) { - if (!node) { - return false; - } - - switch (node.type) { - case "ClassExpression": - case "FunctionExpression": - case "ThisExpression": - case "MemberExpression": - case "CallExpression": - case "NewExpression": - case "ChainExpression": - case "YieldExpression": - case "TaggedTemplateExpression": - case "MetaProperty": - return true; - - case "Identifier": - return node.name !== "undefined"; - - case "AssignmentExpression": - if (["=", "&&="].includes(node.operator)) { - return isPossibleConstructor(node.right); - } - - if (["||=", "??="].includes(node.operator)) { - return ( - isPossibleConstructor(node.left) || - isPossibleConstructor(node.right) - ); - } - - /** - * All other assignment operators are mathematical assignment operators (arithmetic or bitwise). - * An assignment expression with a mathematical operator can either evaluate to a primitive value, - * or throw, depending on the operands. Thus, it cannot evaluate to a constructor function. - */ - return false; - - case "LogicalExpression": - - /* - * If the && operator short-circuits, the left side was falsy and therefore not a constructor, and if - * it doesn't short-circuit, it takes the value from the right side, so the right side must always be a - * possible constructor. A future improvement could verify that the left side could be truthy by - * excluding falsy literals. - */ - if (node.operator === "&&") { - return isPossibleConstructor(node.right); - } - - return ( - isPossibleConstructor(node.left) || - isPossibleConstructor(node.right) - ); - - case "ConditionalExpression": - return ( - isPossibleConstructor(node.alternate) || - isPossibleConstructor(node.consequent) - ); - - case "SequenceExpression": { - const lastExpression = node.expressions[node.expressions.length - 1]; - - return isPossibleConstructor(lastExpression); - } - - default: - return false; - } -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Require `super()` calls in constructors", - recommended: true, - url: "https://eslint.org/docs/latest/rules/constructor-super" - }, - - schema: [], - - messages: { - missingSome: "Lacked a call of 'super()' in some code paths.", - missingAll: "Expected to call 'super()'.", - - duplicate: "Unexpected duplicate 'super()'.", - badSuper: "Unexpected 'super()' because 'super' is not a constructor.", - unexpected: "Unexpected 'super()'." - } - }, - - create(context) { - - /* - * {{hasExtends: boolean, scope: Scope, codePath: CodePath}[]} - * Information for each constructor. - * - upper: Information of the upper constructor. - * - hasExtends: A flag which shows whether own class has a valid `extends` - * part. - * - scope: The scope of own class. - * - codePath: The code path object of the constructor. - */ - let funcInfo = null; - - /* - * {Map} - * Information for each code path segment. - * - calledInSomePaths: A flag of be called `super()` in some code paths. - * - calledInEveryPaths: A flag of be called `super()` in all code paths. - * - validNodes: - */ - let segInfoMap = Object.create(null); - - /** - * Gets the flag which shows `super()` is called in some paths. - * @param {CodePathSegment} segment A code path segment to get. - * @returns {boolean} The flag which shows `super()` is called in some paths - */ - function isCalledInSomePath(segment) { - return segment.reachable && segInfoMap[segment.id].calledInSomePaths; - } - - /** - * Gets the flag which shows `super()` is called in all paths. - * @param {CodePathSegment} segment A code path segment to get. - * @returns {boolean} The flag which shows `super()` is called in all paths. - */ - function isCalledInEveryPath(segment) { - - /* - * If specific segment is the looped segment of the current segment, - * skip the segment. - * If not skipped, this never becomes true after a loop. - */ - if (segment.nextSegments.length === 1 && - segment.nextSegments[0].isLoopedPrevSegment(segment) - ) { - return true; - } - return segment.reachable && segInfoMap[segment.id].calledInEveryPaths; - } - - return { - - /** - * Stacks a constructor information. - * @param {CodePath} codePath A code path which was started. - * @param {ASTNode} node The current node. - * @returns {void} - */ - onCodePathStart(codePath, node) { - if (isConstructorFunction(node)) { - - // Class > ClassBody > MethodDefinition > FunctionExpression - const classNode = node.parent.parent.parent; - const superClass = classNode.superClass; - - funcInfo = { - upper: funcInfo, - isConstructor: true, - hasExtends: Boolean(superClass), - superIsConstructor: isPossibleConstructor(superClass), - codePath - }; - } else { - funcInfo = { - upper: funcInfo, - isConstructor: false, - hasExtends: false, - superIsConstructor: false, - codePath - }; - } - }, - - /** - * Pops a constructor information. - * And reports if `super()` lacked. - * @param {CodePath} codePath A code path which was ended. - * @param {ASTNode} node The current node. - * @returns {void} - */ - onCodePathEnd(codePath, node) { - const hasExtends = funcInfo.hasExtends; - - // Pop. - funcInfo = funcInfo.upper; - - if (!hasExtends) { - return; - } - - // Reports if `super()` lacked. - const segments = codePath.returnedSegments; - const calledInEveryPaths = segments.every(isCalledInEveryPath); - const calledInSomePaths = segments.some(isCalledInSomePath); - - if (!calledInEveryPaths) { - context.report({ - messageId: calledInSomePaths - ? "missingSome" - : "missingAll", - node: node.parent - }); - } - }, - - /** - * Initialize information of a given code path segment. - * @param {CodePathSegment} segment A code path segment to initialize. - * @returns {void} - */ - onCodePathSegmentStart(segment) { - if (!(funcInfo && funcInfo.isConstructor && funcInfo.hasExtends)) { - return; - } - - // Initialize info. - const info = segInfoMap[segment.id] = { - calledInSomePaths: false, - calledInEveryPaths: false, - validNodes: [] - }; - - // When there are previous segments, aggregates these. - const prevSegments = segment.prevSegments; - - if (prevSegments.length > 0) { - info.calledInSomePaths = prevSegments.some(isCalledInSomePath); - info.calledInEveryPaths = prevSegments.every(isCalledInEveryPath); - } - }, - - /** - * Update information of the code path segment when a code path was - * looped. - * @param {CodePathSegment} fromSegment The code path segment of the - * end of a loop. - * @param {CodePathSegment} toSegment A code path segment of the head - * of a loop. - * @returns {void} - */ - onCodePathSegmentLoop(fromSegment, toSegment) { - if (!(funcInfo && funcInfo.isConstructor && funcInfo.hasExtends)) { - return; - } - - // Update information inside of the loop. - const isRealLoop = toSegment.prevSegments.length >= 2; - - funcInfo.codePath.traverseSegments( - { first: toSegment, last: fromSegment }, - segment => { - const info = segInfoMap[segment.id]; - const prevSegments = segment.prevSegments; - - // Updates flags. - info.calledInSomePaths = prevSegments.some(isCalledInSomePath); - info.calledInEveryPaths = prevSegments.every(isCalledInEveryPath); - - // If flags become true anew, reports the valid nodes. - if (info.calledInSomePaths || isRealLoop) { - const nodes = info.validNodes; - - info.validNodes = []; - - for (let i = 0; i < nodes.length; ++i) { - const node = nodes[i]; - - context.report({ - messageId: "duplicate", - node - }); - } - } - } - ); - }, - - /** - * Checks for a call of `super()`. - * @param {ASTNode} node A CallExpression node to check. - * @returns {void} - */ - "CallExpression:exit"(node) { - if (!(funcInfo && funcInfo.isConstructor)) { - return; - } - - // Skips except `super()`. - if (node.callee.type !== "Super") { - return; - } - - // Reports if needed. - if (funcInfo.hasExtends) { - const segments = funcInfo.codePath.currentSegments; - let duplicate = false; - let info = null; - - for (let i = 0; i < segments.length; ++i) { - const segment = segments[i]; - - if (segment.reachable) { - info = segInfoMap[segment.id]; - - duplicate = duplicate || info.calledInSomePaths; - info.calledInSomePaths = info.calledInEveryPaths = true; - } - } - - if (info) { - if (duplicate) { - context.report({ - messageId: "duplicate", - node - }); - } else if (!funcInfo.superIsConstructor) { - context.report({ - messageId: "badSuper", - node - }); - } else { - info.validNodes.push(node); - } - } - } else if (funcInfo.codePath.currentSegments.some(isReachable)) { - context.report({ - messageId: "unexpected", - node - }); - } - }, - - /** - * Set the mark to the returned path as `super()` was called. - * @param {ASTNode} node A ReturnStatement node to check. - * @returns {void} - */ - ReturnStatement(node) { - if (!(funcInfo && funcInfo.isConstructor && funcInfo.hasExtends)) { - return; - } - - // Skips if no argument. - if (!node.argument) { - return; - } - - // Returning argument is a substitute of 'super()'. - const segments = funcInfo.codePath.currentSegments; - - for (let i = 0; i < segments.length; ++i) { - const segment = segments[i]; - - if (segment.reachable) { - const info = segInfoMap[segment.id]; - - info.calledInSomePaths = info.calledInEveryPaths = true; - } - } - }, - - /** - * Resets state. - * @returns {void} - */ - "Program:exit"() { - segInfoMap = Object.create(null); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/curly.js b/node_modules/eslint/lib/rules/curly.js deleted file mode 100644 index 35408247a..000000000 --- a/node_modules/eslint/lib/rules/curly.js +++ /dev/null @@ -1,486 +0,0 @@ -/** - * @fileoverview Rule to flag statements without curly braces - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce consistent brace style for all control statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/curly" - }, - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["all"] - } - ], - minItems: 0, - maxItems: 1 - }, - { - type: "array", - items: [ - { - enum: ["multi", "multi-line", "multi-or-nest"] - }, - { - enum: ["consistent"] - } - ], - minItems: 0, - maxItems: 2 - } - ] - }, - - fixable: "code", - - messages: { - missingCurlyAfter: "Expected { after '{{name}}'.", - missingCurlyAfterCondition: "Expected { after '{{name}}' condition.", - unexpectedCurlyAfter: "Unnecessary { after '{{name}}'.", - unexpectedCurlyAfterCondition: "Unnecessary { after '{{name}}' condition." - } - }, - - create(context) { - - const multiOnly = (context.options[0] === "multi"); - const multiLine = (context.options[0] === "multi-line"); - const multiOrNest = (context.options[0] === "multi-or-nest"); - const consistent = (context.options[1] === "consistent"); - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Determines if a given node is a one-liner that's on the same line as it's preceding code. - * @param {ASTNode} node The node to check. - * @returns {boolean} True if the node is a one-liner that's on the same line as it's preceding code. - * @private - */ - function isCollapsedOneLiner(node) { - const before = sourceCode.getTokenBefore(node); - const last = sourceCode.getLastToken(node); - const lastExcludingSemicolon = astUtils.isSemicolonToken(last) ? sourceCode.getTokenBefore(last) : last; - - return before.loc.start.line === lastExcludingSemicolon.loc.end.line; - } - - /** - * Determines if a given node is a one-liner. - * @param {ASTNode} node The node to check. - * @returns {boolean} True if the node is a one-liner. - * @private - */ - function isOneLiner(node) { - if (node.type === "EmptyStatement") { - return true; - } - - const first = sourceCode.getFirstToken(node); - const last = sourceCode.getLastToken(node); - const lastExcludingSemicolon = astUtils.isSemicolonToken(last) ? sourceCode.getTokenBefore(last) : last; - - return first.loc.start.line === lastExcludingSemicolon.loc.end.line; - } - - /** - * Determines if the given node is a lexical declaration (let, const, function, or class) - * @param {ASTNode} node The node to check - * @returns {boolean} True if the node is a lexical declaration - * @private - */ - function isLexicalDeclaration(node) { - if (node.type === "VariableDeclaration") { - return node.kind === "const" || node.kind === "let"; - } - - return node.type === "FunctionDeclaration" || node.type === "ClassDeclaration"; - } - - /** - * Checks if the given token is an `else` token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is an `else` token. - */ - function isElseKeywordToken(token) { - return token.value === "else" && token.type === "Keyword"; - } - - /** - * Determines whether the given node has an `else` keyword token as the first token after. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is followed by an `else` keyword token. - */ - function isFollowedByElseKeyword(node) { - const nextToken = sourceCode.getTokenAfter(node); - - return Boolean(nextToken) && isElseKeywordToken(nextToken); - } - - /** - * Determines if a semicolon needs to be inserted after removing a set of curly brackets, in order to avoid a SyntaxError. - * @param {Token} closingBracket The } token - * @returns {boolean} `true` if a semicolon needs to be inserted after the last statement in the block. - */ - function needsSemicolon(closingBracket) { - const tokenBefore = sourceCode.getTokenBefore(closingBracket); - const tokenAfter = sourceCode.getTokenAfter(closingBracket); - const lastBlockNode = sourceCode.getNodeByRangeIndex(tokenBefore.range[0]); - - if (astUtils.isSemicolonToken(tokenBefore)) { - - // If the last statement already has a semicolon, don't add another one. - return false; - } - - if (!tokenAfter) { - - // If there are no statements after this block, there is no need to add a semicolon. - return false; - } - - if (lastBlockNode.type === "BlockStatement" && lastBlockNode.parent.type !== "FunctionExpression" && lastBlockNode.parent.type !== "ArrowFunctionExpression") { - - /* - * If the last node surrounded by curly brackets is a BlockStatement (other than a FunctionExpression or an ArrowFunctionExpression), - * don't insert a semicolon. Otherwise, the semicolon would be parsed as a separate statement, which would cause - * a SyntaxError if it was followed by `else`. - */ - return false; - } - - if (tokenBefore.loc.end.line === tokenAfter.loc.start.line) { - - // If the next token is on the same line, insert a semicolon. - return true; - } - - if (/^[([/`+-]/u.test(tokenAfter.value)) { - - // If the next token starts with a character that would disrupt ASI, insert a semicolon. - return true; - } - - if (tokenBefore.type === "Punctuator" && (tokenBefore.value === "++" || tokenBefore.value === "--")) { - - // If the last token is ++ or --, insert a semicolon to avoid disrupting ASI. - return true; - } - - // Otherwise, do not insert a semicolon. - return false; - } - - /** - * Determines whether the code represented by the given node contains an `if` statement - * that would become associated with an `else` keyword directly appended to that code. - * - * Examples where it returns `true`: - * - * if (a) - * foo(); - * - * if (a) { - * foo(); - * } - * - * if (a) - * foo(); - * else if (b) - * bar(); - * - * while (a) - * if (b) - * if(c) - * foo(); - * else - * bar(); - * - * Examples where it returns `false`: - * - * if (a) - * foo(); - * else - * bar(); - * - * while (a) { - * if (b) - * if(c) - * foo(); - * else - * bar(); - * } - * - * while (a) - * if (b) { - * if(c) - * foo(); - * } - * else - * bar(); - * @param {ASTNode} node Node representing the code to check. - * @returns {boolean} `true` if an `if` statement within the code would become associated with an `else` appended to that code. - */ - function hasUnsafeIf(node) { - switch (node.type) { - case "IfStatement": - if (!node.alternate) { - return true; - } - return hasUnsafeIf(node.alternate); - case "ForStatement": - case "ForInStatement": - case "ForOfStatement": - case "LabeledStatement": - case "WithStatement": - case "WhileStatement": - return hasUnsafeIf(node.body); - default: - return false; - } - } - - /** - * Determines whether the existing curly braces around the single statement are necessary to preserve the semantics of the code. - * The braces, which make the given block body, are necessary in either of the following situations: - * - * 1. The statement is a lexical declaration. - * 2. Without the braces, an `if` within the statement would become associated with an `else` after the closing brace: - * - * if (a) { - * if (b) - * foo(); - * } - * else - * bar(); - * - * if (a) - * while (b) - * while (c) { - * while (d) - * if (e) - * while(f) - * foo(); - * } - * else - * bar(); - * @param {ASTNode} node `BlockStatement` body with exactly one statement directly inside. The statement can have its own nested statements. - * @returns {boolean} `true` if the braces are necessary - removing them (replacing the given `BlockStatement` body with its single statement content) - * would change the semantics of the code or produce a syntax error. - */ - function areBracesNecessary(node) { - const statement = node.body[0]; - - return isLexicalDeclaration(statement) || - hasUnsafeIf(statement) && isFollowedByElseKeyword(node); - } - - /** - * Prepares to check the body of a node to see if it's a block statement. - * @param {ASTNode} node The node to report if there's a problem. - * @param {ASTNode} body The body node to check for blocks. - * @param {string} name The name to report if there's a problem. - * @param {{ condition: boolean }} opts Options to pass to the report functions - * @returns {Object} a prepared check object, with "actual", "expected", "check" properties. - * "actual" will be `true` or `false` whether the body is already a block statement. - * "expected" will be `true` or `false` if the body should be a block statement or not, or - * `null` if it doesn't matter, depending on the rule options. It can be modified to change - * the final behavior of "check". - * "check" will be a function reporting appropriate problems depending on the other - * properties. - */ - function prepareCheck(node, body, name, opts) { - const hasBlock = (body.type === "BlockStatement"); - let expected = null; - - if (hasBlock && (body.body.length !== 1 || areBracesNecessary(body))) { - expected = true; - } else if (multiOnly) { - expected = false; - } else if (multiLine) { - if (!isCollapsedOneLiner(body)) { - expected = true; - } - - // otherwise, the body is allowed to have braces or not to have braces - - } else if (multiOrNest) { - if (hasBlock) { - const statement = body.body[0]; - const leadingCommentsInBlock = sourceCode.getCommentsBefore(statement); - - expected = !isOneLiner(statement) || leadingCommentsInBlock.length > 0; - } else { - expected = !isOneLiner(body); - } - } else { - - // default "all" - expected = true; - } - - return { - actual: hasBlock, - expected, - check() { - if (this.expected !== null && this.expected !== this.actual) { - if (this.expected) { - context.report({ - node, - loc: body.loc, - messageId: opts && opts.condition ? "missingCurlyAfterCondition" : "missingCurlyAfter", - data: { - name - }, - fix: fixer => fixer.replaceText(body, `{${sourceCode.getText(body)}}`) - }); - } else { - context.report({ - node, - loc: body.loc, - messageId: opts && opts.condition ? "unexpectedCurlyAfterCondition" : "unexpectedCurlyAfter", - data: { - name - }, - fix(fixer) { - - /* - * `do while` expressions sometimes need a space to be inserted after `do`. - * e.g. `do{foo()} while (bar)` should be corrected to `do foo() while (bar)` - */ - const needsPrecedingSpace = node.type === "DoWhileStatement" && - sourceCode.getTokenBefore(body).range[1] === body.range[0] && - !astUtils.canTokensBeAdjacent("do", sourceCode.getFirstToken(body, { skip: 1 })); - - const openingBracket = sourceCode.getFirstToken(body); - const closingBracket = sourceCode.getLastToken(body); - const lastTokenInBlock = sourceCode.getTokenBefore(closingBracket); - - if (needsSemicolon(closingBracket)) { - - /* - * If removing braces would cause a SyntaxError due to multiple statements on the same line (or - * change the semantics of the code due to ASI), don't perform a fix. - */ - return null; - } - - const resultingBodyText = sourceCode.getText().slice(openingBracket.range[1], lastTokenInBlock.range[0]) + - sourceCode.getText(lastTokenInBlock) + - sourceCode.getText().slice(lastTokenInBlock.range[1], closingBracket.range[0]); - - return fixer.replaceText(body, (needsPrecedingSpace ? " " : "") + resultingBodyText); - } - }); - } - } - } - }; - } - - /** - * Prepares to check the bodies of a "if", "else if" and "else" chain. - * @param {ASTNode} node The first IfStatement node of the chain. - * @returns {Object[]} prepared checks for each body of the chain. See `prepareCheck` for more - * information. - */ - function prepareIfChecks(node) { - const preparedChecks = []; - - for (let currentNode = node; currentNode; currentNode = currentNode.alternate) { - preparedChecks.push(prepareCheck(currentNode, currentNode.consequent, "if", { condition: true })); - if (currentNode.alternate && currentNode.alternate.type !== "IfStatement") { - preparedChecks.push(prepareCheck(currentNode, currentNode.alternate, "else")); - break; - } - } - - if (consistent) { - - /* - * If any node should have or already have braces, make sure they - * all have braces. - * If all nodes shouldn't have braces, make sure they don't. - */ - const expected = preparedChecks.some(preparedCheck => { - if (preparedCheck.expected !== null) { - return preparedCheck.expected; - } - return preparedCheck.actual; - }); - - preparedChecks.forEach(preparedCheck => { - preparedCheck.expected = expected; - }); - } - - return preparedChecks; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - IfStatement(node) { - const parent = node.parent; - const isElseIf = parent.type === "IfStatement" && parent.alternate === node; - - if (!isElseIf) { - - // This is a top `if`, check the whole `if-else-if` chain - prepareIfChecks(node).forEach(preparedCheck => { - preparedCheck.check(); - }); - } - - // Skip `else if`, it's already checked (when the top `if` was visited) - }, - - WhileStatement(node) { - prepareCheck(node, node.body, "while", { condition: true }).check(); - }, - - DoWhileStatement(node) { - prepareCheck(node, node.body, "do").check(); - }, - - ForStatement(node) { - prepareCheck(node, node.body, "for", { condition: true }).check(); - }, - - ForInStatement(node) { - prepareCheck(node, node.body, "for-in").check(); - }, - - ForOfStatement(node) { - prepareCheck(node, node.body, "for-of").check(); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/default-case-last.js b/node_modules/eslint/lib/rules/default-case-last.js deleted file mode 100644 index d4a83b5fd..000000000 --- a/node_modules/eslint/lib/rules/default-case-last.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @fileoverview Rule to enforce default clauses in switch statements to be last - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce default clauses in switch statements to be last", - recommended: false, - url: "https://eslint.org/docs/latest/rules/default-case-last" - }, - - schema: [], - - messages: { - notLast: "Default clause should be the last clause." - } - }, - - create(context) { - return { - SwitchStatement(node) { - const cases = node.cases, - indexOfDefault = cases.findIndex(c => c.test === null); - - if (indexOfDefault !== -1 && indexOfDefault !== cases.length - 1) { - const defaultClause = cases[indexOfDefault]; - - context.report({ node: defaultClause, messageId: "notLast" }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/default-case.js b/node_modules/eslint/lib/rules/default-case.js deleted file mode 100644 index 4f2fad0c4..000000000 --- a/node_modules/eslint/lib/rules/default-case.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @fileoverview require default case in switch statements - * @author Aliaksei Shytkin - */ -"use strict"; - -const DEFAULT_COMMENT_PATTERN = /^no default$/iu; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require `default` cases in `switch` statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/default-case" - }, - - schema: [{ - type: "object", - properties: { - commentPattern: { - type: "string" - } - }, - additionalProperties: false - }], - - messages: { - missingDefaultCase: "Expected a default case." - } - }, - - create(context) { - const options = context.options[0] || {}; - const commentPattern = options.commentPattern - ? new RegExp(options.commentPattern, "u") - : DEFAULT_COMMENT_PATTERN; - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Shortcut to get last element of array - * @param {*[]} collection Array - * @returns {any} Last element - */ - function last(collection) { - return collection[collection.length - 1]; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - SwitchStatement(node) { - - if (!node.cases.length) { - - /* - * skip check of empty switch because there is no easy way - * to extract comments inside it now - */ - return; - } - - const hasDefault = node.cases.some(v => v.test === null); - - if (!hasDefault) { - - let comment; - - const lastCase = last(node.cases); - const comments = sourceCode.getCommentsAfter(lastCase); - - if (comments.length) { - comment = last(comments); - } - - if (!comment || !commentPattern.test(comment.value.trim())) { - context.report({ node, messageId: "missingDefaultCase" }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/default-param-last.js b/node_modules/eslint/lib/rules/default-param-last.js deleted file mode 100644 index 3254fa802..000000000 --- a/node_modules/eslint/lib/rules/default-param-last.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @fileoverview enforce default parameters to be last - * @author Chiawen Chen - */ - -"use strict"; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce default parameters to be last", - recommended: false, - url: "https://eslint.org/docs/latest/rules/default-param-last" - }, - - schema: [], - - messages: { - shouldBeLast: "Default parameters should be last." - } - }, - - create(context) { - - /** - * Handler for function contexts. - * @param {ASTNode} node function node - * @returns {void} - */ - function handleFunction(node) { - let hasSeenPlainParam = false; - - for (let i = node.params.length - 1; i >= 0; i -= 1) { - const param = node.params[i]; - - if ( - param.type !== "AssignmentPattern" && - param.type !== "RestElement" - ) { - hasSeenPlainParam = true; - continue; - } - - if (hasSeenPlainParam && param.type === "AssignmentPattern") { - context.report({ - node: param, - messageId: "shouldBeLast" - }); - } - } - } - - return { - FunctionDeclaration: handleFunction, - FunctionExpression: handleFunction, - ArrowFunctionExpression: handleFunction - }; - } -}; diff --git a/node_modules/eslint/lib/rules/dot-location.js b/node_modules/eslint/lib/rules/dot-location.js deleted file mode 100644 index dac98b06b..000000000 --- a/node_modules/eslint/lib/rules/dot-location.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @fileoverview Validates newlines before and after dots - * @author Greg Cochard - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent newlines before and after dots", - recommended: false, - url: "https://eslint.org/docs/latest/rules/dot-location" - }, - - schema: [ - { - enum: ["object", "property"] - } - ], - - fixable: "code", - - messages: { - expectedDotAfterObject: "Expected dot to be on same line as object.", - expectedDotBeforeProperty: "Expected dot to be on same line as property." - } - }, - - create(context) { - - const config = context.options[0]; - - // default to onObject if no preference is passed - const onObject = config === "object" || !config; - - const sourceCode = context.sourceCode; - - /** - * Reports if the dot between object and property is on the correct location. - * @param {ASTNode} node The `MemberExpression` node. - * @returns {void} - */ - function checkDotLocation(node) { - const property = node.property; - const dotToken = sourceCode.getTokenBefore(property); - - if (onObject) { - - // `obj` expression can be parenthesized, but those paren tokens are not a part of the `obj` node. - const tokenBeforeDot = sourceCode.getTokenBefore(dotToken); - - if (!astUtils.isTokenOnSameLine(tokenBeforeDot, dotToken)) { - context.report({ - node, - loc: dotToken.loc, - messageId: "expectedDotAfterObject", - *fix(fixer) { - if (dotToken.value.startsWith(".") && astUtils.isDecimalIntegerNumericToken(tokenBeforeDot)) { - yield fixer.insertTextAfter(tokenBeforeDot, ` ${dotToken.value}`); - } else { - yield fixer.insertTextAfter(tokenBeforeDot, dotToken.value); - } - yield fixer.remove(dotToken); - } - }); - } - } else if (!astUtils.isTokenOnSameLine(dotToken, property)) { - context.report({ - node, - loc: dotToken.loc, - messageId: "expectedDotBeforeProperty", - *fix(fixer) { - yield fixer.remove(dotToken); - yield fixer.insertTextBefore(property, dotToken.value); - } - }); - } - } - - /** - * Checks the spacing of the dot within a member expression. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkNode(node) { - if (!node.computed) { - checkDotLocation(node); - } - } - - return { - MemberExpression: checkNode - }; - } -}; diff --git a/node_modules/eslint/lib/rules/dot-notation.js b/node_modules/eslint/lib/rules/dot-notation.js deleted file mode 100644 index 78f136867..000000000 --- a/node_modules/eslint/lib/rules/dot-notation.js +++ /dev/null @@ -1,177 +0,0 @@ -/** - * @fileoverview Rule to warn about using dot notation instead of square bracket notation when possible. - * @author Josh Perez - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const keywords = require("./utils/keywords"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const validIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/u; - -// `null` literal must be handled separately. -const literalTypesToCheck = new Set(["string", "boolean"]); - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce dot notation whenever possible", - recommended: false, - url: "https://eslint.org/docs/latest/rules/dot-notation" - }, - - schema: [ - { - type: "object", - properties: { - allowKeywords: { - type: "boolean", - default: true - }, - allowPattern: { - type: "string", - default: "" - } - }, - additionalProperties: false - } - ], - - fixable: "code", - - messages: { - useDot: "[{{key}}] is better written in dot notation.", - useBrackets: ".{{key}} is a syntax error." - } - }, - - create(context) { - const options = context.options[0] || {}; - const allowKeywords = options.allowKeywords === void 0 || options.allowKeywords; - const sourceCode = context.sourceCode; - - let allowPattern; - - if (options.allowPattern) { - allowPattern = new RegExp(options.allowPattern, "u"); - } - - /** - * Check if the property is valid dot notation - * @param {ASTNode} node The dot notation node - * @param {string} value Value which is to be checked - * @returns {void} - */ - function checkComputedProperty(node, value) { - if ( - validIdentifier.test(value) && - (allowKeywords || !keywords.includes(String(value))) && - !(allowPattern && allowPattern.test(value)) - ) { - const formattedValue = node.property.type === "Literal" ? JSON.stringify(value) : `\`${value}\``; - - context.report({ - node: node.property, - messageId: "useDot", - data: { - key: formattedValue - }, - *fix(fixer) { - const leftBracket = sourceCode.getTokenAfter(node.object, astUtils.isOpeningBracketToken); - const rightBracket = sourceCode.getLastToken(node); - const nextToken = sourceCode.getTokenAfter(node); - - // Don't perform any fixes if there are comments inside the brackets. - if (sourceCode.commentsExistBetween(leftBracket, rightBracket)) { - return; - } - - // Replace the brackets by an identifier. - if (!node.optional) { - yield fixer.insertTextBefore( - leftBracket, - astUtils.isDecimalInteger(node.object) ? " ." : "." - ); - } - yield fixer.replaceTextRange( - [leftBracket.range[0], rightBracket.range[1]], - value - ); - - // Insert a space after the property if it will be connected to the next token. - if ( - nextToken && - rightBracket.range[1] === nextToken.range[0] && - !astUtils.canTokensBeAdjacent(String(value), nextToken) - ) { - yield fixer.insertTextAfter(node, " "); - } - } - }); - } - } - - return { - MemberExpression(node) { - if ( - node.computed && - node.property.type === "Literal" && - (literalTypesToCheck.has(typeof node.property.value) || astUtils.isNullLiteral(node.property)) - ) { - checkComputedProperty(node, node.property.value); - } - if ( - node.computed && - node.property.type === "TemplateLiteral" && - node.property.expressions.length === 0 - ) { - checkComputedProperty(node, node.property.quasis[0].value.cooked); - } - if ( - !allowKeywords && - !node.computed && - node.property.type === "Identifier" && - keywords.includes(String(node.property.name)) - ) { - context.report({ - node: node.property, - messageId: "useBrackets", - data: { - key: node.property.name - }, - *fix(fixer) { - const dotToken = sourceCode.getTokenBefore(node.property); - - // A statement that starts with `let[` is parsed as a destructuring variable declaration, not a MemberExpression. - if (node.object.type === "Identifier" && node.object.name === "let" && !node.optional) { - return; - } - - // Don't perform any fixes if there are comments between the dot and the property name. - if (sourceCode.commentsExistBetween(dotToken, node.property)) { - return; - } - - // Replace the identifier to brackets. - if (!node.optional) { - yield fixer.remove(dotToken); - } - yield fixer.replaceText(node.property, `["${node.property.name}"]`); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/eol-last.js b/node_modules/eslint/lib/rules/eol-last.js deleted file mode 100644 index 1036db1a1..000000000 --- a/node_modules/eslint/lib/rules/eol-last.js +++ /dev/null @@ -1,112 +0,0 @@ -/** - * @fileoverview Require or disallow newline at the end of files - * @author Nodeca Team - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow newline at the end of files", - recommended: false, - url: "https://eslint.org/docs/latest/rules/eol-last" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never", "unix", "windows"] - } - ], - - messages: { - missing: "Newline required at end of file but not found.", - unexpected: "Newline not allowed at end of file." - } - }, - create(context) { - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - Program: function checkBadEOF(node) { - const sourceCode = context.sourceCode, - src = sourceCode.getText(), - lastLine = sourceCode.lines[sourceCode.lines.length - 1], - location = { - column: lastLine.length, - line: sourceCode.lines.length - }, - LF = "\n", - CRLF = `\r${LF}`, - endsWithNewline = src.endsWith(LF); - - /* - * Empty source is always valid: No content in file so we don't - * need to lint for a newline on the last line of content. - */ - if (!src.length) { - return; - } - - let mode = context.options[0] || "always", - appendCRLF = false; - - if (mode === "unix") { - - // `"unix"` should behave exactly as `"always"` - mode = "always"; - } - if (mode === "windows") { - - // `"windows"` should behave exactly as `"always"`, but append CRLF in the fixer for backwards compatibility - mode = "always"; - appendCRLF = true; - } - if (mode === "always" && !endsWithNewline) { - - // File is not newline-terminated, but should be - context.report({ - node, - loc: location, - messageId: "missing", - fix(fixer) { - return fixer.insertTextAfterRange([0, src.length], appendCRLF ? CRLF : LF); - } - }); - } else if (mode === "never" && endsWithNewline) { - - const secondLastLine = sourceCode.lines[sourceCode.lines.length - 2]; - - // File is newline-terminated, but shouldn't be - context.report({ - node, - loc: { - start: { line: sourceCode.lines.length - 1, column: secondLastLine.length }, - end: { line: sourceCode.lines.length, column: 0 } - }, - messageId: "unexpected", - fix(fixer) { - const finalEOLs = /(?:\r?\n)+$/u, - match = finalEOLs.exec(sourceCode.text), - start = match.index, - end = sourceCode.text.length; - - return fixer.replaceTextRange([start, end], ""); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/eqeqeq.js b/node_modules/eslint/lib/rules/eqeqeq.js deleted file mode 100644 index 12b1e805e..000000000 --- a/node_modules/eslint/lib/rules/eqeqeq.js +++ /dev/null @@ -1,174 +0,0 @@ -/** - * @fileoverview Rule to flag statements that use != and == instead of !== and === - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require the use of `===` and `!==`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/eqeqeq" - }, - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["always"] - }, - { - type: "object", - properties: { - null: { - enum: ["always", "never", "ignore"] - } - }, - additionalProperties: false - } - ], - additionalItems: false - }, - { - type: "array", - items: [ - { - enum: ["smart", "allow-null"] - } - ], - additionalItems: false - } - ] - }, - - fixable: "code", - - messages: { - unexpected: "Expected '{{expectedOperator}}' and instead saw '{{actualOperator}}'." - } - }, - - create(context) { - const config = context.options[0] || "always"; - const options = context.options[1] || {}; - const sourceCode = context.sourceCode; - - const nullOption = (config === "always") - ? options.null || "always" - : "ignore"; - const enforceRuleForNull = (nullOption === "always"); - const enforceInverseRuleForNull = (nullOption === "never"); - - /** - * Checks if an expression is a typeof expression - * @param {ASTNode} node The node to check - * @returns {boolean} if the node is a typeof expression - */ - function isTypeOf(node) { - return node.type === "UnaryExpression" && node.operator === "typeof"; - } - - /** - * Checks if either operand of a binary expression is a typeof operation - * @param {ASTNode} node The node to check - * @returns {boolean} if one of the operands is typeof - * @private - */ - function isTypeOfBinary(node) { - return isTypeOf(node.left) || isTypeOf(node.right); - } - - /** - * Checks if operands are literals of the same type (via typeof) - * @param {ASTNode} node The node to check - * @returns {boolean} if operands are of same type - * @private - */ - function areLiteralsAndSameType(node) { - return node.left.type === "Literal" && node.right.type === "Literal" && - typeof node.left.value === typeof node.right.value; - } - - /** - * Checks if one of the operands is a literal null - * @param {ASTNode} node The node to check - * @returns {boolean} if operands are null - * @private - */ - function isNullCheck(node) { - return astUtils.isNullLiteral(node.right) || astUtils.isNullLiteral(node.left); - } - - /** - * Reports a message for this rule. - * @param {ASTNode} node The binary expression node that was checked - * @param {string} expectedOperator The operator that was expected (either '==', '!=', '===', or '!==') - * @returns {void} - * @private - */ - function report(node, expectedOperator) { - const operatorToken = sourceCode.getFirstTokenBetween( - node.left, - node.right, - token => token.value === node.operator - ); - - context.report({ - node, - loc: operatorToken.loc, - messageId: "unexpected", - data: { expectedOperator, actualOperator: node.operator }, - fix(fixer) { - - // If the comparison is a `typeof` comparison or both sides are literals with the same type, then it's safe to fix. - if (isTypeOfBinary(node) || areLiteralsAndSameType(node)) { - return fixer.replaceText(operatorToken, expectedOperator); - } - return null; - } - }); - } - - return { - BinaryExpression(node) { - const isNull = isNullCheck(node); - - if (node.operator !== "==" && node.operator !== "!=") { - if (enforceInverseRuleForNull && isNull) { - report(node, node.operator.slice(0, -1)); - } - return; - } - - if (config === "smart" && (isTypeOfBinary(node) || - areLiteralsAndSameType(node) || isNull)) { - return; - } - - if (!enforceRuleForNull && isNull) { - return; - } - - report(node, `${node.operator}=`); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/for-direction.js b/node_modules/eslint/lib/rules/for-direction.js deleted file mode 100644 index 4ed735015..000000000 --- a/node_modules/eslint/lib/rules/for-direction.js +++ /dev/null @@ -1,126 +0,0 @@ -/** - * @fileoverview enforce "for" loop update clause moving the counter in the right direction.(for-direction) - * @author Aladdin-ADD - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Enforce \"for\" loop update clause moving the counter in the right direction", - recommended: true, - url: "https://eslint.org/docs/latest/rules/for-direction" - }, - - fixable: null, - schema: [], - - messages: { - incorrectDirection: "The update clause in this loop moves the variable in the wrong direction." - } - }, - - create(context) { - - /** - * report an error. - * @param {ASTNode} node the node to report. - * @returns {void} - */ - function report(node) { - context.report({ - node, - messageId: "incorrectDirection" - }); - } - - /** - * check the right side of the assignment - * @param {ASTNode} update UpdateExpression to check - * @param {int} dir expected direction that could either be turned around or invalidated - * @returns {int} return dir, the negated dir or zero if it's not clear for identifiers - */ - function getRightDirection(update, dir) { - if (update.right.type === "UnaryExpression") { - if (update.right.operator === "-") { - return -dir; - } - } else if (update.right.type === "Identifier") { - return 0; - } - return dir; - } - - /** - * check UpdateExpression add/sub the counter - * @param {ASTNode} update UpdateExpression to check - * @param {string} counter variable name to check - * @returns {int} if add return 1, if sub return -1, if nochange, return 0 - */ - function getUpdateDirection(update, counter) { - if (update.argument.type === "Identifier" && update.argument.name === counter) { - if (update.operator === "++") { - return 1; - } - if (update.operator === "--") { - return -1; - } - } - return 0; - } - - /** - * check AssignmentExpression add/sub the counter - * @param {ASTNode} update AssignmentExpression to check - * @param {string} counter variable name to check - * @returns {int} if add return 1, if sub return -1, if nochange, return 0 - */ - function getAssignmentDirection(update, counter) { - if (update.left.name === counter) { - if (update.operator === "+=") { - return getRightDirection(update, 1); - } - if (update.operator === "-=") { - return getRightDirection(update, -1); - } - } - return 0; - } - return { - ForStatement(node) { - - if (node.test && node.test.type === "BinaryExpression" && node.test.left.type === "Identifier" && node.update) { - const counter = node.test.left.name; - const operator = node.test.operator; - const update = node.update; - - let wrongDirection; - - if (operator === "<" || operator === "<=") { - wrongDirection = -1; - } else if (operator === ">" || operator === ">=") { - wrongDirection = 1; - } else { - return; - } - - if (update.type === "UpdateExpression") { - if (getUpdateDirection(update, counter) === wrongDirection) { - report(node); - } - } else if (update.type === "AssignmentExpression" && getAssignmentDirection(update, counter) === wrongDirection) { - report(node); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/func-call-spacing.js b/node_modules/eslint/lib/rules/func-call-spacing.js deleted file mode 100644 index 3d5e53849..000000000 --- a/node_modules/eslint/lib/rules/func-call-spacing.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * @fileoverview Rule to control spacing within function calls - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow spacing between function identifiers and their invocations", - recommended: false, - url: "https://eslint.org/docs/latest/rules/func-call-spacing" - }, - - fixable: "whitespace", - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["never"] - } - ], - minItems: 0, - maxItems: 1 - }, - { - type: "array", - items: [ - { - enum: ["always"] - }, - { - type: "object", - properties: { - allowNewlines: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - } - ] - }, - - messages: { - unexpectedWhitespace: "Unexpected whitespace between function name and paren.", - unexpectedNewline: "Unexpected newline between function name and paren.", - missing: "Missing space between function name and paren." - } - }, - - create(context) { - - const never = context.options[0] !== "always"; - const allowNewlines = !never && context.options[1] && context.options[1].allowNewlines; - const sourceCode = context.sourceCode; - const text = sourceCode.getText(); - - /** - * Check if open space is present in a function name - * @param {ASTNode} node node to evaluate - * @param {Token} leftToken The last token of the callee. This may be the closing parenthesis that encloses the callee. - * @param {Token} rightToken Tha first token of the arguments. this is the opening parenthesis that encloses the arguments. - * @returns {void} - * @private - */ - function checkSpacing(node, leftToken, rightToken) { - const textBetweenTokens = text.slice(leftToken.range[1], rightToken.range[0]).replace(/\/\*.*?\*\//gu, ""); - const hasWhitespace = /\s/u.test(textBetweenTokens); - const hasNewline = hasWhitespace && astUtils.LINEBREAK_MATCHER.test(textBetweenTokens); - - /* - * never allowNewlines hasWhitespace hasNewline message - * F F F F Missing space between function name and paren. - * F F F T (Invalid `!hasWhitespace && hasNewline`) - * F F T T Unexpected newline between function name and paren. - * F F T F (OK) - * F T T F (OK) - * F T T T (OK) - * F T F T (Invalid `!hasWhitespace && hasNewline`) - * F T F F Missing space between function name and paren. - * T T F F (Invalid `never && allowNewlines`) - * T T F T (Invalid `!hasWhitespace && hasNewline`) - * T T T T (Invalid `never && allowNewlines`) - * T T T F (Invalid `never && allowNewlines`) - * T F T F Unexpected space between function name and paren. - * T F T T Unexpected space between function name and paren. - * T F F T (Invalid `!hasWhitespace && hasNewline`) - * T F F F (OK) - * - * T T Unexpected space between function name and paren. - * F F Missing space between function name and paren. - * F F T Unexpected newline between function name and paren. - */ - - if (never && hasWhitespace) { - context.report({ - node, - loc: { - start: leftToken.loc.end, - end: { - line: rightToken.loc.start.line, - column: rightToken.loc.start.column - 1 - } - }, - messageId: "unexpectedWhitespace", - fix(fixer) { - - // Don't remove comments. - if (sourceCode.commentsExistBetween(leftToken, rightToken)) { - return null; - } - - // If `?.` exists, it doesn't hide no-unexpected-multiline errors - if (node.optional) { - return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], "?."); - } - - /* - * Only autofix if there is no newline - * https://github.com/eslint/eslint/issues/7787 - */ - if (hasNewline) { - return null; - } - return fixer.removeRange([leftToken.range[1], rightToken.range[0]]); - } - }); - } else if (!never && !hasWhitespace) { - context.report({ - node, - loc: { - start: { - line: leftToken.loc.end.line, - column: leftToken.loc.end.column - 1 - }, - end: rightToken.loc.start - }, - messageId: "missing", - fix(fixer) { - if (node.optional) { - return null; // Not sure if inserting a space to either before/after `?.` token. - } - return fixer.insertTextBefore(rightToken, " "); - } - }); - } else if (!never && !allowNewlines && hasNewline) { - context.report({ - node, - loc: { - start: leftToken.loc.end, - end: rightToken.loc.start - }, - messageId: "unexpectedNewline", - fix(fixer) { - - /* - * Only autofix if there is no newline - * https://github.com/eslint/eslint/issues/7787 - * But if `?.` exists, it doesn't hide no-unexpected-multiline errors - */ - if (!node.optional) { - return null; - } - - // Don't remove comments. - if (sourceCode.commentsExistBetween(leftToken, rightToken)) { - return null; - } - - const range = [leftToken.range[1], rightToken.range[0]]; - const qdToken = sourceCode.getTokenAfter(leftToken); - - if (qdToken.range[0] === leftToken.range[1]) { - return fixer.replaceTextRange(range, "?. "); - } - if (qdToken.range[1] === rightToken.range[0]) { - return fixer.replaceTextRange(range, " ?."); - } - return fixer.replaceTextRange(range, " ?. "); - } - }); - } - } - - return { - "CallExpression, NewExpression"(node) { - const lastToken = sourceCode.getLastToken(node); - const lastCalleeToken = sourceCode.getLastToken(node.callee); - const parenToken = sourceCode.getFirstTokenBetween(lastCalleeToken, lastToken, astUtils.isOpeningParenToken); - const prevToken = parenToken && sourceCode.getTokenBefore(parenToken, astUtils.isNotQuestionDotToken); - - // Parens in NewExpression are optional - if (!(parenToken && parenToken.range[1] < node.range[1])) { - return; - } - - checkSpacing(node, prevToken, parenToken); - }, - - ImportExpression(node) { - const leftToken = sourceCode.getFirstToken(node); - const rightToken = sourceCode.getTokenAfter(leftToken); - - checkSpacing(node, leftToken, rightToken); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/func-name-matching.js b/node_modules/eslint/lib/rules/func-name-matching.js deleted file mode 100644 index b9555d6bd..000000000 --- a/node_modules/eslint/lib/rules/func-name-matching.js +++ /dev/null @@ -1,253 +0,0 @@ -/** - * @fileoverview Rule to require function names to match the name of the variable or property to which they are assigned. - * @author Annie Zhang, Pavel Strashkin - */ - -"use strict"; - -//-------------------------------------------------------------------------- -// Requirements -//-------------------------------------------------------------------------- - -const astUtils = require("./utils/ast-utils"); -const esutils = require("esutils"); - -//-------------------------------------------------------------------------- -// Helpers -//-------------------------------------------------------------------------- - -/** - * Determines if a pattern is `module.exports` or `module["exports"]` - * @param {ASTNode} pattern The left side of the AssignmentExpression - * @returns {boolean} True if the pattern is `module.exports` or `module["exports"]` - */ -function isModuleExports(pattern) { - if (pattern.type === "MemberExpression" && pattern.object.type === "Identifier" && pattern.object.name === "module") { - - // module.exports - if (pattern.property.type === "Identifier" && pattern.property.name === "exports") { - return true; - } - - // module["exports"] - if (pattern.property.type === "Literal" && pattern.property.value === "exports") { - return true; - } - } - return false; -} - -/** - * Determines if a string name is a valid identifier - * @param {string} name The string to be checked - * @param {int} ecmaVersion The ECMAScript version if specified in the parserOptions config - * @returns {boolean} True if the string is a valid identifier - */ -function isIdentifier(name, ecmaVersion) { - if (ecmaVersion >= 2015) { - return esutils.keyword.isIdentifierES6(name); - } - return esutils.keyword.isIdentifierES5(name); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const alwaysOrNever = { enum: ["always", "never"] }; -const optionsObject = { - type: "object", - properties: { - considerPropertyDescriptor: { - type: "boolean" - }, - includeCommonJSModuleExports: { - type: "boolean" - } - }, - additionalProperties: false -}; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require function names to match the name of the variable or property to which they are assigned", - recommended: false, - url: "https://eslint.org/docs/latest/rules/func-name-matching" - }, - - schema: { - anyOf: [{ - type: "array", - additionalItems: false, - items: [alwaysOrNever, optionsObject] - }, { - type: "array", - additionalItems: false, - items: [optionsObject] - }] - }, - - messages: { - matchProperty: "Function name `{{funcName}}` should match property name `{{name}}`.", - matchVariable: "Function name `{{funcName}}` should match variable name `{{name}}`.", - notMatchProperty: "Function name `{{funcName}}` should not match property name `{{name}}`.", - notMatchVariable: "Function name `{{funcName}}` should not match variable name `{{name}}`." - } - }, - - create(context) { - const options = (typeof context.options[0] === "object" ? context.options[0] : context.options[1]) || {}; - const nameMatches = typeof context.options[0] === "string" ? context.options[0] : "always"; - const considerPropertyDescriptor = options.considerPropertyDescriptor; - const includeModuleExports = options.includeCommonJSModuleExports; - const ecmaVersion = context.languageOptions.ecmaVersion; - - /** - * Check whether node is a certain CallExpression. - * @param {string} objName object name - * @param {string} funcName function name - * @param {ASTNode} node The node to check - * @returns {boolean} `true` if node matches CallExpression - */ - function isPropertyCall(objName, funcName, node) { - if (!node) { - return false; - } - return node.type === "CallExpression" && astUtils.isSpecificMemberAccess(node.callee, objName, funcName); - } - - /** - * Compares identifiers based on the nameMatches option - * @param {string} x the first identifier - * @param {string} y the second identifier - * @returns {boolean} whether the two identifiers should warn. - */ - function shouldWarn(x, y) { - return (nameMatches === "always" && x !== y) || (nameMatches === "never" && x === y); - } - - /** - * Reports - * @param {ASTNode} node The node to report - * @param {string} name The variable or property name - * @param {string} funcName The function name - * @param {boolean} isProp True if the reported node is a property assignment - * @returns {void} - */ - function report(node, name, funcName, isProp) { - let messageId; - - if (nameMatches === "always" && isProp) { - messageId = "matchProperty"; - } else if (nameMatches === "always") { - messageId = "matchVariable"; - } else if (isProp) { - messageId = "notMatchProperty"; - } else { - messageId = "notMatchVariable"; - } - context.report({ - node, - messageId, - data: { - name, - funcName - } - }); - } - - /** - * Determines whether a given node is a string literal - * @param {ASTNode} node The node to check - * @returns {boolean} `true` if the node is a string literal - */ - function isStringLiteral(node) { - return node.type === "Literal" && typeof node.value === "string"; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - VariableDeclarator(node) { - if (!node.init || node.init.type !== "FunctionExpression" || node.id.type !== "Identifier") { - return; - } - if (node.init.id && shouldWarn(node.id.name, node.init.id.name)) { - report(node, node.id.name, node.init.id.name, false); - } - }, - - AssignmentExpression(node) { - if ( - node.right.type !== "FunctionExpression" || - (node.left.computed && node.left.property.type !== "Literal") || - (!includeModuleExports && isModuleExports(node.left)) || - (node.left.type !== "Identifier" && node.left.type !== "MemberExpression") - ) { - return; - } - - const isProp = node.left.type === "MemberExpression"; - const name = isProp ? astUtils.getStaticPropertyName(node.left) : node.left.name; - - if (node.right.id && name && isIdentifier(name) && shouldWarn(name, node.right.id.name)) { - report(node, name, node.right.id.name, isProp); - } - }, - - "Property, PropertyDefinition[value]"(node) { - if (!(node.value.type === "FunctionExpression" && node.value.id)) { - return; - } - - if (node.key.type === "Identifier" && !node.computed) { - const functionName = node.value.id.name; - let propertyName = node.key.name; - - if ( - considerPropertyDescriptor && - propertyName === "value" && - node.parent.type === "ObjectExpression" - ) { - if (isPropertyCall("Object", "defineProperty", node.parent.parent) || isPropertyCall("Reflect", "defineProperty", node.parent.parent)) { - const property = node.parent.parent.arguments[1]; - - if (isStringLiteral(property) && shouldWarn(property.value, functionName)) { - report(node, property.value, functionName, true); - } - } else if (isPropertyCall("Object", "defineProperties", node.parent.parent.parent.parent)) { - propertyName = node.parent.parent.key.name; - if (!node.parent.parent.computed && shouldWarn(propertyName, functionName)) { - report(node, propertyName, functionName, true); - } - } else if (isPropertyCall("Object", "create", node.parent.parent.parent.parent)) { - propertyName = node.parent.parent.key.name; - if (!node.parent.parent.computed && shouldWarn(propertyName, functionName)) { - report(node, propertyName, functionName, true); - } - } else if (shouldWarn(propertyName, functionName)) { - report(node, propertyName, functionName, true); - } - } else if (shouldWarn(propertyName, functionName)) { - report(node, propertyName, functionName, true); - } - return; - } - - if ( - isStringLiteral(node.key) && - isIdentifier(node.key.value, ecmaVersion) && - shouldWarn(node.key.value, node.value.id.name) - ) { - report(node, node.key.value, node.value.id.name, true); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/func-names.js b/node_modules/eslint/lib/rules/func-names.js deleted file mode 100644 index b180580e1..000000000 --- a/node_modules/eslint/lib/rules/func-names.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * @fileoverview Rule to warn when a function expression does not have a name. - * @author Kyle T. Nunery - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -/** - * Checks whether or not a given variable is a function name. - * @param {eslint-scope.Variable} variable A variable to check. - * @returns {boolean} `true` if the variable is a function name. - */ -function isFunctionName(variable) { - return variable && variable.defs[0].type === "FunctionName"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require or disallow named `function` expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/func-names" - }, - - schema: { - definitions: { - value: { - enum: [ - "always", - "as-needed", - "never" - ] - } - }, - items: [ - { - $ref: "#/definitions/value" - }, - { - type: "object", - properties: { - generators: { - $ref: "#/definitions/value" - } - }, - additionalProperties: false - } - ] - }, - - messages: { - unnamed: "Unexpected unnamed {{name}}.", - named: "Unexpected named {{name}}." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Returns the config option for the given node. - * @param {ASTNode} node A node to get the config for. - * @returns {string} The config option. - */ - function getConfigForNode(node) { - if ( - node.generator && - context.options.length > 1 && - context.options[1].generators - ) { - return context.options[1].generators; - } - - return context.options[0] || "always"; - } - - /** - * Determines whether the current FunctionExpression node is a get, set, or - * shorthand method in an object literal or a class. - * @param {ASTNode} node A node to check. - * @returns {boolean} True if the node is a get, set, or shorthand method. - */ - function isObjectOrClassMethod(node) { - const parent = node.parent; - - return (parent.type === "MethodDefinition" || ( - parent.type === "Property" && ( - parent.method || - parent.kind === "get" || - parent.kind === "set" - ) - )); - } - - /** - * Determines whether the current FunctionExpression node has a name that would be - * inferred from context in a conforming ES6 environment. - * @param {ASTNode} node A node to check. - * @returns {boolean} True if the node would have a name assigned automatically. - */ - function hasInferredName(node) { - const parent = node.parent; - - return isObjectOrClassMethod(node) || - (parent.type === "VariableDeclarator" && parent.id.type === "Identifier" && parent.init === node) || - (parent.type === "Property" && parent.value === node) || - (parent.type === "PropertyDefinition" && parent.value === node) || - (parent.type === "AssignmentExpression" && parent.left.type === "Identifier" && parent.right === node) || - (parent.type === "AssignmentPattern" && parent.left.type === "Identifier" && parent.right === node); - } - - /** - * Reports that an unnamed function should be named - * @param {ASTNode} node The node to report in the event of an error. - * @returns {void} - */ - function reportUnexpectedUnnamedFunction(node) { - context.report({ - node, - messageId: "unnamed", - loc: astUtils.getFunctionHeadLoc(node, sourceCode), - data: { name: astUtils.getFunctionNameWithKind(node) } - }); - } - - /** - * Reports that a named function should be unnamed - * @param {ASTNode} node The node to report in the event of an error. - * @returns {void} - */ - function reportUnexpectedNamedFunction(node) { - context.report({ - node, - messageId: "named", - loc: astUtils.getFunctionHeadLoc(node, sourceCode), - data: { name: astUtils.getFunctionNameWithKind(node) } - }); - } - - /** - * The listener for function nodes. - * @param {ASTNode} node function node - * @returns {void} - */ - function handleFunction(node) { - - // Skip recursive functions. - const nameVar = sourceCode.getDeclaredVariables(node)[0]; - - if (isFunctionName(nameVar) && nameVar.references.length > 0) { - return; - } - - const hasName = Boolean(node.id && node.id.name); - const config = getConfigForNode(node); - - if (config === "never") { - if (hasName && node.type !== "FunctionDeclaration") { - reportUnexpectedNamedFunction(node); - } - } else if (config === "as-needed") { - if (!hasName && !hasInferredName(node)) { - reportUnexpectedUnnamedFunction(node); - } - } else { - if (!hasName && !isObjectOrClassMethod(node)) { - reportUnexpectedUnnamedFunction(node); - } - } - } - - return { - "FunctionExpression:exit": handleFunction, - "ExportDefaultDeclaration > FunctionDeclaration": handleFunction - }; - } -}; diff --git a/node_modules/eslint/lib/rules/func-style.js b/node_modules/eslint/lib/rules/func-style.js deleted file mode 100644 index ab83772ef..000000000 --- a/node_modules/eslint/lib/rules/func-style.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @fileoverview Rule to enforce a particular function style - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce the consistent use of either `function` declarations or expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/func-style" - }, - - schema: [ - { - enum: ["declaration", "expression"] - }, - { - type: "object", - properties: { - allowArrowFunctions: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - expression: "Expected a function expression.", - declaration: "Expected a function declaration." - } - }, - - create(context) { - - const style = context.options[0], - allowArrowFunctions = context.options[1] && context.options[1].allowArrowFunctions, - enforceDeclarations = (style === "declaration"), - stack = []; - - const nodesToCheck = { - FunctionDeclaration(node) { - stack.push(false); - - if (!enforceDeclarations && node.parent.type !== "ExportDefaultDeclaration") { - context.report({ node, messageId: "expression" }); - } - }, - "FunctionDeclaration:exit"() { - stack.pop(); - }, - - FunctionExpression(node) { - stack.push(false); - - if (enforceDeclarations && node.parent.type === "VariableDeclarator") { - context.report({ node: node.parent, messageId: "declaration" }); - } - }, - "FunctionExpression:exit"() { - stack.pop(); - }, - - ThisExpression() { - if (stack.length > 0) { - stack[stack.length - 1] = true; - } - } - }; - - if (!allowArrowFunctions) { - nodesToCheck.ArrowFunctionExpression = function() { - stack.push(false); - }; - - nodesToCheck["ArrowFunctionExpression:exit"] = function(node) { - const hasThisExpr = stack.pop(); - - if (enforceDeclarations && !hasThisExpr && node.parent.type === "VariableDeclarator") { - context.report({ node: node.parent, messageId: "declaration" }); - } - }; - } - - return nodesToCheck; - - } -}; diff --git a/node_modules/eslint/lib/rules/function-call-argument-newline.js b/node_modules/eslint/lib/rules/function-call-argument-newline.js deleted file mode 100644 index 4462afd0b..000000000 --- a/node_modules/eslint/lib/rules/function-call-argument-newline.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @fileoverview Rule to enforce line breaks between arguments of a function call - * @author Alexey Gonchar - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce line breaks between arguments of a function call", - recommended: false, - url: "https://eslint.org/docs/latest/rules/function-call-argument-newline" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never", "consistent"] - } - ], - - messages: { - unexpectedLineBreak: "There should be no line break here.", - missingLineBreak: "There should be a line break after this argument." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - const checkers = { - unexpected: { - messageId: "unexpectedLineBreak", - check: (prevToken, currentToken) => prevToken.loc.end.line !== currentToken.loc.start.line, - createFix: (token, tokenBefore) => fixer => - fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], " ") - }, - missing: { - messageId: "missingLineBreak", - check: (prevToken, currentToken) => prevToken.loc.end.line === currentToken.loc.start.line, - createFix: (token, tokenBefore) => fixer => - fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], "\n") - } - }; - - /** - * Check all arguments for line breaks in the CallExpression - * @param {CallExpression} node node to evaluate - * @param {{ messageId: string, check: Function }} checker selected checker - * @returns {void} - * @private - */ - function checkArguments(node, checker) { - for (let i = 1; i < node.arguments.length; i++) { - const prevArgToken = sourceCode.getLastToken(node.arguments[i - 1]); - const currentArgToken = sourceCode.getFirstToken(node.arguments[i]); - - if (checker.check(prevArgToken, currentArgToken)) { - const tokenBefore = sourceCode.getTokenBefore( - currentArgToken, - { includeComments: true } - ); - - const hasLineCommentBefore = tokenBefore.type === "Line"; - - context.report({ - node, - loc: { - start: tokenBefore.loc.end, - end: currentArgToken.loc.start - }, - messageId: checker.messageId, - fix: hasLineCommentBefore ? null : checker.createFix(currentArgToken, tokenBefore) - }); - } - } - } - - /** - * Check if open space is present in a function name - * @param {CallExpression} node node to evaluate - * @returns {void} - * @private - */ - function check(node) { - if (node.arguments.length < 2) { - return; - } - - const option = context.options[0] || "always"; - - if (option === "never") { - checkArguments(node, checkers.unexpected); - } else if (option === "always") { - checkArguments(node, checkers.missing); - } else if (option === "consistent") { - const firstArgToken = sourceCode.getLastToken(node.arguments[0]); - const secondArgToken = sourceCode.getFirstToken(node.arguments[1]); - - if (firstArgToken.loc.end.line === secondArgToken.loc.start.line) { - checkArguments(node, checkers.unexpected); - } else { - checkArguments(node, checkers.missing); - } - } - } - - return { - CallExpression: check, - NewExpression: check - }; - } -}; diff --git a/node_modules/eslint/lib/rules/function-paren-newline.js b/node_modules/eslint/lib/rules/function-paren-newline.js deleted file mode 100644 index 8a8714ac9..000000000 --- a/node_modules/eslint/lib/rules/function-paren-newline.js +++ /dev/null @@ -1,289 +0,0 @@ -/** - * @fileoverview enforce consistent line breaks inside function parentheses - * @author Teddy Katz - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent line breaks inside function parentheses", - recommended: false, - url: "https://eslint.org/docs/latest/rules/function-paren-newline" - }, - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - { - enum: ["always", "never", "consistent", "multiline", "multiline-arguments"] - }, - { - type: "object", - properties: { - minItems: { - type: "integer", - minimum: 0 - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - expectedBefore: "Expected newline before ')'.", - expectedAfter: "Expected newline after '('.", - expectedBetween: "Expected newline between arguments/params.", - unexpectedBefore: "Unexpected newline before ')'.", - unexpectedAfter: "Unexpected newline after '('." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const rawOption = context.options[0] || "multiline"; - const multilineOption = rawOption === "multiline"; - const multilineArgumentsOption = rawOption === "multiline-arguments"; - const consistentOption = rawOption === "consistent"; - let minItems; - - if (typeof rawOption === "object") { - minItems = rawOption.minItems; - } else if (rawOption === "always") { - minItems = 0; - } else if (rawOption === "never") { - minItems = Infinity; - } else { - minItems = null; - } - - //---------------------------------------------------------------------- - // Helpers - //---------------------------------------------------------------------- - - /** - * Determines whether there should be newlines inside function parens - * @param {ASTNode[]} elements The arguments or parameters in the list - * @param {boolean} hasLeftNewline `true` if the left paren has a newline in the current code. - * @returns {boolean} `true` if there should be newlines inside the function parens - */ - function shouldHaveNewlines(elements, hasLeftNewline) { - if (multilineArgumentsOption && elements.length === 1) { - return hasLeftNewline; - } - if (multilineOption || multilineArgumentsOption) { - return elements.some((element, index) => index !== elements.length - 1 && element.loc.end.line !== elements[index + 1].loc.start.line); - } - if (consistentOption) { - return hasLeftNewline; - } - return elements.length >= minItems; - } - - /** - * Validates parens - * @param {Object} parens An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token - * @param {ASTNode[]} elements The arguments or parameters in the list - * @returns {void} - */ - function validateParens(parens, elements) { - const leftParen = parens.leftParen; - const rightParen = parens.rightParen; - const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParen); - const tokenBeforeRightParen = sourceCode.getTokenBefore(rightParen); - const hasLeftNewline = !astUtils.isTokenOnSameLine(leftParen, tokenAfterLeftParen); - const hasRightNewline = !astUtils.isTokenOnSameLine(tokenBeforeRightParen, rightParen); - const needsNewlines = shouldHaveNewlines(elements, hasLeftNewline); - - if (hasLeftNewline && !needsNewlines) { - context.report({ - node: leftParen, - messageId: "unexpectedAfter", - fix(fixer) { - return sourceCode.getText().slice(leftParen.range[1], tokenAfterLeftParen.range[0]).trim() - - // If there is a comment between the ( and the first element, don't do a fix. - ? null - : fixer.removeRange([leftParen.range[1], tokenAfterLeftParen.range[0]]); - } - }); - } else if (!hasLeftNewline && needsNewlines) { - context.report({ - node: leftParen, - messageId: "expectedAfter", - fix: fixer => fixer.insertTextAfter(leftParen, "\n") - }); - } - - if (hasRightNewline && !needsNewlines) { - context.report({ - node: rightParen, - messageId: "unexpectedBefore", - fix(fixer) { - return sourceCode.getText().slice(tokenBeforeRightParen.range[1], rightParen.range[0]).trim() - - // If there is a comment between the last element and the ), don't do a fix. - ? null - : fixer.removeRange([tokenBeforeRightParen.range[1], rightParen.range[0]]); - } - }); - } else if (!hasRightNewline && needsNewlines) { - context.report({ - node: rightParen, - messageId: "expectedBefore", - fix: fixer => fixer.insertTextBefore(rightParen, "\n") - }); - } - } - - /** - * Validates a list of arguments or parameters - * @param {Object} parens An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token - * @param {ASTNode[]} elements The arguments or parameters in the list - * @returns {void} - */ - function validateArguments(parens, elements) { - const leftParen = parens.leftParen; - const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParen); - const hasLeftNewline = !astUtils.isTokenOnSameLine(leftParen, tokenAfterLeftParen); - const needsNewlines = shouldHaveNewlines(elements, hasLeftNewline); - - for (let i = 0; i <= elements.length - 2; i++) { - const currentElement = elements[i]; - const nextElement = elements[i + 1]; - const hasNewLine = currentElement.loc.end.line !== nextElement.loc.start.line; - - if (!hasNewLine && needsNewlines) { - context.report({ - node: currentElement, - messageId: "expectedBetween", - fix: fixer => fixer.insertTextBefore(nextElement, "\n") - }); - } - } - } - - /** - * Gets the left paren and right paren tokens of a node. - * @param {ASTNode} node The node with parens - * @throws {TypeError} Unexpected node type. - * @returns {Object} An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token. - * Can also return `null` if an expression has no parens (e.g. a NewExpression with no arguments, or an ArrowFunctionExpression - * with a single parameter) - */ - function getParenTokens(node) { - switch (node.type) { - case "NewExpression": - if (!node.arguments.length && - !( - astUtils.isOpeningParenToken(sourceCode.getLastToken(node, { skip: 1 })) && - astUtils.isClosingParenToken(sourceCode.getLastToken(node)) && - node.callee.range[1] < node.range[1] - ) - ) { - - // If the NewExpression does not have parens (e.g. `new Foo`), return null. - return null; - } - - // falls through - - case "CallExpression": - return { - leftParen: sourceCode.getTokenAfter(node.callee, astUtils.isOpeningParenToken), - rightParen: sourceCode.getLastToken(node) - }; - - case "FunctionDeclaration": - case "FunctionExpression": { - const leftParen = sourceCode.getFirstToken(node, astUtils.isOpeningParenToken); - const rightParen = node.params.length - ? sourceCode.getTokenAfter(node.params[node.params.length - 1], astUtils.isClosingParenToken) - : sourceCode.getTokenAfter(leftParen); - - return { leftParen, rightParen }; - } - - case "ArrowFunctionExpression": { - const firstToken = sourceCode.getFirstToken(node, { skip: (node.async ? 1 : 0) }); - - if (!astUtils.isOpeningParenToken(firstToken)) { - - // If the ArrowFunctionExpression has a single param without parens, return null. - return null; - } - - const rightParen = node.params.length - ? sourceCode.getTokenAfter(node.params[node.params.length - 1], astUtils.isClosingParenToken) - : sourceCode.getTokenAfter(firstToken); - - return { - leftParen: firstToken, - rightParen - }; - } - - case "ImportExpression": { - const leftParen = sourceCode.getFirstToken(node, 1); - const rightParen = sourceCode.getLastToken(node); - - return { leftParen, rightParen }; - } - - default: - throw new TypeError(`unexpected node with type ${node.type}`); - } - } - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - [[ - "ArrowFunctionExpression", - "CallExpression", - "FunctionDeclaration", - "FunctionExpression", - "ImportExpression", - "NewExpression" - ]](node) { - const parens = getParenTokens(node); - let params; - - if (node.type === "ImportExpression") { - params = [node.source]; - } else if (astUtils.isFunction(node)) { - params = node.params; - } else { - params = node.arguments; - } - - if (parens) { - validateParens(parens, params); - - if (multilineArgumentsOption) { - validateArguments(parens, params); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/generator-star-spacing.js b/node_modules/eslint/lib/rules/generator-star-spacing.js deleted file mode 100644 index 81c0b6105..000000000 --- a/node_modules/eslint/lib/rules/generator-star-spacing.js +++ /dev/null @@ -1,206 +0,0 @@ -/** - * @fileoverview Rule to check the spacing around the * in generator functions. - * @author Jamund Ferguson - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const OVERRIDE_SCHEMA = { - oneOf: [ - { - enum: ["before", "after", "both", "neither"] - }, - { - type: "object", - properties: { - before: { type: "boolean" }, - after: { type: "boolean" } - }, - additionalProperties: false - } - ] -}; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing around `*` operators in generator functions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/generator-star-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - { - enum: ["before", "after", "both", "neither"] - }, - { - type: "object", - properties: { - before: { type: "boolean" }, - after: { type: "boolean" }, - named: OVERRIDE_SCHEMA, - anonymous: OVERRIDE_SCHEMA, - method: OVERRIDE_SCHEMA - }, - additionalProperties: false - } - ] - } - ], - - messages: { - missingBefore: "Missing space before *.", - missingAfter: "Missing space after *.", - unexpectedBefore: "Unexpected space before *.", - unexpectedAfter: "Unexpected space after *." - } - }, - - create(context) { - - const optionDefinitions = { - before: { before: true, after: false }, - after: { before: false, after: true }, - both: { before: true, after: true }, - neither: { before: false, after: false } - }; - - /** - * Returns resolved option definitions based on an option and defaults - * @param {any} option The option object or string value - * @param {Object} defaults The defaults to use if options are not present - * @returns {Object} the resolved object definition - */ - function optionToDefinition(option, defaults) { - if (!option) { - return defaults; - } - - return typeof option === "string" - ? optionDefinitions[option] - : Object.assign({}, defaults, option); - } - - const modes = (function(option) { - const defaults = optionToDefinition(option, optionDefinitions.before); - - return { - named: optionToDefinition(option.named, defaults), - anonymous: optionToDefinition(option.anonymous, defaults), - method: optionToDefinition(option.method, defaults) - }; - }(context.options[0] || {})); - - const sourceCode = context.sourceCode; - - /** - * Checks if the given token is a star token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a star token. - */ - function isStarToken(token) { - return token.value === "*" && token.type === "Punctuator"; - } - - /** - * Gets the generator star token of the given function node. - * @param {ASTNode} node The function node to get. - * @returns {Token} Found star token. - */ - function getStarToken(node) { - return sourceCode.getFirstToken( - (node.parent.method || node.parent.type === "MethodDefinition") ? node.parent : node, - isStarToken - ); - } - - /** - * capitalize a given string. - * @param {string} str the given string. - * @returns {string} the capitalized string. - */ - function capitalize(str) { - return str[0].toUpperCase() + str.slice(1); - } - - /** - * Checks the spacing between two tokens before or after the star token. - * @param {string} kind Either "named", "anonymous", or "method" - * @param {string} side Either "before" or "after". - * @param {Token} leftToken `function` keyword token if side is "before", or - * star token if side is "after". - * @param {Token} rightToken Star token if side is "before", or identifier - * token if side is "after". - * @returns {void} - */ - function checkSpacing(kind, side, leftToken, rightToken) { - if (!!(rightToken.range[0] - leftToken.range[1]) !== modes[kind][side]) { - const after = leftToken.value === "*"; - const spaceRequired = modes[kind][side]; - const node = after ? leftToken : rightToken; - const messageId = `${spaceRequired ? "missing" : "unexpected"}${capitalize(side)}`; - - context.report({ - node, - messageId, - fix(fixer) { - if (spaceRequired) { - if (after) { - return fixer.insertTextAfter(node, " "); - } - return fixer.insertTextBefore(node, " "); - } - return fixer.removeRange([leftToken.range[1], rightToken.range[0]]); - } - }); - } - } - - /** - * Enforces the spacing around the star if node is a generator function. - * @param {ASTNode} node A function expression or declaration node. - * @returns {void} - */ - function checkFunction(node) { - if (!node.generator) { - return; - } - - const starToken = getStarToken(node); - const prevToken = sourceCode.getTokenBefore(starToken); - const nextToken = sourceCode.getTokenAfter(starToken); - - let kind = "named"; - - if (node.parent.type === "MethodDefinition" || (node.parent.type === "Property" && node.parent.method)) { - kind = "method"; - } else if (!node.id) { - kind = "anonymous"; - } - - // Only check before when preceded by `function`|`static` keyword - if (!(kind === "method" && starToken === sourceCode.getFirstToken(node.parent))) { - checkSpacing(kind, "before", prevToken, starToken); - } - - checkSpacing(kind, "after", starToken, nextToken); - } - - return { - FunctionDeclaration: checkFunction, - FunctionExpression: checkFunction - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/getter-return.js b/node_modules/eslint/lib/rules/getter-return.js deleted file mode 100644 index 622b6a754..000000000 --- a/node_modules/eslint/lib/rules/getter-return.js +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @fileoverview Enforces that a return statement is present in property getters. - * @author Aladdin-ADD(hh_2013@foxmail.com) - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ -const TARGET_NODE_TYPE = /^(?:Arrow)?FunctionExpression$/u; - -/** - * Checks a given code path segment is reachable. - * @param {CodePathSegment} segment A segment to check. - * @returns {boolean} `true` if the segment is reachable. - */ -function isReachable(segment) { - return segment.reachable; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Enforce `return` statements in getters", - recommended: true, - url: "https://eslint.org/docs/latest/rules/getter-return" - }, - - fixable: null, - - schema: [ - { - type: "object", - properties: { - allowImplicit: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - expected: "Expected to return a value in {{name}}.", - expectedAlways: "Expected {{name}} to always return a value." - } - }, - - create(context) { - - const options = context.options[0] || { allowImplicit: false }; - const sourceCode = context.sourceCode; - - let funcInfo = { - upper: null, - codePath: null, - hasReturn: false, - shouldCheck: false, - node: null - }; - - /** - * Checks whether or not the last code path segment is reachable. - * Then reports this function if the segment is reachable. - * - * If the last code path segment is reachable, there are paths which are not - * returned or thrown. - * @param {ASTNode} node A node to check. - * @returns {void} - */ - function checkLastSegment(node) { - if (funcInfo.shouldCheck && - funcInfo.codePath.currentSegments.some(isReachable) - ) { - context.report({ - node, - loc: astUtils.getFunctionHeadLoc(node, sourceCode), - messageId: funcInfo.hasReturn ? "expectedAlways" : "expected", - data: { - name: astUtils.getFunctionNameWithKind(funcInfo.node) - } - }); - } - } - - /** - * Checks whether a node means a getter function. - * @param {ASTNode} node a node to check. - * @returns {boolean} if node means a getter, return true; else return false. - */ - function isGetter(node) { - const parent = node.parent; - - if (TARGET_NODE_TYPE.test(node.type) && node.body.type === "BlockStatement") { - if (parent.kind === "get") { - return true; - } - if (parent.type === "Property" && astUtils.getStaticPropertyName(parent) === "get" && parent.parent.type === "ObjectExpression") { - - // Object.defineProperty() or Reflect.defineProperty() - if (parent.parent.parent.type === "CallExpression") { - const callNode = parent.parent.parent.callee; - - if (astUtils.isSpecificMemberAccess(callNode, "Object", "defineProperty") || - astUtils.isSpecificMemberAccess(callNode, "Reflect", "defineProperty")) { - return true; - } - } - - // Object.defineProperties() or Object.create() - if (parent.parent.parent.type === "Property" && - parent.parent.parent.parent.type === "ObjectExpression" && - parent.parent.parent.parent.parent.type === "CallExpression") { - const callNode = parent.parent.parent.parent.parent.callee; - - return astUtils.isSpecificMemberAccess(callNode, "Object", "defineProperties") || - astUtils.isSpecificMemberAccess(callNode, "Object", "create"); - } - } - } - return false; - } - return { - - // Stacks this function's information. - onCodePathStart(codePath, node) { - funcInfo = { - upper: funcInfo, - codePath, - hasReturn: false, - shouldCheck: isGetter(node), - node - }; - }, - - // Pops this function's information. - onCodePathEnd() { - funcInfo = funcInfo.upper; - }, - - // Checks the return statement is valid. - ReturnStatement(node) { - if (funcInfo.shouldCheck) { - funcInfo.hasReturn = true; - - // if allowImplicit: false, should also check node.argument - if (!options.allowImplicit && !node.argument) { - context.report({ - node, - messageId: "expected", - data: { - name: astUtils.getFunctionNameWithKind(funcInfo.node) - } - }); - } - } - }, - - // Reports a given function if the last path is reachable. - "FunctionExpression:exit": checkLastSegment, - "ArrowFunctionExpression:exit": checkLastSegment - }; - } -}; diff --git a/node_modules/eslint/lib/rules/global-require.js b/node_modules/eslint/lib/rules/global-require.js deleted file mode 100644 index deae9d267..000000000 --- a/node_modules/eslint/lib/rules/global-require.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @fileoverview Rule for disallowing require() outside of the top-level module context - * @author Jamund Ferguson - * @deprecated in ESLint v7.0.0 - */ - -"use strict"; - -const ACCEPTABLE_PARENTS = new Set([ - "AssignmentExpression", - "VariableDeclarator", - "MemberExpression", - "ExpressionStatement", - "CallExpression", - "ConditionalExpression", - "Program", - "VariableDeclaration", - "ChainExpression" -]); - -/** - * Finds the eslint-scope reference in the given scope. - * @param {Object} scope The scope to search. - * @param {ASTNode} node The identifier node. - * @returns {Reference|null} Returns the found reference or null if none were found. - */ -function findReference(scope, node) { - const references = scope.references.filter(reference => reference.identifier.range[0] === node.range[0] && - reference.identifier.range[1] === node.range[1]); - - if (references.length === 1) { - return references[0]; - } - - /* c8 ignore next */ - return null; - -} - -/** - * Checks if the given identifier node is shadowed in the given scope. - * @param {Object} scope The current scope. - * @param {ASTNode} node The identifier node to check. - * @returns {boolean} Whether or not the name is shadowed. - */ -function isShadowed(scope, node) { - const reference = findReference(scope, node); - - return reference && reference.resolved && reference.resolved.defs.length > 0; -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Require `require()` calls to be placed at top-level module scope", - recommended: false, - url: "https://eslint.org/docs/latest/rules/global-require" - }, - - schema: [], - messages: { - unexpected: "Unexpected require()." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - CallExpression(node) { - const currentScope = sourceCode.getScope(node); - - if (node.callee.name === "require" && !isShadowed(currentScope, node.callee)) { - const isGoodRequire = sourceCode.getAncestors(node).every(parent => ACCEPTABLE_PARENTS.has(parent.type)); - - if (!isGoodRequire) { - context.report({ node, messageId: "unexpected" }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/grouped-accessor-pairs.js b/node_modules/eslint/lib/rules/grouped-accessor-pairs.js deleted file mode 100644 index c08e1c497..000000000 --- a/node_modules/eslint/lib/rules/grouped-accessor-pairs.js +++ /dev/null @@ -1,224 +0,0 @@ -/** - * @fileoverview Rule to require grouped accessor pairs in object literals and classes - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** - * Property name if it can be computed statically, otherwise the list of the tokens of the key node. - * @typedef {string|Token[]} Key - */ - -/** - * Accessor nodes with the same key. - * @typedef {Object} AccessorData - * @property {Key} key Accessor's key - * @property {ASTNode[]} getters List of getter nodes. - * @property {ASTNode[]} setters List of setter nodes. - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not the given lists represent the equal tokens in the same order. - * Tokens are compared by their properties, not by instance. - * @param {Token[]} left First list of tokens. - * @param {Token[]} right Second list of tokens. - * @returns {boolean} `true` if the lists have same tokens. - */ -function areEqualTokenLists(left, right) { - if (left.length !== right.length) { - return false; - } - - for (let i = 0; i < left.length; i++) { - const leftToken = left[i], - rightToken = right[i]; - - if (leftToken.type !== rightToken.type || leftToken.value !== rightToken.value) { - return false; - } - } - - return true; -} - -/** - * Checks whether or not the given keys are equal. - * @param {Key} left First key. - * @param {Key} right Second key. - * @returns {boolean} `true` if the keys are equal. - */ -function areEqualKeys(left, right) { - if (typeof left === "string" && typeof right === "string") { - - // Statically computed names. - return left === right; - } - if (Array.isArray(left) && Array.isArray(right)) { - - // Token lists. - return areEqualTokenLists(left, right); - } - - return false; -} - -/** - * Checks whether or not a given node is of an accessor kind ('get' or 'set'). - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is of an accessor kind. - */ -function isAccessorKind(node) { - return node.kind === "get" || node.kind === "set"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require grouped accessor pairs in object literals and classes", - recommended: false, - url: "https://eslint.org/docs/latest/rules/grouped-accessor-pairs" - }, - - schema: [ - { - enum: ["anyOrder", "getBeforeSet", "setBeforeGet"] - } - ], - - messages: { - notGrouped: "Accessor pair {{ formerName }} and {{ latterName }} should be grouped.", - invalidOrder: "Expected {{ latterName }} to be before {{ formerName }}." - } - }, - - create(context) { - const order = context.options[0] || "anyOrder"; - const sourceCode = context.sourceCode; - - /** - * Reports the given accessor pair. - * @param {string} messageId messageId to report. - * @param {ASTNode} formerNode getter/setter node that is defined before `latterNode`. - * @param {ASTNode} latterNode getter/setter node that is defined after `formerNode`. - * @returns {void} - * @private - */ - function report(messageId, formerNode, latterNode) { - context.report({ - node: latterNode, - messageId, - loc: astUtils.getFunctionHeadLoc(latterNode.value, sourceCode), - data: { - formerName: astUtils.getFunctionNameWithKind(formerNode.value), - latterName: astUtils.getFunctionNameWithKind(latterNode.value) - } - }); - } - - /** - * Creates a new `AccessorData` object for the given getter or setter node. - * @param {ASTNode} node A getter or setter node. - * @returns {AccessorData} New `AccessorData` object that contains the given node. - * @private - */ - function createAccessorData(node) { - const name = astUtils.getStaticPropertyName(node); - const key = (name !== null) ? name : sourceCode.getTokens(node.key); - - return { - key, - getters: node.kind === "get" ? [node] : [], - setters: node.kind === "set" ? [node] : [] - }; - } - - /** - * Merges the given `AccessorData` object into the given accessors list. - * @param {AccessorData[]} accessors The list to merge into. - * @param {AccessorData} accessorData The object to merge. - * @returns {AccessorData[]} The same instance with the merged object. - * @private - */ - function mergeAccessorData(accessors, accessorData) { - const equalKeyElement = accessors.find(a => areEqualKeys(a.key, accessorData.key)); - - if (equalKeyElement) { - equalKeyElement.getters.push(...accessorData.getters); - equalKeyElement.setters.push(...accessorData.setters); - } else { - accessors.push(accessorData); - } - - return accessors; - } - - /** - * Checks accessor pairs in the given list of nodes. - * @param {ASTNode[]} nodes The list to check. - * @param {Function} shouldCheck – Predicate that returns `true` if the node should be checked. - * @returns {void} - * @private - */ - function checkList(nodes, shouldCheck) { - const accessors = nodes - .filter(shouldCheck) - .filter(isAccessorKind) - .map(createAccessorData) - .reduce(mergeAccessorData, []); - - for (const { getters, setters } of accessors) { - - // Don't report accessor properties that have duplicate getters or setters. - if (getters.length === 1 && setters.length === 1) { - const [getter] = getters, - [setter] = setters, - getterIndex = nodes.indexOf(getter), - setterIndex = nodes.indexOf(setter), - formerNode = getterIndex < setterIndex ? getter : setter, - latterNode = getterIndex < setterIndex ? setter : getter; - - if (Math.abs(getterIndex - setterIndex) > 1) { - report("notGrouped", formerNode, latterNode); - } else if ( - (order === "getBeforeSet" && getterIndex > setterIndex) || - (order === "setBeforeGet" && getterIndex < setterIndex) - ) { - report("invalidOrder", formerNode, latterNode); - } - } - } - } - - return { - ObjectExpression(node) { - checkList(node.properties, n => n.type === "Property"); - }, - ClassBody(node) { - checkList(node.body, n => n.type === "MethodDefinition" && !n.static); - checkList(node.body, n => n.type === "MethodDefinition" && n.static); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/guard-for-in.js b/node_modules/eslint/lib/rules/guard-for-in.js deleted file mode 100644 index d6e70d0d7..000000000 --- a/node_modules/eslint/lib/rules/guard-for-in.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @fileoverview Rule to flag for-in loops without if statements inside - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require `for-in` loops to include an `if` statement", - recommended: false, - url: "https://eslint.org/docs/latest/rules/guard-for-in" - }, - - schema: [], - messages: { - wrap: "The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype." - } - }, - - create(context) { - - return { - - ForInStatement(node) { - const body = node.body; - - // empty statement - if (body.type === "EmptyStatement") { - return; - } - - // if statement - if (body.type === "IfStatement") { - return; - } - - // empty block - if (body.type === "BlockStatement" && body.body.length === 0) { - return; - } - - // block with just if statement - if (body.type === "BlockStatement" && body.body.length === 1 && body.body[0].type === "IfStatement") { - return; - } - - // block that starts with if statement - if (body.type === "BlockStatement" && body.body.length >= 1 && body.body[0].type === "IfStatement") { - const i = body.body[0]; - - // ... whose consequent is a continue - if (i.consequent.type === "ContinueStatement") { - return; - } - - // ... whose consequent is a block that contains only a continue - if (i.consequent.type === "BlockStatement" && i.consequent.body.length === 1 && i.consequent.body[0].type === "ContinueStatement") { - return; - } - } - - context.report({ node, messageId: "wrap" }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/handle-callback-err.js b/node_modules/eslint/lib/rules/handle-callback-err.js deleted file mode 100644 index ad84931a9..000000000 --- a/node_modules/eslint/lib/rules/handle-callback-err.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @fileoverview Ensure handling of errors when we know they exist. - * @author Jamund Ferguson - * @deprecated in ESLint v7.0.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Require error handling in callbacks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/handle-callback-err" - }, - - schema: [ - { - type: "string" - } - ], - messages: { - expected: "Expected error to be handled." - } - }, - - create(context) { - - const errorArgument = context.options[0] || "err"; - const sourceCode = context.sourceCode; - - /** - * Checks if the given argument should be interpreted as a regexp pattern. - * @param {string} stringToCheck The string which should be checked. - * @returns {boolean} Whether or not the string should be interpreted as a pattern. - */ - function isPattern(stringToCheck) { - const firstChar = stringToCheck[0]; - - return firstChar === "^"; - } - - /** - * Checks if the given name matches the configured error argument. - * @param {string} name The name which should be compared. - * @returns {boolean} Whether or not the given name matches the configured error variable name. - */ - function matchesConfiguredErrorName(name) { - if (isPattern(errorArgument)) { - const regexp = new RegExp(errorArgument, "u"); - - return regexp.test(name); - } - return name === errorArgument; - } - - /** - * Get the parameters of a given function scope. - * @param {Object} scope The function scope. - * @returns {Array} All parameters of the given scope. - */ - function getParameters(scope) { - return scope.variables.filter(variable => variable.defs[0] && variable.defs[0].type === "Parameter"); - } - - /** - * Check to see if we're handling the error object properly. - * @param {ASTNode} node The AST node to check. - * @returns {void} - */ - function checkForError(node) { - const scope = sourceCode.getScope(node), - parameters = getParameters(scope), - firstParameter = parameters[0]; - - if (firstParameter && matchesConfiguredErrorName(firstParameter.name)) { - if (firstParameter.references.length === 0) { - context.report({ node, messageId: "expected" }); - } - } - } - - return { - FunctionDeclaration: checkForError, - FunctionExpression: checkForError, - ArrowFunctionExpression: checkForError - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/id-blacklist.js b/node_modules/eslint/lib/rules/id-blacklist.js deleted file mode 100644 index 6b7f561ee..000000000 --- a/node_modules/eslint/lib/rules/id-blacklist.js +++ /dev/null @@ -1,246 +0,0 @@ -/** - * @fileoverview Rule that warns when identifier names that are - * specified in the configuration are used. - * @author Keith Cirkel (http://keithcirkel.co.uk) - * @deprecated in ESLint v7.5.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether the given node represents assignment target in a normal assignment or destructuring. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is assignment target. - */ -function isAssignmentTarget(node) { - const parent = node.parent; - - return ( - - // normal assignment - ( - parent.type === "AssignmentExpression" && - parent.left === node - ) || - - // destructuring - parent.type === "ArrayPattern" || - parent.type === "RestElement" || - ( - parent.type === "Property" && - parent.value === node && - parent.parent.type === "ObjectPattern" - ) || - ( - parent.type === "AssignmentPattern" && - parent.left === node - ) - ); -} - -/** - * Checks whether the given node represents an imported name that is renamed in the same import/export specifier. - * - * Examples: - * import { a as b } from 'mod'; // node `a` is renamed import - * export { a as b } from 'mod'; // node `a` is renamed import - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a renamed import. - */ -function isRenamedImport(node) { - const parent = node.parent; - - return ( - ( - parent.type === "ImportSpecifier" && - parent.imported !== parent.local && - parent.imported === node - ) || - ( - parent.type === "ExportSpecifier" && - parent.parent.source && // re-export - parent.local !== parent.exported && - parent.local === node - ) - ); -} - -/** - * Checks whether the given node is a renamed identifier node in an ObjectPattern destructuring. - * - * Examples: - * const { a : b } = foo; // node `a` is renamed node. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a renamed node in an ObjectPattern destructuring. - */ -function isRenamedInDestructuring(node) { - const parent = node.parent; - - return ( - ( - !parent.computed && - parent.type === "Property" && - parent.parent.type === "ObjectPattern" && - parent.value !== node && - parent.key === node - ) - ); -} - -/** - * Checks whether the given node represents shorthand definition of a property in an object literal. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a shorthand property definition. - */ -function isShorthandPropertyDefinition(node) { - const parent = node.parent; - - return ( - parent.type === "Property" && - parent.parent.type === "ObjectExpression" && - parent.shorthand - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: ["id-denylist"], - - type: "suggestion", - - docs: { - description: "Disallow specified identifiers", - recommended: false, - url: "https://eslint.org/docs/latest/rules/id-blacklist" - }, - - schema: { - type: "array", - items: { - type: "string" - }, - uniqueItems: true - }, - messages: { - restricted: "Identifier '{{name}}' is restricted." - } - }, - - create(context) { - - const denyList = new Set(context.options); - const reportedNodes = new Set(); - const sourceCode = context.sourceCode; - - let globalScope; - - /** - * Checks whether the given name is restricted. - * @param {string} name The name to check. - * @returns {boolean} `true` if the name is restricted. - * @private - */ - function isRestricted(name) { - return denyList.has(name); - } - - /** - * Checks whether the given node represents a reference to a global variable that is not declared in the source code. - * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a reference to a global variable. - */ - function isReferenceToGlobalVariable(node) { - const variable = globalScope.set.get(node.name); - - return variable && variable.defs.length === 0 && - variable.references.some(ref => ref.identifier === node); - } - - /** - * Determines whether the given node should be checked. - * @param {ASTNode} node `Identifier` node. - * @returns {boolean} `true` if the node should be checked. - */ - function shouldCheck(node) { - const parent = node.parent; - - /* - * Member access has special rules for checking property names. - * Read access to a property with a restricted name is allowed, because it can be on an object that user has no control over. - * Write access isn't allowed, because it potentially creates a new property with a restricted name. - */ - if ( - parent.type === "MemberExpression" && - parent.property === node && - !parent.computed - ) { - return isAssignmentTarget(parent); - } - - return ( - parent.type !== "CallExpression" && - parent.type !== "NewExpression" && - !isRenamedImport(node) && - !isRenamedInDestructuring(node) && - !( - isReferenceToGlobalVariable(node) && - !isShorthandPropertyDefinition(node) - ) - ); - } - - /** - * Reports an AST node as a rule violation. - * @param {ASTNode} node The node to report. - * @returns {void} - * @private - */ - function report(node) { - - /* - * We used the range instead of the node because it's possible - * for the same identifier to be represented by two different - * nodes, with the most clear example being shorthand properties: - * { foo } - * In this case, "foo" is represented by one node for the name - * and one for the value. The only way to know they are the same - * is to look at the range. - */ - if (!reportedNodes.has(node.range.toString())) { - context.report({ - node, - messageId: "restricted", - data: { - name: node.name - } - }); - reportedNodes.add(node.range.toString()); - } - - } - - return { - - Program(node) { - globalScope = sourceCode.getScope(node); - }, - - Identifier(node) { - if (isRestricted(node.name) && shouldCheck(node)) { - report(node); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/id-denylist.js b/node_modules/eslint/lib/rules/id-denylist.js deleted file mode 100644 index baaa65fe0..000000000 --- a/node_modules/eslint/lib/rules/id-denylist.js +++ /dev/null @@ -1,228 +0,0 @@ -/** - * @fileoverview Rule that warns when identifier names that are - * specified in the configuration are used. - * @author Keith Cirkel (http://keithcirkel.co.uk) - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether the given node represents assignment target in a normal assignment or destructuring. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is assignment target. - */ -function isAssignmentTarget(node) { - const parent = node.parent; - - return ( - - // normal assignment - ( - parent.type === "AssignmentExpression" && - parent.left === node - ) || - - // destructuring - parent.type === "ArrayPattern" || - parent.type === "RestElement" || - ( - parent.type === "Property" && - parent.value === node && - parent.parent.type === "ObjectPattern" - ) || - ( - parent.type === "AssignmentPattern" && - parent.left === node - ) - ); -} - -/** - * Checks whether the given node represents an imported name that is renamed in the same import/export specifier. - * - * Examples: - * import { a as b } from 'mod'; // node `a` is renamed import - * export { a as b } from 'mod'; // node `a` is renamed import - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a renamed import. - */ -function isRenamedImport(node) { - const parent = node.parent; - - return ( - ( - parent.type === "ImportSpecifier" && - parent.imported !== parent.local && - parent.imported === node - ) || - ( - parent.type === "ExportSpecifier" && - parent.parent.source && // re-export - parent.local !== parent.exported && - parent.local === node - ) - ); -} - -/** - * Checks whether the given node is an ObjectPattern destructuring. - * - * Examples: - * const { a : b } = foo; - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is in an ObjectPattern destructuring. - */ -function isPropertyNameInDestructuring(node) { - const parent = node.parent; - - return ( - ( - !parent.computed && - parent.type === "Property" && - parent.parent.type === "ObjectPattern" && - parent.key === node - ) - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow specified identifiers", - recommended: false, - url: "https://eslint.org/docs/latest/rules/id-denylist" - }, - - schema: { - type: "array", - items: { - type: "string" - }, - uniqueItems: true - }, - messages: { - restricted: "Identifier '{{name}}' is restricted.", - restrictedPrivate: "Identifier '#{{name}}' is restricted." - } - }, - - create(context) { - - const denyList = new Set(context.options); - const reportedNodes = new Set(); - const sourceCode = context.sourceCode; - - let globalScope; - - /** - * Checks whether the given name is restricted. - * @param {string} name The name to check. - * @returns {boolean} `true` if the name is restricted. - * @private - */ - function isRestricted(name) { - return denyList.has(name); - } - - /** - * Checks whether the given node represents a reference to a global variable that is not declared in the source code. - * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a reference to a global variable. - */ - function isReferenceToGlobalVariable(node) { - const variable = globalScope.set.get(node.name); - - return variable && variable.defs.length === 0 && - variable.references.some(ref => ref.identifier === node); - } - - /** - * Determines whether the given node should be checked. - * @param {ASTNode} node `Identifier` node. - * @returns {boolean} `true` if the node should be checked. - */ - function shouldCheck(node) { - const parent = node.parent; - - /* - * Member access has special rules for checking property names. - * Read access to a property with a restricted name is allowed, because it can be on an object that user has no control over. - * Write access isn't allowed, because it potentially creates a new property with a restricted name. - */ - if ( - parent.type === "MemberExpression" && - parent.property === node && - !parent.computed - ) { - return isAssignmentTarget(parent); - } - - return ( - parent.type !== "CallExpression" && - parent.type !== "NewExpression" && - !isRenamedImport(node) && - !isPropertyNameInDestructuring(node) && - !isReferenceToGlobalVariable(node) - ); - } - - /** - * Reports an AST node as a rule violation. - * @param {ASTNode} node The node to report. - * @returns {void} - * @private - */ - function report(node) { - - /* - * We used the range instead of the node because it's possible - * for the same identifier to be represented by two different - * nodes, with the most clear example being shorthand properties: - * { foo } - * In this case, "foo" is represented by one node for the name - * and one for the value. The only way to know they are the same - * is to look at the range. - */ - if (!reportedNodes.has(node.range.toString())) { - const isPrivate = node.type === "PrivateIdentifier"; - - context.report({ - node, - messageId: isPrivate ? "restrictedPrivate" : "restricted", - data: { - name: node.name - } - }); - reportedNodes.add(node.range.toString()); - } - } - - return { - - Program(node) { - globalScope = sourceCode.getScope(node); - }, - - [[ - "Identifier", - "PrivateIdentifier" - ]](node) { - if (isRestricted(node.name) && shouldCheck(node)) { - report(node); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/id-length.js b/node_modules/eslint/lib/rules/id-length.js deleted file mode 100644 index 97bc0e430..000000000 --- a/node_modules/eslint/lib/rules/id-length.js +++ /dev/null @@ -1,177 +0,0 @@ -/** - * @fileoverview Rule that warns when identifier names are shorter or longer - * than the values provided in configuration. - * @author Burak Yigit Kaya aka BYK - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { getGraphemeCount } = require("../shared/string-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce minimum and maximum identifier lengths", - recommended: false, - url: "https://eslint.org/docs/latest/rules/id-length" - }, - - schema: [ - { - type: "object", - properties: { - min: { - type: "integer", - default: 2 - }, - max: { - type: "integer" - }, - exceptions: { - type: "array", - uniqueItems: true, - items: { - type: "string" - } - }, - exceptionPatterns: { - type: "array", - uniqueItems: true, - items: { - type: "string" - } - }, - properties: { - enum: ["always", "never"] - } - }, - additionalProperties: false - } - ], - messages: { - tooShort: "Identifier name '{{name}}' is too short (< {{min}}).", - tooShortPrivate: "Identifier name '#{{name}}' is too short (< {{min}}).", - tooLong: "Identifier name '{{name}}' is too long (> {{max}}).", - tooLongPrivate: "Identifier name #'{{name}}' is too long (> {{max}})." - } - }, - - create(context) { - const options = context.options[0] || {}; - const minLength = typeof options.min !== "undefined" ? options.min : 2; - const maxLength = typeof options.max !== "undefined" ? options.max : Infinity; - const properties = options.properties !== "never"; - const exceptions = new Set(options.exceptions); - const exceptionPatterns = (options.exceptionPatterns || []).map(pattern => new RegExp(pattern, "u")); - const reportedNodes = new Set(); - - /** - * Checks if a string matches the provided exception patterns - * @param {string} name The string to check. - * @returns {boolean} if the string is a match - * @private - */ - function matchesExceptionPattern(name) { - return exceptionPatterns.some(pattern => pattern.test(name)); - } - - const SUPPORTED_EXPRESSIONS = { - MemberExpression: properties && function(parent) { - return !parent.computed && ( - - // regular property assignment - (parent.parent.left === parent && parent.parent.type === "AssignmentExpression" || - - // or the last identifier in an ObjectPattern destructuring - parent.parent.type === "Property" && parent.parent.value === parent && - parent.parent.parent.type === "ObjectPattern" && parent.parent.parent.parent.left === parent.parent.parent) - ); - }, - AssignmentPattern(parent, node) { - return parent.left === node; - }, - VariableDeclarator(parent, node) { - return parent.id === node; - }, - Property(parent, node) { - - if (parent.parent.type === "ObjectPattern") { - const isKeyAndValueSame = parent.value.name === parent.key.name; - - return ( - !isKeyAndValueSame && parent.value === node || - isKeyAndValueSame && parent.key === node && properties - ); - } - return properties && !parent.computed && parent.key.name === node.name; - }, - ImportDefaultSpecifier: true, - RestElement: true, - FunctionExpression: true, - ArrowFunctionExpression: true, - ClassDeclaration: true, - FunctionDeclaration: true, - MethodDefinition: true, - PropertyDefinition: true, - CatchClause: true, - ArrayPattern: true - }; - - return { - [[ - "Identifier", - "PrivateIdentifier" - ]](node) { - const name = node.name; - const parent = node.parent; - - const nameLength = getGraphemeCount(name); - - const isShort = nameLength < minLength; - const isLong = nameLength > maxLength; - - if (!(isShort || isLong) || exceptions.has(name) || matchesExceptionPattern(name)) { - return; // Nothing to report - } - - const isValidExpression = SUPPORTED_EXPRESSIONS[parent.type]; - - /* - * We used the range instead of the node because it's possible - * for the same identifier to be represented by two different - * nodes, with the most clear example being shorthand properties: - * { foo } - * In this case, "foo" is represented by one node for the name - * and one for the value. The only way to know they are the same - * is to look at the range. - */ - if (isValidExpression && !reportedNodes.has(node.range.toString()) && (isValidExpression === true || isValidExpression(parent, node))) { - reportedNodes.add(node.range.toString()); - - let messageId = isShort ? "tooShort" : "tooLong"; - - if (node.type === "PrivateIdentifier") { - messageId += "Private"; - } - - context.report({ - node, - messageId, - data: { name, min: minLength, max: maxLength } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/id-match.js b/node_modules/eslint/lib/rules/id-match.js deleted file mode 100644 index e225454e7..000000000 --- a/node_modules/eslint/lib/rules/id-match.js +++ /dev/null @@ -1,299 +0,0 @@ -/** - * @fileoverview Rule to flag non-matching identifiers - * @author Matthieu Larcher - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require identifiers to match a specified regular expression", - recommended: false, - url: "https://eslint.org/docs/latest/rules/id-match" - }, - - schema: [ - { - type: "string" - }, - { - type: "object", - properties: { - properties: { - type: "boolean", - default: false - }, - classFields: { - type: "boolean", - default: false - }, - onlyDeclarations: { - type: "boolean", - default: false - }, - ignoreDestructuring: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - messages: { - notMatch: "Identifier '{{name}}' does not match the pattern '{{pattern}}'.", - notMatchPrivate: "Identifier '#{{name}}' does not match the pattern '{{pattern}}'." - } - }, - - create(context) { - - //-------------------------------------------------------------------------- - // Options - //-------------------------------------------------------------------------- - const pattern = context.options[0] || "^.+$", - regexp = new RegExp(pattern, "u"); - - const options = context.options[1] || {}, - checkProperties = !!options.properties, - checkClassFields = !!options.classFields, - onlyDeclarations = !!options.onlyDeclarations, - ignoreDestructuring = !!options.ignoreDestructuring; - - const sourceCode = context.sourceCode; - let globalScope; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - // contains reported nodes to avoid reporting twice on destructuring with shorthand notation - const reportedNodes = new Set(); - const ALLOWED_PARENT_TYPES = new Set(["CallExpression", "NewExpression"]); - const DECLARATION_TYPES = new Set(["FunctionDeclaration", "VariableDeclarator"]); - const IMPORT_TYPES = new Set(["ImportSpecifier", "ImportNamespaceSpecifier", "ImportDefaultSpecifier"]); - - /** - * Checks whether the given node represents a reference to a global variable that is not declared in the source code. - * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a reference to a global variable. - */ - function isReferenceToGlobalVariable(node) { - const variable = globalScope.set.get(node.name); - - return variable && variable.defs.length === 0 && - variable.references.some(ref => ref.identifier === node); - } - - /** - * Checks if a string matches the provided pattern - * @param {string} name The string to check. - * @returns {boolean} if the string is a match - * @private - */ - function isInvalid(name) { - return !regexp.test(name); - } - - /** - * Checks if a parent of a node is an ObjectPattern. - * @param {ASTNode} node The node to check. - * @returns {boolean} if the node is inside an ObjectPattern - * @private - */ - function isInsideObjectPattern(node) { - let { parent } = node; - - while (parent) { - if (parent.type === "ObjectPattern") { - return true; - } - - parent = parent.parent; - } - - return false; - } - - /** - * Verifies if we should report an error or not based on the effective - * parent node and the identifier name. - * @param {ASTNode} effectiveParent The effective parent node of the node to be reported - * @param {string} name The identifier name of the identifier node - * @returns {boolean} whether an error should be reported or not - */ - function shouldReport(effectiveParent, name) { - return (!onlyDeclarations || DECLARATION_TYPES.has(effectiveParent.type)) && - !ALLOWED_PARENT_TYPES.has(effectiveParent.type) && isInvalid(name); - } - - /** - * Reports an AST node as a rule violation. - * @param {ASTNode} node The node to report. - * @returns {void} - * @private - */ - function report(node) { - - /* - * We used the range instead of the node because it's possible - * for the same identifier to be represented by two different - * nodes, with the most clear example being shorthand properties: - * { foo } - * In this case, "foo" is represented by one node for the name - * and one for the value. The only way to know they are the same - * is to look at the range. - */ - if (!reportedNodes.has(node.range.toString())) { - - const messageId = (node.type === "PrivateIdentifier") - ? "notMatchPrivate" : "notMatch"; - - context.report({ - node, - messageId, - data: { - name: node.name, - pattern - } - }); - reportedNodes.add(node.range.toString()); - } - } - - return { - - Program(node) { - globalScope = sourceCode.getScope(node); - }, - - Identifier(node) { - const name = node.name, - parent = node.parent, - effectiveParent = (parent.type === "MemberExpression") ? parent.parent : parent; - - if (isReferenceToGlobalVariable(node)) { - return; - } - - if (parent.type === "MemberExpression") { - - if (!checkProperties) { - return; - } - - // Always check object names - if (parent.object.type === "Identifier" && - parent.object.name === name) { - if (isInvalid(name)) { - report(node); - } - - // Report AssignmentExpressions left side's assigned variable id - } else if (effectiveParent.type === "AssignmentExpression" && - effectiveParent.left.type === "MemberExpression" && - effectiveParent.left.property.name === node.name) { - if (isInvalid(name)) { - report(node); - } - - // Report AssignmentExpressions only if they are the left side of the assignment - } else if (effectiveParent.type === "AssignmentExpression" && effectiveParent.right.type !== "MemberExpression") { - if (isInvalid(name)) { - report(node); - } - } - - // For https://github.com/eslint/eslint/issues/15123 - } else if ( - parent.type === "Property" && - parent.parent.type === "ObjectExpression" && - parent.key === node && - !parent.computed - ) { - if (checkProperties && isInvalid(name)) { - report(node); - } - - /* - * Properties have their own rules, and - * AssignmentPattern nodes can be treated like Properties: - * e.g.: const { no_camelcased = false } = bar; - */ - } else if (parent.type === "Property" || parent.type === "AssignmentPattern") { - - if (parent.parent && parent.parent.type === "ObjectPattern") { - if (!ignoreDestructuring && parent.shorthand && parent.value.left && isInvalid(name)) { - report(node); - } - - const assignmentKeyEqualsValue = parent.key.name === parent.value.name; - - // prevent checking righthand side of destructured object - if (!assignmentKeyEqualsValue && parent.key === node) { - return; - } - - const valueIsInvalid = parent.value.name && isInvalid(name); - - // ignore destructuring if the option is set, unless a new identifier is created - if (valueIsInvalid && !(assignmentKeyEqualsValue && ignoreDestructuring)) { - report(node); - } - } - - // never check properties or always ignore destructuring - if ((!checkProperties && !parent.computed) || (ignoreDestructuring && isInsideObjectPattern(node))) { - return; - } - - // don't check right hand side of AssignmentExpression to prevent duplicate warnings - if (parent.right !== node && shouldReport(effectiveParent, name)) { - report(node); - } - - // Check if it's an import specifier - } else if (IMPORT_TYPES.has(parent.type)) { - - // Report only if the local imported identifier is invalid - if (parent.local && parent.local.name === node.name && isInvalid(name)) { - report(node); - } - - } else if (parent.type === "PropertyDefinition") { - - if (checkClassFields && isInvalid(name)) { - report(node); - } - - // Report anything that is invalid that isn't a CallExpression - } else if (shouldReport(effectiveParent, name)) { - report(node); - } - }, - - "PrivateIdentifier"(node) { - - const isClassField = node.parent.type === "PropertyDefinition"; - - if (isClassField && !checkClassFields) { - return; - } - - if (isInvalid(node.name)) { - report(node); - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js b/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js deleted file mode 100644 index 30ab1a5f3..000000000 --- a/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @fileoverview enforce the location of arrow function bodies - * @author Sharmila Jesupaul - */ -"use strict"; - -const { isCommentToken, isNotOpeningParenToken } = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce the location of arrow function bodies", - recommended: false, - url: "https://eslint.org/docs/latest/rules/implicit-arrow-linebreak" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["beside", "below"] - } - ], - messages: { - expected: "Expected a linebreak before this expression.", - unexpected: "Expected no linebreak before this expression." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const option = context.options[0] || "beside"; - - /** - * Validates the location of an arrow function body - * @param {ASTNode} node The arrow function body - * @returns {void} - */ - function validateExpression(node) { - if (node.body.type === "BlockStatement") { - return; - } - - const arrowToken = sourceCode.getTokenBefore(node.body, isNotOpeningParenToken); - const firstTokenOfBody = sourceCode.getTokenAfter(arrowToken); - - if (arrowToken.loc.end.line === firstTokenOfBody.loc.start.line && option === "below") { - context.report({ - node: firstTokenOfBody, - messageId: "expected", - fix: fixer => fixer.insertTextBefore(firstTokenOfBody, "\n") - }); - } else if (arrowToken.loc.end.line !== firstTokenOfBody.loc.start.line && option === "beside") { - context.report({ - node: firstTokenOfBody, - messageId: "unexpected", - fix(fixer) { - if (sourceCode.getFirstTokenBetween(arrowToken, firstTokenOfBody, { includeComments: true, filter: isCommentToken })) { - return null; - } - - return fixer.replaceTextRange([arrowToken.range[1], firstTokenOfBody.range[0]], " "); - } - }); - } - } - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - return { - ArrowFunctionExpression: node => validateExpression(node) - }; - } -}; diff --git a/node_modules/eslint/lib/rules/indent-legacy.js b/node_modules/eslint/lib/rules/indent-legacy.js deleted file mode 100644 index 78bf965cb..000000000 --- a/node_modules/eslint/lib/rules/indent-legacy.js +++ /dev/null @@ -1,1126 +0,0 @@ -/** - * @fileoverview This option sets a specific tab width for your code - * - * This rule has been ported and modified from nodeca. - * @author Vitaly Puzrin - * @author Gyandeep Singh - * @deprecated in ESLint v4.0.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -// this rule has known coverage issues, but it's deprecated and shouldn't be updated in the future anyway. -/* c8 ignore next */ -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent indentation", - recommended: false, - url: "https://eslint.org/docs/latest/rules/indent-legacy" - }, - - deprecated: true, - - replacedBy: ["indent"], - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - { - enum: ["tab"] - }, - { - type: "integer", - minimum: 0 - } - ] - }, - { - type: "object", - properties: { - SwitchCase: { - type: "integer", - minimum: 0 - }, - VariableDeclarator: { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - type: "object", - properties: { - var: { - type: "integer", - minimum: 0 - }, - let: { - type: "integer", - minimum: 0 - }, - const: { - type: "integer", - minimum: 0 - } - } - } - ] - }, - outerIIFEBody: { - type: "integer", - minimum: 0 - }, - MemberExpression: { - type: "integer", - minimum: 0 - }, - FunctionDeclaration: { - type: "object", - properties: { - parameters: { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - enum: ["first"] - } - ] - }, - body: { - type: "integer", - minimum: 0 - } - } - }, - FunctionExpression: { - type: "object", - properties: { - parameters: { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - enum: ["first"] - } - ] - }, - body: { - type: "integer", - minimum: 0 - } - } - }, - CallExpression: { - type: "object", - properties: { - parameters: { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - enum: ["first"] - } - ] - } - } - }, - ArrayExpression: { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - enum: ["first"] - } - ] - }, - ObjectExpression: { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - enum: ["first"] - } - ] - } - }, - additionalProperties: false - } - ], - messages: { - expected: "Expected indentation of {{expected}} but found {{actual}}." - } - }, - - create(context) { - const DEFAULT_VARIABLE_INDENT = 1; - const DEFAULT_PARAMETER_INDENT = null; // For backwards compatibility, don't check parameter indentation unless specified in the config - const DEFAULT_FUNCTION_BODY_INDENT = 1; - - let indentType = "space"; - let indentSize = 4; - const options = { - SwitchCase: 0, - VariableDeclarator: { - var: DEFAULT_VARIABLE_INDENT, - let: DEFAULT_VARIABLE_INDENT, - const: DEFAULT_VARIABLE_INDENT - }, - outerIIFEBody: null, - FunctionDeclaration: { - parameters: DEFAULT_PARAMETER_INDENT, - body: DEFAULT_FUNCTION_BODY_INDENT - }, - FunctionExpression: { - parameters: DEFAULT_PARAMETER_INDENT, - body: DEFAULT_FUNCTION_BODY_INDENT - }, - CallExpression: { - arguments: DEFAULT_PARAMETER_INDENT - }, - ArrayExpression: 1, - ObjectExpression: 1 - }; - - const sourceCode = context.sourceCode; - - if (context.options.length) { - if (context.options[0] === "tab") { - indentSize = 1; - indentType = "tab"; - } else /* c8 ignore start */ if (typeof context.options[0] === "number") { - indentSize = context.options[0]; - indentType = "space"; - }/* c8 ignore stop */ - - if (context.options[1]) { - const opts = context.options[1]; - - options.SwitchCase = opts.SwitchCase || 0; - const variableDeclaratorRules = opts.VariableDeclarator; - - if (typeof variableDeclaratorRules === "number") { - options.VariableDeclarator = { - var: variableDeclaratorRules, - let: variableDeclaratorRules, - const: variableDeclaratorRules - }; - } else if (typeof variableDeclaratorRules === "object") { - Object.assign(options.VariableDeclarator, variableDeclaratorRules); - } - - if (typeof opts.outerIIFEBody === "number") { - options.outerIIFEBody = opts.outerIIFEBody; - } - - if (typeof opts.MemberExpression === "number") { - options.MemberExpression = opts.MemberExpression; - } - - if (typeof opts.FunctionDeclaration === "object") { - Object.assign(options.FunctionDeclaration, opts.FunctionDeclaration); - } - - if (typeof opts.FunctionExpression === "object") { - Object.assign(options.FunctionExpression, opts.FunctionExpression); - } - - if (typeof opts.CallExpression === "object") { - Object.assign(options.CallExpression, opts.CallExpression); - } - - if (typeof opts.ArrayExpression === "number" || typeof opts.ArrayExpression === "string") { - options.ArrayExpression = opts.ArrayExpression; - } - - if (typeof opts.ObjectExpression === "number" || typeof opts.ObjectExpression === "string") { - options.ObjectExpression = opts.ObjectExpression; - } - } - } - - const caseIndentStore = {}; - - /** - * Creates an error message for a line, given the expected/actual indentation. - * @param {int} expectedAmount The expected amount of indentation characters for this line - * @param {int} actualSpaces The actual number of indentation spaces that were found on this line - * @param {int} actualTabs The actual number of indentation tabs that were found on this line - * @returns {string} An error message for this line - */ - function createErrorMessageData(expectedAmount, actualSpaces, actualTabs) { - const expectedStatement = `${expectedAmount} ${indentType}${expectedAmount === 1 ? "" : "s"}`; // e.g. "2 tabs" - const foundSpacesWord = `space${actualSpaces === 1 ? "" : "s"}`; // e.g. "space" - const foundTabsWord = `tab${actualTabs === 1 ? "" : "s"}`; // e.g. "tabs" - let foundStatement; - - if (actualSpaces > 0 && actualTabs > 0) { - foundStatement = `${actualSpaces} ${foundSpacesWord} and ${actualTabs} ${foundTabsWord}`; // e.g. "1 space and 2 tabs" - } else if (actualSpaces > 0) { - - /* - * Abbreviate the message if the expected indentation is also spaces. - * e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' - */ - foundStatement = indentType === "space" ? actualSpaces : `${actualSpaces} ${foundSpacesWord}`; - } else if (actualTabs > 0) { - foundStatement = indentType === "tab" ? actualTabs : `${actualTabs} ${foundTabsWord}`; - } else { - foundStatement = "0"; - } - return { - expected: expectedStatement, - actual: foundStatement - }; - } - - /** - * Reports a given indent violation - * @param {ASTNode} node Node violating the indent rule - * @param {int} needed Expected indentation character count - * @param {int} gottenSpaces Indentation space count in the actual node/code - * @param {int} gottenTabs Indentation tab count in the actual node/code - * @param {Object} [loc] Error line and column location - * @param {boolean} isLastNodeCheck Is the error for last node check - * @returns {void} - */ - function report(node, needed, gottenSpaces, gottenTabs, loc, isLastNodeCheck) { - if (gottenSpaces && gottenTabs) { - - // To avoid conflicts with `no-mixed-spaces-and-tabs`, don't report lines that have both spaces and tabs. - return; - } - - const desiredIndent = (indentType === "space" ? " " : "\t").repeat(needed); - - const textRange = isLastNodeCheck - ? [node.range[1] - node.loc.end.column, node.range[1] - node.loc.end.column + gottenSpaces + gottenTabs] - : [node.range[0] - node.loc.start.column, node.range[0] - node.loc.start.column + gottenSpaces + gottenTabs]; - - context.report({ - node, - loc, - messageId: "expected", - data: createErrorMessageData(needed, gottenSpaces, gottenTabs), - fix: fixer => fixer.replaceTextRange(textRange, desiredIndent) - }); - } - - /** - * Get the actual indent of node - * @param {ASTNode|Token} node Node to examine - * @param {boolean} [byLastLine=false] get indent of node's last line - * @returns {Object} The node's indent. Contains keys `space` and `tab`, representing the indent of each character. Also - * contains keys `goodChar` and `badChar`, where `goodChar` is the amount of the user's desired indentation character, and - * `badChar` is the amount of the other indentation character. - */ - function getNodeIndent(node, byLastLine) { - const token = byLastLine ? sourceCode.getLastToken(node) : sourceCode.getFirstToken(node); - const srcCharsBeforeNode = sourceCode.getText(token, token.loc.start.column).split(""); - const indentChars = srcCharsBeforeNode.slice(0, srcCharsBeforeNode.findIndex(char => char !== " " && char !== "\t")); - const spaces = indentChars.filter(char => char === " ").length; - const tabs = indentChars.filter(char => char === "\t").length; - - return { - space: spaces, - tab: tabs, - goodChar: indentType === "space" ? spaces : tabs, - badChar: indentType === "space" ? tabs : spaces - }; - } - - /** - * Checks node is the first in its own start line. By default it looks by start line. - * @param {ASTNode} node The node to check - * @param {boolean} [byEndLocation=false] Lookup based on start position or end - * @returns {boolean} true if its the first in the its start line - */ - function isNodeFirstInLine(node, byEndLocation) { - const firstToken = byEndLocation === true ? sourceCode.getLastToken(node, 1) : sourceCode.getTokenBefore(node), - startLine = byEndLocation === true ? node.loc.end.line : node.loc.start.line, - endLine = firstToken ? firstToken.loc.end.line : -1; - - return startLine !== endLine; - } - - /** - * Check indent for node - * @param {ASTNode} node Node to check - * @param {int} neededIndent needed indent - * @returns {void} - */ - function checkNodeIndent(node, neededIndent) { - const actualIndent = getNodeIndent(node, false); - - if ( - node.type !== "ArrayExpression" && - node.type !== "ObjectExpression" && - (actualIndent.goodChar !== neededIndent || actualIndent.badChar !== 0) && - isNodeFirstInLine(node) - ) { - report(node, neededIndent, actualIndent.space, actualIndent.tab); - } - - if (node.type === "IfStatement" && node.alternate) { - const elseToken = sourceCode.getTokenBefore(node.alternate); - - checkNodeIndent(elseToken, neededIndent); - - if (!isNodeFirstInLine(node.alternate)) { - checkNodeIndent(node.alternate, neededIndent); - } - } - - if (node.type === "TryStatement" && node.handler) { - const catchToken = sourceCode.getFirstToken(node.handler); - - checkNodeIndent(catchToken, neededIndent); - } - - if (node.type === "TryStatement" && node.finalizer) { - const finallyToken = sourceCode.getTokenBefore(node.finalizer); - - checkNodeIndent(finallyToken, neededIndent); - } - - if (node.type === "DoWhileStatement") { - const whileToken = sourceCode.getTokenAfter(node.body); - - checkNodeIndent(whileToken, neededIndent); - } - } - - /** - * Check indent for nodes list - * @param {ASTNode[]} nodes list of node objects - * @param {int} indent needed indent - * @returns {void} - */ - function checkNodesIndent(nodes, indent) { - nodes.forEach(node => checkNodeIndent(node, indent)); - } - - /** - * Check last node line indent this detects, that block closed correctly - * @param {ASTNode} node Node to examine - * @param {int} lastLineIndent needed indent - * @returns {void} - */ - function checkLastNodeLineIndent(node, lastLineIndent) { - const lastToken = sourceCode.getLastToken(node); - const endIndent = getNodeIndent(lastToken, true); - - if ((endIndent.goodChar !== lastLineIndent || endIndent.badChar !== 0) && isNodeFirstInLine(node, true)) { - report( - node, - lastLineIndent, - endIndent.space, - endIndent.tab, - { line: lastToken.loc.start.line, column: lastToken.loc.start.column }, - true - ); - } - } - - /** - * Check last node line indent this detects, that block closed correctly - * This function for more complicated return statement case, where closing parenthesis may be followed by ';' - * @param {ASTNode} node Node to examine - * @param {int} firstLineIndent first line needed indent - * @returns {void} - */ - function checkLastReturnStatementLineIndent(node, firstLineIndent) { - - /* - * in case if return statement ends with ');' we have traverse back to ')' - * otherwise we'll measure indent for ';' and replace ')' - */ - const lastToken = sourceCode.getLastToken(node, astUtils.isClosingParenToken); - const textBeforeClosingParenthesis = sourceCode.getText(lastToken, lastToken.loc.start.column).slice(0, -1); - - if (textBeforeClosingParenthesis.trim()) { - - // There are tokens before the closing paren, don't report this case - return; - } - - const endIndent = getNodeIndent(lastToken, true); - - if (endIndent.goodChar !== firstLineIndent) { - report( - node, - firstLineIndent, - endIndent.space, - endIndent.tab, - { line: lastToken.loc.start.line, column: lastToken.loc.start.column }, - true - ); - } - } - - /** - * Check first node line indent is correct - * @param {ASTNode} node Node to examine - * @param {int} firstLineIndent needed indent - * @returns {void} - */ - function checkFirstNodeLineIndent(node, firstLineIndent) { - const startIndent = getNodeIndent(node, false); - - if ((startIndent.goodChar !== firstLineIndent || startIndent.badChar !== 0) && isNodeFirstInLine(node)) { - report( - node, - firstLineIndent, - startIndent.space, - startIndent.tab, - { line: node.loc.start.line, column: node.loc.start.column } - ); - } - } - - /** - * Returns a parent node of given node based on a specified type - * if not present then return null - * @param {ASTNode} node node to examine - * @param {string} type type that is being looked for - * @param {string} stopAtList end points for the evaluating code - * @returns {ASTNode|void} if found then node otherwise null - */ - function getParentNodeByType(node, type, stopAtList) { - let parent = node.parent; - const stopAtSet = new Set(stopAtList || ["Program"]); - - while (parent.type !== type && !stopAtSet.has(parent.type) && parent.type !== "Program") { - parent = parent.parent; - } - - return parent.type === type ? parent : null; - } - - /** - * Returns the VariableDeclarator based on the current node - * if not present then return null - * @param {ASTNode} node node to examine - * @returns {ASTNode|void} if found then node otherwise null - */ - function getVariableDeclaratorNode(node) { - return getParentNodeByType(node, "VariableDeclarator"); - } - - /** - * Check to see if the node is part of the multi-line variable declaration. - * Also if its on the same line as the varNode - * @param {ASTNode} node node to check - * @param {ASTNode} varNode variable declaration node to check against - * @returns {boolean} True if all the above condition satisfy - */ - function isNodeInVarOnTop(node, varNode) { - return varNode && - varNode.parent.loc.start.line === node.loc.start.line && - varNode.parent.declarations.length > 1; - } - - /** - * Check to see if the argument before the callee node is multi-line and - * there should only be 1 argument before the callee node - * @param {ASTNode} node node to check - * @returns {boolean} True if arguments are multi-line - */ - function isArgBeforeCalleeNodeMultiline(node) { - const parent = node.parent; - - if (parent.arguments.length >= 2 && parent.arguments[1] === node) { - return parent.arguments[0].loc.end.line > parent.arguments[0].loc.start.line; - } - - return false; - } - - /** - * Check to see if the node is a file level IIFE - * @param {ASTNode} node The function node to check. - * @returns {boolean} True if the node is the outer IIFE - */ - function isOuterIIFE(node) { - const parent = node.parent; - let stmt = parent.parent; - - /* - * Verify that the node is an IIEF - */ - if ( - parent.type !== "CallExpression" || - parent.callee !== node) { - - return false; - } - - /* - * Navigate legal ancestors to determine whether this IIEF is outer - */ - while ( - stmt.type === "UnaryExpression" && ( - stmt.operator === "!" || - stmt.operator === "~" || - stmt.operator === "+" || - stmt.operator === "-") || - stmt.type === "AssignmentExpression" || - stmt.type === "LogicalExpression" || - stmt.type === "SequenceExpression" || - stmt.type === "VariableDeclarator") { - - stmt = stmt.parent; - } - - return (( - stmt.type === "ExpressionStatement" || - stmt.type === "VariableDeclaration") && - stmt.parent && stmt.parent.type === "Program" - ); - } - - /** - * Check indent for function block content - * @param {ASTNode} node A BlockStatement node that is inside of a function. - * @returns {void} - */ - function checkIndentInFunctionBlock(node) { - - /* - * Search first caller in chain. - * Ex.: - * - * Models <- Identifier - * .User - * .find() - * .exec(function() { - * // function body - * }); - * - * Looks for 'Models' - */ - const calleeNode = node.parent; // FunctionExpression - let indent; - - if (calleeNode.parent && - (calleeNode.parent.type === "Property" || - calleeNode.parent.type === "ArrayExpression")) { - - // If function is part of array or object, comma can be put at left - indent = getNodeIndent(calleeNode, false).goodChar; - } else { - - // If function is standalone, simple calculate indent - indent = getNodeIndent(calleeNode).goodChar; - } - - if (calleeNode.parent.type === "CallExpression") { - const calleeParent = calleeNode.parent; - - if (calleeNode.type !== "FunctionExpression" && calleeNode.type !== "ArrowFunctionExpression") { - if (calleeParent && calleeParent.loc.start.line < node.loc.start.line) { - indent = getNodeIndent(calleeParent).goodChar; - } - } else { - if (isArgBeforeCalleeNodeMultiline(calleeNode) && - calleeParent.callee.loc.start.line === calleeParent.callee.loc.end.line && - !isNodeFirstInLine(calleeNode)) { - indent = getNodeIndent(calleeParent).goodChar; - } - } - } - - /* - * function body indent should be indent + indent size, unless this - * is a FunctionDeclaration, FunctionExpression, or outer IIFE and the corresponding options are enabled. - */ - let functionOffset = indentSize; - - if (options.outerIIFEBody !== null && isOuterIIFE(calleeNode)) { - functionOffset = options.outerIIFEBody * indentSize; - } else if (calleeNode.type === "FunctionExpression") { - functionOffset = options.FunctionExpression.body * indentSize; - } else if (calleeNode.type === "FunctionDeclaration") { - functionOffset = options.FunctionDeclaration.body * indentSize; - } - indent += functionOffset; - - // check if the node is inside a variable - const parentVarNode = getVariableDeclaratorNode(node); - - if (parentVarNode && isNodeInVarOnTop(node, parentVarNode)) { - indent += indentSize * options.VariableDeclarator[parentVarNode.parent.kind]; - } - - if (node.body.length > 0) { - checkNodesIndent(node.body, indent); - } - - checkLastNodeLineIndent(node, indent - functionOffset); - } - - - /** - * Checks if the given node starts and ends on the same line - * @param {ASTNode} node The node to check - * @returns {boolean} Whether or not the block starts and ends on the same line. - */ - function isSingleLineNode(node) { - const lastToken = sourceCode.getLastToken(node), - startLine = node.loc.start.line, - endLine = lastToken.loc.end.line; - - return startLine === endLine; - } - - /** - * Check indent for array block content or object block content - * @param {ASTNode} node node to examine - * @returns {void} - */ - function checkIndentInArrayOrObjectBlock(node) { - - // Skip inline - if (isSingleLineNode(node)) { - return; - } - - let elements = (node.type === "ArrayExpression") ? node.elements : node.properties; - - // filter out empty elements example would be [ , 2] so remove first element as espree considers it as null - elements = elements.filter(elem => elem !== null); - - let nodeIndent; - let elementsIndent; - const parentVarNode = getVariableDeclaratorNode(node); - - // TODO - come up with a better strategy in future - if (isNodeFirstInLine(node)) { - const parent = node.parent; - - nodeIndent = getNodeIndent(parent).goodChar; - if (!parentVarNode || parentVarNode.loc.start.line !== node.loc.start.line) { - if (parent.type !== "VariableDeclarator" || parentVarNode === parentVarNode.parent.declarations[0]) { - if (parent.type === "VariableDeclarator" && parentVarNode.loc.start.line === parent.loc.start.line) { - nodeIndent += (indentSize * options.VariableDeclarator[parentVarNode.parent.kind]); - } else if (parent.type === "ObjectExpression" || parent.type === "ArrayExpression") { - const parentElements = node.parent.type === "ObjectExpression" ? node.parent.properties : node.parent.elements; - - if (parentElements[0] && - parentElements[0].loc.start.line === parent.loc.start.line && - parentElements[0].loc.end.line !== parent.loc.start.line) { - - /* - * If the first element of the array spans multiple lines, don't increase the expected indentation of the rest. - * e.g. [{ - * foo: 1 - * }, - * { - * bar: 1 - * }] - * the second object is not indented. - */ - } else if (typeof options[parent.type] === "number") { - nodeIndent += options[parent.type] * indentSize; - } else { - nodeIndent = parentElements[0].loc.start.column; - } - } else if (parent.type === "CallExpression" || parent.type === "NewExpression") { - if (typeof options.CallExpression.arguments === "number") { - nodeIndent += options.CallExpression.arguments * indentSize; - } else if (options.CallExpression.arguments === "first") { - if (parent.arguments.includes(node)) { - nodeIndent = parent.arguments[0].loc.start.column; - } - } else { - nodeIndent += indentSize; - } - } else if (parent.type === "LogicalExpression" || parent.type === "ArrowFunctionExpression") { - nodeIndent += indentSize; - } - } - } - - checkFirstNodeLineIndent(node, nodeIndent); - } else { - nodeIndent = getNodeIndent(node).goodChar; - } - - if (options[node.type] === "first") { - elementsIndent = elements.length ? elements[0].loc.start.column : 0; // If there are no elements, elementsIndent doesn't matter. - } else { - elementsIndent = nodeIndent + indentSize * options[node.type]; - } - - /* - * Check if the node is a multiple variable declaration; if so, then - * make sure indentation takes that into account. - */ - if (isNodeInVarOnTop(node, parentVarNode)) { - elementsIndent += indentSize * options.VariableDeclarator[parentVarNode.parent.kind]; - } - - checkNodesIndent(elements, elementsIndent); - - if (elements.length > 0) { - - // Skip last block line check if last item in same line - if (elements[elements.length - 1].loc.end.line === node.loc.end.line) { - return; - } - } - - checkLastNodeLineIndent(node, nodeIndent + - (isNodeInVarOnTop(node, parentVarNode) ? options.VariableDeclarator[parentVarNode.parent.kind] * indentSize : 0)); - } - - /** - * Check if the node or node body is a BlockStatement or not - * @param {ASTNode} node node to test - * @returns {boolean} True if it or its body is a block statement - */ - function isNodeBodyBlock(node) { - return node.type === "BlockStatement" || node.type === "ClassBody" || (node.body && node.body.type === "BlockStatement") || - (node.consequent && node.consequent.type === "BlockStatement"); - } - - /** - * Check indentation for blocks - * @param {ASTNode} node node to check - * @returns {void} - */ - function blockIndentationCheck(node) { - - // Skip inline blocks - if (isSingleLineNode(node)) { - return; - } - - if (node.parent && ( - node.parent.type === "FunctionExpression" || - node.parent.type === "FunctionDeclaration" || - node.parent.type === "ArrowFunctionExpression") - ) { - checkIndentInFunctionBlock(node); - return; - } - - let indent; - let nodesToCheck = []; - - /* - * For this statements we should check indent from statement beginning, - * not from the beginning of the block. - */ - const statementsWithProperties = [ - "IfStatement", "WhileStatement", "ForStatement", "ForInStatement", "ForOfStatement", "DoWhileStatement", "ClassDeclaration", "TryStatement" - ]; - - if (node.parent && statementsWithProperties.includes(node.parent.type) && isNodeBodyBlock(node)) { - indent = getNodeIndent(node.parent).goodChar; - } else if (node.parent && node.parent.type === "CatchClause") { - indent = getNodeIndent(node.parent.parent).goodChar; - } else { - indent = getNodeIndent(node).goodChar; - } - - if (node.type === "IfStatement" && node.consequent.type !== "BlockStatement") { - nodesToCheck = [node.consequent]; - } else if (Array.isArray(node.body)) { - nodesToCheck = node.body; - } else { - nodesToCheck = [node.body]; - } - - if (nodesToCheck.length > 0) { - checkNodesIndent(nodesToCheck, indent + indentSize); - } - - if (node.type === "BlockStatement") { - checkLastNodeLineIndent(node, indent); - } - } - - /** - * Filter out the elements which are on the same line of each other or the node. - * basically have only 1 elements from each line except the variable declaration line. - * @param {ASTNode} node Variable declaration node - * @returns {ASTNode[]} Filtered elements - */ - function filterOutSameLineVars(node) { - return node.declarations.reduce((finalCollection, elem) => { - const lastElem = finalCollection[finalCollection.length - 1]; - - if ((elem.loc.start.line !== node.loc.start.line && !lastElem) || - (lastElem && lastElem.loc.start.line !== elem.loc.start.line)) { - finalCollection.push(elem); - } - - return finalCollection; - }, []); - } - - /** - * Check indentation for variable declarations - * @param {ASTNode} node node to examine - * @returns {void} - */ - function checkIndentInVariableDeclarations(node) { - const elements = filterOutSameLineVars(node); - const nodeIndent = getNodeIndent(node).goodChar; - const lastElement = elements[elements.length - 1]; - - const elementsIndent = nodeIndent + indentSize * options.VariableDeclarator[node.kind]; - - checkNodesIndent(elements, elementsIndent); - - // Only check the last line if there is any token after the last item - if (sourceCode.getLastToken(node).loc.end.line <= lastElement.loc.end.line) { - return; - } - - const tokenBeforeLastElement = sourceCode.getTokenBefore(lastElement); - - if (tokenBeforeLastElement.value === ",") { - - // Special case for comma-first syntax where the semicolon is indented - checkLastNodeLineIndent(node, getNodeIndent(tokenBeforeLastElement).goodChar); - } else { - checkLastNodeLineIndent(node, elementsIndent - indentSize); - } - } - - /** - * Check and decide whether to check for indentation for blockless nodes - * Scenarios are for or while statements without braces around them - * @param {ASTNode} node node to examine - * @returns {void} - */ - function blockLessNodes(node) { - if (node.body.type !== "BlockStatement") { - blockIndentationCheck(node); - } - } - - /** - * Returns the expected indentation for the case statement - * @param {ASTNode} node node to examine - * @param {int} [providedSwitchIndent] indent for switch statement - * @returns {int} indent size - */ - function expectedCaseIndent(node, providedSwitchIndent) { - const switchNode = (node.type === "SwitchStatement") ? node : node.parent; - const switchIndent = typeof providedSwitchIndent === "undefined" - ? getNodeIndent(switchNode).goodChar - : providedSwitchIndent; - let caseIndent; - - if (caseIndentStore[switchNode.loc.start.line]) { - return caseIndentStore[switchNode.loc.start.line]; - } - - if (switchNode.cases.length > 0 && options.SwitchCase === 0) { - caseIndent = switchIndent; - } else { - caseIndent = switchIndent + (indentSize * options.SwitchCase); - } - - caseIndentStore[switchNode.loc.start.line] = caseIndent; - return caseIndent; - - } - - /** - * Checks whether a return statement is wrapped in () - * @param {ASTNode} node node to examine - * @returns {boolean} the result - */ - function isWrappedInParenthesis(node) { - const regex = /^return\s*?\(\s*?\);*?/u; - - const statementWithoutArgument = sourceCode.getText(node).replace( - sourceCode.getText(node.argument), "" - ); - - return regex.test(statementWithoutArgument); - } - - return { - Program(node) { - if (node.body.length > 0) { - - // Root nodes should have no indent - checkNodesIndent(node.body, getNodeIndent(node).goodChar); - } - }, - - ClassBody: blockIndentationCheck, - - BlockStatement: blockIndentationCheck, - - WhileStatement: blockLessNodes, - - ForStatement: blockLessNodes, - - ForInStatement: blockLessNodes, - - ForOfStatement: blockLessNodes, - - DoWhileStatement: blockLessNodes, - - IfStatement(node) { - if (node.consequent.type !== "BlockStatement" && node.consequent.loc.start.line > node.loc.start.line) { - blockIndentationCheck(node); - } - }, - - VariableDeclaration(node) { - if (node.declarations[node.declarations.length - 1].loc.start.line > node.declarations[0].loc.start.line) { - checkIndentInVariableDeclarations(node); - } - }, - - ObjectExpression(node) { - checkIndentInArrayOrObjectBlock(node); - }, - - ArrayExpression(node) { - checkIndentInArrayOrObjectBlock(node); - }, - - MemberExpression(node) { - - if (typeof options.MemberExpression === "undefined") { - return; - } - - if (isSingleLineNode(node)) { - return; - } - - /* - * The typical layout of variable declarations and assignments - * alter the expectation of correct indentation. Skip them. - * TODO: Add appropriate configuration options for variable - * declarations and assignments. - */ - if (getParentNodeByType(node, "VariableDeclarator", ["FunctionExpression", "ArrowFunctionExpression"])) { - return; - } - - if (getParentNodeByType(node, "AssignmentExpression", ["FunctionExpression"])) { - return; - } - - const propertyIndent = getNodeIndent(node).goodChar + indentSize * options.MemberExpression; - - const checkNodes = [node.property]; - - const dot = sourceCode.getTokenBefore(node.property); - - if (dot.type === "Punctuator" && dot.value === ".") { - checkNodes.push(dot); - } - - checkNodesIndent(checkNodes, propertyIndent); - }, - - SwitchStatement(node) { - - // Switch is not a 'BlockStatement' - const switchIndent = getNodeIndent(node).goodChar; - const caseIndent = expectedCaseIndent(node, switchIndent); - - checkNodesIndent(node.cases, caseIndent); - - - checkLastNodeLineIndent(node, switchIndent); - }, - - SwitchCase(node) { - - // Skip inline cases - if (isSingleLineNode(node)) { - return; - } - const caseIndent = expectedCaseIndent(node); - - checkNodesIndent(node.consequent, caseIndent + indentSize); - }, - - FunctionDeclaration(node) { - if (isSingleLineNode(node)) { - return; - } - if (options.FunctionDeclaration.parameters === "first" && node.params.length) { - checkNodesIndent(node.params.slice(1), node.params[0].loc.start.column); - } else if (options.FunctionDeclaration.parameters !== null) { - checkNodesIndent(node.params, getNodeIndent(node).goodChar + indentSize * options.FunctionDeclaration.parameters); - } - }, - - FunctionExpression(node) { - if (isSingleLineNode(node)) { - return; - } - if (options.FunctionExpression.parameters === "first" && node.params.length) { - checkNodesIndent(node.params.slice(1), node.params[0].loc.start.column); - } else if (options.FunctionExpression.parameters !== null) { - checkNodesIndent(node.params, getNodeIndent(node).goodChar + indentSize * options.FunctionExpression.parameters); - } - }, - - ReturnStatement(node) { - if (isSingleLineNode(node)) { - return; - } - - const firstLineIndent = getNodeIndent(node).goodChar; - - // in case if return statement is wrapped in parenthesis - if (isWrappedInParenthesis(node)) { - checkLastReturnStatementLineIndent(node, firstLineIndent); - } else { - checkNodeIndent(node, firstLineIndent); - } - }, - - CallExpression(node) { - if (isSingleLineNode(node)) { - return; - } - if (options.CallExpression.arguments === "first" && node.arguments.length) { - checkNodesIndent(node.arguments.slice(1), node.arguments[0].loc.start.column); - } else if (options.CallExpression.arguments !== null) { - checkNodesIndent(node.arguments, getNodeIndent(node).goodChar + indentSize * options.CallExpression.arguments); - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/indent.js b/node_modules/eslint/lib/rules/indent.js deleted file mode 100644 index bcc5143d2..000000000 --- a/node_modules/eslint/lib/rules/indent.js +++ /dev/null @@ -1,1788 +0,0 @@ -/** - * @fileoverview This rule sets a specific indentation style and width for your code - * - * @author Teddy Katz - * @author Vitaly Puzrin - * @author Gyandeep Singh - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const KNOWN_NODES = new Set([ - "AssignmentExpression", - "AssignmentPattern", - "ArrayExpression", - "ArrayPattern", - "ArrowFunctionExpression", - "AwaitExpression", - "BlockStatement", - "BinaryExpression", - "BreakStatement", - "CallExpression", - "CatchClause", - "ChainExpression", - "ClassBody", - "ClassDeclaration", - "ClassExpression", - "ConditionalExpression", - "ContinueStatement", - "DoWhileStatement", - "DebuggerStatement", - "EmptyStatement", - "ExperimentalRestProperty", - "ExperimentalSpreadProperty", - "ExpressionStatement", - "ForStatement", - "ForInStatement", - "ForOfStatement", - "FunctionDeclaration", - "FunctionExpression", - "Identifier", - "IfStatement", - "Literal", - "LabeledStatement", - "LogicalExpression", - "MemberExpression", - "MetaProperty", - "MethodDefinition", - "NewExpression", - "ObjectExpression", - "ObjectPattern", - "PrivateIdentifier", - "Program", - "Property", - "PropertyDefinition", - "RestElement", - "ReturnStatement", - "SequenceExpression", - "SpreadElement", - "StaticBlock", - "Super", - "SwitchCase", - "SwitchStatement", - "TaggedTemplateExpression", - "TemplateElement", - "TemplateLiteral", - "ThisExpression", - "ThrowStatement", - "TryStatement", - "UnaryExpression", - "UpdateExpression", - "VariableDeclaration", - "VariableDeclarator", - "WhileStatement", - "WithStatement", - "YieldExpression", - "JSXFragment", - "JSXOpeningFragment", - "JSXClosingFragment", - "JSXIdentifier", - "JSXNamespacedName", - "JSXMemberExpression", - "JSXEmptyExpression", - "JSXExpressionContainer", - "JSXElement", - "JSXClosingElement", - "JSXOpeningElement", - "JSXAttribute", - "JSXSpreadAttribute", - "JSXText", - "ExportDefaultDeclaration", - "ExportNamedDeclaration", - "ExportAllDeclaration", - "ExportSpecifier", - "ImportDeclaration", - "ImportSpecifier", - "ImportDefaultSpecifier", - "ImportNamespaceSpecifier", - "ImportExpression" -]); - -/* - * General rule strategy: - * 1. An OffsetStorage instance stores a map of desired offsets, where each token has a specified offset from another - * specified token or to the first column. - * 2. As the AST is traversed, modify the desired offsets of tokens accordingly. For example, when entering a - * BlockStatement, offset all of the tokens in the BlockStatement by 1 indent level from the opening curly - * brace of the BlockStatement. - * 3. After traversing the AST, calculate the expected indentation levels of every token according to the - * OffsetStorage container. - * 4. For each line, compare the expected indentation of the first token to the actual indentation in the file, - * and report the token if the two values are not equal. - */ - - -/** - * A mutable map that stores (key, value) pairs. The keys are numeric indices, and must be unique. - * This is intended to be a generic wrapper around a map with non-negative integer keys, so that the underlying implementation - * can easily be swapped out. - */ -class IndexMap { - - /** - * Creates an empty map - * @param {number} maxKey The maximum key - */ - constructor(maxKey) { - - // Initializing the array with the maximum expected size avoids dynamic reallocations that could degrade performance. - this._values = Array(maxKey + 1); - } - - /** - * Inserts an entry into the map. - * @param {number} key The entry's key - * @param {any} value The entry's value - * @returns {void} - */ - insert(key, value) { - this._values[key] = value; - } - - /** - * Finds the value of the entry with the largest key less than or equal to the provided key - * @param {number} key The provided key - * @returns {*|undefined} The value of the found entry, or undefined if no such entry exists. - */ - findLastNotAfter(key) { - const values = this._values; - - for (let index = key; index >= 0; index--) { - const value = values[index]; - - if (value) { - return value; - } - } - return void 0; - } - - /** - * Deletes all of the keys in the interval [start, end) - * @param {number} start The start of the range - * @param {number} end The end of the range - * @returns {void} - */ - deleteRange(start, end) { - this._values.fill(void 0, start, end); - } -} - -/** - * A helper class to get token-based info related to indentation - */ -class TokenInfo { - - /** - * @param {SourceCode} sourceCode A SourceCode object - */ - constructor(sourceCode) { - this.sourceCode = sourceCode; - this.firstTokensByLineNumber = sourceCode.tokensAndComments.reduce((map, token) => { - if (!map.has(token.loc.start.line)) { - map.set(token.loc.start.line, token); - } - if (!map.has(token.loc.end.line) && sourceCode.text.slice(token.range[1] - token.loc.end.column, token.range[1]).trim()) { - map.set(token.loc.end.line, token); - } - return map; - }, new Map()); - } - - /** - * Gets the first token on a given token's line - * @param {Token|ASTNode} token a node or token - * @returns {Token} The first token on the given line - */ - getFirstTokenOfLine(token) { - return this.firstTokensByLineNumber.get(token.loc.start.line); - } - - /** - * Determines whether a token is the first token in its line - * @param {Token} token The token - * @returns {boolean} `true` if the token is the first on its line - */ - isFirstTokenOfLine(token) { - return this.getFirstTokenOfLine(token) === token; - } - - /** - * Get the actual indent of a token - * @param {Token} token Token to examine. This should be the first token on its line. - * @returns {string} The indentation characters that precede the token - */ - getTokenIndent(token) { - return this.sourceCode.text.slice(token.range[0] - token.loc.start.column, token.range[0]); - } -} - -/** - * A class to store information on desired offsets of tokens from each other - */ -class OffsetStorage { - - /** - * @param {TokenInfo} tokenInfo a TokenInfo instance - * @param {number} indentSize The desired size of each indentation level - * @param {string} indentType The indentation character - * @param {number} maxIndex The maximum end index of any token - */ - constructor(tokenInfo, indentSize, indentType, maxIndex) { - this._tokenInfo = tokenInfo; - this._indentSize = indentSize; - this._indentType = indentType; - - this._indexMap = new IndexMap(maxIndex); - this._indexMap.insert(0, { offset: 0, from: null, force: false }); - - this._lockedFirstTokens = new WeakMap(); - this._desiredIndentCache = new WeakMap(); - this._ignoredTokens = new WeakSet(); - } - - _getOffsetDescriptor(token) { - return this._indexMap.findLastNotAfter(token.range[0]); - } - - /** - * Sets the offset column of token B to match the offset column of token A. - * - **WARNING**: This matches a *column*, even if baseToken is not the first token on its line. In - * most cases, `setDesiredOffset` should be used instead. - * @param {Token} baseToken The first token - * @param {Token} offsetToken The second token, whose offset should be matched to the first token - * @returns {void} - */ - matchOffsetOf(baseToken, offsetToken) { - - /* - * lockedFirstTokens is a map from a token whose indentation is controlled by the "first" option to - * the token that it depends on. For example, with the `ArrayExpression: first` option, the first - * token of each element in the array after the first will be mapped to the first token of the first - * element. The desired indentation of each of these tokens is computed based on the desired indentation - * of the "first" element, rather than through the normal offset mechanism. - */ - this._lockedFirstTokens.set(offsetToken, baseToken); - } - - /** - * Sets the desired offset of a token. - * - * This uses a line-based offset collapsing behavior to handle tokens on the same line. - * For example, consider the following two cases: - * - * ( - * [ - * bar - * ] - * ) - * - * ([ - * bar - * ]) - * - * Based on the first case, it's clear that the `bar` token needs to have an offset of 1 indent level (4 spaces) from - * the `[` token, and the `[` token has to have an offset of 1 indent level from the `(` token. Since the `(` token is - * the first on its line (with an indent of 0 spaces), the `bar` token needs to be offset by 2 indent levels (8 spaces) - * from the start of its line. - * - * However, in the second case `bar` should only be indented by 4 spaces. This is because the offset of 1 indent level - * between the `(` and the `[` tokens gets "collapsed" because the two tokens are on the same line. As a result, the - * `(` token is mapped to the `[` token with an offset of 0, and the rule correctly decides that `bar` should be indented - * by 1 indent level from the start of the line. - * - * This is useful because rule listeners can usually just call `setDesiredOffset` for all the tokens in the node, - * without needing to check which lines those tokens are on. - * - * Note that since collapsing only occurs when two tokens are on the same line, there are a few cases where non-intuitive - * behavior can occur. For example, consider the following cases: - * - * foo( - * ). - * bar( - * baz - * ) - * - * foo( - * ).bar( - * baz - * ) - * - * Based on the first example, it would seem that `bar` should be offset by 1 indent level from `foo`, and `baz` - * should be offset by 1 indent level from `bar`. However, this is not correct, because it would result in `baz` - * being indented by 2 indent levels in the second case (since `foo`, `bar`, and `baz` are all on separate lines, no - * collapsing would occur). - * - * Instead, the correct way would be to offset `baz` by 1 level from `bar`, offset `bar` by 1 level from the `)`, and - * offset the `)` by 0 levels from `foo`. This ensures that the offset between `bar` and the `)` are correctly collapsed - * in the second case. - * @param {Token} token The token - * @param {Token} fromToken The token that `token` should be offset from - * @param {number} offset The desired indent level - * @returns {void} - */ - setDesiredOffset(token, fromToken, offset) { - return this.setDesiredOffsets(token.range, fromToken, offset); - } - - /** - * Sets the desired offset of all tokens in a range - * It's common for node listeners in this file to need to apply the same offset to a large, contiguous range of tokens. - * Moreover, the offset of any given token is usually updated multiple times (roughly once for each node that contains - * it). This means that the offset of each token is updated O(AST depth) times. - * It would not be performant to store and update the offsets for each token independently, because the rule would end - * up having a time complexity of O(number of tokens * AST depth), which is quite slow for large files. - * - * Instead, the offset tree is represented as a collection of contiguous offset ranges in a file. For example, the following - * list could represent the state of the offset tree at a given point: - * - * - Tokens starting in the interval [0, 15) are aligned with the beginning of the file - * - Tokens starting in the interval [15, 30) are offset by 1 indent level from the `bar` token - * - Tokens starting in the interval [30, 43) are offset by 1 indent level from the `foo` token - * - Tokens starting in the interval [43, 820) are offset by 2 indent levels from the `bar` token - * - Tokens starting in the interval [820, ∞) are offset by 1 indent level from the `baz` token - * - * The `setDesiredOffsets` methods inserts ranges like the ones above. The third line above would be inserted by using: - * `setDesiredOffsets([30, 43], fooToken, 1);` - * @param {[number, number]} range A [start, end] pair. All tokens with range[0] <= token.start < range[1] will have the offset applied. - * @param {Token} fromToken The token that this is offset from - * @param {number} offset The desired indent level - * @param {boolean} force `true` if this offset should not use the normal collapsing behavior. This should almost always be false. - * @returns {void} - */ - setDesiredOffsets(range, fromToken, offset, force) { - - /* - * Offset ranges are stored as a collection of nodes, where each node maps a numeric key to an offset - * descriptor. The tree for the example above would have the following nodes: - * - * * key: 0, value: { offset: 0, from: null } - * * key: 15, value: { offset: 1, from: barToken } - * * key: 30, value: { offset: 1, from: fooToken } - * * key: 43, value: { offset: 2, from: barToken } - * * key: 820, value: { offset: 1, from: bazToken } - * - * To find the offset descriptor for any given token, one needs to find the node with the largest key - * which is <= token.start. To make this operation fast, the nodes are stored in a map indexed by key. - */ - - const descriptorToInsert = { offset, from: fromToken, force }; - - const descriptorAfterRange = this._indexMap.findLastNotAfter(range[1]); - - const fromTokenIsInRange = fromToken && fromToken.range[0] >= range[0] && fromToken.range[1] <= range[1]; - const fromTokenDescriptor = fromTokenIsInRange && this._getOffsetDescriptor(fromToken); - - // First, remove any existing nodes in the range from the map. - this._indexMap.deleteRange(range[0] + 1, range[1]); - - // Insert a new node into the map for this range - this._indexMap.insert(range[0], descriptorToInsert); - - /* - * To avoid circular offset dependencies, keep the `fromToken` token mapped to whatever it was mapped to previously, - * even if it's in the current range. - */ - if (fromTokenIsInRange) { - this._indexMap.insert(fromToken.range[0], fromTokenDescriptor); - this._indexMap.insert(fromToken.range[1], descriptorToInsert); - } - - /* - * To avoid modifying the offset of tokens after the range, insert another node to keep the offset of the following - * tokens the same as it was before. - */ - this._indexMap.insert(range[1], descriptorAfterRange); - } - - /** - * Gets the desired indent of a token - * @param {Token} token The token - * @returns {string} The desired indent of the token - */ - getDesiredIndent(token) { - if (!this._desiredIndentCache.has(token)) { - - if (this._ignoredTokens.has(token)) { - - /* - * If the token is ignored, use the actual indent of the token as the desired indent. - * This ensures that no errors are reported for this token. - */ - this._desiredIndentCache.set( - token, - this._tokenInfo.getTokenIndent(token) - ); - } else if (this._lockedFirstTokens.has(token)) { - const firstToken = this._lockedFirstTokens.get(token); - - this._desiredIndentCache.set( - token, - - // (indentation for the first element's line) - this.getDesiredIndent(this._tokenInfo.getFirstTokenOfLine(firstToken)) + - - // (space between the start of the first element's line and the first element) - this._indentType.repeat(firstToken.loc.start.column - this._tokenInfo.getFirstTokenOfLine(firstToken).loc.start.column) - ); - } else { - const offsetInfo = this._getOffsetDescriptor(token); - const offset = ( - offsetInfo.from && - offsetInfo.from.loc.start.line === token.loc.start.line && - !/^\s*?\n/u.test(token.value) && - !offsetInfo.force - ) ? 0 : offsetInfo.offset * this._indentSize; - - this._desiredIndentCache.set( - token, - (offsetInfo.from ? this.getDesiredIndent(offsetInfo.from) : "") + this._indentType.repeat(offset) - ); - } - } - return this._desiredIndentCache.get(token); - } - - /** - * Ignores a token, preventing it from being reported. - * @param {Token} token The token - * @returns {void} - */ - ignoreToken(token) { - if (this._tokenInfo.isFirstTokenOfLine(token)) { - this._ignoredTokens.add(token); - } - } - - /** - * Gets the first token that the given token's indentation is dependent on - * @param {Token} token The token - * @returns {Token} The token that the given token depends on, or `null` if the given token is at the top level - */ - getFirstDependency(token) { - return this._getOffsetDescriptor(token).from; - } -} - -const ELEMENT_LIST_SCHEMA = { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - enum: ["first", "off"] - } - ] -}; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent indentation", - recommended: false, - url: "https://eslint.org/docs/latest/rules/indent" - }, - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - { - enum: ["tab"] - }, - { - type: "integer", - minimum: 0 - } - ] - }, - { - type: "object", - properties: { - SwitchCase: { - type: "integer", - minimum: 0, - default: 0 - }, - VariableDeclarator: { - oneOf: [ - ELEMENT_LIST_SCHEMA, - { - type: "object", - properties: { - var: ELEMENT_LIST_SCHEMA, - let: ELEMENT_LIST_SCHEMA, - const: ELEMENT_LIST_SCHEMA - }, - additionalProperties: false - } - ] - }, - outerIIFEBody: { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - enum: ["off"] - } - ] - }, - MemberExpression: { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - enum: ["off"] - } - ] - }, - FunctionDeclaration: { - type: "object", - properties: { - parameters: ELEMENT_LIST_SCHEMA, - body: { - type: "integer", - minimum: 0 - } - }, - additionalProperties: false - }, - FunctionExpression: { - type: "object", - properties: { - parameters: ELEMENT_LIST_SCHEMA, - body: { - type: "integer", - minimum: 0 - } - }, - additionalProperties: false - }, - StaticBlock: { - type: "object", - properties: { - body: { - type: "integer", - minimum: 0 - } - }, - additionalProperties: false - }, - CallExpression: { - type: "object", - properties: { - arguments: ELEMENT_LIST_SCHEMA - }, - additionalProperties: false - }, - ArrayExpression: ELEMENT_LIST_SCHEMA, - ObjectExpression: ELEMENT_LIST_SCHEMA, - ImportDeclaration: ELEMENT_LIST_SCHEMA, - flatTernaryExpressions: { - type: "boolean", - default: false - }, - offsetTernaryExpressions: { - type: "boolean", - default: false - }, - ignoredNodes: { - type: "array", - items: { - type: "string", - not: { - pattern: ":exit$" - } - } - }, - ignoreComments: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - messages: { - wrongIndentation: "Expected indentation of {{expected}} but found {{actual}}." - } - }, - - create(context) { - const DEFAULT_VARIABLE_INDENT = 1; - const DEFAULT_PARAMETER_INDENT = 1; - const DEFAULT_FUNCTION_BODY_INDENT = 1; - - let indentType = "space"; - let indentSize = 4; - const options = { - SwitchCase: 0, - VariableDeclarator: { - var: DEFAULT_VARIABLE_INDENT, - let: DEFAULT_VARIABLE_INDENT, - const: DEFAULT_VARIABLE_INDENT - }, - outerIIFEBody: 1, - FunctionDeclaration: { - parameters: DEFAULT_PARAMETER_INDENT, - body: DEFAULT_FUNCTION_BODY_INDENT - }, - FunctionExpression: { - parameters: DEFAULT_PARAMETER_INDENT, - body: DEFAULT_FUNCTION_BODY_INDENT - }, - StaticBlock: { - body: DEFAULT_FUNCTION_BODY_INDENT - }, - CallExpression: { - arguments: DEFAULT_PARAMETER_INDENT - }, - MemberExpression: 1, - ArrayExpression: 1, - ObjectExpression: 1, - ImportDeclaration: 1, - flatTernaryExpressions: false, - ignoredNodes: [], - ignoreComments: false - }; - - if (context.options.length) { - if (context.options[0] === "tab") { - indentSize = 1; - indentType = "tab"; - } else { - indentSize = context.options[0]; - indentType = "space"; - } - - if (context.options[1]) { - Object.assign(options, context.options[1]); - - if (typeof options.VariableDeclarator === "number" || options.VariableDeclarator === "first") { - options.VariableDeclarator = { - var: options.VariableDeclarator, - let: options.VariableDeclarator, - const: options.VariableDeclarator - }; - } - } - } - - const sourceCode = context.sourceCode; - const tokenInfo = new TokenInfo(sourceCode); - const offsets = new OffsetStorage(tokenInfo, indentSize, indentType === "space" ? " " : "\t", sourceCode.text.length); - const parameterParens = new WeakSet(); - - /** - * Creates an error message for a line, given the expected/actual indentation. - * @param {int} expectedAmount The expected amount of indentation characters for this line - * @param {int} actualSpaces The actual number of indentation spaces that were found on this line - * @param {int} actualTabs The actual number of indentation tabs that were found on this line - * @returns {string} An error message for this line - */ - function createErrorMessageData(expectedAmount, actualSpaces, actualTabs) { - const expectedStatement = `${expectedAmount} ${indentType}${expectedAmount === 1 ? "" : "s"}`; // e.g. "2 tabs" - const foundSpacesWord = `space${actualSpaces === 1 ? "" : "s"}`; // e.g. "space" - const foundTabsWord = `tab${actualTabs === 1 ? "" : "s"}`; // e.g. "tabs" - let foundStatement; - - if (actualSpaces > 0) { - - /* - * Abbreviate the message if the expected indentation is also spaces. - * e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' - */ - foundStatement = indentType === "space" ? actualSpaces : `${actualSpaces} ${foundSpacesWord}`; - } else if (actualTabs > 0) { - foundStatement = indentType === "tab" ? actualTabs : `${actualTabs} ${foundTabsWord}`; - } else { - foundStatement = "0"; - } - return { - expected: expectedStatement, - actual: foundStatement - }; - } - - /** - * Reports a given indent violation - * @param {Token} token Token violating the indent rule - * @param {string} neededIndent Expected indentation string - * @returns {void} - */ - function report(token, neededIndent) { - const actualIndent = Array.from(tokenInfo.getTokenIndent(token)); - const numSpaces = actualIndent.filter(char => char === " ").length; - const numTabs = actualIndent.filter(char => char === "\t").length; - - context.report({ - node: token, - messageId: "wrongIndentation", - data: createErrorMessageData(neededIndent.length, numSpaces, numTabs), - loc: { - start: { line: token.loc.start.line, column: 0 }, - end: { line: token.loc.start.line, column: token.loc.start.column } - }, - fix(fixer) { - const range = [token.range[0] - token.loc.start.column, token.range[0]]; - const newText = neededIndent; - - return fixer.replaceTextRange(range, newText); - } - }); - } - - /** - * Checks if a token's indentation is correct - * @param {Token} token Token to examine - * @param {string} desiredIndent Desired indentation of the string - * @returns {boolean} `true` if the token's indentation is correct - */ - function validateTokenIndent(token, desiredIndent) { - const indentation = tokenInfo.getTokenIndent(token); - - return indentation === desiredIndent || - - // To avoid conflicts with no-mixed-spaces-and-tabs, don't report mixed spaces and tabs. - indentation.includes(" ") && indentation.includes("\t"); - } - - /** - * Check to see if the node is a file level IIFE - * @param {ASTNode} node The function node to check. - * @returns {boolean} True if the node is the outer IIFE - */ - function isOuterIIFE(node) { - - /* - * Verify that the node is an IIFE - */ - if (!node.parent || node.parent.type !== "CallExpression" || node.parent.callee !== node) { - return false; - } - - /* - * Navigate legal ancestors to determine whether this IIFE is outer. - * A "legal ancestor" is an expression or statement that causes the function to get executed immediately. - * For example, `!(function(){})()` is an outer IIFE even though it is preceded by a ! operator. - */ - let statement = node.parent && node.parent.parent; - - while ( - statement.type === "UnaryExpression" && ["!", "~", "+", "-"].includes(statement.operator) || - statement.type === "AssignmentExpression" || - statement.type === "LogicalExpression" || - statement.type === "SequenceExpression" || - statement.type === "VariableDeclarator" - ) { - statement = statement.parent; - } - - return (statement.type === "ExpressionStatement" || statement.type === "VariableDeclaration") && statement.parent.type === "Program"; - } - - /** - * Counts the number of linebreaks that follow the last non-whitespace character in a string - * @param {string} string The string to check - * @returns {number} The number of JavaScript linebreaks that follow the last non-whitespace character, - * or the total number of linebreaks if the string is all whitespace. - */ - function countTrailingLinebreaks(string) { - const trailingWhitespace = string.match(/\s*$/u)[0]; - const linebreakMatches = trailingWhitespace.match(astUtils.createGlobalLinebreakMatcher()); - - return linebreakMatches === null ? 0 : linebreakMatches.length; - } - - /** - * Check indentation for lists of elements (arrays, objects, function params) - * @param {ASTNode[]} elements List of elements that should be offset - * @param {Token} startToken The start token of the list that element should be aligned against, e.g. '[' - * @param {Token} endToken The end token of the list, e.g. ']' - * @param {number|string} offset The amount that the elements should be offset - * @returns {void} - */ - function addElementListIndent(elements, startToken, endToken, offset) { - - /** - * Gets the first token of a given element, including surrounding parentheses. - * @param {ASTNode} element A node in the `elements` list - * @returns {Token} The first token of this element - */ - function getFirstToken(element) { - let token = sourceCode.getTokenBefore(element); - - while (astUtils.isOpeningParenToken(token) && token !== startToken) { - token = sourceCode.getTokenBefore(token); - } - return sourceCode.getTokenAfter(token); - } - - // Run through all the tokens in the list, and offset them by one indent level (mainly for comments, other things will end up overridden) - offsets.setDesiredOffsets( - [startToken.range[1], endToken.range[0]], - startToken, - typeof offset === "number" ? offset : 1 - ); - offsets.setDesiredOffset(endToken, startToken, 0); - - // If the preference is "first" but there is no first element (e.g. sparse arrays w/ empty first slot), fall back to 1 level. - if (offset === "first" && elements.length && !elements[0]) { - return; - } - elements.forEach((element, index) => { - if (!element) { - - // Skip holes in arrays - return; - } - if (offset === "off") { - - // Ignore the first token of every element if the "off" option is used - offsets.ignoreToken(getFirstToken(element)); - } - - // Offset the following elements correctly relative to the first element - if (index === 0) { - return; - } - if (offset === "first" && tokenInfo.isFirstTokenOfLine(getFirstToken(element))) { - offsets.matchOffsetOf(getFirstToken(elements[0]), getFirstToken(element)); - } else { - const previousElement = elements[index - 1]; - const firstTokenOfPreviousElement = previousElement && getFirstToken(previousElement); - const previousElementLastToken = previousElement && sourceCode.getLastToken(previousElement); - - if ( - previousElement && - previousElementLastToken.loc.end.line - countTrailingLinebreaks(previousElementLastToken.value) > startToken.loc.end.line - ) { - offsets.setDesiredOffsets( - [previousElement.range[1], element.range[1]], - firstTokenOfPreviousElement, - 0 - ); - } - } - }); - } - - /** - * Check and decide whether to check for indentation for blockless nodes - * Scenarios are for or while statements without braces around them - * @param {ASTNode} node node to examine - * @returns {void} - */ - function addBlocklessNodeIndent(node) { - if (node.type !== "BlockStatement") { - const lastParentToken = sourceCode.getTokenBefore(node, astUtils.isNotOpeningParenToken); - - let firstBodyToken = sourceCode.getFirstToken(node); - let lastBodyToken = sourceCode.getLastToken(node); - - while ( - astUtils.isOpeningParenToken(sourceCode.getTokenBefore(firstBodyToken)) && - astUtils.isClosingParenToken(sourceCode.getTokenAfter(lastBodyToken)) - ) { - firstBodyToken = sourceCode.getTokenBefore(firstBodyToken); - lastBodyToken = sourceCode.getTokenAfter(lastBodyToken); - } - - offsets.setDesiredOffsets([firstBodyToken.range[0], lastBodyToken.range[1]], lastParentToken, 1); - } - } - - /** - * Checks the indentation for nodes that are like function calls (`CallExpression` and `NewExpression`) - * @param {ASTNode} node A CallExpression or NewExpression node - * @returns {void} - */ - function addFunctionCallIndent(node) { - let openingParen; - - if (node.arguments.length) { - openingParen = sourceCode.getFirstTokenBetween(node.callee, node.arguments[0], astUtils.isOpeningParenToken); - } else { - openingParen = sourceCode.getLastToken(node, 1); - } - const closingParen = sourceCode.getLastToken(node); - - parameterParens.add(openingParen); - parameterParens.add(closingParen); - - /* - * If `?.` token exists, set desired offset for that. - * This logic is copied from `MemberExpression`'s. - */ - if (node.optional) { - const dotToken = sourceCode.getTokenAfter(node.callee, astUtils.isQuestionDotToken); - const calleeParenCount = sourceCode.getTokensBetween(node.callee, dotToken, { filter: astUtils.isClosingParenToken }).length; - const firstTokenOfCallee = calleeParenCount - ? sourceCode.getTokenBefore(node.callee, { skip: calleeParenCount - 1 }) - : sourceCode.getFirstToken(node.callee); - const lastTokenOfCallee = sourceCode.getTokenBefore(dotToken); - const offsetBase = lastTokenOfCallee.loc.end.line === openingParen.loc.start.line - ? lastTokenOfCallee - : firstTokenOfCallee; - - offsets.setDesiredOffset(dotToken, offsetBase, 1); - } - - const offsetAfterToken = node.callee.type === "TaggedTemplateExpression" ? sourceCode.getFirstToken(node.callee.quasi) : openingParen; - const offsetToken = sourceCode.getTokenBefore(offsetAfterToken); - - offsets.setDesiredOffset(openingParen, offsetToken, 0); - - addElementListIndent(node.arguments, openingParen, closingParen, options.CallExpression.arguments); - } - - /** - * Checks the indentation of parenthesized values, given a list of tokens in a program - * @param {Token[]} tokens A list of tokens - * @returns {void} - */ - function addParensIndent(tokens) { - const parenStack = []; - const parenPairs = []; - - tokens.forEach(nextToken => { - - // Accumulate a list of parenthesis pairs - if (astUtils.isOpeningParenToken(nextToken)) { - parenStack.push(nextToken); - } else if (astUtils.isClosingParenToken(nextToken)) { - parenPairs.unshift({ left: parenStack.pop(), right: nextToken }); - } - }); - - parenPairs.forEach(pair => { - const leftParen = pair.left; - const rightParen = pair.right; - - // We only want to handle parens around expressions, so exclude parentheses that are in function parameters and function call arguments. - if (!parameterParens.has(leftParen) && !parameterParens.has(rightParen)) { - const parenthesizedTokens = new Set(sourceCode.getTokensBetween(leftParen, rightParen)); - - parenthesizedTokens.forEach(token => { - if (!parenthesizedTokens.has(offsets.getFirstDependency(token))) { - offsets.setDesiredOffset(token, leftParen, 1); - } - }); - } - - offsets.setDesiredOffset(rightParen, leftParen, 0); - }); - } - - /** - * Ignore all tokens within an unknown node whose offset do not depend - * on another token's offset within the unknown node - * @param {ASTNode} node Unknown Node - * @returns {void} - */ - function ignoreNode(node) { - const unknownNodeTokens = new Set(sourceCode.getTokens(node, { includeComments: true })); - - unknownNodeTokens.forEach(token => { - if (!unknownNodeTokens.has(offsets.getFirstDependency(token))) { - const firstTokenOfLine = tokenInfo.getFirstTokenOfLine(token); - - if (token === firstTokenOfLine) { - offsets.ignoreToken(token); - } else { - offsets.setDesiredOffset(token, firstTokenOfLine, 0); - } - } - }); - } - - /** - * Check whether the given token is on the first line of a statement. - * @param {Token} token The token to check. - * @param {ASTNode} leafNode The expression node that the token belongs directly. - * @returns {boolean} `true` if the token is on the first line of a statement. - */ - function isOnFirstLineOfStatement(token, leafNode) { - let node = leafNode; - - while (node.parent && !node.parent.type.endsWith("Statement") && !node.parent.type.endsWith("Declaration")) { - node = node.parent; - } - node = node.parent; - - return !node || node.loc.start.line === token.loc.start.line; - } - - /** - * Check whether there are any blank (whitespace-only) lines between - * two tokens on separate lines. - * @param {Token} firstToken The first token. - * @param {Token} secondToken The second token. - * @returns {boolean} `true` if the tokens are on separate lines and - * there exists a blank line between them, `false` otherwise. - */ - function hasBlankLinesBetween(firstToken, secondToken) { - const firstTokenLine = firstToken.loc.end.line; - const secondTokenLine = secondToken.loc.start.line; - - if (firstTokenLine === secondTokenLine || firstTokenLine === secondTokenLine - 1) { - return false; - } - - for (let line = firstTokenLine + 1; line < secondTokenLine; ++line) { - if (!tokenInfo.firstTokensByLineNumber.has(line)) { - return true; - } - } - - return false; - } - - const ignoredNodeFirstTokens = new Set(); - - const baseOffsetListeners = { - "ArrayExpression, ArrayPattern"(node) { - const openingBracket = sourceCode.getFirstToken(node); - const closingBracket = sourceCode.getTokenAfter([...node.elements].reverse().find(_ => _) || openingBracket, astUtils.isClosingBracketToken); - - addElementListIndent(node.elements, openingBracket, closingBracket, options.ArrayExpression); - }, - - "ObjectExpression, ObjectPattern"(node) { - const openingCurly = sourceCode.getFirstToken(node); - const closingCurly = sourceCode.getTokenAfter( - node.properties.length ? node.properties[node.properties.length - 1] : openingCurly, - astUtils.isClosingBraceToken - ); - - addElementListIndent(node.properties, openingCurly, closingCurly, options.ObjectExpression); - }, - - ArrowFunctionExpression(node) { - const maybeOpeningParen = sourceCode.getFirstToken(node, { skip: node.async ? 1 : 0 }); - - if (astUtils.isOpeningParenToken(maybeOpeningParen)) { - const openingParen = maybeOpeningParen; - const closingParen = sourceCode.getTokenBefore(node.body, astUtils.isClosingParenToken); - - parameterParens.add(openingParen); - parameterParens.add(closingParen); - addElementListIndent(node.params, openingParen, closingParen, options.FunctionExpression.parameters); - } - - addBlocklessNodeIndent(node.body); - }, - - AssignmentExpression(node) { - const operator = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); - - offsets.setDesiredOffsets([operator.range[0], node.range[1]], sourceCode.getLastToken(node.left), 1); - offsets.ignoreToken(operator); - offsets.ignoreToken(sourceCode.getTokenAfter(operator)); - }, - - "BinaryExpression, LogicalExpression"(node) { - const operator = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); - - /* - * For backwards compatibility, don't check BinaryExpression indents, e.g. - * var foo = bar && - * baz; - */ - - const tokenAfterOperator = sourceCode.getTokenAfter(operator); - - offsets.ignoreToken(operator); - offsets.ignoreToken(tokenAfterOperator); - offsets.setDesiredOffset(tokenAfterOperator, operator, 0); - }, - - "BlockStatement, ClassBody"(node) { - let blockIndentLevel; - - if (node.parent && isOuterIIFE(node.parent)) { - blockIndentLevel = options.outerIIFEBody; - } else if (node.parent && (node.parent.type === "FunctionExpression" || node.parent.type === "ArrowFunctionExpression")) { - blockIndentLevel = options.FunctionExpression.body; - } else if (node.parent && node.parent.type === "FunctionDeclaration") { - blockIndentLevel = options.FunctionDeclaration.body; - } else { - blockIndentLevel = 1; - } - - /* - * For blocks that aren't lone statements, ensure that the opening curly brace - * is aligned with the parent. - */ - if (!astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type)) { - offsets.setDesiredOffset(sourceCode.getFirstToken(node), sourceCode.getFirstToken(node.parent), 0); - } - - addElementListIndent(node.body, sourceCode.getFirstToken(node), sourceCode.getLastToken(node), blockIndentLevel); - }, - - CallExpression: addFunctionCallIndent, - - "ClassDeclaration[superClass], ClassExpression[superClass]"(node) { - const classToken = sourceCode.getFirstToken(node); - const extendsToken = sourceCode.getTokenBefore(node.superClass, astUtils.isNotOpeningParenToken); - - offsets.setDesiredOffsets([extendsToken.range[0], node.body.range[0]], classToken, 1); - }, - - ConditionalExpression(node) { - const firstToken = sourceCode.getFirstToken(node); - - // `flatTernaryExpressions` option is for the following style: - // var a = - // foo > 0 ? bar : - // foo < 0 ? baz : - // /*else*/ qiz ; - if (!options.flatTernaryExpressions || - !astUtils.isTokenOnSameLine(node.test, node.consequent) || - isOnFirstLineOfStatement(firstToken, node) - ) { - const questionMarkToken = sourceCode.getFirstTokenBetween(node.test, node.consequent, token => token.type === "Punctuator" && token.value === "?"); - const colonToken = sourceCode.getFirstTokenBetween(node.consequent, node.alternate, token => token.type === "Punctuator" && token.value === ":"); - - const firstConsequentToken = sourceCode.getTokenAfter(questionMarkToken); - const lastConsequentToken = sourceCode.getTokenBefore(colonToken); - const firstAlternateToken = sourceCode.getTokenAfter(colonToken); - - offsets.setDesiredOffset(questionMarkToken, firstToken, 1); - offsets.setDesiredOffset(colonToken, firstToken, 1); - - offsets.setDesiredOffset(firstConsequentToken, firstToken, firstConsequentToken.type === "Punctuator" && - options.offsetTernaryExpressions ? 2 : 1); - - /* - * The alternate and the consequent should usually have the same indentation. - * If they share part of a line, align the alternate against the first token of the consequent. - * This allows the alternate to be indented correctly in cases like this: - * foo ? ( - * bar - * ) : ( // this '(' is aligned with the '(' above, so it's considered to be aligned with `foo` - * baz // as a result, `baz` is offset by 1 rather than 2 - * ) - */ - if (lastConsequentToken.loc.end.line === firstAlternateToken.loc.start.line) { - offsets.setDesiredOffset(firstAlternateToken, firstConsequentToken, 0); - } else { - - /** - * If the alternate and consequent do not share part of a line, offset the alternate from the first - * token of the conditional expression. For example: - * foo ? bar - * : baz - * - * If `baz` were aligned with `bar` rather than being offset by 1 from `foo`, `baz` would end up - * having no expected indentation. - */ - offsets.setDesiredOffset(firstAlternateToken, firstToken, firstAlternateToken.type === "Punctuator" && - options.offsetTernaryExpressions ? 2 : 1); - } - } - }, - - "DoWhileStatement, WhileStatement, ForInStatement, ForOfStatement, WithStatement": node => addBlocklessNodeIndent(node.body), - - ExportNamedDeclaration(node) { - if (node.declaration === null) { - const closingCurly = sourceCode.getLastToken(node, astUtils.isClosingBraceToken); - - // Indent the specifiers in `export {foo, bar, baz}` - addElementListIndent(node.specifiers, sourceCode.getFirstToken(node, { skip: 1 }), closingCurly, 1); - - if (node.source) { - - // Indent everything after and including the `from` token in `export {foo, bar, baz} from 'qux'` - offsets.setDesiredOffsets([closingCurly.range[1], node.range[1]], sourceCode.getFirstToken(node), 1); - } - } - }, - - ForStatement(node) { - const forOpeningParen = sourceCode.getFirstToken(node, 1); - - if (node.init) { - offsets.setDesiredOffsets(node.init.range, forOpeningParen, 1); - } - if (node.test) { - offsets.setDesiredOffsets(node.test.range, forOpeningParen, 1); - } - if (node.update) { - offsets.setDesiredOffsets(node.update.range, forOpeningParen, 1); - } - addBlocklessNodeIndent(node.body); - }, - - "FunctionDeclaration, FunctionExpression"(node) { - const closingParen = sourceCode.getTokenBefore(node.body); - const openingParen = sourceCode.getTokenBefore(node.params.length ? node.params[0] : closingParen); - - parameterParens.add(openingParen); - parameterParens.add(closingParen); - addElementListIndent(node.params, openingParen, closingParen, options[node.type].parameters); - }, - - IfStatement(node) { - addBlocklessNodeIndent(node.consequent); - if (node.alternate && node.alternate.type !== "IfStatement") { - addBlocklessNodeIndent(node.alternate); - } - }, - - /* - * For blockless nodes with semicolon-first style, don't indent the semicolon. - * e.g. - * if (foo) - * bar() - * ; [1, 2, 3].map(foo) - * - * Traversal into the node sets indentation of the semicolon, so we need to override it on exit. - */ - ":matches(DoWhileStatement, ForStatement, ForInStatement, ForOfStatement, IfStatement, WhileStatement, WithStatement):exit"(node) { - let nodesToCheck; - - if (node.type === "IfStatement") { - nodesToCheck = [node.consequent]; - if (node.alternate) { - nodesToCheck.push(node.alternate); - } - } else { - nodesToCheck = [node.body]; - } - - for (const nodeToCheck of nodesToCheck) { - const lastToken = sourceCode.getLastToken(nodeToCheck); - - if (astUtils.isSemicolonToken(lastToken)) { - const tokenBeforeLast = sourceCode.getTokenBefore(lastToken); - const tokenAfterLast = sourceCode.getTokenAfter(lastToken); - - // override indentation of `;` only if its line looks like a semicolon-first style line - if ( - !astUtils.isTokenOnSameLine(tokenBeforeLast, lastToken) && - tokenAfterLast && - astUtils.isTokenOnSameLine(lastToken, tokenAfterLast) - ) { - offsets.setDesiredOffset( - lastToken, - sourceCode.getFirstToken(node), - 0 - ); - } - } - } - }, - - ImportDeclaration(node) { - if (node.specifiers.some(specifier => specifier.type === "ImportSpecifier")) { - const openingCurly = sourceCode.getFirstToken(node, astUtils.isOpeningBraceToken); - const closingCurly = sourceCode.getLastToken(node, astUtils.isClosingBraceToken); - - addElementListIndent(node.specifiers.filter(specifier => specifier.type === "ImportSpecifier"), openingCurly, closingCurly, options.ImportDeclaration); - } - - const fromToken = sourceCode.getLastToken(node, token => token.type === "Identifier" && token.value === "from"); - const sourceToken = sourceCode.getLastToken(node, token => token.type === "String"); - const semiToken = sourceCode.getLastToken(node, token => token.type === "Punctuator" && token.value === ";"); - - if (fromToken) { - const end = semiToken && semiToken.range[1] === sourceToken.range[1] ? node.range[1] : sourceToken.range[1]; - - offsets.setDesiredOffsets([fromToken.range[0], end], sourceCode.getFirstToken(node), 1); - } - }, - - ImportExpression(node) { - const openingParen = sourceCode.getFirstToken(node, 1); - const closingParen = sourceCode.getLastToken(node); - - parameterParens.add(openingParen); - parameterParens.add(closingParen); - offsets.setDesiredOffset(openingParen, sourceCode.getTokenBefore(openingParen), 0); - - addElementListIndent([node.source], openingParen, closingParen, options.CallExpression.arguments); - }, - - "MemberExpression, JSXMemberExpression, MetaProperty"(node) { - const object = node.type === "MetaProperty" ? node.meta : node.object; - const firstNonObjectToken = sourceCode.getFirstTokenBetween(object, node.property, astUtils.isNotClosingParenToken); - const secondNonObjectToken = sourceCode.getTokenAfter(firstNonObjectToken); - - const objectParenCount = sourceCode.getTokensBetween(object, node.property, { filter: astUtils.isClosingParenToken }).length; - const firstObjectToken = objectParenCount - ? sourceCode.getTokenBefore(object, { skip: objectParenCount - 1 }) - : sourceCode.getFirstToken(object); - const lastObjectToken = sourceCode.getTokenBefore(firstNonObjectToken); - const firstPropertyToken = node.computed ? firstNonObjectToken : secondNonObjectToken; - - if (node.computed) { - - // For computed MemberExpressions, match the closing bracket with the opening bracket. - offsets.setDesiredOffset(sourceCode.getLastToken(node), firstNonObjectToken, 0); - offsets.setDesiredOffsets(node.property.range, firstNonObjectToken, 1); - } - - /* - * If the object ends on the same line that the property starts, match against the last token - * of the object, to ensure that the MemberExpression is not indented. - * - * Otherwise, match against the first token of the object, e.g. - * foo - * .bar - * .baz // <-- offset by 1 from `foo` - */ - const offsetBase = lastObjectToken.loc.end.line === firstPropertyToken.loc.start.line - ? lastObjectToken - : firstObjectToken; - - if (typeof options.MemberExpression === "number") { - - // Match the dot (for non-computed properties) or the opening bracket (for computed properties) against the object. - offsets.setDesiredOffset(firstNonObjectToken, offsetBase, options.MemberExpression); - - /* - * For computed MemberExpressions, match the first token of the property against the opening bracket. - * Otherwise, match the first token of the property against the object. - */ - offsets.setDesiredOffset(secondNonObjectToken, node.computed ? firstNonObjectToken : offsetBase, options.MemberExpression); - } else { - - // If the MemberExpression option is off, ignore the dot and the first token of the property. - offsets.ignoreToken(firstNonObjectToken); - offsets.ignoreToken(secondNonObjectToken); - - // To ignore the property indentation, ensure that the property tokens depend on the ignored tokens. - offsets.setDesiredOffset(firstNonObjectToken, offsetBase, 0); - offsets.setDesiredOffset(secondNonObjectToken, firstNonObjectToken, 0); - } - }, - - NewExpression(node) { - - // Only indent the arguments if the NewExpression has parens (e.g. `new Foo(bar)` or `new Foo()`, but not `new Foo` - if (node.arguments.length > 0 || - astUtils.isClosingParenToken(sourceCode.getLastToken(node)) && - astUtils.isOpeningParenToken(sourceCode.getLastToken(node, 1))) { - addFunctionCallIndent(node); - } - }, - - Property(node) { - if (!node.shorthand && !node.method && node.kind === "init") { - const colon = sourceCode.getFirstTokenBetween(node.key, node.value, astUtils.isColonToken); - - offsets.ignoreToken(sourceCode.getTokenAfter(colon)); - } - }, - - PropertyDefinition(node) { - const firstToken = sourceCode.getFirstToken(node); - const maybeSemicolonToken = sourceCode.getLastToken(node); - let keyLastToken = null; - - // Indent key. - if (node.computed) { - const bracketTokenL = sourceCode.getTokenBefore(node.key, astUtils.isOpeningBracketToken); - const bracketTokenR = keyLastToken = sourceCode.getTokenAfter(node.key, astUtils.isClosingBracketToken); - const keyRange = [bracketTokenL.range[1], bracketTokenR.range[0]]; - - if (bracketTokenL !== firstToken) { - offsets.setDesiredOffset(bracketTokenL, firstToken, 0); - } - offsets.setDesiredOffsets(keyRange, bracketTokenL, 1); - offsets.setDesiredOffset(bracketTokenR, bracketTokenL, 0); - } else { - const idToken = keyLastToken = sourceCode.getFirstToken(node.key); - - if (idToken !== firstToken) { - offsets.setDesiredOffset(idToken, firstToken, 1); - } - } - - // Indent initializer. - if (node.value) { - const eqToken = sourceCode.getTokenBefore(node.value, astUtils.isEqToken); - const valueToken = sourceCode.getTokenAfter(eqToken); - - offsets.setDesiredOffset(eqToken, keyLastToken, 1); - offsets.setDesiredOffset(valueToken, eqToken, 1); - if (astUtils.isSemicolonToken(maybeSemicolonToken)) { - offsets.setDesiredOffset(maybeSemicolonToken, eqToken, 1); - } - } else if (astUtils.isSemicolonToken(maybeSemicolonToken)) { - offsets.setDesiredOffset(maybeSemicolonToken, keyLastToken, 1); - } - }, - - StaticBlock(node) { - const openingCurly = sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token - const closingCurly = sourceCode.getLastToken(node); - - addElementListIndent(node.body, openingCurly, closingCurly, options.StaticBlock.body); - }, - - SwitchStatement(node) { - const openingCurly = sourceCode.getTokenAfter(node.discriminant, astUtils.isOpeningBraceToken); - const closingCurly = sourceCode.getLastToken(node); - - offsets.setDesiredOffsets([openingCurly.range[1], closingCurly.range[0]], openingCurly, options.SwitchCase); - - if (node.cases.length) { - sourceCode.getTokensBetween( - node.cases[node.cases.length - 1], - closingCurly, - { includeComments: true, filter: astUtils.isCommentToken } - ).forEach(token => offsets.ignoreToken(token)); - } - }, - - SwitchCase(node) { - if (!(node.consequent.length === 1 && node.consequent[0].type === "BlockStatement")) { - const caseKeyword = sourceCode.getFirstToken(node); - const tokenAfterCurrentCase = sourceCode.getTokenAfter(node); - - offsets.setDesiredOffsets([caseKeyword.range[1], tokenAfterCurrentCase.range[0]], caseKeyword, 1); - } - }, - - TemplateLiteral(node) { - node.expressions.forEach((expression, index) => { - const previousQuasi = node.quasis[index]; - const nextQuasi = node.quasis[index + 1]; - const tokenToAlignFrom = previousQuasi.loc.start.line === previousQuasi.loc.end.line - ? sourceCode.getFirstToken(previousQuasi) - : null; - - offsets.setDesiredOffsets([previousQuasi.range[1], nextQuasi.range[0]], tokenToAlignFrom, 1); - offsets.setDesiredOffset(sourceCode.getFirstToken(nextQuasi), tokenToAlignFrom, 0); - }); - }, - - VariableDeclaration(node) { - let variableIndent = Object.prototype.hasOwnProperty.call(options.VariableDeclarator, node.kind) - ? options.VariableDeclarator[node.kind] - : DEFAULT_VARIABLE_INDENT; - - const firstToken = sourceCode.getFirstToken(node), - lastToken = sourceCode.getLastToken(node); - - if (options.VariableDeclarator[node.kind] === "first") { - if (node.declarations.length > 1) { - addElementListIndent( - node.declarations, - firstToken, - lastToken, - "first" - ); - return; - } - - variableIndent = DEFAULT_VARIABLE_INDENT; - } - - if (node.declarations[node.declarations.length - 1].loc.start.line > node.loc.start.line) { - - /* - * VariableDeclarator indentation is a bit different from other forms of indentation, in that the - * indentation of an opening bracket sometimes won't match that of a closing bracket. For example, - * the following indentations are correct: - * - * var foo = { - * ok: true - * }; - * - * var foo = { - * ok: true, - * }, - * bar = 1; - * - * Account for when exiting the AST (after indentations have already been set for the nodes in - * the declaration) by manually increasing the indentation level of the tokens in this declarator - * on the same line as the start of the declaration, provided that there are declarators that - * follow this one. - */ - offsets.setDesiredOffsets(node.range, firstToken, variableIndent, true); - } else { - offsets.setDesiredOffsets(node.range, firstToken, variableIndent); - } - - if (astUtils.isSemicolonToken(lastToken)) { - offsets.ignoreToken(lastToken); - } - }, - - VariableDeclarator(node) { - if (node.init) { - const equalOperator = sourceCode.getTokenBefore(node.init, astUtils.isNotOpeningParenToken); - const tokenAfterOperator = sourceCode.getTokenAfter(equalOperator); - - offsets.ignoreToken(equalOperator); - offsets.ignoreToken(tokenAfterOperator); - offsets.setDesiredOffsets([tokenAfterOperator.range[0], node.range[1]], equalOperator, 1); - offsets.setDesiredOffset(equalOperator, sourceCode.getLastToken(node.id), 0); - } - }, - - "JSXAttribute[value]"(node) { - const equalsToken = sourceCode.getFirstTokenBetween(node.name, node.value, token => token.type === "Punctuator" && token.value === "="); - - offsets.setDesiredOffsets([equalsToken.range[0], node.value.range[1]], sourceCode.getFirstToken(node.name), 1); - }, - - JSXElement(node) { - if (node.closingElement) { - addElementListIndent(node.children, sourceCode.getFirstToken(node.openingElement), sourceCode.getFirstToken(node.closingElement), 1); - } - }, - - JSXOpeningElement(node) { - const firstToken = sourceCode.getFirstToken(node); - let closingToken; - - if (node.selfClosing) { - closingToken = sourceCode.getLastToken(node, { skip: 1 }); - offsets.setDesiredOffset(sourceCode.getLastToken(node), closingToken, 0); - } else { - closingToken = sourceCode.getLastToken(node); - } - offsets.setDesiredOffsets(node.name.range, sourceCode.getFirstToken(node)); - addElementListIndent(node.attributes, firstToken, closingToken, 1); - }, - - JSXClosingElement(node) { - const firstToken = sourceCode.getFirstToken(node); - - offsets.setDesiredOffsets(node.name.range, firstToken, 1); - }, - - JSXFragment(node) { - const firstOpeningToken = sourceCode.getFirstToken(node.openingFragment); - const firstClosingToken = sourceCode.getFirstToken(node.closingFragment); - - addElementListIndent(node.children, firstOpeningToken, firstClosingToken, 1); - }, - - JSXOpeningFragment(node) { - const firstToken = sourceCode.getFirstToken(node); - const closingToken = sourceCode.getLastToken(node); - - offsets.setDesiredOffsets(node.range, firstToken, 1); - offsets.matchOffsetOf(firstToken, closingToken); - }, - - JSXClosingFragment(node) { - const firstToken = sourceCode.getFirstToken(node); - const slashToken = sourceCode.getLastToken(node, { skip: 1 }); - const closingToken = sourceCode.getLastToken(node); - const tokenToMatch = astUtils.isTokenOnSameLine(slashToken, closingToken) ? slashToken : closingToken; - - offsets.setDesiredOffsets(node.range, firstToken, 1); - offsets.matchOffsetOf(firstToken, tokenToMatch); - }, - - JSXExpressionContainer(node) { - const openingCurly = sourceCode.getFirstToken(node); - const closingCurly = sourceCode.getLastToken(node); - - offsets.setDesiredOffsets( - [openingCurly.range[1], closingCurly.range[0]], - openingCurly, - 1 - ); - }, - - JSXSpreadAttribute(node) { - const openingCurly = sourceCode.getFirstToken(node); - const closingCurly = sourceCode.getLastToken(node); - - offsets.setDesiredOffsets( - [openingCurly.range[1], closingCurly.range[0]], - openingCurly, - 1 - ); - }, - - "*"(node) { - const firstToken = sourceCode.getFirstToken(node); - - // Ensure that the children of every node are indented at least as much as the first token. - if (firstToken && !ignoredNodeFirstTokens.has(firstToken)) { - offsets.setDesiredOffsets(node.range, firstToken, 0); - } - } - }; - - const listenerCallQueue = []; - - /* - * To ignore the indentation of a node: - * 1. Don't call the node's listener when entering it (if it has a listener) - * 2. Don't set any offsets against the first token of the node. - * 3. Call `ignoreNode` on the node sometime after exiting it and before validating offsets. - */ - const offsetListeners = {}; - - for (const [selector, listener] of Object.entries(baseOffsetListeners)) { - - /* - * Offset listener calls are deferred until traversal is finished, and are called as - * part of the final `Program:exit` listener. This is necessary because a node might - * be matched by multiple selectors. - * - * Example: Suppose there is an offset listener for `Identifier`, and the user has - * specified in configuration that `MemberExpression > Identifier` should be ignored. - * Due to selector specificity rules, the `Identifier` listener will get called first. However, - * if a given Identifier node is supposed to be ignored, then the `Identifier` offset listener - * should not have been called at all. Without doing extra selector matching, we don't know - * whether the Identifier matches the `MemberExpression > Identifier` selector until the - * `MemberExpression > Identifier` listener is called. - * - * To avoid this, the `Identifier` listener isn't called until traversal finishes and all - * ignored nodes are known. - */ - offsetListeners[selector] = node => listenerCallQueue.push({ listener, node }); - } - - // For each ignored node selector, set up a listener to collect it into the `ignoredNodes` set. - const ignoredNodes = new Set(); - - /** - * Ignores a node - * @param {ASTNode} node The node to ignore - * @returns {void} - */ - function addToIgnoredNodes(node) { - ignoredNodes.add(node); - ignoredNodeFirstTokens.add(sourceCode.getFirstToken(node)); - } - - const ignoredNodeListeners = options.ignoredNodes.reduce( - (listeners, ignoredSelector) => Object.assign(listeners, { [ignoredSelector]: addToIgnoredNodes }), - {} - ); - - /* - * Join the listeners, and add a listener to verify that all tokens actually have the correct indentation - * at the end. - * - * Using Object.assign will cause some offset listeners to be overwritten if the same selector also appears - * in `ignoredNodeListeners`. This isn't a problem because all of the matching nodes will be ignored, - * so those listeners wouldn't be called anyway. - */ - return Object.assign( - offsetListeners, - ignoredNodeListeners, - { - "*:exit"(node) { - - // If a node's type is nonstandard, we can't tell how its children should be offset, so ignore it. - if (!KNOWN_NODES.has(node.type)) { - addToIgnoredNodes(node); - } - }, - "Program:exit"() { - - // If ignoreComments option is enabled, ignore all comment tokens. - if (options.ignoreComments) { - sourceCode.getAllComments() - .forEach(comment => offsets.ignoreToken(comment)); - } - - // Invoke the queued offset listeners for the nodes that aren't ignored. - listenerCallQueue - .filter(nodeInfo => !ignoredNodes.has(nodeInfo.node)) - .forEach(nodeInfo => nodeInfo.listener(nodeInfo.node)); - - // Update the offsets for ignored nodes to prevent their child tokens from being reported. - ignoredNodes.forEach(ignoreNode); - - addParensIndent(sourceCode.ast.tokens); - - /* - * Create a Map from (tokenOrComment) => (precedingToken). - * This is necessary because sourceCode.getTokenBefore does not handle a comment as an argument correctly. - */ - const precedingTokens = sourceCode.ast.comments.reduce((commentMap, comment) => { - const tokenOrCommentBefore = sourceCode.getTokenBefore(comment, { includeComments: true }); - - return commentMap.set(comment, commentMap.has(tokenOrCommentBefore) ? commentMap.get(tokenOrCommentBefore) : tokenOrCommentBefore); - }, new WeakMap()); - - sourceCode.lines.forEach((line, lineIndex) => { - const lineNumber = lineIndex + 1; - - if (!tokenInfo.firstTokensByLineNumber.has(lineNumber)) { - - // Don't check indentation on blank lines - return; - } - - const firstTokenOfLine = tokenInfo.firstTokensByLineNumber.get(lineNumber); - - if (firstTokenOfLine.loc.start.line !== lineNumber) { - - // Don't check the indentation of multi-line tokens (e.g. template literals or block comments) twice. - return; - } - - if (astUtils.isCommentToken(firstTokenOfLine)) { - const tokenBefore = precedingTokens.get(firstTokenOfLine); - const tokenAfter = tokenBefore ? sourceCode.getTokenAfter(tokenBefore) : sourceCode.ast.tokens[0]; - const mayAlignWithBefore = tokenBefore && !hasBlankLinesBetween(tokenBefore, firstTokenOfLine); - const mayAlignWithAfter = tokenAfter && !hasBlankLinesBetween(firstTokenOfLine, tokenAfter); - - /* - * If a comment precedes a line that begins with a semicolon token, align to that token, i.e. - * - * let foo - * // comment - * ;(async () => {})() - */ - if (tokenAfter && astUtils.isSemicolonToken(tokenAfter) && !astUtils.isTokenOnSameLine(firstTokenOfLine, tokenAfter)) { - offsets.setDesiredOffset(firstTokenOfLine, tokenAfter, 0); - } - - // If a comment matches the expected indentation of the token immediately before or after, don't report it. - if ( - mayAlignWithBefore && validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(tokenBefore)) || - mayAlignWithAfter && validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(tokenAfter)) - ) { - return; - } - } - - // If the token matches the expected indentation, don't report it. - if (validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(firstTokenOfLine))) { - return; - } - - // Otherwise, report the token/comment. - report(firstTokenOfLine, offsets.getDesiredIndent(firstTokenOfLine)); - }); - } - } - ); - } -}; diff --git a/node_modules/eslint/lib/rules/index.js b/node_modules/eslint/lib/rules/index.js deleted file mode 100644 index e42639656..000000000 --- a/node_modules/eslint/lib/rules/index.js +++ /dev/null @@ -1,305 +0,0 @@ -/** - * @fileoverview Collects the built-in rules into a map structure so that they can be imported all at once and without - * using the file-system directly. - * @author Peter (Somogyvari) Metz - */ - -"use strict"; - -/* eslint sort-keys: ["error", "asc"] -- More readable for long list */ - -const { LazyLoadingRuleMap } = require("./utils/lazy-loading-rule-map"); - -/** @type {Map} */ -module.exports = new LazyLoadingRuleMap(Object.entries({ - "accessor-pairs": () => require("./accessor-pairs"), - "array-bracket-newline": () => require("./array-bracket-newline"), - "array-bracket-spacing": () => require("./array-bracket-spacing"), - "array-callback-return": () => require("./array-callback-return"), - "array-element-newline": () => require("./array-element-newline"), - "arrow-body-style": () => require("./arrow-body-style"), - "arrow-parens": () => require("./arrow-parens"), - "arrow-spacing": () => require("./arrow-spacing"), - "block-scoped-var": () => require("./block-scoped-var"), - "block-spacing": () => require("./block-spacing"), - "brace-style": () => require("./brace-style"), - "callback-return": () => require("./callback-return"), - camelcase: () => require("./camelcase"), - "capitalized-comments": () => require("./capitalized-comments"), - "class-methods-use-this": () => require("./class-methods-use-this"), - "comma-dangle": () => require("./comma-dangle"), - "comma-spacing": () => require("./comma-spacing"), - "comma-style": () => require("./comma-style"), - complexity: () => require("./complexity"), - "computed-property-spacing": () => require("./computed-property-spacing"), - "consistent-return": () => require("./consistent-return"), - "consistent-this": () => require("./consistent-this"), - "constructor-super": () => require("./constructor-super"), - curly: () => require("./curly"), - "default-case": () => require("./default-case"), - "default-case-last": () => require("./default-case-last"), - "default-param-last": () => require("./default-param-last"), - "dot-location": () => require("./dot-location"), - "dot-notation": () => require("./dot-notation"), - "eol-last": () => require("./eol-last"), - eqeqeq: () => require("./eqeqeq"), - "for-direction": () => require("./for-direction"), - "func-call-spacing": () => require("./func-call-spacing"), - "func-name-matching": () => require("./func-name-matching"), - "func-names": () => require("./func-names"), - "func-style": () => require("./func-style"), - "function-call-argument-newline": () => require("./function-call-argument-newline"), - "function-paren-newline": () => require("./function-paren-newline"), - "generator-star-spacing": () => require("./generator-star-spacing"), - "getter-return": () => require("./getter-return"), - "global-require": () => require("./global-require"), - "grouped-accessor-pairs": () => require("./grouped-accessor-pairs"), - "guard-for-in": () => require("./guard-for-in"), - "handle-callback-err": () => require("./handle-callback-err"), - "id-blacklist": () => require("./id-blacklist"), - "id-denylist": () => require("./id-denylist"), - "id-length": () => require("./id-length"), - "id-match": () => require("./id-match"), - "implicit-arrow-linebreak": () => require("./implicit-arrow-linebreak"), - indent: () => require("./indent"), - "indent-legacy": () => require("./indent-legacy"), - "init-declarations": () => require("./init-declarations"), - "jsx-quotes": () => require("./jsx-quotes"), - "key-spacing": () => require("./key-spacing"), - "keyword-spacing": () => require("./keyword-spacing"), - "line-comment-position": () => require("./line-comment-position"), - "linebreak-style": () => require("./linebreak-style"), - "lines-around-comment": () => require("./lines-around-comment"), - "lines-around-directive": () => require("./lines-around-directive"), - "lines-between-class-members": () => require("./lines-between-class-members"), - "logical-assignment-operators": () => require("./logical-assignment-operators"), - "max-classes-per-file": () => require("./max-classes-per-file"), - "max-depth": () => require("./max-depth"), - "max-len": () => require("./max-len"), - "max-lines": () => require("./max-lines"), - "max-lines-per-function": () => require("./max-lines-per-function"), - "max-nested-callbacks": () => require("./max-nested-callbacks"), - "max-params": () => require("./max-params"), - "max-statements": () => require("./max-statements"), - "max-statements-per-line": () => require("./max-statements-per-line"), - "multiline-comment-style": () => require("./multiline-comment-style"), - "multiline-ternary": () => require("./multiline-ternary"), - "new-cap": () => require("./new-cap"), - "new-parens": () => require("./new-parens"), - "newline-after-var": () => require("./newline-after-var"), - "newline-before-return": () => require("./newline-before-return"), - "newline-per-chained-call": () => require("./newline-per-chained-call"), - "no-alert": () => require("./no-alert"), - "no-array-constructor": () => require("./no-array-constructor"), - "no-async-promise-executor": () => require("./no-async-promise-executor"), - "no-await-in-loop": () => require("./no-await-in-loop"), - "no-bitwise": () => require("./no-bitwise"), - "no-buffer-constructor": () => require("./no-buffer-constructor"), - "no-caller": () => require("./no-caller"), - "no-case-declarations": () => require("./no-case-declarations"), - "no-catch-shadow": () => require("./no-catch-shadow"), - "no-class-assign": () => require("./no-class-assign"), - "no-compare-neg-zero": () => require("./no-compare-neg-zero"), - "no-cond-assign": () => require("./no-cond-assign"), - "no-confusing-arrow": () => require("./no-confusing-arrow"), - "no-console": () => require("./no-console"), - "no-const-assign": () => require("./no-const-assign"), - "no-constant-binary-expression": () => require("./no-constant-binary-expression"), - "no-constant-condition": () => require("./no-constant-condition"), - "no-constructor-return": () => require("./no-constructor-return"), - "no-continue": () => require("./no-continue"), - "no-control-regex": () => require("./no-control-regex"), - "no-debugger": () => require("./no-debugger"), - "no-delete-var": () => require("./no-delete-var"), - "no-div-regex": () => require("./no-div-regex"), - "no-dupe-args": () => require("./no-dupe-args"), - "no-dupe-class-members": () => require("./no-dupe-class-members"), - "no-dupe-else-if": () => require("./no-dupe-else-if"), - "no-dupe-keys": () => require("./no-dupe-keys"), - "no-duplicate-case": () => require("./no-duplicate-case"), - "no-duplicate-imports": () => require("./no-duplicate-imports"), - "no-else-return": () => require("./no-else-return"), - "no-empty": () => require("./no-empty"), - "no-empty-character-class": () => require("./no-empty-character-class"), - "no-empty-function": () => require("./no-empty-function"), - "no-empty-pattern": () => require("./no-empty-pattern"), - "no-empty-static-block": () => require("./no-empty-static-block"), - "no-eq-null": () => require("./no-eq-null"), - "no-eval": () => require("./no-eval"), - "no-ex-assign": () => require("./no-ex-assign"), - "no-extend-native": () => require("./no-extend-native"), - "no-extra-bind": () => require("./no-extra-bind"), - "no-extra-boolean-cast": () => require("./no-extra-boolean-cast"), - "no-extra-label": () => require("./no-extra-label"), - "no-extra-parens": () => require("./no-extra-parens"), - "no-extra-semi": () => require("./no-extra-semi"), - "no-fallthrough": () => require("./no-fallthrough"), - "no-floating-decimal": () => require("./no-floating-decimal"), - "no-func-assign": () => require("./no-func-assign"), - "no-global-assign": () => require("./no-global-assign"), - "no-implicit-coercion": () => require("./no-implicit-coercion"), - "no-implicit-globals": () => require("./no-implicit-globals"), - "no-implied-eval": () => require("./no-implied-eval"), - "no-import-assign": () => require("./no-import-assign"), - "no-inline-comments": () => require("./no-inline-comments"), - "no-inner-declarations": () => require("./no-inner-declarations"), - "no-invalid-regexp": () => require("./no-invalid-regexp"), - "no-invalid-this": () => require("./no-invalid-this"), - "no-irregular-whitespace": () => require("./no-irregular-whitespace"), - "no-iterator": () => require("./no-iterator"), - "no-label-var": () => require("./no-label-var"), - "no-labels": () => require("./no-labels"), - "no-lone-blocks": () => require("./no-lone-blocks"), - "no-lonely-if": () => require("./no-lonely-if"), - "no-loop-func": () => require("./no-loop-func"), - "no-loss-of-precision": () => require("./no-loss-of-precision"), - "no-magic-numbers": () => require("./no-magic-numbers"), - "no-misleading-character-class": () => require("./no-misleading-character-class"), - "no-mixed-operators": () => require("./no-mixed-operators"), - "no-mixed-requires": () => require("./no-mixed-requires"), - "no-mixed-spaces-and-tabs": () => require("./no-mixed-spaces-and-tabs"), - "no-multi-assign": () => require("./no-multi-assign"), - "no-multi-spaces": () => require("./no-multi-spaces"), - "no-multi-str": () => require("./no-multi-str"), - "no-multiple-empty-lines": () => require("./no-multiple-empty-lines"), - "no-native-reassign": () => require("./no-native-reassign"), - "no-negated-condition": () => require("./no-negated-condition"), - "no-negated-in-lhs": () => require("./no-negated-in-lhs"), - "no-nested-ternary": () => require("./no-nested-ternary"), - "no-new": () => require("./no-new"), - "no-new-func": () => require("./no-new-func"), - "no-new-native-nonconstructor": () => require("./no-new-native-nonconstructor"), - "no-new-object": () => require("./no-new-object"), - "no-new-require": () => require("./no-new-require"), - "no-new-symbol": () => require("./no-new-symbol"), - "no-new-wrappers": () => require("./no-new-wrappers"), - "no-nonoctal-decimal-escape": () => require("./no-nonoctal-decimal-escape"), - "no-obj-calls": () => require("./no-obj-calls"), - "no-octal": () => require("./no-octal"), - "no-octal-escape": () => require("./no-octal-escape"), - "no-param-reassign": () => require("./no-param-reassign"), - "no-path-concat": () => require("./no-path-concat"), - "no-plusplus": () => require("./no-plusplus"), - "no-process-env": () => require("./no-process-env"), - "no-process-exit": () => require("./no-process-exit"), - "no-promise-executor-return": () => require("./no-promise-executor-return"), - "no-proto": () => require("./no-proto"), - "no-prototype-builtins": () => require("./no-prototype-builtins"), - "no-redeclare": () => require("./no-redeclare"), - "no-regex-spaces": () => require("./no-regex-spaces"), - "no-restricted-exports": () => require("./no-restricted-exports"), - "no-restricted-globals": () => require("./no-restricted-globals"), - "no-restricted-imports": () => require("./no-restricted-imports"), - "no-restricted-modules": () => require("./no-restricted-modules"), - "no-restricted-properties": () => require("./no-restricted-properties"), - "no-restricted-syntax": () => require("./no-restricted-syntax"), - "no-return-assign": () => require("./no-return-assign"), - "no-return-await": () => require("./no-return-await"), - "no-script-url": () => require("./no-script-url"), - "no-self-assign": () => require("./no-self-assign"), - "no-self-compare": () => require("./no-self-compare"), - "no-sequences": () => require("./no-sequences"), - "no-setter-return": () => require("./no-setter-return"), - "no-shadow": () => require("./no-shadow"), - "no-shadow-restricted-names": () => require("./no-shadow-restricted-names"), - "no-spaced-func": () => require("./no-spaced-func"), - "no-sparse-arrays": () => require("./no-sparse-arrays"), - "no-sync": () => require("./no-sync"), - "no-tabs": () => require("./no-tabs"), - "no-template-curly-in-string": () => require("./no-template-curly-in-string"), - "no-ternary": () => require("./no-ternary"), - "no-this-before-super": () => require("./no-this-before-super"), - "no-throw-literal": () => require("./no-throw-literal"), - "no-trailing-spaces": () => require("./no-trailing-spaces"), - "no-undef": () => require("./no-undef"), - "no-undef-init": () => require("./no-undef-init"), - "no-undefined": () => require("./no-undefined"), - "no-underscore-dangle": () => require("./no-underscore-dangle"), - "no-unexpected-multiline": () => require("./no-unexpected-multiline"), - "no-unmodified-loop-condition": () => require("./no-unmodified-loop-condition"), - "no-unneeded-ternary": () => require("./no-unneeded-ternary"), - "no-unreachable": () => require("./no-unreachable"), - "no-unreachable-loop": () => require("./no-unreachable-loop"), - "no-unsafe-finally": () => require("./no-unsafe-finally"), - "no-unsafe-negation": () => require("./no-unsafe-negation"), - "no-unsafe-optional-chaining": () => require("./no-unsafe-optional-chaining"), - "no-unused-expressions": () => require("./no-unused-expressions"), - "no-unused-labels": () => require("./no-unused-labels"), - "no-unused-private-class-members": () => require("./no-unused-private-class-members"), - "no-unused-vars": () => require("./no-unused-vars"), - "no-use-before-define": () => require("./no-use-before-define"), - "no-useless-backreference": () => require("./no-useless-backreference"), - "no-useless-call": () => require("./no-useless-call"), - "no-useless-catch": () => require("./no-useless-catch"), - "no-useless-computed-key": () => require("./no-useless-computed-key"), - "no-useless-concat": () => require("./no-useless-concat"), - "no-useless-constructor": () => require("./no-useless-constructor"), - "no-useless-escape": () => require("./no-useless-escape"), - "no-useless-rename": () => require("./no-useless-rename"), - "no-useless-return": () => require("./no-useless-return"), - "no-var": () => require("./no-var"), - "no-void": () => require("./no-void"), - "no-warning-comments": () => require("./no-warning-comments"), - "no-whitespace-before-property": () => require("./no-whitespace-before-property"), - "no-with": () => require("./no-with"), - "nonblock-statement-body-position": () => require("./nonblock-statement-body-position"), - "object-curly-newline": () => require("./object-curly-newline"), - "object-curly-spacing": () => require("./object-curly-spacing"), - "object-property-newline": () => require("./object-property-newline"), - "object-shorthand": () => require("./object-shorthand"), - "one-var": () => require("./one-var"), - "one-var-declaration-per-line": () => require("./one-var-declaration-per-line"), - "operator-assignment": () => require("./operator-assignment"), - "operator-linebreak": () => require("./operator-linebreak"), - "padded-blocks": () => require("./padded-blocks"), - "padding-line-between-statements": () => require("./padding-line-between-statements"), - "prefer-arrow-callback": () => require("./prefer-arrow-callback"), - "prefer-const": () => require("./prefer-const"), - "prefer-destructuring": () => require("./prefer-destructuring"), - "prefer-exponentiation-operator": () => require("./prefer-exponentiation-operator"), - "prefer-named-capture-group": () => require("./prefer-named-capture-group"), - "prefer-numeric-literals": () => require("./prefer-numeric-literals"), - "prefer-object-has-own": () => require("./prefer-object-has-own"), - "prefer-object-spread": () => require("./prefer-object-spread"), - "prefer-promise-reject-errors": () => require("./prefer-promise-reject-errors"), - "prefer-reflect": () => require("./prefer-reflect"), - "prefer-regex-literals": () => require("./prefer-regex-literals"), - "prefer-rest-params": () => require("./prefer-rest-params"), - "prefer-spread": () => require("./prefer-spread"), - "prefer-template": () => require("./prefer-template"), - "quote-props": () => require("./quote-props"), - quotes: () => require("./quotes"), - radix: () => require("./radix"), - "require-atomic-updates": () => require("./require-atomic-updates"), - "require-await": () => require("./require-await"), - "require-jsdoc": () => require("./require-jsdoc"), - "require-unicode-regexp": () => require("./require-unicode-regexp"), - "require-yield": () => require("./require-yield"), - "rest-spread-spacing": () => require("./rest-spread-spacing"), - semi: () => require("./semi"), - "semi-spacing": () => require("./semi-spacing"), - "semi-style": () => require("./semi-style"), - "sort-imports": () => require("./sort-imports"), - "sort-keys": () => require("./sort-keys"), - "sort-vars": () => require("./sort-vars"), - "space-before-blocks": () => require("./space-before-blocks"), - "space-before-function-paren": () => require("./space-before-function-paren"), - "space-in-parens": () => require("./space-in-parens"), - "space-infix-ops": () => require("./space-infix-ops"), - "space-unary-ops": () => require("./space-unary-ops"), - "spaced-comment": () => require("./spaced-comment"), - strict: () => require("./strict"), - "switch-colon-spacing": () => require("./switch-colon-spacing"), - "symbol-description": () => require("./symbol-description"), - "template-curly-spacing": () => require("./template-curly-spacing"), - "template-tag-spacing": () => require("./template-tag-spacing"), - "unicode-bom": () => require("./unicode-bom"), - "use-isnan": () => require("./use-isnan"), - "valid-jsdoc": () => require("./valid-jsdoc"), - "valid-typeof": () => require("./valid-typeof"), - "vars-on-top": () => require("./vars-on-top"), - "wrap-iife": () => require("./wrap-iife"), - "wrap-regex": () => require("./wrap-regex"), - "yield-star-spacing": () => require("./yield-star-spacing"), - yoda: () => require("./yoda") -})); diff --git a/node_modules/eslint/lib/rules/init-declarations.js b/node_modules/eslint/lib/rules/init-declarations.js deleted file mode 100644 index 3abe107f1..000000000 --- a/node_modules/eslint/lib/rules/init-declarations.js +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @fileoverview A rule to control the style of variable initializations. - * @author Colin Ihrig - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a given node is a for loop. - * @param {ASTNode} block A node to check. - * @returns {boolean} `true` when the node is a for loop. - */ -function isForLoop(block) { - return block.type === "ForInStatement" || - block.type === "ForOfStatement" || - block.type === "ForStatement"; -} - -/** - * Checks whether or not a given declarator node has its initializer. - * @param {ASTNode} node A declarator node to check. - * @returns {boolean} `true` when the node has its initializer. - */ -function isInitialized(node) { - const declaration = node.parent; - const block = declaration.parent; - - if (isForLoop(block)) { - if (block.type === "ForStatement") { - return block.init === declaration; - } - return block.left === declaration; - } - return Boolean(node.init); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require or disallow initialization in variable declarations", - recommended: false, - url: "https://eslint.org/docs/latest/rules/init-declarations" - }, - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["always"] - } - ], - minItems: 0, - maxItems: 1 - }, - { - type: "array", - items: [ - { - enum: ["never"] - }, - { - type: "object", - properties: { - ignoreForLoopInit: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - } - ] - }, - messages: { - initialized: "Variable '{{idName}}' should be initialized on declaration.", - notInitialized: "Variable '{{idName}}' should not be initialized on declaration." - } - }, - - create(context) { - - const MODE_ALWAYS = "always", - MODE_NEVER = "never"; - - const mode = context.options[0] || MODE_ALWAYS; - const params = context.options[1] || {}; - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - "VariableDeclaration:exit"(node) { - - const kind = node.kind, - declarations = node.declarations; - - for (let i = 0; i < declarations.length; ++i) { - const declaration = declarations[i], - id = declaration.id, - initialized = isInitialized(declaration), - isIgnoredForLoop = params.ignoreForLoopInit && isForLoop(node.parent); - let messageId = ""; - - if (mode === MODE_ALWAYS && !initialized) { - messageId = "initialized"; - } else if (mode === MODE_NEVER && kind !== "const" && initialized && !isIgnoredForLoop) { - messageId = "notInitialized"; - } - - if (id.type === "Identifier" && messageId) { - context.report({ - node: declaration, - messageId, - data: { - idName: id.name - } - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/jsx-quotes.js b/node_modules/eslint/lib/rules/jsx-quotes.js deleted file mode 100644 index a41c85170..000000000 --- a/node_modules/eslint/lib/rules/jsx-quotes.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @fileoverview A rule to ensure consistent quotes used in jsx syntax. - * @author Mathias Schreck - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Constants -//------------------------------------------------------------------------------ - -const QUOTE_SETTINGS = { - "prefer-double": { - quote: "\"", - description: "singlequote", - convert(str) { - return str.replace(/'/gu, "\""); - } - }, - "prefer-single": { - quote: "'", - description: "doublequote", - convert(str) { - return str.replace(/"/gu, "'"); - } - } -}; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce the consistent use of either double or single quotes in JSX attributes", - recommended: false, - url: "https://eslint.org/docs/latest/rules/jsx-quotes" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["prefer-single", "prefer-double"] - } - ], - messages: { - unexpected: "Unexpected usage of {{description}}." - } - }, - - create(context) { - const quoteOption = context.options[0] || "prefer-double", - setting = QUOTE_SETTINGS[quoteOption]; - - /** - * Checks if the given string literal node uses the expected quotes - * @param {ASTNode} node A string literal node. - * @returns {boolean} Whether or not the string literal used the expected quotes. - * @public - */ - function usesExpectedQuotes(node) { - return node.value.includes(setting.quote) || astUtils.isSurroundedBy(node.raw, setting.quote); - } - - return { - JSXAttribute(node) { - const attributeValue = node.value; - - if (attributeValue && astUtils.isStringLiteral(attributeValue) && !usesExpectedQuotes(attributeValue)) { - context.report({ - node: attributeValue, - messageId: "unexpected", - data: { - description: setting.description - }, - fix(fixer) { - return fixer.replaceText(attributeValue, setting.convert(attributeValue.raw)); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/key-spacing.js b/node_modules/eslint/lib/rules/key-spacing.js deleted file mode 100644 index 0b51eb3fe..000000000 --- a/node_modules/eslint/lib/rules/key-spacing.js +++ /dev/null @@ -1,684 +0,0 @@ -/** - * @fileoverview Rule to specify spacing of object literal keys and values - * @author Brandon Mills - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { getGraphemeCount } = require("../shared/string-utils"); - -/** - * Checks whether a string contains a line terminator as defined in - * http://www.ecma-international.org/ecma-262/5.1/#sec-7.3 - * @param {string} str String to test. - * @returns {boolean} True if str contains a line terminator. - */ -function containsLineTerminator(str) { - return astUtils.LINEBREAK_MATCHER.test(str); -} - -/** - * Gets the last element of an array. - * @param {Array} arr An array. - * @returns {any} Last element of arr. - */ -function last(arr) { - return arr[arr.length - 1]; -} - -/** - * Checks whether a node is contained on a single line. - * @param {ASTNode} node AST Node being evaluated. - * @returns {boolean} True if the node is a single line. - */ -function isSingleLine(node) { - return (node.loc.end.line === node.loc.start.line); -} - -/** - * Checks whether the properties on a single line. - * @param {ASTNode[]} properties List of Property AST nodes. - * @returns {boolean} True if all properties is on a single line. - */ -function isSingleLineProperties(properties) { - const [firstProp] = properties, - lastProp = last(properties); - - return firstProp.loc.start.line === lastProp.loc.end.line; -} - -/** - * Initializes a single option property from the configuration with defaults for undefined values - * @param {Object} toOptions Object to be initialized - * @param {Object} fromOptions Object to be initialized from - * @returns {Object} The object with correctly initialized options and values - */ -function initOptionProperty(toOptions, fromOptions) { - toOptions.mode = fromOptions.mode || "strict"; - - // Set value of beforeColon - if (typeof fromOptions.beforeColon !== "undefined") { - toOptions.beforeColon = +fromOptions.beforeColon; - } else { - toOptions.beforeColon = 0; - } - - // Set value of afterColon - if (typeof fromOptions.afterColon !== "undefined") { - toOptions.afterColon = +fromOptions.afterColon; - } else { - toOptions.afterColon = 1; - } - - // Set align if exists - if (typeof fromOptions.align !== "undefined") { - if (typeof fromOptions.align === "object") { - toOptions.align = fromOptions.align; - } else { // "string" - toOptions.align = { - on: fromOptions.align, - mode: toOptions.mode, - beforeColon: toOptions.beforeColon, - afterColon: toOptions.afterColon - }; - } - } - - return toOptions; -} - -/** - * Initializes all the option values (singleLine, multiLine and align) from the configuration with defaults for undefined values - * @param {Object} toOptions Object to be initialized - * @param {Object} fromOptions Object to be initialized from - * @returns {Object} The object with correctly initialized options and values - */ -function initOptions(toOptions, fromOptions) { - if (typeof fromOptions.align === "object") { - - // Initialize the alignment configuration - toOptions.align = initOptionProperty({}, fromOptions.align); - toOptions.align.on = fromOptions.align.on || "colon"; - toOptions.align.mode = fromOptions.align.mode || "strict"; - - toOptions.multiLine = initOptionProperty({}, (fromOptions.multiLine || fromOptions)); - toOptions.singleLine = initOptionProperty({}, (fromOptions.singleLine || fromOptions)); - - } else { // string or undefined - toOptions.multiLine = initOptionProperty({}, (fromOptions.multiLine || fromOptions)); - toOptions.singleLine = initOptionProperty({}, (fromOptions.singleLine || fromOptions)); - - // If alignment options are defined in multiLine, pull them out into the general align configuration - if (toOptions.multiLine.align) { - toOptions.align = { - on: toOptions.multiLine.align.on, - mode: toOptions.multiLine.align.mode || toOptions.multiLine.mode, - beforeColon: toOptions.multiLine.align.beforeColon, - afterColon: toOptions.multiLine.align.afterColon - }; - } - } - - return toOptions; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing between keys and values in object literal properties", - recommended: false, - url: "https://eslint.org/docs/latest/rules/key-spacing" - }, - - fixable: "whitespace", - - schema: [{ - anyOf: [ - { - type: "object", - properties: { - align: { - anyOf: [ - { - enum: ["colon", "value"] - }, - { - type: "object", - properties: { - mode: { - enum: ["strict", "minimum"] - }, - on: { - enum: ["colon", "value"] - }, - beforeColon: { - type: "boolean" - }, - afterColon: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - }, - mode: { - enum: ["strict", "minimum"] - }, - beforeColon: { - type: "boolean" - }, - afterColon: { - type: "boolean" - } - }, - additionalProperties: false - }, - { - type: "object", - properties: { - singleLine: { - type: "object", - properties: { - mode: { - enum: ["strict", "minimum"] - }, - beforeColon: { - type: "boolean" - }, - afterColon: { - type: "boolean" - } - }, - additionalProperties: false - }, - multiLine: { - type: "object", - properties: { - align: { - anyOf: [ - { - enum: ["colon", "value"] - }, - { - type: "object", - properties: { - mode: { - enum: ["strict", "minimum"] - }, - on: { - enum: ["colon", "value"] - }, - beforeColon: { - type: "boolean" - }, - afterColon: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - }, - mode: { - enum: ["strict", "minimum"] - }, - beforeColon: { - type: "boolean" - }, - afterColon: { - type: "boolean" - } - }, - additionalProperties: false - } - }, - additionalProperties: false - }, - { - type: "object", - properties: { - singleLine: { - type: "object", - properties: { - mode: { - enum: ["strict", "minimum"] - }, - beforeColon: { - type: "boolean" - }, - afterColon: { - type: "boolean" - } - }, - additionalProperties: false - }, - multiLine: { - type: "object", - properties: { - mode: { - enum: ["strict", "minimum"] - }, - beforeColon: { - type: "boolean" - }, - afterColon: { - type: "boolean" - } - }, - additionalProperties: false - }, - align: { - type: "object", - properties: { - mode: { - enum: ["strict", "minimum"] - }, - on: { - enum: ["colon", "value"] - }, - beforeColon: { - type: "boolean" - }, - afterColon: { - type: "boolean" - } - }, - additionalProperties: false - } - }, - additionalProperties: false - } - ] - }], - messages: { - extraKey: "Extra space after {{computed}}key '{{key}}'.", - extraValue: "Extra space before value for {{computed}}key '{{key}}'.", - missingKey: "Missing space after {{computed}}key '{{key}}'.", - missingValue: "Missing space before value for {{computed}}key '{{key}}'." - } - }, - - create(context) { - - /** - * OPTIONS - * "key-spacing": [2, { - * beforeColon: false, - * afterColon: true, - * align: "colon" // Optional, or "value" - * } - */ - const options = context.options[0] || {}, - ruleOptions = initOptions({}, options), - multiLineOptions = ruleOptions.multiLine, - singleLineOptions = ruleOptions.singleLine, - alignmentOptions = ruleOptions.align || null; - - const sourceCode = context.sourceCode; - - /** - * Determines if the given property is key-value property. - * @param {ASTNode} property Property node to check. - * @returns {boolean} Whether the property is a key-value property. - */ - function isKeyValueProperty(property) { - return !( - (property.method || - property.shorthand || - property.kind !== "init" || property.type !== "Property") // Could be "ExperimentalSpreadProperty" or "SpreadElement" - ); - } - - /** - * Starting from the given node (a property.key node here) looks forward - * until it finds the colon punctuator and returns it. - * @param {ASTNode} node The node to start looking from. - * @returns {ASTNode} The colon punctuator. - */ - function getNextColon(node) { - return sourceCode.getTokenAfter(node, astUtils.isColonToken); - } - - /** - * Starting from the given node (a property.key node here) looks forward - * until it finds the last token before a colon punctuator and returns it. - * @param {ASTNode} node The node to start looking from. - * @returns {ASTNode} The last token before a colon punctuator. - */ - function getLastTokenBeforeColon(node) { - const colonToken = getNextColon(node); - - return sourceCode.getTokenBefore(colonToken); - } - - /** - * Starting from the given node (a property.key node here) looks forward - * until it finds the first token after a colon punctuator and returns it. - * @param {ASTNode} node The node to start looking from. - * @returns {ASTNode} The first token after a colon punctuator. - */ - function getFirstTokenAfterColon(node) { - const colonToken = getNextColon(node); - - return sourceCode.getTokenAfter(colonToken); - } - - /** - * Checks whether a property is a member of the property group it follows. - * @param {ASTNode} lastMember The last Property known to be in the group. - * @param {ASTNode} candidate The next Property that might be in the group. - * @returns {boolean} True if the candidate property is part of the group. - */ - function continuesPropertyGroup(lastMember, candidate) { - const groupEndLine = lastMember.loc.start.line, - candidateValueStartLine = (isKeyValueProperty(candidate) ? getFirstTokenAfterColon(candidate.key) : candidate).loc.start.line; - - if (candidateValueStartLine - groupEndLine <= 1) { - return true; - } - - /* - * Check that the first comment is adjacent to the end of the group, the - * last comment is adjacent to the candidate property, and that successive - * comments are adjacent to each other. - */ - const leadingComments = sourceCode.getCommentsBefore(candidate); - - if ( - leadingComments.length && - leadingComments[0].loc.start.line - groupEndLine <= 1 && - candidateValueStartLine - last(leadingComments).loc.end.line <= 1 - ) { - for (let i = 1; i < leadingComments.length; i++) { - if (leadingComments[i].loc.start.line - leadingComments[i - 1].loc.end.line > 1) { - return false; - } - } - return true; - } - - return false; - } - - /** - * Gets an object literal property's key as the identifier name or string value. - * @param {ASTNode} property Property node whose key to retrieve. - * @returns {string} The property's key. - */ - function getKey(property) { - const key = property.key; - - if (property.computed) { - return sourceCode.getText().slice(key.range[0], key.range[1]); - } - return astUtils.getStaticPropertyName(property); - } - - /** - * Reports an appropriately-formatted error if spacing is incorrect on one - * side of the colon. - * @param {ASTNode} property Key-value pair in an object literal. - * @param {string} side Side being verified - either "key" or "value". - * @param {string} whitespace Actual whitespace string. - * @param {int} expected Expected whitespace length. - * @param {string} mode Value of the mode as "strict" or "minimum" - * @returns {void} - */ - function report(property, side, whitespace, expected, mode) { - const diff = whitespace.length - expected; - - if (( - diff && mode === "strict" || - diff < 0 && mode === "minimum" || - diff > 0 && !expected && mode === "minimum") && - !(expected && containsLineTerminator(whitespace)) - ) { - const nextColon = getNextColon(property.key), - tokenBeforeColon = sourceCode.getTokenBefore(nextColon, { includeComments: true }), - tokenAfterColon = sourceCode.getTokenAfter(nextColon, { includeComments: true }), - isKeySide = side === "key", - isExtra = diff > 0, - diffAbs = Math.abs(diff), - spaces = Array(diffAbs + 1).join(" "); - - const locStart = isKeySide ? tokenBeforeColon.loc.end : nextColon.loc.start; - const locEnd = isKeySide ? nextColon.loc.start : tokenAfterColon.loc.start; - const missingLoc = isKeySide ? tokenBeforeColon.loc : tokenAfterColon.loc; - const loc = isExtra ? { start: locStart, end: locEnd } : missingLoc; - - let fix; - - if (isExtra) { - let range; - - // Remove whitespace - if (isKeySide) { - range = [tokenBeforeColon.range[1], tokenBeforeColon.range[1] + diffAbs]; - } else { - range = [tokenAfterColon.range[0] - diffAbs, tokenAfterColon.range[0]]; - } - fix = function(fixer) { - return fixer.removeRange(range); - }; - } else { - - // Add whitespace - if (isKeySide) { - fix = function(fixer) { - return fixer.insertTextAfter(tokenBeforeColon, spaces); - }; - } else { - fix = function(fixer) { - return fixer.insertTextBefore(tokenAfterColon, spaces); - }; - } - } - - let messageId = ""; - - if (isExtra) { - messageId = side === "key" ? "extraKey" : "extraValue"; - } else { - messageId = side === "key" ? "missingKey" : "missingValue"; - } - - context.report({ - node: property[side], - loc, - messageId, - data: { - computed: property.computed ? "computed " : "", - key: getKey(property) - }, - fix - }); - } - } - - /** - * Gets the number of characters in a key, including quotes around string - * keys and braces around computed property keys. - * @param {ASTNode} property Property of on object literal. - * @returns {int} Width of the key. - */ - function getKeyWidth(property) { - const startToken = sourceCode.getFirstToken(property); - const endToken = getLastTokenBeforeColon(property.key); - - return getGraphemeCount(sourceCode.getText().slice(startToken.range[0], endToken.range[1])); - } - - /** - * Gets the whitespace around the colon in an object literal property. - * @param {ASTNode} property Property node from an object literal. - * @returns {Object} Whitespace before and after the property's colon. - */ - function getPropertyWhitespace(property) { - const whitespace = /(\s*):(\s*)/u.exec(sourceCode.getText().slice( - property.key.range[1], property.value.range[0] - )); - - if (whitespace) { - return { - beforeColon: whitespace[1], - afterColon: whitespace[2] - }; - } - return null; - } - - /** - * Creates groups of properties. - * @param {ASTNode} node ObjectExpression node being evaluated. - * @returns {Array} Groups of property AST node lists. - */ - function createGroups(node) { - if (node.properties.length === 1) { - return [node.properties]; - } - - return node.properties.reduce((groups, property) => { - const currentGroup = last(groups), - prev = last(currentGroup); - - if (!prev || continuesPropertyGroup(prev, property)) { - currentGroup.push(property); - } else { - groups.push([property]); - } - - return groups; - }, [ - [] - ]); - } - - /** - * Verifies correct vertical alignment of a group of properties. - * @param {ASTNode[]} properties List of Property AST nodes. - * @returns {void} - */ - function verifyGroupAlignment(properties) { - const length = properties.length, - widths = properties.map(getKeyWidth), // Width of keys, including quotes - align = alignmentOptions.on; // "value" or "colon" - let targetWidth = Math.max(...widths), - beforeColon, afterColon, mode; - - if (alignmentOptions && length > 1) { // When aligning values within a group, use the alignment configuration. - beforeColon = alignmentOptions.beforeColon; - afterColon = alignmentOptions.afterColon; - mode = alignmentOptions.mode; - } else { - beforeColon = multiLineOptions.beforeColon; - afterColon = multiLineOptions.afterColon; - mode = alignmentOptions.mode; - } - - // Conditionally include one space before or after colon - targetWidth += (align === "colon" ? beforeColon : afterColon); - - for (let i = 0; i < length; i++) { - const property = properties[i]; - const whitespace = getPropertyWhitespace(property); - - if (whitespace) { // Object literal getters/setters lack a colon - const width = widths[i]; - - if (align === "value") { - report(property, "key", whitespace.beforeColon, beforeColon, mode); - report(property, "value", whitespace.afterColon, targetWidth - width, mode); - } else { // align = "colon" - report(property, "key", whitespace.beforeColon, targetWidth - width, mode); - report(property, "value", whitespace.afterColon, afterColon, mode); - } - } - } - } - - /** - * Verifies spacing of property conforms to specified options. - * @param {ASTNode} node Property node being evaluated. - * @param {Object} lineOptions Configured singleLine or multiLine options - * @returns {void} - */ - function verifySpacing(node, lineOptions) { - const actual = getPropertyWhitespace(node); - - if (actual) { // Object literal getters/setters lack colons - report(node, "key", actual.beforeColon, lineOptions.beforeColon, lineOptions.mode); - report(node, "value", actual.afterColon, lineOptions.afterColon, lineOptions.mode); - } - } - - /** - * Verifies spacing of each property in a list. - * @param {ASTNode[]} properties List of Property AST nodes. - * @param {Object} lineOptions Configured singleLine or multiLine options - * @returns {void} - */ - function verifyListSpacing(properties, lineOptions) { - const length = properties.length; - - for (let i = 0; i < length; i++) { - verifySpacing(properties[i], lineOptions); - } - } - - /** - * Verifies vertical alignment, taking into account groups of properties. - * @param {ASTNode} node ObjectExpression node being evaluated. - * @returns {void} - */ - function verifyAlignment(node) { - createGroups(node).forEach(group => { - const properties = group.filter(isKeyValueProperty); - - if (properties.length > 0 && isSingleLineProperties(properties)) { - verifyListSpacing(properties, multiLineOptions); - } else { - verifyGroupAlignment(properties); - } - }); - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - if (alignmentOptions) { // Verify vertical alignment - - return { - ObjectExpression(node) { - if (isSingleLine(node)) { - verifyListSpacing(node.properties.filter(isKeyValueProperty), singleLineOptions); - } else { - verifyAlignment(node); - } - } - }; - - } - - // Obey beforeColon and afterColon in each property as configured - return { - Property(node) { - verifySpacing(node, isSingleLine(node.parent) ? singleLineOptions : multiLineOptions); - } - }; - - - } -}; diff --git a/node_modules/eslint/lib/rules/keyword-spacing.js b/node_modules/eslint/lib/rules/keyword-spacing.js deleted file mode 100644 index 8ed821998..000000000 --- a/node_modules/eslint/lib/rules/keyword-spacing.js +++ /dev/null @@ -1,637 +0,0 @@ -/** - * @fileoverview Rule to enforce spacing before and after keywords. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"), - keywords = require("./utils/keywords"); - -//------------------------------------------------------------------------------ -// Constants -//------------------------------------------------------------------------------ - -const PREV_TOKEN = /^[)\]}>]$/u; -const NEXT_TOKEN = /^(?:[([{<~!]|\+\+?|--?)$/u; -const PREV_TOKEN_M = /^[)\]}>*]$/u; -const NEXT_TOKEN_M = /^[{*]$/u; -const TEMPLATE_OPEN_PAREN = /\$\{$/u; -const TEMPLATE_CLOSE_PAREN = /^\}/u; -const CHECK_TYPE = /^(?:JSXElement|RegularExpression|String|Template|PrivateIdentifier)$/u; -const KEYS = keywords.concat(["as", "async", "await", "from", "get", "let", "of", "set", "yield"]); - -// check duplications. -(function() { - KEYS.sort(); - for (let i = 1; i < KEYS.length; ++i) { - if (KEYS[i] === KEYS[i - 1]) { - throw new Error(`Duplication was found in the keyword list: ${KEYS[i]}`); - } - } -}()); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a given token is a "Template" token ends with "${". - * @param {Token} token A token to check. - * @returns {boolean} `true` if the token is a "Template" token ends with "${". - */ -function isOpenParenOfTemplate(token) { - return token.type === "Template" && TEMPLATE_OPEN_PAREN.test(token.value); -} - -/** - * Checks whether or not a given token is a "Template" token starts with "}". - * @param {Token} token A token to check. - * @returns {boolean} `true` if the token is a "Template" token starts with "}". - */ -function isCloseParenOfTemplate(token) { - return token.type === "Template" && TEMPLATE_CLOSE_PAREN.test(token.value); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing before and after keywords", - recommended: false, - url: "https://eslint.org/docs/latest/rules/keyword-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - before: { type: "boolean", default: true }, - after: { type: "boolean", default: true }, - overrides: { - type: "object", - properties: KEYS.reduce((retv, key) => { - retv[key] = { - type: "object", - properties: { - before: { type: "boolean" }, - after: { type: "boolean" } - }, - additionalProperties: false - }; - return retv; - }, {}), - additionalProperties: false - } - }, - additionalProperties: false - } - ], - messages: { - expectedBefore: "Expected space(s) before \"{{value}}\".", - expectedAfter: "Expected space(s) after \"{{value}}\".", - unexpectedBefore: "Unexpected space(s) before \"{{value}}\".", - unexpectedAfter: "Unexpected space(s) after \"{{value}}\"." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - const tokensToIgnore = new WeakSet(); - - /** - * Reports a given token if there are not space(s) before the token. - * @param {Token} token A token to report. - * @param {RegExp} pattern A pattern of the previous token to check. - * @returns {void} - */ - function expectSpaceBefore(token, pattern) { - const prevToken = sourceCode.getTokenBefore(token); - - if (prevToken && - (CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) && - !isOpenParenOfTemplate(prevToken) && - !tokensToIgnore.has(prevToken) && - astUtils.isTokenOnSameLine(prevToken, token) && - !sourceCode.isSpaceBetweenTokens(prevToken, token) - ) { - context.report({ - loc: token.loc, - messageId: "expectedBefore", - data: token, - fix(fixer) { - return fixer.insertTextBefore(token, " "); - } - }); - } - } - - /** - * Reports a given token if there are space(s) before the token. - * @param {Token} token A token to report. - * @param {RegExp} pattern A pattern of the previous token to check. - * @returns {void} - */ - function unexpectSpaceBefore(token, pattern) { - const prevToken = sourceCode.getTokenBefore(token); - - if (prevToken && - (CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) && - !isOpenParenOfTemplate(prevToken) && - !tokensToIgnore.has(prevToken) && - astUtils.isTokenOnSameLine(prevToken, token) && - sourceCode.isSpaceBetweenTokens(prevToken, token) - ) { - context.report({ - loc: { start: prevToken.loc.end, end: token.loc.start }, - messageId: "unexpectedBefore", - data: token, - fix(fixer) { - return fixer.removeRange([prevToken.range[1], token.range[0]]); - } - }); - } - } - - /** - * Reports a given token if there are not space(s) after the token. - * @param {Token} token A token to report. - * @param {RegExp} pattern A pattern of the next token to check. - * @returns {void} - */ - function expectSpaceAfter(token, pattern) { - const nextToken = sourceCode.getTokenAfter(token); - - if (nextToken && - (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && - !isCloseParenOfTemplate(nextToken) && - !tokensToIgnore.has(nextToken) && - astUtils.isTokenOnSameLine(token, nextToken) && - !sourceCode.isSpaceBetweenTokens(token, nextToken) - ) { - context.report({ - loc: token.loc, - messageId: "expectedAfter", - data: token, - fix(fixer) { - return fixer.insertTextAfter(token, " "); - } - }); - } - } - - /** - * Reports a given token if there are space(s) after the token. - * @param {Token} token A token to report. - * @param {RegExp} pattern A pattern of the next token to check. - * @returns {void} - */ - function unexpectSpaceAfter(token, pattern) { - const nextToken = sourceCode.getTokenAfter(token); - - if (nextToken && - (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && - !isCloseParenOfTemplate(nextToken) && - !tokensToIgnore.has(nextToken) && - astUtils.isTokenOnSameLine(token, nextToken) && - sourceCode.isSpaceBetweenTokens(token, nextToken) - ) { - - context.report({ - loc: { start: token.loc.end, end: nextToken.loc.start }, - messageId: "unexpectedAfter", - data: token, - fix(fixer) { - return fixer.removeRange([token.range[1], nextToken.range[0]]); - } - }); - } - } - - /** - * Parses the option object and determines check methods for each keyword. - * @param {Object|undefined} options The option object to parse. - * @returns {Object} - Normalized option object. - * Keys are keywords (there are for every keyword). - * Values are instances of `{"before": function, "after": function}`. - */ - function parseOptions(options = {}) { - const before = options.before !== false; - const after = options.after !== false; - const defaultValue = { - before: before ? expectSpaceBefore : unexpectSpaceBefore, - after: after ? expectSpaceAfter : unexpectSpaceAfter - }; - const overrides = (options && options.overrides) || {}; - const retv = Object.create(null); - - for (let i = 0; i < KEYS.length; ++i) { - const key = KEYS[i]; - const override = overrides[key]; - - if (override) { - const thisBefore = ("before" in override) ? override.before : before; - const thisAfter = ("after" in override) ? override.after : after; - - retv[key] = { - before: thisBefore ? expectSpaceBefore : unexpectSpaceBefore, - after: thisAfter ? expectSpaceAfter : unexpectSpaceAfter - }; - } else { - retv[key] = defaultValue; - } - } - - return retv; - } - - const checkMethodMap = parseOptions(context.options[0]); - - /** - * Reports a given token if usage of spacing followed by the token is - * invalid. - * @param {Token} token A token to report. - * @param {RegExp} [pattern] Optional. A pattern of the previous - * token to check. - * @returns {void} - */ - function checkSpacingBefore(token, pattern) { - checkMethodMap[token.value].before(token, pattern || PREV_TOKEN); - } - - /** - * Reports a given token if usage of spacing preceded by the token is - * invalid. - * @param {Token} token A token to report. - * @param {RegExp} [pattern] Optional. A pattern of the next - * token to check. - * @returns {void} - */ - function checkSpacingAfter(token, pattern) { - checkMethodMap[token.value].after(token, pattern || NEXT_TOKEN); - } - - /** - * Reports a given token if usage of spacing around the token is invalid. - * @param {Token} token A token to report. - * @returns {void} - */ - function checkSpacingAround(token) { - checkSpacingBefore(token); - checkSpacingAfter(token); - } - - /** - * Reports the first token of a given node if the first token is a keyword - * and usage of spacing around the token is invalid. - * @param {ASTNode|null} node A node to report. - * @returns {void} - */ - function checkSpacingAroundFirstToken(node) { - const firstToken = node && sourceCode.getFirstToken(node); - - if (firstToken && firstToken.type === "Keyword") { - checkSpacingAround(firstToken); - } - } - - /** - * Reports the first token of a given node if the first token is a keyword - * and usage of spacing followed by the token is invalid. - * - * This is used for unary operators (e.g. `typeof`), `function`, and `super`. - * Other rules are handling usage of spacing preceded by those keywords. - * @param {ASTNode|null} node A node to report. - * @returns {void} - */ - function checkSpacingBeforeFirstToken(node) { - const firstToken = node && sourceCode.getFirstToken(node); - - if (firstToken && firstToken.type === "Keyword") { - checkSpacingBefore(firstToken); - } - } - - /** - * Reports the previous token of a given node if the token is a keyword and - * usage of spacing around the token is invalid. - * @param {ASTNode|null} node A node to report. - * @returns {void} - */ - function checkSpacingAroundTokenBefore(node) { - if (node) { - const token = sourceCode.getTokenBefore(node, astUtils.isKeywordToken); - - checkSpacingAround(token); - } - } - - /** - * Reports `async` or `function` keywords of a given node if usage of - * spacing around those keywords is invalid. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForFunction(node) { - const firstToken = node && sourceCode.getFirstToken(node); - - if (firstToken && - ((firstToken.type === "Keyword" && firstToken.value === "function") || - firstToken.value === "async") - ) { - checkSpacingBefore(firstToken); - } - } - - /** - * Reports `class` and `extends` keywords of a given node if usage of - * spacing around those keywords is invalid. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForClass(node) { - checkSpacingAroundFirstToken(node); - checkSpacingAroundTokenBefore(node.superClass); - } - - /** - * Reports `if` and `else` keywords of a given node if usage of spacing - * around those keywords is invalid. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForIfStatement(node) { - checkSpacingAroundFirstToken(node); - checkSpacingAroundTokenBefore(node.alternate); - } - - /** - * Reports `try`, `catch`, and `finally` keywords of a given node if usage - * of spacing around those keywords is invalid. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForTryStatement(node) { - checkSpacingAroundFirstToken(node); - checkSpacingAroundFirstToken(node.handler); - checkSpacingAroundTokenBefore(node.finalizer); - } - - /** - * Reports `do` and `while` keywords of a given node if usage of spacing - * around those keywords is invalid. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForDoWhileStatement(node) { - checkSpacingAroundFirstToken(node); - checkSpacingAroundTokenBefore(node.test); - } - - /** - * Reports `for` and `in` keywords of a given node if usage of spacing - * around those keywords is invalid. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForForInStatement(node) { - checkSpacingAroundFirstToken(node); - - const inToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); - const previousToken = sourceCode.getTokenBefore(inToken); - - if (previousToken.type !== "PrivateIdentifier") { - checkSpacingBefore(inToken); - } - - checkSpacingAfter(inToken); - } - - /** - * Reports `for` and `of` keywords of a given node if usage of spacing - * around those keywords is invalid. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForForOfStatement(node) { - if (node.await) { - checkSpacingBefore(sourceCode.getFirstToken(node, 0)); - checkSpacingAfter(sourceCode.getFirstToken(node, 1)); - } else { - checkSpacingAroundFirstToken(node); - } - - const ofToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); - const previousToken = sourceCode.getTokenBefore(ofToken); - - if (previousToken.type !== "PrivateIdentifier") { - checkSpacingBefore(ofToken); - } - - checkSpacingAfter(ofToken); - } - - /** - * Reports `import`, `export`, `as`, and `from` keywords of a given node if - * usage of spacing around those keywords is invalid. - * - * This rule handles the `*` token in module declarations. - * - * import*as A from "./a"; /*error Expected space(s) after "import". - * error Expected space(s) before "as". - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForModuleDeclaration(node) { - const firstToken = sourceCode.getFirstToken(node); - - checkSpacingBefore(firstToken, PREV_TOKEN_M); - checkSpacingAfter(firstToken, NEXT_TOKEN_M); - - if (node.type === "ExportDefaultDeclaration") { - checkSpacingAround(sourceCode.getTokenAfter(firstToken)); - } - - if (node.type === "ExportAllDeclaration" && node.exported) { - const asToken = sourceCode.getTokenBefore(node.exported); - - checkSpacingBefore(asToken, PREV_TOKEN_M); - checkSpacingAfter(asToken, NEXT_TOKEN_M); - } - - if (node.source) { - const fromToken = sourceCode.getTokenBefore(node.source); - - checkSpacingBefore(fromToken, PREV_TOKEN_M); - checkSpacingAfter(fromToken, NEXT_TOKEN_M); - } - } - - /** - * Reports `as` keyword of a given node if usage of spacing around this - * keyword is invalid. - * @param {ASTNode} node An `ImportSpecifier` node to check. - * @returns {void} - */ - function checkSpacingForImportSpecifier(node) { - if (node.imported.range[0] !== node.local.range[0]) { - const asToken = sourceCode.getTokenBefore(node.local); - - checkSpacingBefore(asToken, PREV_TOKEN_M); - } - } - - /** - * Reports `as` keyword of a given node if usage of spacing around this - * keyword is invalid. - * @param {ASTNode} node An `ExportSpecifier` node to check. - * @returns {void} - */ - function checkSpacingForExportSpecifier(node) { - if (node.local.range[0] !== node.exported.range[0]) { - const asToken = sourceCode.getTokenBefore(node.exported); - - checkSpacingBefore(asToken, PREV_TOKEN_M); - checkSpacingAfter(asToken, NEXT_TOKEN_M); - } - } - - /** - * Reports `as` keyword of a given node if usage of spacing around this - * keyword is invalid. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForImportNamespaceSpecifier(node) { - const asToken = sourceCode.getFirstToken(node, 1); - - checkSpacingBefore(asToken, PREV_TOKEN_M); - } - - /** - * Reports `static`, `get`, and `set` keywords of a given node if usage of - * spacing around those keywords is invalid. - * @param {ASTNode} node A node to report. - * @throws {Error} If unable to find token get, set, or async beside method name. - * @returns {void} - */ - function checkSpacingForProperty(node) { - if (node.static) { - checkSpacingAroundFirstToken(node); - } - if (node.kind === "get" || - node.kind === "set" || - ( - (node.method || node.type === "MethodDefinition") && - node.value.async - ) - ) { - const token = sourceCode.getTokenBefore( - node.key, - tok => { - switch (tok.value) { - case "get": - case "set": - case "async": - return true; - default: - return false; - } - } - ); - - if (!token) { - throw new Error("Failed to find token get, set, or async beside method name"); - } - - - checkSpacingAround(token); - } - } - - /** - * Reports `await` keyword of a given node if usage of spacing before - * this keyword is invalid. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function checkSpacingForAwaitExpression(node) { - checkSpacingBefore(sourceCode.getFirstToken(node)); - } - - return { - - // Statements - DebuggerStatement: checkSpacingAroundFirstToken, - WithStatement: checkSpacingAroundFirstToken, - - // Statements - Control flow - BreakStatement: checkSpacingAroundFirstToken, - ContinueStatement: checkSpacingAroundFirstToken, - ReturnStatement: checkSpacingAroundFirstToken, - ThrowStatement: checkSpacingAroundFirstToken, - TryStatement: checkSpacingForTryStatement, - - // Statements - Choice - IfStatement: checkSpacingForIfStatement, - SwitchStatement: checkSpacingAroundFirstToken, - SwitchCase: checkSpacingAroundFirstToken, - - // Statements - Loops - DoWhileStatement: checkSpacingForDoWhileStatement, - ForInStatement: checkSpacingForForInStatement, - ForOfStatement: checkSpacingForForOfStatement, - ForStatement: checkSpacingAroundFirstToken, - WhileStatement: checkSpacingAroundFirstToken, - - // Statements - Declarations - ClassDeclaration: checkSpacingForClass, - ExportNamedDeclaration: checkSpacingForModuleDeclaration, - ExportDefaultDeclaration: checkSpacingForModuleDeclaration, - ExportAllDeclaration: checkSpacingForModuleDeclaration, - FunctionDeclaration: checkSpacingForFunction, - ImportDeclaration: checkSpacingForModuleDeclaration, - VariableDeclaration: checkSpacingAroundFirstToken, - - // Expressions - ArrowFunctionExpression: checkSpacingForFunction, - AwaitExpression: checkSpacingForAwaitExpression, - ClassExpression: checkSpacingForClass, - FunctionExpression: checkSpacingForFunction, - NewExpression: checkSpacingBeforeFirstToken, - Super: checkSpacingBeforeFirstToken, - ThisExpression: checkSpacingBeforeFirstToken, - UnaryExpression: checkSpacingBeforeFirstToken, - YieldExpression: checkSpacingBeforeFirstToken, - - // Others - ImportSpecifier: checkSpacingForImportSpecifier, - ExportSpecifier: checkSpacingForExportSpecifier, - ImportNamespaceSpecifier: checkSpacingForImportNamespaceSpecifier, - MethodDefinition: checkSpacingForProperty, - PropertyDefinition: checkSpacingForProperty, - StaticBlock: checkSpacingAroundFirstToken, - Property: checkSpacingForProperty, - - // To avoid conflicts with `space-infix-ops`, e.g. `a > this.b` - "BinaryExpression[operator='>']"(node) { - const operatorToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); - - tokensToIgnore.add(operatorToken); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/line-comment-position.js b/node_modules/eslint/lib/rules/line-comment-position.js deleted file mode 100644 index 314fac167..000000000 --- a/node_modules/eslint/lib/rules/line-comment-position.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @fileoverview Rule to enforce the position of line comments - * @author Alberto Rodríguez - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce position of line comments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/line-comment-position" - }, - - schema: [ - { - oneOf: [ - { - enum: ["above", "beside"] - }, - { - type: "object", - properties: { - position: { - enum: ["above", "beside"] - }, - ignorePattern: { - type: "string" - }, - applyDefaultPatterns: { - type: "boolean" - }, - applyDefaultIgnorePatterns: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - } - ], - messages: { - above: "Expected comment to be above code.", - beside: "Expected comment to be beside code." - } - }, - - create(context) { - const options = context.options[0]; - - let above, - ignorePattern, - applyDefaultIgnorePatterns = true; - - if (!options || typeof options === "string") { - above = !options || options === "above"; - - } else { - above = !options.position || options.position === "above"; - ignorePattern = options.ignorePattern; - - if (Object.prototype.hasOwnProperty.call(options, "applyDefaultIgnorePatterns")) { - applyDefaultIgnorePatterns = options.applyDefaultIgnorePatterns; - } else { - applyDefaultIgnorePatterns = options.applyDefaultPatterns !== false; - } - } - - const defaultIgnoreRegExp = astUtils.COMMENTS_IGNORE_PATTERN; - const fallThroughRegExp = /^\s*falls?\s?through/u; - const customIgnoreRegExp = new RegExp(ignorePattern, "u"); - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - Program() { - const comments = sourceCode.getAllComments(); - - comments.filter(token => token.type === "Line").forEach(node => { - if (applyDefaultIgnorePatterns && (defaultIgnoreRegExp.test(node.value) || fallThroughRegExp.test(node.value))) { - return; - } - - if (ignorePattern && customIgnoreRegExp.test(node.value)) { - return; - } - - const previous = sourceCode.getTokenBefore(node, { includeComments: true }); - const isOnSameLine = previous && previous.loc.end.line === node.loc.start.line; - - if (above) { - if (isOnSameLine) { - context.report({ - node, - messageId: "above" - }); - } - } else { - if (!isOnSameLine) { - context.report({ - node, - messageId: "beside" - }); - } - } - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/linebreak-style.js b/node_modules/eslint/lib/rules/linebreak-style.js deleted file mode 100644 index d8f36094b..000000000 --- a/node_modules/eslint/lib/rules/linebreak-style.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @fileoverview Rule to enforce a single linebreak style. - * @author Erik Mueller - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent linebreak style", - recommended: false, - url: "https://eslint.org/docs/latest/rules/linebreak-style" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["unix", "windows"] - } - ], - messages: { - expectedLF: "Expected linebreaks to be 'LF' but found 'CRLF'.", - expectedCRLF: "Expected linebreaks to be 'CRLF' but found 'LF'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Builds a fix function that replaces text at the specified range in the source text. - * @param {int[]} range The range to replace - * @param {string} text The text to insert. - * @returns {Function} Fixer function - * @private - */ - function createFix(range, text) { - return function(fixer) { - return fixer.replaceTextRange(range, text); - }; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - Program: function checkForLinebreakStyle(node) { - const linebreakStyle = context.options[0] || "unix", - expectedLF = linebreakStyle === "unix", - expectedLFChars = expectedLF ? "\n" : "\r\n", - source = sourceCode.getText(), - pattern = astUtils.createGlobalLinebreakMatcher(); - let match; - - let i = 0; - - while ((match = pattern.exec(source)) !== null) { - i++; - if (match[0] === expectedLFChars) { - continue; - } - - const index = match.index; - const range = [index, index + match[0].length]; - - context.report({ - node, - loc: { - start: { - line: i, - column: sourceCode.lines[i - 1].length - }, - end: { - line: i + 1, - column: 0 - } - }, - messageId: expectedLF ? "expectedLF" : "expectedCRLF", - fix: createFix(range, expectedLFChars) - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/lines-around-comment.js b/node_modules/eslint/lib/rules/lines-around-comment.js deleted file mode 100644 index 10aeba3cb..000000000 --- a/node_modules/eslint/lib/rules/lines-around-comment.js +++ /dev/null @@ -1,468 +0,0 @@ -/** - * @fileoverview Enforces empty lines around comments. - * @author Jamund Ferguson - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Return an array with any line numbers that are empty. - * @param {Array} lines An array of each line of the file. - * @returns {Array} An array of line numbers. - */ -function getEmptyLineNums(lines) { - const emptyLines = lines.map((line, i) => ({ - code: line.trim(), - num: i + 1 - })).filter(line => !line.code).map(line => line.num); - - return emptyLines; -} - -/** - * Return an array with any line numbers that contain comments. - * @param {Array} comments An array of comment tokens. - * @returns {Array} An array of line numbers. - */ -function getCommentLineNums(comments) { - const lines = []; - - comments.forEach(token => { - const start = token.loc.start.line; - const end = token.loc.end.line; - - lines.push(start, end); - }); - return lines; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require empty lines around comments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/lines-around-comment" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - beforeBlockComment: { - type: "boolean", - default: true - }, - afterBlockComment: { - type: "boolean", - default: false - }, - beforeLineComment: { - type: "boolean", - default: false - }, - afterLineComment: { - type: "boolean", - default: false - }, - allowBlockStart: { - type: "boolean", - default: false - }, - allowBlockEnd: { - type: "boolean", - default: false - }, - allowClassStart: { - type: "boolean" - }, - allowClassEnd: { - type: "boolean" - }, - allowObjectStart: { - type: "boolean" - }, - allowObjectEnd: { - type: "boolean" - }, - allowArrayStart: { - type: "boolean" - }, - allowArrayEnd: { - type: "boolean" - }, - ignorePattern: { - type: "string" - }, - applyDefaultIgnorePatterns: { - type: "boolean" - }, - afterHashbangComment: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - messages: { - after: "Expected line after comment.", - before: "Expected line before comment." - } - }, - - create(context) { - - const options = Object.assign({}, context.options[0]); - const ignorePattern = options.ignorePattern; - const defaultIgnoreRegExp = astUtils.COMMENTS_IGNORE_PATTERN; - const customIgnoreRegExp = new RegExp(ignorePattern, "u"); - const applyDefaultIgnorePatterns = options.applyDefaultIgnorePatterns !== false; - - options.beforeBlockComment = typeof options.beforeBlockComment !== "undefined" ? options.beforeBlockComment : true; - - const sourceCode = context.sourceCode; - - const lines = sourceCode.lines, - numLines = lines.length + 1, - comments = sourceCode.getAllComments(), - commentLines = getCommentLineNums(comments), - emptyLines = getEmptyLineNums(lines), - commentAndEmptyLines = new Set(commentLines.concat(emptyLines)); - - /** - * Returns whether or not comments are on lines starting with or ending with code - * @param {token} token The comment token to check. - * @returns {boolean} True if the comment is not alone. - */ - function codeAroundComment(token) { - let currentToken = token; - - do { - currentToken = sourceCode.getTokenBefore(currentToken, { includeComments: true }); - } while (currentToken && astUtils.isCommentToken(currentToken)); - - if (currentToken && astUtils.isTokenOnSameLine(currentToken, token)) { - return true; - } - - currentToken = token; - do { - currentToken = sourceCode.getTokenAfter(currentToken, { includeComments: true }); - } while (currentToken && astUtils.isCommentToken(currentToken)); - - if (currentToken && astUtils.isTokenOnSameLine(token, currentToken)) { - return true; - } - - return false; - } - - /** - * Returns whether or not comments are inside a node type or not. - * @param {ASTNode} parent The Comment parent node. - * @param {string} nodeType The parent type to check against. - * @returns {boolean} True if the comment is inside nodeType. - */ - function isParentNodeType(parent, nodeType) { - return parent.type === nodeType || - (parent.body && parent.body.type === nodeType) || - (parent.consequent && parent.consequent.type === nodeType); - } - - /** - * Returns the parent node that contains the given token. - * @param {token} token The token to check. - * @returns {ASTNode|null} The parent node that contains the given token. - */ - function getParentNodeOfToken(token) { - const node = sourceCode.getNodeByRangeIndex(token.range[0]); - - /* - * For the purpose of this rule, the comment token is in a `StaticBlock` node only - * if it's inside the braces of that `StaticBlock` node. - * - * Example where this function returns `null`: - * - * static - * // comment - * { - * } - * - * Example where this function returns `StaticBlock` node: - * - * static - * { - * // comment - * } - * - */ - if (node && node.type === "StaticBlock") { - const openingBrace = sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token - - return token.range[0] >= openingBrace.range[0] - ? node - : null; - } - - return node; - } - - /** - * Returns whether or not comments are at the parent start or not. - * @param {token} token The Comment token. - * @param {string} nodeType The parent type to check against. - * @returns {boolean} True if the comment is at parent start. - */ - function isCommentAtParentStart(token, nodeType) { - const parent = getParentNodeOfToken(token); - - if (parent && isParentNodeType(parent, nodeType)) { - let parentStartNodeOrToken = parent; - - if (parent.type === "StaticBlock") { - parentStartNodeOrToken = sourceCode.getFirstToken(parent, { skip: 1 }); // opening brace of the static block - } else if (parent.type === "SwitchStatement") { - parentStartNodeOrToken = sourceCode.getTokenAfter(parent.discriminant, { - filter: astUtils.isOpeningBraceToken - }); // opening brace of the switch statement - } - - return token.loc.start.line - parentStartNodeOrToken.loc.start.line === 1; - } - - return false; - } - - /** - * Returns whether or not comments are at the parent end or not. - * @param {token} token The Comment token. - * @param {string} nodeType The parent type to check against. - * @returns {boolean} True if the comment is at parent end. - */ - function isCommentAtParentEnd(token, nodeType) { - const parent = getParentNodeOfToken(token); - - return !!parent && isParentNodeType(parent, nodeType) && - parent.loc.end.line - token.loc.end.line === 1; - } - - /** - * Returns whether or not comments are at the block start or not. - * @param {token} token The Comment token. - * @returns {boolean} True if the comment is at block start. - */ - function isCommentAtBlockStart(token) { - return ( - isCommentAtParentStart(token, "ClassBody") || - isCommentAtParentStart(token, "BlockStatement") || - isCommentAtParentStart(token, "StaticBlock") || - isCommentAtParentStart(token, "SwitchCase") || - isCommentAtParentStart(token, "SwitchStatement") - ); - } - - /** - * Returns whether or not comments are at the block end or not. - * @param {token} token The Comment token. - * @returns {boolean} True if the comment is at block end. - */ - function isCommentAtBlockEnd(token) { - return ( - isCommentAtParentEnd(token, "ClassBody") || - isCommentAtParentEnd(token, "BlockStatement") || - isCommentAtParentEnd(token, "StaticBlock") || - isCommentAtParentEnd(token, "SwitchCase") || - isCommentAtParentEnd(token, "SwitchStatement") - ); - } - - /** - * Returns whether or not comments are at the class start or not. - * @param {token} token The Comment token. - * @returns {boolean} True if the comment is at class start. - */ - function isCommentAtClassStart(token) { - return isCommentAtParentStart(token, "ClassBody"); - } - - /** - * Returns whether or not comments are at the class end or not. - * @param {token} token The Comment token. - * @returns {boolean} True if the comment is at class end. - */ - function isCommentAtClassEnd(token) { - return isCommentAtParentEnd(token, "ClassBody"); - } - - /** - * Returns whether or not comments are at the object start or not. - * @param {token} token The Comment token. - * @returns {boolean} True if the comment is at object start. - */ - function isCommentAtObjectStart(token) { - return isCommentAtParentStart(token, "ObjectExpression") || isCommentAtParentStart(token, "ObjectPattern"); - } - - /** - * Returns whether or not comments are at the object end or not. - * @param {token} token The Comment token. - * @returns {boolean} True if the comment is at object end. - */ - function isCommentAtObjectEnd(token) { - return isCommentAtParentEnd(token, "ObjectExpression") || isCommentAtParentEnd(token, "ObjectPattern"); - } - - /** - * Returns whether or not comments are at the array start or not. - * @param {token} token The Comment token. - * @returns {boolean} True if the comment is at array start. - */ - function isCommentAtArrayStart(token) { - return isCommentAtParentStart(token, "ArrayExpression") || isCommentAtParentStart(token, "ArrayPattern"); - } - - /** - * Returns whether or not comments are at the array end or not. - * @param {token} token The Comment token. - * @returns {boolean} True if the comment is at array end. - */ - function isCommentAtArrayEnd(token) { - return isCommentAtParentEnd(token, "ArrayExpression") || isCommentAtParentEnd(token, "ArrayPattern"); - } - - /** - * Checks if a comment token has lines around it (ignores inline comments) - * @param {token} token The Comment token. - * @param {Object} opts Options to determine the newline. - * @param {boolean} opts.after Should have a newline after this line. - * @param {boolean} opts.before Should have a newline before this line. - * @returns {void} - */ - function checkForEmptyLine(token, opts) { - if (applyDefaultIgnorePatterns && defaultIgnoreRegExp.test(token.value)) { - return; - } - - if (ignorePattern && customIgnoreRegExp.test(token.value)) { - return; - } - - let after = opts.after, - before = opts.before; - - const prevLineNum = token.loc.start.line - 1, - nextLineNum = token.loc.end.line + 1, - commentIsNotAlone = codeAroundComment(token); - - const blockStartAllowed = options.allowBlockStart && - isCommentAtBlockStart(token) && - !(options.allowClassStart === false && - isCommentAtClassStart(token)), - blockEndAllowed = options.allowBlockEnd && isCommentAtBlockEnd(token) && !(options.allowClassEnd === false && isCommentAtClassEnd(token)), - classStartAllowed = options.allowClassStart && isCommentAtClassStart(token), - classEndAllowed = options.allowClassEnd && isCommentAtClassEnd(token), - objectStartAllowed = options.allowObjectStart && isCommentAtObjectStart(token), - objectEndAllowed = options.allowObjectEnd && isCommentAtObjectEnd(token), - arrayStartAllowed = options.allowArrayStart && isCommentAtArrayStart(token), - arrayEndAllowed = options.allowArrayEnd && isCommentAtArrayEnd(token); - - const exceptionStartAllowed = blockStartAllowed || classStartAllowed || objectStartAllowed || arrayStartAllowed; - const exceptionEndAllowed = blockEndAllowed || classEndAllowed || objectEndAllowed || arrayEndAllowed; - - // ignore top of the file and bottom of the file - if (prevLineNum < 1) { - before = false; - } - if (nextLineNum >= numLines) { - after = false; - } - - // we ignore all inline comments - if (commentIsNotAlone) { - return; - } - - const previousTokenOrComment = sourceCode.getTokenBefore(token, { includeComments: true }); - const nextTokenOrComment = sourceCode.getTokenAfter(token, { includeComments: true }); - - // check for newline before - if (!exceptionStartAllowed && before && !commentAndEmptyLines.has(prevLineNum) && - !(astUtils.isCommentToken(previousTokenOrComment) && astUtils.isTokenOnSameLine(previousTokenOrComment, token))) { - const lineStart = token.range[0] - token.loc.start.column; - const range = [lineStart, lineStart]; - - context.report({ - node: token, - messageId: "before", - fix(fixer) { - return fixer.insertTextBeforeRange(range, "\n"); - } - }); - } - - // check for newline after - if (!exceptionEndAllowed && after && !commentAndEmptyLines.has(nextLineNum) && - !(astUtils.isCommentToken(nextTokenOrComment) && astUtils.isTokenOnSameLine(token, nextTokenOrComment))) { - context.report({ - node: token, - messageId: "after", - fix(fixer) { - return fixer.insertTextAfter(token, "\n"); - } - }); - } - - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - Program() { - comments.forEach(token => { - if (token.type === "Line") { - if (options.beforeLineComment || options.afterLineComment) { - checkForEmptyLine(token, { - after: options.afterLineComment, - before: options.beforeLineComment - }); - } - } else if (token.type === "Block") { - if (options.beforeBlockComment || options.afterBlockComment) { - checkForEmptyLine(token, { - after: options.afterBlockComment, - before: options.beforeBlockComment - }); - } - } else if (token.type === "Shebang") { - if (options.afterHashbangComment) { - checkForEmptyLine(token, { - after: options.afterHashbangComment, - before: false - }); - } - } - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/lines-around-directive.js b/node_modules/eslint/lib/rules/lines-around-directive.js deleted file mode 100644 index 1c82d8f98..000000000 --- a/node_modules/eslint/lib/rules/lines-around-directive.js +++ /dev/null @@ -1,201 +0,0 @@ -/** - * @fileoverview Require or disallow newlines around directives. - * @author Kai Cataldo - * @deprecated in ESLint v4.0.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow newlines around directives", - recommended: false, - url: "https://eslint.org/docs/latest/rules/lines-around-directive" - }, - - schema: [{ - oneOf: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - before: { - enum: ["always", "never"] - }, - after: { - enum: ["always", "never"] - } - }, - additionalProperties: false, - minProperties: 2 - } - ] - }], - - fixable: "whitespace", - messages: { - expected: "Expected newline {{location}} \"{{value}}\" directive.", - unexpected: "Unexpected newline {{location}} \"{{value}}\" directive." - }, - deprecated: true, - replacedBy: ["padding-line-between-statements"] - }, - - create(context) { - const sourceCode = context.sourceCode; - const config = context.options[0] || "always"; - const expectLineBefore = typeof config === "string" ? config : config.before; - const expectLineAfter = typeof config === "string" ? config : config.after; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Check if node is preceded by a blank newline. - * @param {ASTNode} node Node to check. - * @returns {boolean} Whether or not the passed in node is preceded by a blank newline. - */ - function hasNewlineBefore(node) { - const tokenBefore = sourceCode.getTokenBefore(node, { includeComments: true }); - const tokenLineBefore = tokenBefore ? tokenBefore.loc.end.line : 0; - - return node.loc.start.line - tokenLineBefore >= 2; - } - - /** - * Gets the last token of a node that is on the same line as the rest of the node. - * This will usually be the last token of the node, but it will be the second-to-last token if the node has a trailing - * semicolon on a different line. - * @param {ASTNode} node A directive node - * @returns {Token} The last token of the node on the line - */ - function getLastTokenOnLine(node) { - const lastToken = sourceCode.getLastToken(node); - const secondToLastToken = sourceCode.getTokenBefore(lastToken); - - return astUtils.isSemicolonToken(lastToken) && lastToken.loc.start.line > secondToLastToken.loc.end.line - ? secondToLastToken - : lastToken; - } - - /** - * Check if node is followed by a blank newline. - * @param {ASTNode} node Node to check. - * @returns {boolean} Whether or not the passed in node is followed by a blank newline. - */ - function hasNewlineAfter(node) { - const lastToken = getLastTokenOnLine(node); - const tokenAfter = sourceCode.getTokenAfter(lastToken, { includeComments: true }); - - return tokenAfter.loc.start.line - lastToken.loc.end.line >= 2; - } - - /** - * Report errors for newlines around directives. - * @param {ASTNode} node Node to check. - * @param {string} location Whether the error was found before or after the directive. - * @param {boolean} expected Whether or not a newline was expected or unexpected. - * @returns {void} - */ - function reportError(node, location, expected) { - context.report({ - node, - messageId: expected ? "expected" : "unexpected", - data: { - value: node.expression.value, - location - }, - fix(fixer) { - const lastToken = getLastTokenOnLine(node); - - if (expected) { - return location === "before" ? fixer.insertTextBefore(node, "\n") : fixer.insertTextAfter(lastToken, "\n"); - } - return fixer.removeRange(location === "before" ? [node.range[0] - 1, node.range[0]] : [lastToken.range[1], lastToken.range[1] + 1]); - } - }); - } - - /** - * Check lines around directives in node - * @param {ASTNode} node node to check - * @returns {void} - */ - function checkDirectives(node) { - const directives = astUtils.getDirectivePrologue(node); - - if (!directives.length) { - return; - } - - const firstDirective = directives[0]; - const leadingComments = sourceCode.getCommentsBefore(firstDirective); - - /* - * Only check before the first directive if it is preceded by a comment or if it is at the top of - * the file and expectLineBefore is set to "never". This is to not force a newline at the top of - * the file if there are no comments as well as for compatibility with padded-blocks. - */ - if (leadingComments.length) { - if (expectLineBefore === "always" && !hasNewlineBefore(firstDirective)) { - reportError(firstDirective, "before", true); - } - - if (expectLineBefore === "never" && hasNewlineBefore(firstDirective)) { - reportError(firstDirective, "before", false); - } - } else if ( - node.type === "Program" && - expectLineBefore === "never" && - !leadingComments.length && - hasNewlineBefore(firstDirective) - ) { - reportError(firstDirective, "before", false); - } - - const lastDirective = directives[directives.length - 1]; - const statements = node.type === "Program" ? node.body : node.body.body; - - /* - * Do not check after the last directive if the body only - * contains a directive prologue and isn't followed by a comment to ensure - * this rule behaves well with padded-blocks. - */ - if (lastDirective === statements[statements.length - 1] && !lastDirective.trailingComments) { - return; - } - - if (expectLineAfter === "always" && !hasNewlineAfter(lastDirective)) { - reportError(lastDirective, "after", true); - } - - if (expectLineAfter === "never" && hasNewlineAfter(lastDirective)) { - reportError(lastDirective, "after", false); - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - Program: checkDirectives, - FunctionDeclaration: checkDirectives, - FunctionExpression: checkDirectives, - ArrowFunctionExpression: checkDirectives - }; - } -}; diff --git a/node_modules/eslint/lib/rules/lines-between-class-members.js b/node_modules/eslint/lib/rules/lines-between-class-members.js deleted file mode 100644 index dee4bab5f..000000000 --- a/node_modules/eslint/lib/rules/lines-between-class-members.js +++ /dev/null @@ -1,181 +0,0 @@ -/** - * @fileoverview Rule to check empty newline between class members - * @author 薛定谔的猫 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow an empty line between class members", - recommended: false, - url: "https://eslint.org/docs/latest/rules/lines-between-class-members" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - exceptAfterSingleLine: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - messages: { - never: "Unexpected blank line between class members.", - always: "Expected blank line between class members." - } - }, - - create(context) { - - const options = []; - - options[0] = context.options[0] || "always"; - options[1] = context.options[1] || { exceptAfterSingleLine: false }; - - const sourceCode = context.sourceCode; - - /** - * Gets a pair of tokens that should be used to check lines between two class member nodes. - * - * In most cases, this returns the very last token of the current node and - * the very first token of the next node. - * For example: - * - * class C { - * x = 1; // curLast: `;` nextFirst: `in` - * in = 2 - * } - * - * There is only one exception. If the given node ends with a semicolon, and it looks like - * a semicolon-less style's semicolon - one that is not on the same line as the preceding - * token, but is on the line where the next class member starts - this returns the preceding - * token and the semicolon as boundary tokens. - * For example: - * - * class C { - * x = 1 // curLast: `1` nextFirst: `;` - * ;in = 2 - * } - * When determining the desired layout of the code, we should treat this semicolon as - * a part of the next class member node instead of the one it technically belongs to. - * @param {ASTNode} curNode Current class member node. - * @param {ASTNode} nextNode Next class member node. - * @returns {Token} The actual last token of `node`. - * @private - */ - function getBoundaryTokens(curNode, nextNode) { - const lastToken = sourceCode.getLastToken(curNode); - const prevToken = sourceCode.getTokenBefore(lastToken); - const nextToken = sourceCode.getFirstToken(nextNode); // skip possible lone `;` between nodes - - const isSemicolonLessStyle = ( - astUtils.isSemicolonToken(lastToken) && - !astUtils.isTokenOnSameLine(prevToken, lastToken) && - astUtils.isTokenOnSameLine(lastToken, nextToken) - ); - - return isSemicolonLessStyle - ? { curLast: prevToken, nextFirst: lastToken } - : { curLast: lastToken, nextFirst: nextToken }; - } - - /** - * Return the last token among the consecutive tokens that have no exceed max line difference in between, before the first token in the next member. - * @param {Token} prevLastToken The last token in the previous member node. - * @param {Token} nextFirstToken The first token in the next member node. - * @param {number} maxLine The maximum number of allowed line difference between consecutive tokens. - * @returns {Token} The last token among the consecutive tokens. - */ - function findLastConsecutiveTokenAfter(prevLastToken, nextFirstToken, maxLine) { - const after = sourceCode.getTokenAfter(prevLastToken, { includeComments: true }); - - if (after !== nextFirstToken && after.loc.start.line - prevLastToken.loc.end.line <= maxLine) { - return findLastConsecutiveTokenAfter(after, nextFirstToken, maxLine); - } - return prevLastToken; - } - - /** - * Return the first token among the consecutive tokens that have no exceed max line difference in between, after the last token in the previous member. - * @param {Token} nextFirstToken The first token in the next member node. - * @param {Token} prevLastToken The last token in the previous member node. - * @param {number} maxLine The maximum number of allowed line difference between consecutive tokens. - * @returns {Token} The first token among the consecutive tokens. - */ - function findFirstConsecutiveTokenBefore(nextFirstToken, prevLastToken, maxLine) { - const before = sourceCode.getTokenBefore(nextFirstToken, { includeComments: true }); - - if (before !== prevLastToken && nextFirstToken.loc.start.line - before.loc.end.line <= maxLine) { - return findFirstConsecutiveTokenBefore(before, prevLastToken, maxLine); - } - return nextFirstToken; - } - - /** - * Checks if there is a token or comment between two tokens. - * @param {Token} before The token before. - * @param {Token} after The token after. - * @returns {boolean} True if there is a token or comment between two tokens. - */ - function hasTokenOrCommentBetween(before, after) { - return sourceCode.getTokensBetween(before, after, { includeComments: true }).length !== 0; - } - - return { - ClassBody(node) { - const body = node.body; - - for (let i = 0; i < body.length - 1; i++) { - const curFirst = sourceCode.getFirstToken(body[i]); - const { curLast, nextFirst } = getBoundaryTokens(body[i], body[i + 1]); - const isMulti = !astUtils.isTokenOnSameLine(curFirst, curLast); - const skip = !isMulti && options[1].exceptAfterSingleLine; - const beforePadding = findLastConsecutiveTokenAfter(curLast, nextFirst, 1); - const afterPadding = findFirstConsecutiveTokenBefore(nextFirst, curLast, 1); - const isPadded = afterPadding.loc.start.line - beforePadding.loc.end.line > 1; - const hasTokenInPadding = hasTokenOrCommentBetween(beforePadding, afterPadding); - const curLineLastToken = findLastConsecutiveTokenAfter(curLast, nextFirst, 0); - - if ((options[0] === "always" && !skip && !isPadded) || - (options[0] === "never" && isPadded)) { - context.report({ - node: body[i + 1], - messageId: isPadded ? "never" : "always", - fix(fixer) { - if (hasTokenInPadding) { - return null; - } - return isPadded - ? fixer.replaceTextRange([beforePadding.range[1], afterPadding.range[0]], "\n") - : fixer.insertTextAfter(curLineLastToken, "\n"); - } - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/logical-assignment-operators.js b/node_modules/eslint/lib/rules/logical-assignment-operators.js deleted file mode 100644 index d373bec6d..000000000 --- a/node_modules/eslint/lib/rules/logical-assignment-operators.js +++ /dev/null @@ -1,474 +0,0 @@ -/** - * @fileoverview Rule to replace assignment expressions with logical operator assignment - * @author Daniel Martens - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ -const astUtils = require("./utils/ast-utils.js"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const baseTypes = new Set(["Identifier", "Super", "ThisExpression"]); - -/** - * Returns true iff either "undefined" or a void expression (eg. "void 0") - * @param {ASTNode} expression Expression to check - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {boolean} True iff "undefined" or "void ..." - */ -function isUndefined(expression, scope) { - if (expression.type === "Identifier" && expression.name === "undefined") { - return astUtils.isReferenceToGlobalVariable(scope, expression); - } - - return expression.type === "UnaryExpression" && - expression.operator === "void" && - expression.argument.type === "Literal" && - expression.argument.value === 0; -} - -/** - * Returns true iff the reference is either an identifier or member expression - * @param {ASTNode} expression Expression to check - * @returns {boolean} True for identifiers and member expressions - */ -function isReference(expression) { - return (expression.type === "Identifier" && expression.name !== "undefined") || - expression.type === "MemberExpression"; -} - -/** - * Returns true iff the expression checks for nullish with loose equals. - * Examples: value == null, value == void 0 - * @param {ASTNode} expression Test condition - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {boolean} True iff implicit nullish comparison - */ -function isImplicitNullishComparison(expression, scope) { - if (expression.type !== "BinaryExpression" || expression.operator !== "==") { - return false; - } - - const reference = isReference(expression.left) ? "left" : "right"; - const nullish = reference === "left" ? "right" : "left"; - - return isReference(expression[reference]) && - (astUtils.isNullLiteral(expression[nullish]) || isUndefined(expression[nullish], scope)); -} - -/** - * Condition with two equal comparisons. - * @param {ASTNode} expression Condition - * @returns {boolean} True iff matches ? === ? || ? === ? - */ -function isDoubleComparison(expression) { - return expression.type === "LogicalExpression" && - expression.operator === "||" && - expression.left.type === "BinaryExpression" && - expression.left.operator === "===" && - expression.right.type === "BinaryExpression" && - expression.right.operator === "==="; -} - -/** - * Returns true iff the expression checks for undefined and null. - * Example: value === null || value === undefined - * @param {ASTNode} expression Test condition - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {boolean} True iff explicit nullish comparison - */ -function isExplicitNullishComparison(expression, scope) { - if (!isDoubleComparison(expression)) { - return false; - } - const leftReference = isReference(expression.left.left) ? "left" : "right"; - const leftNullish = leftReference === "left" ? "right" : "left"; - const rightReference = isReference(expression.right.left) ? "left" : "right"; - const rightNullish = rightReference === "left" ? "right" : "left"; - - return astUtils.isSameReference(expression.left[leftReference], expression.right[rightReference]) && - ((astUtils.isNullLiteral(expression.left[leftNullish]) && isUndefined(expression.right[rightNullish], scope)) || - (isUndefined(expression.left[leftNullish], scope) && astUtils.isNullLiteral(expression.right[rightNullish]))); -} - -/** - * Returns true for Boolean(arg) calls - * @param {ASTNode} expression Test condition - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {boolean} Whether the expression is a boolean cast - */ -function isBooleanCast(expression, scope) { - return expression.type === "CallExpression" && - expression.callee.name === "Boolean" && - expression.arguments.length === 1 && - astUtils.isReferenceToGlobalVariable(scope, expression.callee); -} - -/** - * Returns true for: - * truthiness checks: value, Boolean(value), !!value - * falsiness checks: !value, !Boolean(value) - * nullish checks: value == null, value === undefined || value === null - * @param {ASTNode} expression Test condition - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {?{ reference: ASTNode, operator: '??'|'||'|'&&'}} Null if not a known existence - */ -function getExistence(expression, scope) { - const isNegated = expression.type === "UnaryExpression" && expression.operator === "!"; - const base = isNegated ? expression.argument : expression; - - switch (true) { - case isReference(base): - return { reference: base, operator: isNegated ? "||" : "&&" }; - case base.type === "UnaryExpression" && base.operator === "!" && isReference(base.argument): - return { reference: base.argument, operator: "&&" }; - case isBooleanCast(base, scope) && isReference(base.arguments[0]): - return { reference: base.arguments[0], operator: isNegated ? "||" : "&&" }; - case isImplicitNullishComparison(expression, scope): - return { reference: isReference(expression.left) ? expression.left : expression.right, operator: "??" }; - case isExplicitNullishComparison(expression, scope): - return { reference: isReference(expression.left.left) ? expression.left.left : expression.left.right, operator: "??" }; - default: return null; - } -} - -/** - * Returns true iff the node is inside a with block - * @param {ASTNode} node Node to check - * @returns {boolean} True iff passed node is inside a with block - */ -function isInsideWithBlock(node) { - if (node.type === "Program") { - return false; - } - - return node.parent.type === "WithStatement" && node.parent.body === node ? true : isInsideWithBlock(node.parent); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require or disallow logical assignment operator shorthand", - recommended: false, - url: "https://eslint.org/docs/latest/rules/logical-assignment-operators" - }, - - schema: { - type: "array", - oneOf: [{ - items: [ - { const: "always" }, - { - type: "object", - properties: { - enforceForIfStatements: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - minItems: 0, // 0 for allowing passing no options - maxItems: 2 - }, { - items: [{ const: "never" }], - minItems: 1, - maxItems: 1 - }] - }, - fixable: "code", - // eslint-disable-next-line eslint-plugin/require-meta-has-suggestions -- Does not detect conditional suggestions - hasSuggestions: true, - messages: { - assignment: "Assignment (=) can be replaced with operator assignment ({{operator}}).", - useLogicalOperator: "Convert this assignment to use the operator {{ operator }}.", - logical: "Logical expression can be replaced with an assignment ({{ operator }}).", - convertLogical: "Replace this logical expression with an assignment with the operator {{ operator }}.", - if: "'if' statement can be replaced with a logical operator assignment with operator {{ operator }}.", - convertIf: "Replace this 'if' statement with a logical assignment with operator {{ operator }}.", - unexpected: "Unexpected logical operator assignment ({{operator}}) shorthand.", - separate: "Separate the logical assignment into an assignment with a logical operator." - } - }, - - create(context) { - const mode = context.options[0] === "never" ? "never" : "always"; - const checkIf = mode === "always" && context.options.length > 1 && context.options[1].enforceForIfStatements; - const sourceCode = context.sourceCode; - const isStrict = sourceCode.getScope(sourceCode.ast).isStrict; - - /** - * Returns false if the access could be a getter - * @param {ASTNode} node Assignment expression - * @returns {boolean} True iff the fix is safe - */ - function cannotBeGetter(node) { - return node.type === "Identifier" && - (isStrict || !isInsideWithBlock(node)); - } - - /** - * Check whether only a single property is accessed - * @param {ASTNode} node reference - * @returns {boolean} True iff a single property is accessed - */ - function accessesSingleProperty(node) { - if (!isStrict && isInsideWithBlock(node)) { - return node.type === "Identifier"; - } - - return node.type === "MemberExpression" && - baseTypes.has(node.object.type) && - (!node.computed || (node.property.type !== "MemberExpression" && node.property.type !== "ChainExpression")); - } - - /** - * Adds a fixer or suggestion whether on the fix is safe. - * @param {{ messageId: string, node: ASTNode }} descriptor Report descriptor without fix or suggest - * @param {{ messageId: string, fix: Function }} suggestion Adds the fix or the whole suggestion as only element in "suggest" to suggestion - * @param {boolean} shouldBeFixed Fix iff the condition is true - * @returns {Object} Descriptor with either an added fix or suggestion - */ - function createConditionalFixer(descriptor, suggestion, shouldBeFixed) { - if (shouldBeFixed) { - return { - ...descriptor, - fix: suggestion.fix - }; - } - - return { - ...descriptor, - suggest: [suggestion] - }; - } - - - /** - * Returns the operator token for assignments and binary expressions - * @param {ASTNode} node AssignmentExpression or BinaryExpression - * @returns {import('eslint').AST.Token} Operator token between the left and right expression - */ - function getOperatorToken(node) { - return sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); - } - - if (mode === "never") { - return { - - // foo ||= bar - "AssignmentExpression"(assignment) { - if (!astUtils.isLogicalAssignmentOperator(assignment.operator)) { - return; - } - - const descriptor = { - messageId: "unexpected", - node: assignment, - data: { operator: assignment.operator } - }; - const suggestion = { - messageId: "separate", - *fix(ruleFixer) { - if (sourceCode.getCommentsInside(assignment).length > 0) { - return; - } - - const operatorToken = getOperatorToken(assignment); - - // -> foo = bar - yield ruleFixer.replaceText(operatorToken, "="); - - const assignmentText = sourceCode.getText(assignment.left); - const operator = assignment.operator.slice(0, -1); - - // -> foo = foo || bar - yield ruleFixer.insertTextAfter(operatorToken, ` ${assignmentText} ${operator}`); - - const precedence = astUtils.getPrecedence(assignment.right) <= astUtils.getPrecedence({ type: "LogicalExpression", operator }); - - // ?? and || / && cannot be mixed but have same precedence - const mixed = assignment.operator === "??=" && astUtils.isLogicalExpression(assignment.right); - - if (!astUtils.isParenthesised(sourceCode, assignment.right) && (precedence || mixed)) { - - // -> foo = foo || (bar) - yield ruleFixer.insertTextBefore(assignment.right, "("); - yield ruleFixer.insertTextAfter(assignment.right, ")"); - } - } - }; - - context.report(createConditionalFixer(descriptor, suggestion, cannotBeGetter(assignment.left))); - } - }; - } - - return { - - // foo = foo || bar - "AssignmentExpression[operator='='][right.type='LogicalExpression']"(assignment) { - if (!astUtils.isSameReference(assignment.left, assignment.right.left)) { - return; - } - - const descriptor = { - messageId: "assignment", - node: assignment, - data: { operator: `${assignment.right.operator}=` } - }; - const suggestion = { - messageId: "useLogicalOperator", - data: { operator: `${assignment.right.operator}=` }, - *fix(ruleFixer) { - if (sourceCode.getCommentsInside(assignment).length > 0) { - return; - } - - // No need for parenthesis around the assignment based on precedence as the precedence stays the same even with changed operator - const assignmentOperatorToken = getOperatorToken(assignment); - - // -> foo ||= foo || bar - yield ruleFixer.insertTextBefore(assignmentOperatorToken, assignment.right.operator); - - // -> foo ||= bar - const logicalOperatorToken = getOperatorToken(assignment.right); - const firstRightOperandToken = sourceCode.getTokenAfter(logicalOperatorToken); - - yield ruleFixer.removeRange([assignment.right.range[0], firstRightOperandToken.range[0]]); - } - }; - - context.report(createConditionalFixer(descriptor, suggestion, cannotBeGetter(assignment.left))); - }, - - // foo || (foo = bar) - 'LogicalExpression[right.type="AssignmentExpression"][right.operator="="]'(logical) { - - // Right side has to be parenthesized, otherwise would be parsed as (foo || foo) = bar which is illegal - if (isReference(logical.left) && astUtils.isSameReference(logical.left, logical.right.left)) { - const descriptor = { - messageId: "logical", - node: logical, - data: { operator: `${logical.operator}=` } - }; - const suggestion = { - messageId: "convertLogical", - data: { operator: `${logical.operator}=` }, - *fix(ruleFixer) { - if (sourceCode.getCommentsInside(logical).length > 0) { - return; - } - - const requiresOuterParenthesis = logical.parent.type !== "ExpressionStatement" && - (astUtils.getPrecedence({ type: "AssignmentExpression" }) < astUtils.getPrecedence(logical.parent)); - - if (!astUtils.isParenthesised(sourceCode, logical) && requiresOuterParenthesis) { - yield ruleFixer.insertTextBefore(logical, "("); - yield ruleFixer.insertTextAfter(logical, ")"); - } - - // Also removes all opening parenthesis - yield ruleFixer.removeRange([logical.range[0], logical.right.range[0]]); // -> foo = bar) - - // Also removes all ending parenthesis - yield ruleFixer.removeRange([logical.right.range[1], logical.range[1]]); // -> foo = bar - - const operatorToken = getOperatorToken(logical.right); - - yield ruleFixer.insertTextBefore(operatorToken, logical.operator); // -> foo ||= bar - } - }; - const fix = cannotBeGetter(logical.left) || accessesSingleProperty(logical.left); - - context.report(createConditionalFixer(descriptor, suggestion, fix)); - } - }, - - // if (foo) foo = bar - "IfStatement[alternate=null]"(ifNode) { - if (!checkIf) { - return; - } - - const hasBody = ifNode.consequent.type === "BlockStatement"; - - if (hasBody && ifNode.consequent.body.length !== 1) { - return; - } - - const body = hasBody ? ifNode.consequent.body[0] : ifNode.consequent; - const scope = sourceCode.getScope(ifNode); - const existence = getExistence(ifNode.test, scope); - - if ( - body.type === "ExpressionStatement" && - body.expression.type === "AssignmentExpression" && - body.expression.operator === "=" && - existence !== null && - astUtils.isSameReference(existence.reference, body.expression.left) - ) { - const descriptor = { - messageId: "if", - node: ifNode, - data: { operator: `${existence.operator}=` } - }; - const suggestion = { - messageId: "convertIf", - data: { operator: `${existence.operator}=` }, - *fix(ruleFixer) { - if (sourceCode.getCommentsInside(ifNode).length > 0) { - return; - } - - const firstBodyToken = sourceCode.getFirstToken(body); - const prevToken = sourceCode.getTokenBefore(ifNode); - - if ( - prevToken !== null && - prevToken.value !== ";" && - prevToken.value !== "{" && - firstBodyToken.type !== "Identifier" && - firstBodyToken.type !== "Keyword" - ) { - - // Do not fix if the fixed statement could be part of the previous statement (eg. fn() if (a == null) (a) = b --> fn()(a) ??= b) - return; - } - - - const operatorToken = getOperatorToken(body.expression); - - yield ruleFixer.insertTextBefore(operatorToken, existence.operator); // -> if (foo) foo ||= bar - - yield ruleFixer.removeRange([ifNode.range[0], body.range[0]]); // -> foo ||= bar - - yield ruleFixer.removeRange([body.range[1], ifNode.range[1]]); // -> foo ||= bar, only present if "if" had a body - - const nextToken = sourceCode.getTokenAfter(body.expression); - - if (hasBody && (nextToken !== null && nextToken.value !== ";")) { - yield ruleFixer.insertTextAfter(ifNode, ";"); - } - } - }; - const shouldBeFixed = cannotBeGetter(existence.reference) || - (ifNode.test.type !== "LogicalExpression" && accessesSingleProperty(existence.reference)); - - context.report(createConditionalFixer(descriptor, suggestion, shouldBeFixed)); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/max-classes-per-file.js b/node_modules/eslint/lib/rules/max-classes-per-file.js deleted file mode 100644 index 241e06023..000000000 --- a/node_modules/eslint/lib/rules/max-classes-per-file.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @fileoverview Enforce a maximum number of classes per file - * @author James Garbutt - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce a maximum number of classes per file", - recommended: false, - url: "https://eslint.org/docs/latest/rules/max-classes-per-file" - }, - - schema: [ - { - oneOf: [ - { - type: "integer", - minimum: 1 - }, - { - type: "object", - properties: { - ignoreExpressions: { - type: "boolean" - }, - max: { - type: "integer", - minimum: 1 - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - maximumExceeded: "File has too many classes ({{ classCount }}). Maximum allowed is {{ max }}." - } - }, - create(context) { - const [option = {}] = context.options; - const [ignoreExpressions, max] = typeof option === "number" - ? [false, option || 1] - : [option.ignoreExpressions, option.max || 1]; - - let classCount = 0; - - return { - Program() { - classCount = 0; - }, - "Program:exit"(node) { - if (classCount > max) { - context.report({ - node, - messageId: "maximumExceeded", - data: { - classCount, - max - } - }); - } - }, - "ClassDeclaration"() { - classCount++; - }, - "ClassExpression"() { - if (!ignoreExpressions) { - classCount++; - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/max-depth.js b/node_modules/eslint/lib/rules/max-depth.js deleted file mode 100644 index 7a8e9f94e..000000000 --- a/node_modules/eslint/lib/rules/max-depth.js +++ /dev/null @@ -1,156 +0,0 @@ -/** - * @fileoverview A rule to set the maximum depth block can be nested in a function. - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce a maximum depth that blocks can be nested", - recommended: false, - url: "https://eslint.org/docs/latest/rules/max-depth" - }, - - schema: [ - { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - type: "object", - properties: { - maximum: { - type: "integer", - minimum: 0 - }, - max: { - type: "integer", - minimum: 0 - } - }, - additionalProperties: false - } - ] - } - ], - messages: { - tooDeeply: "Blocks are nested too deeply ({{depth}}). Maximum allowed is {{maxDepth}}." - } - }, - - create(context) { - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - const functionStack = [], - option = context.options[0]; - let maxDepth = 4; - - if ( - typeof option === "object" && - (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) - ) { - maxDepth = option.maximum || option.max; - } - if (typeof option === "number") { - maxDepth = option; - } - - /** - * When parsing a new function, store it in our function stack - * @returns {void} - * @private - */ - function startFunction() { - functionStack.push(0); - } - - /** - * When parsing is done then pop out the reference - * @returns {void} - * @private - */ - function endFunction() { - functionStack.pop(); - } - - /** - * Save the block and Evaluate the node - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function pushBlock(node) { - const len = ++functionStack[functionStack.length - 1]; - - if (len > maxDepth) { - context.report({ node, messageId: "tooDeeply", data: { depth: len, maxDepth } }); - } - } - - /** - * Pop the saved block - * @returns {void} - * @private - */ - function popBlock() { - functionStack[functionStack.length - 1]--; - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - Program: startFunction, - FunctionDeclaration: startFunction, - FunctionExpression: startFunction, - ArrowFunctionExpression: startFunction, - StaticBlock: startFunction, - - IfStatement(node) { - if (node.parent.type !== "IfStatement") { - pushBlock(node); - } - }, - SwitchStatement: pushBlock, - TryStatement: pushBlock, - DoWhileStatement: pushBlock, - WhileStatement: pushBlock, - WithStatement: pushBlock, - ForStatement: pushBlock, - ForInStatement: pushBlock, - ForOfStatement: pushBlock, - - "IfStatement:exit": popBlock, - "SwitchStatement:exit": popBlock, - "TryStatement:exit": popBlock, - "DoWhileStatement:exit": popBlock, - "WhileStatement:exit": popBlock, - "WithStatement:exit": popBlock, - "ForStatement:exit": popBlock, - "ForInStatement:exit": popBlock, - "ForOfStatement:exit": popBlock, - - "FunctionDeclaration:exit": endFunction, - "FunctionExpression:exit": endFunction, - "ArrowFunctionExpression:exit": endFunction, - "StaticBlock:exit": endFunction, - "Program:exit": endFunction - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/max-len.js b/node_modules/eslint/lib/rules/max-len.js deleted file mode 100644 index 59e85214a..000000000 --- a/node_modules/eslint/lib/rules/max-len.js +++ /dev/null @@ -1,433 +0,0 @@ -/** - * @fileoverview Rule to check for max length on a line. - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Constants -//------------------------------------------------------------------------------ - -const OPTIONS_SCHEMA = { - type: "object", - properties: { - code: { - type: "integer", - minimum: 0 - }, - comments: { - type: "integer", - minimum: 0 - }, - tabWidth: { - type: "integer", - minimum: 0 - }, - ignorePattern: { - type: "string" - }, - ignoreComments: { - type: "boolean" - }, - ignoreStrings: { - type: "boolean" - }, - ignoreUrls: { - type: "boolean" - }, - ignoreTemplateLiterals: { - type: "boolean" - }, - ignoreRegExpLiterals: { - type: "boolean" - }, - ignoreTrailingComments: { - type: "boolean" - } - }, - additionalProperties: false -}; - -const OPTIONS_OR_INTEGER_SCHEMA = { - anyOf: [ - OPTIONS_SCHEMA, - { - type: "integer", - minimum: 0 - } - ] -}; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce a maximum line length", - recommended: false, - url: "https://eslint.org/docs/latest/rules/max-len" - }, - - schema: [ - OPTIONS_OR_INTEGER_SCHEMA, - OPTIONS_OR_INTEGER_SCHEMA, - OPTIONS_SCHEMA - ], - messages: { - max: "This line has a length of {{lineLength}}. Maximum allowed is {{maxLength}}.", - maxComment: "This line has a comment length of {{lineLength}}. Maximum allowed is {{maxCommentLength}}." - } - }, - - create(context) { - - /* - * Inspired by http://tools.ietf.org/html/rfc3986#appendix-B, however: - * - They're matching an entire string that we know is a URI - * - We're matching part of a string where we think there *might* be a URL - * - We're only concerned about URLs, as picking out any URI would cause - * too many false positives - * - We don't care about matching the entire URL, any small segment is fine - */ - const URL_REGEXP = /[^:/?#]:\/\/[^?#]/u; - - const sourceCode = context.sourceCode; - - /** - * Computes the length of a line that may contain tabs. The width of each - * tab will be the number of spaces to the next tab stop. - * @param {string} line The line. - * @param {int} tabWidth The width of each tab stop in spaces. - * @returns {int} The computed line length. - * @private - */ - function computeLineLength(line, tabWidth) { - let extraCharacterCount = 0; - - line.replace(/\t/gu, (match, offset) => { - const totalOffset = offset + extraCharacterCount, - previousTabStopOffset = tabWidth ? totalOffset % tabWidth : 0, - spaceCount = tabWidth - previousTabStopOffset; - - extraCharacterCount += spaceCount - 1; // -1 for the replaced tab - }); - return Array.from(line).length + extraCharacterCount; - } - - // The options object must be the last option specified… - const options = Object.assign({}, context.options[context.options.length - 1]); - - // …but max code length… - if (typeof context.options[0] === "number") { - options.code = context.options[0]; - } - - // …and tabWidth can be optionally specified directly as integers. - if (typeof context.options[1] === "number") { - options.tabWidth = context.options[1]; - } - - const maxLength = typeof options.code === "number" ? options.code : 80, - tabWidth = typeof options.tabWidth === "number" ? options.tabWidth : 4, - ignoreComments = !!options.ignoreComments, - ignoreStrings = !!options.ignoreStrings, - ignoreTemplateLiterals = !!options.ignoreTemplateLiterals, - ignoreRegExpLiterals = !!options.ignoreRegExpLiterals, - ignoreTrailingComments = !!options.ignoreTrailingComments || !!options.ignoreComments, - ignoreUrls = !!options.ignoreUrls, - maxCommentLength = options.comments; - let ignorePattern = options.ignorePattern || null; - - if (ignorePattern) { - ignorePattern = new RegExp(ignorePattern, "u"); - } - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Tells if a given comment is trailing: it starts on the current line and - * extends to or past the end of the current line. - * @param {string} line The source line we want to check for a trailing comment on - * @param {number} lineNumber The one-indexed line number for line - * @param {ASTNode} comment The comment to inspect - * @returns {boolean} If the comment is trailing on the given line - */ - function isTrailingComment(line, lineNumber, comment) { - return comment && - (comment.loc.start.line === lineNumber && lineNumber <= comment.loc.end.line) && - (comment.loc.end.line > lineNumber || comment.loc.end.column === line.length); - } - - /** - * Tells if a comment encompasses the entire line. - * @param {string} line The source line with a trailing comment - * @param {number} lineNumber The one-indexed line number this is on - * @param {ASTNode} comment The comment to remove - * @returns {boolean} If the comment covers the entire line - */ - function isFullLineComment(line, lineNumber, comment) { - const start = comment.loc.start, - end = comment.loc.end, - isFirstTokenOnLine = !line.slice(0, comment.loc.start.column).trim(); - - return comment && - (start.line < lineNumber || (start.line === lineNumber && isFirstTokenOnLine)) && - (end.line > lineNumber || (end.line === lineNumber && end.column === line.length)); - } - - /** - * Check if a node is a JSXEmptyExpression contained in a single line JSXExpressionContainer. - * @param {ASTNode} node A node to check. - * @returns {boolean} True if the node is a JSXEmptyExpression contained in a single line JSXExpressionContainer. - */ - function isJSXEmptyExpressionInSingleLineContainer(node) { - if (!node || !node.parent || node.type !== "JSXEmptyExpression" || node.parent.type !== "JSXExpressionContainer") { - return false; - } - - const parent = node.parent; - - return parent.loc.start.line === parent.loc.end.line; - } - - /** - * Gets the line after the comment and any remaining trailing whitespace is - * stripped. - * @param {string} line The source line with a trailing comment - * @param {ASTNode} comment The comment to remove - * @returns {string} Line without comment and trailing whitespace - */ - function stripTrailingComment(line, comment) { - - // loc.column is zero-indexed - return line.slice(0, comment.loc.start.column).replace(/\s+$/u, ""); - } - - /** - * Ensure that an array exists at [key] on `object`, and add `value` to it. - * @param {Object} object the object to mutate - * @param {string} key the object's key - * @param {any} value the value to add - * @returns {void} - * @private - */ - function ensureArrayAndPush(object, key, value) { - if (!Array.isArray(object[key])) { - object[key] = []; - } - object[key].push(value); - } - - /** - * Retrieves an array containing all strings (" or ') in the source code. - * @returns {ASTNode[]} An array of string nodes. - */ - function getAllStrings() { - return sourceCode.ast.tokens.filter(token => (token.type === "String" || - (token.type === "JSXText" && sourceCode.getNodeByRangeIndex(token.range[0] - 1).type === "JSXAttribute"))); - } - - /** - * Retrieves an array containing all template literals in the source code. - * @returns {ASTNode[]} An array of template literal nodes. - */ - function getAllTemplateLiterals() { - return sourceCode.ast.tokens.filter(token => token.type === "Template"); - } - - - /** - * Retrieves an array containing all RegExp literals in the source code. - * @returns {ASTNode[]} An array of RegExp literal nodes. - */ - function getAllRegExpLiterals() { - return sourceCode.ast.tokens.filter(token => token.type === "RegularExpression"); - } - - - /** - * A reducer to group an AST node by line number, both start and end. - * @param {Object} acc the accumulator - * @param {ASTNode} node the AST node in question - * @returns {Object} the modified accumulator - * @private - */ - function groupByLineNumber(acc, node) { - for (let i = node.loc.start.line; i <= node.loc.end.line; ++i) { - ensureArrayAndPush(acc, i, node); - } - return acc; - } - - /** - * Returns an array of all comments in the source code. - * If the element in the array is a JSXEmptyExpression contained with a single line JSXExpressionContainer, - * the element is changed with JSXExpressionContainer node. - * @returns {ASTNode[]} An array of comment nodes - */ - function getAllComments() { - const comments = []; - - sourceCode.getAllComments() - .forEach(commentNode => { - const containingNode = sourceCode.getNodeByRangeIndex(commentNode.range[0]); - - if (isJSXEmptyExpressionInSingleLineContainer(containingNode)) { - - // push a unique node only - if (comments[comments.length - 1] !== containingNode.parent) { - comments.push(containingNode.parent); - } - } else { - comments.push(commentNode); - } - }); - - return comments; - } - - /** - * Check the program for max length - * @param {ASTNode} node Node to examine - * @returns {void} - * @private - */ - function checkProgramForMaxLength(node) { - - // split (honors line-ending) - const lines = sourceCode.lines, - - // list of comments to ignore - comments = ignoreComments || maxCommentLength || ignoreTrailingComments ? getAllComments() : []; - - // we iterate over comments in parallel with the lines - let commentsIndex = 0; - - const strings = getAllStrings(); - const stringsByLine = strings.reduce(groupByLineNumber, {}); - - const templateLiterals = getAllTemplateLiterals(); - const templateLiteralsByLine = templateLiterals.reduce(groupByLineNumber, {}); - - const regExpLiterals = getAllRegExpLiterals(); - const regExpLiteralsByLine = regExpLiterals.reduce(groupByLineNumber, {}); - - lines.forEach((line, i) => { - - // i is zero-indexed, line numbers are one-indexed - const lineNumber = i + 1; - - /* - * if we're checking comment length; we need to know whether this - * line is a comment - */ - let lineIsComment = false; - let textToMeasure; - - /* - * We can short-circuit the comment checks if we're already out of - * comments to check. - */ - if (commentsIndex < comments.length) { - let comment = null; - - // iterate over comments until we find one past the current line - do { - comment = comments[++commentsIndex]; - } while (comment && comment.loc.start.line <= lineNumber); - - // and step back by one - comment = comments[--commentsIndex]; - - if (isFullLineComment(line, lineNumber, comment)) { - lineIsComment = true; - textToMeasure = line; - } else if (ignoreTrailingComments && isTrailingComment(line, lineNumber, comment)) { - textToMeasure = stripTrailingComment(line, comment); - - // ignore multiple trailing comments in the same line - let lastIndex = commentsIndex; - - while (isTrailingComment(textToMeasure, lineNumber, comments[--lastIndex])) { - textToMeasure = stripTrailingComment(textToMeasure, comments[lastIndex]); - } - } else { - textToMeasure = line; - } - } else { - textToMeasure = line; - } - if (ignorePattern && ignorePattern.test(textToMeasure) || - ignoreUrls && URL_REGEXP.test(textToMeasure) || - ignoreStrings && stringsByLine[lineNumber] || - ignoreTemplateLiterals && templateLiteralsByLine[lineNumber] || - ignoreRegExpLiterals && regExpLiteralsByLine[lineNumber] - ) { - - // ignore this line - return; - } - - const lineLength = computeLineLength(textToMeasure, tabWidth); - const commentLengthApplies = lineIsComment && maxCommentLength; - - if (lineIsComment && ignoreComments) { - return; - } - - const loc = { - start: { - line: lineNumber, - column: 0 - }, - end: { - line: lineNumber, - column: textToMeasure.length - } - }; - - if (commentLengthApplies) { - if (lineLength > maxCommentLength) { - context.report({ - node, - loc, - messageId: "maxComment", - data: { - lineLength, - maxCommentLength - } - }); - } - } else if (lineLength > maxLength) { - context.report({ - node, - loc, - messageId: "max", - data: { - lineLength, - maxLength - } - }); - } - }); - } - - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - Program: checkProgramForMaxLength - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/max-lines-per-function.js b/node_modules/eslint/lib/rules/max-lines-per-function.js deleted file mode 100644 index f981922a7..000000000 --- a/node_modules/eslint/lib/rules/max-lines-per-function.js +++ /dev/null @@ -1,213 +0,0 @@ -/** - * @fileoverview A rule to set the maximum number of line of code in a function. - * @author Pete Ward - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { upperCaseFirst } = require("../shared/string-utils"); - -//------------------------------------------------------------------------------ -// Constants -//------------------------------------------------------------------------------ - -const OPTIONS_SCHEMA = { - type: "object", - properties: { - max: { - type: "integer", - minimum: 0 - }, - skipComments: { - type: "boolean" - }, - skipBlankLines: { - type: "boolean" - }, - IIFEs: { - type: "boolean" - } - }, - additionalProperties: false -}; - -const OPTIONS_OR_INTEGER_SCHEMA = { - oneOf: [ - OPTIONS_SCHEMA, - { - type: "integer", - minimum: 1 - } - ] -}; - -/** - * Given a list of comment nodes, return a map with numeric keys (source code line numbers) and comment token values. - * @param {Array} comments An array of comment nodes. - * @returns {Map} A map with numeric keys (source code line numbers) and comment token values. - */ -function getCommentLineNumbers(comments) { - const map = new Map(); - - comments.forEach(comment => { - for (let i = comment.loc.start.line; i <= comment.loc.end.line; i++) { - map.set(i, comment); - } - }); - return map; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce a maximum number of lines of code in a function", - recommended: false, - url: "https://eslint.org/docs/latest/rules/max-lines-per-function" - }, - - schema: [ - OPTIONS_OR_INTEGER_SCHEMA - ], - messages: { - exceed: "{{name}} has too many lines ({{lineCount}}). Maximum allowed is {{maxLines}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const lines = sourceCode.lines; - - const option = context.options[0]; - let maxLines = 50; - let skipComments = false; - let skipBlankLines = false; - let IIFEs = false; - - if (typeof option === "object") { - maxLines = typeof option.max === "number" ? option.max : 50; - skipComments = !!option.skipComments; - skipBlankLines = !!option.skipBlankLines; - IIFEs = !!option.IIFEs; - } else if (typeof option === "number") { - maxLines = option; - } - - const commentLineNumbers = getCommentLineNumbers(sourceCode.getAllComments()); - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Tells if a comment encompasses the entire line. - * @param {string} line The source line with a trailing comment - * @param {number} lineNumber The one-indexed line number this is on - * @param {ASTNode} comment The comment to remove - * @returns {boolean} If the comment covers the entire line - */ - function isFullLineComment(line, lineNumber, comment) { - const start = comment.loc.start, - end = comment.loc.end, - isFirstTokenOnLine = start.line === lineNumber && !line.slice(0, start.column).trim(), - isLastTokenOnLine = end.line === lineNumber && !line.slice(end.column).trim(); - - return comment && - (start.line < lineNumber || isFirstTokenOnLine) && - (end.line > lineNumber || isLastTokenOnLine); - } - - /** - * Identifies is a node is a FunctionExpression which is part of an IIFE - * @param {ASTNode} node Node to test - * @returns {boolean} True if it's an IIFE - */ - function isIIFE(node) { - return (node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") && node.parent && node.parent.type === "CallExpression" && node.parent.callee === node; - } - - /** - * Identifies is a node is a FunctionExpression which is embedded within a MethodDefinition or Property - * @param {ASTNode} node Node to test - * @returns {boolean} True if it's a FunctionExpression embedded within a MethodDefinition or Property - */ - function isEmbedded(node) { - if (!node.parent) { - return false; - } - if (node !== node.parent.value) { - return false; - } - if (node.parent.type === "MethodDefinition") { - return true; - } - if (node.parent.type === "Property") { - return node.parent.method === true || node.parent.kind === "get" || node.parent.kind === "set"; - } - return false; - } - - /** - * Count the lines in the function - * @param {ASTNode} funcNode Function AST node - * @returns {void} - * @private - */ - function processFunction(funcNode) { - const node = isEmbedded(funcNode) ? funcNode.parent : funcNode; - - if (!IIFEs && isIIFE(node)) { - return; - } - let lineCount = 0; - - for (let i = node.loc.start.line - 1; i < node.loc.end.line; ++i) { - const line = lines[i]; - - if (skipComments) { - if (commentLineNumbers.has(i + 1) && isFullLineComment(line, i + 1, commentLineNumbers.get(i + 1))) { - continue; - } - } - - if (skipBlankLines) { - if (line.match(/^\s*$/u)) { - continue; - } - } - - lineCount++; - } - - if (lineCount > maxLines) { - const name = upperCaseFirst(astUtils.getFunctionNameWithKind(funcNode)); - - context.report({ - node, - messageId: "exceed", - data: { name, lineCount, maxLines } - }); - } - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - FunctionDeclaration: processFunction, - FunctionExpression: processFunction, - ArrowFunctionExpression: processFunction - }; - } -}; diff --git a/node_modules/eslint/lib/rules/max-lines.js b/node_modules/eslint/lib/rules/max-lines.js deleted file mode 100644 index e85d44290..000000000 --- a/node_modules/eslint/lib/rules/max-lines.js +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @fileoverview enforce a maximum file length - * @author Alberto Rodríguez - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Creates an array of numbers from `start` up to, but not including, `end` - * @param {number} start The start of the range - * @param {number} end The end of the range - * @returns {number[]} The range of numbers - */ -function range(start, end) { - return [...Array(end - start).keys()].map(x => x + start); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce a maximum number of lines per file", - recommended: false, - url: "https://eslint.org/docs/latest/rules/max-lines" - }, - - schema: [ - { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - type: "object", - properties: { - max: { - type: "integer", - minimum: 0 - }, - skipComments: { - type: "boolean" - }, - skipBlankLines: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - } - ], - messages: { - exceed: - "File has too many lines ({{actual}}). Maximum allowed is {{max}}." - } - }, - - create(context) { - const option = context.options[0]; - let max = 300; - - if ( - typeof option === "object" && - Object.prototype.hasOwnProperty.call(option, "max") - ) { - max = option.max; - } else if (typeof option === "number") { - max = option; - } - - const skipComments = option && option.skipComments; - const skipBlankLines = option && option.skipBlankLines; - - const sourceCode = context.sourceCode; - - /** - * Returns whether or not a token is a comment node type - * @param {Token} token The token to check - * @returns {boolean} True if the token is a comment node - */ - function isCommentNodeType(token) { - return token && (token.type === "Block" || token.type === "Line"); - } - - /** - * Returns the line numbers of a comment that don't have any code on the same line - * @param {Node} comment The comment node to check - * @returns {number[]} The line numbers - */ - function getLinesWithoutCode(comment) { - let start = comment.loc.start.line; - let end = comment.loc.end.line; - - let token; - - token = comment; - do { - token = sourceCode.getTokenBefore(token, { - includeComments: true - }); - } while (isCommentNodeType(token)); - - if (token && astUtils.isTokenOnSameLine(token, comment)) { - start += 1; - } - - token = comment; - do { - token = sourceCode.getTokenAfter(token, { - includeComments: true - }); - } while (isCommentNodeType(token)); - - if (token && astUtils.isTokenOnSameLine(comment, token)) { - end -= 1; - } - - if (start <= end) { - return range(start, end + 1); - } - return []; - } - - return { - "Program:exit"() { - let lines = sourceCode.lines.map((text, i) => ({ - lineNumber: i + 1, - text - })); - - /* - * If file ends with a linebreak, `sourceCode.lines` will have one extra empty line at the end. - * That isn't a real line, so we shouldn't count it. - */ - if (lines.length > 1 && lines[lines.length - 1].text === "") { - lines.pop(); - } - - if (skipBlankLines) { - lines = lines.filter(l => l.text.trim() !== ""); - } - - if (skipComments) { - const comments = sourceCode.getAllComments(); - - const commentLines = new Set(comments.flatMap(getLinesWithoutCode)); - - lines = lines.filter( - l => !commentLines.has(l.lineNumber) - ); - } - - if (lines.length > max) { - const loc = { - start: { - line: lines[max].lineNumber, - column: 0 - }, - end: { - line: sourceCode.lines.length, - column: sourceCode.lines[sourceCode.lines.length - 1].length - } - }; - - context.report({ - loc, - messageId: "exceed", - data: { - max, - actual: lines.length - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/max-nested-callbacks.js b/node_modules/eslint/lib/rules/max-nested-callbacks.js deleted file mode 100644 index d8f380b3c..000000000 --- a/node_modules/eslint/lib/rules/max-nested-callbacks.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @fileoverview Rule to enforce a maximum number of nested callbacks. - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce a maximum depth that callbacks can be nested", - recommended: false, - url: "https://eslint.org/docs/latest/rules/max-nested-callbacks" - }, - - schema: [ - { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - type: "object", - properties: { - maximum: { - type: "integer", - minimum: 0 - }, - max: { - type: "integer", - minimum: 0 - } - }, - additionalProperties: false - } - ] - } - ], - messages: { - exceed: "Too many nested callbacks ({{num}}). Maximum allowed is {{max}}." - } - }, - - create(context) { - - //-------------------------------------------------------------------------- - // Constants - //-------------------------------------------------------------------------- - const option = context.options[0]; - let THRESHOLD = 10; - - if ( - typeof option === "object" && - (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) - ) { - THRESHOLD = option.maximum || option.max; - } else if (typeof option === "number") { - THRESHOLD = option; - } - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - const callbackStack = []; - - /** - * Checks a given function node for too many callbacks. - * @param {ASTNode} node The node to check. - * @returns {void} - * @private - */ - function checkFunction(node) { - const parent = node.parent; - - if (parent.type === "CallExpression") { - callbackStack.push(node); - } - - if (callbackStack.length > THRESHOLD) { - const opts = { num: callbackStack.length, max: THRESHOLD }; - - context.report({ node, messageId: "exceed", data: opts }); - } - } - - /** - * Pops the call stack. - * @returns {void} - * @private - */ - function popStack() { - callbackStack.pop(); - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - ArrowFunctionExpression: checkFunction, - "ArrowFunctionExpression:exit": popStack, - - FunctionExpression: checkFunction, - "FunctionExpression:exit": popStack - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/max-params.js b/node_modules/eslint/lib/rules/max-params.js deleted file mode 100644 index 213477a15..000000000 --- a/node_modules/eslint/lib/rules/max-params.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @fileoverview Rule to flag when a function has too many parameters - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { upperCaseFirst } = require("../shared/string-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce a maximum number of parameters in function definitions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/max-params" - }, - - schema: [ - { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - type: "object", - properties: { - maximum: { - type: "integer", - minimum: 0 - }, - max: { - type: "integer", - minimum: 0 - } - }, - additionalProperties: false - } - ] - } - ], - messages: { - exceed: "{{name}} has too many parameters ({{count}}). Maximum allowed is {{max}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const option = context.options[0]; - let numParams = 3; - - if ( - typeof option === "object" && - (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) - ) { - numParams = option.maximum || option.max; - } - if (typeof option === "number") { - numParams = option; - } - - /** - * Checks a function to see if it has too many parameters. - * @param {ASTNode} node The node to check. - * @returns {void} - * @private - */ - function checkFunction(node) { - if (node.params.length > numParams) { - context.report({ - loc: astUtils.getFunctionHeadLoc(node, sourceCode), - node, - messageId: "exceed", - data: { - name: upperCaseFirst(astUtils.getFunctionNameWithKind(node)), - count: node.params.length, - max: numParams - } - }); - } - } - - return { - FunctionDeclaration: checkFunction, - ArrowFunctionExpression: checkFunction, - FunctionExpression: checkFunction - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/max-statements-per-line.js b/node_modules/eslint/lib/rules/max-statements-per-line.js deleted file mode 100644 index b96650487..000000000 --- a/node_modules/eslint/lib/rules/max-statements-per-line.js +++ /dev/null @@ -1,196 +0,0 @@ -/** - * @fileoverview Specify the maximum number of statements allowed per line. - * @author Kenneth Williams - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce a maximum number of statements allowed per line", - recommended: false, - url: "https://eslint.org/docs/latest/rules/max-statements-per-line" - }, - - schema: [ - { - type: "object", - properties: { - max: { - type: "integer", - minimum: 1, - default: 1 - } - }, - additionalProperties: false - } - ], - messages: { - exceed: "This line has {{numberOfStatementsOnThisLine}} {{statements}}. Maximum allowed is {{maxStatementsPerLine}}." - } - }, - - create(context) { - - const sourceCode = context.sourceCode, - options = context.options[0] || {}, - maxStatementsPerLine = typeof options.max !== "undefined" ? options.max : 1; - - let lastStatementLine = 0, - numberOfStatementsOnThisLine = 0, - firstExtraStatement; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - const SINGLE_CHILD_ALLOWED = /^(?:(?:DoWhile|For|ForIn|ForOf|If|Labeled|While)Statement|Export(?:Default|Named)Declaration)$/u; - - /** - * Reports with the first extra statement, and clears it. - * @returns {void} - */ - function reportFirstExtraStatementAndClear() { - if (firstExtraStatement) { - context.report({ - node: firstExtraStatement, - messageId: "exceed", - data: { - numberOfStatementsOnThisLine, - maxStatementsPerLine, - statements: numberOfStatementsOnThisLine === 1 ? "statement" : "statements" - } - }); - } - firstExtraStatement = null; - } - - /** - * Gets the actual last token of a given node. - * @param {ASTNode} node A node to get. This is a node except EmptyStatement. - * @returns {Token} The actual last token. - */ - function getActualLastToken(node) { - return sourceCode.getLastToken(node, astUtils.isNotSemicolonToken); - } - - /** - * Addresses a given node. - * It updates the state of this rule, then reports the node if the node violated this rule. - * @param {ASTNode} node A node to check. - * @returns {void} - */ - function enterStatement(node) { - const line = node.loc.start.line; - - /* - * Skip to allow non-block statements if this is direct child of control statements. - * `if (a) foo();` is counted as 1. - * But `if (a) foo(); else foo();` should be counted as 2. - */ - if (SINGLE_CHILD_ALLOWED.test(node.parent.type) && - node.parent.alternate !== node - ) { - return; - } - - // Update state. - if (line === lastStatementLine) { - numberOfStatementsOnThisLine += 1; - } else { - reportFirstExtraStatementAndClear(); - numberOfStatementsOnThisLine = 1; - lastStatementLine = line; - } - - // Reports if the node violated this rule. - if (numberOfStatementsOnThisLine === maxStatementsPerLine + 1) { - firstExtraStatement = firstExtraStatement || node; - } - } - - /** - * Updates the state of this rule with the end line of leaving node to check with the next statement. - * @param {ASTNode} node A node to check. - * @returns {void} - */ - function leaveStatement(node) { - const line = getActualLastToken(node).loc.end.line; - - // Update state. - if (line !== lastStatementLine) { - reportFirstExtraStatementAndClear(); - numberOfStatementsOnThisLine = 1; - lastStatementLine = line; - } - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - BreakStatement: enterStatement, - ClassDeclaration: enterStatement, - ContinueStatement: enterStatement, - DebuggerStatement: enterStatement, - DoWhileStatement: enterStatement, - ExpressionStatement: enterStatement, - ForInStatement: enterStatement, - ForOfStatement: enterStatement, - ForStatement: enterStatement, - FunctionDeclaration: enterStatement, - IfStatement: enterStatement, - ImportDeclaration: enterStatement, - LabeledStatement: enterStatement, - ReturnStatement: enterStatement, - SwitchStatement: enterStatement, - ThrowStatement: enterStatement, - TryStatement: enterStatement, - VariableDeclaration: enterStatement, - WhileStatement: enterStatement, - WithStatement: enterStatement, - ExportNamedDeclaration: enterStatement, - ExportDefaultDeclaration: enterStatement, - ExportAllDeclaration: enterStatement, - - "BreakStatement:exit": leaveStatement, - "ClassDeclaration:exit": leaveStatement, - "ContinueStatement:exit": leaveStatement, - "DebuggerStatement:exit": leaveStatement, - "DoWhileStatement:exit": leaveStatement, - "ExpressionStatement:exit": leaveStatement, - "ForInStatement:exit": leaveStatement, - "ForOfStatement:exit": leaveStatement, - "ForStatement:exit": leaveStatement, - "FunctionDeclaration:exit": leaveStatement, - "IfStatement:exit": leaveStatement, - "ImportDeclaration:exit": leaveStatement, - "LabeledStatement:exit": leaveStatement, - "ReturnStatement:exit": leaveStatement, - "SwitchStatement:exit": leaveStatement, - "ThrowStatement:exit": leaveStatement, - "TryStatement:exit": leaveStatement, - "VariableDeclaration:exit": leaveStatement, - "WhileStatement:exit": leaveStatement, - "WithStatement:exit": leaveStatement, - "ExportNamedDeclaration:exit": leaveStatement, - "ExportDefaultDeclaration:exit": leaveStatement, - "ExportAllDeclaration:exit": leaveStatement, - "Program:exit": reportFirstExtraStatementAndClear - }; - } -}; diff --git a/node_modules/eslint/lib/rules/max-statements.js b/node_modules/eslint/lib/rules/max-statements.js deleted file mode 100644 index 78053831f..000000000 --- a/node_modules/eslint/lib/rules/max-statements.js +++ /dev/null @@ -1,184 +0,0 @@ -/** - * @fileoverview A rule to set the maximum number of statements in a function. - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { upperCaseFirst } = require("../shared/string-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce a maximum number of statements allowed in function blocks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/max-statements" - }, - - schema: [ - { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - type: "object", - properties: { - maximum: { - type: "integer", - minimum: 0 - }, - max: { - type: "integer", - minimum: 0 - } - }, - additionalProperties: false - } - ] - }, - { - type: "object", - properties: { - ignoreTopLevelFunctions: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - messages: { - exceed: "{{name}} has too many statements ({{count}}). Maximum allowed is {{max}}." - } - }, - - create(context) { - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - const functionStack = [], - option = context.options[0], - ignoreTopLevelFunctions = context.options[1] && context.options[1].ignoreTopLevelFunctions || false, - topLevelFunctions = []; - let maxStatements = 10; - - if ( - typeof option === "object" && - (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max")) - ) { - maxStatements = option.maximum || option.max; - } else if (typeof option === "number") { - maxStatements = option; - } - - /** - * Reports a node if it has too many statements - * @param {ASTNode} node node to evaluate - * @param {int} count Number of statements in node - * @param {int} max Maximum number of statements allowed - * @returns {void} - * @private - */ - function reportIfTooManyStatements(node, count, max) { - if (count > max) { - const name = upperCaseFirst(astUtils.getFunctionNameWithKind(node)); - - context.report({ - node, - messageId: "exceed", - data: { name, count, max } - }); - } - } - - /** - * When parsing a new function, store it in our function stack - * @returns {void} - * @private - */ - function startFunction() { - functionStack.push(0); - } - - /** - * Evaluate the node at the end of function - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function endFunction(node) { - const count = functionStack.pop(); - - /* - * This rule does not apply to class static blocks, but we have to track them so - * that statements in them do not count as statements in the enclosing function. - */ - if (node.type === "StaticBlock") { - return; - } - - if (ignoreTopLevelFunctions && functionStack.length === 0) { - topLevelFunctions.push({ node, count }); - } else { - reportIfTooManyStatements(node, count, maxStatements); - } - } - - /** - * Increment the count of the functions - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function countStatements(node) { - functionStack[functionStack.length - 1] += node.body.length; - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - FunctionDeclaration: startFunction, - FunctionExpression: startFunction, - ArrowFunctionExpression: startFunction, - StaticBlock: startFunction, - - BlockStatement: countStatements, - - "FunctionDeclaration:exit": endFunction, - "FunctionExpression:exit": endFunction, - "ArrowFunctionExpression:exit": endFunction, - "StaticBlock:exit": endFunction, - - "Program:exit"() { - if (topLevelFunctions.length === 1) { - return; - } - - topLevelFunctions.forEach(element => { - const count = element.count; - const node = element.node; - - reportIfTooManyStatements(node, count, maxStatements); - }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/multiline-comment-style.js b/node_modules/eslint/lib/rules/multiline-comment-style.js deleted file mode 100644 index 6da986201..000000000 --- a/node_modules/eslint/lib/rules/multiline-comment-style.js +++ /dev/null @@ -1,474 +0,0 @@ -/** - * @fileoverview enforce a particular style for multiline comments - * @author Teddy Katz - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce a particular style for multiline comments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/multiline-comment-style" - }, - - fixable: "whitespace", - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["starred-block", "bare-block"] - } - ], - additionalItems: false - }, - { - type: "array", - items: [ - { - enum: ["separate-lines"] - }, - { - type: "object", - properties: { - checkJSDoc: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - additionalItems: false - } - ] - }, - messages: { - expectedBlock: "Expected a block comment instead of consecutive line comments.", - expectedBareBlock: "Expected a block comment without padding stars.", - startNewline: "Expected a linebreak after '/*'.", - endNewline: "Expected a linebreak before '*/'.", - missingStar: "Expected a '*' at the start of this line.", - alignment: "Expected this line to be aligned with the start of the comment.", - expectedLines: "Expected multiple line comments instead of a block comment." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const option = context.options[0] || "starred-block"; - const params = context.options[1] || {}; - const checkJSDoc = !!params.checkJSDoc; - - //---------------------------------------------------------------------- - // Helpers - //---------------------------------------------------------------------- - - /** - * Checks if a comment line is starred. - * @param {string} line A string representing a comment line. - * @returns {boolean} Whether or not the comment line is starred. - */ - function isStarredCommentLine(line) { - return /^\s*\*/u.test(line); - } - - /** - * Checks if a comment group is in starred-block form. - * @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment. - * @returns {boolean} Whether or not the comment group is in starred block form. - */ - function isStarredBlockComment([firstComment]) { - if (firstComment.type !== "Block") { - return false; - } - - const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER); - - // The first and last lines can only contain whitespace. - return lines.length > 0 && lines.every((line, i) => (i === 0 || i === lines.length - 1 ? /^\s*$/u : /^\s*\*/u).test(line)); - } - - /** - * Checks if a comment group is in JSDoc form. - * @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment. - * @returns {boolean} Whether or not the comment group is in JSDoc form. - */ - function isJSDocComment([firstComment]) { - if (firstComment.type !== "Block") { - return false; - } - - const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER); - - return /^\*\s*$/u.test(lines[0]) && - lines.slice(1, -1).every(line => /^\s* /u.test(line)) && - /^\s*$/u.test(lines[lines.length - 1]); - } - - /** - * Processes a comment group that is currently in separate-line form, calculating the offset for each line. - * @param {Token[]} commentGroup A group of comments containing multiple line comments. - * @returns {string[]} An array of the processed lines. - */ - function processSeparateLineComments(commentGroup) { - const allLinesHaveLeadingSpace = commentGroup - .map(({ value }) => value) - .filter(line => line.trim().length) - .every(line => line.startsWith(" ")); - - return commentGroup.map(({ value }) => (allLinesHaveLeadingSpace ? value.replace(/^ /u, "") : value)); - } - - /** - * Processes a comment group that is currently in starred-block form, calculating the offset for each line. - * @param {Token} comment A single block comment token in starred-block form. - * @returns {string[]} An array of the processed lines. - */ - function processStarredBlockComment(comment) { - const lines = comment.value.split(astUtils.LINEBREAK_MATCHER) - .filter((line, i, linesArr) => !(i === 0 || i === linesArr.length - 1)) - .map(line => line.replace(/^\s*$/u, "")); - const allLinesHaveLeadingSpace = lines - .map(line => line.replace(/\s*\*/u, "")) - .filter(line => line.trim().length) - .every(line => line.startsWith(" ")); - - return lines.map(line => line.replace(allLinesHaveLeadingSpace ? /\s*\* ?/u : /\s*\*/u, "")); - } - - /** - * Processes a comment group that is currently in bare-block form, calculating the offset for each line. - * @param {Token} comment A single block comment token in bare-block form. - * @returns {string[]} An array of the processed lines. - */ - function processBareBlockComment(comment) { - const lines = comment.value.split(astUtils.LINEBREAK_MATCHER).map(line => line.replace(/^\s*$/u, "")); - const leadingWhitespace = `${sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0])} `; - let offset = ""; - - /* - * Calculate the offset of the least indented line and use that as the basis for offsetting all the lines. - * The first line should not be checked because it is inline with the opening block comment delimiter. - */ - for (const [i, line] of lines.entries()) { - if (!line.trim().length || i === 0) { - continue; - } - - const [, lineOffset] = line.match(/^(\s*\*?\s*)/u); - - if (lineOffset.length < leadingWhitespace.length) { - const newOffset = leadingWhitespace.slice(lineOffset.length - leadingWhitespace.length); - - if (newOffset.length > offset.length) { - offset = newOffset; - } - } - } - - return lines.map(line => { - const match = line.match(/^(\s*\*?\s*)(.*)/u); - const [, lineOffset, lineContents] = match; - - if (lineOffset.length > leadingWhitespace.length) { - return `${lineOffset.slice(leadingWhitespace.length - (offset.length + lineOffset.length))}${lineContents}`; - } - - if (lineOffset.length < leadingWhitespace.length) { - return `${lineOffset.slice(leadingWhitespace.length)}${lineContents}`; - } - - return lineContents; - }); - } - - /** - * Gets a list of comment lines in a group, formatting leading whitespace as necessary. - * @param {Token[]} commentGroup A group of comments containing either multiple line comments or a single block comment. - * @returns {string[]} A list of comment lines. - */ - function getCommentLines(commentGroup) { - const [firstComment] = commentGroup; - - if (firstComment.type === "Line") { - return processSeparateLineComments(commentGroup); - } - - if (isStarredBlockComment(commentGroup)) { - return processStarredBlockComment(firstComment); - } - - return processBareBlockComment(firstComment); - } - - /** - * Gets the initial offset (whitespace) from the beginning of a line to a given comment token. - * @param {Token} comment The token to check. - * @returns {string} The offset from the beginning of a line to the token. - */ - function getInitialOffset(comment) { - return sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0]); - } - - /** - * Converts a comment into starred-block form - * @param {Token} firstComment The first comment of the group being converted - * @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment - * @returns {string} A representation of the comment value in starred-block form, excluding start and end markers - */ - function convertToStarredBlock(firstComment, commentLinesList) { - const initialOffset = getInitialOffset(firstComment); - - return `/*\n${commentLinesList.map(line => `${initialOffset} * ${line}`).join("\n")}\n${initialOffset} */`; - } - - /** - * Converts a comment into separate-line form - * @param {Token} firstComment The first comment of the group being converted - * @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment - * @returns {string} A representation of the comment value in separate-line form - */ - function convertToSeparateLines(firstComment, commentLinesList) { - return commentLinesList.map(line => `// ${line}`).join(`\n${getInitialOffset(firstComment)}`); - } - - /** - * Converts a comment into bare-block form - * @param {Token} firstComment The first comment of the group being converted - * @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment - * @returns {string} A representation of the comment value in bare-block form - */ - function convertToBlock(firstComment, commentLinesList) { - return `/* ${commentLinesList.join(`\n${getInitialOffset(firstComment)} `)} */`; - } - - /** - * Each method checks a group of comments to see if it's valid according to the given option. - * @param {Token[]} commentGroup A list of comments that appear together. This will either contain a single - * block comment or multiple line comments. - * @returns {void} - */ - const commentGroupCheckers = { - "starred-block"(commentGroup) { - const [firstComment] = commentGroup; - const commentLines = getCommentLines(commentGroup); - - if (commentLines.some(value => value.includes("*/"))) { - return; - } - - if (commentGroup.length > 1) { - context.report({ - loc: { - start: firstComment.loc.start, - end: commentGroup[commentGroup.length - 1].loc.end - }, - messageId: "expectedBlock", - fix(fixer) { - const range = [firstComment.range[0], commentGroup[commentGroup.length - 1].range[1]]; - - return commentLines.some(value => value.startsWith("/")) - ? null - : fixer.replaceTextRange(range, convertToStarredBlock(firstComment, commentLines)); - } - }); - } else { - const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER); - const expectedLeadingWhitespace = getInitialOffset(firstComment); - const expectedLinePrefix = `${expectedLeadingWhitespace} *`; - - if (!/^\*?\s*$/u.test(lines[0])) { - const start = firstComment.value.startsWith("*") ? firstComment.range[0] + 1 : firstComment.range[0]; - - context.report({ - loc: { - start: firstComment.loc.start, - end: { line: firstComment.loc.start.line, column: firstComment.loc.start.column + 2 } - }, - messageId: "startNewline", - fix: fixer => fixer.insertTextAfterRange([start, start + 2], `\n${expectedLinePrefix}`) - }); - } - - if (!/^\s*$/u.test(lines[lines.length - 1])) { - context.report({ - loc: { - start: { line: firstComment.loc.end.line, column: firstComment.loc.end.column - 2 }, - end: firstComment.loc.end - }, - messageId: "endNewline", - fix: fixer => fixer.replaceTextRange([firstComment.range[1] - 2, firstComment.range[1]], `\n${expectedLinePrefix}/`) - }); - } - - for (let lineNumber = firstComment.loc.start.line + 1; lineNumber <= firstComment.loc.end.line; lineNumber++) { - const lineText = sourceCode.lines[lineNumber - 1]; - const errorType = isStarredCommentLine(lineText) - ? "alignment" - : "missingStar"; - - if (!lineText.startsWith(expectedLinePrefix)) { - context.report({ - loc: { - start: { line: lineNumber, column: 0 }, - end: { line: lineNumber, column: lineText.length } - }, - messageId: errorType, - fix(fixer) { - const lineStartIndex = sourceCode.getIndexFromLoc({ line: lineNumber, column: 0 }); - - if (errorType === "alignment") { - const [, commentTextPrefix = ""] = lineText.match(/^(\s*\*)/u) || []; - const commentTextStartIndex = lineStartIndex + commentTextPrefix.length; - - return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], expectedLinePrefix); - } - - const [, commentTextPrefix = ""] = lineText.match(/^(\s*)/u) || []; - const commentTextStartIndex = lineStartIndex + commentTextPrefix.length; - let offset; - - for (const [idx, line] of lines.entries()) { - if (!/\S+/u.test(line)) { - continue; - } - - const lineTextToAlignWith = sourceCode.lines[firstComment.loc.start.line - 1 + idx]; - const [, prefix = "", initialOffset = ""] = lineTextToAlignWith.match(/^(\s*(?:\/?\*)?(\s*))/u) || []; - - offset = `${commentTextPrefix.slice(prefix.length)}${initialOffset}`; - - if (/^\s*\//u.test(lineText) && offset.length === 0) { - offset += " "; - } - break; - } - - return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], `${expectedLinePrefix}${offset}`); - } - }); - } - } - } - }, - "separate-lines"(commentGroup) { - const [firstComment] = commentGroup; - - const isJSDoc = isJSDocComment(commentGroup); - - if (firstComment.type !== "Block" || (!checkJSDoc && isJSDoc)) { - return; - } - - let commentLines = getCommentLines(commentGroup); - - if (isJSDoc) { - commentLines = commentLines.slice(1, commentLines.length - 1); - } - - const tokenAfter = sourceCode.getTokenAfter(firstComment, { includeComments: true }); - - if (tokenAfter && firstComment.loc.end.line === tokenAfter.loc.start.line) { - return; - } - - context.report({ - loc: { - start: firstComment.loc.start, - end: { line: firstComment.loc.start.line, column: firstComment.loc.start.column + 2 } - }, - messageId: "expectedLines", - fix(fixer) { - return fixer.replaceText(firstComment, convertToSeparateLines(firstComment, commentLines)); - } - }); - }, - "bare-block"(commentGroup) { - if (isJSDocComment(commentGroup)) { - return; - } - - const [firstComment] = commentGroup; - const commentLines = getCommentLines(commentGroup); - - // Disallows consecutive line comments in favor of using a block comment. - if (firstComment.type === "Line" && commentLines.length > 1 && - !commentLines.some(value => value.includes("*/"))) { - context.report({ - loc: { - start: firstComment.loc.start, - end: commentGroup[commentGroup.length - 1].loc.end - }, - messageId: "expectedBlock", - fix(fixer) { - return fixer.replaceTextRange( - [firstComment.range[0], commentGroup[commentGroup.length - 1].range[1]], - convertToBlock(firstComment, commentLines) - ); - } - }); - } - - // Prohibits block comments from having a * at the beginning of each line. - if (isStarredBlockComment(commentGroup)) { - context.report({ - loc: { - start: firstComment.loc.start, - end: { line: firstComment.loc.start.line, column: firstComment.loc.start.column + 2 } - }, - messageId: "expectedBareBlock", - fix(fixer) { - return fixer.replaceText(firstComment, convertToBlock(firstComment, commentLines)); - } - }); - } - } - }; - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - Program() { - return sourceCode.getAllComments() - .filter(comment => comment.type !== "Shebang") - .filter(comment => !astUtils.COMMENTS_IGNORE_PATTERN.test(comment.value)) - .filter(comment => { - const tokenBefore = sourceCode.getTokenBefore(comment, { includeComments: true }); - - return !tokenBefore || tokenBefore.loc.end.line < comment.loc.start.line; - }) - .reduce((commentGroups, comment, index, commentList) => { - const tokenBefore = sourceCode.getTokenBefore(comment, { includeComments: true }); - - if ( - comment.type === "Line" && - index && commentList[index - 1].type === "Line" && - tokenBefore && tokenBefore.loc.end.line === comment.loc.start.line - 1 && - tokenBefore === commentList[index - 1] - ) { - commentGroups[commentGroups.length - 1].push(comment); - } else { - commentGroups.push([comment]); - } - - return commentGroups; - }, []) - .filter(commentGroup => !(commentGroup.length === 1 && commentGroup[0].loc.start.line === commentGroup[0].loc.end.line)) - .forEach(commentGroupCheckers[option]); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/multiline-ternary.js b/node_modules/eslint/lib/rules/multiline-ternary.js deleted file mode 100644 index f156fe32b..000000000 --- a/node_modules/eslint/lib/rules/multiline-ternary.js +++ /dev/null @@ -1,171 +0,0 @@ -/** - * @fileoverview Enforce newlines between operands of ternary expressions - * @author Kai Cataldo - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce newlines between operands of ternary expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/multiline-ternary" - }, - - schema: [ - { - enum: ["always", "always-multiline", "never"] - } - ], - - messages: { - expectedTestCons: "Expected newline between test and consequent of ternary expression.", - expectedConsAlt: "Expected newline between consequent and alternate of ternary expression.", - unexpectedTestCons: "Unexpected newline between test and consequent of ternary expression.", - unexpectedConsAlt: "Unexpected newline between consequent and alternate of ternary expression." - }, - - fixable: "whitespace" - }, - - create(context) { - const sourceCode = context.sourceCode; - const option = context.options[0]; - const multiline = option !== "never"; - const allowSingleLine = option === "always-multiline"; - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - ConditionalExpression(node) { - const questionToken = sourceCode.getTokenAfter(node.test, astUtils.isNotClosingParenToken); - const colonToken = sourceCode.getTokenAfter(node.consequent, astUtils.isNotClosingParenToken); - - const firstTokenOfTest = sourceCode.getFirstToken(node); - const lastTokenOfTest = sourceCode.getTokenBefore(questionToken); - const firstTokenOfConsequent = sourceCode.getTokenAfter(questionToken); - const lastTokenOfConsequent = sourceCode.getTokenBefore(colonToken); - const firstTokenOfAlternate = sourceCode.getTokenAfter(colonToken); - - const areTestAndConsequentOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfTest, firstTokenOfConsequent); - const areConsequentAndAlternateOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfConsequent, firstTokenOfAlternate); - - const hasComments = !!sourceCode.getCommentsInside(node).length; - - if (!multiline) { - if (!areTestAndConsequentOnSameLine) { - context.report({ - node: node.test, - loc: { - start: firstTokenOfTest.loc.start, - end: lastTokenOfTest.loc.end - }, - messageId: "unexpectedTestCons", - fix(fixer) { - if (hasComments) { - return null; - } - const fixers = []; - const areTestAndQuestionOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfTest, questionToken); - const areQuestionAndConsOnSameLine = astUtils.isTokenOnSameLine(questionToken, firstTokenOfConsequent); - - if (!areTestAndQuestionOnSameLine) { - fixers.push(fixer.removeRange([lastTokenOfTest.range[1], questionToken.range[0]])); - } - if (!areQuestionAndConsOnSameLine) { - fixers.push(fixer.removeRange([questionToken.range[1], firstTokenOfConsequent.range[0]])); - } - - return fixers; - } - }); - } - - if (!areConsequentAndAlternateOnSameLine) { - context.report({ - node: node.consequent, - loc: { - start: firstTokenOfConsequent.loc.start, - end: lastTokenOfConsequent.loc.end - }, - messageId: "unexpectedConsAlt", - fix(fixer) { - if (hasComments) { - return null; - } - const fixers = []; - const areConsAndColonOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfConsequent, colonToken); - const areColonAndAltOnSameLine = astUtils.isTokenOnSameLine(colonToken, firstTokenOfAlternate); - - if (!areConsAndColonOnSameLine) { - fixers.push(fixer.removeRange([lastTokenOfConsequent.range[1], colonToken.range[0]])); - } - if (!areColonAndAltOnSameLine) { - fixers.push(fixer.removeRange([colonToken.range[1], firstTokenOfAlternate.range[0]])); - } - - return fixers; - } - }); - } - } else { - if (allowSingleLine && node.loc.start.line === node.loc.end.line) { - return; - } - - if (areTestAndConsequentOnSameLine) { - context.report({ - node: node.test, - loc: { - start: firstTokenOfTest.loc.start, - end: lastTokenOfTest.loc.end - }, - messageId: "expectedTestCons", - fix: fixer => (hasComments ? null : ( - fixer.replaceTextRange( - [ - lastTokenOfTest.range[1], - questionToken.range[0] - ], - "\n" - ) - )) - }); - } - - if (areConsequentAndAlternateOnSameLine) { - context.report({ - node: node.consequent, - loc: { - start: firstTokenOfConsequent.loc.start, - end: lastTokenOfConsequent.loc.end - }, - messageId: "expectedConsAlt", - fix: (fixer => (hasComments ? null : ( - fixer.replaceTextRange( - [ - lastTokenOfConsequent.range[1], - colonToken.range[0] - ], - "\n" - ) - ))) - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/new-cap.js b/node_modules/eslint/lib/rules/new-cap.js deleted file mode 100644 index f81e42fd0..000000000 --- a/node_modules/eslint/lib/rules/new-cap.js +++ /dev/null @@ -1,276 +0,0 @@ -/** - * @fileoverview Rule to flag use of constructors without capital letters - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const CAPS_ALLOWED = [ - "Array", - "Boolean", - "Date", - "Error", - "Function", - "Number", - "Object", - "RegExp", - "String", - "Symbol", - "BigInt" -]; - -/** - * Ensure that if the key is provided, it must be an array. - * @param {Object} obj Object to check with `key`. - * @param {string} key Object key to check on `obj`. - * @param {any} fallback If obj[key] is not present, this will be returned. - * @throws {TypeError} If key is not an own array type property of `obj`. - * @returns {string[]} Returns obj[key] if it's an Array, otherwise `fallback` - */ -function checkArray(obj, key, fallback) { - - /* c8 ignore start */ - if (Object.prototype.hasOwnProperty.call(obj, key) && !Array.isArray(obj[key])) { - throw new TypeError(`${key}, if provided, must be an Array`); - }/* c8 ignore stop */ - return obj[key] || fallback; -} - -/** - * A reducer function to invert an array to an Object mapping the string form of the key, to `true`. - * @param {Object} map Accumulator object for the reduce. - * @param {string} key Object key to set to `true`. - * @returns {Object} Returns the updated Object for further reduction. - */ -function invert(map, key) { - map[key] = true; - return map; -} - -/** - * Creates an object with the cap is new exceptions as its keys and true as their values. - * @param {Object} config Rule configuration - * @returns {Object} Object with cap is new exceptions. - */ -function calculateCapIsNewExceptions(config) { - let capIsNewExceptions = checkArray(config, "capIsNewExceptions", CAPS_ALLOWED); - - if (capIsNewExceptions !== CAPS_ALLOWED) { - capIsNewExceptions = capIsNewExceptions.concat(CAPS_ALLOWED); - } - - return capIsNewExceptions.reduce(invert, {}); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require constructor names to begin with a capital letter", - recommended: false, - url: "https://eslint.org/docs/latest/rules/new-cap" - }, - - schema: [ - { - type: "object", - properties: { - newIsCap: { - type: "boolean", - default: true - }, - capIsNew: { - type: "boolean", - default: true - }, - newIsCapExceptions: { - type: "array", - items: { - type: "string" - } - }, - newIsCapExceptionPattern: { - type: "string" - }, - capIsNewExceptions: { - type: "array", - items: { - type: "string" - } - }, - capIsNewExceptionPattern: { - type: "string" - }, - properties: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - messages: { - upper: "A function with a name starting with an uppercase letter should only be used as a constructor.", - lower: "A constructor name should not start with a lowercase letter." - } - }, - - create(context) { - - const config = Object.assign({}, context.options[0]); - - config.newIsCap = config.newIsCap !== false; - config.capIsNew = config.capIsNew !== false; - const skipProperties = config.properties === false; - - const newIsCapExceptions = checkArray(config, "newIsCapExceptions", []).reduce(invert, {}); - const newIsCapExceptionPattern = config.newIsCapExceptionPattern ? new RegExp(config.newIsCapExceptionPattern, "u") : null; - - const capIsNewExceptions = calculateCapIsNewExceptions(config); - const capIsNewExceptionPattern = config.capIsNewExceptionPattern ? new RegExp(config.capIsNewExceptionPattern, "u") : null; - - const listeners = {}; - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Get exact callee name from expression - * @param {ASTNode} node CallExpression or NewExpression node - * @returns {string} name - */ - function extractNameFromExpression(node) { - return node.callee.type === "Identifier" - ? node.callee.name - : astUtils.getStaticPropertyName(node.callee) || ""; - } - - /** - * Returns the capitalization state of the string - - * Whether the first character is uppercase, lowercase, or non-alphabetic - * @param {string} str String - * @returns {string} capitalization state: "non-alpha", "lower", or "upper" - */ - function getCap(str) { - const firstChar = str.charAt(0); - - const firstCharLower = firstChar.toLowerCase(); - const firstCharUpper = firstChar.toUpperCase(); - - if (firstCharLower === firstCharUpper) { - - // char has no uppercase variant, so it's non-alphabetic - return "non-alpha"; - } - if (firstChar === firstCharLower) { - return "lower"; - } - return "upper"; - - } - - /** - * Check if capitalization is allowed for a CallExpression - * @param {Object} allowedMap Object mapping calleeName to a Boolean - * @param {ASTNode} node CallExpression node - * @param {string} calleeName Capitalized callee name from a CallExpression - * @param {Object} pattern RegExp object from options pattern - * @returns {boolean} Returns true if the callee may be capitalized - */ - function isCapAllowed(allowedMap, node, calleeName, pattern) { - const sourceText = sourceCode.getText(node.callee); - - if (allowedMap[calleeName] || allowedMap[sourceText]) { - return true; - } - - if (pattern && pattern.test(sourceText)) { - return true; - } - - const callee = astUtils.skipChainExpression(node.callee); - - if (calleeName === "UTC" && callee.type === "MemberExpression") { - - // allow if callee is Date.UTC - return callee.object.type === "Identifier" && - callee.object.name === "Date"; - } - - return skipProperties && callee.type === "MemberExpression"; - } - - /** - * Reports the given messageId for the given node. The location will be the start of the property or the callee. - * @param {ASTNode} node CallExpression or NewExpression node. - * @param {string} messageId The messageId to report. - * @returns {void} - */ - function report(node, messageId) { - let callee = astUtils.skipChainExpression(node.callee); - - if (callee.type === "MemberExpression") { - callee = callee.property; - } - - context.report({ node, loc: callee.loc, messageId }); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - if (config.newIsCap) { - listeners.NewExpression = function(node) { - - const constructorName = extractNameFromExpression(node); - - if (constructorName) { - const capitalization = getCap(constructorName); - const isAllowed = capitalization !== "lower" || isCapAllowed(newIsCapExceptions, node, constructorName, newIsCapExceptionPattern); - - if (!isAllowed) { - report(node, "lower"); - } - } - }; - } - - if (config.capIsNew) { - listeners.CallExpression = function(node) { - - const calleeName = extractNameFromExpression(node); - - if (calleeName) { - const capitalization = getCap(calleeName); - const isAllowed = capitalization !== "upper" || isCapAllowed(capIsNewExceptions, node, calleeName, capIsNewExceptionPattern); - - if (!isAllowed) { - report(node, "upper"); - } - } - }; - } - - return listeners; - } -}; diff --git a/node_modules/eslint/lib/rules/new-parens.js b/node_modules/eslint/lib/rules/new-parens.js deleted file mode 100644 index e8667310f..000000000 --- a/node_modules/eslint/lib/rules/new-parens.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @fileoverview Rule to flag when using constructor without parentheses - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce or disallow parentheses when invoking a constructor with no arguments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/new-parens" - }, - - fixable: "code", - schema: [ - { - enum: ["always", "never"] - } - ], - messages: { - missing: "Missing '()' invoking a constructor.", - unnecessary: "Unnecessary '()' invoking a constructor with no arguments." - } - }, - - create(context) { - const options = context.options; - const always = options[0] !== "never"; // Default is always - - const sourceCode = context.sourceCode; - - return { - NewExpression(node) { - if (node.arguments.length !== 0) { - return; // if there are arguments, there have to be parens - } - - const lastToken = sourceCode.getLastToken(node); - const hasLastParen = lastToken && astUtils.isClosingParenToken(lastToken); - - // `hasParens` is true only if the new expression ends with its own parens, e.g., new new foo() does not end with its own parens - const hasParens = hasLastParen && - astUtils.isOpeningParenToken(sourceCode.getTokenBefore(lastToken)) && - node.callee.range[1] < node.range[1]; - - if (always) { - if (!hasParens) { - context.report({ - node, - messageId: "missing", - fix: fixer => fixer.insertTextAfter(node, "()") - }); - } - } else { - if (hasParens) { - context.report({ - node, - messageId: "unnecessary", - fix: fixer => [ - fixer.remove(sourceCode.getTokenBefore(lastToken)), - fixer.remove(lastToken), - fixer.insertTextBefore(node, "("), - fixer.insertTextAfter(node, ")") - ] - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/newline-after-var.js b/node_modules/eslint/lib/rules/newline-after-var.js deleted file mode 100644 index 5c9b5fbd1..000000000 --- a/node_modules/eslint/lib/rules/newline-after-var.js +++ /dev/null @@ -1,255 +0,0 @@ -/** - * @fileoverview Rule to check empty newline after "var" statement - * @author Gopal Venkatesan - * @deprecated in ESLint v4.0.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow an empty line after variable declarations", - recommended: false, - url: "https://eslint.org/docs/latest/rules/newline-after-var" - }, - schema: [ - { - enum: ["never", "always"] - } - ], - fixable: "whitespace", - messages: { - expected: "Expected blank line after variable declarations.", - unexpected: "Unexpected blank line after variable declarations." - }, - - deprecated: true, - - replacedBy: ["padding-line-between-statements"] - }, - - create(context) { - const sourceCode = context.sourceCode; - - // Default `mode` to "always". - const mode = context.options[0] === "never" ? "never" : "always"; - - // Cache starting and ending line numbers of comments for faster lookup - const commentEndLine = sourceCode.getAllComments().reduce((result, token) => { - result[token.loc.start.line] = token.loc.end.line; - return result; - }, {}); - - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Gets a token from the given node to compare line to the next statement. - * - * In general, the token is the last token of the node. However, the token is the second last token if the following conditions satisfy. - * - * - The last token is semicolon. - * - The semicolon is on a different line from the previous token of the semicolon. - * - * This behavior would address semicolon-less style code. e.g.: - * - * var foo = 1 - * - * ;(a || b).doSomething() - * @param {ASTNode} node The node to get. - * @returns {Token} The token to compare line to the next statement. - */ - function getLastToken(node) { - const lastToken = sourceCode.getLastToken(node); - - if (lastToken.type === "Punctuator" && lastToken.value === ";") { - const prevToken = sourceCode.getTokenBefore(lastToken); - - if (prevToken.loc.end.line !== lastToken.loc.start.line) { - return prevToken; - } - } - - return lastToken; - } - - /** - * Determine if provided keyword is a variable declaration - * @private - * @param {string} keyword keyword to test - * @returns {boolean} True if `keyword` is a type of var - */ - function isVar(keyword) { - return keyword === "var" || keyword === "let" || keyword === "const"; - } - - /** - * Determine if provided keyword is a variant of for specifiers - * @private - * @param {string} keyword keyword to test - * @returns {boolean} True if `keyword` is a variant of for specifier - */ - function isForTypeSpecifier(keyword) { - return keyword === "ForStatement" || keyword === "ForInStatement" || keyword === "ForOfStatement"; - } - - /** - * Determine if provided keyword is an export specifiers - * @private - * @param {string} nodeType nodeType to test - * @returns {boolean} True if `nodeType` is an export specifier - */ - function isExportSpecifier(nodeType) { - return nodeType === "ExportNamedDeclaration" || nodeType === "ExportSpecifier" || - nodeType === "ExportDefaultDeclaration" || nodeType === "ExportAllDeclaration"; - } - - /** - * Determine if provided node is the last of their parent block. - * @private - * @param {ASTNode} node node to test - * @returns {boolean} True if `node` is last of their parent block. - */ - function isLastNode(node) { - const token = sourceCode.getTokenAfter(node); - - return !token || (token.type === "Punctuator" && token.value === "}"); - } - - /** - * Gets the last line of a group of consecutive comments - * @param {number} commentStartLine The starting line of the group - * @returns {number} The number of the last comment line of the group - */ - function getLastCommentLineOfBlock(commentStartLine) { - const currentCommentEnd = commentEndLine[commentStartLine]; - - return commentEndLine[currentCommentEnd + 1] ? getLastCommentLineOfBlock(currentCommentEnd + 1) : currentCommentEnd; - } - - /** - * Determine if a token starts more than one line after a comment ends - * @param {token} token The token being checked - * @param {integer} commentStartLine The line number on which the comment starts - * @returns {boolean} True if `token` does not start immediately after a comment - */ - function hasBlankLineAfterComment(token, commentStartLine) { - return token.loc.start.line > getLastCommentLineOfBlock(commentStartLine) + 1; - } - - /** - * Checks that a blank line exists after a variable declaration when mode is - * set to "always", or checks that there is no blank line when mode is set - * to "never" - * @private - * @param {ASTNode} node `VariableDeclaration` node to test - * @returns {void} - */ - function checkForBlankLine(node) { - - /* - * lastToken is the last token on the node's line. It will usually also be the last token of the node, but it will - * sometimes be second-last if there is a semicolon on a different line. - */ - const lastToken = getLastToken(node), - - /* - * If lastToken is the last token of the node, nextToken should be the token after the node. Otherwise, nextToken - * is the last token of the node. - */ - nextToken = lastToken === sourceCode.getLastToken(node) ? sourceCode.getTokenAfter(node) : sourceCode.getLastToken(node), - nextLineNum = lastToken.loc.end.line + 1; - - // Ignore if there is no following statement - if (!nextToken) { - return; - } - - // Ignore if parent of node is a for variant - if (isForTypeSpecifier(node.parent.type)) { - return; - } - - // Ignore if parent of node is an export specifier - if (isExportSpecifier(node.parent.type)) { - return; - } - - /* - * Some coding styles use multiple `var` statements, so do nothing if - * the next token is a `var` statement. - */ - if (nextToken.type === "Keyword" && isVar(nextToken.value)) { - return; - } - - // Ignore if it is last statement in a block - if (isLastNode(node)) { - return; - } - - // Next statement is not a `var`... - const noNextLineToken = nextToken.loc.start.line > nextLineNum; - const hasNextLineComment = (typeof commentEndLine[nextLineNum] !== "undefined"); - - if (mode === "never" && noNextLineToken && !hasNextLineComment) { - context.report({ - node, - messageId: "unexpected", - data: { identifier: node.name }, - fix(fixer) { - const linesBetween = sourceCode.getText().slice(lastToken.range[1], nextToken.range[0]).split(astUtils.LINEBREAK_MATCHER); - - return fixer.replaceTextRange([lastToken.range[1], nextToken.range[0]], `${linesBetween.slice(0, -1).join("")}\n${linesBetween[linesBetween.length - 1]}`); - } - }); - } - - // Token on the next line, or comment without blank line - if ( - mode === "always" && ( - !noNextLineToken || - hasNextLineComment && !hasBlankLineAfterComment(nextToken, nextLineNum) - ) - ) { - context.report({ - node, - messageId: "expected", - data: { identifier: node.name }, - fix(fixer) { - if ((noNextLineToken ? getLastCommentLineOfBlock(nextLineNum) : lastToken.loc.end.line) === nextToken.loc.start.line) { - return fixer.insertTextBefore(nextToken, "\n\n"); - } - - return fixer.insertTextBeforeRange([nextToken.range[0] - nextToken.loc.start.column, nextToken.range[1]], "\n"); - } - }); - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - VariableDeclaration: checkForBlankLine - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/newline-before-return.js b/node_modules/eslint/lib/rules/newline-before-return.js deleted file mode 100644 index 73d8ef99f..000000000 --- a/node_modules/eslint/lib/rules/newline-before-return.js +++ /dev/null @@ -1,217 +0,0 @@ -/** - * @fileoverview Rule to require newlines before `return` statement - * @author Kai Cataldo - * @deprecated in ESLint v4.0.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require an empty line before `return` statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/newline-before-return" - }, - - fixable: "whitespace", - schema: [], - messages: { - expected: "Expected newline before return statement." - }, - - deprecated: true, - replacedBy: ["padding-line-between-statements"] - }, - - create(context) { - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Tests whether node is preceded by supplied tokens - * @param {ASTNode} node node to check - * @param {Array} testTokens array of tokens to test against - * @returns {boolean} Whether or not the node is preceded by one of the supplied tokens - * @private - */ - function isPrecededByTokens(node, testTokens) { - const tokenBefore = sourceCode.getTokenBefore(node); - - return testTokens.includes(tokenBefore.value); - } - - /** - * Checks whether node is the first node after statement or in block - * @param {ASTNode} node node to check - * @returns {boolean} Whether or not the node is the first node after statement or in block - * @private - */ - function isFirstNode(node) { - const parentType = node.parent.type; - - if (node.parent.body) { - return Array.isArray(node.parent.body) - ? node.parent.body[0] === node - : node.parent.body === node; - } - - if (parentType === "IfStatement") { - return isPrecededByTokens(node, ["else", ")"]); - } - if (parentType === "DoWhileStatement") { - return isPrecededByTokens(node, ["do"]); - } - if (parentType === "SwitchCase") { - return isPrecededByTokens(node, [":"]); - } - return isPrecededByTokens(node, [")"]); - - } - - /** - * Returns the number of lines of comments that precede the node - * @param {ASTNode} node node to check for overlapping comments - * @param {number} lineNumTokenBefore line number of previous token, to check for overlapping comments - * @returns {number} Number of lines of comments that precede the node - * @private - */ - function calcCommentLines(node, lineNumTokenBefore) { - const comments = sourceCode.getCommentsBefore(node); - let numLinesComments = 0; - - if (!comments.length) { - return numLinesComments; - } - - comments.forEach(comment => { - numLinesComments++; - - if (comment.type === "Block") { - numLinesComments += comment.loc.end.line - comment.loc.start.line; - } - - // avoid counting lines with inline comments twice - if (comment.loc.start.line === lineNumTokenBefore) { - numLinesComments--; - } - - if (comment.loc.end.line === node.loc.start.line) { - numLinesComments--; - } - }); - - return numLinesComments; - } - - /** - * Returns the line number of the token before the node that is passed in as an argument - * @param {ASTNode} node The node to use as the start of the calculation - * @returns {number} Line number of the token before `node` - * @private - */ - function getLineNumberOfTokenBefore(node) { - const tokenBefore = sourceCode.getTokenBefore(node); - let lineNumTokenBefore; - - /** - * Global return (at the beginning of a script) is a special case. - * If there is no token before `return`, then we expect no line - * break before the return. Comments are allowed to occupy lines - * before the global return, just no blank lines. - * Setting lineNumTokenBefore to zero in that case results in the - * desired behavior. - */ - if (tokenBefore) { - lineNumTokenBefore = tokenBefore.loc.end.line; - } else { - lineNumTokenBefore = 0; // global return at beginning of script - } - - return lineNumTokenBefore; - } - - /** - * Checks whether node is preceded by a newline - * @param {ASTNode} node node to check - * @returns {boolean} Whether or not the node is preceded by a newline - * @private - */ - function hasNewlineBefore(node) { - const lineNumNode = node.loc.start.line; - const lineNumTokenBefore = getLineNumberOfTokenBefore(node); - const commentLines = calcCommentLines(node, lineNumTokenBefore); - - return (lineNumNode - lineNumTokenBefore - commentLines) > 1; - } - - /** - * Checks whether it is safe to apply a fix to a given return statement. - * - * The fix is not considered safe if the given return statement has leading comments, - * as we cannot safely determine if the newline should be added before or after the comments. - * For more information, see: https://github.com/eslint/eslint/issues/5958#issuecomment-222767211 - * @param {ASTNode} node The return statement node to check. - * @returns {boolean} `true` if it can fix the node. - * @private - */ - function canFix(node) { - const leadingComments = sourceCode.getCommentsBefore(node); - const lastLeadingComment = leadingComments[leadingComments.length - 1]; - const tokenBefore = sourceCode.getTokenBefore(node); - - if (leadingComments.length === 0) { - return true; - } - - /* - * if the last leading comment ends in the same line as the previous token and - * does not share a line with the `return` node, we can consider it safe to fix. - * Example: - * function a() { - * var b; //comment - * return; - * } - */ - if (lastLeadingComment.loc.end.line === tokenBefore.loc.end.line && - lastLeadingComment.loc.end.line !== node.loc.start.line) { - return true; - } - - return false; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - ReturnStatement(node) { - if (!isFirstNode(node) && !hasNewlineBefore(node)) { - context.report({ - node, - messageId: "expected", - fix(fixer) { - if (canFix(node)) { - const tokenBefore = sourceCode.getTokenBefore(node); - const newlines = node.loc.start.line === tokenBefore.loc.end.line ? "\n\n" : "\n"; - - return fixer.insertTextBefore(node, newlines); - } - return null; - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/newline-per-chained-call.js b/node_modules/eslint/lib/rules/newline-per-chained-call.js deleted file mode 100644 index b2e6cd9e4..000000000 --- a/node_modules/eslint/lib/rules/newline-per-chained-call.js +++ /dev/null @@ -1,123 +0,0 @@ -/** - * @fileoverview Rule to ensure newline per method call when chaining calls - * @author Rajendra Patil - * @author Burak Yigit Kaya - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require a newline after each call in a method chain", - recommended: false, - url: "https://eslint.org/docs/latest/rules/newline-per-chained-call" - }, - - fixable: "whitespace", - - schema: [{ - type: "object", - properties: { - ignoreChainWithDepth: { - type: "integer", - minimum: 1, - maximum: 10, - default: 2 - } - }, - additionalProperties: false - }], - messages: { - expected: "Expected line break before `{{callee}}`." - } - }, - - create(context) { - - const options = context.options[0] || {}, - ignoreChainWithDepth = options.ignoreChainWithDepth || 2; - - const sourceCode = context.sourceCode; - - /** - * Get the prefix of a given MemberExpression node. - * If the MemberExpression node is a computed value it returns a - * left bracket. If not it returns a period. - * @param {ASTNode} node A MemberExpression node to get - * @returns {string} The prefix of the node. - */ - function getPrefix(node) { - if (node.computed) { - if (node.optional) { - return "?.["; - } - return "["; - } - if (node.optional) { - return "?."; - } - return "."; - } - - /** - * Gets the property text of a given MemberExpression node. - * If the text is multiline, this returns only the first line. - * @param {ASTNode} node A MemberExpression node to get. - * @returns {string} The property text of the node. - */ - function getPropertyText(node) { - const prefix = getPrefix(node); - const lines = sourceCode.getText(node.property).split(astUtils.LINEBREAK_MATCHER); - const suffix = node.computed && lines.length === 1 ? "]" : ""; - - return prefix + lines[0] + suffix; - } - - return { - "CallExpression:exit"(node) { - const callee = astUtils.skipChainExpression(node.callee); - - if (callee.type !== "MemberExpression") { - return; - } - - let parent = astUtils.skipChainExpression(callee.object); - let depth = 1; - - while (parent && parent.callee) { - depth += 1; - parent = astUtils.skipChainExpression(astUtils.skipChainExpression(parent.callee).object); - } - - if (depth > ignoreChainWithDepth && astUtils.isTokenOnSameLine(callee.object, callee.property)) { - const firstTokenAfterObject = sourceCode.getTokenAfter(callee.object, astUtils.isNotClosingParenToken); - - context.report({ - node: callee.property, - loc: { - start: firstTokenAfterObject.loc.start, - end: callee.loc.end - }, - messageId: "expected", - data: { - callee: getPropertyText(callee) - }, - fix(fixer) { - return fixer.insertTextBefore(firstTokenAfterObject, "\n"); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-alert.js b/node_modules/eslint/lib/rules/no-alert.js deleted file mode 100644 index cc8728565..000000000 --- a/node_modules/eslint/lib/rules/no-alert.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @fileoverview Rule to flag use of alert, confirm, prompt - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { - getStaticPropertyName: getPropertyName, - getVariableByName, - skipChainExpression -} = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks if the given name is a prohibited identifier. - * @param {string} name The name to check - * @returns {boolean} Whether or not the name is prohibited. - */ -function isProhibitedIdentifier(name) { - return /^(alert|confirm|prompt)$/u.test(name); -} - -/** - * Finds the eslint-scope reference in the given scope. - * @param {Object} scope The scope to search. - * @param {ASTNode} node The identifier node. - * @returns {Reference|null} Returns the found reference or null if none were found. - */ -function findReference(scope, node) { - const references = scope.references.filter(reference => reference.identifier.range[0] === node.range[0] && - reference.identifier.range[1] === node.range[1]); - - if (references.length === 1) { - return references[0]; - } - return null; -} - -/** - * Checks if the given identifier node is shadowed in the given scope. - * @param {Object} scope The current scope. - * @param {string} node The identifier node to check - * @returns {boolean} Whether or not the name is shadowed. - */ -function isShadowed(scope, node) { - const reference = findReference(scope, node); - - return reference && reference.resolved && reference.resolved.defs.length > 0; -} - -/** - * Checks if the given identifier node is a ThisExpression in the global scope or the global window property. - * @param {Object} scope The current scope. - * @param {string} node The identifier node to check - * @returns {boolean} Whether or not the node is a reference to the global object. - */ -function isGlobalThisReferenceOrGlobalWindow(scope, node) { - if (scope.type === "global" && node.type === "ThisExpression") { - return true; - } - if ( - node.type === "Identifier" && - ( - node.name === "window" || - (node.name === "globalThis" && getVariableByName(scope, "globalThis")) - ) - ) { - return !isShadowed(scope, node); - } - - return false; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the use of `alert`, `confirm`, and `prompt`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-alert" - }, - - schema: [], - - messages: { - unexpected: "Unexpected {{name}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - CallExpression(node) { - const callee = skipChainExpression(node.callee), - currentScope = sourceCode.getScope(node); - - // without window. - if (callee.type === "Identifier") { - const name = callee.name; - - if (!isShadowed(currentScope, callee) && isProhibitedIdentifier(callee.name)) { - context.report({ - node, - messageId: "unexpected", - data: { name } - }); - } - - } else if (callee.type === "MemberExpression" && isGlobalThisReferenceOrGlobalWindow(currentScope, callee.object)) { - const name = getPropertyName(callee); - - if (isProhibitedIdentifier(name)) { - context.report({ - node, - messageId: "unexpected", - data: { name } - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-array-constructor.js b/node_modules/eslint/lib/rules/no-array-constructor.js deleted file mode 100644 index b53992641..000000000 --- a/node_modules/eslint/lib/rules/no-array-constructor.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @fileoverview Disallow construction of dense arrays using the Array constructor - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `Array` constructors", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-array-constructor" - }, - - schema: [], - - messages: { - preferLiteral: "The array literal notation [] is preferable." - } - }, - - create(context) { - - /** - * Disallow construction of dense arrays using the Array constructor - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function check(node) { - if ( - node.arguments.length !== 1 && - node.callee.type === "Identifier" && - node.callee.name === "Array" - ) { - context.report({ node, messageId: "preferLiteral" }); - } - } - - return { - CallExpression: check, - NewExpression: check - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-async-promise-executor.js b/node_modules/eslint/lib/rules/no-async-promise-executor.js deleted file mode 100644 index ea6c85114..000000000 --- a/node_modules/eslint/lib/rules/no-async-promise-executor.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @fileoverview disallow using an async function as a Promise executor - * @author Teddy Katz - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow using an async function as a Promise executor", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-async-promise-executor" - }, - - fixable: null, - schema: [], - messages: { - async: "Promise executor functions should not be async." - } - }, - - create(context) { - return { - "NewExpression[callee.name='Promise'][arguments.0.async=true]"(node) { - context.report({ - node: context.sourceCode.getFirstToken(node.arguments[0], token => token.value === "async"), - messageId: "async" - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-await-in-loop.js b/node_modules/eslint/lib/rules/no-await-in-loop.js deleted file mode 100644 index 20230defa..000000000 --- a/node_modules/eslint/lib/rules/no-await-in-loop.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @fileoverview Rule to disallow uses of await inside of loops. - * @author Nat Mote (nmote) - */ -"use strict"; - -/** - * Check whether it should stop traversing ancestors at the given node. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if it should stop traversing. - */ -function isBoundary(node) { - const t = node.type; - - return ( - t === "FunctionDeclaration" || - t === "FunctionExpression" || - t === "ArrowFunctionExpression" || - - /* - * Don't report the await expressions on for-await-of loop since it's - * asynchronous iteration intentionally. - */ - (t === "ForOfStatement" && node.await === true) - ); -} - -/** - * Check whether the given node is in loop. - * @param {ASTNode} node A node to check. - * @param {ASTNode} parent A parent node to check. - * @returns {boolean} `true` if the node is in loop. - */ -function isLooped(node, parent) { - switch (parent.type) { - case "ForStatement": - return ( - node === parent.test || - node === parent.update || - node === parent.body - ); - - case "ForOfStatement": - case "ForInStatement": - return node === parent.body; - - case "WhileStatement": - case "DoWhileStatement": - return node === parent.test || node === parent.body; - - default: - return false; - } -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow `await` inside of loops", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-await-in-loop" - }, - - schema: [], - - messages: { - unexpectedAwait: "Unexpected `await` inside a loop." - } - }, - create(context) { - - /** - * Validate an await expression. - * @param {ASTNode} awaitNode An AwaitExpression or ForOfStatement node to validate. - * @returns {void} - */ - function validate(awaitNode) { - if (awaitNode.type === "ForOfStatement" && !awaitNode.await) { - return; - } - - let node = awaitNode; - let parent = node.parent; - - while (parent && !isBoundary(parent)) { - if (isLooped(node, parent)) { - context.report({ - node: awaitNode, - messageId: "unexpectedAwait" - }); - return; - } - node = parent; - parent = parent.parent; - } - } - - return { - AwaitExpression: validate, - ForOfStatement: validate - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-bitwise.js b/node_modules/eslint/lib/rules/no-bitwise.js deleted file mode 100644 index d90992b20..000000000 --- a/node_modules/eslint/lib/rules/no-bitwise.js +++ /dev/null @@ -1,119 +0,0 @@ -/** - * @fileoverview Rule to flag bitwise identifiers - * @author Nicholas C. Zakas - */ - -"use strict"; - -/* - * - * Set of bitwise operators. - * - */ -const BITWISE_OPERATORS = [ - "^", "|", "&", "<<", ">>", ">>>", - "^=", "|=", "&=", "<<=", ">>=", ">>>=", - "~" -]; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow bitwise operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-bitwise" - }, - - schema: [ - { - type: "object", - properties: { - allow: { - type: "array", - items: { - enum: BITWISE_OPERATORS - }, - uniqueItems: true - }, - int32Hint: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "Unexpected use of '{{operator}}'." - } - }, - - create(context) { - const options = context.options[0] || {}; - const allowed = options.allow || []; - const int32Hint = options.int32Hint === true; - - /** - * Reports an unexpected use of a bitwise operator. - * @param {ASTNode} node Node which contains the bitwise operator. - * @returns {void} - */ - function report(node) { - context.report({ node, messageId: "unexpected", data: { operator: node.operator } }); - } - - /** - * Checks if the given node has a bitwise operator. - * @param {ASTNode} node The node to check. - * @returns {boolean} Whether or not the node has a bitwise operator. - */ - function hasBitwiseOperator(node) { - return BITWISE_OPERATORS.includes(node.operator); - } - - /** - * Checks if exceptions were provided, e.g. `{ allow: ['~', '|'] }`. - * @param {ASTNode} node The node to check. - * @returns {boolean} Whether or not the node has a bitwise operator. - */ - function allowedOperator(node) { - return allowed.includes(node.operator); - } - - /** - * Checks if the given bitwise operator is used for integer typecasting, i.e. "|0" - * @param {ASTNode} node The node to check. - * @returns {boolean} whether the node is used in integer typecasting. - */ - function isInt32Hint(node) { - return int32Hint && node.operator === "|" && node.right && - node.right.type === "Literal" && node.right.value === 0; - } - - /** - * Report if the given node contains a bitwise operator. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkNodeForBitwiseOperator(node) { - if (hasBitwiseOperator(node) && !allowedOperator(node) && !isInt32Hint(node)) { - report(node); - } - } - - return { - AssignmentExpression: checkNodeForBitwiseOperator, - BinaryExpression: checkNodeForBitwiseOperator, - UnaryExpression: checkNodeForBitwiseOperator - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-buffer-constructor.js b/node_modules/eslint/lib/rules/no-buffer-constructor.js deleted file mode 100644 index 0b73c7674..000000000 --- a/node_modules/eslint/lib/rules/no-buffer-constructor.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @fileoverview disallow use of the Buffer() constructor - * @author Teddy Katz - * @deprecated in ESLint v7.0.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "problem", - - docs: { - description: "Disallow use of the `Buffer()` constructor", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-buffer-constructor" - }, - - schema: [], - - messages: { - deprecated: "{{expr}} is deprecated. Use Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe() instead." - } - }, - - create(context) { - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - "CallExpression[callee.name='Buffer'], NewExpression[callee.name='Buffer']"(node) { - context.report({ - node, - messageId: "deprecated", - data: { expr: node.type === "CallExpression" ? "Buffer()" : "new Buffer()" } - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-caller.js b/node_modules/eslint/lib/rules/no-caller.js deleted file mode 100644 index 3e61a8e1c..000000000 --- a/node_modules/eslint/lib/rules/no-caller.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @fileoverview Rule to flag use of arguments.callee and arguments.caller. - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the use of `arguments.caller` or `arguments.callee`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-caller" - }, - - schema: [], - - messages: { - unexpected: "Avoid arguments.{{prop}}." - } - }, - - create(context) { - - return { - - MemberExpression(node) { - const objectName = node.object.name, - propertyName = node.property.name; - - if (objectName === "arguments" && !node.computed && propertyName && propertyName.match(/^calle[er]$/u)) { - context.report({ node, messageId: "unexpected", data: { prop: propertyName } }); - } - - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-case-declarations.js b/node_modules/eslint/lib/rules/no-case-declarations.js deleted file mode 100644 index 8dc5b021d..000000000 --- a/node_modules/eslint/lib/rules/no-case-declarations.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @fileoverview Rule to flag use of an lexical declarations inside a case clause - * @author Erik Arvidsson - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow lexical declarations in case clauses", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-case-declarations" - }, - - schema: [], - - messages: { - unexpected: "Unexpected lexical declaration in case block." - } - }, - - create(context) { - - /** - * Checks whether or not a node is a lexical declaration. - * @param {ASTNode} node A direct child statement of a switch case. - * @returns {boolean} Whether or not the node is a lexical declaration. - */ - function isLexicalDeclaration(node) { - switch (node.type) { - case "FunctionDeclaration": - case "ClassDeclaration": - return true; - case "VariableDeclaration": - return node.kind !== "var"; - default: - return false; - } - } - - return { - SwitchCase(node) { - for (let i = 0; i < node.consequent.length; i++) { - const statement = node.consequent[i]; - - if (isLexicalDeclaration(statement)) { - context.report({ - node: statement, - messageId: "unexpected" - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-catch-shadow.js b/node_modules/eslint/lib/rules/no-catch-shadow.js deleted file mode 100644 index f9d855243..000000000 --- a/node_modules/eslint/lib/rules/no-catch-shadow.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @fileoverview Rule to flag variable leak in CatchClauses in IE 8 and earlier - * @author Ian Christian Myers - * @deprecated in ESLint v5.1.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `catch` clause parameters from shadowing variables in the outer scope", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-catch-shadow" - }, - - replacedBy: ["no-shadow"], - - deprecated: true, - schema: [], - - messages: { - mutable: "Value of '{{name}}' may be overwritten in IE 8 and earlier." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Check if the parameters are been shadowed - * @param {Object} scope current scope - * @param {string} name parameter name - * @returns {boolean} True is its been shadowed - */ - function paramIsShadowing(scope, name) { - return astUtils.getVariableByName(scope, name) !== null; - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - - "CatchClause[param!=null]"(node) { - let scope = sourceCode.getScope(node); - - /* - * When ecmaVersion >= 6, CatchClause creates its own scope - * so start from one upper scope to exclude the current node - */ - if (scope.block === node) { - scope = scope.upper; - } - - if (paramIsShadowing(scope, node.param.name)) { - context.report({ node, messageId: "mutable", data: { name: node.param.name } }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-class-assign.js b/node_modules/eslint/lib/rules/no-class-assign.js deleted file mode 100644 index 49f3b844e..000000000 --- a/node_modules/eslint/lib/rules/no-class-assign.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @fileoverview A rule to disallow modifying variables of class declarations - * @author Toru Nagashima - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow reassigning class members", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-class-assign" - }, - - schema: [], - - messages: { - class: "'{{name}}' is a class." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Finds and reports references that are non initializer and writable. - * @param {Variable} variable A variable to check. - * @returns {void} - */ - function checkVariable(variable) { - astUtils.getModifyingReferences(variable.references).forEach(reference => { - context.report({ node: reference.identifier, messageId: "class", data: { name: reference.identifier.name } }); - - }); - } - - /** - * Finds and reports references that are non initializer and writable. - * @param {ASTNode} node A ClassDeclaration/ClassExpression node to check. - * @returns {void} - */ - function checkForClass(node) { - sourceCode.getDeclaredVariables(node).forEach(checkVariable); - } - - return { - ClassDeclaration: checkForClass, - ClassExpression: checkForClass - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-compare-neg-zero.js b/node_modules/eslint/lib/rules/no-compare-neg-zero.js deleted file mode 100644 index 112f6c1d1..000000000 --- a/node_modules/eslint/lib/rules/no-compare-neg-zero.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @fileoverview The rule should warn against code that tries to compare against -0. - * @author Aladdin-ADD - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow comparing against -0", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-compare-neg-zero" - }, - - fixable: null, - schema: [], - - messages: { - unexpected: "Do not use the '{{operator}}' operator to compare against -0." - } - }, - - create(context) { - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Checks a given node is -0 - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is -0. - */ - function isNegZero(node) { - return node.type === "UnaryExpression" && node.operator === "-" && node.argument.type === "Literal" && node.argument.value === 0; - } - const OPERATORS_TO_CHECK = new Set([">", ">=", "<", "<=", "==", "===", "!=", "!=="]); - - return { - BinaryExpression(node) { - if (OPERATORS_TO_CHECK.has(node.operator)) { - if (isNegZero(node.left) || isNegZero(node.right)) { - context.report({ - node, - messageId: "unexpected", - data: { operator: node.operator } - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-cond-assign.js b/node_modules/eslint/lib/rules/no-cond-assign.js deleted file mode 100644 index 952920215..000000000 --- a/node_modules/eslint/lib/rules/no-cond-assign.js +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @fileoverview Rule to flag assignment in a conditional statement's test expression - * @author Stephen Murray - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const TEST_CONDITION_PARENT_TYPES = new Set(["IfStatement", "WhileStatement", "DoWhileStatement", "ForStatement", "ConditionalExpression"]); - -const NODE_DESCRIPTIONS = { - DoWhileStatement: "a 'do...while' statement", - ForStatement: "a 'for' statement", - IfStatement: "an 'if' statement", - WhileStatement: "a 'while' statement" -}; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow assignment operators in conditional expressions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-cond-assign" - }, - - schema: [ - { - enum: ["except-parens", "always"] - } - ], - - messages: { - unexpected: "Unexpected assignment within {{type}}.", - - // must match JSHint's error message - missing: "Expected a conditional expression and instead saw an assignment." - } - }, - - create(context) { - - const prohibitAssign = (context.options[0] || "except-parens"); - - const sourceCode = context.sourceCode; - - /** - * Check whether an AST node is the test expression for a conditional statement. - * @param {!Object} node The node to test. - * @returns {boolean} `true` if the node is the text expression for a conditional statement; otherwise, `false`. - */ - function isConditionalTestExpression(node) { - return node.parent && - TEST_CONDITION_PARENT_TYPES.has(node.parent.type) && - node === node.parent.test; - } - - /** - * Given an AST node, perform a bottom-up search for the first ancestor that represents a conditional statement. - * @param {!Object} node The node to use at the start of the search. - * @returns {?Object} The closest ancestor node that represents a conditional statement. - */ - function findConditionalAncestor(node) { - let currentAncestor = node; - - do { - if (isConditionalTestExpression(currentAncestor)) { - return currentAncestor.parent; - } - } while ((currentAncestor = currentAncestor.parent) && !astUtils.isFunction(currentAncestor)); - - return null; - } - - /** - * Check whether the code represented by an AST node is enclosed in two sets of parentheses. - * @param {!Object} node The node to test. - * @returns {boolean} `true` if the code is enclosed in two sets of parentheses; otherwise, `false`. - */ - function isParenthesisedTwice(node) { - const previousToken = sourceCode.getTokenBefore(node, 1), - nextToken = sourceCode.getTokenAfter(node, 1); - - return astUtils.isParenthesised(sourceCode, node) && - previousToken && astUtils.isOpeningParenToken(previousToken) && previousToken.range[1] <= node.range[0] && - astUtils.isClosingParenToken(nextToken) && nextToken.range[0] >= node.range[1]; - } - - /** - * Check a conditional statement's test expression for top-level assignments that are not enclosed in parentheses. - * @param {!Object} node The node for the conditional statement. - * @returns {void} - */ - function testForAssign(node) { - if (node.test && - (node.test.type === "AssignmentExpression") && - (node.type === "ForStatement" - ? !astUtils.isParenthesised(sourceCode, node.test) - : !isParenthesisedTwice(node.test) - ) - ) { - - context.report({ - node: node.test, - messageId: "missing" - }); - } - } - - /** - * Check whether an assignment expression is descended from a conditional statement's test expression. - * @param {!Object} node The node for the assignment expression. - * @returns {void} - */ - function testForConditionalAncestor(node) { - const ancestor = findConditionalAncestor(node); - - if (ancestor) { - context.report({ - node, - messageId: "unexpected", - data: { - type: NODE_DESCRIPTIONS[ancestor.type] || ancestor.type - } - }); - } - } - - if (prohibitAssign === "always") { - return { - AssignmentExpression: testForConditionalAncestor - }; - } - - return { - DoWhileStatement: testForAssign, - ForStatement: testForAssign, - IfStatement: testForAssign, - WhileStatement: testForAssign, - ConditionalExpression: testForAssign - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-confusing-arrow.js b/node_modules/eslint/lib/rules/no-confusing-arrow.js deleted file mode 100644 index de6e2f30c..000000000 --- a/node_modules/eslint/lib/rules/no-confusing-arrow.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @fileoverview A rule to warn against using arrow functions when they could be - * confused with comparisons - * @author Jxck - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils.js"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a node is a conditional expression. - * @param {ASTNode} node node to test - * @returns {boolean} `true` if the node is a conditional expression. - */ -function isConditional(node) { - return node && node.type === "ConditionalExpression"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow arrow functions where they could be confused with comparisons", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-confusing-arrow" - }, - - fixable: "code", - - schema: [{ - type: "object", - properties: { - allowParens: { type: "boolean", default: true }, - onlyOneSimpleParam: { type: "boolean", default: false } - }, - additionalProperties: false - }], - - messages: { - confusing: "Arrow function used ambiguously with a conditional expression." - } - }, - - create(context) { - const config = context.options[0] || {}; - const allowParens = config.allowParens || (config.allowParens === void 0); - const onlyOneSimpleParam = config.onlyOneSimpleParam; - const sourceCode = context.sourceCode; - - - /** - * Reports if an arrow function contains an ambiguous conditional. - * @param {ASTNode} node A node to check and report. - * @returns {void} - */ - function checkArrowFunc(node) { - const body = node.body; - - if (isConditional(body) && - !(allowParens && astUtils.isParenthesised(sourceCode, body)) && - !(onlyOneSimpleParam && !(node.params.length === 1 && node.params[0].type === "Identifier"))) { - context.report({ - node, - messageId: "confusing", - fix(fixer) { - - // if `allowParens` is not set to true don't bother wrapping in parens - return allowParens && fixer.replaceText(node.body, `(${sourceCode.getText(node.body)})`); - } - }); - } - } - - return { - ArrowFunctionExpression: checkArrowFunc - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-console.js b/node_modules/eslint/lib/rules/no-console.js deleted file mode 100644 index f257098d3..000000000 --- a/node_modules/eslint/lib/rules/no-console.js +++ /dev/null @@ -1,135 +0,0 @@ -/** - * @fileoverview Rule to flag use of console object - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the use of `console`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-console" - }, - - schema: [ - { - type: "object", - properties: { - allow: { - type: "array", - items: { - type: "string" - }, - minItems: 1, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "Unexpected console statement." - } - }, - - create(context) { - const options = context.options[0] || {}; - const allowed = options.allow || []; - const sourceCode = context.sourceCode; - - /** - * Checks whether the given reference is 'console' or not. - * @param {eslint-scope.Reference} reference The reference to check. - * @returns {boolean} `true` if the reference is 'console'. - */ - function isConsole(reference) { - const id = reference.identifier; - - return id && id.name === "console"; - } - - /** - * Checks whether the property name of the given MemberExpression node - * is allowed by options or not. - * @param {ASTNode} node The MemberExpression node to check. - * @returns {boolean} `true` if the property name of the node is allowed. - */ - function isAllowed(node) { - const propertyName = astUtils.getStaticPropertyName(node); - - return propertyName && allowed.includes(propertyName); - } - - /** - * Checks whether the given reference is a member access which is not - * allowed by options or not. - * @param {eslint-scope.Reference} reference The reference to check. - * @returns {boolean} `true` if the reference is a member access which - * is not allowed by options. - */ - function isMemberAccessExceptAllowed(reference) { - const node = reference.identifier; - const parent = node.parent; - - return ( - parent.type === "MemberExpression" && - parent.object === node && - !isAllowed(parent) - ); - } - - /** - * Reports the given reference as a violation. - * @param {eslint-scope.Reference} reference The reference to report. - * @returns {void} - */ - function report(reference) { - const node = reference.identifier.parent; - - context.report({ - node, - loc: node.loc, - messageId: "unexpected" - }); - } - - return { - "Program:exit"(node) { - const scope = sourceCode.getScope(node); - const consoleVar = astUtils.getVariableByName(scope, "console"); - const shadowed = consoleVar && consoleVar.defs.length > 0; - - /* - * 'scope.through' includes all references to undefined - * variables. If the variable 'console' is not defined, it uses - * 'scope.through'. - */ - const references = consoleVar - ? consoleVar.references - : scope.through.filter(isConsole); - - if (!shadowed) { - references - .filter(isMemberAccessExceptAllowed) - .forEach(report); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-const-assign.js b/node_modules/eslint/lib/rules/no-const-assign.js deleted file mode 100644 index 0ceaf7ea5..000000000 --- a/node_modules/eslint/lib/rules/no-const-assign.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @fileoverview A rule to disallow modifying variables that are declared using `const` - * @author Toru Nagashima - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow reassigning `const` variables", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-const-assign" - }, - - schema: [], - - messages: { - const: "'{{name}}' is constant." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Finds and reports references that are non initializer and writable. - * @param {Variable} variable A variable to check. - * @returns {void} - */ - function checkVariable(variable) { - astUtils.getModifyingReferences(variable.references).forEach(reference => { - context.report({ node: reference.identifier, messageId: "const", data: { name: reference.identifier.name } }); - }); - } - - return { - VariableDeclaration(node) { - if (node.kind === "const") { - sourceCode.getDeclaredVariables(node).forEach(checkVariable); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-constant-binary-expression.js b/node_modules/eslint/lib/rules/no-constant-binary-expression.js deleted file mode 100644 index 845255a0c..000000000 --- a/node_modules/eslint/lib/rules/no-constant-binary-expression.js +++ /dev/null @@ -1,509 +0,0 @@ -/** - * @fileoverview Rule to flag constant comparisons and logical expressions that always/never short circuit - * @author Jordan Eldredge - */ - -"use strict"; - -const globals = require("globals"); -const { isNullLiteral, isConstant, isReferenceToGlobalVariable, isLogicalAssignmentOperator } = require("./utils/ast-utils"); - -const NUMERIC_OR_STRING_BINARY_OPERATORS = new Set(["+", "-", "*", "/", "%", "|", "^", "&", "**", "<<", ">>", ">>>"]); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a node is `null` or `undefined`. Similar to the one - * found in ast-utils.js, but this one correctly handles the edge case that - * `undefined` has been redefined. - * @param {Scope} scope Scope in which the expression was found. - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is a `null` or `undefined`. - * @public - */ -function isNullOrUndefined(scope, node) { - return ( - isNullLiteral(node) || - (node.type === "Identifier" && node.name === "undefined" && isReferenceToGlobalVariable(scope, node)) || - (node.type === "UnaryExpression" && node.operator === "void") - ); -} - -/** - * Test if an AST node has a statically knowable constant nullishness. Meaning, - * it will always resolve to a constant value of either: `null`, `undefined` - * or not `null` _or_ `undefined`. An expression that can vary between those - * three states at runtime would return `false`. - * @param {Scope} scope The scope in which the node was found. - * @param {ASTNode} node The AST node being tested. - * @param {boolean} nonNullish if `true` then nullish values are not considered constant. - * @returns {boolean} Does `node` have constant nullishness? - */ -function hasConstantNullishness(scope, node, nonNullish) { - if (nonNullish && isNullOrUndefined(scope, node)) { - return false; - } - - switch (node.type) { - case "ObjectExpression": // Objects are never nullish - case "ArrayExpression": // Arrays are never nullish - case "ArrowFunctionExpression": // Functions never nullish - case "FunctionExpression": // Functions are never nullish - case "ClassExpression": // Classes are never nullish - case "NewExpression": // Objects are never nullish - case "Literal": // Nullish, or non-nullish, literals never change - case "TemplateLiteral": // A string is never nullish - case "UpdateExpression": // Numbers are never nullish - case "BinaryExpression": // Numbers, strings, or booleans are never nullish - return true; - case "CallExpression": { - if (node.callee.type !== "Identifier") { - return false; - } - const functionName = node.callee.name; - - return (functionName === "Boolean" || functionName === "String" || functionName === "Number") && - isReferenceToGlobalVariable(scope, node.callee); - } - case "LogicalExpression": { - return node.operator === "??" && hasConstantNullishness(scope, node.right, true); - } - case "AssignmentExpression": - if (node.operator === "=") { - return hasConstantNullishness(scope, node.right, nonNullish); - } - - /* - * Handling short-circuiting assignment operators would require - * walking the scope. We won't attempt that (for now...) / - */ - if (isLogicalAssignmentOperator(node.operator)) { - return false; - } - - /* - * The remaining assignment expressions all result in a numeric or - * string (non-nullish) value: - * "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "|=", "^=", "&=" - */ - - return true; - case "UnaryExpression": - - /* - * "void" Always returns `undefined` - * "typeof" All types are strings, and thus non-nullish - * "!" Boolean is never nullish - * "delete" Returns a boolean, which is never nullish - * Math operators always return numbers or strings, neither of which - * are non-nullish "+", "-", "~" - */ - - return true; - case "SequenceExpression": { - const last = node.expressions[node.expressions.length - 1]; - - return hasConstantNullishness(scope, last, nonNullish); - } - case "Identifier": - return node.name === "undefined" && isReferenceToGlobalVariable(scope, node); - case "JSXElement": // ESLint has a policy of not assuming any specific JSX behavior. - case "JSXFragment": - return false; - default: - return false; - } -} - -/** - * Test if an AST node is a boolean value that never changes. Specifically we - * test for: - * 1. Literal booleans (`true` or `false`) - * 2. Unary `!` expressions with a constant value - * 3. Constant booleans created via the `Boolean` global function - * @param {Scope} scope The scope in which the node was found. - * @param {ASTNode} node The node to test - * @returns {boolean} Is `node` guaranteed to be a boolean? - */ -function isStaticBoolean(scope, node) { - switch (node.type) { - case "Literal": - return typeof node.value === "boolean"; - case "CallExpression": - return node.callee.type === "Identifier" && node.callee.name === "Boolean" && - isReferenceToGlobalVariable(scope, node.callee) && - (node.arguments.length === 0 || isConstant(scope, node.arguments[0], true)); - case "UnaryExpression": - return node.operator === "!" && isConstant(scope, node.argument, true); - default: - return false; - } -} - - -/** - * Test if an AST node will always give the same result when compared to a - * boolean value. Note that comparison to boolean values is different than - * truthiness. - * https://262.ecma-international.org/5.1/#sec-11.9.3 - * - * Javascript `==` operator works by converting the boolean to `1` (true) or - * `+0` (false) and then checks the values `==` equality to that number. - * @param {Scope} scope The scope in which node was found. - * @param {ASTNode} node The node to test. - * @returns {boolean} Will `node` always coerce to the same boolean value? - */ -function hasConstantLooseBooleanComparison(scope, node) { - switch (node.type) { - case "ObjectExpression": - case "ClassExpression": - - /** - * In theory objects like: - * - * `{toString: () => a}` - * `{valueOf: () => a}` - * - * Or a classes like: - * - * `class { static toString() { return a } }` - * `class { static valueOf() { return a } }` - * - * Are not constant verifiably when `inBooleanPosition` is - * false, but it's an edge case we've opted not to handle. - */ - return true; - case "ArrayExpression": { - const nonSpreadElements = node.elements.filter(e => - - // Elements can be `null` in sparse arrays: `[,,]`; - e !== null && e.type !== "SpreadElement"); - - - /* - * Possible future direction if needed: We could check if the - * single value would result in variable boolean comparison. - * For now we will err on the side of caution since `[x]` could - * evaluate to `[0]` or `[1]`. - */ - return node.elements.length === 0 || nonSpreadElements.length > 1; - } - case "ArrowFunctionExpression": - case "FunctionExpression": - return true; - case "UnaryExpression": - if (node.operator === "void" || // Always returns `undefined` - node.operator === "typeof" // All `typeof` strings, when coerced to number, are not 0 or 1. - ) { - return true; - } - if (node.operator === "!") { - return isConstant(scope, node.argument, true); - } - - /* - * We won't try to reason about +, -, ~, or delete - * In theory, for the mathematical operators, we could look at the - * argument and try to determine if it coerces to a constant numeric - * value. - */ - return false; - case "NewExpression": // Objects might have custom `.valueOf` or `.toString`. - return false; - case "CallExpression": { - if (node.callee.type === "Identifier" && - node.callee.name === "Boolean" && - isReferenceToGlobalVariable(scope, node.callee) - ) { - return node.arguments.length === 0 || isConstant(scope, node.arguments[0], true); - } - return false; - } - case "Literal": // True or false, literals never change - return true; - case "Identifier": - return node.name === "undefined" && isReferenceToGlobalVariable(scope, node); - case "TemplateLiteral": - - /* - * In theory we could try to check if the quasi are sufficient to - * prove that the expression will always be true, but it would be - * tricky to get right. For example: `000.${foo}000` - */ - return node.expressions.length === 0; - case "AssignmentExpression": - if (node.operator === "=") { - return hasConstantLooseBooleanComparison(scope, node.right); - } - - /* - * Handling short-circuiting assignment operators would require - * walking the scope. We won't attempt that (for now...) - * - * The remaining assignment expressions all result in a numeric or - * string (non-nullish) values which could be truthy or falsy: - * "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "|=", "^=", "&=" - */ - return false; - case "SequenceExpression": { - const last = node.expressions[node.expressions.length - 1]; - - return hasConstantLooseBooleanComparison(scope, last); - } - case "JSXElement": // ESLint has a policy of not assuming any specific JSX behavior. - case "JSXFragment": - return false; - default: - return false; - } -} - - -/** - * Test if an AST node will always give the same result when _strictly_ compared - * to a boolean value. This can happen if the expression can never be boolean, or - * if it is always the same boolean value. - * @param {Scope} scope The scope in which the node was found. - * @param {ASTNode} node The node to test - * @returns {boolean} Will `node` always give the same result when compared to a - * static boolean value? - */ -function hasConstantStrictBooleanComparison(scope, node) { - switch (node.type) { - case "ObjectExpression": // Objects are not booleans - case "ArrayExpression": // Arrays are not booleans - case "ArrowFunctionExpression": // Functions are not booleans - case "FunctionExpression": - case "ClassExpression": // Classes are not booleans - case "NewExpression": // Objects are not booleans - case "TemplateLiteral": // Strings are not booleans - case "Literal": // True, false, or not boolean, literals never change. - case "UpdateExpression": // Numbers are not booleans - return true; - case "BinaryExpression": - return NUMERIC_OR_STRING_BINARY_OPERATORS.has(node.operator); - case "UnaryExpression": { - if (node.operator === "delete") { - return false; - } - if (node.operator === "!") { - return isConstant(scope, node.argument, true); - } - - /* - * The remaining operators return either strings or numbers, neither - * of which are boolean. - */ - return true; - } - case "SequenceExpression": { - const last = node.expressions[node.expressions.length - 1]; - - return hasConstantStrictBooleanComparison(scope, last); - } - case "Identifier": - return node.name === "undefined" && isReferenceToGlobalVariable(scope, node); - case "AssignmentExpression": - if (node.operator === "=") { - return hasConstantStrictBooleanComparison(scope, node.right); - } - - /* - * Handling short-circuiting assignment operators would require - * walking the scope. We won't attempt that (for now...) - */ - if (isLogicalAssignmentOperator(node.operator)) { - return false; - } - - /* - * The remaining assignment expressions all result in either a number - * or a string, neither of which can ever be boolean. - */ - return true; - case "CallExpression": { - if (node.callee.type !== "Identifier") { - return false; - } - const functionName = node.callee.name; - - if ( - (functionName === "String" || functionName === "Number") && - isReferenceToGlobalVariable(scope, node.callee) - ) { - return true; - } - if (functionName === "Boolean" && isReferenceToGlobalVariable(scope, node.callee)) { - return ( - node.arguments.length === 0 || isConstant(scope, node.arguments[0], true)); - } - return false; - } - case "JSXElement": // ESLint has a policy of not assuming any specific JSX behavior. - case "JSXFragment": - return false; - default: - return false; - } -} - -/** - * Test if an AST node will always result in a newly constructed object - * @param {Scope} scope The scope in which the node was found. - * @param {ASTNode} node The node to test - * @returns {boolean} Will `node` always be new? - */ -function isAlwaysNew(scope, node) { - switch (node.type) { - case "ObjectExpression": - case "ArrayExpression": - case "ArrowFunctionExpression": - case "FunctionExpression": - case "ClassExpression": - return true; - case "NewExpression": { - if (node.callee.type !== "Identifier") { - return false; - } - - /* - * All the built-in constructors are always new, but - * user-defined constructors could return a sentinel - * object. - * - * Catching these is especially useful for primitive constructors - * which return boxed values, a surprising gotcha' in JavaScript. - */ - return Object.hasOwnProperty.call(globals.builtin, node.callee.name) && - isReferenceToGlobalVariable(scope, node.callee); - } - case "Literal": - - // Regular expressions are objects, and thus always new - return typeof node.regex === "object"; - case "SequenceExpression": { - const last = node.expressions[node.expressions.length - 1]; - - return isAlwaysNew(scope, last); - } - case "AssignmentExpression": - if (node.operator === "=") { - return isAlwaysNew(scope, node.right); - } - return false; - case "ConditionalExpression": - return isAlwaysNew(scope, node.consequent) && isAlwaysNew(scope, node.alternate); - case "JSXElement": // ESLint has a policy of not assuming any specific JSX behavior. - case "JSXFragment": - return false; - default: - return false; - } -} - -/** - * Checks if one operand will cause the result to be constant. - * @param {Scope} scope Scope in which the expression was found. - * @param {ASTNode} a One side of the expression - * @param {ASTNode} b The other side of the expression - * @param {string} operator The binary expression operator - * @returns {ASTNode | null} The node which will cause the expression to have a constant result. - */ -function findBinaryExpressionConstantOperand(scope, a, b, operator) { - if (operator === "==" || operator === "!=") { - if ( - (isNullOrUndefined(scope, a) && hasConstantNullishness(scope, b, false)) || - (isStaticBoolean(scope, a) && hasConstantLooseBooleanComparison(scope, b)) - ) { - return b; - } - } else if (operator === "===" || operator === "!==") { - if ( - (isNullOrUndefined(scope, a) && hasConstantNullishness(scope, b, false)) || - (isStaticBoolean(scope, a) && hasConstantStrictBooleanComparison(scope, b)) - ) { - return b; - } - } - return null; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - docs: { - description: "Disallow expressions where the operation doesn't affect the value", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-constant-binary-expression" - }, - schema: [], - messages: { - constantBinaryOperand: "Unexpected constant binary expression. Compares constantly with the {{otherSide}}-hand side of the `{{operator}}`.", - constantShortCircuit: "Unexpected constant {{property}} on the left-hand side of a `{{operator}}` expression.", - alwaysNew: "Unexpected comparison to newly constructed object. These two values can never be equal.", - bothAlwaysNew: "Unexpected comparison of two newly constructed objects. These two values can never be equal." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - LogicalExpression(node) { - const { operator, left } = node; - const scope = sourceCode.getScope(node); - - if ((operator === "&&" || operator === "||") && isConstant(scope, left, true)) { - context.report({ node: left, messageId: "constantShortCircuit", data: { property: "truthiness", operator } }); - } else if (operator === "??" && hasConstantNullishness(scope, left, false)) { - context.report({ node: left, messageId: "constantShortCircuit", data: { property: "nullishness", operator } }); - } - }, - BinaryExpression(node) { - const scope = sourceCode.getScope(node); - const { right, left, operator } = node; - const rightConstantOperand = findBinaryExpressionConstantOperand(scope, left, right, operator); - const leftConstantOperand = findBinaryExpressionConstantOperand(scope, right, left, operator); - - if (rightConstantOperand) { - context.report({ node: rightConstantOperand, messageId: "constantBinaryOperand", data: { operator, otherSide: "left" } }); - } else if (leftConstantOperand) { - context.report({ node: leftConstantOperand, messageId: "constantBinaryOperand", data: { operator, otherSide: "right" } }); - } else if (operator === "===" || operator === "!==") { - if (isAlwaysNew(scope, left)) { - context.report({ node: left, messageId: "alwaysNew" }); - } else if (isAlwaysNew(scope, right)) { - context.report({ node: right, messageId: "alwaysNew" }); - } - } else if (operator === "==" || operator === "!=") { - - /* - * If both sides are "new", then both sides are objects and - * therefore they will be compared by reference even with `==` - * equality. - */ - if (isAlwaysNew(scope, left) && isAlwaysNew(scope, right)) { - context.report({ node: left, messageId: "bothAlwaysNew" }); - } - } - - } - - /* - * In theory we could handle short-circuiting assignment operators, - * for some constant values, but that would require walking the - * scope to find the value of the variable being assigned. This is - * dependant on https://github.com/eslint/eslint/issues/13776 - * - * AssignmentExpression() {}, - */ - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-constant-condition.js b/node_modules/eslint/lib/rules/no-constant-condition.js deleted file mode 100644 index 24abe3632..000000000 --- a/node_modules/eslint/lib/rules/no-constant-condition.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * @fileoverview Rule to flag use constant conditions - * @author Christian Schulz - */ - -"use strict"; - -const { isConstant } = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow constant expressions in conditions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-constant-condition" - }, - - schema: [ - { - type: "object", - properties: { - checkLoops: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "Unexpected constant condition." - } - }, - - create(context) { - const options = context.options[0] || {}, - checkLoops = options.checkLoops !== false, - loopSetStack = []; - const sourceCode = context.sourceCode; - - let loopsInCurrentScope = new Set(); - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Tracks when the given node contains a constant condition. - * @param {ASTNode} node The AST node to check. - * @returns {void} - * @private - */ - function trackConstantConditionLoop(node) { - if (node.test && isConstant(sourceCode.getScope(node), node.test, true)) { - loopsInCurrentScope.add(node); - } - } - - /** - * Reports when the set contains the given constant condition node - * @param {ASTNode} node The AST node to check. - * @returns {void} - * @private - */ - function checkConstantConditionLoopInSet(node) { - if (loopsInCurrentScope.has(node)) { - loopsInCurrentScope.delete(node); - context.report({ node: node.test, messageId: "unexpected" }); - } - } - - /** - * Reports when the given node contains a constant condition. - * @param {ASTNode} node The AST node to check. - * @returns {void} - * @private - */ - function reportIfConstant(node) { - if (node.test && isConstant(sourceCode.getScope(node), node.test, true)) { - context.report({ node: node.test, messageId: "unexpected" }); - } - } - - /** - * Stores current set of constant loops in loopSetStack temporarily - * and uses a new set to track constant loops - * @returns {void} - * @private - */ - function enterFunction() { - loopSetStack.push(loopsInCurrentScope); - loopsInCurrentScope = new Set(); - } - - /** - * Reports when the set still contains stored constant conditions - * @returns {void} - * @private - */ - function exitFunction() { - loopsInCurrentScope = loopSetStack.pop(); - } - - /** - * Checks node when checkLoops option is enabled - * @param {ASTNode} node The AST node to check. - * @returns {void} - * @private - */ - function checkLoop(node) { - if (checkLoops) { - trackConstantConditionLoop(node); - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - ConditionalExpression: reportIfConstant, - IfStatement: reportIfConstant, - WhileStatement: checkLoop, - "WhileStatement:exit": checkConstantConditionLoopInSet, - DoWhileStatement: checkLoop, - "DoWhileStatement:exit": checkConstantConditionLoopInSet, - ForStatement: checkLoop, - "ForStatement > .test": node => checkLoop(node.parent), - "ForStatement:exit": checkConstantConditionLoopInSet, - FunctionDeclaration: enterFunction, - "FunctionDeclaration:exit": exitFunction, - FunctionExpression: enterFunction, - "FunctionExpression:exit": exitFunction, - YieldExpression: () => loopsInCurrentScope.clear() - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-constructor-return.js b/node_modules/eslint/lib/rules/no-constructor-return.js deleted file mode 100644 index d7d98939b..000000000 --- a/node_modules/eslint/lib/rules/no-constructor-return.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @fileoverview Rule to disallow returning value from constructor. - * @author Pig Fang - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow returning value from constructor", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-constructor-return" - }, - - schema: {}, - - fixable: null, - - messages: { - unexpected: "Unexpected return statement in constructor." - } - }, - - create(context) { - const stack = []; - - return { - onCodePathStart(_, node) { - stack.push(node); - }, - onCodePathEnd() { - stack.pop(); - }, - ReturnStatement(node) { - const last = stack[stack.length - 1]; - - if (!last.parent) { - return; - } - - if ( - last.parent.type === "MethodDefinition" && - last.parent.kind === "constructor" && - (node.parent.parent === last || node.argument) - ) { - context.report({ - node, - messageId: "unexpected" - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-continue.js b/node_modules/eslint/lib/rules/no-continue.js deleted file mode 100644 index f6e484b2f..000000000 --- a/node_modules/eslint/lib/rules/no-continue.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @fileoverview Rule to flag use of continue statement - * @author Borislav Zhivkov - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `continue` statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-continue" - }, - - schema: [], - - messages: { - unexpected: "Unexpected use of continue statement." - } - }, - - create(context) { - - return { - ContinueStatement(node) { - context.report({ node, messageId: "unexpected" }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-control-regex.js b/node_modules/eslint/lib/rules/no-control-regex.js deleted file mode 100644 index 086747f37..000000000 --- a/node_modules/eslint/lib/rules/no-control-regex.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * @fileoverview Rule to forbid control characters from regular expressions. - * @author Nicholas C. Zakas - */ - -"use strict"; - -const RegExpValidator = require("@eslint-community/regexpp").RegExpValidator; -const collector = new (class { - constructor() { - this._source = ""; - this._controlChars = []; - this._validator = new RegExpValidator(this); - } - - onPatternEnter() { - this._controlChars = []; - } - - onCharacter(start, end, cp) { - if (cp >= 0x00 && - cp <= 0x1F && - ( - this._source.codePointAt(start) === cp || - this._source.slice(start, end).startsWith("\\x") || - this._source.slice(start, end).startsWith("\\u") - ) - ) { - this._controlChars.push(`\\x${`0${cp.toString(16)}`.slice(-2)}`); - } - } - - collectControlChars(regexpStr, flags) { - const uFlag = typeof flags === "string" && flags.includes("u"); - - try { - this._source = regexpStr; - this._validator.validatePattern(regexpStr, void 0, void 0, uFlag); // Call onCharacter hook - } catch { - - // Ignore syntax errors in RegExp. - } - return this._controlChars; - } -})(); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow control characters in regular expressions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-control-regex" - }, - - schema: [], - - messages: { - unexpected: "Unexpected control character(s) in regular expression: {{controlChars}}." - } - }, - - create(context) { - - /** - * Get the regex expression - * @param {ASTNode} node `Literal` node to evaluate - * @returns {{ pattern: string, flags: string | null } | null} Regex if found (the given node is either a regex literal - * or a string literal that is the pattern argument of a RegExp constructor call). Otherwise `null`. If flags cannot be determined, - * the `flags` property will be `null`. - * @private - */ - function getRegExp(node) { - if (node.regex) { - return node.regex; - } - if (typeof node.value === "string" && - (node.parent.type === "NewExpression" || node.parent.type === "CallExpression") && - node.parent.callee.type === "Identifier" && - node.parent.callee.name === "RegExp" && - node.parent.arguments[0] === node - ) { - const pattern = node.value; - const flags = - node.parent.arguments.length > 1 && - node.parent.arguments[1].type === "Literal" && - typeof node.parent.arguments[1].value === "string" - ? node.parent.arguments[1].value - : null; - - return { pattern, flags }; - } - - return null; - } - - return { - Literal(node) { - const regExp = getRegExp(node); - - if (regExp) { - const { pattern, flags } = regExp; - const controlCharacters = collector.collectControlChars(pattern, flags); - - if (controlCharacters.length > 0) { - context.report({ - node, - messageId: "unexpected", - data: { - controlChars: controlCharacters.join(", ") - } - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-debugger.js b/node_modules/eslint/lib/rules/no-debugger.js deleted file mode 100644 index f69843515..000000000 --- a/node_modules/eslint/lib/rules/no-debugger.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @fileoverview Rule to flag use of a debugger statement - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow the use of `debugger`", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-debugger" - }, - - fixable: null, - schema: [], - - messages: { - unexpected: "Unexpected 'debugger' statement." - } - }, - - create(context) { - - return { - DebuggerStatement(node) { - context.report({ - node, - messageId: "unexpected" - }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-delete-var.js b/node_modules/eslint/lib/rules/no-delete-var.js deleted file mode 100644 index 126603c83..000000000 --- a/node_modules/eslint/lib/rules/no-delete-var.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @fileoverview Rule to flag when deleting variables - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow deleting variables", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-delete-var" - }, - - schema: [], - - messages: { - unexpected: "Variables should not be deleted." - } - }, - - create(context) { - - return { - - UnaryExpression(node) { - if (node.operator === "delete" && node.argument.type === "Identifier") { - context.report({ node, messageId: "unexpected" }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-div-regex.js b/node_modules/eslint/lib/rules/no-div-regex.js deleted file mode 100644 index 208f840be..000000000 --- a/node_modules/eslint/lib/rules/no-div-regex.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @fileoverview Rule to check for ambiguous div operator in regexes - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow equal signs explicitly at the beginning of regular expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-div-regex" - }, - - fixable: "code", - - schema: [], - - messages: { - unexpected: "A regular expression literal can be confused with '/='." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - - Literal(node) { - const token = sourceCode.getFirstToken(node); - - if (token.type === "RegularExpression" && token.value[1] === "=") { - context.report({ - node, - messageId: "unexpected", - fix(fixer) { - return fixer.replaceTextRange([token.range[0] + 1, token.range[0] + 2], "[=]"); - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-dupe-args.js b/node_modules/eslint/lib/rules/no-dupe-args.js deleted file mode 100644 index c04ede5af..000000000 --- a/node_modules/eslint/lib/rules/no-dupe-args.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @fileoverview Rule to flag duplicate arguments - * @author Jamund Ferguson - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow duplicate arguments in `function` definitions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-dupe-args" - }, - - schema: [], - - messages: { - unexpected: "Duplicate param '{{name}}'." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Checks whether or not a given definition is a parameter's. - * @param {eslint-scope.DefEntry} def A definition to check. - * @returns {boolean} `true` if the definition is a parameter's. - */ - function isParameter(def) { - return def.type === "Parameter"; - } - - /** - * Determines if a given node has duplicate parameters. - * @param {ASTNode} node The node to check. - * @returns {void} - * @private - */ - function checkParams(node) { - const variables = sourceCode.getDeclaredVariables(node); - - for (let i = 0; i < variables.length; ++i) { - const variable = variables[i]; - - // Checks and reports duplications. - const defs = variable.defs.filter(isParameter); - - if (defs.length >= 2) { - context.report({ - node, - messageId: "unexpected", - data: { name: variable.name } - }); - } - } - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - FunctionDeclaration: checkParams, - FunctionExpression: checkParams - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-dupe-class-members.js b/node_modules/eslint/lib/rules/no-dupe-class-members.js deleted file mode 100644 index 2a7a9e810..000000000 --- a/node_modules/eslint/lib/rules/no-dupe-class-members.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @fileoverview A rule to disallow duplicate name in class members. - * @author Toru Nagashima - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow duplicate class members", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-dupe-class-members" - }, - - schema: [], - - messages: { - unexpected: "Duplicate name '{{name}}'." - } - }, - - create(context) { - let stack = []; - - /** - * Gets state of a given member name. - * @param {string} name A name of a member. - * @param {boolean} isStatic A flag which specifies that is a static member. - * @returns {Object} A state of a given member name. - * - retv.init {boolean} A flag which shows the name is declared as normal member. - * - retv.get {boolean} A flag which shows the name is declared as getter. - * - retv.set {boolean} A flag which shows the name is declared as setter. - */ - function getState(name, isStatic) { - const stateMap = stack[stack.length - 1]; - const key = `$${name}`; // to avoid "__proto__". - - if (!stateMap[key]) { - stateMap[key] = { - nonStatic: { init: false, get: false, set: false }, - static: { init: false, get: false, set: false } - }; - } - - return stateMap[key][isStatic ? "static" : "nonStatic"]; - } - - return { - - // Initializes the stack of state of member declarations. - Program() { - stack = []; - }, - - // Initializes state of member declarations for the class. - ClassBody() { - stack.push(Object.create(null)); - }, - - // Disposes the state for the class. - "ClassBody:exit"() { - stack.pop(); - }, - - // Reports the node if its name has been declared already. - "MethodDefinition, PropertyDefinition"(node) { - const name = astUtils.getStaticPropertyName(node); - const kind = node.type === "MethodDefinition" ? node.kind : "field"; - - if (name === null || kind === "constructor") { - return; - } - - const state = getState(name, node.static); - let isDuplicate = false; - - if (kind === "get") { - isDuplicate = (state.init || state.get); - state.get = true; - } else if (kind === "set") { - isDuplicate = (state.init || state.set); - state.set = true; - } else { - isDuplicate = (state.init || state.get || state.set); - state.init = true; - } - - if (isDuplicate) { - context.report({ node, messageId: "unexpected", data: { name } }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-dupe-else-if.js b/node_modules/eslint/lib/rules/no-dupe-else-if.js deleted file mode 100644 index 60f436d1d..000000000 --- a/node_modules/eslint/lib/rules/no-dupe-else-if.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @fileoverview Rule to disallow duplicate conditions in if-else-if chains - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines whether the first given array is a subset of the second given array. - * @param {Function} comparator A function to compare two elements, should return `true` if they are equal. - * @param {Array} arrA The array to compare from. - * @param {Array} arrB The array to compare against. - * @returns {boolean} `true` if the array `arrA` is a subset of the array `arrB`. - */ -function isSubsetByComparator(comparator, arrA, arrB) { - return arrA.every(a => arrB.some(b => comparator(a, b))); -} - -/** - * Splits the given node by the given logical operator. - * @param {string} operator Logical operator `||` or `&&`. - * @param {ASTNode} node The node to split. - * @returns {ASTNode[]} Array of conditions that makes the node when joined by the operator. - */ -function splitByLogicalOperator(operator, node) { - if (node.type === "LogicalExpression" && node.operator === operator) { - return [...splitByLogicalOperator(operator, node.left), ...splitByLogicalOperator(operator, node.right)]; - } - return [node]; -} - -const splitByOr = splitByLogicalOperator.bind(null, "||"); -const splitByAnd = splitByLogicalOperator.bind(null, "&&"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow duplicate conditions in if-else-if chains", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-dupe-else-if" - }, - - schema: [], - - messages: { - unexpected: "This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Determines whether the two given nodes are considered to be equal. In particular, given that the nodes - * represent expressions in a boolean context, `||` and `&&` can be considered as commutative operators. - * @param {ASTNode} a First node. - * @param {ASTNode} b Second node. - * @returns {boolean} `true` if the nodes are considered to be equal. - */ - function equal(a, b) { - if (a.type !== b.type) { - return false; - } - - if ( - a.type === "LogicalExpression" && - (a.operator === "||" || a.operator === "&&") && - a.operator === b.operator - ) { - return equal(a.left, b.left) && equal(a.right, b.right) || - equal(a.left, b.right) && equal(a.right, b.left); - } - - return astUtils.equalTokens(a, b, sourceCode); - } - - const isSubset = isSubsetByComparator.bind(null, equal); - - return { - IfStatement(node) { - const test = node.test, - conditionsToCheck = test.type === "LogicalExpression" && test.operator === "&&" - ? [test, ...splitByAnd(test)] - : [test]; - let current = node, - listToCheck = conditionsToCheck.map(c => splitByOr(c).map(splitByAnd)); - - while (current.parent && current.parent.type === "IfStatement" && current.parent.alternate === current) { - current = current.parent; - - const currentOrOperands = splitByOr(current.test).map(splitByAnd); - - listToCheck = listToCheck.map(orOperands => orOperands.filter( - orOperand => !currentOrOperands.some(currentOrOperand => isSubset(currentOrOperand, orOperand)) - )); - - if (listToCheck.some(orOperands => orOperands.length === 0)) { - context.report({ node: test, messageId: "unexpected" }); - break; - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-dupe-keys.js b/node_modules/eslint/lib/rules/no-dupe-keys.js deleted file mode 100644 index 980b0044a..000000000 --- a/node_modules/eslint/lib/rules/no-dupe-keys.js +++ /dev/null @@ -1,142 +0,0 @@ -/** - * @fileoverview Rule to flag use of duplicate keys in an object. - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const GET_KIND = /^(?:init|get)$/u; -const SET_KIND = /^(?:init|set)$/u; - -/** - * The class which stores properties' information of an object. - */ -class ObjectInfo { - - /** - * @param {ObjectInfo|null} upper The information of the outer object. - * @param {ASTNode} node The ObjectExpression node of this information. - */ - constructor(upper, node) { - this.upper = upper; - this.node = node; - this.properties = new Map(); - } - - /** - * Gets the information of the given Property node. - * @param {ASTNode} node The Property node to get. - * @returns {{get: boolean, set: boolean}} The information of the property. - */ - getPropertyInfo(node) { - const name = astUtils.getStaticPropertyName(node); - - if (!this.properties.has(name)) { - this.properties.set(name, { get: false, set: false }); - } - return this.properties.get(name); - } - - /** - * Checks whether the given property has been defined already or not. - * @param {ASTNode} node The Property node to check. - * @returns {boolean} `true` if the property has been defined. - */ - isPropertyDefined(node) { - const entry = this.getPropertyInfo(node); - - return ( - (GET_KIND.test(node.kind) && entry.get) || - (SET_KIND.test(node.kind) && entry.set) - ); - } - - /** - * Defines the given property. - * @param {ASTNode} node The Property node to define. - * @returns {void} - */ - defineProperty(node) { - const entry = this.getPropertyInfo(node); - - if (GET_KIND.test(node.kind)) { - entry.get = true; - } - if (SET_KIND.test(node.kind)) { - entry.set = true; - } - } -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow duplicate keys in object literals", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-dupe-keys" - }, - - schema: [], - - messages: { - unexpected: "Duplicate key '{{name}}'." - } - }, - - create(context) { - let info = null; - - return { - ObjectExpression(node) { - info = new ObjectInfo(info, node); - }, - "ObjectExpression:exit"() { - info = info.upper; - }, - - Property(node) { - const name = astUtils.getStaticPropertyName(node); - - // Skip destructuring. - if (node.parent.type !== "ObjectExpression") { - return; - } - - // Skip if the name is not static. - if (name === null) { - return; - } - - // Reports if the name is defined already. - if (info.isPropertyDefined(node)) { - context.report({ - node: info.node, - loc: node.key.loc, - messageId: "unexpected", - data: { name } - }); - } - - // Update info. - info.defineProperty(node); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-duplicate-case.js b/node_modules/eslint/lib/rules/no-duplicate-case.js deleted file mode 100644 index 839f357e7..000000000 --- a/node_modules/eslint/lib/rules/no-duplicate-case.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @fileoverview Rule to disallow a duplicate case label. - * @author Dieter Oberkofler - * @author Burak Yigit Kaya - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow duplicate case labels", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-duplicate-case" - }, - - schema: [], - - messages: { - unexpected: "Duplicate case label." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Determines whether the two given nodes are considered to be equal. - * @param {ASTNode} a First node. - * @param {ASTNode} b Second node. - * @returns {boolean} `true` if the nodes are considered to be equal. - */ - function equal(a, b) { - if (a.type !== b.type) { - return false; - } - - return astUtils.equalTokens(a, b, sourceCode); - } - return { - SwitchStatement(node) { - const previousTests = []; - - for (const switchCase of node.cases) { - if (switchCase.test) { - const test = switchCase.test; - - if (previousTests.some(previousTest => equal(previousTest, test))) { - context.report({ node: switchCase, messageId: "unexpected" }); - } else { - previousTests.push(test); - } - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-duplicate-imports.js b/node_modules/eslint/lib/rules/no-duplicate-imports.js deleted file mode 100644 index 25c07b750..000000000 --- a/node_modules/eslint/lib/rules/no-duplicate-imports.js +++ /dev/null @@ -1,290 +0,0 @@ -/** - * @fileoverview Restrict usage of duplicate imports. - * @author Simen Bekkhus - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const NAMED_TYPES = ["ImportSpecifier", "ExportSpecifier"]; -const NAMESPACE_TYPES = [ - "ImportNamespaceSpecifier", - "ExportNamespaceSpecifier" -]; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** - * Check if an import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier). - * @param {string} importExportType An import/export type to check. - * @param {string} type Can be "named" or "namespace" - * @returns {boolean} True if import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier) and false if it doesn't. - */ -function isImportExportSpecifier(importExportType, type) { - const arrayToCheck = type === "named" ? NAMED_TYPES : NAMESPACE_TYPES; - - return arrayToCheck.includes(importExportType); -} - -/** - * Return the type of (import|export). - * @param {ASTNode} node A node to get. - * @returns {string} The type of the (import|export). - */ -function getImportExportType(node) { - if (node.specifiers && node.specifiers.length > 0) { - const nodeSpecifiers = node.specifiers; - const index = nodeSpecifiers.findIndex( - ({ type }) => - isImportExportSpecifier(type, "named") || - isImportExportSpecifier(type, "namespace") - ); - const i = index > -1 ? index : 0; - - return nodeSpecifiers[i].type; - } - if (node.type === "ExportAllDeclaration") { - if (node.exported) { - return "ExportNamespaceSpecifier"; - } - return "ExportAll"; - } - return "SideEffectImport"; -} - -/** - * Returns a boolean indicates if two (import|export) can be merged - * @param {ASTNode} node1 A node to check. - * @param {ASTNode} node2 A node to check. - * @returns {boolean} True if two (import|export) can be merged, false if they can't. - */ -function isImportExportCanBeMerged(node1, node2) { - const importExportType1 = getImportExportType(node1); - const importExportType2 = getImportExportType(node2); - - if ( - (importExportType1 === "ExportAll" && - importExportType2 !== "ExportAll" && - importExportType2 !== "SideEffectImport") || - (importExportType1 !== "ExportAll" && - importExportType1 !== "SideEffectImport" && - importExportType2 === "ExportAll") - ) { - return false; - } - if ( - (isImportExportSpecifier(importExportType1, "namespace") && - isImportExportSpecifier(importExportType2, "named")) || - (isImportExportSpecifier(importExportType2, "namespace") && - isImportExportSpecifier(importExportType1, "named")) - ) { - return false; - } - return true; -} - -/** - * Returns a boolean if we should report (import|export). - * @param {ASTNode} node A node to be reported or not. - * @param {[ASTNode]} previousNodes An array contains previous nodes of the module imported or exported. - * @returns {boolean} True if the (import|export) should be reported. - */ -function shouldReportImportExport(node, previousNodes) { - let i = 0; - - while (i < previousNodes.length) { - if (isImportExportCanBeMerged(node, previousNodes[i])) { - return true; - } - i++; - } - return false; -} - -/** - * Returns array contains only nodes with declarations types equal to type. - * @param {[{node: ASTNode, declarationType: string}]} nodes An array contains objects, each object contains a node and a declaration type. - * @param {string} type Declaration type. - * @returns {[ASTNode]} An array contains only nodes with declarations types equal to type. - */ -function getNodesByDeclarationType(nodes, type) { - return nodes - .filter(({ declarationType }) => declarationType === type) - .map(({ node }) => node); -} - -/** - * Returns the name of the module imported or re-exported. - * @param {ASTNode} node A node to get. - * @returns {string} The name of the module, or empty string if no name. - */ -function getModule(node) { - if (node && node.source && node.source.value) { - return node.source.value.trim(); - } - return ""; -} - -/** - * Checks if the (import|export) can be merged with at least one import or one export, and reports if so. - * @param {RuleContext} context The ESLint rule context object. - * @param {ASTNode} node A node to get. - * @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type. - * @param {string} declarationType A declaration type can be an import or export. - * @param {boolean} includeExports Whether or not to check for exports in addition to imports. - * @returns {void} No return value. - */ -function checkAndReport( - context, - node, - modules, - declarationType, - includeExports -) { - const module = getModule(node); - - if (modules.has(module)) { - const previousNodes = modules.get(module); - const messagesIds = []; - const importNodes = getNodesByDeclarationType(previousNodes, "import"); - let exportNodes; - - if (includeExports) { - exportNodes = getNodesByDeclarationType(previousNodes, "export"); - } - if (declarationType === "import") { - if (shouldReportImportExport(node, importNodes)) { - messagesIds.push("import"); - } - if (includeExports) { - if (shouldReportImportExport(node, exportNodes)) { - messagesIds.push("importAs"); - } - } - } else if (declarationType === "export") { - if (shouldReportImportExport(node, exportNodes)) { - messagesIds.push("export"); - } - if (shouldReportImportExport(node, importNodes)) { - messagesIds.push("exportAs"); - } - } - messagesIds.forEach(messageId => - context.report({ - node, - messageId, - data: { - module - } - })); - } -} - -/** - * @callback nodeCallback - * @param {ASTNode} node A node to handle. - */ - -/** - * Returns a function handling the (imports|exports) of a given file - * @param {RuleContext} context The ESLint rule context object. - * @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type. - * @param {string} declarationType A declaration type can be an import or export. - * @param {boolean} includeExports Whether or not to check for exports in addition to imports. - * @returns {nodeCallback} A function passed to ESLint to handle the statement. - */ -function handleImportsExports( - context, - modules, - declarationType, - includeExports -) { - return function(node) { - const module = getModule(node); - - if (module) { - checkAndReport( - context, - node, - modules, - declarationType, - includeExports - ); - const currentNode = { node, declarationType }; - let nodes = [currentNode]; - - if (modules.has(module)) { - const previousNodes = modules.get(module); - - nodes = [...previousNodes, currentNode]; - } - modules.set(module, nodes); - } - }; -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow duplicate module imports", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-duplicate-imports" - }, - - schema: [ - { - type: "object", - properties: { - includeExports: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - import: "'{{module}}' import is duplicated.", - importAs: "'{{module}}' import is duplicated as export.", - export: "'{{module}}' export is duplicated.", - exportAs: "'{{module}}' export is duplicated as import." - } - }, - - create(context) { - const includeExports = (context.options[0] || {}).includeExports, - modules = new Map(); - const handlers = { - ImportDeclaration: handleImportsExports( - context, - modules, - "import", - includeExports - ) - }; - - if (includeExports) { - handlers.ExportNamedDeclaration = handleImportsExports( - context, - modules, - "export", - includeExports - ); - handlers.ExportAllDeclaration = handleImportsExports( - context, - modules, - "export", - includeExports - ); - } - return handlers; - } -}; diff --git a/node_modules/eslint/lib/rules/no-else-return.js b/node_modules/eslint/lib/rules/no-else-return.js deleted file mode 100644 index 9dbf56965..000000000 --- a/node_modules/eslint/lib/rules/no-else-return.js +++ /dev/null @@ -1,405 +0,0 @@ -/** - * @fileoverview Rule to flag `else` after a `return` in `if` - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const FixTracker = require("./utils/fix-tracker"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `else` blocks after `return` statements in `if` statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-else-return" - }, - - schema: [{ - type: "object", - properties: { - allowElseIf: { - type: "boolean", - default: true - } - }, - additionalProperties: false - }], - - fixable: "code", - - messages: { - unexpected: "Unnecessary 'else' after 'return'." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Checks whether the given names can be safely used to declare block-scoped variables - * in the given scope. Name collisions can produce redeclaration syntax errors, - * or silently change references and modify behavior of the original code. - * - * This is not a generic function. In particular, it is assumed that the scope is a function scope or - * a function's inner scope, and that the names can be valid identifiers in the given scope. - * @param {string[]} names Array of variable names. - * @param {eslint-scope.Scope} scope Function scope or a function's inner scope. - * @returns {boolean} True if all names can be safely declared, false otherwise. - */ - function isSafeToDeclare(names, scope) { - - if (names.length === 0) { - return true; - } - - const functionScope = scope.variableScope; - - /* - * If this is a function scope, scope.variables will contain parameters, implicit variables such as "arguments", - * all function-scoped variables ('var'), and block-scoped variables defined in the scope. - * If this is an inner scope, scope.variables will contain block-scoped variables defined in the scope. - * - * Redeclaring any of these would cause a syntax error, except for the implicit variables. - */ - const declaredVariables = scope.variables.filter(({ defs }) => defs.length > 0); - - if (declaredVariables.some(({ name }) => names.includes(name))) { - return false; - } - - // Redeclaring a catch variable would also cause a syntax error. - if (scope !== functionScope && scope.upper.type === "catch") { - if (scope.upper.variables.some(({ name }) => names.includes(name))) { - return false; - } - } - - /* - * Redeclaring an implicit variable, such as "arguments", would not cause a syntax error. - * However, if the variable was used, declaring a new one with the same name would change references - * and modify behavior. - */ - const usedImplicitVariables = scope.variables.filter(({ defs, references }) => - defs.length === 0 && references.length > 0); - - if (usedImplicitVariables.some(({ name }) => names.includes(name))) { - return false; - } - - /* - * Declaring a variable with a name that was already used to reference a variable from an upper scope - * would change references and modify behavior. - */ - if (scope.through.some(t => names.includes(t.identifier.name))) { - return false; - } - - /* - * If the scope is an inner scope (not the function scope), an uninitialized `var` variable declared inside - * the scope node (directly or in one of its descendants) is neither declared nor 'through' in the scope. - * - * For example, this would be a syntax error "Identifier 'a' has already been declared": - * function foo() { if (bar) { let a; if (baz) { var a; } } } - */ - if (scope !== functionScope) { - const scopeNodeRange = scope.block.range; - const variablesToCheck = functionScope.variables.filter(({ name }) => names.includes(name)); - - if (variablesToCheck.some(v => v.defs.some(({ node: { range } }) => - scopeNodeRange[0] <= range[0] && range[1] <= scopeNodeRange[1]))) { - return false; - } - } - - return true; - } - - - /** - * Checks whether the removal of `else` and its braces is safe from variable name collisions. - * @param {Node} node The 'else' node. - * @param {eslint-scope.Scope} scope The scope in which the node and the whole 'if' statement is. - * @returns {boolean} True if it is safe, false otherwise. - */ - function isSafeFromNameCollisions(node, scope) { - - if (node.type === "FunctionDeclaration") { - - // Conditional function declaration. Scope and hoisting are unpredictable, different engines work differently. - return false; - } - - if (node.type !== "BlockStatement") { - return true; - } - - const elseBlockScope = scope.childScopes.find(({ block }) => block === node); - - if (!elseBlockScope) { - - // ecmaVersion < 6, `else` block statement cannot have its own scope, no possible collisions. - return true; - } - - /* - * elseBlockScope is supposed to merge into its upper scope. elseBlockScope.variables array contains - * only block-scoped variables (such as let and const variables or class and function declarations) - * defined directly in the elseBlockScope. These are exactly the only names that could cause collisions. - */ - const namesToCheck = elseBlockScope.variables.map(({ name }) => name); - - return isSafeToDeclare(namesToCheck, scope); - } - - /** - * Display the context report if rule is violated - * @param {Node} elseNode The 'else' node - * @returns {void} - */ - function displayReport(elseNode) { - const currentScope = sourceCode.getScope(elseNode.parent); - - context.report({ - node: elseNode, - messageId: "unexpected", - fix(fixer) { - - if (!isSafeFromNameCollisions(elseNode, currentScope)) { - return null; - } - - const startToken = sourceCode.getFirstToken(elseNode); - const elseToken = sourceCode.getTokenBefore(startToken); - const source = sourceCode.getText(elseNode); - const lastIfToken = sourceCode.getTokenBefore(elseToken); - let fixedSource, firstTokenOfElseBlock; - - if (startToken.type === "Punctuator" && startToken.value === "{") { - firstTokenOfElseBlock = sourceCode.getTokenAfter(startToken); - } else { - firstTokenOfElseBlock = startToken; - } - - /* - * If the if block does not have curly braces and does not end in a semicolon - * and the else block starts with (, [, /, +, ` or -, then it is not - * safe to remove the else keyword, because ASI will not add a semicolon - * after the if block - */ - const ifBlockMaybeUnsafe = elseNode.parent.consequent.type !== "BlockStatement" && lastIfToken.value !== ";"; - const elseBlockUnsafe = /^[([/+`-]/u.test(firstTokenOfElseBlock.value); - - if (ifBlockMaybeUnsafe && elseBlockUnsafe) { - return null; - } - - const endToken = sourceCode.getLastToken(elseNode); - const lastTokenOfElseBlock = sourceCode.getTokenBefore(endToken); - - if (lastTokenOfElseBlock.value !== ";") { - const nextToken = sourceCode.getTokenAfter(endToken); - - const nextTokenUnsafe = nextToken && /^[([/+`-]/u.test(nextToken.value); - const nextTokenOnSameLine = nextToken && nextToken.loc.start.line === lastTokenOfElseBlock.loc.start.line; - - /* - * If the else block contents does not end in a semicolon, - * and the else block starts with (, [, /, +, ` or -, then it is not - * safe to remove the else block, because ASI will not add a semicolon - * after the remaining else block contents - */ - if (nextTokenUnsafe || (nextTokenOnSameLine && nextToken.value !== "}")) { - return null; - } - } - - if (startToken.type === "Punctuator" && startToken.value === "{") { - fixedSource = source.slice(1, -1); - } else { - fixedSource = source; - } - - /* - * Extend the replacement range to include the entire - * function to avoid conflicting with no-useless-return. - * https://github.com/eslint/eslint/issues/8026 - * - * Also, to avoid name collisions between two else blocks. - */ - return new FixTracker(fixer, sourceCode) - .retainEnclosingFunction(elseNode) - .replaceTextRange([elseToken.range[0], elseNode.range[1]], fixedSource); - } - }); - } - - /** - * Check to see if the node is a ReturnStatement - * @param {Node} node The node being evaluated - * @returns {boolean} True if node is a return - */ - function checkForReturn(node) { - return node.type === "ReturnStatement"; - } - - /** - * Naive return checking, does not iterate through the whole - * BlockStatement because we make the assumption that the ReturnStatement - * will be the last node in the body of the BlockStatement. - * @param {Node} node The consequent/alternate node - * @returns {boolean} True if it has a return - */ - function naiveHasReturn(node) { - if (node.type === "BlockStatement") { - const body = node.body, - lastChildNode = body[body.length - 1]; - - return lastChildNode && checkForReturn(lastChildNode); - } - return checkForReturn(node); - } - - /** - * Check to see if the node is valid for evaluation, - * meaning it has an else. - * @param {Node} node The node being evaluated - * @returns {boolean} True if the node is valid - */ - function hasElse(node) { - return node.alternate && node.consequent; - } - - /** - * If the consequent is an IfStatement, check to see if it has an else - * and both its consequent and alternate path return, meaning this is - * a nested case of rule violation. If-Else not considered currently. - * @param {Node} node The consequent node - * @returns {boolean} True if this is a nested rule violation - */ - function checkForIf(node) { - return node.type === "IfStatement" && hasElse(node) && - naiveHasReturn(node.alternate) && naiveHasReturn(node.consequent); - } - - /** - * Check the consequent/body node to make sure it is not - * a ReturnStatement or an IfStatement that returns on both - * code paths. - * @param {Node} node The consequent or body node - * @returns {boolean} `true` if it is a Return/If node that always returns. - */ - function checkForReturnOrIf(node) { - return checkForReturn(node) || checkForIf(node); - } - - - /** - * Check whether a node returns in every codepath. - * @param {Node} node The node to be checked - * @returns {boolean} `true` if it returns on every codepath. - */ - function alwaysReturns(node) { - if (node.type === "BlockStatement") { - - // If we have a BlockStatement, check each consequent body node. - return node.body.some(checkForReturnOrIf); - } - - /* - * If not a block statement, make sure the consequent isn't a - * ReturnStatement or an IfStatement with returns on both paths. - */ - return checkForReturnOrIf(node); - } - - - /** - * Check the if statement, but don't catch else-if blocks. - * @returns {void} - * @param {Node} node The node for the if statement to check - * @private - */ - function checkIfWithoutElse(node) { - const parent = node.parent; - - /* - * Fixing this would require splitting one statement into two, so no error should - * be reported if this node is in a position where only one statement is allowed. - */ - if (!astUtils.STATEMENT_LIST_PARENTS.has(parent.type)) { - return; - } - - const consequents = []; - let alternate; - - for (let currentNode = node; currentNode.type === "IfStatement"; currentNode = currentNode.alternate) { - if (!currentNode.alternate) { - return; - } - consequents.push(currentNode.consequent); - alternate = currentNode.alternate; - } - - if (consequents.every(alwaysReturns)) { - displayReport(alternate); - } - } - - /** - * Check the if statement - * @returns {void} - * @param {Node} node The node for the if statement to check - * @private - */ - function checkIfWithElse(node) { - const parent = node.parent; - - - /* - * Fixing this would require splitting one statement into two, so no error should - * be reported if this node is in a position where only one statement is allowed. - */ - if (!astUtils.STATEMENT_LIST_PARENTS.has(parent.type)) { - return; - } - - const alternate = node.alternate; - - if (alternate && alwaysReturns(node.consequent)) { - displayReport(alternate); - } - } - - const allowElseIf = !(context.options[0] && context.options[0].allowElseIf === false); - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - - "IfStatement:exit": allowElseIf ? checkIfWithoutElse : checkIfWithElse - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-empty-character-class.js b/node_modules/eslint/lib/rules/no-empty-character-class.js deleted file mode 100644 index da29bbe92..000000000 --- a/node_modules/eslint/lib/rules/no-empty-character-class.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @fileoverview Rule to flag the use of empty character classes in regular expressions - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/* - * plain-English description of the following regexp: - * 0. `^` fix the match at the beginning of the string - * 1. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following - * 1.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes) - * 1.1. `\\.`: an escape sequence - * 1.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty - * 2. `$`: fix the match at the end of the string - */ -const regex = /^([^\\[]|\\.|\[([^\\\]]|\\.)+\])*$/u; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow empty character classes in regular expressions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-empty-character-class" - }, - - schema: [], - - messages: { - unexpected: "Empty class." - } - }, - - create(context) { - return { - "Literal[regex]"(node) { - if (!regex.test(node.regex.pattern)) { - context.report({ node, messageId: "unexpected" }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-empty-function.js b/node_modules/eslint/lib/rules/no-empty-function.js deleted file mode 100644 index 2fcb75534..000000000 --- a/node_modules/eslint/lib/rules/no-empty-function.js +++ /dev/null @@ -1,167 +0,0 @@ -/** - * @fileoverview Rule to disallow empty functions. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const ALLOW_OPTIONS = Object.freeze([ - "functions", - "arrowFunctions", - "generatorFunctions", - "methods", - "generatorMethods", - "getters", - "setters", - "constructors", - "asyncFunctions", - "asyncMethods" -]); - -/** - * Gets the kind of a given function node. - * @param {ASTNode} node A function node to get. This is one of - * an ArrowFunctionExpression, a FunctionDeclaration, or a - * FunctionExpression. - * @returns {string} The kind of the function. This is one of "functions", - * "arrowFunctions", "generatorFunctions", "asyncFunctions", "methods", - * "generatorMethods", "asyncMethods", "getters", "setters", and - * "constructors". - */ -function getKind(node) { - const parent = node.parent; - let kind = ""; - - if (node.type === "ArrowFunctionExpression") { - return "arrowFunctions"; - } - - // Detects main kind. - if (parent.type === "Property") { - if (parent.kind === "get") { - return "getters"; - } - if (parent.kind === "set") { - return "setters"; - } - kind = parent.method ? "methods" : "functions"; - - } else if (parent.type === "MethodDefinition") { - if (parent.kind === "get") { - return "getters"; - } - if (parent.kind === "set") { - return "setters"; - } - if (parent.kind === "constructor") { - return "constructors"; - } - kind = "methods"; - - } else { - kind = "functions"; - } - - // Detects prefix. - let prefix = ""; - - if (node.generator) { - prefix = "generator"; - } else if (node.async) { - prefix = "async"; - } else { - return kind; - } - return prefix + kind[0].toUpperCase() + kind.slice(1); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow empty functions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-empty-function" - }, - - schema: [ - { - type: "object", - properties: { - allow: { - type: "array", - items: { enum: ALLOW_OPTIONS }, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "Unexpected empty {{name}}." - } - }, - - create(context) { - const options = context.options[0] || {}; - const allowed = options.allow || []; - - const sourceCode = context.sourceCode; - - /** - * Reports a given function node if the node matches the following patterns. - * - * - Not allowed by options. - * - The body is empty. - * - The body doesn't have any comments. - * @param {ASTNode} node A function node to report. This is one of - * an ArrowFunctionExpression, a FunctionDeclaration, or a - * FunctionExpression. - * @returns {void} - */ - function reportIfEmpty(node) { - const kind = getKind(node); - const name = astUtils.getFunctionNameWithKind(node); - const innerComments = sourceCode.getTokens(node.body, { - includeComments: true, - filter: astUtils.isCommentToken - }); - - if (!allowed.includes(kind) && - node.body.type === "BlockStatement" && - node.body.body.length === 0 && - innerComments.length === 0 - ) { - context.report({ - node, - loc: node.body.loc, - messageId: "unexpected", - data: { name } - }); - } - } - - return { - ArrowFunctionExpression: reportIfEmpty, - FunctionDeclaration: reportIfEmpty, - FunctionExpression: reportIfEmpty - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-empty-pattern.js b/node_modules/eslint/lib/rules/no-empty-pattern.js deleted file mode 100644 index abb1a7c6d..000000000 --- a/node_modules/eslint/lib/rules/no-empty-pattern.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @fileoverview Rule to disallow an empty pattern - * @author Alberto Rodríguez - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow empty destructuring patterns", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-empty-pattern" - }, - - schema: [], - - messages: { - unexpected: "Unexpected empty {{type}} pattern." - } - }, - - create(context) { - return { - ObjectPattern(node) { - if (node.properties.length === 0) { - context.report({ node, messageId: "unexpected", data: { type: "object" } }); - } - }, - ArrayPattern(node) { - if (node.elements.length === 0) { - context.report({ node, messageId: "unexpected", data: { type: "array" } }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-empty-static-block.js b/node_modules/eslint/lib/rules/no-empty-static-block.js deleted file mode 100644 index 81fc449b8..000000000 --- a/node_modules/eslint/lib/rules/no-empty-static-block.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @fileoverview Rule to disallow empty static blocks. - * @author Sosuke Suzuki - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow empty static blocks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-empty-static-block" - }, - - schema: [], - - messages: { - unexpected: "Unexpected empty static block." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - StaticBlock(node) { - if (node.body.length === 0) { - const closingBrace = sourceCode.getLastToken(node); - - if (sourceCode.getCommentsBefore(closingBrace).length === 0) { - context.report({ - node, - messageId: "unexpected" - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-empty.js b/node_modules/eslint/lib/rules/no-empty.js deleted file mode 100644 index 1c157963e..000000000 --- a/node_modules/eslint/lib/rules/no-empty.js +++ /dev/null @@ -1,103 +0,0 @@ -/** - * @fileoverview Rule to flag use of an empty block statement - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - hasSuggestions: true, - type: "suggestion", - - docs: { - description: "Disallow empty block statements", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-empty" - }, - - schema: [ - { - type: "object", - properties: { - allowEmptyCatch: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "Empty {{type}} statement.", - suggestComment: "Add comment inside empty {{type}} statement." - } - }, - - create(context) { - const options = context.options[0] || {}, - allowEmptyCatch = options.allowEmptyCatch || false; - - const sourceCode = context.sourceCode; - - return { - BlockStatement(node) { - - // if the body is not empty, we can just return immediately - if (node.body.length !== 0) { - return; - } - - // a function is generally allowed to be empty - if (astUtils.isFunction(node.parent)) { - return; - } - - if (allowEmptyCatch && node.parent.type === "CatchClause") { - return; - } - - // any other block is only allowed to be empty, if it contains a comment - if (sourceCode.getCommentsInside(node).length > 0) { - return; - } - - context.report({ - node, - messageId: "unexpected", - data: { type: "block" }, - suggest: [ - { - messageId: "suggestComment", - data: { type: "block" }, - fix(fixer) { - const range = [node.range[0] + 1, node.range[1] - 1]; - - return fixer.replaceTextRange(range, " /* empty */ "); - } - } - ] - }); - }, - - SwitchStatement(node) { - - if (typeof node.cases === "undefined" || node.cases.length === 0) { - context.report({ node, messageId: "unexpected", data: { type: "switch" } }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-eq-null.js b/node_modules/eslint/lib/rules/no-eq-null.js deleted file mode 100644 index 9252907b6..000000000 --- a/node_modules/eslint/lib/rules/no-eq-null.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @fileoverview Rule to flag comparisons to null without a type-checking - * operator. - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `null` comparisons without type-checking operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-eq-null" - }, - - schema: [], - - messages: { - unexpected: "Use '===' to compare with null." - } - }, - - create(context) { - - return { - - BinaryExpression(node) { - const badOperator = node.operator === "==" || node.operator === "!="; - - if (node.right.type === "Literal" && node.right.raw === "null" && badOperator || - node.left.type === "Literal" && node.left.raw === "null" && badOperator) { - context.report({ node, messageId: "unexpected" }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-eval.js b/node_modules/eslint/lib/rules/no-eval.js deleted file mode 100644 index a059526a6..000000000 --- a/node_modules/eslint/lib/rules/no-eval.js +++ /dev/null @@ -1,286 +0,0 @@ -/** - * @fileoverview Rule to flag use of eval() statement - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const candidatesOfGlobalObject = Object.freeze([ - "global", - "window", - "globalThis" -]); - -/** - * Checks a given node is a MemberExpression node which has the specified name's - * property. - * @param {ASTNode} node A node to check. - * @param {string} name A name to check. - * @returns {boolean} `true` if the node is a MemberExpression node which has - * the specified name's property - */ -function isMember(node, name) { - return astUtils.isSpecificMemberAccess(node, null, name); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the use of `eval()`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-eval" - }, - - schema: [ - { - type: "object", - properties: { - allowIndirect: { type: "boolean", default: false } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "eval can be harmful." - } - }, - - create(context) { - const allowIndirect = Boolean( - context.options[0] && - context.options[0].allowIndirect - ); - const sourceCode = context.sourceCode; - let funcInfo = null; - - /** - * Pushes a `this` scope (non-arrow function, class static block, or class field initializer) information to the stack. - * Top-level scopes are handled separately. - * - * This is used in order to check whether or not `this` binding is a - * reference to the global object. - * @param {ASTNode} node A node of the scope. - * For functions, this is one of FunctionDeclaration, FunctionExpression. - * For class static blocks, this is StaticBlock. - * For class field initializers, this can be any node that is PropertyDefinition#value. - * @returns {void} - */ - function enterThisScope(node) { - const strict = sourceCode.getScope(node).isStrict; - - funcInfo = { - upper: funcInfo, - node, - strict, - isTopLevelOfScript: false, - defaultThis: false, - initialized: strict - }; - } - - /** - * Pops a variable scope from the stack. - * @returns {void} - */ - function exitThisScope() { - funcInfo = funcInfo.upper; - } - - /** - * Reports a given node. - * - * `node` is `Identifier` or `MemberExpression`. - * The parent of `node` might be `CallExpression`. - * - * The location of the report is always `eval` `Identifier` (or possibly - * `Literal`). The type of the report is `CallExpression` if the parent is - * `CallExpression`. Otherwise, it's the given node type. - * @param {ASTNode} node A node to report. - * @returns {void} - */ - function report(node) { - const parent = node.parent; - const locationNode = node.type === "MemberExpression" - ? node.property - : node; - - const reportNode = parent.type === "CallExpression" && parent.callee === node - ? parent - : node; - - context.report({ - node: reportNode, - loc: locationNode.loc, - messageId: "unexpected" - }); - } - - /** - * Reports accesses of `eval` via the global object. - * @param {eslint-scope.Scope} globalScope The global scope. - * @returns {void} - */ - function reportAccessingEvalViaGlobalObject(globalScope) { - for (let i = 0; i < candidatesOfGlobalObject.length; ++i) { - const name = candidatesOfGlobalObject[i]; - const variable = astUtils.getVariableByName(globalScope, name); - - if (!variable) { - continue; - } - - const references = variable.references; - - for (let j = 0; j < references.length; ++j) { - const identifier = references[j].identifier; - let node = identifier.parent; - - // To detect code like `window.window.eval`. - while (isMember(node, name)) { - node = node.parent; - } - - // Reports. - if (isMember(node, "eval")) { - report(node); - } - } - } - } - - /** - * Reports all accesses of `eval` (excludes direct calls to eval). - * @param {eslint-scope.Scope} globalScope The global scope. - * @returns {void} - */ - function reportAccessingEval(globalScope) { - const variable = astUtils.getVariableByName(globalScope, "eval"); - - if (!variable) { - return; - } - - const references = variable.references; - - for (let i = 0; i < references.length; ++i) { - const reference = references[i]; - const id = reference.identifier; - - if (id.name === "eval" && !astUtils.isCallee(id)) { - - // Is accessing to eval (excludes direct calls to eval) - report(id); - } - } - } - - if (allowIndirect) { - - // Checks only direct calls to eval. It's simple! - return { - "CallExpression:exit"(node) { - const callee = node.callee; - - /* - * Optional call (`eval?.("code")`) is not direct eval. - * The direct eval is only step 6.a.vi of https://tc39.es/ecma262/#sec-function-calls-runtime-semantics-evaluation - * But the optional call is https://tc39.es/ecma262/#sec-optional-chaining-chain-evaluation - */ - if (!node.optional && astUtils.isSpecificId(callee, "eval")) { - report(callee); - } - } - }; - } - - return { - "CallExpression:exit"(node) { - const callee = node.callee; - - if (astUtils.isSpecificId(callee, "eval")) { - report(callee); - } - }, - - Program(node) { - const scope = sourceCode.getScope(node), - features = context.parserOptions.ecmaFeatures || {}, - strict = - scope.isStrict || - node.sourceType === "module" || - (features.globalReturn && scope.childScopes[0].isStrict), - isTopLevelOfScript = node.sourceType !== "module" && !features.globalReturn; - - funcInfo = { - upper: null, - node, - strict, - isTopLevelOfScript, - defaultThis: true, - initialized: true - }; - }, - - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - - exitThisScope(); - reportAccessingEval(globalScope); - reportAccessingEvalViaGlobalObject(globalScope); - }, - - FunctionDeclaration: enterThisScope, - "FunctionDeclaration:exit": exitThisScope, - FunctionExpression: enterThisScope, - "FunctionExpression:exit": exitThisScope, - "PropertyDefinition > *.value": enterThisScope, - "PropertyDefinition > *.value:exit": exitThisScope, - StaticBlock: enterThisScope, - "StaticBlock:exit": exitThisScope, - - ThisExpression(node) { - if (!isMember(node.parent, "eval")) { - return; - } - - /* - * `this.eval` is found. - * Checks whether or not the value of `this` is the global object. - */ - if (!funcInfo.initialized) { - funcInfo.initialized = true; - funcInfo.defaultThis = astUtils.isDefaultThisBinding( - funcInfo.node, - sourceCode - ); - } - - // `this` at the top level of scripts always refers to the global object - if (funcInfo.isTopLevelOfScript || (!funcInfo.strict && funcInfo.defaultThis)) { - - // `this.eval` is possible built-in `eval`. - report(node.parent); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-ex-assign.js b/node_modules/eslint/lib/rules/no-ex-assign.js deleted file mode 100644 index d0e9febae..000000000 --- a/node_modules/eslint/lib/rules/no-ex-assign.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @fileoverview Rule to flag assignment of the exception parameter - * @author Stephen Murray - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow reassigning exceptions in `catch` clauses", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-ex-assign" - }, - - schema: [], - - messages: { - unexpected: "Do not assign to the exception parameter." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Finds and reports references that are non initializer and writable. - * @param {Variable} variable A variable to check. - * @returns {void} - */ - function checkVariable(variable) { - astUtils.getModifyingReferences(variable.references).forEach(reference => { - context.report({ node: reference.identifier, messageId: "unexpected" }); - }); - } - - return { - CatchClause(node) { - sourceCode.getDeclaredVariables(node).forEach(checkVariable); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-extend-native.js b/node_modules/eslint/lib/rules/no-extend-native.js deleted file mode 100644 index fcbb38557..000000000 --- a/node_modules/eslint/lib/rules/no-extend-native.js +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @fileoverview Rule to flag adding properties to native object's prototypes. - * @author David Nelson - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const globals = require("globals"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow extending native types", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-extend-native" - }, - - schema: [ - { - type: "object", - properties: { - exceptions: { - type: "array", - items: { - type: "string" - }, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "{{builtin}} prototype is read only, properties should not be added." - } - }, - - create(context) { - - const config = context.options[0] || {}; - const sourceCode = context.sourceCode; - const exceptions = new Set(config.exceptions || []); - const modifiedBuiltins = new Set( - Object.keys(globals.builtin) - .filter(builtin => builtin[0].toUpperCase() === builtin[0]) - .filter(builtin => !exceptions.has(builtin)) - ); - - /** - * Reports a lint error for the given node. - * @param {ASTNode} node The node to report. - * @param {string} builtin The name of the native builtin being extended. - * @returns {void} - */ - function reportNode(node, builtin) { - context.report({ - node, - messageId: "unexpected", - data: { - builtin - } - }); - } - - /** - * Check to see if the `prototype` property of the given object - * identifier node is being accessed. - * @param {ASTNode} identifierNode The Identifier representing the object - * to check. - * @returns {boolean} True if the identifier is the object of a - * MemberExpression and its `prototype` property is being accessed, - * false otherwise. - */ - function isPrototypePropertyAccessed(identifierNode) { - return Boolean( - identifierNode && - identifierNode.parent && - identifierNode.parent.type === "MemberExpression" && - identifierNode.parent.object === identifierNode && - astUtils.getStaticPropertyName(identifierNode.parent) === "prototype" - ); - } - - /** - * Check if it's an assignment to the property of the given node. - * Example: `*.prop = 0` // the `*` is the given node. - * @param {ASTNode} node The node to check. - * @returns {boolean} True if an assignment to the property of the node. - */ - function isAssigningToPropertyOf(node) { - return ( - node.parent.type === "MemberExpression" && - node.parent.object === node && - node.parent.parent.type === "AssignmentExpression" && - node.parent.parent.left === node.parent - ); - } - - /** - * Checks if the given node is at the first argument of the method call of `Object.defineProperty()` or `Object.defineProperties()`. - * @param {ASTNode} node The node to check. - * @returns {boolean} True if the node is at the first argument of the method call of `Object.defineProperty()` or `Object.defineProperties()`. - */ - function isInDefinePropertyCall(node) { - return ( - node.parent.type === "CallExpression" && - node.parent.arguments[0] === node && - astUtils.isSpecificMemberAccess(node.parent.callee, "Object", /^definePropert(?:y|ies)$/u) - ); - } - - /** - * Check to see if object prototype access is part of a prototype - * extension. There are three ways a prototype can be extended: - * 1. Assignment to prototype property (Object.prototype.foo = 1) - * 2. Object.defineProperty()/Object.defineProperties() on a prototype - * If prototype extension is detected, report the AssignmentExpression - * or CallExpression node. - * @param {ASTNode} identifierNode The Identifier representing the object - * which prototype is being accessed and possibly extended. - * @returns {void} - */ - function checkAndReportPrototypeExtension(identifierNode) { - if (!isPrototypePropertyAccessed(identifierNode)) { - return; // This is not `*.prototype` access. - } - - /* - * `identifierNode.parent` is a MemberExpression `*.prototype`. - * If it's an optional member access, it may be wrapped by a `ChainExpression` node. - */ - const prototypeNode = - identifierNode.parent.parent.type === "ChainExpression" - ? identifierNode.parent.parent - : identifierNode.parent; - - if (isAssigningToPropertyOf(prototypeNode)) { - - // `*.prototype` -> MemberExpression -> AssignmentExpression - reportNode(prototypeNode.parent.parent, identifierNode.name); - } else if (isInDefinePropertyCall(prototypeNode)) { - - // `*.prototype` -> CallExpression - reportNode(prototypeNode.parent, identifierNode.name); - } - } - - return { - - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - - modifiedBuiltins.forEach(builtin => { - const builtinVar = globalScope.set.get(builtin); - - if (builtinVar && builtinVar.references) { - builtinVar.references - .map(ref => ref.identifier) - .forEach(checkAndReportPrototypeExtension); - } - }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-extra-bind.js b/node_modules/eslint/lib/rules/no-extra-bind.js deleted file mode 100644 index e1e72b0c7..000000000 --- a/node_modules/eslint/lib/rules/no-extra-bind.js +++ /dev/null @@ -1,213 +0,0 @@ -/** - * @fileoverview Rule to flag unnecessary bind calls - * @author Bence Dányi - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const SIDE_EFFECT_FREE_NODE_TYPES = new Set(["Literal", "Identifier", "ThisExpression", "FunctionExpression"]); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary calls to `.bind()`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-extra-bind" - }, - - schema: [], - fixable: "code", - - messages: { - unexpected: "The function binding is unnecessary." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - let scopeInfo = null; - - /** - * Checks if a node is free of side effects. - * - * This check is stricter than it needs to be, in order to keep the implementation simple. - * @param {ASTNode} node A node to check. - * @returns {boolean} True if the node is known to be side-effect free, false otherwise. - */ - function isSideEffectFree(node) { - return SIDE_EFFECT_FREE_NODE_TYPES.has(node.type); - } - - /** - * Reports a given function node. - * @param {ASTNode} node A node to report. This is a FunctionExpression or - * an ArrowFunctionExpression. - * @returns {void} - */ - function report(node) { - const memberNode = node.parent; - const callNode = memberNode.parent.type === "ChainExpression" - ? memberNode.parent.parent - : memberNode.parent; - - context.report({ - node: callNode, - messageId: "unexpected", - loc: memberNode.property.loc, - - fix(fixer) { - if (!isSideEffectFree(callNode.arguments[0])) { - return null; - } - - /* - * The list of the first/last token pair of a removal range. - * This is two parts because closing parentheses may exist between the method name and arguments. - * E.g. `(function(){}.bind ) (obj)` - * ^^^^^ ^^^^^ < removal ranges - * E.g. `(function(){}?.['bind'] ) ?.(obj)` - * ^^^^^^^^^^ ^^^^^^^ < removal ranges - */ - const tokenPairs = [ - [ - - // `.`, `?.`, or `[` token. - sourceCode.getTokenAfter( - memberNode.object, - astUtils.isNotClosingParenToken - ), - - // property name or `]` token. - sourceCode.getLastToken(memberNode) - ], - [ - - // `?.` or `(` token of arguments. - sourceCode.getTokenAfter( - memberNode, - astUtils.isNotClosingParenToken - ), - - // `)` token of arguments. - sourceCode.getLastToken(callNode) - ] - ]; - const firstTokenToRemove = tokenPairs[0][0]; - const lastTokenToRemove = tokenPairs[1][1]; - - if (sourceCode.commentsExistBetween(firstTokenToRemove, lastTokenToRemove)) { - return null; - } - - return tokenPairs.map(([start, end]) => - fixer.removeRange([start.range[0], end.range[1]])); - } - }); - } - - /** - * Checks whether or not a given function node is the callee of `.bind()` - * method. - * - * e.g. `(function() {}.bind(foo))` - * @param {ASTNode} node A node to report. This is a FunctionExpression or - * an ArrowFunctionExpression. - * @returns {boolean} `true` if the node is the callee of `.bind()` method. - */ - function isCalleeOfBindMethod(node) { - if (!astUtils.isSpecificMemberAccess(node.parent, null, "bind")) { - return false; - } - - // The node of `*.bind` member access. - const bindNode = node.parent.parent.type === "ChainExpression" - ? node.parent.parent - : node.parent; - - return ( - bindNode.parent.type === "CallExpression" && - bindNode.parent.callee === bindNode && - bindNode.parent.arguments.length === 1 && - bindNode.parent.arguments[0].type !== "SpreadElement" - ); - } - - /** - * Adds a scope information object to the stack. - * @param {ASTNode} node A node to add. This node is a FunctionExpression - * or a FunctionDeclaration node. - * @returns {void} - */ - function enterFunction(node) { - scopeInfo = { - isBound: isCalleeOfBindMethod(node), - thisFound: false, - upper: scopeInfo - }; - } - - /** - * Removes the scope information object from the top of the stack. - * At the same time, this reports the function node if the function has - * `.bind()` and the `this` keywords found. - * @param {ASTNode} node A node to remove. This node is a - * FunctionExpression or a FunctionDeclaration node. - * @returns {void} - */ - function exitFunction(node) { - if (scopeInfo.isBound && !scopeInfo.thisFound) { - report(node); - } - - scopeInfo = scopeInfo.upper; - } - - /** - * Reports a given arrow function if the function is callee of `.bind()` - * method. - * @param {ASTNode} node A node to report. This node is an - * ArrowFunctionExpression. - * @returns {void} - */ - function exitArrowFunction(node) { - if (isCalleeOfBindMethod(node)) { - report(node); - } - } - - /** - * Set the mark as the `this` keyword was found in this scope. - * @returns {void} - */ - function markAsThisFound() { - if (scopeInfo) { - scopeInfo.thisFound = true; - } - } - - return { - "ArrowFunctionExpression:exit": exitArrowFunction, - FunctionDeclaration: enterFunction, - "FunctionDeclaration:exit": exitFunction, - FunctionExpression: enterFunction, - "FunctionExpression:exit": exitFunction, - ThisExpression: markAsThisFound - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-extra-boolean-cast.js b/node_modules/eslint/lib/rules/no-extra-boolean-cast.js deleted file mode 100644 index f342533bf..000000000 --- a/node_modules/eslint/lib/rules/no-extra-boolean-cast.js +++ /dev/null @@ -1,317 +0,0 @@ -/** - * @fileoverview Rule to flag unnecessary double negation in Boolean contexts - * @author Brandon Mills - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const eslintUtils = require("@eslint-community/eslint-utils"); - -const precedence = astUtils.getPrecedence; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary boolean casts", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-extra-boolean-cast" - }, - - schema: [{ - type: "object", - properties: { - enforceForLogicalOperands: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - fixable: "code", - - messages: { - unexpectedCall: "Redundant Boolean call.", - unexpectedNegation: "Redundant double negation." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - // Node types which have a test which will coerce values to booleans. - const BOOLEAN_NODE_TYPES = new Set([ - "IfStatement", - "DoWhileStatement", - "WhileStatement", - "ConditionalExpression", - "ForStatement" - ]); - - /** - * Check if a node is a Boolean function or constructor. - * @param {ASTNode} node the node - * @returns {boolean} If the node is Boolean function or constructor - */ - function isBooleanFunctionOrConstructorCall(node) { - - // Boolean() and new Boolean() - return (node.type === "CallExpression" || node.type === "NewExpression") && - node.callee.type === "Identifier" && - node.callee.name === "Boolean"; - } - - /** - * Checks whether the node is a logical expression and that the option is enabled - * @param {ASTNode} node the node - * @returns {boolean} if the node is a logical expression and option is enabled - */ - function isLogicalContext(node) { - return node.type === "LogicalExpression" && - (node.operator === "||" || node.operator === "&&") && - (context.options.length && context.options[0].enforceForLogicalOperands === true); - - } - - - /** - * Check if a node is in a context where its value would be coerced to a boolean at runtime. - * @param {ASTNode} node The node - * @returns {boolean} If it is in a boolean context - */ - function isInBooleanContext(node) { - return ( - (isBooleanFunctionOrConstructorCall(node.parent) && - node === node.parent.arguments[0]) || - - (BOOLEAN_NODE_TYPES.has(node.parent.type) && - node === node.parent.test) || - - // ! - (node.parent.type === "UnaryExpression" && - node.parent.operator === "!") - ); - } - - /** - * Checks whether the node is a context that should report an error - * Acts recursively if it is in a logical context - * @param {ASTNode} node the node - * @returns {boolean} If the node is in one of the flagged contexts - */ - function isInFlaggedContext(node) { - if (node.parent.type === "ChainExpression") { - return isInFlaggedContext(node.parent); - } - - return isInBooleanContext(node) || - (isLogicalContext(node.parent) && - - // For nested logical statements - isInFlaggedContext(node.parent) - ); - } - - - /** - * Check if a node has comments inside. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if it has comments inside. - */ - function hasCommentsInside(node) { - return Boolean(sourceCode.getCommentsInside(node).length); - } - - /** - * Checks if the given node is wrapped in grouping parentheses. Parentheses for constructs such as if() don't count. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is parenthesized. - * @private - */ - function isParenthesized(node) { - return eslintUtils.isParenthesized(1, node, sourceCode); - } - - /** - * Determines whether the given node needs to be parenthesized when replacing the previous node. - * It assumes that `previousNode` is the node to be reported by this rule, so it has a limited list - * of possible parent node types. By the same assumption, the node's role in a particular parent is already known. - * For example, if the parent is `ConditionalExpression`, `previousNode` must be its `test` child. - * @param {ASTNode} previousNode Previous node. - * @param {ASTNode} node The node to check. - * @throws {Error} (Unreachable.) - * @returns {boolean} `true` if the node needs to be parenthesized. - */ - function needsParens(previousNode, node) { - if (previousNode.parent.type === "ChainExpression") { - return needsParens(previousNode.parent, node); - } - if (isParenthesized(previousNode)) { - - // parentheses around the previous node will stay, so there is no need for an additional pair - return false; - } - - // parent of the previous node will become parent of the replacement node - const parent = previousNode.parent; - - switch (parent.type) { - case "CallExpression": - case "NewExpression": - return node.type === "SequenceExpression"; - case "IfStatement": - case "DoWhileStatement": - case "WhileStatement": - case "ForStatement": - return false; - case "ConditionalExpression": - return precedence(node) <= precedence(parent); - case "UnaryExpression": - return precedence(node) < precedence(parent); - case "LogicalExpression": - if (astUtils.isMixedLogicalAndCoalesceExpressions(node, parent)) { - return true; - } - if (previousNode === parent.left) { - return precedence(node) < precedence(parent); - } - return precedence(node) <= precedence(parent); - - /* c8 ignore next */ - default: - throw new Error(`Unexpected parent type: ${parent.type}`); - } - } - - return { - UnaryExpression(node) { - const parent = node.parent; - - - // Exit early if it's guaranteed not to match - if (node.operator !== "!" || - parent.type !== "UnaryExpression" || - parent.operator !== "!") { - return; - } - - - if (isInFlaggedContext(parent)) { - context.report({ - node: parent, - messageId: "unexpectedNegation", - fix(fixer) { - if (hasCommentsInside(parent)) { - return null; - } - - if (needsParens(parent, node.argument)) { - return fixer.replaceText(parent, `(${sourceCode.getText(node.argument)})`); - } - - let prefix = ""; - const tokenBefore = sourceCode.getTokenBefore(parent); - const firstReplacementToken = sourceCode.getFirstToken(node.argument); - - if ( - tokenBefore && - tokenBefore.range[1] === parent.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, firstReplacementToken) - ) { - prefix = " "; - } - - return fixer.replaceText(parent, prefix + sourceCode.getText(node.argument)); - } - }); - } - }, - - CallExpression(node) { - if (node.callee.type !== "Identifier" || node.callee.name !== "Boolean") { - return; - } - - if (isInFlaggedContext(node)) { - context.report({ - node, - messageId: "unexpectedCall", - fix(fixer) { - const parent = node.parent; - - if (node.arguments.length === 0) { - if (parent.type === "UnaryExpression" && parent.operator === "!") { - - /* - * !Boolean() -> true - */ - - if (hasCommentsInside(parent)) { - return null; - } - - const replacement = "true"; - let prefix = ""; - const tokenBefore = sourceCode.getTokenBefore(parent); - - if ( - tokenBefore && - tokenBefore.range[1] === parent.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, replacement) - ) { - prefix = " "; - } - - return fixer.replaceText(parent, prefix + replacement); - } - - /* - * Boolean() -> false - */ - - if (hasCommentsInside(node)) { - return null; - } - - return fixer.replaceText(node, "false"); - } - - if (node.arguments.length === 1) { - const argument = node.arguments[0]; - - if (argument.type === "SpreadElement" || hasCommentsInside(node)) { - return null; - } - - /* - * Boolean(expression) -> expression - */ - - if (needsParens(node, argument)) { - return fixer.replaceText(node, `(${sourceCode.getText(argument)})`); - } - - return fixer.replaceText(node, sourceCode.getText(argument)); - } - - // two or more arguments - return null; - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-extra-label.js b/node_modules/eslint/lib/rules/no-extra-label.js deleted file mode 100644 index 45ff441d0..000000000 --- a/node_modules/eslint/lib/rules/no-extra-label.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * @fileoverview Rule to disallow unnecessary labels - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary labels", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-extra-label" - }, - - schema: [], - fixable: "code", - - messages: { - unexpected: "This label '{{name}}' is unnecessary." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - let scopeInfo = null; - - /** - * Creates a new scope with a breakable statement. - * @param {ASTNode} node A node to create. This is a BreakableStatement. - * @returns {void} - */ - function enterBreakableStatement(node) { - scopeInfo = { - label: node.parent.type === "LabeledStatement" ? node.parent.label : null, - breakable: true, - upper: scopeInfo - }; - } - - /** - * Removes the top scope of the stack. - * @returns {void} - */ - function exitBreakableStatement() { - scopeInfo = scopeInfo.upper; - } - - /** - * Creates a new scope with a labeled statement. - * - * This ignores it if the body is a breakable statement. - * In this case it's handled in the `enterBreakableStatement` function. - * @param {ASTNode} node A node to create. This is a LabeledStatement. - * @returns {void} - */ - function enterLabeledStatement(node) { - if (!astUtils.isBreakableStatement(node.body)) { - scopeInfo = { - label: node.label, - breakable: false, - upper: scopeInfo - }; - } - } - - /** - * Removes the top scope of the stack. - * - * This ignores it if the body is a breakable statement. - * In this case it's handled in the `exitBreakableStatement` function. - * @param {ASTNode} node A node. This is a LabeledStatement. - * @returns {void} - */ - function exitLabeledStatement(node) { - if (!astUtils.isBreakableStatement(node.body)) { - scopeInfo = scopeInfo.upper; - } - } - - /** - * Reports a given control node if it's unnecessary. - * @param {ASTNode} node A node. This is a BreakStatement or a - * ContinueStatement. - * @returns {void} - */ - function reportIfUnnecessary(node) { - if (!node.label) { - return; - } - - const labelNode = node.label; - - for (let info = scopeInfo; info !== null; info = info.upper) { - if (info.breakable || info.label && info.label.name === labelNode.name) { - if (info.breakable && info.label && info.label.name === labelNode.name) { - context.report({ - node: labelNode, - messageId: "unexpected", - data: labelNode, - fix(fixer) { - const breakOrContinueToken = sourceCode.getFirstToken(node); - - if (sourceCode.commentsExistBetween(breakOrContinueToken, labelNode)) { - return null; - } - - return fixer.removeRange([breakOrContinueToken.range[1], labelNode.range[1]]); - } - }); - } - return; - } - } - } - - return { - WhileStatement: enterBreakableStatement, - "WhileStatement:exit": exitBreakableStatement, - DoWhileStatement: enterBreakableStatement, - "DoWhileStatement:exit": exitBreakableStatement, - ForStatement: enterBreakableStatement, - "ForStatement:exit": exitBreakableStatement, - ForInStatement: enterBreakableStatement, - "ForInStatement:exit": exitBreakableStatement, - ForOfStatement: enterBreakableStatement, - "ForOfStatement:exit": exitBreakableStatement, - SwitchStatement: enterBreakableStatement, - "SwitchStatement:exit": exitBreakableStatement, - LabeledStatement: enterLabeledStatement, - "LabeledStatement:exit": exitLabeledStatement, - BreakStatement: reportIfUnnecessary, - ContinueStatement: reportIfUnnecessary - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-extra-parens.js b/node_modules/eslint/lib/rules/no-extra-parens.js deleted file mode 100644 index 0f59d7dd3..000000000 --- a/node_modules/eslint/lib/rules/no-extra-parens.js +++ /dev/null @@ -1,1283 +0,0 @@ -/** - * @fileoverview Disallow parenthesising higher precedence subexpressions. - * @author Michael Ficarra - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const { isParenthesized: isParenthesizedRaw } = require("@eslint-community/eslint-utils"); -const astUtils = require("./utils/ast-utils.js"); - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Disallow unnecessary parentheses", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-extra-parens" - }, - - fixable: "code", - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["functions"] - } - ], - minItems: 0, - maxItems: 1 - }, - { - type: "array", - items: [ - { - enum: ["all"] - }, - { - type: "object", - properties: { - conditionalAssign: { type: "boolean" }, - nestedBinaryExpressions: { type: "boolean" }, - returnAssign: { type: "boolean" }, - ignoreJSX: { enum: ["none", "all", "single-line", "multi-line"] }, - enforceForArrowConditionals: { type: "boolean" }, - enforceForSequenceExpressions: { type: "boolean" }, - enforceForNewInMemberExpressions: { type: "boolean" }, - enforceForFunctionPrototypeMethods: { type: "boolean" }, - allowParensAfterCommentPattern: { type: "string" } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - } - ] - }, - - messages: { - unexpected: "Unnecessary parentheses around expression." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - const tokensToIgnore = new WeakSet(); - const precedence = astUtils.getPrecedence; - const ALL_NODES = context.options[0] !== "functions"; - const EXCEPT_COND_ASSIGN = ALL_NODES && context.options[1] && context.options[1].conditionalAssign === false; - const NESTED_BINARY = ALL_NODES && context.options[1] && context.options[1].nestedBinaryExpressions === false; - const EXCEPT_RETURN_ASSIGN = ALL_NODES && context.options[1] && context.options[1].returnAssign === false; - const IGNORE_JSX = ALL_NODES && context.options[1] && context.options[1].ignoreJSX; - const IGNORE_ARROW_CONDITIONALS = ALL_NODES && context.options[1] && - context.options[1].enforceForArrowConditionals === false; - const IGNORE_SEQUENCE_EXPRESSIONS = ALL_NODES && context.options[1] && - context.options[1].enforceForSequenceExpressions === false; - const IGNORE_NEW_IN_MEMBER_EXPR = ALL_NODES && context.options[1] && - context.options[1].enforceForNewInMemberExpressions === false; - const IGNORE_FUNCTION_PROTOTYPE_METHODS = ALL_NODES && context.options[1] && - context.options[1].enforceForFunctionPrototypeMethods === false; - const ALLOW_PARENS_AFTER_COMMENT_PATTERN = ALL_NODES && context.options[1] && context.options[1].allowParensAfterCommentPattern; - - const PRECEDENCE_OF_ASSIGNMENT_EXPR = precedence({ type: "AssignmentExpression" }); - const PRECEDENCE_OF_UPDATE_EXPR = precedence({ type: "UpdateExpression" }); - - let reportsBuffer; - - /** - * Determines whether the given node is a `call` or `apply` method call, invoked directly on a `FunctionExpression` node. - * Example: function(){}.call() - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is an immediate `call` or `apply` method call. - * @private - */ - function isImmediateFunctionPrototypeMethodCall(node) { - const callNode = astUtils.skipChainExpression(node); - - if (callNode.type !== "CallExpression") { - return false; - } - const callee = astUtils.skipChainExpression(callNode.callee); - - return ( - callee.type === "MemberExpression" && - callee.object.type === "FunctionExpression" && - ["call", "apply"].includes(astUtils.getStaticPropertyName(callee)) - ); - } - - /** - * Determines if this rule should be enforced for a node given the current configuration. - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the rule should be enforced for this node. - * @private - */ - function ruleApplies(node) { - if (node.type === "JSXElement" || node.type === "JSXFragment") { - const isSingleLine = node.loc.start.line === node.loc.end.line; - - switch (IGNORE_JSX) { - - // Exclude this JSX element from linting - case "all": - return false; - - // Exclude this JSX element if it is multi-line element - case "multi-line": - return isSingleLine; - - // Exclude this JSX element if it is single-line element - case "single-line": - return !isSingleLine; - - // Nothing special to be done for JSX elements - case "none": - break; - - // no default - } - } - - if (node.type === "SequenceExpression" && IGNORE_SEQUENCE_EXPRESSIONS) { - return false; - } - - if (isImmediateFunctionPrototypeMethodCall(node) && IGNORE_FUNCTION_PROTOTYPE_METHODS) { - return false; - } - - return ALL_NODES || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression"; - } - - /** - * Determines if a node is surrounded by parentheses. - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is parenthesised. - * @private - */ - function isParenthesised(node) { - return isParenthesizedRaw(1, node, sourceCode); - } - - /** - * Determines if a node is surrounded by parentheses twice. - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is doubly parenthesised. - * @private - */ - function isParenthesisedTwice(node) { - return isParenthesizedRaw(2, node, sourceCode); - } - - /** - * Determines if a node is surrounded by (potentially) invalid parentheses. - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is incorrectly parenthesised. - * @private - */ - function hasExcessParens(node) { - return ruleApplies(node) && isParenthesised(node); - } - - /** - * Determines if a node that is expected to be parenthesised is surrounded by - * (potentially) invalid extra parentheses. - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is has an unexpected extra pair of parentheses. - * @private - */ - function hasDoubleExcessParens(node) { - return ruleApplies(node) && isParenthesisedTwice(node); - } - - /** - * Determines if a node that is expected to be parenthesised is surrounded by - * (potentially) invalid extra parentheses with considering precedence level of the node. - * If the preference level of the node is not higher or equal to precedence lower limit, it also checks - * whether the node is surrounded by parentheses twice or not. - * @param {ASTNode} node The node to be checked. - * @param {number} precedenceLowerLimit The lower limit of precedence. - * @returns {boolean} True if the node is has an unexpected extra pair of parentheses. - * @private - */ - function hasExcessParensWithPrecedence(node, precedenceLowerLimit) { - if (ruleApplies(node) && isParenthesised(node)) { - if ( - precedence(node) >= precedenceLowerLimit || - isParenthesisedTwice(node) - ) { - return true; - } - } - return false; - } - - /** - * Determines if a node test expression is allowed to have a parenthesised assignment - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the assignment can be parenthesised. - * @private - */ - function isCondAssignException(node) { - return EXCEPT_COND_ASSIGN && node.test.type === "AssignmentExpression"; - } - - /** - * Determines if a node is in a return statement - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is in a return statement. - * @private - */ - function isInReturnStatement(node) { - for (let currentNode = node; currentNode; currentNode = currentNode.parent) { - if ( - currentNode.type === "ReturnStatement" || - (currentNode.type === "ArrowFunctionExpression" && currentNode.body.type !== "BlockStatement") - ) { - return true; - } - } - - return false; - } - - /** - * Determines if a constructor function is newed-up with parens - * @param {ASTNode} newExpression The NewExpression node to be checked. - * @returns {boolean} True if the constructor is called with parens. - * @private - */ - function isNewExpressionWithParens(newExpression) { - const lastToken = sourceCode.getLastToken(newExpression); - const penultimateToken = sourceCode.getTokenBefore(lastToken); - - return newExpression.arguments.length > 0 || - ( - - // The expression should end with its own parens, e.g., new new foo() is not a new expression with parens - astUtils.isOpeningParenToken(penultimateToken) && - astUtils.isClosingParenToken(lastToken) && - newExpression.callee.range[1] < newExpression.range[1] - ); - } - - /** - * Determines if a node is or contains an assignment expression - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is or contains an assignment expression. - * @private - */ - function containsAssignment(node) { - if (node.type === "AssignmentExpression") { - return true; - } - if (node.type === "ConditionalExpression" && - (node.consequent.type === "AssignmentExpression" || node.alternate.type === "AssignmentExpression")) { - return true; - } - if ((node.left && node.left.type === "AssignmentExpression") || - (node.right && node.right.type === "AssignmentExpression")) { - return true; - } - - return false; - } - - /** - * Determines if a node is contained by or is itself a return statement and is allowed to have a parenthesised assignment - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the assignment can be parenthesised. - * @private - */ - function isReturnAssignException(node) { - if (!EXCEPT_RETURN_ASSIGN || !isInReturnStatement(node)) { - return false; - } - - if (node.type === "ReturnStatement") { - return node.argument && containsAssignment(node.argument); - } - if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") { - return containsAssignment(node.body); - } - return containsAssignment(node); - - } - - /** - * Determines if a node following a [no LineTerminator here] restriction is - * surrounded by (potentially) invalid extra parentheses. - * @param {Token} token The token preceding the [no LineTerminator here] restriction. - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is incorrectly parenthesised. - * @private - */ - function hasExcessParensNoLineTerminator(token, node) { - if (token.loc.end.line === node.loc.start.line) { - return hasExcessParens(node); - } - - return hasDoubleExcessParens(node); - } - - /** - * Determines whether a node should be preceded by an additional space when removing parens - * @param {ASTNode} node node to evaluate; must be surrounded by parentheses - * @returns {boolean} `true` if a space should be inserted before the node - * @private - */ - function requiresLeadingSpace(node) { - const leftParenToken = sourceCode.getTokenBefore(node); - const tokenBeforeLeftParen = sourceCode.getTokenBefore(leftParenToken, { includeComments: true }); - const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParenToken, { includeComments: true }); - - return tokenBeforeLeftParen && - tokenBeforeLeftParen.range[1] === leftParenToken.range[0] && - leftParenToken.range[1] === tokenAfterLeftParen.range[0] && - !astUtils.canTokensBeAdjacent(tokenBeforeLeftParen, tokenAfterLeftParen); - } - - /** - * Determines whether a node should be followed by an additional space when removing parens - * @param {ASTNode} node node to evaluate; must be surrounded by parentheses - * @returns {boolean} `true` if a space should be inserted after the node - * @private - */ - function requiresTrailingSpace(node) { - const nextTwoTokens = sourceCode.getTokensAfter(node, { count: 2 }); - const rightParenToken = nextTwoTokens[0]; - const tokenAfterRightParen = nextTwoTokens[1]; - const tokenBeforeRightParen = sourceCode.getLastToken(node); - - return rightParenToken && tokenAfterRightParen && - !sourceCode.isSpaceBetweenTokens(rightParenToken, tokenAfterRightParen) && - !astUtils.canTokensBeAdjacent(tokenBeforeRightParen, tokenAfterRightParen); - } - - /** - * Determines if a given expression node is an IIFE - * @param {ASTNode} node The node to check - * @returns {boolean} `true` if the given node is an IIFE - */ - function isIIFE(node) { - const maybeCallNode = astUtils.skipChainExpression(node); - - return maybeCallNode.type === "CallExpression" && maybeCallNode.callee.type === "FunctionExpression"; - } - - /** - * Determines if the given node can be the assignment target in destructuring or the LHS of an assignment. - * This is to avoid an autofix that could change behavior because parsers mistakenly allow invalid syntax, - * such as `(a = b) = c` and `[(a = b) = c] = []`. Ideally, this function shouldn't be necessary. - * @param {ASTNode} [node] The node to check - * @returns {boolean} `true` if the given node can be a valid assignment target - */ - function canBeAssignmentTarget(node) { - return node && (node.type === "Identifier" || node.type === "MemberExpression"); - } - - /** - * Report the node - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function report(node) { - const leftParenToken = sourceCode.getTokenBefore(node); - const rightParenToken = sourceCode.getTokenAfter(node); - - if (!isParenthesisedTwice(node)) { - if (tokensToIgnore.has(sourceCode.getFirstToken(node))) { - return; - } - - if (isIIFE(node) && !isParenthesised(node.callee)) { - return; - } - - if (ALLOW_PARENS_AFTER_COMMENT_PATTERN) { - const commentsBeforeLeftParenToken = sourceCode.getCommentsBefore(leftParenToken); - const totalCommentsBeforeLeftParenTokenCount = commentsBeforeLeftParenToken.length; - const ignorePattern = new RegExp(ALLOW_PARENS_AFTER_COMMENT_PATTERN, "u"); - - if ( - totalCommentsBeforeLeftParenTokenCount > 0 && - ignorePattern.test(commentsBeforeLeftParenToken[totalCommentsBeforeLeftParenTokenCount - 1].value) - ) { - return; - } - } - } - - /** - * Finishes reporting - * @returns {void} - * @private - */ - function finishReport() { - context.report({ - node, - loc: leftParenToken.loc, - messageId: "unexpected", - fix(fixer) { - const parenthesizedSource = sourceCode.text.slice(leftParenToken.range[1], rightParenToken.range[0]); - - return fixer.replaceTextRange([ - leftParenToken.range[0], - rightParenToken.range[1] - ], (requiresLeadingSpace(node) ? " " : "") + parenthesizedSource + (requiresTrailingSpace(node) ? " " : "")); - } - }); - } - - if (reportsBuffer) { - reportsBuffer.reports.push({ node, finishReport }); - return; - } - - finishReport(); - } - - /** - * Evaluate a argument of the node. - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkArgumentWithPrecedence(node) { - if (hasExcessParensWithPrecedence(node.argument, precedence(node))) { - report(node.argument); - } - } - - /** - * Check if a member expression contains a call expression - * @param {ASTNode} node MemberExpression node to evaluate - * @returns {boolean} true if found, false if not - */ - function doesMemberExpressionContainCallExpression(node) { - let currentNode = node.object; - let currentNodeType = node.object.type; - - while (currentNodeType === "MemberExpression") { - currentNode = currentNode.object; - currentNodeType = currentNode.type; - } - - return currentNodeType === "CallExpression"; - } - - /** - * Evaluate a new call - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkCallNew(node) { - const callee = node.callee; - - if (hasExcessParensWithPrecedence(callee, precedence(node))) { - if ( - hasDoubleExcessParens(callee) || - !( - isIIFE(node) || - - // (new A)(); new (new A)(); - ( - callee.type === "NewExpression" && - !isNewExpressionWithParens(callee) && - !( - node.type === "NewExpression" && - !isNewExpressionWithParens(node) - ) - ) || - - // new (a().b)(); new (a.b().c); - ( - node.type === "NewExpression" && - callee.type === "MemberExpression" && - doesMemberExpressionContainCallExpression(callee) - ) || - - // (a?.b)(); (a?.())(); - ( - !node.optional && - callee.type === "ChainExpression" - ) - ) - ) { - report(node.callee); - } - } - node.arguments - .filter(arg => hasExcessParensWithPrecedence(arg, PRECEDENCE_OF_ASSIGNMENT_EXPR)) - .forEach(report); - } - - /** - * Evaluate binary logicals - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkBinaryLogical(node) { - const prec = precedence(node); - const leftPrecedence = precedence(node.left); - const rightPrecedence = precedence(node.right); - const isExponentiation = node.operator === "**"; - const shouldSkipLeft = NESTED_BINARY && (node.left.type === "BinaryExpression" || node.left.type === "LogicalExpression"); - const shouldSkipRight = NESTED_BINARY && (node.right.type === "BinaryExpression" || node.right.type === "LogicalExpression"); - - if (!shouldSkipLeft && hasExcessParens(node.left)) { - if ( - !(["AwaitExpression", "UnaryExpression"].includes(node.left.type) && isExponentiation) && - !astUtils.isMixedLogicalAndCoalesceExpressions(node.left, node) && - (leftPrecedence > prec || (leftPrecedence === prec && !isExponentiation)) || - isParenthesisedTwice(node.left) - ) { - report(node.left); - } - } - - if (!shouldSkipRight && hasExcessParens(node.right)) { - if ( - !astUtils.isMixedLogicalAndCoalesceExpressions(node.right, node) && - (rightPrecedence > prec || (rightPrecedence === prec && isExponentiation)) || - isParenthesisedTwice(node.right) - ) { - report(node.right); - } - } - } - - /** - * Check the parentheses around the super class of the given class definition. - * @param {ASTNode} node The node of class declarations to check. - * @returns {void} - */ - function checkClass(node) { - if (!node.superClass) { - return; - } - - /* - * If `node.superClass` is a LeftHandSideExpression, parentheses are extra. - * Otherwise, parentheses are needed. - */ - const hasExtraParens = precedence(node.superClass) > PRECEDENCE_OF_UPDATE_EXPR - ? hasExcessParens(node.superClass) - : hasDoubleExcessParens(node.superClass); - - if (hasExtraParens) { - report(node.superClass); - } - } - - /** - * Check the parentheses around the argument of the given spread operator. - * @param {ASTNode} node The node of spread elements/properties to check. - * @returns {void} - */ - function checkSpreadOperator(node) { - if (hasExcessParensWithPrecedence(node.argument, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(node.argument); - } - } - - /** - * Checks the parentheses for an ExpressionStatement or ExportDefaultDeclaration - * @param {ASTNode} node The ExpressionStatement.expression or ExportDefaultDeclaration.declaration node - * @returns {void} - */ - function checkExpressionOrExportStatement(node) { - const firstToken = isParenthesised(node) ? sourceCode.getTokenBefore(node) : sourceCode.getFirstToken(node); - const secondToken = sourceCode.getTokenAfter(firstToken, astUtils.isNotOpeningParenToken); - const thirdToken = secondToken ? sourceCode.getTokenAfter(secondToken) : null; - const tokenAfterClosingParens = secondToken ? sourceCode.getTokenAfter(secondToken, astUtils.isNotClosingParenToken) : null; - - if ( - astUtils.isOpeningParenToken(firstToken) && - ( - astUtils.isOpeningBraceToken(secondToken) || - secondToken.type === "Keyword" && ( - secondToken.value === "function" || - secondToken.value === "class" || - secondToken.value === "let" && - tokenAfterClosingParens && - ( - astUtils.isOpeningBracketToken(tokenAfterClosingParens) || - tokenAfterClosingParens.type === "Identifier" - ) - ) || - secondToken && secondToken.type === "Identifier" && secondToken.value === "async" && thirdToken && thirdToken.type === "Keyword" && thirdToken.value === "function" - ) - ) { - tokensToIgnore.add(secondToken); - } - - const hasExtraParens = node.parent.type === "ExportDefaultDeclaration" - ? hasExcessParensWithPrecedence(node, PRECEDENCE_OF_ASSIGNMENT_EXPR) - : hasExcessParens(node); - - if (hasExtraParens) { - report(node); - } - } - - /** - * Finds the path from the given node to the specified ancestor. - * @param {ASTNode} node First node in the path. - * @param {ASTNode} ancestor Last node in the path. - * @returns {ASTNode[]} Path, including both nodes. - * @throws {Error} If the given node does not have the specified ancestor. - */ - function pathToAncestor(node, ancestor) { - const path = [node]; - let currentNode = node; - - while (currentNode !== ancestor) { - - currentNode = currentNode.parent; - - /* c8 ignore start */ - if (currentNode === null) { - throw new Error("Nodes are not in the ancestor-descendant relationship."); - }/* c8 ignore stop */ - - path.push(currentNode); - } - - return path; - } - - /** - * Finds the path from the given node to the specified descendant. - * @param {ASTNode} node First node in the path. - * @param {ASTNode} descendant Last node in the path. - * @returns {ASTNode[]} Path, including both nodes. - * @throws {Error} If the given node does not have the specified descendant. - */ - function pathToDescendant(node, descendant) { - return pathToAncestor(descendant, node).reverse(); - } - - /** - * Checks whether the syntax of the given ancestor of an 'in' expression inside a for-loop initializer - * is preventing the 'in' keyword from being interpreted as a part of an ill-formed for-in loop. - * @param {ASTNode} node Ancestor of an 'in' expression. - * @param {ASTNode} child Child of the node, ancestor of the same 'in' expression or the 'in' expression itself. - * @returns {boolean} True if the keyword 'in' would be interpreted as the 'in' operator, without any parenthesis. - */ - function isSafelyEnclosingInExpression(node, child) { - switch (node.type) { - case "ArrayExpression": - case "ArrayPattern": - case "BlockStatement": - case "ObjectExpression": - case "ObjectPattern": - case "TemplateLiteral": - return true; - case "ArrowFunctionExpression": - case "FunctionExpression": - return node.params.includes(child); - case "CallExpression": - case "NewExpression": - return node.arguments.includes(child); - case "MemberExpression": - return node.computed && node.property === child; - case "ConditionalExpression": - return node.consequent === child; - default: - return false; - } - } - - /** - * Starts a new reports buffering. Warnings will be stored in a buffer instead of being reported immediately. - * An additional logic that requires multiple nodes (e.g. a whole subtree) may dismiss some of the stored warnings. - * @returns {void} - */ - function startNewReportsBuffering() { - reportsBuffer = { - upper: reportsBuffer, - inExpressionNodes: [], - reports: [] - }; - } - - /** - * Ends the current reports buffering. - * @returns {void} - */ - function endCurrentReportsBuffering() { - const { upper, inExpressionNodes, reports } = reportsBuffer; - - if (upper) { - upper.inExpressionNodes.push(...inExpressionNodes); - upper.reports.push(...reports); - } else { - - // flush remaining reports - reports.forEach(({ finishReport }) => finishReport()); - } - - reportsBuffer = upper; - } - - /** - * Checks whether the given node is in the current reports buffer. - * @param {ASTNode} node Node to check. - * @returns {boolean} True if the node is in the current buffer, false otherwise. - */ - function isInCurrentReportsBuffer(node) { - return reportsBuffer.reports.some(r => r.node === node); - } - - /** - * Removes the given node from the current reports buffer. - * @param {ASTNode} node Node to remove. - * @returns {void} - */ - function removeFromCurrentReportsBuffer(node) { - reportsBuffer.reports = reportsBuffer.reports.filter(r => r.node !== node); - } - - /** - * Checks whether a node is a MemberExpression at NewExpression's callee. - * @param {ASTNode} node node to check. - * @returns {boolean} True if the node is a MemberExpression at NewExpression's callee. false otherwise. - */ - function isMemberExpInNewCallee(node) { - if (node.type === "MemberExpression") { - return node.parent.type === "NewExpression" && node.parent.callee === node - ? true - : node.parent.object === node && isMemberExpInNewCallee(node.parent); - } - return false; - } - - /** - * Checks if the left-hand side of an assignment is an identifier, the operator is one of - * `=`, `&&=`, `||=` or `??=` and the right-hand side is an anonymous class or function. - * - * As per https://tc39.es/ecma262/#sec-assignment-operators-runtime-semantics-evaluation, an - * assignment involving one of the operators `=`, `&&=`, `||=` or `??=` where the right-hand - * side is an anonymous class or function and the left-hand side is an *unparenthesized* - * identifier has different semantics than other assignments. - * Specifically, when an expression like `foo = function () {}` is evaluated, `foo.name` - * will be set to the string "foo", i.e. the identifier name. The same thing does not happen - * when evaluating `(foo) = function () {}`. - * Since the parenthesizing of the identifier in the left-hand side is significant in this - * special case, the parentheses, if present, should not be flagged as unnecessary. - * @param {ASTNode} node an AssignmentExpression node. - * @returns {boolean} `true` if the left-hand side of the assignment is an identifier, the - * operator is one of `=`, `&&=`, `||=` or `??=` and the right-hand side is an anonymous - * class or function; otherwise, `false`. - */ - function isAnonymousFunctionAssignmentException({ left, operator, right }) { - if (left.type === "Identifier" && ["=", "&&=", "||=", "??="].includes(operator)) { - const rhsType = right.type; - - if (rhsType === "ArrowFunctionExpression") { - return true; - } - if ((rhsType === "FunctionExpression" || rhsType === "ClassExpression") && !right.id) { - return true; - } - } - return false; - } - - return { - ArrayExpression(node) { - node.elements - .filter(e => e && hasExcessParensWithPrecedence(e, PRECEDENCE_OF_ASSIGNMENT_EXPR)) - .forEach(report); - }, - - ArrayPattern(node) { - node.elements - .filter(e => canBeAssignmentTarget(e) && hasExcessParens(e)) - .forEach(report); - }, - - ArrowFunctionExpression(node) { - if (isReturnAssignException(node)) { - return; - } - - if (node.body.type === "ConditionalExpression" && - IGNORE_ARROW_CONDITIONALS - ) { - return; - } - - if (node.body.type !== "BlockStatement") { - const firstBodyToken = sourceCode.getFirstToken(node.body, astUtils.isNotOpeningParenToken); - const tokenBeforeFirst = sourceCode.getTokenBefore(firstBodyToken); - - if (astUtils.isOpeningParenToken(tokenBeforeFirst) && astUtils.isOpeningBraceToken(firstBodyToken)) { - tokensToIgnore.add(firstBodyToken); - } - if (hasExcessParensWithPrecedence(node.body, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(node.body); - } - } - }, - - AssignmentExpression(node) { - if (canBeAssignmentTarget(node.left) && hasExcessParens(node.left) && - (!isAnonymousFunctionAssignmentException(node) || isParenthesisedTwice(node.left))) { - report(node.left); - } - - if (!isReturnAssignException(node) && hasExcessParensWithPrecedence(node.right, precedence(node))) { - report(node.right); - } - }, - - BinaryExpression(node) { - if (reportsBuffer && node.operator === "in") { - reportsBuffer.inExpressionNodes.push(node); - } - - checkBinaryLogical(node); - }, - - CallExpression: checkCallNew, - - ConditionalExpression(node) { - if (isReturnAssignException(node)) { - return; - } - if ( - !isCondAssignException(node) && - hasExcessParensWithPrecedence(node.test, precedence({ type: "LogicalExpression", operator: "||" })) - ) { - report(node.test); - } - - if (hasExcessParensWithPrecedence(node.consequent, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(node.consequent); - } - - if (hasExcessParensWithPrecedence(node.alternate, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(node.alternate); - } - }, - - DoWhileStatement(node) { - if (hasExcessParens(node.test) && !isCondAssignException(node)) { - report(node.test); - } - }, - - ExportDefaultDeclaration: node => checkExpressionOrExportStatement(node.declaration), - ExpressionStatement: node => checkExpressionOrExportStatement(node.expression), - - ForInStatement(node) { - if (node.left.type !== "VariableDeclaration") { - const firstLeftToken = sourceCode.getFirstToken(node.left, astUtils.isNotOpeningParenToken); - - if ( - firstLeftToken.value === "let" && - astUtils.isOpeningBracketToken( - sourceCode.getTokenAfter(firstLeftToken, astUtils.isNotClosingParenToken) - ) - ) { - - // ForInStatement#left expression cannot start with `let[`. - tokensToIgnore.add(firstLeftToken); - } - } - - if (hasExcessParens(node.left)) { - report(node.left); - } - - if (hasExcessParens(node.right)) { - report(node.right); - } - }, - - ForOfStatement(node) { - if (node.left.type !== "VariableDeclaration") { - const firstLeftToken = sourceCode.getFirstToken(node.left, astUtils.isNotOpeningParenToken); - - if (firstLeftToken.value === "let") { - - // ForOfStatement#left expression cannot start with `let`. - tokensToIgnore.add(firstLeftToken); - } - } - - if (hasExcessParens(node.left)) { - report(node.left); - } - - if (hasExcessParensWithPrecedence(node.right, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(node.right); - } - }, - - ForStatement(node) { - if (node.test && hasExcessParens(node.test) && !isCondAssignException(node)) { - report(node.test); - } - - if (node.update && hasExcessParens(node.update)) { - report(node.update); - } - - if (node.init) { - - if (node.init.type !== "VariableDeclaration") { - const firstToken = sourceCode.getFirstToken(node.init, astUtils.isNotOpeningParenToken); - - if ( - firstToken.value === "let" && - astUtils.isOpeningBracketToken( - sourceCode.getTokenAfter(firstToken, astUtils.isNotClosingParenToken) - ) - ) { - - // ForStatement#init expression cannot start with `let[`. - tokensToIgnore.add(firstToken); - } - } - - startNewReportsBuffering(); - - if (hasExcessParens(node.init)) { - report(node.init); - } - } - }, - - "ForStatement > *.init:exit"(node) { - - /* - * Removing parentheses around `in` expressions might change semantics and cause errors. - * - * For example, this valid for loop: - * for (let a = (b in c); ;); - * after removing parentheses would be treated as an invalid for-in loop: - * for (let a = b in c; ;); - */ - - if (reportsBuffer.reports.length) { - reportsBuffer.inExpressionNodes.forEach(inExpressionNode => { - const path = pathToDescendant(node, inExpressionNode); - let nodeToExclude; - - for (let i = 0; i < path.length; i++) { - const pathNode = path[i]; - - if (i < path.length - 1) { - const nextPathNode = path[i + 1]; - - if (isSafelyEnclosingInExpression(pathNode, nextPathNode)) { - - // The 'in' expression in safely enclosed by the syntax of its ancestor nodes (e.g. by '{}' or '[]'). - return; - } - } - - if (isParenthesised(pathNode)) { - if (isInCurrentReportsBuffer(pathNode)) { - - // This node was supposed to be reported, but parentheses might be necessary. - - if (isParenthesisedTwice(pathNode)) { - - /* - * This node is parenthesised twice, it certainly has at least one pair of `extra` parentheses. - * If the --fix option is on, the current fixing iteration will remove only one pair of parentheses. - * The remaining pair is safely enclosing the 'in' expression. - */ - return; - } - - // Exclude the outermost node only. - if (!nodeToExclude) { - nodeToExclude = pathNode; - } - - // Don't break the loop here, there might be some safe nodes or parentheses that will stay inside. - - } else { - - // This node will stay parenthesised, the 'in' expression in safely enclosed by '()'. - return; - } - } - } - - // Exclude the node from the list (i.e. treat parentheses as necessary) - removeFromCurrentReportsBuffer(nodeToExclude); - }); - } - - endCurrentReportsBuffering(); - }, - - IfStatement(node) { - if (hasExcessParens(node.test) && !isCondAssignException(node)) { - report(node.test); - } - }, - - ImportExpression(node) { - const { source } = node; - - if (source.type === "SequenceExpression") { - if (hasDoubleExcessParens(source)) { - report(source); - } - } else if (hasExcessParens(source)) { - report(source); - } - }, - - LogicalExpression: checkBinaryLogical, - - MemberExpression(node) { - const shouldAllowWrapOnce = isMemberExpInNewCallee(node) && - doesMemberExpressionContainCallExpression(node); - const nodeObjHasExcessParens = shouldAllowWrapOnce - ? hasDoubleExcessParens(node.object) - : hasExcessParens(node.object) && - !( - isImmediateFunctionPrototypeMethodCall(node.parent) && - node.parent.callee === node && - IGNORE_FUNCTION_PROTOTYPE_METHODS - ); - - if ( - nodeObjHasExcessParens && - precedence(node.object) >= precedence(node) && - ( - node.computed || - !( - astUtils.isDecimalInteger(node.object) || - - // RegExp literal is allowed to have parens (#1589) - (node.object.type === "Literal" && node.object.regex) - ) - ) - ) { - report(node.object); - } - - if (nodeObjHasExcessParens && - node.object.type === "CallExpression" - ) { - report(node.object); - } - - if (nodeObjHasExcessParens && - !IGNORE_NEW_IN_MEMBER_EXPR && - node.object.type === "NewExpression" && - isNewExpressionWithParens(node.object)) { - report(node.object); - } - - if (nodeObjHasExcessParens && - node.optional && - node.object.type === "ChainExpression" - ) { - report(node.object); - } - - if (node.computed && hasExcessParens(node.property)) { - report(node.property); - } - }, - - "MethodDefinition[computed=true]"(node) { - if (hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(node.key); - } - }, - - NewExpression: checkCallNew, - - ObjectExpression(node) { - node.properties - .filter(property => property.value && hasExcessParensWithPrecedence(property.value, PRECEDENCE_OF_ASSIGNMENT_EXPR)) - .forEach(property => report(property.value)); - }, - - ObjectPattern(node) { - node.properties - .filter(property => { - const value = property.value; - - return canBeAssignmentTarget(value) && hasExcessParens(value); - }).forEach(property => report(property.value)); - }, - - Property(node) { - if (node.computed) { - const { key } = node; - - if (key && hasExcessParensWithPrecedence(key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(key); - } - } - }, - - PropertyDefinition(node) { - if (node.computed && hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(node.key); - } - - if (node.value && hasExcessParensWithPrecedence(node.value, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(node.value); - } - }, - - RestElement(node) { - const argument = node.argument; - - if (canBeAssignmentTarget(argument) && hasExcessParens(argument)) { - report(argument); - } - }, - - ReturnStatement(node) { - const returnToken = sourceCode.getFirstToken(node); - - if (isReturnAssignException(node)) { - return; - } - - if (node.argument && - hasExcessParensNoLineTerminator(returnToken, node.argument) && - - // RegExp literal is allowed to have parens (#1589) - !(node.argument.type === "Literal" && node.argument.regex)) { - report(node.argument); - } - }, - - SequenceExpression(node) { - const precedenceOfNode = precedence(node); - - node.expressions - .filter(e => hasExcessParensWithPrecedence(e, precedenceOfNode)) - .forEach(report); - }, - - SwitchCase(node) { - if (node.test && hasExcessParens(node.test)) { - report(node.test); - } - }, - - SwitchStatement(node) { - if (hasExcessParens(node.discriminant)) { - report(node.discriminant); - } - }, - - ThrowStatement(node) { - const throwToken = sourceCode.getFirstToken(node); - - if (hasExcessParensNoLineTerminator(throwToken, node.argument)) { - report(node.argument); - } - }, - - UnaryExpression: checkArgumentWithPrecedence, - UpdateExpression(node) { - if (node.prefix) { - checkArgumentWithPrecedence(node); - } else { - const { argument } = node; - const operatorToken = sourceCode.getLastToken(node); - - if (argument.loc.end.line === operatorToken.loc.start.line) { - checkArgumentWithPrecedence(node); - } else { - if (hasDoubleExcessParens(argument)) { - report(argument); - } - } - } - }, - AwaitExpression: checkArgumentWithPrecedence, - - VariableDeclarator(node) { - if ( - node.init && hasExcessParensWithPrecedence(node.init, PRECEDENCE_OF_ASSIGNMENT_EXPR) && - - // RegExp literal is allowed to have parens (#1589) - !(node.init.type === "Literal" && node.init.regex) - ) { - report(node.init); - } - }, - - WhileStatement(node) { - if (hasExcessParens(node.test) && !isCondAssignException(node)) { - report(node.test); - } - }, - - WithStatement(node) { - if (hasExcessParens(node.object)) { - report(node.object); - } - }, - - YieldExpression(node) { - if (node.argument) { - const yieldToken = sourceCode.getFirstToken(node); - - if ((precedence(node.argument) >= precedence(node) && - hasExcessParensNoLineTerminator(yieldToken, node.argument)) || - hasDoubleExcessParens(node.argument)) { - report(node.argument); - } - } - }, - - ClassDeclaration: checkClass, - ClassExpression: checkClass, - - SpreadElement: checkSpreadOperator, - SpreadProperty: checkSpreadOperator, - ExperimentalSpreadProperty: checkSpreadOperator, - - TemplateLiteral(node) { - node.expressions - .filter(e => e && hasExcessParens(e)) - .forEach(report); - }, - - AssignmentPattern(node) { - const { left, right } = node; - - if (canBeAssignmentTarget(left) && hasExcessParens(left)) { - report(left); - } - - if (right && hasExcessParensWithPrecedence(right, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(right); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-extra-semi.js b/node_modules/eslint/lib/rules/no-extra-semi.js deleted file mode 100644 index ebf145f9c..000000000 --- a/node_modules/eslint/lib/rules/no-extra-semi.js +++ /dev/null @@ -1,126 +0,0 @@ -/** - * @fileoverview Rule to flag use of unnecessary semicolons - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const FixTracker = require("./utils/fix-tracker"); -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary semicolons", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-extra-semi" - }, - - fixable: "code", - schema: [], - - messages: { - unexpected: "Unnecessary semicolon." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Reports an unnecessary semicolon error. - * @param {Node|Token} nodeOrToken A node or a token to be reported. - * @returns {void} - */ - function report(nodeOrToken) { - context.report({ - node: nodeOrToken, - messageId: "unexpected", - fix(fixer) { - - /* - * Expand the replacement range to include the surrounding - * tokens to avoid conflicting with semi. - * https://github.com/eslint/eslint/issues/7928 - */ - return new FixTracker(fixer, context.sourceCode) - .retainSurroundingTokens(nodeOrToken) - .remove(nodeOrToken); - } - }); - } - - /** - * Checks for a part of a class body. - * This checks tokens from a specified token to a next MethodDefinition or the end of class body. - * @param {Token} firstToken The first token to check. - * @returns {void} - */ - function checkForPartOfClassBody(firstToken) { - for (let token = firstToken; - token.type === "Punctuator" && !astUtils.isClosingBraceToken(token); - token = sourceCode.getTokenAfter(token) - ) { - if (astUtils.isSemicolonToken(token)) { - report(token); - } - } - } - - return { - - /** - * Reports this empty statement, except if the parent node is a loop. - * @param {Node} node A EmptyStatement node to be reported. - * @returns {void} - */ - EmptyStatement(node) { - const parent = node.parent, - allowedParentTypes = [ - "ForStatement", - "ForInStatement", - "ForOfStatement", - "WhileStatement", - "DoWhileStatement", - "IfStatement", - "LabeledStatement", - "WithStatement" - ]; - - if (!allowedParentTypes.includes(parent.type)) { - report(node); - } - }, - - /** - * Checks tokens from the head of this class body to the first MethodDefinition or the end of this class body. - * @param {Node} node A ClassBody node to check. - * @returns {void} - */ - ClassBody(node) { - checkForPartOfClassBody(sourceCode.getFirstToken(node, 1)); // 0 is `{`. - }, - - /** - * Checks tokens from this MethodDefinition to the next MethodDefinition or the end of this class body. - * @param {Node} node A MethodDefinition node of the start point. - * @returns {void} - */ - "MethodDefinition, PropertyDefinition, StaticBlock"(node) { - checkForPartOfClassBody(sourceCode.getTokenAfter(node)); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-fallthrough.js b/node_modules/eslint/lib/rules/no-fallthrough.js deleted file mode 100644 index bd2ee9bbe..000000000 --- a/node_modules/eslint/lib/rules/no-fallthrough.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * @fileoverview Rule to flag fall-through cases in switch statements. - * @author Matt DuVall - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { directivesPattern } = require("../shared/directives"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const DEFAULT_FALLTHROUGH_COMMENT = /falls?\s?through/iu; - -/** - * Checks whether or not a given comment string is really a fallthrough comment and not an ESLint directive. - * @param {string} comment The comment string to check. - * @param {RegExp} fallthroughCommentPattern The regular expression used for checking for fallthrough comments. - * @returns {boolean} `true` if the comment string is truly a fallthrough comment. - */ -function isFallThroughComment(comment, fallthroughCommentPattern) { - return fallthroughCommentPattern.test(comment) && !directivesPattern.test(comment.trim()); -} - -/** - * Checks whether or not a given case has a fallthrough comment. - * @param {ASTNode} caseWhichFallsThrough SwitchCase node which falls through. - * @param {ASTNode} subsequentCase The case after caseWhichFallsThrough. - * @param {RuleContext} context A rule context which stores comments. - * @param {RegExp} fallthroughCommentPattern A pattern to match comment to. - * @returns {boolean} `true` if the case has a valid fallthrough comment. - */ -function hasFallthroughComment(caseWhichFallsThrough, subsequentCase, context, fallthroughCommentPattern) { - const sourceCode = context.sourceCode; - - if (caseWhichFallsThrough.consequent.length === 1 && caseWhichFallsThrough.consequent[0].type === "BlockStatement") { - const trailingCloseBrace = sourceCode.getLastToken(caseWhichFallsThrough.consequent[0]); - const commentInBlock = sourceCode.getCommentsBefore(trailingCloseBrace).pop(); - - if (commentInBlock && isFallThroughComment(commentInBlock.value, fallthroughCommentPattern)) { - return true; - } - } - - const comment = sourceCode.getCommentsBefore(subsequentCase).pop(); - - return Boolean(comment && isFallThroughComment(comment.value, fallthroughCommentPattern)); -} - -/** - * Checks whether or not a given code path segment is reachable. - * @param {CodePathSegment} segment A CodePathSegment to check. - * @returns {boolean} `true` if the segment is reachable. - */ -function isReachable(segment) { - return segment.reachable; -} - -/** - * Checks whether a node and a token are separated by blank lines - * @param {ASTNode} node The node to check - * @param {Token} token The token to compare against - * @returns {boolean} `true` if there are blank lines between node and token - */ -function hasBlankLinesBetween(node, token) { - return token.loc.start.line > node.loc.end.line + 1; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow fallthrough of `case` statements", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-fallthrough" - }, - - schema: [ - { - type: "object", - properties: { - commentPattern: { - type: "string", - default: "" - }, - allowEmptyCase: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - messages: { - case: "Expected a 'break' statement before 'case'.", - default: "Expected a 'break' statement before 'default'." - } - }, - - create(context) { - const options = context.options[0] || {}; - let currentCodePath = null; - const sourceCode = context.sourceCode; - const allowEmptyCase = options.allowEmptyCase || false; - - /* - * We need to use leading comments of the next SwitchCase node because - * trailing comments is wrong if semicolons are omitted. - */ - let fallthroughCase = null; - let fallthroughCommentPattern = null; - - if (options.commentPattern) { - fallthroughCommentPattern = new RegExp(options.commentPattern, "u"); - } else { - fallthroughCommentPattern = DEFAULT_FALLTHROUGH_COMMENT; - } - return { - onCodePathStart(codePath) { - currentCodePath = codePath; - }, - onCodePathEnd() { - currentCodePath = currentCodePath.upper; - }, - - SwitchCase(node) { - - /* - * Checks whether or not there is a fallthrough comment. - * And reports the previous fallthrough node if that does not exist. - */ - - if (fallthroughCase && (!hasFallthroughComment(fallthroughCase, node, context, fallthroughCommentPattern))) { - context.report({ - messageId: node.test ? "case" : "default", - node - }); - } - fallthroughCase = null; - }, - - "SwitchCase:exit"(node) { - const nextToken = sourceCode.getTokenAfter(node); - - /* - * `reachable` meant fall through because statements preceded by - * `break`, `return`, or `throw` are unreachable. - * And allows empty cases and the last case. - */ - if (currentCodePath.currentSegments.some(isReachable) && - (node.consequent.length > 0 || (!allowEmptyCase && hasBlankLinesBetween(node, nextToken))) && - node.parent.cases[node.parent.cases.length - 1] !== node) { - fallthroughCase = node; - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-floating-decimal.js b/node_modules/eslint/lib/rules/no-floating-decimal.js deleted file mode 100644 index c26876440..000000000 --- a/node_modules/eslint/lib/rules/no-floating-decimal.js +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @fileoverview Rule to flag use of a leading/trailing decimal point in a numeric literal - * @author James Allardice - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow leading or trailing decimal points in numeric literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-floating-decimal" - }, - - schema: [], - fixable: "code", - messages: { - leading: "A leading decimal point can be confused with a dot.", - trailing: "A trailing decimal point can be confused with a dot." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - Literal(node) { - - if (typeof node.value === "number") { - if (node.raw.startsWith(".")) { - context.report({ - node, - messageId: "leading", - fix(fixer) { - const tokenBefore = sourceCode.getTokenBefore(node); - const needsSpaceBefore = tokenBefore && - tokenBefore.range[1] === node.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, `0${node.raw}`); - - return fixer.insertTextBefore(node, needsSpaceBefore ? " 0" : "0"); - } - }); - } - if (node.raw.indexOf(".") === node.raw.length - 1) { - context.report({ - node, - messageId: "trailing", - fix: fixer => fixer.insertTextAfter(node, "0") - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-func-assign.js b/node_modules/eslint/lib/rules/no-func-assign.js deleted file mode 100644 index 8084af6eb..000000000 --- a/node_modules/eslint/lib/rules/no-func-assign.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @fileoverview Rule to flag use of function declaration identifiers as variables. - * @author Ian Christian Myers - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow reassigning `function` declarations", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-func-assign" - }, - - schema: [], - - messages: { - isAFunction: "'{{name}}' is a function." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Reports a reference if is non initializer and writable. - * @param {References} references Collection of reference to check. - * @returns {void} - */ - function checkReference(references) { - astUtils.getModifyingReferences(references).forEach(reference => { - context.report({ - node: reference.identifier, - messageId: "isAFunction", - data: { - name: reference.identifier.name - } - }); - }); - } - - /** - * Finds and reports references that are non initializer and writable. - * @param {Variable} variable A variable to check. - * @returns {void} - */ - function checkVariable(variable) { - if (variable.defs[0].type === "FunctionName") { - checkReference(variable.references); - } - } - - /** - * Checks parameters of a given function node. - * @param {ASTNode} node A function node to check. - * @returns {void} - */ - function checkForFunction(node) { - sourceCode.getDeclaredVariables(node).forEach(checkVariable); - } - - return { - FunctionDeclaration: checkForFunction, - FunctionExpression: checkForFunction - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-global-assign.js b/node_modules/eslint/lib/rules/no-global-assign.js deleted file mode 100644 index 99ae7a2ee..000000000 --- a/node_modules/eslint/lib/rules/no-global-assign.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @fileoverview Rule to disallow assignments to native objects or read-only global variables - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow assignments to native objects or read-only global variables", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-global-assign" - }, - - schema: [ - { - type: "object", - properties: { - exceptions: { - type: "array", - items: { type: "string" }, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - globalShouldNotBeModified: "Read-only global '{{name}}' should not be modified." - } - }, - - create(context) { - const config = context.options[0]; - const sourceCode = context.sourceCode; - const exceptions = (config && config.exceptions) || []; - - /** - * Reports write references. - * @param {Reference} reference A reference to check. - * @param {int} index The index of the reference in the references. - * @param {Reference[]} references The array that the reference belongs to. - * @returns {void} - */ - function checkReference(reference, index, references) { - const identifier = reference.identifier; - - if (reference.init === false && - reference.isWrite() && - - /* - * Destructuring assignments can have multiple default value, - * so possibly there are multiple writeable references for the same identifier. - */ - (index === 0 || references[index - 1].identifier !== identifier) - ) { - context.report({ - node: identifier, - messageId: "globalShouldNotBeModified", - data: { - name: identifier.name - } - }); - } - } - - /** - * Reports write references if a given variable is read-only builtin. - * @param {Variable} variable A variable to check. - * @returns {void} - */ - function checkVariable(variable) { - if (variable.writeable === false && !exceptions.includes(variable.name)) { - variable.references.forEach(checkReference); - } - } - - return { - Program(node) { - const globalScope = sourceCode.getScope(node); - - globalScope.variables.forEach(checkVariable); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-implicit-coercion.js b/node_modules/eslint/lib/rules/no-implicit-coercion.js deleted file mode 100644 index 36baad383..000000000 --- a/node_modules/eslint/lib/rules/no-implicit-coercion.js +++ /dev/null @@ -1,380 +0,0 @@ -/** - * @fileoverview A rule to disallow the type conversions with shorter notations. - * @author Toru Nagashima - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const INDEX_OF_PATTERN = /^(?:i|lastI)ndexOf$/u; -const ALLOWABLE_OPERATORS = ["~", "!!", "+", "*"]; - -/** - * Parses and normalizes an option object. - * @param {Object} options An option object to parse. - * @returns {Object} The parsed and normalized option object. - */ -function parseOptions(options) { - return { - boolean: "boolean" in options ? options.boolean : true, - number: "number" in options ? options.number : true, - string: "string" in options ? options.string : true, - disallowTemplateShorthand: "disallowTemplateShorthand" in options ? options.disallowTemplateShorthand : false, - allow: options.allow || [] - }; -} - -/** - * Checks whether or not a node is a double logical negating. - * @param {ASTNode} node An UnaryExpression node to check. - * @returns {boolean} Whether or not the node is a double logical negating. - */ -function isDoubleLogicalNegating(node) { - return ( - node.operator === "!" && - node.argument.type === "UnaryExpression" && - node.argument.operator === "!" - ); -} - -/** - * Checks whether or not a node is a binary negating of `.indexOf()` method calling. - * @param {ASTNode} node An UnaryExpression node to check. - * @returns {boolean} Whether or not the node is a binary negating of `.indexOf()` method calling. - */ -function isBinaryNegatingOfIndexOf(node) { - if (node.operator !== "~") { - return false; - } - const callNode = astUtils.skipChainExpression(node.argument); - - return ( - callNode.type === "CallExpression" && - astUtils.isSpecificMemberAccess(callNode.callee, null, INDEX_OF_PATTERN) - ); -} - -/** - * Checks whether or not a node is a multiplying by one. - * @param {BinaryExpression} node A BinaryExpression node to check. - * @returns {boolean} Whether or not the node is a multiplying by one. - */ -function isMultiplyByOne(node) { - return node.operator === "*" && ( - node.left.type === "Literal" && node.left.value === 1 || - node.right.type === "Literal" && node.right.value === 1 - ); -} - -/** - * Checks whether the given node logically represents multiplication by a fraction of `1`. - * For example, `a * 1` in `a * 1 / b` is technically multiplication by `1`, but the - * whole expression can be logically interpreted as `a * (1 / b)` rather than `(a * 1) / b`. - * @param {BinaryExpression} node A BinaryExpression node to check. - * @param {SourceCode} sourceCode The source code object. - * @returns {boolean} Whether or not the node is a multiplying by a fraction of `1`. - */ -function isMultiplyByFractionOfOne(node, sourceCode) { - return node.type === "BinaryExpression" && - node.operator === "*" && - (node.right.type === "Literal" && node.right.value === 1) && - node.parent.type === "BinaryExpression" && - node.parent.operator === "/" && - node.parent.left === node && - !astUtils.isParenthesised(sourceCode, node); -} - -/** - * Checks whether the result of a node is numeric or not - * @param {ASTNode} node The node to test - * @returns {boolean} true if the node is a number literal or a `Number()`, `parseInt` or `parseFloat` call - */ -function isNumeric(node) { - return ( - node.type === "Literal" && typeof node.value === "number" || - node.type === "CallExpression" && ( - node.callee.name === "Number" || - node.callee.name === "parseInt" || - node.callee.name === "parseFloat" - ) - ); -} - -/** - * Returns the first non-numeric operand in a BinaryExpression. Designed to be - * used from bottom to up since it walks up the BinaryExpression trees using - * node.parent to find the result. - * @param {BinaryExpression} node The BinaryExpression node to be walked up on - * @returns {ASTNode|null} The first non-numeric item in the BinaryExpression tree or null - */ -function getNonNumericOperand(node) { - const left = node.left, - right = node.right; - - if (right.type !== "BinaryExpression" && !isNumeric(right)) { - return right; - } - - if (left.type !== "BinaryExpression" && !isNumeric(left)) { - return left; - } - - return null; -} - -/** - * Checks whether an expression evaluates to a string. - * @param {ASTNode} node node that represents the expression to check. - * @returns {boolean} Whether or not the expression evaluates to a string. - */ -function isStringType(node) { - return astUtils.isStringLiteral(node) || - ( - node.type === "CallExpression" && - node.callee.type === "Identifier" && - node.callee.name === "String" - ); -} - -/** - * Checks whether a node is an empty string literal or not. - * @param {ASTNode} node The node to check. - * @returns {boolean} Whether or not the passed in node is an - * empty string literal or not. - */ -function isEmptyString(node) { - return astUtils.isStringLiteral(node) && (node.value === "" || (node.type === "TemplateLiteral" && node.quasis.length === 1 && node.quasis[0].value.cooked === "")); -} - -/** - * Checks whether or not a node is a concatenating with an empty string. - * @param {ASTNode} node A BinaryExpression node to check. - * @returns {boolean} Whether or not the node is a concatenating with an empty string. - */ -function isConcatWithEmptyString(node) { - return node.operator === "+" && ( - (isEmptyString(node.left) && !isStringType(node.right)) || - (isEmptyString(node.right) && !isStringType(node.left)) - ); -} - -/** - * Checks whether or not a node is appended with an empty string. - * @param {ASTNode} node An AssignmentExpression node to check. - * @returns {boolean} Whether or not the node is appended with an empty string. - */ -function isAppendEmptyString(node) { - return node.operator === "+=" && isEmptyString(node.right); -} - -/** - * Returns the operand that is not an empty string from a flagged BinaryExpression. - * @param {ASTNode} node The flagged BinaryExpression node to check. - * @returns {ASTNode} The operand that is not an empty string from a flagged BinaryExpression. - */ -function getNonEmptyOperand(node) { - return isEmptyString(node.left) ? node.right : node.left; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow shorthand type conversions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-implicit-coercion" - }, - - fixable: "code", - - schema: [{ - type: "object", - properties: { - boolean: { - type: "boolean", - default: true - }, - number: { - type: "boolean", - default: true - }, - string: { - type: "boolean", - default: true - }, - disallowTemplateShorthand: { - type: "boolean", - default: false - }, - allow: { - type: "array", - items: { - enum: ALLOWABLE_OPERATORS - }, - uniqueItems: true - } - }, - additionalProperties: false - }], - - messages: { - useRecommendation: "use `{{recommendation}}` instead." - } - }, - - create(context) { - const options = parseOptions(context.options[0] || {}); - const sourceCode = context.sourceCode; - - /** - * Reports an error and autofixes the node - * @param {ASTNode} node An ast node to report the error on. - * @param {string} recommendation The recommended code for the issue - * @param {bool} shouldFix Whether this report should fix the node - * @returns {void} - */ - function report(node, recommendation, shouldFix) { - context.report({ - node, - messageId: "useRecommendation", - data: { - recommendation - }, - fix(fixer) { - if (!shouldFix) { - return null; - } - - const tokenBefore = sourceCode.getTokenBefore(node); - - if ( - tokenBefore && - tokenBefore.range[1] === node.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, recommendation) - ) { - return fixer.replaceText(node, ` ${recommendation}`); - } - return fixer.replaceText(node, recommendation); - } - }); - } - - return { - UnaryExpression(node) { - let operatorAllowed; - - // !!foo - operatorAllowed = options.allow.includes("!!"); - if (!operatorAllowed && options.boolean && isDoubleLogicalNegating(node)) { - const recommendation = `Boolean(${sourceCode.getText(node.argument.argument)})`; - - report(node, recommendation, true); - } - - // ~foo.indexOf(bar) - operatorAllowed = options.allow.includes("~"); - if (!operatorAllowed && options.boolean && isBinaryNegatingOfIndexOf(node)) { - - // `foo?.indexOf(bar) !== -1` will be true (== found) if the `foo` is nullish. So use `>= 0` in that case. - const comparison = node.argument.type === "ChainExpression" ? ">= 0" : "!== -1"; - const recommendation = `${sourceCode.getText(node.argument)} ${comparison}`; - - report(node, recommendation, false); - } - - // +foo - operatorAllowed = options.allow.includes("+"); - if (!operatorAllowed && options.number && node.operator === "+" && !isNumeric(node.argument)) { - const recommendation = `Number(${sourceCode.getText(node.argument)})`; - - report(node, recommendation, true); - } - }, - - // Use `:exit` to prevent double reporting - "BinaryExpression:exit"(node) { - let operatorAllowed; - - // 1 * foo - operatorAllowed = options.allow.includes("*"); - const nonNumericOperand = !operatorAllowed && options.number && isMultiplyByOne(node) && !isMultiplyByFractionOfOne(node, sourceCode) && - getNonNumericOperand(node); - - if (nonNumericOperand) { - const recommendation = `Number(${sourceCode.getText(nonNumericOperand)})`; - - report(node, recommendation, true); - } - - // "" + foo - operatorAllowed = options.allow.includes("+"); - if (!operatorAllowed && options.string && isConcatWithEmptyString(node)) { - const recommendation = `String(${sourceCode.getText(getNonEmptyOperand(node))})`; - - report(node, recommendation, true); - } - }, - - AssignmentExpression(node) { - - // foo += "" - const operatorAllowed = options.allow.includes("+"); - - if (!operatorAllowed && options.string && isAppendEmptyString(node)) { - const code = sourceCode.getText(getNonEmptyOperand(node)); - const recommendation = `${code} = String(${code})`; - - report(node, recommendation, true); - } - }, - - TemplateLiteral(node) { - if (!options.disallowTemplateShorthand) { - return; - } - - // tag`${foo}` - if (node.parent.type === "TaggedTemplateExpression") { - return; - } - - // `` or `${foo}${bar}` - if (node.expressions.length !== 1) { - return; - } - - - // `prefix${foo}` - if (node.quasis[0].value.cooked !== "") { - return; - } - - // `${foo}postfix` - if (node.quasis[1].value.cooked !== "") { - return; - } - - // if the expression is already a string, then this isn't a coercion - if (isStringType(node.expressions[0])) { - return; - } - - const code = sourceCode.getText(node.expressions[0]); - const recommendation = `String(${code})`; - - report(node, recommendation, true); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-implicit-globals.js b/node_modules/eslint/lib/rules/no-implicit-globals.js deleted file mode 100644 index 2a182477c..000000000 --- a/node_modules/eslint/lib/rules/no-implicit-globals.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * @fileoverview Rule to check for implicit global variables, functions and classes. - * @author Joshua Peek - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow declarations in the global scope", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-implicit-globals" - }, - - schema: [{ - type: "object", - properties: { - lexicalBindings: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - - messages: { - globalNonLexicalBinding: "Unexpected {{kind}} declaration in the global scope, wrap in an IIFE for a local variable, assign as global property for a global variable.", - globalLexicalBinding: "Unexpected {{kind}} declaration in the global scope, wrap in a block or in an IIFE.", - globalVariableLeak: "Global variable leak, declare the variable if it is intended to be local.", - assignmentToReadonlyGlobal: "Unexpected assignment to read-only global variable.", - redeclarationOfReadonlyGlobal: "Unexpected redeclaration of read-only global variable." - } - }, - - create(context) { - - const checkLexicalBindings = context.options[0] && context.options[0].lexicalBindings === true; - const sourceCode = context.sourceCode; - - /** - * Reports the node. - * @param {ASTNode} node Node to report. - * @param {string} messageId Id of the message to report. - * @param {string|undefined} kind Declaration kind, can be 'var', 'const', 'let', function or class. - * @returns {void} - */ - function report(node, messageId, kind) { - context.report({ - node, - messageId, - data: { - kind - } - }); - } - - return { - Program(node) { - const scope = sourceCode.getScope(node); - - scope.variables.forEach(variable => { - - // Only ESLint global variables have the `writable` key. - const isReadonlyEslintGlobalVariable = variable.writeable === false; - const isWritableEslintGlobalVariable = variable.writeable === true; - - if (isWritableEslintGlobalVariable) { - - // Everything is allowed with writable ESLint global variables. - return; - } - - // Variables exported by "exported" block comments - if (variable.eslintExported) { - return; - } - - variable.defs.forEach(def => { - const defNode = def.node; - - if (def.type === "FunctionName" || (def.type === "Variable" && def.parent.kind === "var")) { - if (isReadonlyEslintGlobalVariable) { - report(defNode, "redeclarationOfReadonlyGlobal"); - } else { - report( - defNode, - "globalNonLexicalBinding", - def.type === "FunctionName" ? "function" : `'${def.parent.kind}'` - ); - } - } - - if (checkLexicalBindings) { - if (def.type === "ClassName" || - (def.type === "Variable" && (def.parent.kind === "let" || def.parent.kind === "const"))) { - if (isReadonlyEslintGlobalVariable) { - report(defNode, "redeclarationOfReadonlyGlobal"); - } else { - report( - defNode, - "globalLexicalBinding", - def.type === "ClassName" ? "class" : `'${def.parent.kind}'` - ); - } - } - } - }); - }); - - // Undeclared assigned variables. - scope.implicit.variables.forEach(variable => { - const scopeVariable = scope.set.get(variable.name); - let messageId; - - if (scopeVariable) { - - // ESLint global variable - if (scopeVariable.writeable) { - return; - } - messageId = "assignmentToReadonlyGlobal"; - - } else { - - // Reference to an unknown variable, possible global leak. - messageId = "globalVariableLeak"; - } - - // def.node is an AssignmentExpression, ForInStatement or ForOfStatement. - variable.defs.forEach(def => { - report(def.node, messageId); - }); - }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-implied-eval.js b/node_modules/eslint/lib/rules/no-implied-eval.js deleted file mode 100644 index 9a84f8cba..000000000 --- a/node_modules/eslint/lib/rules/no-implied-eval.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @fileoverview Rule to flag use of implied eval via setTimeout and setInterval - * @author James Allardice - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { getStaticValue } = require("@eslint-community/eslint-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the use of `eval()`-like methods", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-implied-eval" - }, - - schema: [], - - messages: { - impliedEval: "Implied eval. Consider passing a function instead of a string." - } - }, - - create(context) { - const GLOBAL_CANDIDATES = Object.freeze(["global", "window", "globalThis"]); - const EVAL_LIKE_FUNC_PATTERN = /^(?:set(?:Interval|Timeout)|execScript)$/u; - const sourceCode = context.sourceCode; - - /** - * Checks whether a node is evaluated as a string or not. - * @param {ASTNode} node A node to check. - * @returns {boolean} True if the node is evaluated as a string. - */ - function isEvaluatedString(node) { - if ( - (node.type === "Literal" && typeof node.value === "string") || - node.type === "TemplateLiteral" - ) { - return true; - } - if (node.type === "BinaryExpression" && node.operator === "+") { - return isEvaluatedString(node.left) || isEvaluatedString(node.right); - } - return false; - } - - /** - * Reports if the `CallExpression` node has evaluated argument. - * @param {ASTNode} node A CallExpression to check. - * @returns {void} - */ - function reportImpliedEvalCallExpression(node) { - const [firstArgument] = node.arguments; - - if (firstArgument) { - - const staticValue = getStaticValue(firstArgument, sourceCode.getScope(node)); - const isStaticString = staticValue && typeof staticValue.value === "string"; - const isString = isStaticString || isEvaluatedString(firstArgument); - - if (isString) { - context.report({ - node, - messageId: "impliedEval" - }); - } - } - - } - - /** - * Reports calls of `implied eval` via the global references. - * @param {Variable} globalVar A global variable to check. - * @returns {void} - */ - function reportImpliedEvalViaGlobal(globalVar) { - const { references, name } = globalVar; - - references.forEach(ref => { - const identifier = ref.identifier; - let node = identifier.parent; - - while (astUtils.isSpecificMemberAccess(node, null, name)) { - node = node.parent; - } - - if (astUtils.isSpecificMemberAccess(node, null, EVAL_LIKE_FUNC_PATTERN)) { - const calleeNode = node.parent.type === "ChainExpression" ? node.parent : node; - const parent = calleeNode.parent; - - if (parent.type === "CallExpression" && parent.callee === calleeNode) { - reportImpliedEvalCallExpression(parent); - } - } - }); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - CallExpression(node) { - if (astUtils.isSpecificId(node.callee, EVAL_LIKE_FUNC_PATTERN)) { - reportImpliedEvalCallExpression(node); - } - }, - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - - GLOBAL_CANDIDATES - .map(candidate => astUtils.getVariableByName(globalScope, candidate)) - .filter(globalVar => !!globalVar && globalVar.defs.length === 0) - .forEach(reportImpliedEvalViaGlobal); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-import-assign.js b/node_modules/eslint/lib/rules/no-import-assign.js deleted file mode 100644 index c69988666..000000000 --- a/node_modules/eslint/lib/rules/no-import-assign.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * @fileoverview Rule to flag updates of imported bindings. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const { findVariable } = require("@eslint-community/eslint-utils"); -const astUtils = require("./utils/ast-utils"); - -const WellKnownMutationFunctions = { - Object: /^(?:assign|definePropert(?:y|ies)|freeze|setPrototypeOf)$/u, - Reflect: /^(?:(?:define|delete)Property|set(?:PrototypeOf)?)$/u -}; - -/** - * Check if a given node is LHS of an assignment node. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is LHS. - */ -function isAssignmentLeft(node) { - const { parent } = node; - - return ( - ( - parent.type === "AssignmentExpression" && - parent.left === node - ) || - - // Destructuring assignments - parent.type === "ArrayPattern" || - ( - parent.type === "Property" && - parent.value === node && - parent.parent.type === "ObjectPattern" - ) || - parent.type === "RestElement" || - ( - parent.type === "AssignmentPattern" && - parent.left === node - ) - ); -} - -/** - * Check if a given node is the operand of mutation unary operator. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is the operand of mutation unary operator. - */ -function isOperandOfMutationUnaryOperator(node) { - const argumentNode = node.parent.type === "ChainExpression" - ? node.parent - : node; - const { parent } = argumentNode; - - return ( - ( - parent.type === "UpdateExpression" && - parent.argument === argumentNode - ) || - ( - parent.type === "UnaryExpression" && - parent.operator === "delete" && - parent.argument === argumentNode - ) - ); -} - -/** - * Check if a given node is the iteration variable of `for-in`/`for-of` syntax. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is the iteration variable. - */ -function isIterationVariable(node) { - const { parent } = node; - - return ( - ( - parent.type === "ForInStatement" && - parent.left === node - ) || - ( - parent.type === "ForOfStatement" && - parent.left === node - ) - ); -} - -/** - * Check if a given node is at the first argument of a well-known mutation function. - * - `Object.assign` - * - `Object.defineProperty` - * - `Object.defineProperties` - * - `Object.freeze` - * - `Object.setPrototypeOf` - * - `Reflect.defineProperty` - * - `Reflect.deleteProperty` - * - `Reflect.set` - * - `Reflect.setPrototypeOf` - * @param {ASTNode} node The node to check. - * @param {Scope} scope A `escope.Scope` object to find variable (whichever). - * @returns {boolean} `true` if the node is at the first argument of a well-known mutation function. - */ -function isArgumentOfWellKnownMutationFunction(node, scope) { - const { parent } = node; - - if (parent.type !== "CallExpression" || parent.arguments[0] !== node) { - return false; - } - const callee = astUtils.skipChainExpression(parent.callee); - - if ( - !astUtils.isSpecificMemberAccess(callee, "Object", WellKnownMutationFunctions.Object) && - !astUtils.isSpecificMemberAccess(callee, "Reflect", WellKnownMutationFunctions.Reflect) - ) { - return false; - } - const variable = findVariable(scope, callee.object); - - return variable !== null && variable.scope.type === "global"; -} - -/** - * Check if the identifier node is placed at to update members. - * @param {ASTNode} id The Identifier node to check. - * @param {Scope} scope A `escope.Scope` object to find variable (whichever). - * @returns {boolean} `true` if the member of `id` was updated. - */ -function isMemberWrite(id, scope) { - const { parent } = id; - - return ( - ( - parent.type === "MemberExpression" && - parent.object === id && - ( - isAssignmentLeft(parent) || - isOperandOfMutationUnaryOperator(parent) || - isIterationVariable(parent) - ) - ) || - isArgumentOfWellKnownMutationFunction(id, scope) - ); -} - -/** - * Get the mutation node. - * @param {ASTNode} id The Identifier node to get. - * @returns {ASTNode} The mutation node. - */ -function getWriteNode(id) { - let node = id.parent; - - while ( - node && - node.type !== "AssignmentExpression" && - node.type !== "UpdateExpression" && - node.type !== "UnaryExpression" && - node.type !== "CallExpression" && - node.type !== "ForInStatement" && - node.type !== "ForOfStatement" - ) { - node = node.parent; - } - - return node || id; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow assigning to imported bindings", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-import-assign" - }, - - schema: [], - - messages: { - readonly: "'{{name}}' is read-only.", - readonlyMember: "The members of '{{name}}' are read-only." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - ImportDeclaration(node) { - const scope = sourceCode.getScope(node); - - for (const variable of sourceCode.getDeclaredVariables(node)) { - const shouldCheckMembers = variable.defs.some( - d => d.node.type === "ImportNamespaceSpecifier" - ); - let prevIdNode = null; - - for (const reference of variable.references) { - const idNode = reference.identifier; - - /* - * AssignmentPattern (e.g. `[a = 0] = b`) makes two write - * references for the same identifier. This should skip - * the one of the two in order to prevent redundant reports. - */ - if (idNode === prevIdNode) { - continue; - } - prevIdNode = idNode; - - if (reference.isWrite()) { - context.report({ - node: getWriteNode(idNode), - messageId: "readonly", - data: { name: idNode.name } - }); - } else if (shouldCheckMembers && isMemberWrite(idNode, scope)) { - context.report({ - node: getWriteNode(idNode), - messageId: "readonlyMember", - data: { name: idNode.name } - }); - } - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-inline-comments.js b/node_modules/eslint/lib/rules/no-inline-comments.js deleted file mode 100644 index d96e6472d..000000000 --- a/node_modules/eslint/lib/rules/no-inline-comments.js +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @fileoverview Enforces or disallows inline comments. - * @author Greg Cochard - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow inline comments after code", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-inline-comments" - }, - - schema: [ - { - type: "object", - properties: { - ignorePattern: { - type: "string" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedInlineComment: "Unexpected comment inline with code." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const options = context.options[0]; - let customIgnoreRegExp; - - if (options && options.ignorePattern) { - customIgnoreRegExp = new RegExp(options.ignorePattern, "u"); - } - - /** - * Will check that comments are not on lines starting with or ending with code - * @param {ASTNode} node The comment node to check - * @private - * @returns {void} - */ - function testCodeAroundComment(node) { - - const startLine = String(sourceCode.lines[node.loc.start.line - 1]), - endLine = String(sourceCode.lines[node.loc.end.line - 1]), - preamble = startLine.slice(0, node.loc.start.column).trim(), - postamble = endLine.slice(node.loc.end.column).trim(), - isPreambleEmpty = !preamble, - isPostambleEmpty = !postamble; - - // Nothing on both sides - if (isPreambleEmpty && isPostambleEmpty) { - return; - } - - // Matches the ignore pattern - if (customIgnoreRegExp && customIgnoreRegExp.test(node.value)) { - return; - } - - // JSX Exception - if ( - (isPreambleEmpty || preamble === "{") && - (isPostambleEmpty || postamble === "}") - ) { - const enclosingNode = sourceCode.getNodeByRangeIndex(node.range[0]); - - if (enclosingNode && enclosingNode.type === "JSXEmptyExpression") { - return; - } - } - - // Don't report ESLint directive comments - if (astUtils.isDirectiveComment(node)) { - return; - } - - context.report({ - node, - messageId: "unexpectedInlineComment" - }); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - Program() { - sourceCode.getAllComments() - .filter(token => token.type !== "Shebang") - .forEach(testCodeAroundComment); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-inner-declarations.js b/node_modules/eslint/lib/rules/no-inner-declarations.js deleted file mode 100644 index f4bae43e5..000000000 --- a/node_modules/eslint/lib/rules/no-inner-declarations.js +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @fileoverview Rule to enforce declarations in program or function body root. - * @author Brandon Mills - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const validParent = new Set(["Program", "StaticBlock", "ExportNamedDeclaration", "ExportDefaultDeclaration"]); -const validBlockStatementParent = new Set(["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]); - -/** - * Finds the nearest enclosing context where this rule allows declarations and returns its description. - * @param {ASTNode} node Node to search from. - * @returns {string} Description. One of "program", "function body", "class static block body". - */ -function getAllowedBodyDescription(node) { - let { parent } = node; - - while (parent) { - - if (parent.type === "StaticBlock") { - return "class static block body"; - } - - if (astUtils.isFunction(parent)) { - return "function body"; - } - - ({ parent } = parent); - } - - return "program"; -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow variable or `function` declarations in nested blocks", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-inner-declarations" - }, - - schema: [ - { - enum: ["functions", "both"] - } - ], - - messages: { - moveDeclToRoot: "Move {{type}} declaration to {{body}} root." - } - }, - - create(context) { - - /** - * Ensure that a given node is at a program or function body's root. - * @param {ASTNode} node Declaration node to check. - * @returns {void} - */ - function check(node) { - const parent = node.parent; - - if ( - parent.type === "BlockStatement" && validBlockStatementParent.has(parent.parent.type) - ) { - return; - } - - if (validParent.has(parent.type)) { - return; - } - - context.report({ - node, - messageId: "moveDeclToRoot", - data: { - type: (node.type === "FunctionDeclaration" ? "function" : "variable"), - body: getAllowedBodyDescription(node) - } - }); - } - - - return { - - FunctionDeclaration: check, - VariableDeclaration(node) { - if (context.options[0] === "both" && node.kind === "var") { - check(node); - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-invalid-regexp.js b/node_modules/eslint/lib/rules/no-invalid-regexp.js deleted file mode 100644 index 9a35743d1..000000000 --- a/node_modules/eslint/lib/rules/no-invalid-regexp.js +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @fileoverview Validate strings passed to the RegExp constructor - * @author Michael Ficarra - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const RegExpValidator = require("@eslint-community/regexpp").RegExpValidator; -const validator = new RegExpValidator(); -const validFlags = /[dgimsuy]/gu; -const undefined1 = void 0; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow invalid regular expression strings in `RegExp` constructors", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-invalid-regexp" - }, - - schema: [{ - type: "object", - properties: { - allowConstructorFlags: { - type: "array", - items: { - type: "string" - } - } - }, - additionalProperties: false - }], - - messages: { - regexMessage: "{{message}}." - } - }, - - create(context) { - - const options = context.options[0]; - let allowedFlags = null; - - if (options && options.allowConstructorFlags) { - const temp = options.allowConstructorFlags.join("").replace(validFlags, ""); - - if (temp) { - allowedFlags = new RegExp(`[${temp}]`, "giu"); - } - } - - /** - * Reports error with the provided message. - * @param {ASTNode} node The node holding the invalid RegExp - * @param {string} message The message to report. - * @returns {void} - */ - function report(node, message) { - context.report({ - node, - messageId: "regexMessage", - data: { message } - }); - } - - /** - * Check if node is a string - * @param {ASTNode} node node to evaluate - * @returns {boolean} True if its a string - * @private - */ - function isString(node) { - return node && node.type === "Literal" && typeof node.value === "string"; - } - - /** - * Gets flags of a regular expression created by the given `RegExp()` or `new RegExp()` call - * Examples: - * new RegExp(".") // => "" - * new RegExp(".", "gu") // => "gu" - * new RegExp(".", flags) // => null - * @param {ASTNode} node `CallExpression` or `NewExpression` node - * @returns {string|null} flags if they can be determined, `null` otherwise - * @private - */ - function getFlags(node) { - if (node.arguments.length < 2) { - return ""; - } - - if (isString(node.arguments[1])) { - return node.arguments[1].value; - } - - return null; - } - - /** - * Check syntax error in a given pattern. - * @param {string} pattern The RegExp pattern to validate. - * @param {boolean} uFlag The Unicode flag. - * @returns {string|null} The syntax error. - */ - function validateRegExpPattern(pattern, uFlag) { - try { - validator.validatePattern(pattern, undefined1, undefined1, uFlag); - return null; - } catch (err) { - return err.message; - } - } - - /** - * Check syntax error in a given flags. - * @param {string|null} flags The RegExp flags to validate. - * @returns {string|null} The syntax error. - */ - function validateRegExpFlags(flags) { - if (!flags) { - return null; - } - try { - validator.validateFlags(flags); - return null; - } catch { - return `Invalid flags supplied to RegExp constructor '${flags}'`; - } - } - - return { - "CallExpression, NewExpression"(node) { - if (node.callee.type !== "Identifier" || node.callee.name !== "RegExp") { - return; - } - - let flags = getFlags(node); - - if (flags && allowedFlags) { - flags = flags.replace(allowedFlags, ""); - } - - let message = validateRegExpFlags(flags); - - if (message) { - report(node, message); - return; - } - - if (!isString(node.arguments[0])) { - return; - } - - const pattern = node.arguments[0].value; - - message = ( - - // If flags are unknown, report the regex only if its pattern is invalid both with and without the "u" flag - flags === null - ? validateRegExpPattern(pattern, true) && validateRegExpPattern(pattern, false) - : validateRegExpPattern(pattern, flags.includes("u")) - ); - - if (message) { - report(node, message); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-invalid-this.js b/node_modules/eslint/lib/rules/no-invalid-this.js deleted file mode 100644 index 49ecbe514..000000000 --- a/node_modules/eslint/lib/rules/no-invalid-this.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * @fileoverview A rule to disallow `this` keywords in contexts where the value of `this` is `undefined`. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines if the given code path is a code path with lexical `this` binding. - * That is, if `this` within the code path refers to `this` of surrounding code path. - * @param {CodePath} codePath Code path. - * @param {ASTNode} node Node that started the code path. - * @returns {boolean} `true` if it is a code path with lexical `this` binding. - */ -function isCodePathWithLexicalThis(codePath, node) { - return codePath.origin === "function" && node.type === "ArrowFunctionExpression"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow use of `this` in contexts where the value of `this` is `undefined`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-invalid-this" - }, - - schema: [ - { - type: "object", - properties: { - capIsConstructor: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedThis: "Unexpected 'this'." - } - }, - - create(context) { - const options = context.options[0] || {}; - const capIsConstructor = options.capIsConstructor !== false; - const stack = [], - sourceCode = context.sourceCode; - - /** - * Gets the current checking context. - * - * The return value has a flag that whether or not `this` keyword is valid. - * The flag is initialized when got at the first time. - * @returns {{valid: boolean}} - * an object which has a flag that whether or not `this` keyword is valid. - */ - stack.getCurrent = function() { - const current = this[this.length - 1]; - - if (!current.init) { - current.init = true; - current.valid = !astUtils.isDefaultThisBinding( - current.node, - sourceCode, - { capIsConstructor } - ); - } - return current; - }; - - return { - - onCodePathStart(codePath, node) { - if (isCodePathWithLexicalThis(codePath, node)) { - return; - } - - if (codePath.origin === "program") { - const scope = sourceCode.getScope(node); - const features = context.parserOptions.ecmaFeatures || {}; - - // `this` at the top level of scripts always refers to the global object - stack.push({ - init: true, - node, - valid: !( - node.sourceType === "module" || - (features.globalReturn && scope.childScopes[0].isStrict) - ) - }); - - return; - } - - /* - * `init: false` means that `valid` isn't determined yet. - * Most functions don't use `this`, and the calculation for `valid` - * is relatively costly, so we'll calculate it lazily when the first - * `this` within the function is traversed. A special case are non-strict - * functions, because `this` refers to the global object and therefore is - * always valid, so we can set `init: true` right away. - */ - stack.push({ - init: !sourceCode.getScope(node).isStrict, - node, - valid: true - }); - }, - - onCodePathEnd(codePath, node) { - if (isCodePathWithLexicalThis(codePath, node)) { - return; - } - - stack.pop(); - }, - - // Reports if `this` of the current context is invalid. - ThisExpression(node) { - const current = stack.getCurrent(); - - if (current && !current.valid) { - context.report({ - node, - messageId: "unexpectedThis" - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-irregular-whitespace.js b/node_modules/eslint/lib/rules/no-irregular-whitespace.js deleted file mode 100644 index 67519b5e8..000000000 --- a/node_modules/eslint/lib/rules/no-irregular-whitespace.js +++ /dev/null @@ -1,259 +0,0 @@ -/** - * @fileoverview Rule to disallow whitespace that is not a tab or space, whitespace inside strings and comments are allowed - * @author Jonathan Kingston - * @author Christophe Porteneuve - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Constants -//------------------------------------------------------------------------------ - -const ALL_IRREGULARS = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]/u; -const IRREGULAR_WHITESPACE = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/mgu; -const IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/mgu; -const LINE_BREAK = astUtils.createGlobalLinebreakMatcher(); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow irregular whitespace", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-irregular-whitespace" - }, - - schema: [ - { - type: "object", - properties: { - skipComments: { - type: "boolean", - default: false - }, - skipStrings: { - type: "boolean", - default: true - }, - skipTemplates: { - type: "boolean", - default: false - }, - skipRegExps: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - noIrregularWhitespace: "Irregular whitespace not allowed." - } - }, - - create(context) { - - // Module store of errors that we have found - let errors = []; - - // Lookup the `skipComments` option, which defaults to `false`. - const options = context.options[0] || {}; - const skipComments = !!options.skipComments; - const skipStrings = options.skipStrings !== false; - const skipRegExps = !!options.skipRegExps; - const skipTemplates = !!options.skipTemplates; - - const sourceCode = context.sourceCode; - const commentNodes = sourceCode.getAllComments(); - - /** - * Removes errors that occur inside the given node - * @param {ASTNode} node to check for matching errors. - * @returns {void} - * @private - */ - function removeWhitespaceError(node) { - const locStart = node.loc.start; - const locEnd = node.loc.end; - - errors = errors.filter(({ loc: { start: errorLocStart } }) => ( - errorLocStart.line < locStart.line || - errorLocStart.line === locStart.line && errorLocStart.column < locStart.column || - errorLocStart.line === locEnd.line && errorLocStart.column >= locEnd.column || - errorLocStart.line > locEnd.line - )); - } - - /** - * Checks identifier or literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors - * @param {ASTNode} node to check for matching errors. - * @returns {void} - * @private - */ - function removeInvalidNodeErrorsInIdentifierOrLiteral(node) { - const shouldCheckStrings = skipStrings && (typeof node.value === "string"); - const shouldCheckRegExps = skipRegExps && Boolean(node.regex); - - if (shouldCheckStrings || shouldCheckRegExps) { - - // If we have irregular characters remove them from the errors list - if (ALL_IRREGULARS.test(node.raw)) { - removeWhitespaceError(node); - } - } - } - - /** - * Checks template string literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors - * @param {ASTNode} node to check for matching errors. - * @returns {void} - * @private - */ - function removeInvalidNodeErrorsInTemplateLiteral(node) { - if (typeof node.value.raw === "string") { - if (ALL_IRREGULARS.test(node.value.raw)) { - removeWhitespaceError(node); - } - } - } - - /** - * Checks comment nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors - * @param {ASTNode} node to check for matching errors. - * @returns {void} - * @private - */ - function removeInvalidNodeErrorsInComment(node) { - if (ALL_IRREGULARS.test(node.value)) { - removeWhitespaceError(node); - } - } - - /** - * Checks the program source for irregular whitespace - * @param {ASTNode} node The program node - * @returns {void} - * @private - */ - function checkForIrregularWhitespace(node) { - const sourceLines = sourceCode.lines; - - sourceLines.forEach((sourceLine, lineIndex) => { - const lineNumber = lineIndex + 1; - let match; - - while ((match = IRREGULAR_WHITESPACE.exec(sourceLine)) !== null) { - errors.push({ - node, - messageId: "noIrregularWhitespace", - loc: { - start: { - line: lineNumber, - column: match.index - }, - end: { - line: lineNumber, - column: match.index + match[0].length - } - } - }); - } - }); - } - - /** - * Checks the program source for irregular line terminators - * @param {ASTNode} node The program node - * @returns {void} - * @private - */ - function checkForIrregularLineTerminators(node) { - const source = sourceCode.getText(), - sourceLines = sourceCode.lines, - linebreaks = source.match(LINE_BREAK); - let lastLineIndex = -1, - match; - - while ((match = IRREGULAR_LINE_TERMINATORS.exec(source)) !== null) { - const lineIndex = linebreaks.indexOf(match[0], lastLineIndex + 1) || 0; - - errors.push({ - node, - messageId: "noIrregularWhitespace", - loc: { - start: { - line: lineIndex + 1, - column: sourceLines[lineIndex].length - }, - end: { - line: lineIndex + 2, - column: 0 - } - } - }); - - lastLineIndex = lineIndex; - } - } - - /** - * A no-op function to act as placeholder for comment accumulation when the `skipComments` option is `false`. - * @returns {void} - * @private - */ - function noop() {} - - const nodes = {}; - - if (ALL_IRREGULARS.test(sourceCode.getText())) { - nodes.Program = function(node) { - - /* - * As we can easily fire warnings for all white space issues with - * all the source its simpler to fire them here. - * This means we can check all the application code without having - * to worry about issues caused in the parser tokens. - * When writing this code also evaluating per node was missing out - * connecting tokens in some cases. - * We can later filter the errors when they are found to be not an - * issue in nodes we don't care about. - */ - checkForIrregularWhitespace(node); - checkForIrregularLineTerminators(node); - }; - - nodes.Identifier = removeInvalidNodeErrorsInIdentifierOrLiteral; - nodes.Literal = removeInvalidNodeErrorsInIdentifierOrLiteral; - nodes.TemplateElement = skipTemplates ? removeInvalidNodeErrorsInTemplateLiteral : noop; - nodes["Program:exit"] = function() { - if (skipComments) { - - // First strip errors occurring in comment nodes. - commentNodes.forEach(removeInvalidNodeErrorsInComment); - } - - // If we have any errors remaining report on them - errors.forEach(error => context.report(error)); - }; - } else { - nodes.Program = noop; - } - - return nodes; - } -}; diff --git a/node_modules/eslint/lib/rules/no-iterator.js b/node_modules/eslint/lib/rules/no-iterator.js deleted file mode 100644 index dcd9683b4..000000000 --- a/node_modules/eslint/lib/rules/no-iterator.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @fileoverview Rule to flag usage of __iterator__ property - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { getStaticPropertyName } = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the use of the `__iterator__` property", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-iterator" - }, - - schema: [], - - messages: { - noIterator: "Reserved name '__iterator__'." - } - }, - - create(context) { - - return { - - MemberExpression(node) { - - if (getStaticPropertyName(node) === "__iterator__") { - context.report({ - node, - messageId: "noIterator" - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-label-var.js b/node_modules/eslint/lib/rules/no-label-var.js deleted file mode 100644 index bf33cd157..000000000 --- a/node_modules/eslint/lib/rules/no-label-var.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @fileoverview Rule to flag labels that are the same as an identifier - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow labels that share a name with a variable", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-label-var" - }, - - schema: [], - - messages: { - identifierClashWithLabel: "Found identifier with same name as label." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Check if the identifier is present inside current scope - * @param {Object} scope current scope - * @param {string} name To evaluate - * @returns {boolean} True if its present - * @private - */ - function findIdentifier(scope, name) { - return astUtils.getVariableByName(scope, name) !== null; - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - - LabeledStatement(node) { - - // Fetch the innermost scope. - const scope = sourceCode.getScope(node); - - /* - * Recursively find the identifier walking up the scope, starting - * with the innermost scope. - */ - if (findIdentifier(scope, node.label.name)) { - context.report({ - node, - messageId: "identifierClashWithLabel" - }); - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-labels.js b/node_modules/eslint/lib/rules/no-labels.js deleted file mode 100644 index d991a0a80..000000000 --- a/node_modules/eslint/lib/rules/no-labels.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * @fileoverview Disallow Labeled Statements - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow labeled statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-labels" - }, - - schema: [ - { - type: "object", - properties: { - allowLoop: { - type: "boolean", - default: false - }, - allowSwitch: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedLabel: "Unexpected labeled statement.", - unexpectedLabelInBreak: "Unexpected label in break statement.", - unexpectedLabelInContinue: "Unexpected label in continue statement." - } - }, - - create(context) { - const options = context.options[0]; - const allowLoop = options && options.allowLoop; - const allowSwitch = options && options.allowSwitch; - let scopeInfo = null; - - /** - * Gets the kind of a given node. - * @param {ASTNode} node A node to get. - * @returns {string} The kind of the node. - */ - function getBodyKind(node) { - if (astUtils.isLoop(node)) { - return "loop"; - } - if (node.type === "SwitchStatement") { - return "switch"; - } - return "other"; - } - - /** - * Checks whether the label of a given kind is allowed or not. - * @param {string} kind A kind to check. - * @returns {boolean} `true` if the kind is allowed. - */ - function isAllowed(kind) { - switch (kind) { - case "loop": return allowLoop; - case "switch": return allowSwitch; - default: return false; - } - } - - /** - * Checks whether a given name is a label of a loop or not. - * @param {string} label A name of a label to check. - * @returns {boolean} `true` if the name is a label of a loop. - */ - function getKind(label) { - let info = scopeInfo; - - while (info) { - if (info.label === label) { - return info.kind; - } - info = info.upper; - } - - /* c8 ignore next */ - return "other"; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - LabeledStatement(node) { - scopeInfo = { - label: node.label.name, - kind: getBodyKind(node.body), - upper: scopeInfo - }; - }, - - "LabeledStatement:exit"(node) { - if (!isAllowed(scopeInfo.kind)) { - context.report({ - node, - messageId: "unexpectedLabel" - }); - } - - scopeInfo = scopeInfo.upper; - }, - - BreakStatement(node) { - if (node.label && !isAllowed(getKind(node.label.name))) { - context.report({ - node, - messageId: "unexpectedLabelInBreak" - }); - } - }, - - ContinueStatement(node) { - if (node.label && !isAllowed(getKind(node.label.name))) { - context.report({ - node, - messageId: "unexpectedLabelInContinue" - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-lone-blocks.js b/node_modules/eslint/lib/rules/no-lone-blocks.js deleted file mode 100644 index 767eec2be..000000000 --- a/node_modules/eslint/lib/rules/no-lone-blocks.js +++ /dev/null @@ -1,136 +0,0 @@ -/** - * @fileoverview Rule to flag blocks with no reason to exist - * @author Brandon Mills - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary nested blocks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-lone-blocks" - }, - - schema: [], - - messages: { - redundantBlock: "Block is redundant.", - redundantNestedBlock: "Nested block is redundant." - } - }, - - create(context) { - - // A stack of lone blocks to be checked for block-level bindings - const loneBlocks = []; - let ruleDef; - const sourceCode = context.sourceCode; - - /** - * Reports a node as invalid. - * @param {ASTNode} node The node to be reported. - * @returns {void} - */ - function report(node) { - const messageId = node.parent.type === "BlockStatement" || node.parent.type === "StaticBlock" - ? "redundantNestedBlock" - : "redundantBlock"; - - context.report({ - node, - messageId - }); - } - - /** - * Checks for any occurrence of a BlockStatement in a place where lists of statements can appear - * @param {ASTNode} node The node to check - * @returns {boolean} True if the node is a lone block. - */ - function isLoneBlock(node) { - return node.parent.type === "BlockStatement" || - node.parent.type === "StaticBlock" || - node.parent.type === "Program" || - - // Don't report blocks in switch cases if the block is the only statement of the case. - node.parent.type === "SwitchCase" && !(node.parent.consequent[0] === node && node.parent.consequent.length === 1); - } - - /** - * Checks the enclosing block of the current node for block-level bindings, - * and "marks it" as valid if any. - * @param {ASTNode} node The current node to check. - * @returns {void} - */ - function markLoneBlock(node) { - if (loneBlocks.length === 0) { - return; - } - - const block = node.parent; - - if (loneBlocks[loneBlocks.length - 1] === block) { - loneBlocks.pop(); - } - } - - // Default rule definition: report all lone blocks - ruleDef = { - BlockStatement(node) { - if (isLoneBlock(node)) { - report(node); - } - } - }; - - // ES6: report blocks without block-level bindings, or that's only child of another block - if (context.languageOptions.ecmaVersion >= 2015) { - ruleDef = { - BlockStatement(node) { - if (isLoneBlock(node)) { - loneBlocks.push(node); - } - }, - "BlockStatement:exit"(node) { - if (loneBlocks.length > 0 && loneBlocks[loneBlocks.length - 1] === node) { - loneBlocks.pop(); - report(node); - } else if ( - ( - node.parent.type === "BlockStatement" || - node.parent.type === "StaticBlock" - ) && - node.parent.body.length === 1 - ) { - report(node); - } - } - }; - - ruleDef.VariableDeclaration = function(node) { - if (node.kind === "let" || node.kind === "const") { - markLoneBlock(node); - } - }; - - ruleDef.FunctionDeclaration = function(node) { - if (sourceCode.getScope(node).isStrict) { - markLoneBlock(node); - } - }; - - ruleDef.ClassDeclaration = markLoneBlock; - } - - return ruleDef; - } -}; diff --git a/node_modules/eslint/lib/rules/no-lonely-if.js b/node_modules/eslint/lib/rules/no-lonely-if.js deleted file mode 100644 index eefd2c688..000000000 --- a/node_modules/eslint/lib/rules/no-lonely-if.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @fileoverview Rule to disallow if as the only statement in an else block - * @author Brandon Mills - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `if` statements as the only statement in `else` blocks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-lonely-if" - }, - - schema: [], - fixable: "code", - - messages: { - unexpectedLonelyIf: "Unexpected if as the only statement in an else block." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - IfStatement(node) { - const parent = node.parent, - grandparent = parent.parent; - - if (parent && parent.type === "BlockStatement" && - parent.body.length === 1 && grandparent && - grandparent.type === "IfStatement" && - parent === grandparent.alternate) { - context.report({ - node, - messageId: "unexpectedLonelyIf", - fix(fixer) { - const openingElseCurly = sourceCode.getFirstToken(parent); - const closingElseCurly = sourceCode.getLastToken(parent); - const elseKeyword = sourceCode.getTokenBefore(openingElseCurly); - const tokenAfterElseBlock = sourceCode.getTokenAfter(closingElseCurly); - const lastIfToken = sourceCode.getLastToken(node.consequent); - const sourceText = sourceCode.getText(); - - if (sourceText.slice(openingElseCurly.range[1], - node.range[0]).trim() || sourceText.slice(node.range[1], closingElseCurly.range[0]).trim()) { - - // Don't fix if there are any non-whitespace characters interfering (e.g. comments) - return null; - } - - if ( - node.consequent.type !== "BlockStatement" && lastIfToken.value !== ";" && tokenAfterElseBlock && - ( - node.consequent.loc.end.line === tokenAfterElseBlock.loc.start.line || - /^[([/+`-]/u.test(tokenAfterElseBlock.value) || - lastIfToken.value === "++" || - lastIfToken.value === "--" - ) - ) { - - /* - * If the `if` statement has no block, and is not followed by a semicolon, make sure that fixing - * the issue would not change semantics due to ASI. If this would happen, don't do a fix. - */ - return null; - } - - return fixer.replaceTextRange( - [openingElseCurly.range[0], closingElseCurly.range[1]], - (elseKeyword.range[1] === openingElseCurly.range[0] ? " " : "") + sourceCode.getText(node) - ); - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-loop-func.js b/node_modules/eslint/lib/rules/no-loop-func.js deleted file mode 100644 index e1d65fdc9..000000000 --- a/node_modules/eslint/lib/rules/no-loop-func.js +++ /dev/null @@ -1,206 +0,0 @@ -/** - * @fileoverview Rule to flag creation of function inside a loop - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Gets the containing loop node of a specified node. - * - * We don't need to check nested functions, so this ignores those. - * `Scope.through` contains references of nested functions. - * @param {ASTNode} node An AST node to get. - * @returns {ASTNode|null} The containing loop node of the specified node, or - * `null`. - */ -function getContainingLoopNode(node) { - for (let currentNode = node; currentNode.parent; currentNode = currentNode.parent) { - const parent = currentNode.parent; - - switch (parent.type) { - case "WhileStatement": - case "DoWhileStatement": - return parent; - - case "ForStatement": - - // `init` is outside of the loop. - if (parent.init !== currentNode) { - return parent; - } - break; - - case "ForInStatement": - case "ForOfStatement": - - // `right` is outside of the loop. - if (parent.right !== currentNode) { - return parent; - } - break; - - case "ArrowFunctionExpression": - case "FunctionExpression": - case "FunctionDeclaration": - - // We don't need to check nested functions. - return null; - - default: - break; - } - } - - return null; -} - -/** - * Gets the containing loop node of a given node. - * If the loop was nested, this returns the most outer loop. - * @param {ASTNode} node A node to get. This is a loop node. - * @param {ASTNode|null} excludedNode A node that the result node should not - * include. - * @returns {ASTNode} The most outer loop node. - */ -function getTopLoopNode(node, excludedNode) { - const border = excludedNode ? excludedNode.range[1] : 0; - let retv = node; - let containingLoopNode = node; - - while (containingLoopNode && containingLoopNode.range[0] >= border) { - retv = containingLoopNode; - containingLoopNode = getContainingLoopNode(containingLoopNode); - } - - return retv; -} - -/** - * Checks whether a given reference which refers to an upper scope's variable is - * safe or not. - * @param {ASTNode} loopNode A containing loop node. - * @param {eslint-scope.Reference} reference A reference to check. - * @returns {boolean} `true` if the reference is safe or not. - */ -function isSafe(loopNode, reference) { - const variable = reference.resolved; - const definition = variable && variable.defs[0]; - const declaration = definition && definition.parent; - const kind = (declaration && declaration.type === "VariableDeclaration") - ? declaration.kind - : ""; - - // Variables which are declared by `const` is safe. - if (kind === "const") { - return true; - } - - /* - * Variables which are declared by `let` in the loop is safe. - * It's a different instance from the next loop step's. - */ - if (kind === "let" && - declaration.range[0] > loopNode.range[0] && - declaration.range[1] < loopNode.range[1] - ) { - return true; - } - - /* - * WriteReferences which exist after this border are unsafe because those - * can modify the variable. - */ - const border = getTopLoopNode( - loopNode, - (kind === "let") ? declaration : null - ).range[0]; - - /** - * Checks whether a given reference is safe or not. - * The reference is every reference of the upper scope's variable we are - * looking now. - * - * It's safe if the reference matches one of the following condition. - * - is readonly. - * - doesn't exist inside a local function and after the border. - * @param {eslint-scope.Reference} upperRef A reference to check. - * @returns {boolean} `true` if the reference is safe. - */ - function isSafeReference(upperRef) { - const id = upperRef.identifier; - - return ( - !upperRef.isWrite() || - variable.scope.variableScope === upperRef.from.variableScope && - id.range[0] < border - ); - } - - return Boolean(variable) && variable.references.every(isSafeReference); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow function declarations that contain unsafe references inside loop statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-loop-func" - }, - - schema: [], - - messages: { - unsafeRefs: "Function declared in a loop contains unsafe references to variable(s) {{ varNames }}." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Reports functions which match the following condition: - * - * - has a loop node in ancestors. - * - has any references which refers to an unsafe variable. - * @param {ASTNode} node The AST node to check. - * @returns {void} - */ - function checkForLoops(node) { - const loopNode = getContainingLoopNode(node); - - if (!loopNode) { - return; - } - - const references = sourceCode.getScope(node).through; - const unsafeRefs = references.filter(r => !isSafe(loopNode, r)).map(r => r.identifier.name); - - if (unsafeRefs.length > 0) { - context.report({ - node, - messageId: "unsafeRefs", - data: { varNames: `'${unsafeRefs.join("', '")}'` } - }); - } - } - - return { - ArrowFunctionExpression: checkForLoops, - FunctionExpression: checkForLoops, - FunctionDeclaration: checkForLoops - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-loss-of-precision.js b/node_modules/eslint/lib/rules/no-loss-of-precision.js deleted file mode 100644 index 22ca7f93e..000000000 --- a/node_modules/eslint/lib/rules/no-loss-of-precision.js +++ /dev/null @@ -1,206 +0,0 @@ -/** - * @fileoverview Rule to flag numbers that will lose significant figure precision at runtime - * @author Jacob Moore - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow literal numbers that lose precision", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-loss-of-precision" - }, - schema: [], - messages: { - noLossOfPrecision: "This number literal will lose precision at runtime." - } - }, - - create(context) { - - /** - * Returns whether the node is number literal - * @param {Node} node the node literal being evaluated - * @returns {boolean} true if the node is a number literal - */ - function isNumber(node) { - return typeof node.value === "number"; - } - - /** - * Gets the source code of the given number literal. Removes `_` numeric separators from the result. - * @param {Node} node the number `Literal` node - * @returns {string} raw source code of the literal, without numeric separators - */ - function getRaw(node) { - return node.raw.replace(/_/gu, ""); - } - - /** - * Checks whether the number is base ten - * @param {ASTNode} node the node being evaluated - * @returns {boolean} true if the node is in base ten - */ - function isBaseTen(node) { - const prefixes = ["0x", "0X", "0b", "0B", "0o", "0O"]; - - return prefixes.every(prefix => !node.raw.startsWith(prefix)) && - !/^0[0-7]+$/u.test(node.raw); - } - - /** - * Checks that the user-intended non-base ten number equals the actual number after is has been converted to the Number type - * @param {Node} node the node being evaluated - * @returns {boolean} true if they do not match - */ - function notBaseTenLosesPrecision(node) { - const rawString = getRaw(node).toUpperCase(); - let base = 0; - - if (rawString.startsWith("0B")) { - base = 2; - } else if (rawString.startsWith("0X")) { - base = 16; - } else { - base = 8; - } - - return !rawString.endsWith(node.value.toString(base).toUpperCase()); - } - - /** - * Adds a decimal point to the numeric string at index 1 - * @param {string} stringNumber the numeric string without any decimal point - * @returns {string} the numeric string with a decimal point in the proper place - */ - function addDecimalPointToNumber(stringNumber) { - return `${stringNumber.slice(0, 1)}.${stringNumber.slice(1)}`; - } - - /** - * Returns the number stripped of leading zeros - * @param {string} numberAsString the string representation of the number - * @returns {string} the stripped string - */ - function removeLeadingZeros(numberAsString) { - return numberAsString.replace(/^0*/u, ""); - } - - /** - * Returns the number stripped of trailing zeros - * @param {string} numberAsString the string representation of the number - * @returns {string} the stripped string - */ - function removeTrailingZeros(numberAsString) { - return numberAsString.replace(/0*$/u, ""); - } - - /** - * Converts an integer to an object containing the integer's coefficient and order of magnitude - * @param {string} stringInteger the string representation of the integer being converted - * @returns {Object} the object containing the integer's coefficient and order of magnitude - */ - function normalizeInteger(stringInteger) { - const significantDigits = removeTrailingZeros(removeLeadingZeros(stringInteger)); - - return { - magnitude: stringInteger.startsWith("0") ? stringInteger.length - 2 : stringInteger.length - 1, - coefficient: addDecimalPointToNumber(significantDigits) - }; - } - - /** - * - * Converts a float to an object containing the floats's coefficient and order of magnitude - * @param {string} stringFloat the string representation of the float being converted - * @returns {Object} the object containing the integer's coefficient and order of magnitude - */ - function normalizeFloat(stringFloat) { - const trimmedFloat = removeLeadingZeros(stringFloat); - - if (trimmedFloat.startsWith(".")) { - const decimalDigits = trimmedFloat.split(".").pop(); - const significantDigits = removeLeadingZeros(decimalDigits); - - return { - magnitude: significantDigits.length - decimalDigits.length - 1, - coefficient: addDecimalPointToNumber(significantDigits) - }; - - } - return { - magnitude: trimmedFloat.indexOf(".") - 1, - coefficient: addDecimalPointToNumber(trimmedFloat.replace(".", "")) - - }; - } - - - /** - * Converts a base ten number to proper scientific notation - * @param {string} stringNumber the string representation of the base ten number to be converted - * @returns {string} the number converted to scientific notation - */ - function convertNumberToScientificNotation(stringNumber) { - const splitNumber = stringNumber.replace("E", "e").split("e"); - const originalCoefficient = splitNumber[0]; - const normalizedNumber = stringNumber.includes(".") ? normalizeFloat(originalCoefficient) - : normalizeInteger(originalCoefficient); - const normalizedCoefficient = normalizedNumber.coefficient; - const magnitude = splitNumber.length > 1 ? (parseInt(splitNumber[1], 10) + normalizedNumber.magnitude) - : normalizedNumber.magnitude; - - return `${normalizedCoefficient}e${magnitude}`; - - } - - /** - * Checks that the user-intended base ten number equals the actual number after is has been converted to the Number type - * @param {Node} node the node being evaluated - * @returns {boolean} true if they do not match - */ - function baseTenLosesPrecision(node) { - const normalizedRawNumber = convertNumberToScientificNotation(getRaw(node)); - const requestedPrecision = normalizedRawNumber.split("e")[0].replace(".", "").length; - - if (requestedPrecision > 100) { - return true; - } - const storedNumber = node.value.toPrecision(requestedPrecision); - const normalizedStoredNumber = convertNumberToScientificNotation(storedNumber); - - return normalizedRawNumber !== normalizedStoredNumber; - } - - - /** - * Checks that the user-intended number equals the actual number after is has been converted to the Number type - * @param {Node} node the node being evaluated - * @returns {boolean} true if they do not match - */ - function losesPrecision(node) { - return isBaseTen(node) ? baseTenLosesPrecision(node) : notBaseTenLosesPrecision(node); - } - - - return { - Literal(node) { - if (node.value && isNumber(node) && losesPrecision(node)) { - context.report({ - messageId: "noLossOfPrecision", - node - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-magic-numbers.js b/node_modules/eslint/lib/rules/no-magic-numbers.js deleted file mode 100644 index f48a62d85..000000000 --- a/node_modules/eslint/lib/rules/no-magic-numbers.js +++ /dev/null @@ -1,243 +0,0 @@ -/** - * @fileoverview Rule to flag statements that use magic numbers (adapted from https://github.com/danielstjules/buddy.js) - * @author Vincent Lemeunier - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -// Maximum array length by the ECMAScript Specification. -const MAX_ARRAY_LENGTH = 2 ** 32 - 1; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** - * Convert the value to bigint if it's a string. Otherwise return the value as-is. - * @param {bigint|number|string} x The value to normalize. - * @returns {bigint|number} The normalized value. - */ -function normalizeIgnoreValue(x) { - if (typeof x === "string") { - return BigInt(x.slice(0, -1)); - } - return x; -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow magic numbers", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-magic-numbers" - }, - - schema: [{ - type: "object", - properties: { - detectObjects: { - type: "boolean", - default: false - }, - enforceConst: { - type: "boolean", - default: false - }, - ignore: { - type: "array", - items: { - anyOf: [ - { type: "number" }, - { type: "string", pattern: "^[+-]?(?:0|[1-9][0-9]*)n$" } - ] - }, - uniqueItems: true - }, - ignoreArrayIndexes: { - type: "boolean", - default: false - }, - ignoreDefaultValues: { - type: "boolean", - default: false - }, - ignoreClassFieldInitialValues: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - - messages: { - useConst: "Number constants declarations must use 'const'.", - noMagic: "No magic number: {{raw}}." - } - }, - - create(context) { - const config = context.options[0] || {}, - detectObjects = !!config.detectObjects, - enforceConst = !!config.enforceConst, - ignore = new Set((config.ignore || []).map(normalizeIgnoreValue)), - ignoreArrayIndexes = !!config.ignoreArrayIndexes, - ignoreDefaultValues = !!config.ignoreDefaultValues, - ignoreClassFieldInitialValues = !!config.ignoreClassFieldInitialValues; - - const okTypes = detectObjects ? [] : ["ObjectExpression", "Property", "AssignmentExpression"]; - - /** - * Returns whether the rule is configured to ignore the given value - * @param {bigint|number} value The value to check - * @returns {boolean} true if the value is ignored - */ - function isIgnoredValue(value) { - return ignore.has(value); - } - - /** - * Returns whether the number is a default value assignment. - * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node - * @returns {boolean} true if the number is a default value - */ - function isDefaultValue(fullNumberNode) { - const parent = fullNumberNode.parent; - - return parent.type === "AssignmentPattern" && parent.right === fullNumberNode; - } - - /** - * Returns whether the number is the initial value of a class field. - * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node - * @returns {boolean} true if the number is the initial value of a class field. - */ - function isClassFieldInitialValue(fullNumberNode) { - const parent = fullNumberNode.parent; - - return parent.type === "PropertyDefinition" && parent.value === fullNumberNode; - } - - /** - * Returns whether the given node is used as a radix within parseInt() or Number.parseInt() - * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node - * @returns {boolean} true if the node is radix - */ - function isParseIntRadix(fullNumberNode) { - const parent = fullNumberNode.parent; - - return parent.type === "CallExpression" && fullNumberNode === parent.arguments[1] && - ( - astUtils.isSpecificId(parent.callee, "parseInt") || - astUtils.isSpecificMemberAccess(parent.callee, "Number", "parseInt") - ); - } - - /** - * Returns whether the given node is a direct child of a JSX node. - * In particular, it aims to detect numbers used as prop values in JSX tags. - * Example: - * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node - * @returns {boolean} true if the node is a JSX number - */ - function isJSXNumber(fullNumberNode) { - return fullNumberNode.parent.type.indexOf("JSX") === 0; - } - - /** - * Returns whether the given node is used as an array index. - * Value must coerce to a valid array index name: "0", "1", "2" ... "4294967294". - * - * All other values, like "-1", "2.5", or "4294967295", are just "normal" object properties, - * which can be created and accessed on an array in addition to the array index properties, - * but they don't affect array's length and are not considered by methods such as .map(), .forEach() etc. - * - * The maximum array length by the specification is 2 ** 32 - 1 = 4294967295, - * thus the maximum valid index is 2 ** 32 - 2 = 4294967294. - * - * All notations are allowed, as long as the value coerces to one of "0", "1", "2" ... "4294967294". - * - * Valid examples: - * a[0], a[1], a[1.2e1], a[0xAB], a[0n], a[1n] - * a[-0] (same as a[0] because -0 coerces to "0") - * a[-0n] (-0n evaluates to 0n) - * - * Invalid examples: - * a[-1], a[-0xAB], a[-1n], a[2.5], a[1.23e1], a[12e-1] - * a[4294967295] (above the max index, it's an access to a regular property a["4294967295"]) - * a[999999999999999999999] (even if it wasn't above the max index, it would be a["1e+21"]) - * a[1e310] (same as a["Infinity"]) - * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node - * @param {bigint|number} value Value expressed by the fullNumberNode - * @returns {boolean} true if the node is a valid array index - */ - function isArrayIndex(fullNumberNode, value) { - const parent = fullNumberNode.parent; - - return parent.type === "MemberExpression" && parent.property === fullNumberNode && - (Number.isInteger(value) || typeof value === "bigint") && - value >= 0 && value < MAX_ARRAY_LENGTH; - } - - return { - Literal(node) { - if (!astUtils.isNumericLiteral(node)) { - return; - } - - let fullNumberNode; - let value; - let raw; - - // Treat unary minus as a part of the number - if (node.parent.type === "UnaryExpression" && node.parent.operator === "-") { - fullNumberNode = node.parent; - value = -node.value; - raw = `-${node.raw}`; - } else { - fullNumberNode = node; - value = node.value; - raw = node.raw; - } - - const parent = fullNumberNode.parent; - - // Always allow radix arguments and JSX props - if ( - isIgnoredValue(value) || - (ignoreDefaultValues && isDefaultValue(fullNumberNode)) || - (ignoreClassFieldInitialValues && isClassFieldInitialValue(fullNumberNode)) || - isParseIntRadix(fullNumberNode) || - isJSXNumber(fullNumberNode) || - (ignoreArrayIndexes && isArrayIndex(fullNumberNode, value)) - ) { - return; - } - - if (parent.type === "VariableDeclarator") { - if (enforceConst && parent.parent.kind !== "const") { - context.report({ - node: fullNumberNode, - messageId: "useConst" - }); - } - } else if ( - !okTypes.includes(parent.type) || - (parent.type === "AssignmentExpression" && parent.left.type === "Identifier") - ) { - context.report({ - node: fullNumberNode, - messageId: "noMagic", - data: { - raw - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-misleading-character-class.js b/node_modules/eslint/lib/rules/no-misleading-character-class.js deleted file mode 100644 index 47ee84ec8..000000000 --- a/node_modules/eslint/lib/rules/no-misleading-character-class.js +++ /dev/null @@ -1,244 +0,0 @@ -/** - * @author Toru Nagashima - */ -"use strict"; - -const { CALL, CONSTRUCT, ReferenceTracker, getStringIfConstant } = require("@eslint-community/eslint-utils"); -const { RegExpParser, visitRegExpAST } = require("@eslint-community/regexpp"); -const { isCombiningCharacter, isEmojiModifier, isRegionalIndicatorSymbol, isSurrogatePair } = require("./utils/unicode"); -const astUtils = require("./utils/ast-utils.js"); -const { isValidWithUnicodeFlag } = require("./utils/regular-expressions"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Iterate character sequences of a given nodes. - * - * CharacterClassRange syntax can steal a part of character sequence, - * so this function reverts CharacterClassRange syntax and restore the sequence. - * @param {regexpp.AST.CharacterClassElement[]} nodes The node list to iterate character sequences. - * @returns {IterableIterator} The list of character sequences. - */ -function *iterateCharacterSequence(nodes) { - let seq = []; - - for (const node of nodes) { - switch (node.type) { - case "Character": - seq.push(node.value); - break; - - case "CharacterClassRange": - seq.push(node.min.value); - yield seq; - seq = [node.max.value]; - break; - - case "CharacterSet": - if (seq.length > 0) { - yield seq; - seq = []; - } - break; - - // no default - } - } - - if (seq.length > 0) { - yield seq; - } -} - -const hasCharacterSequence = { - surrogatePairWithoutUFlag(chars) { - return chars.some((c, i) => i !== 0 && isSurrogatePair(chars[i - 1], c)); - }, - - combiningClass(chars) { - return chars.some((c, i) => ( - i !== 0 && - isCombiningCharacter(c) && - !isCombiningCharacter(chars[i - 1]) - )); - }, - - emojiModifier(chars) { - return chars.some((c, i) => ( - i !== 0 && - isEmojiModifier(c) && - !isEmojiModifier(chars[i - 1]) - )); - }, - - regionalIndicatorSymbol(chars) { - return chars.some((c, i) => ( - i !== 0 && - isRegionalIndicatorSymbol(c) && - isRegionalIndicatorSymbol(chars[i - 1]) - )); - }, - - zwj(chars) { - const lastIndex = chars.length - 1; - - return chars.some((c, i) => ( - i !== 0 && - i !== lastIndex && - c === 0x200d && - chars[i - 1] !== 0x200d && - chars[i + 1] !== 0x200d - )); - } -}; - -const kinds = Object.keys(hasCharacterSequence); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow characters which are made with multiple code points in character class syntax", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-misleading-character-class" - }, - - hasSuggestions: true, - - schema: [], - - messages: { - surrogatePairWithoutUFlag: "Unexpected surrogate pair in character class. Use 'u' flag.", - combiningClass: "Unexpected combined character in character class.", - emojiModifier: "Unexpected modified Emoji in character class.", - regionalIndicatorSymbol: "Unexpected national flag in character class.", - zwj: "Unexpected joined character sequence in character class.", - suggestUnicodeFlag: "Add unicode 'u' flag to regex." - } - }, - create(context) { - const sourceCode = context.sourceCode; - const parser = new RegExpParser(); - - /** - * Verify a given regular expression. - * @param {Node} node The node to report. - * @param {string} pattern The regular expression pattern to verify. - * @param {string} flags The flags of the regular expression. - * @param {Function} unicodeFixer Fixer for missing "u" flag. - * @returns {void} - */ - function verify(node, pattern, flags, unicodeFixer) { - let patternNode; - - try { - patternNode = parser.parsePattern( - pattern, - 0, - pattern.length, - flags.includes("u") - ); - } catch { - - // Ignore regular expressions with syntax errors - return; - } - - const foundKinds = new Set(); - - visitRegExpAST(patternNode, { - onCharacterClassEnter(ccNode) { - for (const chars of iterateCharacterSequence(ccNode.elements)) { - for (const kind of kinds) { - if (hasCharacterSequence[kind](chars)) { - foundKinds.add(kind); - } - } - } - } - }); - - for (const kind of foundKinds) { - let suggest; - - if (kind === "surrogatePairWithoutUFlag") { - suggest = [{ - messageId: "suggestUnicodeFlag", - fix: unicodeFixer - }]; - } - - context.report({ - node, - messageId: kind, - suggest - }); - } - } - - return { - "Literal[regex]"(node) { - verify(node, node.regex.pattern, node.regex.flags, fixer => { - if (!isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, node.regex.pattern)) { - return null; - } - - return fixer.insertTextAfter(node, "u"); - }); - }, - "Program"(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - - /* - * Iterate calls of RegExp. - * E.g., `new RegExp()`, `RegExp()`, `new window.RegExp()`, - * `const {RegExp: a} = window; new a()`, etc... - */ - for (const { node: refNode } of tracker.iterateGlobalReferences({ - RegExp: { [CALL]: true, [CONSTRUCT]: true } - })) { - const [patternNode, flagsNode] = refNode.arguments; - const pattern = getStringIfConstant(patternNode, scope); - const flags = getStringIfConstant(flagsNode, scope); - - if (typeof pattern === "string") { - verify(refNode, pattern, flags || "", fixer => { - - if (!isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, pattern)) { - return null; - } - - if (refNode.arguments.length === 1) { - const penultimateToken = sourceCode.getLastToken(refNode, { skip: 1 }); // skip closing parenthesis - - return fixer.insertTextAfter( - penultimateToken, - astUtils.isCommaToken(penultimateToken) - ? ' "u",' - : ', "u"' - ); - } - - if ((flagsNode.type === "Literal" && typeof flagsNode.value === "string") || flagsNode.type === "TemplateLiteral") { - const range = [flagsNode.range[0], flagsNode.range[1] - 1]; - - return fixer.insertTextAfterRange(range, "u"); - } - - return null; - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-mixed-operators.js b/node_modules/eslint/lib/rules/no-mixed-operators.js deleted file mode 100644 index 724abe094..000000000 --- a/node_modules/eslint/lib/rules/no-mixed-operators.js +++ /dev/null @@ -1,226 +0,0 @@ -/** - * @fileoverview Rule to disallow mixed binary operators. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils.js"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const ARITHMETIC_OPERATORS = ["+", "-", "*", "/", "%", "**"]; -const BITWISE_OPERATORS = ["&", "|", "^", "~", "<<", ">>", ">>>"]; -const COMPARISON_OPERATORS = ["==", "!=", "===", "!==", ">", ">=", "<", "<="]; -const LOGICAL_OPERATORS = ["&&", "||"]; -const RELATIONAL_OPERATORS = ["in", "instanceof"]; -const TERNARY_OPERATOR = ["?:"]; -const COALESCE_OPERATOR = ["??"]; -const ALL_OPERATORS = [].concat( - ARITHMETIC_OPERATORS, - BITWISE_OPERATORS, - COMPARISON_OPERATORS, - LOGICAL_OPERATORS, - RELATIONAL_OPERATORS, - TERNARY_OPERATOR, - COALESCE_OPERATOR -); -const DEFAULT_GROUPS = [ - ARITHMETIC_OPERATORS, - BITWISE_OPERATORS, - COMPARISON_OPERATORS, - LOGICAL_OPERATORS, - RELATIONAL_OPERATORS -]; -const TARGET_NODE_TYPE = /^(?:Binary|Logical|Conditional)Expression$/u; - -/** - * Normalizes options. - * @param {Object|undefined} options A options object to normalize. - * @returns {Object} Normalized option object. - */ -function normalizeOptions(options = {}) { - const hasGroups = options.groups && options.groups.length > 0; - const groups = hasGroups ? options.groups : DEFAULT_GROUPS; - const allowSamePrecedence = options.allowSamePrecedence !== false; - - return { - groups, - allowSamePrecedence - }; -} - -/** - * Checks whether any group which includes both given operator exists or not. - * @param {Array} groups A list of groups to check. - * @param {string} left An operator. - * @param {string} right Another operator. - * @returns {boolean} `true` if such group existed. - */ -function includesBothInAGroup(groups, left, right) { - return groups.some(group => group.includes(left) && group.includes(right)); -} - -/** - * Checks whether the given node is a conditional expression and returns the test node else the left node. - * @param {ASTNode} node A node which can be a BinaryExpression or a LogicalExpression node. - * This parent node can be BinaryExpression, LogicalExpression - * , or a ConditionalExpression node - * @returns {ASTNode} node the appropriate node(left or test). - */ -function getChildNode(node) { - return node.type === "ConditionalExpression" ? node.test : node.left; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow mixed binary operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-mixed-operators" - }, - - schema: [ - { - type: "object", - properties: { - groups: { - type: "array", - items: { - type: "array", - items: { enum: ALL_OPERATORS }, - minItems: 2, - uniqueItems: true - }, - uniqueItems: true - }, - allowSamePrecedence: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedMixedOperator: "Unexpected mix of '{{leftOperator}}' and '{{rightOperator}}'. Use parentheses to clarify the intended order of operations." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const options = normalizeOptions(context.options[0]); - - /** - * Checks whether a given node should be ignored by options or not. - * @param {ASTNode} node A node to check. This is a BinaryExpression - * node or a LogicalExpression node. This parent node is one of - * them, too. - * @returns {boolean} `true` if the node should be ignored. - */ - function shouldIgnore(node) { - const a = node; - const b = node.parent; - - return ( - !includesBothInAGroup(options.groups, a.operator, b.type === "ConditionalExpression" ? "?:" : b.operator) || - ( - options.allowSamePrecedence && - astUtils.getPrecedence(a) === astUtils.getPrecedence(b) - ) - ); - } - - /** - * Checks whether the operator of a given node is mixed with parent - * node's operator or not. - * @param {ASTNode} node A node to check. This is a BinaryExpression - * node or a LogicalExpression node. This parent node is one of - * them, too. - * @returns {boolean} `true` if the node was mixed. - */ - function isMixedWithParent(node) { - - return ( - node.operator !== node.parent.operator && - !astUtils.isParenthesised(sourceCode, node) - ); - } - - /** - * Gets the operator token of a given node. - * @param {ASTNode} node A node to check. This is a BinaryExpression - * node or a LogicalExpression node. - * @returns {Token} The operator token of the node. - */ - function getOperatorToken(node) { - return sourceCode.getTokenAfter(getChildNode(node), astUtils.isNotClosingParenToken); - } - - /** - * Reports both the operator of a given node and the operator of the - * parent node. - * @param {ASTNode} node A node to check. This is a BinaryExpression - * node or a LogicalExpression node. This parent node is one of - * them, too. - * @returns {void} - */ - function reportBothOperators(node) { - const parent = node.parent; - const left = (getChildNode(parent) === node) ? node : parent; - const right = (getChildNode(parent) !== node) ? node : parent; - const data = { - leftOperator: left.operator || "?:", - rightOperator: right.operator || "?:" - }; - - context.report({ - node: left, - loc: getOperatorToken(left).loc, - messageId: "unexpectedMixedOperator", - data - }); - context.report({ - node: right, - loc: getOperatorToken(right).loc, - messageId: "unexpectedMixedOperator", - data - }); - } - - /** - * Checks between the operator of this node and the operator of the - * parent node. - * @param {ASTNode} node A node to check. - * @returns {void} - */ - function check(node) { - if ( - TARGET_NODE_TYPE.test(node.parent.type) && - isMixedWithParent(node) && - !shouldIgnore(node) - ) { - reportBothOperators(node); - } - } - - return { - BinaryExpression: check, - LogicalExpression: check - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-mixed-requires.js b/node_modules/eslint/lib/rules/no-mixed-requires.js deleted file mode 100644 index 9e7b80390..000000000 --- a/node_modules/eslint/lib/rules/no-mixed-requires.js +++ /dev/null @@ -1,238 +0,0 @@ -/** - * @fileoverview Rule to enforce grouped require statements for Node.JS - * @author Raphael Pigulla - * @deprecated in ESLint v7.0.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Disallow `require` calls to be mixed with regular variable declarations", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-mixed-requires" - }, - - schema: [ - { - oneOf: [ - { - type: "boolean" - }, - { - type: "object", - properties: { - grouping: { - type: "boolean" - }, - allowCall: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - noMixRequire: "Do not mix 'require' and other declarations.", - noMixCoreModuleFileComputed: "Do not mix core, module, file and computed requires." - } - }, - - create(context) { - - const options = context.options[0]; - let grouping = false, - allowCall = false; - - if (typeof options === "object") { - grouping = options.grouping; - allowCall = options.allowCall; - } else { - grouping = !!options; - } - - /** - * Returns the list of built-in modules. - * @returns {string[]} An array of built-in Node.js modules. - */ - function getBuiltinModules() { - - /* - * This list is generated using: - * `require("repl")._builtinLibs.concat('repl').sort()` - * This particular list is as per nodejs v0.12.2 and iojs v0.7.1 - */ - return [ - "assert", "buffer", "child_process", "cluster", "crypto", - "dgram", "dns", "domain", "events", "fs", "http", "https", - "net", "os", "path", "punycode", "querystring", "readline", - "repl", "smalloc", "stream", "string_decoder", "tls", "tty", - "url", "util", "v8", "vm", "zlib" - ]; - } - - const BUILTIN_MODULES = getBuiltinModules(); - - const DECL_REQUIRE = "require", - DECL_UNINITIALIZED = "uninitialized", - DECL_OTHER = "other"; - - const REQ_CORE = "core", - REQ_FILE = "file", - REQ_MODULE = "module", - REQ_COMPUTED = "computed"; - - /** - * Determines the type of a declaration statement. - * @param {ASTNode} initExpression The init node of the VariableDeclarator. - * @returns {string} The type of declaration represented by the expression. - */ - function getDeclarationType(initExpression) { - if (!initExpression) { - - // "var x;" - return DECL_UNINITIALIZED; - } - - if (initExpression.type === "CallExpression" && - initExpression.callee.type === "Identifier" && - initExpression.callee.name === "require" - ) { - - // "var x = require('util');" - return DECL_REQUIRE; - } - if (allowCall && - initExpression.type === "CallExpression" && - initExpression.callee.type === "CallExpression" - ) { - - // "var x = require('diagnose')('sub-module');" - return getDeclarationType(initExpression.callee); - } - if (initExpression.type === "MemberExpression") { - - // "var x = require('glob').Glob;" - return getDeclarationType(initExpression.object); - } - - // "var x = 42;" - return DECL_OTHER; - } - - /** - * Determines the type of module that is loaded via require. - * @param {ASTNode} initExpression The init node of the VariableDeclarator. - * @returns {string} The module type. - */ - function inferModuleType(initExpression) { - if (initExpression.type === "MemberExpression") { - - // "var x = require('glob').Glob;" - return inferModuleType(initExpression.object); - } - if (initExpression.arguments.length === 0) { - - // "var x = require();" - return REQ_COMPUTED; - } - - const arg = initExpression.arguments[0]; - - if (arg.type !== "Literal" || typeof arg.value !== "string") { - - // "var x = require(42);" - return REQ_COMPUTED; - } - - if (BUILTIN_MODULES.includes(arg.value)) { - - // "var fs = require('fs');" - return REQ_CORE; - } - if (/^\.{0,2}\//u.test(arg.value)) { - - // "var utils = require('./utils');" - return REQ_FILE; - } - - // "var async = require('async');" - return REQ_MODULE; - - } - - /** - * Check if the list of variable declarations is mixed, i.e. whether it - * contains both require and other declarations. - * @param {ASTNode} declarations The list of VariableDeclarators. - * @returns {boolean} True if the declarations are mixed, false if not. - */ - function isMixed(declarations) { - const contains = {}; - - declarations.forEach(declaration => { - const type = getDeclarationType(declaration.init); - - contains[type] = true; - }); - - return !!( - contains[DECL_REQUIRE] && - (contains[DECL_UNINITIALIZED] || contains[DECL_OTHER]) - ); - } - - /** - * Check if all require declarations in the given list are of the same - * type. - * @param {ASTNode} declarations The list of VariableDeclarators. - * @returns {boolean} True if the declarations are grouped, false if not. - */ - function isGrouped(declarations) { - const found = {}; - - declarations.forEach(declaration => { - if (getDeclarationType(declaration.init) === DECL_REQUIRE) { - found[inferModuleType(declaration.init)] = true; - } - }); - - return Object.keys(found).length <= 1; - } - - - return { - - VariableDeclaration(node) { - - if (isMixed(node.declarations)) { - context.report({ - node, - messageId: "noMixRequire" - }); - } else if (grouping && !isGrouped(node.declarations)) { - context.report({ - node, - messageId: "noMixCoreModuleFileComputed" - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js b/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js deleted file mode 100644 index a18e4f30d..000000000 --- a/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js +++ /dev/null @@ -1,113 +0,0 @@ -/** - * @fileoverview Disallow mixed spaces and tabs for indentation - * @author Jary Niebur - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Disallow mixed spaces and tabs for indentation", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-mixed-spaces-and-tabs" - }, - - schema: [ - { - enum: ["smart-tabs", true, false] - } - ], - - messages: { - mixedSpacesAndTabs: "Mixed spaces and tabs." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - let smartTabs; - - switch (context.options[0]) { - case true: // Support old syntax, maybe add deprecation warning here - case "smart-tabs": - smartTabs = true; - break; - default: - smartTabs = false; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - "Program:exit"(node) { - const lines = sourceCode.lines, - comments = sourceCode.getAllComments(), - ignoredCommentLines = new Set(); - - // Add all lines except the first ones. - comments.forEach(comment => { - for (let i = comment.loc.start.line + 1; i <= comment.loc.end.line; i++) { - ignoredCommentLines.add(i); - } - }); - - /* - * At least one space followed by a tab - * or the reverse before non-tab/-space - * characters begin. - */ - let regex = /^(?=( +|\t+))\1(?:\t| )/u; - - if (smartTabs) { - - /* - * At least one space followed by a tab - * before non-tab/-space characters begin. - */ - regex = /^(?=(\t*))\1(?=( +))\2\t/u; - } - - lines.forEach((line, i) => { - const match = regex.exec(line); - - if (match) { - const lineNumber = i + 1; - const loc = { - start: { - line: lineNumber, - column: match[0].length - 2 - }, - end: { - line: lineNumber, - column: match[0].length - } - }; - - if (!ignoredCommentLines.has(lineNumber)) { - const containingNode = sourceCode.getNodeByRangeIndex(sourceCode.getIndexFromLoc(loc.start)); - - if (!(containingNode && ["Literal", "TemplateElement"].includes(containingNode.type))) { - context.report({ - node, - loc, - messageId: "mixedSpacesAndTabs" - }); - } - } - } - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-multi-assign.js b/node_modules/eslint/lib/rules/no-multi-assign.js deleted file mode 100644 index a7a50c194..000000000 --- a/node_modules/eslint/lib/rules/no-multi-assign.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @fileoverview Rule to check use of chained assignment expressions - * @author Stewart Rand - */ - -"use strict"; - - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow use of chained assignment expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-multi-assign" - }, - - schema: [{ - type: "object", - properties: { - ignoreNonDeclaration: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - - messages: { - unexpectedChain: "Unexpected chained assignment." - } - }, - - create(context) { - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - const options = context.options[0] || { - ignoreNonDeclaration: false - }; - const selectors = [ - "VariableDeclarator > AssignmentExpression.init", - "PropertyDefinition > AssignmentExpression.value" - ]; - - if (!options.ignoreNonDeclaration) { - selectors.push("AssignmentExpression > AssignmentExpression.right"); - } - - return { - [selectors](node) { - context.report({ - node, - messageId: "unexpectedChain" - }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-multi-spaces.js b/node_modules/eslint/lib/rules/no-multi-spaces.js deleted file mode 100644 index 62074e657..000000000 --- a/node_modules/eslint/lib/rules/no-multi-spaces.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @fileoverview Disallow use of multiple spaces. - * @author Nicholas C. Zakas - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Disallow multiple spaces", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-multi-spaces" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - exceptions: { - type: "object", - patternProperties: { - "^([A-Z][a-z]*)+$": { - type: "boolean" - } - }, - additionalProperties: false - }, - ignoreEOLComments: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - multipleSpaces: "Multiple spaces found before '{{displayValue}}'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const options = context.options[0] || {}; - const ignoreEOLComments = options.ignoreEOLComments; - const exceptions = Object.assign({ Property: true }, options.exceptions); - const hasExceptions = Object.keys(exceptions).some(key => exceptions[key]); - - /** - * Formats value of given comment token for error message by truncating its length. - * @param {Token} token comment token - * @returns {string} formatted value - * @private - */ - function formatReportedCommentValue(token) { - const valueLines = token.value.split("\n"); - const value = valueLines[0]; - const formattedValue = `${value.slice(0, 12)}...`; - - return valueLines.length === 1 && value.length <= 12 ? value : formattedValue; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - Program() { - sourceCode.tokensAndComments.forEach((leftToken, leftIndex, tokensAndComments) => { - if (leftIndex === tokensAndComments.length - 1) { - return; - } - const rightToken = tokensAndComments[leftIndex + 1]; - - // Ignore tokens that don't have 2 spaces between them or are on different lines - if ( - !sourceCode.text.slice(leftToken.range[1], rightToken.range[0]).includes(" ") || - leftToken.loc.end.line < rightToken.loc.start.line - ) { - return; - } - - // Ignore comments that are the last token on their line if `ignoreEOLComments` is active. - if ( - ignoreEOLComments && - astUtils.isCommentToken(rightToken) && - ( - leftIndex === tokensAndComments.length - 2 || - rightToken.loc.end.line < tokensAndComments[leftIndex + 2].loc.start.line - ) - ) { - return; - } - - // Ignore tokens that are in a node in the "exceptions" object - if (hasExceptions) { - const parentNode = sourceCode.getNodeByRangeIndex(rightToken.range[0] - 1); - - if (parentNode && exceptions[parentNode.type]) { - return; - } - } - - let displayValue; - - if (rightToken.type === "Block") { - displayValue = `/*${formatReportedCommentValue(rightToken)}*/`; - } else if (rightToken.type === "Line") { - displayValue = `//${formatReportedCommentValue(rightToken)}`; - } else { - displayValue = rightToken.value; - } - - context.report({ - node: rightToken, - loc: { start: leftToken.loc.end, end: rightToken.loc.start }, - messageId: "multipleSpaces", - data: { displayValue }, - fix: fixer => fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], " ") - }); - }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-multi-str.js b/node_modules/eslint/lib/rules/no-multi-str.js deleted file mode 100644 index 8011729ec..000000000 --- a/node_modules/eslint/lib/rules/no-multi-str.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @fileoverview Rule to flag when using multiline strings - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow multiline strings", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-multi-str" - }, - - schema: [], - - messages: { - multilineString: "Multiline support is limited to browsers supporting ES5 only." - } - }, - - create(context) { - - /** - * Determines if a given node is part of JSX syntax. - * @param {ASTNode} node The node to check. - * @returns {boolean} True if the node is a JSX node, false if not. - * @private - */ - function isJSXElement(node) { - return node.type.indexOf("JSX") === 0; - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - - Literal(node) { - if (astUtils.LINEBREAK_MATCHER.test(node.raw) && !isJSXElement(node.parent)) { - context.report({ - node, - messageId: "multilineString" - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-multiple-empty-lines.js b/node_modules/eslint/lib/rules/no-multiple-empty-lines.js deleted file mode 100644 index 2c0fbf2c6..000000000 --- a/node_modules/eslint/lib/rules/no-multiple-empty-lines.js +++ /dev/null @@ -1,151 +0,0 @@ -/** - * @fileoverview Disallows multiple blank lines. - * implementation adapted from the no-trailing-spaces rule. - * @author Greg Cochard - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Disallow multiple empty lines", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-multiple-empty-lines" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - max: { - type: "integer", - minimum: 0 - }, - maxEOF: { - type: "integer", - minimum: 0 - }, - maxBOF: { - type: "integer", - minimum: 0 - } - }, - required: ["max"], - additionalProperties: false - } - ], - - messages: { - blankBeginningOfFile: "Too many blank lines at the beginning of file. Max of {{max}} allowed.", - blankEndOfFile: "Too many blank lines at the end of file. Max of {{max}} allowed.", - consecutiveBlank: "More than {{max}} blank {{pluralizedLines}} not allowed." - } - }, - - create(context) { - - // Use options.max or 2 as default - let max = 2, - maxEOF = max, - maxBOF = max; - - if (context.options.length) { - max = context.options[0].max; - maxEOF = typeof context.options[0].maxEOF !== "undefined" ? context.options[0].maxEOF : max; - maxBOF = typeof context.options[0].maxBOF !== "undefined" ? context.options[0].maxBOF : max; - } - - const sourceCode = context.sourceCode; - - // Swallow the final newline, as some editors add it automatically and we don't want it to cause an issue - const allLines = sourceCode.lines[sourceCode.lines.length - 1] === "" ? sourceCode.lines.slice(0, -1) : sourceCode.lines; - const templateLiteralLines = new Set(); - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - TemplateLiteral(node) { - node.quasis.forEach(literalPart => { - - // Empty lines have a semantic meaning if they're inside template literals. Don't count these as empty lines. - for (let ignoredLine = literalPart.loc.start.line; ignoredLine < literalPart.loc.end.line; ignoredLine++) { - templateLiteralLines.add(ignoredLine); - } - }); - }, - "Program:exit"(node) { - return allLines - - // Given a list of lines, first get a list of line numbers that are non-empty. - .reduce((nonEmptyLineNumbers, line, index) => { - if (line.trim() || templateLiteralLines.has(index + 1)) { - nonEmptyLineNumbers.push(index + 1); - } - return nonEmptyLineNumbers; - }, []) - - // Add a value at the end to allow trailing empty lines to be checked. - .concat(allLines.length + 1) - - // Given two line numbers of non-empty lines, report the lines between if the difference is too large. - .reduce((lastLineNumber, lineNumber) => { - let messageId, maxAllowed; - - if (lastLineNumber === 0) { - messageId = "blankBeginningOfFile"; - maxAllowed = maxBOF; - } else if (lineNumber === allLines.length + 1) { - messageId = "blankEndOfFile"; - maxAllowed = maxEOF; - } else { - messageId = "consecutiveBlank"; - maxAllowed = max; - } - - if (lineNumber - lastLineNumber - 1 > maxAllowed) { - context.report({ - node, - loc: { - start: { line: lastLineNumber + maxAllowed + 1, column: 0 }, - end: { line: lineNumber, column: 0 } - }, - messageId, - data: { - max: maxAllowed, - pluralizedLines: maxAllowed === 1 ? "line" : "lines" - }, - fix(fixer) { - const rangeStart = sourceCode.getIndexFromLoc({ line: lastLineNumber + 1, column: 0 }); - - /* - * The end of the removal range is usually the start index of the next line. - * However, at the end of the file there is no next line, so the end of the - * range is just the length of the text. - */ - const lineNumberAfterRemovedLines = lineNumber - maxAllowed; - const rangeEnd = lineNumberAfterRemovedLines <= allLines.length - ? sourceCode.getIndexFromLoc({ line: lineNumberAfterRemovedLines, column: 0 }) - : sourceCode.text.length; - - return fixer.removeRange([rangeStart, rangeEnd]); - } - }); - } - - return lineNumber; - }, 0); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-native-reassign.js b/node_modules/eslint/lib/rules/no-native-reassign.js deleted file mode 100644 index e3fed4451..000000000 --- a/node_modules/eslint/lib/rules/no-native-reassign.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @fileoverview Rule to disallow assignments to native objects or read-only global variables - * @author Ilya Volodin - * @deprecated in ESLint v3.3.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow assignments to native objects or read-only global variables", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-native-reassign" - }, - - deprecated: true, - - replacedBy: ["no-global-assign"], - - schema: [ - { - type: "object", - properties: { - exceptions: { - type: "array", - items: { type: "string" }, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - nativeReassign: "Read-only global '{{name}}' should not be modified." - } - }, - - create(context) { - const config = context.options[0]; - const exceptions = (config && config.exceptions) || []; - const sourceCode = context.sourceCode; - - /** - * Reports write references. - * @param {Reference} reference A reference to check. - * @param {int} index The index of the reference in the references. - * @param {Reference[]} references The array that the reference belongs to. - * @returns {void} - */ - function checkReference(reference, index, references) { - const identifier = reference.identifier; - - if (reference.init === false && - reference.isWrite() && - - /* - * Destructuring assignments can have multiple default value, - * so possibly there are multiple writeable references for the same identifier. - */ - (index === 0 || references[index - 1].identifier !== identifier) - ) { - context.report({ - node: identifier, - messageId: "nativeReassign", - data: identifier - }); - } - } - - /** - * Reports write references if a given variable is read-only builtin. - * @param {Variable} variable A variable to check. - * @returns {void} - */ - function checkVariable(variable) { - if (variable.writeable === false && !exceptions.includes(variable.name)) { - variable.references.forEach(checkReference); - } - } - - return { - Program(node) { - const globalScope = sourceCode.getScope(node); - - globalScope.variables.forEach(checkVariable); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-negated-condition.js b/node_modules/eslint/lib/rules/no-negated-condition.js deleted file mode 100644 index 3cb759049..000000000 --- a/node_modules/eslint/lib/rules/no-negated-condition.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @fileoverview Rule to disallow a negated condition - * @author Alberto Rodríguez - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow negated conditions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-negated-condition" - }, - - schema: [], - - messages: { - unexpectedNegated: "Unexpected negated condition." - } - }, - - create(context) { - - /** - * Determines if a given node is an if-else without a condition on the else - * @param {ASTNode} node The node to check. - * @returns {boolean} True if the node has an else without an if. - * @private - */ - function hasElseWithoutCondition(node) { - return node.alternate && node.alternate.type !== "IfStatement"; - } - - /** - * Determines if a given node is a negated unary expression - * @param {Object} test The test object to check. - * @returns {boolean} True if the node is a negated unary expression. - * @private - */ - function isNegatedUnaryExpression(test) { - return test.type === "UnaryExpression" && test.operator === "!"; - } - - /** - * Determines if a given node is a negated binary expression - * @param {Test} test The test to check. - * @returns {boolean} True if the node is a negated binary expression. - * @private - */ - function isNegatedBinaryExpression(test) { - return test.type === "BinaryExpression" && - (test.operator === "!=" || test.operator === "!=="); - } - - /** - * Determines if a given node has a negated if expression - * @param {ASTNode} node The node to check. - * @returns {boolean} True if the node has a negated if expression. - * @private - */ - function isNegatedIf(node) { - return isNegatedUnaryExpression(node.test) || isNegatedBinaryExpression(node.test); - } - - return { - IfStatement(node) { - if (!hasElseWithoutCondition(node)) { - return; - } - - if (isNegatedIf(node)) { - context.report({ - node, - messageId: "unexpectedNegated" - }); - } - }, - ConditionalExpression(node) { - if (isNegatedIf(node)) { - context.report({ - node, - messageId: "unexpectedNegated" - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-negated-in-lhs.js b/node_modules/eslint/lib/rules/no-negated-in-lhs.js deleted file mode 100644 index 7a50be7f2..000000000 --- a/node_modules/eslint/lib/rules/no-negated-in-lhs.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @fileoverview A rule to disallow negated left operands of the `in` operator - * @author Michael Ficarra - * @deprecated in ESLint v3.3.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow negating the left operand in `in` expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-negated-in-lhs" - }, - - replacedBy: ["no-unsafe-negation"], - - deprecated: true, - schema: [], - - messages: { - negatedLHS: "The 'in' expression's left operand is negated." - } - }, - - create(context) { - - return { - - BinaryExpression(node) { - if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") { - context.report({ node, messageId: "negatedLHS" }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-nested-ternary.js b/node_modules/eslint/lib/rules/no-nested-ternary.js deleted file mode 100644 index faf80416c..000000000 --- a/node_modules/eslint/lib/rules/no-nested-ternary.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @fileoverview Rule to flag nested ternary expressions - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow nested ternary expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-nested-ternary" - }, - - schema: [], - - messages: { - noNestedTernary: "Do not nest ternary expressions." - } - }, - - create(context) { - - return { - ConditionalExpression(node) { - if (node.alternate.type === "ConditionalExpression" || - node.consequent.type === "ConditionalExpression") { - context.report({ - node, - messageId: "noNestedTernary" - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-new-func.js b/node_modules/eslint/lib/rules/no-new-func.js deleted file mode 100644 index d58b2d715..000000000 --- a/node_modules/eslint/lib/rules/no-new-func.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @fileoverview Rule to flag when using new Function - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const callMethods = new Set(["apply", "bind", "call"]); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `new` operators with the `Function` object", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-new-func" - }, - - schema: [], - - messages: { - noFunctionConstructor: "The Function constructor is eval." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - const variable = globalScope.set.get("Function"); - - if (variable && variable.defs.length === 0) { - variable.references.forEach(ref => { - const idNode = ref.identifier; - const { parent } = idNode; - let evalNode; - - if (parent) { - if (idNode === parent.callee && ( - parent.type === "NewExpression" || - parent.type === "CallExpression" - )) { - evalNode = parent; - } else if ( - parent.type === "MemberExpression" && - idNode === parent.object && - callMethods.has(astUtils.getStaticPropertyName(parent)) - ) { - const maybeCallee = parent.parent.type === "ChainExpression" ? parent.parent : parent; - - if (maybeCallee.parent.type === "CallExpression" && maybeCallee.parent.callee === maybeCallee) { - evalNode = maybeCallee.parent; - } - } - } - - if (evalNode) { - context.report({ - node: evalNode, - messageId: "noFunctionConstructor" - }); - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js b/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js deleted file mode 100644 index ee70d281d..000000000 --- a/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @fileoverview Rule to disallow use of the new operator with global non-constructor functions - * @author Sosuke Suzuki - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const nonConstructorGlobalFunctionNames = ["Symbol", "BigInt"]; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow `new` operators with global non-constructor functions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-new-native-nonconstructor" - }, - - schema: [], - - messages: { - noNewNonconstructor: "`{{name}}` cannot be called as a constructor." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - - for (const nonConstructorName of nonConstructorGlobalFunctionNames) { - const variable = globalScope.set.get(nonConstructorName); - - if (variable && variable.defs.length === 0) { - variable.references.forEach(ref => { - const idNode = ref.identifier; - const parent = idNode.parent; - - if (parent && parent.type === "NewExpression" && parent.callee === idNode) { - context.report({ - node: idNode, - messageId: "noNewNonconstructor", - data: { name: nonConstructorName } - }); - } - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-new-object.js b/node_modules/eslint/lib/rules/no-new-object.js deleted file mode 100644 index 08a482be7..000000000 --- a/node_modules/eslint/lib/rules/no-new-object.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @fileoverview A rule to disallow calls to the Object constructor - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `Object` constructors", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-new-object" - }, - - schema: [], - - messages: { - preferLiteral: "The object literal notation {} is preferable." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - NewExpression(node) { - const variable = astUtils.getVariableByName( - sourceCode.getScope(node), - node.callee.name - ); - - if (variable && variable.identifiers.length > 0) { - return; - } - - if (node.callee.name === "Object") { - context.report({ - node, - messageId: "preferLiteral" - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-new-require.js b/node_modules/eslint/lib/rules/no-new-require.js deleted file mode 100644 index 6abfc17c8..000000000 --- a/node_modules/eslint/lib/rules/no-new-require.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @fileoverview Rule to disallow use of new operator with the `require` function - * @author Wil Moore III - * @deprecated in ESLint v7.0.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Disallow `new` operators with calls to `require`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-new-require" - }, - - schema: [], - - messages: { - noNewRequire: "Unexpected use of new with require." - } - }, - - create(context) { - - return { - - NewExpression(node) { - if (node.callee.type === "Identifier" && node.callee.name === "require") { - context.report({ - node, - messageId: "noNewRequire" - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-new-symbol.js b/node_modules/eslint/lib/rules/no-new-symbol.js deleted file mode 100644 index 998302202..000000000 --- a/node_modules/eslint/lib/rules/no-new-symbol.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @fileoverview Rule to disallow use of the new operator with the `Symbol` object - * @author Alberto Rodríguez - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow `new` operators with the `Symbol` object", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-new-symbol" - }, - - schema: [], - - messages: { - noNewSymbol: "`Symbol` cannot be called as a constructor." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - const variable = globalScope.set.get("Symbol"); - - if (variable && variable.defs.length === 0) { - variable.references.forEach(ref => { - const idNode = ref.identifier; - const parent = idNode.parent; - - if (parent && parent.type === "NewExpression" && parent.callee === idNode) { - context.report({ - node: idNode, - messageId: "noNewSymbol" - }); - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-new-wrappers.js b/node_modules/eslint/lib/rules/no-new-wrappers.js deleted file mode 100644 index 9a12e1a3b..000000000 --- a/node_modules/eslint/lib/rules/no-new-wrappers.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @fileoverview Rule to flag when using constructor for wrapper objects - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `new` operators with the `String`, `Number`, and `Boolean` objects", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-new-wrappers" - }, - - schema: [], - - messages: { - noConstructor: "Do not use {{fn}} as a constructor." - } - }, - - create(context) { - - return { - - NewExpression(node) { - const wrapperObjects = ["String", "Number", "Boolean"]; - - if (wrapperObjects.includes(node.callee.name)) { - context.report({ - node, - messageId: "noConstructor", - data: { fn: node.callee.name } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-new.js b/node_modules/eslint/lib/rules/no-new.js deleted file mode 100644 index 9e20bad7b..000000000 --- a/node_modules/eslint/lib/rules/no-new.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @fileoverview Rule to flag statements with function invocation preceded by - * "new" and not part of assignment - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `new` operators outside of assignments or comparisons", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-new" - }, - - schema: [], - - messages: { - noNewStatement: "Do not use 'new' for side effects." - } - }, - - create(context) { - - return { - "ExpressionStatement > NewExpression"(node) { - context.report({ - node: node.parent, - messageId: "noNewStatement" - }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js b/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js deleted file mode 100644 index 5939390fd..000000000 --- a/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js +++ /dev/null @@ -1,148 +0,0 @@ -/** - * @fileoverview Rule to disallow `\8` and `\9` escape sequences in string literals. - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const QUICK_TEST_REGEX = /\\[89]/u; - -/** - * Returns unicode escape sequence that represents the given character. - * @param {string} character A single code unit. - * @returns {string} "\uXXXX" sequence. - */ -function getUnicodeEscape(character) { - return `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `\\8` and `\\9` escape sequences in string literals", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-nonoctal-decimal-escape" - }, - - hasSuggestions: true, - - schema: [], - - messages: { - decimalEscape: "Don't use '{{decimalEscape}}' escape sequence.", - - // suggestions - refactor: "Replace '{{original}}' with '{{replacement}}'. This maintains the current functionality.", - escapeBackslash: "Replace '{{original}}' with '{{replacement}}' to include the actual backslash character." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Creates a new Suggestion object. - * @param {string} messageId "refactor" or "escapeBackslash". - * @param {int[]} range The range to replace. - * @param {string} replacement New text for the range. - * @returns {Object} Suggestion - */ - function createSuggestion(messageId, range, replacement) { - return { - messageId, - data: { - original: sourceCode.getText().slice(...range), - replacement - }, - fix(fixer) { - return fixer.replaceTextRange(range, replacement); - } - }; - } - - return { - Literal(node) { - if (typeof node.value !== "string") { - return; - } - - if (!QUICK_TEST_REGEX.test(node.raw)) { - return; - } - - const regex = /(?:[^\\]|(?\\.))*?(?\\[89])/suy; - let match; - - while ((match = regex.exec(node.raw))) { - const { previousEscape, decimalEscape } = match.groups; - const decimalEscapeRangeEnd = node.range[0] + match.index + match[0].length; - const decimalEscapeRangeStart = decimalEscapeRangeEnd - decimalEscape.length; - const decimalEscapeRange = [decimalEscapeRangeStart, decimalEscapeRangeEnd]; - const suggest = []; - - // When `regex` is matched, `previousEscape` can only capture characters adjacent to `decimalEscape` - if (previousEscape === "\\0") { - - /* - * Now we have a NULL escape "\0" immediately followed by a decimal escape, e.g.: "\0\8". - * Fixing this to "\08" would turn "\0" into a legacy octal escape. To avoid producing - * an octal escape while fixing a decimal escape, we provide different suggestions. - */ - suggest.push( - createSuggestion( // "\0\8" -> "\u00008" - "refactor", - [decimalEscapeRangeStart - previousEscape.length, decimalEscapeRangeEnd], - `${getUnicodeEscape("\0")}${decimalEscape[1]}` - ), - createSuggestion( // "\8" -> "\u0038" - "refactor", - decimalEscapeRange, - getUnicodeEscape(decimalEscape[1]) - ) - ); - } else { - suggest.push( - createSuggestion( // "\8" -> "8" - "refactor", - decimalEscapeRange, - decimalEscape[1] - ) - ); - } - - suggest.push( - createSuggestion( // "\8" -> "\\8" - "escapeBackslash", - decimalEscapeRange, - `\\${decimalEscape}` - ) - ); - - context.report({ - node, - loc: { - start: sourceCode.getLocFromIndex(decimalEscapeRangeStart), - end: sourceCode.getLocFromIndex(decimalEscapeRangeEnd) - }, - messageId: "decimalEscape", - data: { - decimalEscape - }, - suggest - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-obj-calls.js b/node_modules/eslint/lib/rules/no-obj-calls.js deleted file mode 100644 index ee767ea2f..000000000 --- a/node_modules/eslint/lib/rules/no-obj-calls.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @fileoverview Rule to flag use of an object property of the global object (Math and JSON) as a function - * @author James Allardice - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { CALL, CONSTRUCT, ReferenceTracker } = require("@eslint-community/eslint-utils"); -const getPropertyName = require("./utils/ast-utils").getStaticPropertyName; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const nonCallableGlobals = ["Atomics", "JSON", "Math", "Reflect", "Intl"]; - -/** - * Returns the name of the node to report - * @param {ASTNode} node A node to report - * @returns {string} name to report - */ -function getReportNodeName(node) { - if (node.type === "ChainExpression") { - return getReportNodeName(node.expression); - } - if (node.type === "MemberExpression") { - return getPropertyName(node); - } - return node.name; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow calling global object properties as functions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-obj-calls" - }, - - schema: [], - - messages: { - unexpectedCall: "'{{name}}' is not a function.", - unexpectedRefCall: "'{{name}}' is reference to '{{ref}}', which is not a function." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const traceMap = {}; - - for (const g of nonCallableGlobals) { - traceMap[g] = { - [CALL]: true, - [CONSTRUCT]: true - }; - } - - for (const { node: refNode, path } of tracker.iterateGlobalReferences(traceMap)) { - const name = getReportNodeName(refNode.callee); - const ref = path[0]; - const messageId = name === ref ? "unexpectedCall" : "unexpectedRefCall"; - - context.report({ node: refNode, messageId, data: { name, ref } }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-octal-escape.js b/node_modules/eslint/lib/rules/no-octal-escape.js deleted file mode 100644 index 6924d5419..000000000 --- a/node_modules/eslint/lib/rules/no-octal-escape.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @fileoverview Rule to flag octal escape sequences in string literals. - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow octal escape sequences in string literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-octal-escape" - }, - - schema: [], - - messages: { - octalEscapeSequence: "Don't use octal: '\\{{sequence}}'. Use '\\u....' instead." - } - }, - - create(context) { - - return { - - Literal(node) { - if (typeof node.value !== "string") { - return; - } - - // \0 represents a valid NULL character if it isn't followed by a digit. - const match = node.raw.match( - /^(?:[^\\]|\\.)*?\\([0-3][0-7]{1,2}|[4-7][0-7]|0(?=[89])|[1-7])/su - ); - - if (match) { - context.report({ - node, - messageId: "octalEscapeSequence", - data: { sequence: match[1] } - }); - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-octal.js b/node_modules/eslint/lib/rules/no-octal.js deleted file mode 100644 index dc027696a..000000000 --- a/node_modules/eslint/lib/rules/no-octal.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @fileoverview Rule to flag when initializing octal literal - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow octal literals", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-octal" - }, - - schema: [], - - messages: { - noOctal: "Octal literals should not be used." - } - }, - - create(context) { - - return { - - Literal(node) { - if (typeof node.value === "number" && /^0[0-9]/u.test(node.raw)) { - context.report({ - node, - messageId: "noOctal" - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-param-reassign.js b/node_modules/eslint/lib/rules/no-param-reassign.js deleted file mode 100644 index 607cafd38..000000000 --- a/node_modules/eslint/lib/rules/no-param-reassign.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * @fileoverview Disallow reassignment of function parameters. - * @author Nat Burns - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const stopNodePattern = /(?:Statement|Declaration|Function(?:Expression)?|Program)$/u; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow reassigning `function` parameters", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-param-reassign" - }, - - schema: [ - { - oneOf: [ - { - type: "object", - properties: { - props: { - enum: [false] - } - }, - additionalProperties: false - }, - { - type: "object", - properties: { - props: { - enum: [true] - }, - ignorePropertyModificationsFor: { - type: "array", - items: { - type: "string" - }, - uniqueItems: true - }, - ignorePropertyModificationsForRegex: { - type: "array", - items: { - type: "string" - }, - uniqueItems: true - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - assignmentToFunctionParam: "Assignment to function parameter '{{name}}'.", - assignmentToFunctionParamProp: "Assignment to property of function parameter '{{name}}'." - } - }, - - create(context) { - const props = context.options[0] && context.options[0].props; - const ignoredPropertyAssignmentsFor = context.options[0] && context.options[0].ignorePropertyModificationsFor || []; - const ignoredPropertyAssignmentsForRegex = context.options[0] && context.options[0].ignorePropertyModificationsForRegex || []; - const sourceCode = context.sourceCode; - - /** - * Checks whether or not the reference modifies properties of its variable. - * @param {Reference} reference A reference to check. - * @returns {boolean} Whether or not the reference modifies properties of its variable. - */ - function isModifyingProp(reference) { - let node = reference.identifier; - let parent = node.parent; - - while (parent && (!stopNodePattern.test(parent.type) || - parent.type === "ForInStatement" || parent.type === "ForOfStatement")) { - switch (parent.type) { - - // e.g. foo.a = 0; - case "AssignmentExpression": - return parent.left === node; - - // e.g. ++foo.a; - case "UpdateExpression": - return true; - - // e.g. delete foo.a; - case "UnaryExpression": - if (parent.operator === "delete") { - return true; - } - break; - - // e.g. for (foo.a in b) {} - case "ForInStatement": - case "ForOfStatement": - if (parent.left === node) { - return true; - } - - // this is a stop node for parent.right and parent.body - return false; - - // EXCLUDES: e.g. cache.get(foo.a).b = 0; - case "CallExpression": - if (parent.callee !== node) { - return false; - } - break; - - // EXCLUDES: e.g. cache[foo.a] = 0; - case "MemberExpression": - if (parent.property === node) { - return false; - } - break; - - // EXCLUDES: e.g. ({ [foo]: a }) = bar; - case "Property": - if (parent.key === node) { - return false; - } - - break; - - // EXCLUDES: e.g. (foo ? a : b).c = bar; - case "ConditionalExpression": - if (parent.test === node) { - return false; - } - - break; - - // no default - } - - node = parent; - parent = node.parent; - } - - return false; - } - - /** - * Tests that an identifier name matches any of the ignored property assignments. - * First we test strings in ignoredPropertyAssignmentsFor. - * Then we instantiate and test RegExp objects from ignoredPropertyAssignmentsForRegex strings. - * @param {string} identifierName A string that describes the name of an identifier to - * ignore property assignments for. - * @returns {boolean} Whether the string matches an ignored property assignment regular expression or not. - */ - function isIgnoredPropertyAssignment(identifierName) { - return ignoredPropertyAssignmentsFor.includes(identifierName) || - ignoredPropertyAssignmentsForRegex.some(ignored => new RegExp(ignored, "u").test(identifierName)); - } - - /** - * Reports a reference if is non initializer and writable. - * @param {Reference} reference A reference to check. - * @param {int} index The index of the reference in the references. - * @param {Reference[]} references The array that the reference belongs to. - * @returns {void} - */ - function checkReference(reference, index, references) { - const identifier = reference.identifier; - - if (identifier && - !reference.init && - - /* - * Destructuring assignments can have multiple default value, - * so possibly there are multiple writeable references for the same identifier. - */ - (index === 0 || references[index - 1].identifier !== identifier) - ) { - if (reference.isWrite()) { - context.report({ - node: identifier, - messageId: "assignmentToFunctionParam", - data: { name: identifier.name } - }); - } else if (props && isModifyingProp(reference) && !isIgnoredPropertyAssignment(identifier.name)) { - context.report({ - node: identifier, - messageId: "assignmentToFunctionParamProp", - data: { name: identifier.name } - }); - } - } - } - - /** - * Finds and reports references that are non initializer and writable. - * @param {Variable} variable A variable to check. - * @returns {void} - */ - function checkVariable(variable) { - if (variable.defs[0].type === "Parameter") { - variable.references.forEach(checkReference); - } - } - - /** - * Checks parameters of a given function node. - * @param {ASTNode} node A function node to check. - * @returns {void} - */ - function checkForFunction(node) { - sourceCode.getDeclaredVariables(node).forEach(checkVariable); - } - - return { - - // `:exit` is needed for the `node.parent` property of identifier nodes. - "FunctionDeclaration:exit": checkForFunction, - "FunctionExpression:exit": checkForFunction, - "ArrowFunctionExpression:exit": checkForFunction - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-path-concat.js b/node_modules/eslint/lib/rules/no-path-concat.js deleted file mode 100644 index 2e4a3a21c..000000000 --- a/node_modules/eslint/lib/rules/no-path-concat.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @fileoverview Disallow string concatenation when using __dirname and __filename - * @author Nicholas C. Zakas - * @deprecated in ESLint v7.0.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Disallow string concatenation with `__dirname` and `__filename`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-path-concat" - }, - - schema: [], - - messages: { - usePathFunctions: "Use path.join() or path.resolve() instead of + to create paths." - } - }, - - create(context) { - - const MATCHER = /^__(?:dir|file)name$/u; - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - BinaryExpression(node) { - - const left = node.left, - right = node.right; - - if (node.operator === "+" && - ((left.type === "Identifier" && MATCHER.test(left.name)) || - (right.type === "Identifier" && MATCHER.test(right.name))) - ) { - - context.report({ - node, - messageId: "usePathFunctions" - }); - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-plusplus.js b/node_modules/eslint/lib/rules/no-plusplus.js deleted file mode 100644 index 22a6fd013..000000000 --- a/node_modules/eslint/lib/rules/no-plusplus.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @fileoverview Rule to flag use of unary increment and decrement operators. - * @author Ian Christian Myers - * @author Brody McKee (github.com/mrmckeb) - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines whether the given node is the update node of a `ForStatement`. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is `ForStatement` update. - */ -function isForStatementUpdate(node) { - const parent = node.parent; - - return parent.type === "ForStatement" && parent.update === node; -} - -/** - * Determines whether the given node is considered to be a for loop "afterthought" by the logic of this rule. - * In particular, it returns `true` if the given node is either: - * - The update node of a `ForStatement`: for (;; i++) {} - * - An operand of a sequence expression that is the update node: for (;; foo(), i++) {} - * - An operand of a sequence expression that is child of another sequence expression, etc., - * up to the sequence expression that is the update node: for (;; foo(), (bar(), (baz(), i++))) {} - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is a for loop afterthought. - */ -function isForLoopAfterthought(node) { - const parent = node.parent; - - if (parent.type === "SequenceExpression") { - return isForLoopAfterthought(parent); - } - - return isForStatementUpdate(node); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the unary operators `++` and `--`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-plusplus" - }, - - schema: [ - { - type: "object", - properties: { - allowForLoopAfterthoughts: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedUnaryOp: "Unary operator '{{operator}}' used." - } - }, - - create(context) { - - const config = context.options[0]; - let allowForLoopAfterthoughts = false; - - if (typeof config === "object") { - allowForLoopAfterthoughts = config.allowForLoopAfterthoughts === true; - } - - return { - - UpdateExpression(node) { - if (allowForLoopAfterthoughts && isForLoopAfterthought(node)) { - return; - } - - context.report({ - node, - messageId: "unexpectedUnaryOp", - data: { - operator: node.operator - } - }); - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-process-env.js b/node_modules/eslint/lib/rules/no-process-env.js deleted file mode 100644 index 8dac648ff..000000000 --- a/node_modules/eslint/lib/rules/no-process-env.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @fileoverview Disallow the use of process.env() - * @author Vignesh Anand - * @deprecated in ESLint v7.0.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Disallow the use of `process.env`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-process-env" - }, - - schema: [], - - messages: { - unexpectedProcessEnv: "Unexpected use of process.env." - } - }, - - create(context) { - - return { - - MemberExpression(node) { - const objectName = node.object.name, - propertyName = node.property.name; - - if (objectName === "process" && !node.computed && propertyName && propertyName === "env") { - context.report({ node, messageId: "unexpectedProcessEnv" }); - } - - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-process-exit.js b/node_modules/eslint/lib/rules/no-process-exit.js deleted file mode 100644 index fa398a72e..000000000 --- a/node_modules/eslint/lib/rules/no-process-exit.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @fileoverview Disallow the use of process.exit() - * @author Nicholas C. Zakas - * @deprecated in ESLint v7.0.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Disallow the use of `process.exit()`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-process-exit" - }, - - schema: [], - - messages: { - noProcessExit: "Don't use process.exit(); throw an error instead." - } - }, - - create(context) { - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - "CallExpression > MemberExpression.callee[object.name = 'process'][property.name = 'exit']"(node) { - context.report({ node: node.parent, messageId: "noProcessExit" }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-promise-executor-return.js b/node_modules/eslint/lib/rules/no-promise-executor-return.js deleted file mode 100644 index d46a730e4..000000000 --- a/node_modules/eslint/lib/rules/no-promise-executor-return.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @fileoverview Rule to disallow returning values from Promise executor functions - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { findVariable } = require("@eslint-community/eslint-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const functionTypesToCheck = new Set(["ArrowFunctionExpression", "FunctionExpression"]); - -/** - * Determines whether the given identifier node is a reference to a global variable. - * @param {ASTNode} node `Identifier` node to check. - * @param {Scope} scope Scope to which the node belongs. - * @returns {boolean} True if the identifier is a reference to a global variable. - */ -function isGlobalReference(node, scope) { - const variable = findVariable(scope, node); - - return variable !== null && variable.scope.type === "global" && variable.defs.length === 0; -} - -/** - * Finds function's outer scope. - * @param {Scope} scope Function's own scope. - * @returns {Scope} Function's outer scope. - */ -function getOuterScope(scope) { - const upper = scope.upper; - - if (upper.type === "function-expression-name") { - return upper.upper; - } - return upper; -} - -/** - * Determines whether the given function node is used as a Promise executor. - * @param {ASTNode} node The node to check. - * @param {Scope} scope Function's own scope. - * @returns {boolean} `true` if the node is a Promise executor. - */ -function isPromiseExecutor(node, scope) { - const parent = node.parent; - - return parent.type === "NewExpression" && - parent.arguments[0] === node && - parent.callee.type === "Identifier" && - parent.callee.name === "Promise" && - isGlobalReference(parent.callee, getOuterScope(scope)); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow returning values from Promise executor functions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-promise-executor-return" - }, - - schema: [], - - messages: { - returnsValue: "Return values from promise executor functions cannot be read." - } - }, - - create(context) { - - let funcInfo = null; - const sourceCode = context.sourceCode; - - /** - * Reports the given node. - * @param {ASTNode} node Node to report. - * @returns {void} - */ - function report(node) { - context.report({ node, messageId: "returnsValue" }); - } - - return { - - onCodePathStart(_, node) { - funcInfo = { - upper: funcInfo, - shouldCheck: functionTypesToCheck.has(node.type) && isPromiseExecutor(node, sourceCode.getScope(node)) - }; - - if (funcInfo.shouldCheck && node.type === "ArrowFunctionExpression" && node.expression) { - report(node.body); - } - }, - - onCodePathEnd() { - funcInfo = funcInfo.upper; - }, - - ReturnStatement(node) { - if (funcInfo.shouldCheck && node.argument) { - report(node); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-proto.js b/node_modules/eslint/lib/rules/no-proto.js deleted file mode 100644 index 28320d5d5..000000000 --- a/node_modules/eslint/lib/rules/no-proto.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @fileoverview Rule to flag usage of __proto__ property - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { getStaticPropertyName } = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the use of the `__proto__` property", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-proto" - }, - - schema: [], - - messages: { - unexpectedProto: "The '__proto__' property is deprecated." - } - }, - - create(context) { - - return { - - MemberExpression(node) { - if (getStaticPropertyName(node) === "__proto__") { - context.report({ node, messageId: "unexpectedProto" }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-prototype-builtins.js b/node_modules/eslint/lib/rules/no-prototype-builtins.js deleted file mode 100644 index a7a57bc11..000000000 --- a/node_modules/eslint/lib/rules/no-prototype-builtins.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @fileoverview Rule to disallow use of Object.prototype builtins on objects - * @author Andrew Levine - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow calling some `Object.prototype` methods directly on objects", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-prototype-builtins" - }, - - schema: [], - - messages: { - prototypeBuildIn: "Do not access Object.prototype method '{{prop}}' from target object." - } - }, - - create(context) { - const DISALLOWED_PROPS = new Set([ - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable" - ]); - - /** - * Reports if a disallowed property is used in a CallExpression - * @param {ASTNode} node The CallExpression node. - * @returns {void} - */ - function disallowBuiltIns(node) { - - const callee = astUtils.skipChainExpression(node.callee); - - if (callee.type !== "MemberExpression") { - return; - } - - const propName = astUtils.getStaticPropertyName(callee); - - if (propName !== null && DISALLOWED_PROPS.has(propName)) { - context.report({ - messageId: "prototypeBuildIn", - loc: callee.property.loc, - data: { prop: propName }, - node - }); - } - } - - return { - CallExpression: disallowBuiltIns - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-redeclare.js b/node_modules/eslint/lib/rules/no-redeclare.js deleted file mode 100644 index 8a4877e8a..000000000 --- a/node_modules/eslint/lib/rules/no-redeclare.js +++ /dev/null @@ -1,174 +0,0 @@ -/** - * @fileoverview Rule to flag when the same variable is declared more then once. - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow variable redeclaration", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-redeclare" - }, - - messages: { - redeclared: "'{{id}}' is already defined.", - redeclaredAsBuiltin: "'{{id}}' is already defined as a built-in global variable.", - redeclaredBySyntax: "'{{id}}' is already defined by a variable declaration." - }, - - schema: [ - { - type: "object", - properties: { - builtinGlobals: { type: "boolean", default: true } - }, - additionalProperties: false - } - ] - }, - - create(context) { - const options = { - builtinGlobals: Boolean( - context.options.length === 0 || - context.options[0].builtinGlobals - ) - }; - const sourceCode = context.sourceCode; - - /** - * Iterate declarations of a given variable. - * @param {escope.variable} variable The variable object to iterate declarations. - * @returns {IterableIterator<{type:string,node:ASTNode,loc:SourceLocation}>} The declarations. - */ - function *iterateDeclarations(variable) { - if (options.builtinGlobals && ( - variable.eslintImplicitGlobalSetting === "readonly" || - variable.eslintImplicitGlobalSetting === "writable" - )) { - yield { type: "builtin" }; - } - - for (const id of variable.identifiers) { - yield { type: "syntax", node: id, loc: id.loc }; - } - - if (variable.eslintExplicitGlobalComments) { - for (const comment of variable.eslintExplicitGlobalComments) { - yield { - type: "comment", - node: comment, - loc: astUtils.getNameLocationInGlobalDirectiveComment( - sourceCode, - comment, - variable.name - ) - }; - } - } - } - - /** - * Find variables in a given scope and flag redeclared ones. - * @param {Scope} scope An eslint-scope scope object. - * @returns {void} - * @private - */ - function findVariablesInScope(scope) { - for (const variable of scope.variables) { - const [ - declaration, - ...extraDeclarations - ] = iterateDeclarations(variable); - - if (extraDeclarations.length === 0) { - continue; - } - - /* - * If the type of a declaration is different from the type of - * the first declaration, it shows the location of the first - * declaration. - */ - const detailMessageId = declaration.type === "builtin" - ? "redeclaredAsBuiltin" - : "redeclaredBySyntax"; - const data = { id: variable.name }; - - // Report extra declarations. - for (const { type, node, loc } of extraDeclarations) { - const messageId = type === declaration.type - ? "redeclared" - : detailMessageId; - - context.report({ node, loc, messageId, data }); - } - } - } - - /** - * Find variables in the current scope. - * @param {ASTNode} node The node of the current scope. - * @returns {void} - * @private - */ - function checkForBlock(node) { - const scope = sourceCode.getScope(node); - - /* - * In ES5, some node type such as `BlockStatement` doesn't have that scope. - * `scope.block` is a different node in such a case. - */ - if (scope.block === node) { - findVariablesInScope(scope); - } - } - - return { - Program(node) { - const scope = sourceCode.getScope(node); - - findVariablesInScope(scope); - - // Node.js or ES modules has a special scope. - if ( - scope.type === "global" && - scope.childScopes[0] && - - // The special scope's block is the Program node. - scope.block === scope.childScopes[0].block - ) { - findVariablesInScope(scope.childScopes[0]); - } - }, - - FunctionDeclaration: checkForBlock, - FunctionExpression: checkForBlock, - ArrowFunctionExpression: checkForBlock, - - StaticBlock: checkForBlock, - - BlockStatement: checkForBlock, - ForStatement: checkForBlock, - ForInStatement: checkForBlock, - ForOfStatement: checkForBlock, - SwitchStatement: checkForBlock - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-regex-spaces.js b/node_modules/eslint/lib/rules/no-regex-spaces.js deleted file mode 100644 index e7fae6d40..000000000 --- a/node_modules/eslint/lib/rules/no-regex-spaces.js +++ /dev/null @@ -1,182 +0,0 @@ -/** - * @fileoverview Rule to count multiple spaces in regular expressions - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const regexpp = require("@eslint-community/regexpp"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const regExpParser = new regexpp.RegExpParser(); -const DOUBLE_SPACE = / {2}/u; - -/** - * Check if node is a string - * @param {ASTNode} node node to evaluate - * @returns {boolean} True if its a string - * @private - */ -function isString(node) { - return node && node.type === "Literal" && typeof node.value === "string"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow multiple spaces in regular expressions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-regex-spaces" - }, - - schema: [], - fixable: "code", - - messages: { - multipleSpaces: "Spaces are hard to count. Use {{{length}}}." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Validate regular expression - * @param {ASTNode} nodeToReport Node to report. - * @param {string} pattern Regular expression pattern to validate. - * @param {string} rawPattern Raw representation of the pattern in the source code. - * @param {number} rawPatternStartRange Start range of the pattern in the source code. - * @param {string} flags Regular expression flags. - * @returns {void} - * @private - */ - function checkRegex(nodeToReport, pattern, rawPattern, rawPatternStartRange, flags) { - - // Skip if there are no consecutive spaces in the source code, to avoid reporting e.g., RegExp(' \ '). - if (!DOUBLE_SPACE.test(rawPattern)) { - return; - } - - const characterClassNodes = []; - let regExpAST; - - try { - regExpAST = regExpParser.parsePattern(pattern, 0, pattern.length, flags.includes("u")); - } catch { - - // Ignore regular expressions with syntax errors - return; - } - - regexpp.visitRegExpAST(regExpAST, { - onCharacterClassEnter(ccNode) { - characterClassNodes.push(ccNode); - } - }); - - const spacesPattern = /( {2,})(?: [+*{?]|[^+*{?]|$)/gu; - let match; - - while ((match = spacesPattern.exec(pattern))) { - const { 1: { length }, index } = match; - - // Report only consecutive spaces that are not in character classes. - if ( - characterClassNodes.every(({ start, end }) => index < start || end <= index) - ) { - context.report({ - node: nodeToReport, - messageId: "multipleSpaces", - data: { length }, - fix(fixer) { - if (pattern !== rawPattern) { - return null; - } - return fixer.replaceTextRange( - [rawPatternStartRange + index, rawPatternStartRange + index + length], - ` {${length}}` - ); - } - }); - - // Report only the first occurrence of consecutive spaces - return; - } - } - } - - /** - * Validate regular expression literals - * @param {ASTNode} node node to validate - * @returns {void} - * @private - */ - function checkLiteral(node) { - if (node.regex) { - const pattern = node.regex.pattern; - const rawPattern = node.raw.slice(1, node.raw.lastIndexOf("/")); - const rawPatternStartRange = node.range[0] + 1; - const flags = node.regex.flags; - - checkRegex( - node, - pattern, - rawPattern, - rawPatternStartRange, - flags - ); - } - } - - /** - * Validate strings passed to the RegExp constructor - * @param {ASTNode} node node to validate - * @returns {void} - * @private - */ - function checkFunction(node) { - const scope = sourceCode.getScope(node); - const regExpVar = astUtils.getVariableByName(scope, "RegExp"); - const shadowed = regExpVar && regExpVar.defs.length > 0; - const patternNode = node.arguments[0]; - const flagsNode = node.arguments[1]; - - if (node.callee.type === "Identifier" && node.callee.name === "RegExp" && isString(patternNode) && !shadowed) { - const pattern = patternNode.value; - const rawPattern = patternNode.raw.slice(1, -1); - const rawPatternStartRange = patternNode.range[0] + 1; - const flags = isString(flagsNode) ? flagsNode.value : ""; - - checkRegex( - node, - pattern, - rawPattern, - rawPatternStartRange, - flags - ); - } - } - - return { - Literal: checkLiteral, - CallExpression: checkFunction, - NewExpression: checkFunction - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-restricted-exports.js b/node_modules/eslint/lib/rules/no-restricted-exports.js deleted file mode 100644 index a1d54b085..000000000 --- a/node_modules/eslint/lib/rules/no-restricted-exports.js +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @fileoverview Rule to disallow specified names in exports - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow specified names in exports", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-restricted-exports" - }, - - schema: [{ - anyOf: [ - { - type: "object", - properties: { - restrictedNamedExports: { - type: "array", - items: { - type: "string" - }, - uniqueItems: true - } - }, - additionalProperties: false - }, - { - type: "object", - properties: { - restrictedNamedExports: { - type: "array", - items: { - type: "string", - pattern: "^(?!default$)" - }, - uniqueItems: true - }, - restrictDefaultExports: { - type: "object", - properties: { - - // Allow/Disallow `export default foo; export default 42; export default function foo() {}` format - direct: { - type: "boolean" - }, - - // Allow/Disallow `export { foo as default };` declarations - named: { - type: "boolean" - }, - - // Allow/Disallow `export { default } from "mod"; export { default as default } from "mod";` declarations - defaultFrom: { - type: "boolean" - }, - - // Allow/Disallow `export { foo as default } from "mod";` declarations - namedFrom: { - type: "boolean" - }, - - // Allow/Disallow `export * as default from "mod"`; declarations - namespaceFrom: { - type: "boolean" - } - }, - additionalProperties: false - } - }, - additionalProperties: false - } - ] - }], - - messages: { - restrictedNamed: "'{{name}}' is restricted from being used as an exported name.", - restrictedDefault: "Exporting 'default' is restricted." - } - }, - - create(context) { - - const restrictedNames = new Set(context.options[0] && context.options[0].restrictedNamedExports); - const restrictDefaultExports = context.options[0] && context.options[0].restrictDefaultExports; - const sourceCode = context.sourceCode; - - /** - * Checks and reports given exported name. - * @param {ASTNode} node exported `Identifier` or string `Literal` node to check. - * @returns {void} - */ - function checkExportedName(node) { - const name = astUtils.getModuleExportName(node); - - if (restrictedNames.has(name)) { - context.report({ - node, - messageId: "restrictedNamed", - data: { name } - }); - return; - } - - if (name === "default") { - if (node.parent.type === "ExportAllDeclaration") { - if (restrictDefaultExports && restrictDefaultExports.namespaceFrom) { - context.report({ - node, - messageId: "restrictedDefault" - }); - } - - } else { // ExportSpecifier - const isSourceSpecified = !!node.parent.parent.source; - const specifierLocalName = astUtils.getModuleExportName(node.parent.local); - - if (!isSourceSpecified && restrictDefaultExports && restrictDefaultExports.named) { - context.report({ - node, - messageId: "restrictedDefault" - }); - return; - } - - if (isSourceSpecified && restrictDefaultExports) { - if ( - (specifierLocalName === "default" && restrictDefaultExports.defaultFrom) || - (specifierLocalName !== "default" && restrictDefaultExports.namedFrom) - ) { - context.report({ - node, - messageId: "restrictedDefault" - }); - } - } - } - } - } - - return { - ExportAllDeclaration(node) { - if (node.exported) { - checkExportedName(node.exported); - } - }, - - ExportDefaultDeclaration(node) { - if (restrictDefaultExports && restrictDefaultExports.direct) { - context.report({ - node, - messageId: "restrictedDefault" - }); - } - }, - - ExportNamedDeclaration(node) { - const declaration = node.declaration; - - if (declaration) { - if (declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") { - checkExportedName(declaration.id); - } else if (declaration.type === "VariableDeclaration") { - sourceCode.getDeclaredVariables(declaration) - .map(v => v.defs.find(d => d.parent === declaration)) - .map(d => d.name) // Identifier nodes - .forEach(checkExportedName); - } - } else { - node.specifiers - .map(s => s.exported) - .forEach(checkExportedName); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-restricted-globals.js b/node_modules/eslint/lib/rules/no-restricted-globals.js deleted file mode 100644 index 919a8ee0a..000000000 --- a/node_modules/eslint/lib/rules/no-restricted-globals.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * @fileoverview Restrict usage of specified globals. - * @author Benoît Zugmeyer - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow specified global variables", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-restricted-globals" - }, - - schema: { - type: "array", - items: { - oneOf: [ - { - type: "string" - }, - { - type: "object", - properties: { - name: { type: "string" }, - message: { type: "string" } - }, - required: ["name"], - additionalProperties: false - } - ] - }, - uniqueItems: true, - minItems: 0 - }, - - messages: { - defaultMessage: "Unexpected use of '{{name}}'.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - customMessage: "Unexpected use of '{{name}}'. {{customMessage}}" - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - // If no globals are restricted, we don't need to do anything - if (context.options.length === 0) { - return {}; - } - - const restrictedGlobalMessages = context.options.reduce((memo, option) => { - if (typeof option === "string") { - memo[option] = null; - } else { - memo[option.name] = option.message; - } - - return memo; - }, {}); - - /** - * Report a variable to be used as a restricted global. - * @param {Reference} reference the variable reference - * @returns {void} - * @private - */ - function reportReference(reference) { - const name = reference.identifier.name, - customMessage = restrictedGlobalMessages[name], - messageId = customMessage - ? "customMessage" - : "defaultMessage"; - - context.report({ - node: reference.identifier, - messageId, - data: { - name, - customMessage - } - }); - } - - /** - * Check if the given name is a restricted global name. - * @param {string} name name of a variable - * @returns {boolean} whether the variable is a restricted global or not - * @private - */ - function isRestricted(name) { - return Object.prototype.hasOwnProperty.call(restrictedGlobalMessages, name); - } - - return { - Program(node) { - const scope = sourceCode.getScope(node); - - // Report variables declared elsewhere (ex: variables defined as "global" by eslint) - scope.variables.forEach(variable => { - if (!variable.defs.length && isRestricted(variable.name)) { - variable.references.forEach(reportReference); - } - }); - - // Report variables not declared at all - scope.through.forEach(reference => { - if (isRestricted(reference.identifier.name)) { - reportReference(reference); - } - }); - - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-restricted-imports.js b/node_modules/eslint/lib/rules/no-restricted-imports.js deleted file mode 100644 index 6abfcacae..000000000 --- a/node_modules/eslint/lib/rules/no-restricted-imports.js +++ /dev/null @@ -1,387 +0,0 @@ -/** - * @fileoverview Restrict usage of specified node imports. - * @author Guy Ellis - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const ignore = require("ignore"); - -const arrayOfStringsOrObjects = { - type: "array", - items: { - anyOf: [ - { type: "string" }, - { - type: "object", - properties: { - name: { type: "string" }, - message: { - type: "string", - minLength: 1 - }, - importNames: { - type: "array", - items: { - type: "string" - } - } - }, - additionalProperties: false, - required: ["name"] - } - ] - }, - uniqueItems: true -}; - -const arrayOfStringsOrObjectPatterns = { - anyOf: [ - { - type: "array", - items: { - type: "string" - }, - uniqueItems: true - }, - { - type: "array", - items: { - type: "object", - properties: { - importNames: { - type: "array", - items: { - type: "string" - }, - minItems: 1, - uniqueItems: true - }, - group: { - type: "array", - items: { - type: "string" - }, - minItems: 1, - uniqueItems: true - }, - message: { - type: "string", - minLength: 1 - }, - caseSensitive: { - type: "boolean" - } - }, - additionalProperties: false, - required: ["group"] - }, - uniqueItems: true - } - ] -}; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow specified modules when loaded by `import`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-restricted-imports" - }, - - messages: { - path: "'{{importSource}}' import is restricted from being used.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - pathWithCustomMessage: "'{{importSource}}' import is restricted from being used. {{customMessage}}", - - patterns: "'{{importSource}}' import is restricted from being used by a pattern.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - patternWithCustomMessage: "'{{importSource}}' import is restricted from being used by a pattern. {{customMessage}}", - - patternAndImportName: "'{{importName}}' import from '{{importSource}}' is restricted from being used by a pattern.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - patternAndImportNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}", - - patternAndEverything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - patternAndEverythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}", - - everything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - everythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted. {{customMessage}}", - - importName: "'{{importName}}' import from '{{importSource}}' is restricted.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - importNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted. {{customMessage}}" - }, - - schema: { - anyOf: [ - arrayOfStringsOrObjects, - { - type: "array", - items: [{ - type: "object", - properties: { - paths: arrayOfStringsOrObjects, - patterns: arrayOfStringsOrObjectPatterns - }, - additionalProperties: false - }], - additionalItems: false - } - ] - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const options = Array.isArray(context.options) ? context.options : []; - const isPathAndPatternsObject = - typeof options[0] === "object" && - (Object.prototype.hasOwnProperty.call(options[0], "paths") || Object.prototype.hasOwnProperty.call(options[0], "patterns")); - - const restrictedPaths = (isPathAndPatternsObject ? options[0].paths : context.options) || []; - const restrictedPathMessages = restrictedPaths.reduce((memo, importSource) => { - if (typeof importSource === "string") { - memo[importSource] = { message: null }; - } else { - memo[importSource.name] = { - message: importSource.message, - importNames: importSource.importNames - }; - } - return memo; - }, {}); - - // Handle patterns too, either as strings or groups - let restrictedPatterns = (isPathAndPatternsObject ? options[0].patterns : []) || []; - - // standardize to array of objects if we have an array of strings - if (restrictedPatterns.length > 0 && typeof restrictedPatterns[0] === "string") { - restrictedPatterns = [{ group: restrictedPatterns }]; - } - - // relative paths are supported for this rule - const restrictedPatternGroups = restrictedPatterns.map(({ group, message, caseSensitive, importNames }) => ({ - matcher: ignore({ allowRelativePaths: true, ignorecase: !caseSensitive }).add(group), - customMessage: message, - importNames - })); - - // if no imports are restricted we don't need to check - if (Object.keys(restrictedPaths).length === 0 && restrictedPatternGroups.length === 0) { - return {}; - } - - /** - * Report a restricted path. - * @param {string} importSource path of the import - * @param {Map} importNames Map of import names that are being imported - * @param {node} node representing the restricted path reference - * @returns {void} - * @private - */ - function checkRestrictedPathAndReport(importSource, importNames, node) { - if (!Object.prototype.hasOwnProperty.call(restrictedPathMessages, importSource)) { - return; - } - - const customMessage = restrictedPathMessages[importSource].message; - const restrictedImportNames = restrictedPathMessages[importSource].importNames; - - if (restrictedImportNames) { - if (importNames.has("*")) { - const specifierData = importNames.get("*")[0]; - - context.report({ - node, - messageId: customMessage ? "everythingWithCustomMessage" : "everything", - loc: specifierData.loc, - data: { - importSource, - importNames: restrictedImportNames, - customMessage - } - }); - } - - restrictedImportNames.forEach(importName => { - if (importNames.has(importName)) { - const specifiers = importNames.get(importName); - - specifiers.forEach(specifier => { - context.report({ - node, - messageId: customMessage ? "importNameWithCustomMessage" : "importName", - loc: specifier.loc, - data: { - importSource, - customMessage, - importName - } - }); - }); - } - }); - } else { - context.report({ - node, - messageId: customMessage ? "pathWithCustomMessage" : "path", - data: { - importSource, - customMessage - } - }); - } - } - - /** - * Report a restricted path specifically for patterns. - * @param {node} node representing the restricted path reference - * @param {Object} group contains an Ignore instance for paths, the customMessage to show on failure, - * and any restricted import names that have been specified in the config - * @param {Map} importNames Map of import names that are being imported - * @returns {void} - * @private - */ - function reportPathForPatterns(node, group, importNames) { - const importSource = node.source.value.trim(); - - const customMessage = group.customMessage; - const restrictedImportNames = group.importNames; - - /* - * If we are not restricting to any specific import names and just the pattern itself, - * report the error and move on - */ - if (!restrictedImportNames) { - context.report({ - node, - messageId: customMessage ? "patternWithCustomMessage" : "patterns", - data: { - importSource, - customMessage - } - }); - return; - } - - if (importNames.has("*")) { - const specifierData = importNames.get("*")[0]; - - context.report({ - node, - messageId: customMessage ? "patternAndEverythingWithCustomMessage" : "patternAndEverything", - loc: specifierData.loc, - data: { - importSource, - importNames: restrictedImportNames, - customMessage - } - }); - } - - restrictedImportNames.forEach(importName => { - if (!importNames.has(importName)) { - return; - } - - const specifiers = importNames.get(importName); - - specifiers.forEach(specifier => { - context.report({ - node, - messageId: customMessage ? "patternAndImportNameWithCustomMessage" : "patternAndImportName", - loc: specifier.loc, - data: { - importSource, - customMessage, - importName - } - }); - }); - }); - } - - /** - * Check if the given importSource is restricted by a pattern. - * @param {string} importSource path of the import - * @param {Object} group contains a Ignore instance for paths, and the customMessage to show if it fails - * @returns {boolean} whether the variable is a restricted pattern or not - * @private - */ - function isRestrictedPattern(importSource, group) { - return group.matcher.ignores(importSource); - } - - /** - * Checks a node to see if any problems should be reported. - * @param {ASTNode} node The node to check. - * @returns {void} - * @private - */ - function checkNode(node) { - const importSource = node.source.value.trim(); - const importNames = new Map(); - - if (node.type === "ExportAllDeclaration") { - const starToken = sourceCode.getFirstToken(node, 1); - - importNames.set("*", [{ loc: starToken.loc }]); - } else if (node.specifiers) { - for (const specifier of node.specifiers) { - let name; - const specifierData = { loc: specifier.loc }; - - if (specifier.type === "ImportDefaultSpecifier") { - name = "default"; - } else if (specifier.type === "ImportNamespaceSpecifier") { - name = "*"; - } else if (specifier.imported) { - name = astUtils.getModuleExportName(specifier.imported); - } else if (specifier.local) { - name = astUtils.getModuleExportName(specifier.local); - } - - if (typeof name === "string") { - if (importNames.has(name)) { - importNames.get(name).push(specifierData); - } else { - importNames.set(name, [specifierData]); - } - } - } - } - - checkRestrictedPathAndReport(importSource, importNames, node); - restrictedPatternGroups.forEach(group => { - if (isRestrictedPattern(importSource, group)) { - reportPathForPatterns(node, group, importNames); - } - }); - } - - return { - ImportDeclaration: checkNode, - ExportNamedDeclaration(node) { - if (node.source) { - checkNode(node); - } - }, - ExportAllDeclaration: checkNode - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-restricted-modules.js b/node_modules/eslint/lib/rules/no-restricted-modules.js deleted file mode 100644 index d79bdbe57..000000000 --- a/node_modules/eslint/lib/rules/no-restricted-modules.js +++ /dev/null @@ -1,216 +0,0 @@ -/** - * @fileoverview Restrict usage of specified node modules. - * @author Christian Schulz - * @deprecated in ESLint v7.0.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const ignore = require("ignore"); - -const arrayOfStrings = { - type: "array", - items: { type: "string" }, - uniqueItems: true -}; - -const arrayOfStringsOrObjects = { - type: "array", - items: { - anyOf: [ - { type: "string" }, - { - type: "object", - properties: { - name: { type: "string" }, - message: { - type: "string", - minLength: 1 - } - }, - additionalProperties: false, - required: ["name"] - } - ] - }, - uniqueItems: true -}; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Disallow specified modules when loaded by `require`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-restricted-modules" - }, - - schema: { - anyOf: [ - arrayOfStringsOrObjects, - { - type: "array", - items: { - type: "object", - properties: { - paths: arrayOfStringsOrObjects, - patterns: arrayOfStrings - }, - additionalProperties: false - }, - additionalItems: false - } - ] - }, - - messages: { - defaultMessage: "'{{name}}' module is restricted from being used.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - customMessage: "'{{name}}' module is restricted from being used. {{customMessage}}", - patternMessage: "'{{name}}' module is restricted from being used by a pattern." - } - }, - - create(context) { - const options = Array.isArray(context.options) ? context.options : []; - const isPathAndPatternsObject = - typeof options[0] === "object" && - (Object.prototype.hasOwnProperty.call(options[0], "paths") || Object.prototype.hasOwnProperty.call(options[0], "patterns")); - - const restrictedPaths = (isPathAndPatternsObject ? options[0].paths : context.options) || []; - const restrictedPatterns = (isPathAndPatternsObject ? options[0].patterns : []) || []; - - const restrictedPathMessages = restrictedPaths.reduce((memo, importName) => { - if (typeof importName === "string") { - memo[importName] = null; - } else { - memo[importName.name] = importName.message; - } - return memo; - }, {}); - - // if no imports are restricted we don't need to check - if (Object.keys(restrictedPaths).length === 0 && restrictedPatterns.length === 0) { - return {}; - } - - // relative paths are supported for this rule - const ig = ignore({ allowRelativePaths: true }).add(restrictedPatterns); - - - /** - * Function to check if a node is a string literal. - * @param {ASTNode} node The node to check. - * @returns {boolean} If the node is a string literal. - */ - function isStringLiteral(node) { - return node && node.type === "Literal" && typeof node.value === "string"; - } - - /** - * Function to check if a node is a static string template literal. - * @param {ASTNode} node The node to check. - * @returns {boolean} If the node is a string template literal. - */ - function isStaticTemplateLiteral(node) { - return node && node.type === "TemplateLiteral" && node.expressions.length === 0; - } - - /** - * Function to check if a node is a require call. - * @param {ASTNode} node The node to check. - * @returns {boolean} If the node is a require call. - */ - function isRequireCall(node) { - return node.callee.type === "Identifier" && node.callee.name === "require"; - } - - /** - * Extract string from Literal or TemplateLiteral node - * @param {ASTNode} node The node to extract from - * @returns {string|null} Extracted string or null if node doesn't represent a string - */ - function getFirstArgumentString(node) { - if (isStringLiteral(node)) { - return node.value.trim(); - } - - if (isStaticTemplateLiteral(node)) { - return node.quasis[0].value.cooked.trim(); - } - - return null; - } - - /** - * Report a restricted path. - * @param {node} node representing the restricted path reference - * @param {string} name restricted path - * @returns {void} - * @private - */ - function reportPath(node, name) { - const customMessage = restrictedPathMessages[name]; - const messageId = customMessage - ? "customMessage" - : "defaultMessage"; - - context.report({ - node, - messageId, - data: { - name, - customMessage - } - }); - } - - /** - * Check if the given name is a restricted path name - * @param {string} name name of a variable - * @returns {boolean} whether the variable is a restricted path or not - * @private - */ - function isRestrictedPath(name) { - return Object.prototype.hasOwnProperty.call(restrictedPathMessages, name); - } - - return { - CallExpression(node) { - if (isRequireCall(node)) { - - // node has arguments - if (node.arguments.length) { - const name = getFirstArgumentString(node.arguments[0]); - - // if first argument is a string literal or a static string template literal - if (name) { - - // check if argument value is in restricted modules array - if (isRestrictedPath(name)) { - reportPath(node, name); - } - - if (restrictedPatterns.length > 0 && ig.ignores(name)) { - context.report({ - node, - messageId: "patternMessage", - data: { name } - }); - } - } - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-restricted-properties.js b/node_modules/eslint/lib/rules/no-restricted-properties.js deleted file mode 100644 index b07663260..000000000 --- a/node_modules/eslint/lib/rules/no-restricted-properties.js +++ /dev/null @@ -1,181 +0,0 @@ -/** - * @fileoverview Rule to disallow certain object properties - * @author Will Klein & Eli White - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow certain properties on certain objects", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-restricted-properties" - }, - - schema: { - type: "array", - items: { - anyOf: [ // `object` and `property` are both optional, but at least one of them must be provided. - { - type: "object", - properties: { - object: { - type: "string" - }, - property: { - type: "string" - }, - message: { - type: "string" - } - }, - additionalProperties: false, - required: ["object"] - }, - { - type: "object", - properties: { - object: { - type: "string" - }, - property: { - type: "string" - }, - message: { - type: "string" - } - }, - additionalProperties: false, - required: ["property"] - } - ] - }, - uniqueItems: true - }, - - messages: { - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - restrictedObjectProperty: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - restrictedProperty: "'{{propertyName}}' is restricted from being used.{{message}}" - } - }, - - create(context) { - const restrictedCalls = context.options; - - if (restrictedCalls.length === 0) { - return {}; - } - - const restrictedProperties = new Map(); - const globallyRestrictedObjects = new Map(); - const globallyRestrictedProperties = new Map(); - - restrictedCalls.forEach(option => { - const objectName = option.object; - const propertyName = option.property; - - if (typeof objectName === "undefined") { - globallyRestrictedProperties.set(propertyName, { message: option.message }); - } else if (typeof propertyName === "undefined") { - globallyRestrictedObjects.set(objectName, { message: option.message }); - } else { - if (!restrictedProperties.has(objectName)) { - restrictedProperties.set(objectName, new Map()); - } - - restrictedProperties.get(objectName).set(propertyName, { - message: option.message - }); - } - }); - - /** - * Checks to see whether a property access is restricted, and reports it if so. - * @param {ASTNode} node The node to report - * @param {string} objectName The name of the object - * @param {string} propertyName The name of the property - * @returns {undefined} - */ - function checkPropertyAccess(node, objectName, propertyName) { - if (propertyName === null) { - return; - } - const matchedObject = restrictedProperties.get(objectName); - const matchedObjectProperty = matchedObject ? matchedObject.get(propertyName) : globallyRestrictedObjects.get(objectName); - const globalMatchedProperty = globallyRestrictedProperties.get(propertyName); - - if (matchedObjectProperty) { - const message = matchedObjectProperty.message ? ` ${matchedObjectProperty.message}` : ""; - - context.report({ - node, - messageId: "restrictedObjectProperty", - data: { - objectName, - propertyName, - message - } - }); - } else if (globalMatchedProperty) { - const message = globalMatchedProperty.message ? ` ${globalMatchedProperty.message}` : ""; - - context.report({ - node, - messageId: "restrictedProperty", - data: { - propertyName, - message - } - }); - } - } - - /** - * Checks property accesses in a destructuring assignment expression, e.g. `var foo; ({foo} = bar);` - * @param {ASTNode} node An AssignmentExpression or AssignmentPattern node - * @returns {undefined} - */ - function checkDestructuringAssignment(node) { - if (node.right.type === "Identifier") { - const objectName = node.right.name; - - if (node.left.type === "ObjectPattern") { - node.left.properties.forEach(property => { - checkPropertyAccess(node.left, objectName, astUtils.getStaticPropertyName(property)); - }); - } - } - } - - return { - MemberExpression(node) { - checkPropertyAccess(node, node.object && node.object.name, astUtils.getStaticPropertyName(node)); - }, - VariableDeclarator(node) { - if (node.init && node.init.type === "Identifier") { - const objectName = node.init.name; - - if (node.id.type === "ObjectPattern") { - node.id.properties.forEach(property => { - checkPropertyAccess(node.id, objectName, astUtils.getStaticPropertyName(property)); - }); - } - } - }, - AssignmentExpression: checkDestructuringAssignment, - AssignmentPattern: checkDestructuringAssignment - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-restricted-syntax.js b/node_modules/eslint/lib/rules/no-restricted-syntax.js deleted file mode 100644 index 930882c33..000000000 --- a/node_modules/eslint/lib/rules/no-restricted-syntax.js +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @fileoverview Rule to flag use of certain node types - * @author Burak Yigit Kaya - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow specified syntax", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-restricted-syntax" - }, - - schema: { - type: "array", - items: { - oneOf: [ - { - type: "string" - }, - { - type: "object", - properties: { - selector: { type: "string" }, - message: { type: "string" } - }, - required: ["selector"], - additionalProperties: false - } - ] - }, - uniqueItems: true, - minItems: 0 - }, - - messages: { - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - restrictedSyntax: "{{message}}" - } - }, - - create(context) { - return context.options.reduce((result, selectorOrObject) => { - const isStringFormat = (typeof selectorOrObject === "string"); - const hasCustomMessage = !isStringFormat && Boolean(selectorOrObject.message); - - const selector = isStringFormat ? selectorOrObject : selectorOrObject.selector; - const message = hasCustomMessage ? selectorOrObject.message : `Using '${selector}' is not allowed.`; - - return Object.assign(result, { - [selector](node) { - context.report({ - node, - messageId: "restrictedSyntax", - data: { message } - }); - } - }); - }, {}); - - } -}; diff --git a/node_modules/eslint/lib/rules/no-return-assign.js b/node_modules/eslint/lib/rules/no-return-assign.js deleted file mode 100644 index 73caf0e6b..000000000 --- a/node_modules/eslint/lib/rules/no-return-assign.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @fileoverview Rule to flag when return statement contains assignment - * @author Ilya Volodin - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const SENTINEL_TYPE = /^(?:[a-zA-Z]+?Statement|ArrowFunctionExpression|FunctionExpression|ClassExpression)$/u; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow assignment operators in `return` statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-return-assign" - }, - - schema: [ - { - enum: ["except-parens", "always"] - } - ], - - messages: { - returnAssignment: "Return statement should not contain assignment.", - arrowAssignment: "Arrow function should not return assignment." - } - }, - - create(context) { - const always = (context.options[0] || "except-parens") !== "except-parens"; - const sourceCode = context.sourceCode; - - return { - AssignmentExpression(node) { - if (!always && astUtils.isParenthesised(sourceCode, node)) { - return; - } - - let currentChild = node; - let parent = currentChild.parent; - - // Find ReturnStatement or ArrowFunctionExpression in ancestors. - while (parent && !SENTINEL_TYPE.test(parent.type)) { - currentChild = parent; - parent = parent.parent; - } - - // Reports. - if (parent && parent.type === "ReturnStatement") { - context.report({ - node: parent, - messageId: "returnAssignment" - }); - } else if (parent && parent.type === "ArrowFunctionExpression" && parent.body === currentChild) { - context.report({ - node: parent, - messageId: "arrowAssignment" - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-return-await.js b/node_modules/eslint/lib/rules/no-return-await.js deleted file mode 100644 index b5abf14c6..000000000 --- a/node_modules/eslint/lib/rules/no-return-await.js +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @fileoverview Disallows unnecessary `return await` - * @author Jordan Harband - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - hasSuggestions: true, - type: "suggestion", - - docs: { - description: "Disallow unnecessary `return await`", - - recommended: false, - - url: "https://eslint.org/docs/latest/rules/no-return-await" - }, - - fixable: null, - - schema: [ - ], - - messages: { - removeAwait: "Remove redundant `await`.", - redundantUseOfAwait: "Redundant use of `await` on a return value." - } - }, - - create(context) { - - /** - * Reports a found unnecessary `await` expression. - * @param {ASTNode} node The node representing the `await` expression to report - * @returns {void} - */ - function reportUnnecessaryAwait(node) { - context.report({ - node: context.sourceCode.getFirstToken(node), - loc: node.loc, - messageId: "redundantUseOfAwait", - suggest: [ - { - messageId: "removeAwait", - fix(fixer) { - const sourceCode = context.sourceCode; - const [awaitToken, tokenAfterAwait] = sourceCode.getFirstTokens(node, 2); - - const areAwaitAndAwaitedExpressionOnTheSameLine = awaitToken.loc.start.line === tokenAfterAwait.loc.start.line; - - if (!areAwaitAndAwaitedExpressionOnTheSameLine) { - return null; - } - - const [startOfAwait, endOfAwait] = awaitToken.range; - - const characterAfterAwait = sourceCode.text[endOfAwait]; - const trimLength = characterAfterAwait === " " ? 1 : 0; - - const range = [startOfAwait, endOfAwait + trimLength]; - - return fixer.removeRange(range); - } - } - ] - - }); - } - - /** - * Determines whether a thrown error from this node will be caught/handled within this function rather than immediately halting - * this function. For example, a statement in a `try` block will always have an error handler. A statement in - * a `catch` block will only have an error handler if there is also a `finally` block. - * @param {ASTNode} node A node representing a location where an could be thrown - * @returns {boolean} `true` if a thrown error will be caught/handled in this function - */ - function hasErrorHandler(node) { - let ancestor = node; - - while (!astUtils.isFunction(ancestor) && ancestor.type !== "Program") { - if (ancestor.parent.type === "TryStatement" && (ancestor === ancestor.parent.block || ancestor === ancestor.parent.handler && ancestor.parent.finalizer)) { - return true; - } - ancestor = ancestor.parent; - } - return false; - } - - /** - * Checks if a node is placed in tail call position. Once `return` arguments (or arrow function expressions) can be a complex expression, - * an `await` expression could or could not be unnecessary by the definition of this rule. So we're looking for `await` expressions that are in tail position. - * @param {ASTNode} node A node representing the `await` expression to check - * @returns {boolean} The checking result - */ - function isInTailCallPosition(node) { - if (node.parent.type === "ArrowFunctionExpression") { - return true; - } - if (node.parent.type === "ReturnStatement") { - return !hasErrorHandler(node.parent); - } - if (node.parent.type === "ConditionalExpression" && (node === node.parent.consequent || node === node.parent.alternate)) { - return isInTailCallPosition(node.parent); - } - if (node.parent.type === "LogicalExpression" && node === node.parent.right) { - return isInTailCallPosition(node.parent); - } - if (node.parent.type === "SequenceExpression" && node === node.parent.expressions[node.parent.expressions.length - 1]) { - return isInTailCallPosition(node.parent); - } - return false; - } - - return { - AwaitExpression(node) { - if (isInTailCallPosition(node) && !hasErrorHandler(node)) { - reportUnnecessaryAwait(node); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-script-url.js b/node_modules/eslint/lib/rules/no-script-url.js deleted file mode 100644 index 1d16bde3c..000000000 --- a/node_modules/eslint/lib/rules/no-script-url.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @fileoverview Rule to flag when using javascript: urls - * @author Ilya Volodin - */ -/* eslint no-script-url: 0 -- Code is checking to report such URLs */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `javascript:` urls", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-script-url" - }, - - schema: [], - - messages: { - unexpectedScriptURL: "Script URL is a form of eval." - } - }, - - create(context) { - - /** - * Check whether a node's static value starts with "javascript:" or not. - * And report an error for unexpected script URL. - * @param {ASTNode} node node to check - * @returns {void} - */ - function check(node) { - const value = astUtils.getStaticStringValue(node); - - if (typeof value === "string" && value.toLowerCase().indexOf("javascript:") === 0) { - context.report({ node, messageId: "unexpectedScriptURL" }); - } - } - return { - Literal(node) { - if (node.value && typeof node.value === "string") { - check(node); - } - }, - TemplateLiteral(node) { - if (!(node.parent && node.parent.type === "TaggedTemplateExpression")) { - check(node); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-self-assign.js b/node_modules/eslint/lib/rules/no-self-assign.js deleted file mode 100644 index 33ac8fb50..000000000 --- a/node_modules/eslint/lib/rules/no-self-assign.js +++ /dev/null @@ -1,183 +0,0 @@ -/** - * @fileoverview Rule to disallow assignments where both sides are exactly the same - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const SPACES = /\s+/gu; - -/** - * Traverses 2 Pattern nodes in parallel, then reports self-assignments. - * @param {ASTNode|null} left A left node to traverse. This is a Pattern or - * a Property. - * @param {ASTNode|null} right A right node to traverse. This is a Pattern or - * a Property. - * @param {boolean} props The flag to check member expressions as well. - * @param {Function} report A callback function to report. - * @returns {void} - */ -function eachSelfAssignment(left, right, props, report) { - if (!left || !right) { - - // do nothing - } else if ( - left.type === "Identifier" && - right.type === "Identifier" && - left.name === right.name - ) { - report(right); - } else if ( - left.type === "ArrayPattern" && - right.type === "ArrayExpression" - ) { - const end = Math.min(left.elements.length, right.elements.length); - - for (let i = 0; i < end; ++i) { - const leftElement = left.elements[i]; - const rightElement = right.elements[i]; - - // Avoid cases such as [...a] = [...a, 1] - if ( - leftElement && - leftElement.type === "RestElement" && - i < right.elements.length - 1 - ) { - break; - } - - eachSelfAssignment(leftElement, rightElement, props, report); - - // After a spread element, those indices are unknown. - if (rightElement && rightElement.type === "SpreadElement") { - break; - } - } - } else if ( - left.type === "RestElement" && - right.type === "SpreadElement" - ) { - eachSelfAssignment(left.argument, right.argument, props, report); - } else if ( - left.type === "ObjectPattern" && - right.type === "ObjectExpression" && - right.properties.length >= 1 - ) { - - /* - * Gets the index of the last spread property. - * It's possible to overwrite properties followed by it. - */ - let startJ = 0; - - for (let i = right.properties.length - 1; i >= 0; --i) { - const propType = right.properties[i].type; - - if (propType === "SpreadElement" || propType === "ExperimentalSpreadProperty") { - startJ = i + 1; - break; - } - } - - for (let i = 0; i < left.properties.length; ++i) { - for (let j = startJ; j < right.properties.length; ++j) { - eachSelfAssignment( - left.properties[i], - right.properties[j], - props, - report - ); - } - } - } else if ( - left.type === "Property" && - right.type === "Property" && - right.kind === "init" && - !right.method - ) { - const leftName = astUtils.getStaticPropertyName(left); - - if (leftName !== null && leftName === astUtils.getStaticPropertyName(right)) { - eachSelfAssignment(left.value, right.value, props, report); - } - } else if ( - props && - astUtils.skipChainExpression(left).type === "MemberExpression" && - astUtils.skipChainExpression(right).type === "MemberExpression" && - astUtils.isSameReference(left, right) - ) { - report(right); - } -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow assignments where both sides are exactly the same", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-self-assign" - }, - - schema: [ - { - type: "object", - properties: { - props: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - messages: { - selfAssignment: "'{{name}}' is assigned to itself." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const [{ props = true } = {}] = context.options; - - /** - * Reports a given node as self assignments. - * @param {ASTNode} node A node to report. This is an Identifier node. - * @returns {void} - */ - function report(node) { - context.report({ - node, - messageId: "selfAssignment", - data: { - name: sourceCode.getText(node).replace(SPACES, "") - } - }); - } - - return { - AssignmentExpression(node) { - if (["=", "&&=", "||=", "??="].includes(node.operator)) { - eachSelfAssignment(node.left, node.right, props, report); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-self-compare.js b/node_modules/eslint/lib/rules/no-self-compare.js deleted file mode 100644 index 3b076eba8..000000000 --- a/node_modules/eslint/lib/rules/no-self-compare.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @fileoverview Rule to flag comparison where left part is the same as the right - * part. - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow comparisons where both sides are exactly the same", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-self-compare" - }, - - schema: [], - - messages: { - comparingToSelf: "Comparing to itself is potentially pointless." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Determines whether two nodes are composed of the same tokens. - * @param {ASTNode} nodeA The first node - * @param {ASTNode} nodeB The second node - * @returns {boolean} true if the nodes have identical token representations - */ - function hasSameTokens(nodeA, nodeB) { - const tokensA = sourceCode.getTokens(nodeA); - const tokensB = sourceCode.getTokens(nodeB); - - return tokensA.length === tokensB.length && - tokensA.every((token, index) => token.type === tokensB[index].type && token.value === tokensB[index].value); - } - - return { - - BinaryExpression(node) { - const operators = new Set(["===", "==", "!==", "!=", ">", "<", ">=", "<="]); - - if (operators.has(node.operator) && hasSameTokens(node.left, node.right)) { - context.report({ node, messageId: "comparingToSelf" }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-sequences.js b/node_modules/eslint/lib/rules/no-sequences.js deleted file mode 100644 index cd21fc784..000000000 --- a/node_modules/eslint/lib/rules/no-sequences.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @fileoverview Rule to flag use of comma operator - * @author Brandon Mills - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const DEFAULT_OPTIONS = { - allowInParentheses: true -}; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow comma operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-sequences" - }, - - schema: [{ - properties: { - allowInParentheses: { - type: "boolean", - default: true - } - }, - additionalProperties: false - }], - - messages: { - unexpectedCommaExpression: "Unexpected use of comma operator." - } - }, - - create(context) { - const options = Object.assign({}, DEFAULT_OPTIONS, context.options[0]); - const sourceCode = context.sourceCode; - - /** - * Parts of the grammar that are required to have parens. - */ - const parenthesized = { - DoWhileStatement: "test", - IfStatement: "test", - SwitchStatement: "discriminant", - WhileStatement: "test", - WithStatement: "object", - ArrowFunctionExpression: "body" - - /* - * Omitting CallExpression - commas are parsed as argument separators - * Omitting NewExpression - commas are parsed as argument separators - * Omitting ForInStatement - parts aren't individually parenthesised - * Omitting ForStatement - parts aren't individually parenthesised - */ - }; - - /** - * Determines whether a node is required by the grammar to be wrapped in - * parens, e.g. the test of an if statement. - * @param {ASTNode} node The AST node - * @returns {boolean} True if parens around node belong to parent node. - */ - function requiresExtraParens(node) { - return node.parent && parenthesized[node.parent.type] && - node === node.parent[parenthesized[node.parent.type]]; - } - - /** - * Check if a node is wrapped in parens. - * @param {ASTNode} node The AST node - * @returns {boolean} True if the node has a paren on each side. - */ - function isParenthesised(node) { - return astUtils.isParenthesised(sourceCode, node); - } - - /** - * Check if a node is wrapped in two levels of parens. - * @param {ASTNode} node The AST node - * @returns {boolean} True if two parens surround the node on each side. - */ - function isParenthesisedTwice(node) { - const previousToken = sourceCode.getTokenBefore(node, 1), - nextToken = sourceCode.getTokenAfter(node, 1); - - return isParenthesised(node) && previousToken && nextToken && - astUtils.isOpeningParenToken(previousToken) && previousToken.range[1] <= node.range[0] && - astUtils.isClosingParenToken(nextToken) && nextToken.range[0] >= node.range[1]; - } - - return { - SequenceExpression(node) { - - // Always allow sequences in for statement update - if (node.parent.type === "ForStatement" && - (node === node.parent.init || node === node.parent.update)) { - return; - } - - // Wrapping a sequence in extra parens indicates intent - if (options.allowInParentheses) { - if (requiresExtraParens(node)) { - if (isParenthesisedTwice(node)) { - return; - } - } else { - if (isParenthesised(node)) { - return; - } - } - } - - const firstCommaToken = sourceCode.getTokenAfter(node.expressions[0], astUtils.isCommaToken); - - context.report({ node, loc: firstCommaToken.loc, messageId: "unexpectedCommaExpression" }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-setter-return.js b/node_modules/eslint/lib/rules/no-setter-return.js deleted file mode 100644 index a5abaaa7e..000000000 --- a/node_modules/eslint/lib/rules/no-setter-return.js +++ /dev/null @@ -1,226 +0,0 @@ -/** - * @fileoverview Rule to disallow returning values from setters - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { findVariable } = require("@eslint-community/eslint-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines whether the given identifier node is a reference to a global variable. - * @param {ASTNode} node `Identifier` node to check. - * @param {Scope} scope Scope to which the node belongs. - * @returns {boolean} True if the identifier is a reference to a global variable. - */ -function isGlobalReference(node, scope) { - const variable = findVariable(scope, node); - - return variable !== null && variable.scope.type === "global" && variable.defs.length === 0; -} - -/** - * Determines whether the given node is an argument of the specified global method call, at the given `index` position. - * E.g., for given `index === 1`, this function checks for `objectName.methodName(foo, node)`, where objectName is a global variable. - * @param {ASTNode} node The node to check. - * @param {Scope} scope Scope to which the node belongs. - * @param {string} objectName Name of the global object. - * @param {string} methodName Name of the method. - * @param {number} index The given position. - * @returns {boolean} `true` if the node is argument at the given position. - */ -function isArgumentOfGlobalMethodCall(node, scope, objectName, methodName, index) { - const callNode = node.parent; - - return callNode.type === "CallExpression" && - callNode.arguments[index] === node && - astUtils.isSpecificMemberAccess(callNode.callee, objectName, methodName) && - isGlobalReference(astUtils.skipChainExpression(callNode.callee).object, scope); -} - -/** - * Determines whether the given node is used as a property descriptor. - * @param {ASTNode} node The node to check. - * @param {Scope} scope Scope to which the node belongs. - * @returns {boolean} `true` if the node is a property descriptor. - */ -function isPropertyDescriptor(node, scope) { - if ( - isArgumentOfGlobalMethodCall(node, scope, "Object", "defineProperty", 2) || - isArgumentOfGlobalMethodCall(node, scope, "Reflect", "defineProperty", 2) - ) { - return true; - } - - const parent = node.parent; - - if ( - parent.type === "Property" && - parent.value === node - ) { - const grandparent = parent.parent; - - if ( - grandparent.type === "ObjectExpression" && - ( - isArgumentOfGlobalMethodCall(grandparent, scope, "Object", "create", 1) || - isArgumentOfGlobalMethodCall(grandparent, scope, "Object", "defineProperties", 1) - ) - ) { - return true; - } - } - - return false; -} - -/** - * Determines whether the given function node is used as a setter function. - * @param {ASTNode} node The node to check. - * @param {Scope} scope Scope to which the node belongs. - * @returns {boolean} `true` if the node is a setter. - */ -function isSetter(node, scope) { - const parent = node.parent; - - if ( - (parent.type === "Property" || parent.type === "MethodDefinition") && - parent.kind === "set" && - parent.value === node - ) { - - // Setter in an object literal or in a class - return true; - } - - if ( - parent.type === "Property" && - parent.value === node && - astUtils.getStaticPropertyName(parent) === "set" && - parent.parent.type === "ObjectExpression" && - isPropertyDescriptor(parent.parent, scope) - ) { - - // Setter in a property descriptor - return true; - } - - return false; -} - -/** - * Finds function's outer scope. - * @param {Scope} scope Function's own scope. - * @returns {Scope} Function's outer scope. - */ -function getOuterScope(scope) { - const upper = scope.upper; - - if (upper.type === "function-expression-name") { - return upper.upper; - } - - return upper; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow returning values from setters", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-setter-return" - }, - - schema: [], - - messages: { - returnsValue: "Setter cannot return a value." - } - }, - - create(context) { - let funcInfo = null; - const sourceCode = context.sourceCode; - - /** - * Creates and pushes to the stack a function info object for the given function node. - * @param {ASTNode} node The function node. - * @returns {void} - */ - function enterFunction(node) { - const outerScope = getOuterScope(sourceCode.getScope(node)); - - funcInfo = { - upper: funcInfo, - isSetter: isSetter(node, outerScope) - }; - } - - /** - * Pops the current function info object from the stack. - * @returns {void} - */ - function exitFunction() { - funcInfo = funcInfo.upper; - } - - /** - * Reports the given node. - * @param {ASTNode} node Node to report. - * @returns {void} - */ - function report(node) { - context.report({ node, messageId: "returnsValue" }); - } - - return { - - /* - * Function declarations cannot be setters, but we still have to track them in the `funcInfo` stack to avoid - * false positives, because a ReturnStatement node can belong to a function declaration inside a setter. - * - * Note: A previously declared function can be referenced and actually used as a setter in a property descriptor, - * but that's out of scope for this rule. - */ - FunctionDeclaration: enterFunction, - FunctionExpression: enterFunction, - ArrowFunctionExpression(node) { - enterFunction(node); - - if (funcInfo.isSetter && node.expression) { - - // { set: foo => bar } property descriptor. Report implicit return 'bar' as the equivalent for a return statement. - report(node.body); - } - }, - - "FunctionDeclaration:exit": exitFunction, - "FunctionExpression:exit": exitFunction, - "ArrowFunctionExpression:exit": exitFunction, - - ReturnStatement(node) { - - // Global returns (e.g., at the top level of a Node module) don't have `funcInfo`. - if (funcInfo && funcInfo.isSetter && node.argument) { - report(node); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-shadow-restricted-names.js b/node_modules/eslint/lib/rules/no-shadow-restricted-names.js deleted file mode 100644 index 29560fffc..000000000 --- a/node_modules/eslint/lib/rules/no-shadow-restricted-names.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @fileoverview Disallow shadowing of NaN, undefined, and Infinity (ES5 section 15.1.1) - * @author Michael Ficarra - */ -"use strict"; - -/** - * Determines if a variable safely shadows undefined. - * This is the case when a variable named `undefined` is never assigned to a value (i.e. it always shares the same value - * as the global). - * @param {eslintScope.Variable} variable The variable to check - * @returns {boolean} true if this variable safely shadows `undefined` - */ -function safelyShadowsUndefined(variable) { - return variable.name === "undefined" && - variable.references.every(ref => !ref.isWrite()) && - variable.defs.every(def => def.node.type === "VariableDeclarator" && def.node.init === null); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow identifiers from shadowing restricted names", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-shadow-restricted-names" - }, - - schema: [], - - messages: { - shadowingRestrictedName: "Shadowing of global property '{{name}}'." - } - }, - - create(context) { - - - const RESTRICTED = new Set(["undefined", "NaN", "Infinity", "arguments", "eval"]); - const sourceCode = context.sourceCode; - - return { - "VariableDeclaration, :function, CatchClause"(node) { - for (const variable of sourceCode.getDeclaredVariables(node)) { - if (variable.defs.length > 0 && RESTRICTED.has(variable.name) && !safelyShadowsUndefined(variable)) { - context.report({ - node: variable.defs[0].name, - messageId: "shadowingRestrictedName", - data: { - name: variable.name - } - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-shadow.js b/node_modules/eslint/lib/rules/no-shadow.js deleted file mode 100644 index 3e4d99822..000000000 --- a/node_modules/eslint/lib/rules/no-shadow.js +++ /dev/null @@ -1,336 +0,0 @@ -/** - * @fileoverview Rule to flag on declaring variables already declared in the outer scope - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const FUNC_EXPR_NODE_TYPES = new Set(["ArrowFunctionExpression", "FunctionExpression"]); -const CALL_EXPR_NODE_TYPE = new Set(["CallExpression"]); -const FOR_IN_OF_TYPE = /^For(?:In|Of)Statement$/u; -const SENTINEL_TYPE = /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/u; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow variable declarations from shadowing variables declared in the outer scope", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-shadow" - }, - - schema: [ - { - type: "object", - properties: { - builtinGlobals: { type: "boolean", default: false }, - hoist: { enum: ["all", "functions", "never"], default: "functions" }, - allow: { - type: "array", - items: { - type: "string" - } - }, - ignoreOnInitialization: { type: "boolean", default: false } - }, - additionalProperties: false - } - ], - - messages: { - noShadow: "'{{name}}' is already declared in the upper scope on line {{shadowedLine}} column {{shadowedColumn}}.", - noShadowGlobal: "'{{name}}' is already a global variable." - } - }, - - create(context) { - - const options = { - builtinGlobals: context.options[0] && context.options[0].builtinGlobals, - hoist: (context.options[0] && context.options[0].hoist) || "functions", - allow: (context.options[0] && context.options[0].allow) || [], - ignoreOnInitialization: context.options[0] && context.options[0].ignoreOnInitialization - }; - const sourceCode = context.sourceCode; - - /** - * Checks whether or not a given location is inside of the range of a given node. - * @param {ASTNode} node An node to check. - * @param {number} location A location to check. - * @returns {boolean} `true` if the location is inside of the range of the node. - */ - function isInRange(node, location) { - return node && node.range[0] <= location && location <= node.range[1]; - } - - /** - * Searches from the current node through its ancestry to find a matching node. - * @param {ASTNode} node a node to get. - * @param {(node: ASTNode) => boolean} match a callback that checks whether or not the node verifies its condition or not. - * @returns {ASTNode|null} the matching node. - */ - function findSelfOrAncestor(node, match) { - let currentNode = node; - - while (currentNode && !match(currentNode)) { - currentNode = currentNode.parent; - } - return currentNode; - } - - /** - * Finds function's outer scope. - * @param {Scope} scope Function's own scope. - * @returns {Scope} Function's outer scope. - */ - function getOuterScope(scope) { - const upper = scope.upper; - - if (upper.type === "function-expression-name") { - return upper.upper; - } - return upper; - } - - /** - * Checks if a variable and a shadowedVariable have the same init pattern ancestor. - * @param {Object} variable a variable to check. - * @param {Object} shadowedVariable a shadowedVariable to check. - * @returns {boolean} Whether or not the variable and the shadowedVariable have the same init pattern ancestor. - */ - function isInitPatternNode(variable, shadowedVariable) { - const outerDef = shadowedVariable.defs[0]; - - if (!outerDef) { - return false; - } - - const { variableScope } = variable.scope; - - - if (!(FUNC_EXPR_NODE_TYPES.has(variableScope.block.type) && getOuterScope(variableScope) === shadowedVariable.scope)) { - return false; - } - - const fun = variableScope.block; - const { parent } = fun; - - const callExpression = findSelfOrAncestor( - parent, - node => CALL_EXPR_NODE_TYPE.has(node.type) - ); - - if (!callExpression) { - return false; - } - - let node = outerDef.name; - const location = callExpression.range[1]; - - while (node) { - if (node.type === "VariableDeclarator") { - if (isInRange(node.init, location)) { - return true; - } - if (FOR_IN_OF_TYPE.test(node.parent.parent.type) && - isInRange(node.parent.parent.right, location) - ) { - return true; - } - break; - } else if (node.type === "AssignmentPattern") { - if (isInRange(node.right, location)) { - return true; - } - } else if (SENTINEL_TYPE.test(node.type)) { - break; - } - - node = node.parent; - } - - return false; - } - - /** - * Check if variable name is allowed. - * @param {ASTNode} variable The variable to check. - * @returns {boolean} Whether or not the variable name is allowed. - */ - function isAllowed(variable) { - return options.allow.includes(variable.name); - } - - /** - * Checks if a variable of the class name in the class scope of ClassDeclaration. - * - * ClassDeclaration creates two variables of its name into its outer scope and its class scope. - * So we should ignore the variable in the class scope. - * @param {Object} variable The variable to check. - * @returns {boolean} Whether or not the variable of the class name in the class scope of ClassDeclaration. - */ - function isDuplicatedClassNameVariable(variable) { - const block = variable.scope.block; - - return block.type === "ClassDeclaration" && block.id === variable.identifiers[0]; - } - - /** - * Checks if a variable is inside the initializer of scopeVar. - * - * To avoid reporting at declarations such as `var a = function a() {};`. - * But it should report `var a = function(a) {};` or `var a = function() { function a() {} };`. - * @param {Object} variable The variable to check. - * @param {Object} scopeVar The scope variable to look for. - * @returns {boolean} Whether or not the variable is inside initializer of scopeVar. - */ - function isOnInitializer(variable, scopeVar) { - const outerScope = scopeVar.scope; - const outerDef = scopeVar.defs[0]; - const outer = outerDef && outerDef.parent && outerDef.parent.range; - const innerScope = variable.scope; - const innerDef = variable.defs[0]; - const inner = innerDef && innerDef.name.range; - - return ( - outer && - inner && - outer[0] < inner[0] && - inner[1] < outer[1] && - ((innerDef.type === "FunctionName" && innerDef.node.type === "FunctionExpression") || innerDef.node.type === "ClassExpression") && - outerScope === innerScope.upper - ); - } - - /** - * Get a range of a variable's identifier node. - * @param {Object} variable The variable to get. - * @returns {Array|undefined} The range of the variable's identifier node. - */ - function getNameRange(variable) { - const def = variable.defs[0]; - - return def && def.name.range; - } - - /** - * Get declared line and column of a variable. - * @param {eslint-scope.Variable} variable The variable to get. - * @returns {Object} The declared line and column of the variable. - */ - function getDeclaredLocation(variable) { - const identifier = variable.identifiers[0]; - let obj; - - if (identifier) { - obj = { - global: false, - line: identifier.loc.start.line, - column: identifier.loc.start.column + 1 - }; - } else { - obj = { - global: true - }; - } - return obj; - } - - /** - * Checks if a variable is in TDZ of scopeVar. - * @param {Object} variable The variable to check. - * @param {Object} scopeVar The variable of TDZ. - * @returns {boolean} Whether or not the variable is in TDZ of scopeVar. - */ - function isInTdz(variable, scopeVar) { - const outerDef = scopeVar.defs[0]; - const inner = getNameRange(variable); - const outer = getNameRange(scopeVar); - - return ( - inner && - outer && - inner[1] < outer[0] && - - // Excepts FunctionDeclaration if is {"hoist":"function"}. - (options.hoist !== "functions" || !outerDef || outerDef.node.type !== "FunctionDeclaration") - ); - } - - /** - * Checks the current context for shadowed variables. - * @param {Scope} scope Fixme - * @returns {void} - */ - function checkForShadows(scope) { - const variables = scope.variables; - - for (let i = 0; i < variables.length; ++i) { - const variable = variables[i]; - - // Skips "arguments" or variables of a class name in the class scope of ClassDeclaration. - if (variable.identifiers.length === 0 || - isDuplicatedClassNameVariable(variable) || - isAllowed(variable) - ) { - continue; - } - - // Gets shadowed variable. - const shadowed = astUtils.getVariableByName(scope.upper, variable.name); - - if (shadowed && - (shadowed.identifiers.length > 0 || (options.builtinGlobals && "writeable" in shadowed)) && - !isOnInitializer(variable, shadowed) && - !(options.ignoreOnInitialization && isInitPatternNode(variable, shadowed)) && - !(options.hoist !== "all" && isInTdz(variable, shadowed)) - ) { - const location = getDeclaredLocation(shadowed); - const messageId = location.global ? "noShadowGlobal" : "noShadow"; - const data = { name: variable.name }; - - if (!location.global) { - data.shadowedLine = location.line; - data.shadowedColumn = location.column; - } - context.report({ - node: variable.identifiers[0], - messageId, - data - }); - } - } - } - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - const stack = globalScope.childScopes.slice(); - - while (stack.length) { - const scope = stack.pop(); - - stack.push(...scope.childScopes); - checkForShadows(scope); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-spaced-func.js b/node_modules/eslint/lib/rules/no-spaced-func.js deleted file mode 100644 index d79c18440..000000000 --- a/node_modules/eslint/lib/rules/no-spaced-func.js +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @fileoverview Rule to check that spaced function application - * @author Matt DuVall - * @deprecated in ESLint v3.3.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Disallow spacing between function identifiers and their applications (deprecated)", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-spaced-func" - }, - - deprecated: true, - - replacedBy: ["func-call-spacing"], - - fixable: "whitespace", - schema: [], - - messages: { - noSpacedFunction: "Unexpected space between function name and paren." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Check if open space is present in a function name - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function detectOpenSpaces(node) { - const lastCalleeToken = sourceCode.getLastToken(node.callee); - let prevToken = lastCalleeToken, - parenToken = sourceCode.getTokenAfter(lastCalleeToken); - - // advances to an open parenthesis. - while ( - parenToken && - parenToken.range[1] < node.range[1] && - parenToken.value !== "(" - ) { - prevToken = parenToken; - parenToken = sourceCode.getTokenAfter(parenToken); - } - - // look for a space between the callee and the open paren - if (parenToken && - parenToken.range[1] < node.range[1] && - sourceCode.isSpaceBetweenTokens(prevToken, parenToken) - ) { - context.report({ - node, - loc: lastCalleeToken.loc.start, - messageId: "noSpacedFunction", - fix(fixer) { - return fixer.removeRange([prevToken.range[1], parenToken.range[0]]); - } - }); - } - } - - return { - CallExpression: detectOpenSpaces, - NewExpression: detectOpenSpaces - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-sparse-arrays.js b/node_modules/eslint/lib/rules/no-sparse-arrays.js deleted file mode 100644 index c65b0ab2c..000000000 --- a/node_modules/eslint/lib/rules/no-sparse-arrays.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @fileoverview Disallow sparse arrays - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow sparse arrays", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-sparse-arrays" - }, - - schema: [], - - messages: { - unexpectedSparseArray: "Unexpected comma in middle of array." - } - }, - - create(context) { - - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - ArrayExpression(node) { - - const emptySpot = node.elements.includes(null); - - if (emptySpot) { - context.report({ node, messageId: "unexpectedSparseArray" }); - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-sync.js b/node_modules/eslint/lib/rules/no-sync.js deleted file mode 100644 index 8f79a36b4..000000000 --- a/node_modules/eslint/lib/rules/no-sync.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @fileoverview Rule to check for properties whose identifier ends with the string Sync - * @author Matt DuVall - * @deprecated in ESLint v7.0.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - - replacedBy: [], - - type: "suggestion", - - docs: { - description: "Disallow synchronous methods", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-sync" - }, - - schema: [ - { - type: "object", - properties: { - allowAtRootLevel: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - noSync: "Unexpected sync method: '{{propertyName}}'." - } - }, - - create(context) { - const selector = context.options[0] && context.options[0].allowAtRootLevel - ? ":function MemberExpression[property.name=/.*Sync$/]" - : "MemberExpression[property.name=/.*Sync$/]"; - - return { - [selector](node) { - context.report({ - node, - messageId: "noSync", - data: { - propertyName: node.property.name - } - }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-tabs.js b/node_modules/eslint/lib/rules/no-tabs.js deleted file mode 100644 index b33690c24..000000000 --- a/node_modules/eslint/lib/rules/no-tabs.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @fileoverview Rule to check for tabs inside a file - * @author Gyandeep Singh - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const tabRegex = /\t+/gu; -const anyNonWhitespaceRegex = /\S/u; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Disallow all tabs", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-tabs" - }, - schema: [{ - type: "object", - properties: { - allowIndentationTabs: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - - messages: { - unexpectedTab: "Unexpected tab character." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const allowIndentationTabs = context.options && context.options[0] && context.options[0].allowIndentationTabs; - - return { - Program(node) { - sourceCode.getLines().forEach((line, index) => { - let match; - - while ((match = tabRegex.exec(line)) !== null) { - if (allowIndentationTabs && !anyNonWhitespaceRegex.test(line.slice(0, match.index))) { - continue; - } - - context.report({ - node, - loc: { - start: { - line: index + 1, - column: match.index - }, - end: { - line: index + 1, - column: match.index + match[0].length - } - }, - messageId: "unexpectedTab" - }); - } - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-template-curly-in-string.js b/node_modules/eslint/lib/rules/no-template-curly-in-string.js deleted file mode 100644 index 92b4c1c86..000000000 --- a/node_modules/eslint/lib/rules/no-template-curly-in-string.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @fileoverview Warn when using template string syntax in regular strings - * @author Jeroen Engels - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow template literal placeholder syntax in regular strings", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-template-curly-in-string" - }, - - schema: [], - - messages: { - unexpectedTemplateExpression: "Unexpected template string expression." - } - }, - - create(context) { - const regex = /\$\{[^}]+\}/u; - - return { - Literal(node) { - if (typeof node.value === "string" && regex.test(node.value)) { - context.report({ - node, - messageId: "unexpectedTemplateExpression" - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-ternary.js b/node_modules/eslint/lib/rules/no-ternary.js deleted file mode 100644 index 4d43c7e02..000000000 --- a/node_modules/eslint/lib/rules/no-ternary.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @fileoverview Rule to flag use of ternary operators. - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow ternary operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-ternary" - }, - - schema: [], - - messages: { - noTernaryOperator: "Ternary operator used." - } - }, - - create(context) { - - return { - - ConditionalExpression(node) { - context.report({ node, messageId: "noTernaryOperator" }); - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-this-before-super.js b/node_modules/eslint/lib/rules/no-this-before-super.js deleted file mode 100644 index 139bb6649..000000000 --- a/node_modules/eslint/lib/rules/no-this-before-super.js +++ /dev/null @@ -1,304 +0,0 @@ -/** - * @fileoverview A rule to disallow using `this`/`super` before `super()`. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a given node is a constructor. - * @param {ASTNode} node A node to check. This node type is one of - * `Program`, `FunctionDeclaration`, `FunctionExpression`, and - * `ArrowFunctionExpression`. - * @returns {boolean} `true` if the node is a constructor. - */ -function isConstructorFunction(node) { - return ( - node.type === "FunctionExpression" && - node.parent.type === "MethodDefinition" && - node.parent.kind === "constructor" - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow `this`/`super` before calling `super()` in constructors", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-this-before-super" - }, - - schema: [], - - messages: { - noBeforeSuper: "'{{kind}}' is not allowed before 'super()'." - } - }, - - create(context) { - - /* - * Information for each constructor. - * - upper: Information of the upper constructor. - * - hasExtends: A flag which shows whether the owner class has a valid - * `extends` part. - * - scope: The scope of the owner class. - * - codePath: The code path of this constructor. - */ - let funcInfo = null; - - /* - * Information for each code path segment. - * Each key is the id of a code path segment. - * Each value is an object: - * - superCalled: The flag which shows `super()` called in all code paths. - * - invalidNodes: The array of invalid ThisExpression and Super nodes. - */ - let segInfoMap = Object.create(null); - - /** - * Gets whether or not `super()` is called in a given code path segment. - * @param {CodePathSegment} segment A code path segment to get. - * @returns {boolean} `true` if `super()` is called. - */ - function isCalled(segment) { - return !segment.reachable || segInfoMap[segment.id].superCalled; - } - - /** - * Checks whether or not this is in a constructor. - * @returns {boolean} `true` if this is in a constructor. - */ - function isInConstructorOfDerivedClass() { - return Boolean(funcInfo && funcInfo.isConstructor && funcInfo.hasExtends); - } - - /** - * Checks whether or not this is before `super()` is called. - * @returns {boolean} `true` if this is before `super()` is called. - */ - function isBeforeCallOfSuper() { - return ( - isInConstructorOfDerivedClass() && - !funcInfo.codePath.currentSegments.every(isCalled) - ); - } - - /** - * Sets a given node as invalid. - * @param {ASTNode} node A node to set as invalid. This is one of - * a ThisExpression and a Super. - * @returns {void} - */ - function setInvalid(node) { - const segments = funcInfo.codePath.currentSegments; - - for (let i = 0; i < segments.length; ++i) { - const segment = segments[i]; - - if (segment.reachable) { - segInfoMap[segment.id].invalidNodes.push(node); - } - } - } - - /** - * Sets the current segment as `super` was called. - * @returns {void} - */ - function setSuperCalled() { - const segments = funcInfo.codePath.currentSegments; - - for (let i = 0; i < segments.length; ++i) { - const segment = segments[i]; - - if (segment.reachable) { - segInfoMap[segment.id].superCalled = true; - } - } - } - - return { - - /** - * Adds information of a constructor into the stack. - * @param {CodePath} codePath A code path which was started. - * @param {ASTNode} node The current node. - * @returns {void} - */ - onCodePathStart(codePath, node) { - if (isConstructorFunction(node)) { - - // Class > ClassBody > MethodDefinition > FunctionExpression - const classNode = node.parent.parent.parent; - - funcInfo = { - upper: funcInfo, - isConstructor: true, - hasExtends: Boolean( - classNode.superClass && - !astUtils.isNullOrUndefined(classNode.superClass) - ), - codePath - }; - } else { - funcInfo = { - upper: funcInfo, - isConstructor: false, - hasExtends: false, - codePath - }; - } - }, - - /** - * Removes the top of stack item. - * - * And this traverses all segments of this code path then reports every - * invalid node. - * @param {CodePath} codePath A code path which was ended. - * @returns {void} - */ - onCodePathEnd(codePath) { - const isDerivedClass = funcInfo.hasExtends; - - funcInfo = funcInfo.upper; - if (!isDerivedClass) { - return; - } - - codePath.traverseSegments((segment, controller) => { - const info = segInfoMap[segment.id]; - - for (let i = 0; i < info.invalidNodes.length; ++i) { - const invalidNode = info.invalidNodes[i]; - - context.report({ - messageId: "noBeforeSuper", - node: invalidNode, - data: { - kind: invalidNode.type === "Super" ? "super" : "this" - } - }); - } - - if (info.superCalled) { - controller.skip(); - } - }); - }, - - /** - * Initialize information of a given code path segment. - * @param {CodePathSegment} segment A code path segment to initialize. - * @returns {void} - */ - onCodePathSegmentStart(segment) { - if (!isInConstructorOfDerivedClass()) { - return; - } - - // Initialize info. - segInfoMap[segment.id] = { - superCalled: ( - segment.prevSegments.length > 0 && - segment.prevSegments.every(isCalled) - ), - invalidNodes: [] - }; - }, - - /** - * Update information of the code path segment when a code path was - * looped. - * @param {CodePathSegment} fromSegment The code path segment of the - * end of a loop. - * @param {CodePathSegment} toSegment A code path segment of the head - * of a loop. - * @returns {void} - */ - onCodePathSegmentLoop(fromSegment, toSegment) { - if (!isInConstructorOfDerivedClass()) { - return; - } - - // Update information inside of the loop. - funcInfo.codePath.traverseSegments( - { first: toSegment, last: fromSegment }, - (segment, controller) => { - const info = segInfoMap[segment.id]; - - if (info.superCalled) { - info.invalidNodes = []; - controller.skip(); - } else if ( - segment.prevSegments.length > 0 && - segment.prevSegments.every(isCalled) - ) { - info.superCalled = true; - info.invalidNodes = []; - } - } - ); - }, - - /** - * Reports if this is before `super()`. - * @param {ASTNode} node A target node. - * @returns {void} - */ - ThisExpression(node) { - if (isBeforeCallOfSuper()) { - setInvalid(node); - } - }, - - /** - * Reports if this is before `super()`. - * @param {ASTNode} node A target node. - * @returns {void} - */ - Super(node) { - if (!astUtils.isCallee(node) && isBeforeCallOfSuper()) { - setInvalid(node); - } - }, - - /** - * Marks `super()` called. - * @param {ASTNode} node A target node. - * @returns {void} - */ - "CallExpression:exit"(node) { - if (node.callee.type === "Super" && isBeforeCallOfSuper()) { - setSuperCalled(); - } - }, - - /** - * Resets state. - * @returns {void} - */ - "Program:exit"() { - segInfoMap = Object.create(null); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-throw-literal.js b/node_modules/eslint/lib/rules/no-throw-literal.js deleted file mode 100644 index 07a0df62d..000000000 --- a/node_modules/eslint/lib/rules/no-throw-literal.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @fileoverview Rule to restrict what can be thrown as an exception. - * @author Dieter Oberkofler - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow throwing literals as exceptions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-throw-literal" - }, - - schema: [], - - messages: { - object: "Expected an error object to be thrown.", - undef: "Do not throw undefined." - } - }, - - create(context) { - - return { - - ThrowStatement(node) { - if (!astUtils.couldBeError(node.argument)) { - context.report({ node, messageId: "object" }); - } else if (node.argument.type === "Identifier") { - if (node.argument.name === "undefined") { - context.report({ node, messageId: "undef" }); - } - } - - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-trailing-spaces.js b/node_modules/eslint/lib/rules/no-trailing-spaces.js deleted file mode 100644 index 1674de542..000000000 --- a/node_modules/eslint/lib/rules/no-trailing-spaces.js +++ /dev/null @@ -1,190 +0,0 @@ -/** - * @fileoverview Disallow trailing spaces at the end of lines. - * @author Nodeca Team - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Disallow trailing whitespace at the end of lines", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-trailing-spaces" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - skipBlankLines: { - type: "boolean", - default: false - }, - ignoreComments: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - trailingSpace: "Trailing spaces not allowed." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - const BLANK_CLASS = "[ \t\u00a0\u2000-\u200b\u3000]", - SKIP_BLANK = `^${BLANK_CLASS}*$`, - NONBLANK = `${BLANK_CLASS}+$`; - - const options = context.options[0] || {}, - skipBlankLines = options.skipBlankLines || false, - ignoreComments = options.ignoreComments || false; - - /** - * Report the error message - * @param {ASTNode} node node to report - * @param {int[]} location range information - * @param {int[]} fixRange Range based on the whole program - * @returns {void} - */ - function report(node, location, fixRange) { - - /* - * Passing node is a bit dirty, because message data will contain big - * text in `source`. But... who cares :) ? - * One more kludge will not make worse the bloody wizardry of this - * plugin. - */ - context.report({ - node, - loc: location, - messageId: "trailingSpace", - fix(fixer) { - return fixer.removeRange(fixRange); - } - }); - } - - /** - * Given a list of comment nodes, return the line numbers for those comments. - * @param {Array} comments An array of comment nodes. - * @returns {number[]} An array of line numbers containing comments. - */ - function getCommentLineNumbers(comments) { - const lines = new Set(); - - comments.forEach(comment => { - const endLine = comment.type === "Block" - ? comment.loc.end.line - 1 - : comment.loc.end.line; - - for (let i = comment.loc.start.line; i <= endLine; i++) { - lines.add(i); - } - }); - - return lines; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - Program: function checkTrailingSpaces(node) { - - /* - * Let's hack. Since Espree does not return whitespace nodes, - * fetch the source code and do matching via regexps. - */ - - const re = new RegExp(NONBLANK, "u"), - skipMatch = new RegExp(SKIP_BLANK, "u"), - lines = sourceCode.lines, - linebreaks = sourceCode.getText().match(astUtils.createGlobalLinebreakMatcher()), - comments = sourceCode.getAllComments(), - commentLineNumbers = getCommentLineNumbers(comments); - - let totalLength = 0, - fixRange = []; - - for (let i = 0, ii = lines.length; i < ii; i++) { - const lineNumber = i + 1; - - /* - * Always add linebreak length to line length to accommodate for line break (\n or \r\n) - * Because during the fix time they also reserve one spot in the array. - * Usually linebreak length is 2 for \r\n (CRLF) and 1 for \n (LF) - */ - const linebreakLength = linebreaks && linebreaks[i] ? linebreaks[i].length : 1; - const lineLength = lines[i].length + linebreakLength; - - const matches = re.exec(lines[i]); - - if (matches) { - const location = { - start: { - line: lineNumber, - column: matches.index - }, - end: { - line: lineNumber, - column: lineLength - linebreakLength - } - }; - - const rangeStart = totalLength + location.start.column; - const rangeEnd = totalLength + location.end.column; - const containingNode = sourceCode.getNodeByRangeIndex(rangeStart); - - if (containingNode && containingNode.type === "TemplateElement" && - rangeStart > containingNode.parent.range[0] && - rangeEnd < containingNode.parent.range[1]) { - totalLength += lineLength; - continue; - } - - /* - * If the line has only whitespace, and skipBlankLines - * is true, don't report it - */ - if (skipBlankLines && skipMatch.test(lines[i])) { - totalLength += lineLength; - continue; - } - - fixRange = [rangeStart, rangeEnd]; - - if (!ignoreComments || !commentLineNumbers.has(lineNumber)) { - report(node, location, fixRange); - } - } - - totalLength += lineLength; - } - } - - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-undef-init.js b/node_modules/eslint/lib/rules/no-undef-init.js deleted file mode 100644 index be19d6f95..000000000 --- a/node_modules/eslint/lib/rules/no-undef-init.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @fileoverview Rule to flag when initializing to undefined - * @author Ilya Volodin - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow initializing variables to `undefined`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-undef-init" - }, - - schema: [], - fixable: "code", - - messages: { - unnecessaryUndefinedInit: "It's not necessary to initialize '{{name}}' to undefined." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - - VariableDeclarator(node) { - const name = sourceCode.getText(node.id), - init = node.init && node.init.name, - scope = sourceCode.getScope(node), - undefinedVar = astUtils.getVariableByName(scope, "undefined"), - shadowed = undefinedVar && undefinedVar.defs.length > 0, - lastToken = sourceCode.getLastToken(node); - - if (init === "undefined" && node.parent.kind !== "const" && !shadowed) { - context.report({ - node, - messageId: "unnecessaryUndefinedInit", - data: { name }, - fix(fixer) { - if (node.parent.kind === "var") { - return null; - } - - if (node.id.type === "ArrayPattern" || node.id.type === "ObjectPattern") { - - // Don't fix destructuring assignment to `undefined`. - return null; - } - - if (sourceCode.commentsExistBetween(node.id, lastToken)) { - return null; - } - - return fixer.removeRange([node.id.range[1], node.range[1]]); - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-undef.js b/node_modules/eslint/lib/rules/no-undef.js deleted file mode 100644 index fe470286c..000000000 --- a/node_modules/eslint/lib/rules/no-undef.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @fileoverview Rule to flag references to undeclared variables. - * @author Mark Macdonald - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks if the given node is the argument of a typeof operator. - * @param {ASTNode} node The AST node being checked. - * @returns {boolean} Whether or not the node is the argument of a typeof operator. - */ -function hasTypeOfOperator(node) { - const parent = node.parent; - - return parent.type === "UnaryExpression" && parent.operator === "typeof"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow the use of undeclared variables unless mentioned in `/*global */` comments", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-undef" - }, - - schema: [ - { - type: "object", - properties: { - typeof: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - messages: { - undef: "'{{name}}' is not defined." - } - }, - - create(context) { - const options = context.options[0]; - const considerTypeOf = options && options.typeof === true || false; - const sourceCode = context.sourceCode; - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - - globalScope.through.forEach(ref => { - const identifier = ref.identifier; - - if (!considerTypeOf && hasTypeOfOperator(identifier)) { - return; - } - - context.report({ - node: identifier, - messageId: "undef", - data: identifier - }); - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-undefined.js b/node_modules/eslint/lib/rules/no-undefined.js deleted file mode 100644 index 8f47ca1b0..000000000 --- a/node_modules/eslint/lib/rules/no-undefined.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @fileoverview Rule to flag references to the undefined variable. - * @author Michael Ficarra - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the use of `undefined` as an identifier", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-undefined" - }, - - schema: [], - - messages: { - unexpectedUndefined: "Unexpected use of undefined." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Report an invalid "undefined" identifier node. - * @param {ASTNode} node The node to report. - * @returns {void} - */ - function report(node) { - context.report({ - node, - messageId: "unexpectedUndefined" - }); - } - - /** - * Checks the given scope for references to `undefined` and reports - * all references found. - * @param {eslint-scope.Scope} scope The scope to check. - * @returns {void} - */ - function checkScope(scope) { - const undefinedVar = scope.set.get("undefined"); - - if (!undefinedVar) { - return; - } - - const references = undefinedVar.references; - - const defs = undefinedVar.defs; - - // Report non-initializing references (those are covered in defs below) - references - .filter(ref => !ref.init) - .forEach(ref => report(ref.identifier)); - - defs.forEach(def => report(def.name)); - } - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - - const stack = [globalScope]; - - while (stack.length) { - const scope = stack.pop(); - - stack.push(...scope.childScopes); - checkScope(scope); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-underscore-dangle.js b/node_modules/eslint/lib/rules/no-underscore-dangle.js deleted file mode 100644 index a0e05c6c1..000000000 --- a/node_modules/eslint/lib/rules/no-underscore-dangle.js +++ /dev/null @@ -1,335 +0,0 @@ -/** - * @fileoverview Rule to flag dangling underscores in variable declarations. - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow dangling underscores in identifiers", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-underscore-dangle" - }, - - schema: [ - { - type: "object", - properties: { - allow: { - type: "array", - items: { - type: "string" - } - }, - allowAfterThis: { - type: "boolean", - default: false - }, - allowAfterSuper: { - type: "boolean", - default: false - }, - allowAfterThisConstructor: { - type: "boolean", - default: false - }, - enforceInMethodNames: { - type: "boolean", - default: false - }, - allowFunctionParams: { - type: "boolean", - default: true - }, - enforceInClassFields: { - type: "boolean", - default: false - }, - allowInArrayDestructuring: { - type: "boolean", - default: true - }, - allowInObjectDestructuring: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedUnderscore: "Unexpected dangling '_' in '{{identifier}}'." - } - }, - - create(context) { - - const options = context.options[0] || {}; - const ALLOWED_VARIABLES = options.allow ? options.allow : []; - const allowAfterThis = typeof options.allowAfterThis !== "undefined" ? options.allowAfterThis : false; - const allowAfterSuper = typeof options.allowAfterSuper !== "undefined" ? options.allowAfterSuper : false; - const allowAfterThisConstructor = typeof options.allowAfterThisConstructor !== "undefined" ? options.allowAfterThisConstructor : false; - const enforceInMethodNames = typeof options.enforceInMethodNames !== "undefined" ? options.enforceInMethodNames : false; - const enforceInClassFields = typeof options.enforceInClassFields !== "undefined" ? options.enforceInClassFields : false; - const allowFunctionParams = typeof options.allowFunctionParams !== "undefined" ? options.allowFunctionParams : true; - const allowInArrayDestructuring = typeof options.allowInArrayDestructuring !== "undefined" ? options.allowInArrayDestructuring : true; - const allowInObjectDestructuring = typeof options.allowInObjectDestructuring !== "undefined" ? options.allowInObjectDestructuring : true; - const sourceCode = context.sourceCode; - - //------------------------------------------------------------------------- - // Helpers - //------------------------------------------------------------------------- - - /** - * Check if identifier is present inside the allowed option - * @param {string} identifier name of the node - * @returns {boolean} true if its is present - * @private - */ - function isAllowed(identifier) { - return ALLOWED_VARIABLES.includes(identifier); - } - - /** - * Check if identifier has a dangling underscore - * @param {string} identifier name of the node - * @returns {boolean} true if its is present - * @private - */ - function hasDanglingUnderscore(identifier) { - const len = identifier.length; - - return identifier !== "_" && (identifier[0] === "_" || identifier[len - 1] === "_"); - } - - /** - * Check if identifier is a special case member expression - * @param {string} identifier name of the node - * @returns {boolean} true if its is a special case - * @private - */ - function isSpecialCaseIdentifierForMemberExpression(identifier) { - return identifier === "__proto__"; - } - - /** - * Check if identifier is a special case variable expression - * @param {string} identifier name of the node - * @returns {boolean} true if its is a special case - * @private - */ - function isSpecialCaseIdentifierInVariableExpression(identifier) { - - // Checks for the underscore library usage here - return identifier === "_"; - } - - /** - * Check if a node is a member reference of this.constructor - * @param {ASTNode} node node to evaluate - * @returns {boolean} true if it is a reference on this.constructor - * @private - */ - function isThisConstructorReference(node) { - return node.object.type === "MemberExpression" && - node.object.property.name === "constructor" && - node.object.object.type === "ThisExpression"; - } - - /** - * Check if function parameter has a dangling underscore. - * @param {ASTNode} node function node to evaluate - * @returns {void} - * @private - */ - function checkForDanglingUnderscoreInFunctionParameters(node) { - if (!allowFunctionParams) { - node.params.forEach(param => { - const { type } = param; - let nodeToCheck; - - if (type === "RestElement") { - nodeToCheck = param.argument; - } else if (type === "AssignmentPattern") { - nodeToCheck = param.left; - } else { - nodeToCheck = param; - } - - if (nodeToCheck.type === "Identifier") { - const identifier = nodeToCheck.name; - - if (hasDanglingUnderscore(identifier) && !isAllowed(identifier)) { - context.report({ - node: param, - messageId: "unexpectedUnderscore", - data: { - identifier - } - }); - } - } - }); - } - } - - /** - * Check if function has a dangling underscore - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkForDanglingUnderscoreInFunction(node) { - if (node.type === "FunctionDeclaration" && node.id) { - const identifier = node.id.name; - - if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && !isAllowed(identifier)) { - context.report({ - node, - messageId: "unexpectedUnderscore", - data: { - identifier - } - }); - } - } - checkForDanglingUnderscoreInFunctionParameters(node); - } - - - /** - * Check if variable expression has a dangling underscore - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkForDanglingUnderscoreInVariableExpression(node) { - sourceCode.getDeclaredVariables(node).forEach(variable => { - const definition = variable.defs.find(def => def.node === node); - const identifierNode = definition.name; - const identifier = identifierNode.name; - let parent = identifierNode.parent; - - while (!["VariableDeclarator", "ArrayPattern", "ObjectPattern"].includes(parent.type)) { - parent = parent.parent; - } - - if ( - hasDanglingUnderscore(identifier) && - !isSpecialCaseIdentifierInVariableExpression(identifier) && - !isAllowed(identifier) && - !(allowInArrayDestructuring && parent.type === "ArrayPattern") && - !(allowInObjectDestructuring && parent.type === "ObjectPattern") - ) { - context.report({ - node, - messageId: "unexpectedUnderscore", - data: { - identifier - } - }); - } - }); - } - - /** - * Check if member expression has a dangling underscore - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkForDanglingUnderscoreInMemberExpression(node) { - const identifier = node.property.name, - isMemberOfThis = node.object.type === "ThisExpression", - isMemberOfSuper = node.object.type === "Super", - isMemberOfThisConstructor = isThisConstructorReference(node); - - if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && - !(isMemberOfThis && allowAfterThis) && - !(isMemberOfSuper && allowAfterSuper) && - !(isMemberOfThisConstructor && allowAfterThisConstructor) && - !isSpecialCaseIdentifierForMemberExpression(identifier) && !isAllowed(identifier)) { - context.report({ - node, - messageId: "unexpectedUnderscore", - data: { - identifier - } - }); - } - } - - /** - * Check if method declaration or method property has a dangling underscore - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkForDanglingUnderscoreInMethod(node) { - const identifier = node.key.name; - const isMethod = node.type === "MethodDefinition" || node.type === "Property" && node.method; - - if (typeof identifier !== "undefined" && enforceInMethodNames && isMethod && hasDanglingUnderscore(identifier) && !isAllowed(identifier)) { - context.report({ - node, - messageId: "unexpectedUnderscore", - data: { - identifier: node.key.type === "PrivateIdentifier" - ? `#${identifier}` - : identifier - } - }); - } - } - - /** - * Check if a class field has a dangling underscore - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkForDanglingUnderscoreInClassField(node) { - const identifier = node.key.name; - - if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && - enforceInClassFields && - !isAllowed(identifier)) { - context.report({ - node, - messageId: "unexpectedUnderscore", - data: { - identifier: node.key.type === "PrivateIdentifier" - ? `#${identifier}` - : identifier - } - }); - } - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - FunctionDeclaration: checkForDanglingUnderscoreInFunction, - VariableDeclarator: checkForDanglingUnderscoreInVariableExpression, - MemberExpression: checkForDanglingUnderscoreInMemberExpression, - MethodDefinition: checkForDanglingUnderscoreInMethod, - PropertyDefinition: checkForDanglingUnderscoreInClassField, - Property: checkForDanglingUnderscoreInMethod, - FunctionExpression: checkForDanglingUnderscoreInFunction, - ArrowFunctionExpression: checkForDanglingUnderscoreInFunction - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-unexpected-multiline.js b/node_modules/eslint/lib/rules/no-unexpected-multiline.js deleted file mode 100644 index 810c08b01..000000000 --- a/node_modules/eslint/lib/rules/no-unexpected-multiline.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @fileoverview Rule to spot scenarios where a newline looks like it is ending a statement, but is not. - * @author Glen Mailer - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow confusing multiline expressions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unexpected-multiline" - }, - - schema: [], - messages: { - function: "Unexpected newline between function and ( of function call.", - property: "Unexpected newline between object and [ of property access.", - taggedTemplate: "Unexpected newline between template tag and template literal.", - division: "Unexpected newline between numerator and division operator." - } - }, - - create(context) { - - const REGEX_FLAG_MATCHER = /^[gimsuy]+$/u; - - const sourceCode = context.sourceCode; - - /** - * Check to see if there is a newline between the node and the following open bracket - * line's expression - * @param {ASTNode} node The node to check. - * @param {string} messageId The error messageId to use. - * @returns {void} - * @private - */ - function checkForBreakAfter(node, messageId) { - const openParen = sourceCode.getTokenAfter(node, astUtils.isNotClosingParenToken); - const nodeExpressionEnd = sourceCode.getTokenBefore(openParen); - - if (openParen.loc.start.line !== nodeExpressionEnd.loc.end.line) { - context.report({ - node, - loc: openParen.loc, - messageId - }); - } - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - - MemberExpression(node) { - if (!node.computed || node.optional) { - return; - } - checkForBreakAfter(node.object, "property"); - }, - - TaggedTemplateExpression(node) { - const { quasi } = node; - - // handles common tags, parenthesized tags, and typescript's generic type arguments - const tokenBefore = sourceCode.getTokenBefore(quasi); - - if (tokenBefore.loc.end.line !== quasi.loc.start.line) { - context.report({ - node, - loc: { - start: quasi.loc.start, - end: { - line: quasi.loc.start.line, - column: quasi.loc.start.column + 1 - } - }, - messageId: "taggedTemplate" - }); - } - }, - - CallExpression(node) { - if (node.arguments.length === 0 || node.optional) { - return; - } - checkForBreakAfter(node.callee, "function"); - }, - - "BinaryExpression[operator='/'] > BinaryExpression[operator='/'].left"(node) { - const secondSlash = sourceCode.getTokenAfter(node, token => token.value === "/"); - const tokenAfterOperator = sourceCode.getTokenAfter(secondSlash); - - if ( - tokenAfterOperator.type === "Identifier" && - REGEX_FLAG_MATCHER.test(tokenAfterOperator.value) && - secondSlash.range[1] === tokenAfterOperator.range[0] - ) { - checkForBreakAfter(node.left, "division"); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js b/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js deleted file mode 100644 index 768a15573..000000000 --- a/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js +++ /dev/null @@ -1,360 +0,0 @@ -/** - * @fileoverview Rule to disallow use of unmodified expressions in loop conditions - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Traverser = require("../shared/traverser"), - astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const SENTINEL_PATTERN = /(?:(?:Call|Class|Function|Member|New|Yield)Expression|Statement|Declaration)$/u; -const LOOP_PATTERN = /^(?:DoWhile|For|While)Statement$/u; // for-in/of statements don't have `test` property. -const GROUP_PATTERN = /^(?:BinaryExpression|ConditionalExpression)$/u; -const SKIP_PATTERN = /^(?:ArrowFunction|Class|Function)Expression$/u; -const DYNAMIC_PATTERN = /^(?:Call|Member|New|TaggedTemplate|Yield)Expression$/u; - -/** - * @typedef {Object} LoopConditionInfo - * @property {eslint-scope.Reference} reference - The reference. - * @property {ASTNode} group - BinaryExpression or ConditionalExpression nodes - * that the reference is belonging to. - * @property {Function} isInLoop - The predicate which checks a given reference - * is in this loop. - * @property {boolean} modified - The flag that the reference is modified in - * this loop. - */ - -/** - * Checks whether or not a given reference is a write reference. - * @param {eslint-scope.Reference} reference A reference to check. - * @returns {boolean} `true` if the reference is a write reference. - */ -function isWriteReference(reference) { - if (reference.init) { - const def = reference.resolved && reference.resolved.defs[0]; - - if (!def || def.type !== "Variable" || def.parent.kind !== "var") { - return false; - } - } - return reference.isWrite(); -} - -/** - * Checks whether or not a given loop condition info does not have the modified - * flag. - * @param {LoopConditionInfo} condition A loop condition info to check. - * @returns {boolean} `true` if the loop condition info is "unmodified". - */ -function isUnmodified(condition) { - return !condition.modified; -} - -/** - * Checks whether or not a given loop condition info does not have the modified - * flag and does not have the group this condition belongs to. - * @param {LoopConditionInfo} condition A loop condition info to check. - * @returns {boolean} `true` if the loop condition info is "unmodified". - */ -function isUnmodifiedAndNotBelongToGroup(condition) { - return !(condition.modified || condition.group); -} - -/** - * Checks whether or not a given reference is inside of a given node. - * @param {ASTNode} node A node to check. - * @param {eslint-scope.Reference} reference A reference to check. - * @returns {boolean} `true` if the reference is inside of the node. - */ -function isInRange(node, reference) { - const or = node.range; - const ir = reference.identifier.range; - - return or[0] <= ir[0] && ir[1] <= or[1]; -} - -/** - * Checks whether or not a given reference is inside of a loop node's condition. - * @param {ASTNode} node A node to check. - * @param {eslint-scope.Reference} reference A reference to check. - * @returns {boolean} `true` if the reference is inside of the loop node's - * condition. - */ -const isInLoop = { - WhileStatement: isInRange, - DoWhileStatement: isInRange, - ForStatement(node, reference) { - return ( - isInRange(node, reference) && - !(node.init && isInRange(node.init, reference)) - ); - } -}; - -/** - * Gets the function which encloses a given reference. - * This supports only FunctionDeclaration. - * @param {eslint-scope.Reference} reference A reference to get. - * @returns {ASTNode|null} The function node or null. - */ -function getEncloseFunctionDeclaration(reference) { - let node = reference.identifier; - - while (node) { - if (node.type === "FunctionDeclaration") { - return node.id ? node : null; - } - - node = node.parent; - } - - return null; -} - -/** - * Updates the "modified" flags of given loop conditions with given modifiers. - * @param {LoopConditionInfo[]} conditions The loop conditions to be updated. - * @param {eslint-scope.Reference[]} modifiers The references to update. - * @returns {void} - */ -function updateModifiedFlag(conditions, modifiers) { - - for (let i = 0; i < conditions.length; ++i) { - const condition = conditions[i]; - - for (let j = 0; !condition.modified && j < modifiers.length; ++j) { - const modifier = modifiers[j]; - let funcNode, funcVar; - - /* - * Besides checking for the condition being in the loop, we want to - * check the function that this modifier is belonging to is called - * in the loop. - * FIXME: This should probably be extracted to a function. - */ - const inLoop = condition.isInLoop(modifier) || Boolean( - (funcNode = getEncloseFunctionDeclaration(modifier)) && - (funcVar = astUtils.getVariableByName(modifier.from.upper, funcNode.id.name)) && - funcVar.references.some(condition.isInLoop) - ); - - condition.modified = inLoop; - } - } -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow unmodified loop conditions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-unmodified-loop-condition" - }, - - schema: [], - - messages: { - loopConditionNotModified: "'{{name}}' is not modified in this loop." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - let groupMap = null; - - /** - * Reports a given condition info. - * @param {LoopConditionInfo} condition A loop condition info to report. - * @returns {void} - */ - function report(condition) { - const node = condition.reference.identifier; - - context.report({ - node, - messageId: "loopConditionNotModified", - data: node - }); - } - - /** - * Registers given conditions to the group the condition belongs to. - * @param {LoopConditionInfo[]} conditions A loop condition info to - * register. - * @returns {void} - */ - function registerConditionsToGroup(conditions) { - for (let i = 0; i < conditions.length; ++i) { - const condition = conditions[i]; - - if (condition.group) { - let group = groupMap.get(condition.group); - - if (!group) { - group = []; - groupMap.set(condition.group, group); - } - group.push(condition); - } - } - } - - /** - * Reports references which are inside of unmodified groups. - * @param {LoopConditionInfo[]} conditions A loop condition info to report. - * @returns {void} - */ - function checkConditionsInGroup(conditions) { - if (conditions.every(isUnmodified)) { - conditions.forEach(report); - } - } - - /** - * Checks whether or not a given group node has any dynamic elements. - * @param {ASTNode} root A node to check. - * This node is one of BinaryExpression or ConditionalExpression. - * @returns {boolean} `true` if the node is dynamic. - */ - function hasDynamicExpressions(root) { - let retv = false; - - Traverser.traverse(root, { - visitorKeys: sourceCode.visitorKeys, - enter(node) { - if (DYNAMIC_PATTERN.test(node.type)) { - retv = true; - this.break(); - } else if (SKIP_PATTERN.test(node.type)) { - this.skip(); - } - } - }); - - return retv; - } - - /** - * Creates the loop condition information from a given reference. - * @param {eslint-scope.Reference} reference A reference to create. - * @returns {LoopConditionInfo|null} Created loop condition info, or null. - */ - function toLoopCondition(reference) { - if (reference.init) { - return null; - } - - let group = null; - let child = reference.identifier; - let node = child.parent; - - while (node) { - if (SENTINEL_PATTERN.test(node.type)) { - if (LOOP_PATTERN.test(node.type) && node.test === child) { - - // This reference is inside of a loop condition. - return { - reference, - group, - isInLoop: isInLoop[node.type].bind(null, node), - modified: false - }; - } - - // This reference is outside of a loop condition. - break; - } - - /* - * If it's inside of a group, OK if either operand is modified. - * So stores the group this reference belongs to. - */ - if (GROUP_PATTERN.test(node.type)) { - - // If this expression is dynamic, no need to check. - if (hasDynamicExpressions(node)) { - break; - } else { - group = node; - } - } - - child = node; - node = node.parent; - } - - return null; - } - - /** - * Finds unmodified references which are inside of a loop condition. - * Then reports the references which are outside of groups. - * @param {eslint-scope.Variable} variable A variable to report. - * @returns {void} - */ - function checkReferences(variable) { - - // Gets references that exist in loop conditions. - const conditions = variable - .references - .map(toLoopCondition) - .filter(Boolean); - - if (conditions.length === 0) { - return; - } - - // Registers the conditions to belonging groups. - registerConditionsToGroup(conditions); - - // Check the conditions are modified. - const modifiers = variable.references.filter(isWriteReference); - - if (modifiers.length > 0) { - updateModifiedFlag(conditions, modifiers); - } - - /* - * Reports the conditions which are not belonging to groups. - * Others will be reported after all variables are done. - */ - conditions - .filter(isUnmodifiedAndNotBelongToGroup) - .forEach(report); - } - - return { - "Program:exit"(node) { - const queue = [sourceCode.getScope(node)]; - - groupMap = new Map(); - - let scope; - - while ((scope = queue.pop())) { - queue.push(...scope.childScopes); - scope.variables.forEach(checkReferences); - } - - groupMap.forEach(checkConditionsInGroup); - groupMap = null; - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unneeded-ternary.js b/node_modules/eslint/lib/rules/no-unneeded-ternary.js deleted file mode 100644 index ab1bdc59c..000000000 --- a/node_modules/eslint/lib/rules/no-unneeded-ternary.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * @fileoverview Rule to flag no-unneeded-ternary - * @author Gyandeep Singh - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -// Operators that always result in a boolean value -const BOOLEAN_OPERATORS = new Set(["==", "===", "!=", "!==", ">", ">=", "<", "<=", "in", "instanceof"]); -const OPERATOR_INVERSES = { - "==": "!=", - "!=": "==", - "===": "!==", - "!==": "===" - - // Operators like < and >= are not true inverses, since both will return false with NaN. -}; -const OR_PRECEDENCE = astUtils.getPrecedence({ type: "LogicalExpression", operator: "||" }); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow ternary operators when simpler alternatives exist", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-unneeded-ternary" - }, - - schema: [ - { - type: "object", - properties: { - defaultAssignment: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - fixable: "code", - - messages: { - unnecessaryConditionalExpression: "Unnecessary use of boolean literals in conditional expression.", - unnecessaryConditionalAssignment: "Unnecessary use of conditional expression for default assignment." - } - }, - - create(context) { - const options = context.options[0] || {}; - const defaultAssignment = options.defaultAssignment !== false; - const sourceCode = context.sourceCode; - - /** - * Test if the node is a boolean literal - * @param {ASTNode} node The node to report. - * @returns {boolean} True if the its a boolean literal - * @private - */ - function isBooleanLiteral(node) { - return node.type === "Literal" && typeof node.value === "boolean"; - } - - /** - * Creates an expression that represents the boolean inverse of the expression represented by the original node - * @param {ASTNode} node A node representing an expression - * @returns {string} A string representing an inverted expression - */ - function invertExpression(node) { - if (node.type === "BinaryExpression" && Object.prototype.hasOwnProperty.call(OPERATOR_INVERSES, node.operator)) { - const operatorToken = sourceCode.getFirstTokenBetween( - node.left, - node.right, - token => token.value === node.operator - ); - const text = sourceCode.getText(); - - return text.slice(node.range[0], - operatorToken.range[0]) + OPERATOR_INVERSES[node.operator] + text.slice(operatorToken.range[1], node.range[1]); - } - - if (astUtils.getPrecedence(node) < astUtils.getPrecedence({ type: "UnaryExpression" })) { - return `!(${astUtils.getParenthesisedText(sourceCode, node)})`; - } - return `!${astUtils.getParenthesisedText(sourceCode, node)}`; - } - - /** - * Tests if a given node always evaluates to a boolean value - * @param {ASTNode} node An expression node - * @returns {boolean} True if it is determined that the node will always evaluate to a boolean value - */ - function isBooleanExpression(node) { - return node.type === "BinaryExpression" && BOOLEAN_OPERATORS.has(node.operator) || - node.type === "UnaryExpression" && node.operator === "!"; - } - - /** - * Test if the node matches the pattern id ? id : expression - * @param {ASTNode} node The ConditionalExpression to check. - * @returns {boolean} True if the pattern is matched, and false otherwise - * @private - */ - function matchesDefaultAssignment(node) { - return node.test.type === "Identifier" && - node.consequent.type === "Identifier" && - node.test.name === node.consequent.name; - } - - return { - - ConditionalExpression(node) { - if (isBooleanLiteral(node.alternate) && isBooleanLiteral(node.consequent)) { - context.report({ - node, - messageId: "unnecessaryConditionalExpression", - fix(fixer) { - if (node.consequent.value === node.alternate.value) { - - // Replace `foo ? true : true` with just `true`, but don't replace `foo() ? true : true` - return node.test.type === "Identifier" ? fixer.replaceText(node, node.consequent.value.toString()) : null; - } - if (node.alternate.value) { - - // Replace `foo() ? false : true` with `!(foo())` - return fixer.replaceText(node, invertExpression(node.test)); - } - - // Replace `foo ? true : false` with `foo` if `foo` is guaranteed to be a boolean, or `!!foo` otherwise. - - return fixer.replaceText(node, isBooleanExpression(node.test) ? astUtils.getParenthesisedText(sourceCode, node.test) : `!${invertExpression(node.test)}`); - } - }); - } else if (!defaultAssignment && matchesDefaultAssignment(node)) { - context.report({ - node, - messageId: "unnecessaryConditionalAssignment", - fix(fixer) { - const shouldParenthesizeAlternate = - ( - astUtils.getPrecedence(node.alternate) < OR_PRECEDENCE || - astUtils.isCoalesceExpression(node.alternate) - ) && - !astUtils.isParenthesised(sourceCode, node.alternate); - const alternateText = shouldParenthesizeAlternate - ? `(${sourceCode.getText(node.alternate)})` - : astUtils.getParenthesisedText(sourceCode, node.alternate); - const testText = astUtils.getParenthesisedText(sourceCode, node.test); - - return fixer.replaceText(node, `${testText} || ${alternateText}`); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unreachable-loop.js b/node_modules/eslint/lib/rules/no-unreachable-loop.js deleted file mode 100644 index 1df764e17..000000000 --- a/node_modules/eslint/lib/rules/no-unreachable-loop.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * @fileoverview Rule to disallow loops with a body that allows only one iteration - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const allLoopTypes = ["WhileStatement", "DoWhileStatement", "ForStatement", "ForInStatement", "ForOfStatement"]; - -/** - * Determines whether the given node is the first node in the code path to which a loop statement - * 'loops' for the next iteration. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is a looping target. - */ -function isLoopingTarget(node) { - const parent = node.parent; - - if (parent) { - switch (parent.type) { - case "WhileStatement": - return node === parent.test; - case "DoWhileStatement": - return node === parent.body; - case "ForStatement": - return node === (parent.update || parent.test || parent.body); - case "ForInStatement": - case "ForOfStatement": - return node === parent.left; - - // no default - } - } - - return false; -} - -/** - * Creates an array with elements from the first given array that are not included in the second given array. - * @param {Array} arrA The array to compare from. - * @param {Array} arrB The array to compare against. - * @returns {Array} a new array that represents `arrA \ arrB`. - */ -function getDifference(arrA, arrB) { - return arrA.filter(a => !arrB.includes(a)); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow loops with a body that allows only one iteration", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-unreachable-loop" - }, - - schema: [{ - type: "object", - properties: { - ignore: { - type: "array", - items: { - enum: allLoopTypes - }, - uniqueItems: true - } - }, - additionalProperties: false - }], - - messages: { - invalid: "Invalid loop. Its body allows only one iteration." - } - }, - - create(context) { - const ignoredLoopTypes = context.options[0] && context.options[0].ignore || [], - loopTypesToCheck = getDifference(allLoopTypes, ignoredLoopTypes), - loopSelector = loopTypesToCheck.join(","), - loopsByTargetSegments = new Map(), - loopsToReport = new Set(); - - let currentCodePath = null; - - return { - onCodePathStart(codePath) { - currentCodePath = codePath; - }, - - onCodePathEnd() { - currentCodePath = currentCodePath.upper; - }, - - [loopSelector](node) { - - /** - * Ignore unreachable loop statements to avoid unnecessary complexity in the implementation, or false positives otherwise. - * For unreachable segments, the code path analysis does not raise events required for this implementation. - */ - if (currentCodePath.currentSegments.some(segment => segment.reachable)) { - loopsToReport.add(node); - } - }, - - onCodePathSegmentStart(segment, node) { - if (isLoopingTarget(node)) { - const loop = node.parent; - - loopsByTargetSegments.set(segment, loop); - } - }, - - onCodePathSegmentLoop(_, toSegment, node) { - const loop = loopsByTargetSegments.get(toSegment); - - /** - * The second iteration is reachable, meaning that the loop is valid by the logic of this rule, - * only if there is at least one loop event with the appropriate target (which has been already - * determined in the `loopsByTargetSegments` map), raised from either: - * - * - the end of the loop's body (in which case `node === loop`) - * - a `continue` statement - * - * This condition skips loop events raised from `ForInStatement > .right` and `ForOfStatement > .right` nodes. - */ - if (node === loop || node.type === "ContinueStatement") { - - // Removes loop if it exists in the set. Otherwise, `Set#delete` has no effect and doesn't throw. - loopsToReport.delete(loop); - } - }, - - "Program:exit"() { - loopsToReport.forEach( - node => context.report({ node, messageId: "invalid" }) - ); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unreachable.js b/node_modules/eslint/lib/rules/no-unreachable.js deleted file mode 100644 index 6216a73a2..000000000 --- a/node_modules/eslint/lib/rules/no-unreachable.js +++ /dev/null @@ -1,264 +0,0 @@ -/** - * @fileoverview Checks for unreachable code due to return, throws, break, and continue. - * @author Joel Feenstra - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * @typedef {Object} ConstructorInfo - * @property {ConstructorInfo | null} upper Info about the constructor that encloses this constructor. - * @property {boolean} hasSuperCall The flag about having `super()` expressions. - */ - -/** - * Checks whether or not a given variable declarator has the initializer. - * @param {ASTNode} node A VariableDeclarator node to check. - * @returns {boolean} `true` if the node has the initializer. - */ -function isInitialized(node) { - return Boolean(node.init); -} - -/** - * Checks whether or not a given code path segment is unreachable. - * @param {CodePathSegment} segment A CodePathSegment to check. - * @returns {boolean} `true` if the segment is unreachable. - */ -function isUnreachable(segment) { - return !segment.reachable; -} - -/** - * The class to distinguish consecutive unreachable statements. - */ -class ConsecutiveRange { - constructor(sourceCode) { - this.sourceCode = sourceCode; - this.startNode = null; - this.endNode = null; - } - - /** - * The location object of this range. - * @type {Object} - */ - get location() { - return { - start: this.startNode.loc.start, - end: this.endNode.loc.end - }; - } - - /** - * `true` if this range is empty. - * @type {boolean} - */ - get isEmpty() { - return !(this.startNode && this.endNode); - } - - /** - * Checks whether the given node is inside of this range. - * @param {ASTNode|Token} node The node to check. - * @returns {boolean} `true` if the node is inside of this range. - */ - contains(node) { - return ( - node.range[0] >= this.startNode.range[0] && - node.range[1] <= this.endNode.range[1] - ); - } - - /** - * Checks whether the given node is consecutive to this range. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is consecutive to this range. - */ - isConsecutive(node) { - return this.contains(this.sourceCode.getTokenBefore(node)); - } - - /** - * Merges the given node to this range. - * @param {ASTNode} node The node to merge. - * @returns {void} - */ - merge(node) { - this.endNode = node; - } - - /** - * Resets this range by the given node or null. - * @param {ASTNode|null} node The node to reset, or null. - * @returns {void} - */ - reset(node) { - this.startNode = this.endNode = node; - } -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow unreachable code after `return`, `throw`, `continue`, and `break` statements", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unreachable" - }, - - schema: [], - - messages: { - unreachableCode: "Unreachable code." - } - }, - - create(context) { - let currentCodePath = null; - - /** @type {ConstructorInfo | null} */ - let constructorInfo = null; - - /** @type {ConsecutiveRange} */ - const range = new ConsecutiveRange(context.sourceCode); - - /** - * Reports a given node if it's unreachable. - * @param {ASTNode} node A statement node to report. - * @returns {void} - */ - function reportIfUnreachable(node) { - let nextNode = null; - - if (node && (node.type === "PropertyDefinition" || currentCodePath.currentSegments.every(isUnreachable))) { - - // Store this statement to distinguish consecutive statements. - if (range.isEmpty) { - range.reset(node); - return; - } - - // Skip if this statement is inside of the current range. - if (range.contains(node)) { - return; - } - - // Merge if this statement is consecutive to the current range. - if (range.isConsecutive(node)) { - range.merge(node); - return; - } - - nextNode = node; - } - - /* - * Report the current range since this statement is reachable or is - * not consecutive to the current range. - */ - if (!range.isEmpty) { - context.report({ - messageId: "unreachableCode", - loc: range.location, - node: range.startNode - }); - } - - // Update the current range. - range.reset(nextNode); - } - - return { - - // Manages the current code path. - onCodePathStart(codePath) { - currentCodePath = codePath; - }, - - onCodePathEnd() { - currentCodePath = currentCodePath.upper; - }, - - // Registers for all statement nodes (excludes FunctionDeclaration). - BlockStatement: reportIfUnreachable, - BreakStatement: reportIfUnreachable, - ClassDeclaration: reportIfUnreachable, - ContinueStatement: reportIfUnreachable, - DebuggerStatement: reportIfUnreachable, - DoWhileStatement: reportIfUnreachable, - ExpressionStatement: reportIfUnreachable, - ForInStatement: reportIfUnreachable, - ForOfStatement: reportIfUnreachable, - ForStatement: reportIfUnreachable, - IfStatement: reportIfUnreachable, - ImportDeclaration: reportIfUnreachable, - LabeledStatement: reportIfUnreachable, - ReturnStatement: reportIfUnreachable, - SwitchStatement: reportIfUnreachable, - ThrowStatement: reportIfUnreachable, - TryStatement: reportIfUnreachable, - - VariableDeclaration(node) { - if (node.kind !== "var" || node.declarations.some(isInitialized)) { - reportIfUnreachable(node); - } - }, - - WhileStatement: reportIfUnreachable, - WithStatement: reportIfUnreachable, - ExportNamedDeclaration: reportIfUnreachable, - ExportDefaultDeclaration: reportIfUnreachable, - ExportAllDeclaration: reportIfUnreachable, - - "Program:exit"() { - reportIfUnreachable(); - }, - - /* - * Instance fields defined in a subclass are never created if the constructor of the subclass - * doesn't call `super()`, so their definitions are unreachable code. - */ - "MethodDefinition[kind='constructor']"() { - constructorInfo = { - upper: constructorInfo, - hasSuperCall: false - }; - }, - "MethodDefinition[kind='constructor']:exit"(node) { - const { hasSuperCall } = constructorInfo; - - constructorInfo = constructorInfo.upper; - - // skip typescript constructors without the body - if (!node.value.body) { - return; - } - - const classDefinition = node.parent.parent; - - if (classDefinition.superClass && !hasSuperCall) { - for (const element of classDefinition.body.body) { - if (element.type === "PropertyDefinition" && !element.static) { - reportIfUnreachable(element); - } - } - } - }, - "CallExpression > Super.callee"() { - if (constructorInfo) { - constructorInfo.hasSuperCall = true; - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unsafe-finally.js b/node_modules/eslint/lib/rules/no-unsafe-finally.js deleted file mode 100644 index ebd24328f..000000000 --- a/node_modules/eslint/lib/rules/no-unsafe-finally.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @fileoverview Rule to flag unsafe statements in finally block - * @author Onur Temizkan - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const SENTINEL_NODE_TYPE_RETURN_THROW = /^(?:Program|(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression)$/u; -const SENTINEL_NODE_TYPE_BREAK = /^(?:Program|(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|DoWhileStatement|WhileStatement|ForOfStatement|ForInStatement|ForStatement|SwitchStatement)$/u; -const SENTINEL_NODE_TYPE_CONTINUE = /^(?:Program|(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|DoWhileStatement|WhileStatement|ForOfStatement|ForInStatement|ForStatement)$/u; - - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow control flow statements in `finally` blocks", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unsafe-finally" - }, - - schema: [], - - messages: { - unsafeUsage: "Unsafe usage of {{nodeType}}." - } - }, - create(context) { - - /** - * Checks if the node is the finalizer of a TryStatement - * @param {ASTNode} node node to check. - * @returns {boolean} - true if the node is the finalizer of a TryStatement - */ - function isFinallyBlock(node) { - return node.parent.type === "TryStatement" && node.parent.finalizer === node; - } - - /** - * Climbs up the tree if the node is not a sentinel node - * @param {ASTNode} node node to check. - * @param {string} label label of the break or continue statement - * @returns {boolean} - return whether the node is a finally block or a sentinel node - */ - function isInFinallyBlock(node, label) { - let labelInside = false; - let sentinelNodeType; - - if (node.type === "BreakStatement" && !node.label) { - sentinelNodeType = SENTINEL_NODE_TYPE_BREAK; - } else if (node.type === "ContinueStatement") { - sentinelNodeType = SENTINEL_NODE_TYPE_CONTINUE; - } else { - sentinelNodeType = SENTINEL_NODE_TYPE_RETURN_THROW; - } - - for ( - let currentNode = node; - currentNode && !sentinelNodeType.test(currentNode.type); - currentNode = currentNode.parent - ) { - if (currentNode.parent.label && label && (currentNode.parent.label.name === label.name)) { - labelInside = true; - } - if (isFinallyBlock(currentNode)) { - if (label && labelInside) { - return false; - } - return true; - } - } - return false; - } - - /** - * Checks whether the possibly-unsafe statement is inside a finally block. - * @param {ASTNode} node node to check. - * @returns {void} - */ - function check(node) { - if (isInFinallyBlock(node, node.label)) { - context.report({ - messageId: "unsafeUsage", - data: { - nodeType: node.type - }, - node, - line: node.loc.line, - column: node.loc.column - }); - } - } - - return { - ReturnStatement: check, - ThrowStatement: check, - BreakStatement: check, - ContinueStatement: check - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unsafe-negation.js b/node_modules/eslint/lib/rules/no-unsafe-negation.js deleted file mode 100644 index cabd7e2cc..000000000 --- a/node_modules/eslint/lib/rules/no-unsafe-negation.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * @fileoverview Rule to disallow negating the left operand of relational operators - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether the given operator is `in` or `instanceof` - * @param {string} op The operator type to check. - * @returns {boolean} `true` if the operator is `in` or `instanceof` - */ -function isInOrInstanceOfOperator(op) { - return op === "in" || op === "instanceof"; -} - -/** - * Checks whether the given operator is an ordering relational operator or not. - * @param {string} op The operator type to check. - * @returns {boolean} `true` if the operator is an ordering relational operator. - */ -function isOrderingRelationalOperator(op) { - return op === "<" || op === ">" || op === ">=" || op === "<="; -} - -/** - * Checks whether the given node is a logical negation expression or not. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is a logical negation expression. - */ -function isNegation(node) { - return node.type === "UnaryExpression" && node.operator === "!"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow negating the left operand of relational operators", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unsafe-negation" - }, - - hasSuggestions: true, - - schema: [ - { - type: "object", - properties: { - enforceForOrderingRelations: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - fixable: null, - - messages: { - unexpected: "Unexpected negating the left operand of '{{operator}}' operator.", - suggestNegatedExpression: "Negate '{{operator}}' expression instead of its left operand. This changes the current behavior.", - suggestParenthesisedNegation: "Wrap negation in '()' to make the intention explicit. This preserves the current behavior." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const options = context.options[0] || {}; - const enforceForOrderingRelations = options.enforceForOrderingRelations === true; - - return { - BinaryExpression(node) { - const operator = node.operator; - const orderingRelationRuleApplies = enforceForOrderingRelations && isOrderingRelationalOperator(operator); - - if ( - (isInOrInstanceOfOperator(operator) || orderingRelationRuleApplies) && - isNegation(node.left) && - !astUtils.isParenthesised(sourceCode, node.left) - ) { - context.report({ - node, - loc: node.left.loc, - messageId: "unexpected", - data: { operator }, - suggest: [ - { - messageId: "suggestNegatedExpression", - data: { operator }, - fix(fixer) { - const negationToken = sourceCode.getFirstToken(node.left); - const fixRange = [negationToken.range[1], node.range[1]]; - const text = sourceCode.text.slice(fixRange[0], fixRange[1]); - - return fixer.replaceTextRange(fixRange, `(${text})`); - } - }, - { - messageId: "suggestParenthesisedNegation", - fix(fixer) { - return fixer.replaceText(node.left, `(${sourceCode.getText(node.left)})`); - } - } - ] - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js b/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js deleted file mode 100644 index fe2bead85..000000000 --- a/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js +++ /dev/null @@ -1,205 +0,0 @@ -/** - * @fileoverview Rule to disallow unsafe optional chaining - * @author Yeon JuAn - */ - -"use strict"; - -const UNSAFE_ARITHMETIC_OPERATORS = new Set(["+", "-", "/", "*", "%", "**"]); -const UNSAFE_ASSIGNMENT_OPERATORS = new Set(["+=", "-=", "/=", "*=", "%=", "**="]); -const UNSAFE_RELATIONAL_OPERATORS = new Set(["in", "instanceof"]); - -/** - * Checks whether a node is a destructuring pattern or not - * @param {ASTNode} node node to check - * @returns {boolean} `true` if a node is a destructuring pattern, otherwise `false` - */ -function isDestructuringPattern(node) { - return node.type === "ObjectPattern" || node.type === "ArrayPattern"; -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow use of optional chaining in contexts where the `undefined` value is not allowed", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining" - }, - schema: [{ - type: "object", - properties: { - disallowArithmeticOperators: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - fixable: null, - messages: { - unsafeOptionalChain: "Unsafe usage of optional chaining. If it short-circuits with 'undefined' the evaluation will throw TypeError.", - unsafeArithmetic: "Unsafe arithmetic operation on optional chaining. It can result in NaN." - } - }, - - create(context) { - const options = context.options[0] || {}; - const disallowArithmeticOperators = (options.disallowArithmeticOperators) || false; - - /** - * Reports unsafe usage of optional chaining - * @param {ASTNode} node node to report - * @returns {void} - */ - function reportUnsafeUsage(node) { - context.report({ - messageId: "unsafeOptionalChain", - node - }); - } - - /** - * Reports unsafe arithmetic operation on optional chaining - * @param {ASTNode} node node to report - * @returns {void} - */ - function reportUnsafeArithmetic(node) { - context.report({ - messageId: "unsafeArithmetic", - node - }); - } - - /** - * Checks and reports if a node can short-circuit with `undefined` by optional chaining. - * @param {ASTNode} [node] node to check - * @param {Function} reportFunc report function - * @returns {void} - */ - function checkUndefinedShortCircuit(node, reportFunc) { - if (!node) { - return; - } - switch (node.type) { - case "LogicalExpression": - if (node.operator === "||" || node.operator === "??") { - checkUndefinedShortCircuit(node.right, reportFunc); - } else if (node.operator === "&&") { - checkUndefinedShortCircuit(node.left, reportFunc); - checkUndefinedShortCircuit(node.right, reportFunc); - } - break; - case "SequenceExpression": - checkUndefinedShortCircuit( - node.expressions[node.expressions.length - 1], - reportFunc - ); - break; - case "ConditionalExpression": - checkUndefinedShortCircuit(node.consequent, reportFunc); - checkUndefinedShortCircuit(node.alternate, reportFunc); - break; - case "AwaitExpression": - checkUndefinedShortCircuit(node.argument, reportFunc); - break; - case "ChainExpression": - reportFunc(node); - break; - default: - break; - } - } - - /** - * Checks unsafe usage of optional chaining - * @param {ASTNode} node node to check - * @returns {void} - */ - function checkUnsafeUsage(node) { - checkUndefinedShortCircuit(node, reportUnsafeUsage); - } - - /** - * Checks unsafe arithmetic operations on optional chaining - * @param {ASTNode} node node to check - * @returns {void} - */ - function checkUnsafeArithmetic(node) { - checkUndefinedShortCircuit(node, reportUnsafeArithmetic); - } - - return { - "AssignmentExpression, AssignmentPattern"(node) { - if (isDestructuringPattern(node.left)) { - checkUnsafeUsage(node.right); - } - }, - "ClassDeclaration, ClassExpression"(node) { - checkUnsafeUsage(node.superClass); - }, - CallExpression(node) { - if (!node.optional) { - checkUnsafeUsage(node.callee); - } - }, - NewExpression(node) { - checkUnsafeUsage(node.callee); - }, - VariableDeclarator(node) { - if (isDestructuringPattern(node.id)) { - checkUnsafeUsage(node.init); - } - }, - MemberExpression(node) { - if (!node.optional) { - checkUnsafeUsage(node.object); - } - }, - TaggedTemplateExpression(node) { - checkUnsafeUsage(node.tag); - }, - ForOfStatement(node) { - checkUnsafeUsage(node.right); - }, - SpreadElement(node) { - if (node.parent && node.parent.type !== "ObjectExpression") { - checkUnsafeUsage(node.argument); - } - }, - BinaryExpression(node) { - if (UNSAFE_RELATIONAL_OPERATORS.has(node.operator)) { - checkUnsafeUsage(node.right); - } - if ( - disallowArithmeticOperators && - UNSAFE_ARITHMETIC_OPERATORS.has(node.operator) - ) { - checkUnsafeArithmetic(node.right); - checkUnsafeArithmetic(node.left); - } - }, - WithStatement(node) { - checkUnsafeUsage(node.object); - }, - UnaryExpression(node) { - if ( - disallowArithmeticOperators && - UNSAFE_ARITHMETIC_OPERATORS.has(node.operator) - ) { - checkUnsafeArithmetic(node.argument); - } - }, - AssignmentExpression(node) { - if ( - disallowArithmeticOperators && - UNSAFE_ASSIGNMENT_OPERATORS.has(node.operator) - ) { - checkUnsafeArithmetic(node.right); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unused-expressions.js b/node_modules/eslint/lib/rules/no-unused-expressions.js deleted file mode 100644 index 8337c1948..000000000 --- a/node_modules/eslint/lib/rules/no-unused-expressions.js +++ /dev/null @@ -1,188 +0,0 @@ -/** - * @fileoverview Flag expressions in statement position that do not side effect - * @author Michael Ficarra - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** - * Returns `true`. - * @returns {boolean} `true`. - */ -function alwaysTrue() { - return true; -} - -/** - * Returns `false`. - * @returns {boolean} `false`. - */ -function alwaysFalse() { - return false; -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unused expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-unused-expressions" - }, - - schema: [ - { - type: "object", - properties: { - allowShortCircuit: { - type: "boolean", - default: false - }, - allowTernary: { - type: "boolean", - default: false - }, - allowTaggedTemplates: { - type: "boolean", - default: false - }, - enforceForJSX: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - unusedExpression: "Expected an assignment or function call and instead saw an expression." - } - }, - - create(context) { - const config = context.options[0] || {}, - allowShortCircuit = config.allowShortCircuit || false, - allowTernary = config.allowTernary || false, - allowTaggedTemplates = config.allowTaggedTemplates || false, - enforceForJSX = config.enforceForJSX || false; - - /** - * Has AST suggesting a directive. - * @param {ASTNode} node any node - * @returns {boolean} whether the given node structurally represents a directive - */ - function looksLikeDirective(node) { - return node.type === "ExpressionStatement" && - node.expression.type === "Literal" && typeof node.expression.value === "string"; - } - - /** - * Gets the leading sequence of members in a list that pass the predicate. - * @param {Function} predicate ([a] -> Boolean) the function used to make the determination - * @param {a[]} list the input list - * @returns {a[]} the leading sequence of members in the given list that pass the given predicate - */ - function takeWhile(predicate, list) { - for (let i = 0; i < list.length; ++i) { - if (!predicate(list[i])) { - return list.slice(0, i); - } - } - return list.slice(); - } - - /** - * Gets leading directives nodes in a Node body. - * @param {ASTNode} node a Program or BlockStatement node - * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body - */ - function directives(node) { - return takeWhile(looksLikeDirective, node.body); - } - - /** - * Detect if a Node is a directive. - * @param {ASTNode} node any node - * @returns {boolean} whether the given node is considered a directive in its current position - */ - function isDirective(node) { - const parent = node.parent, - grandparent = parent.parent; - - /** - * https://tc39.es/ecma262/#directive-prologue - * - * Only `FunctionBody`, `ScriptBody` and `ModuleBody` can have directive prologue. - * Class static blocks do not have directive prologue. - */ - return (parent.type === "Program" || parent.type === "BlockStatement" && - (/Function/u.test(grandparent.type))) && - directives(parent).includes(node); - } - - /** - * The member functions return `true` if the type has no side-effects. - * Unknown nodes are handled as `false`, then this rule ignores those. - */ - const Checker = Object.assign(Object.create(null), { - isDisallowed(node) { - return (Checker[node.type] || alwaysFalse)(node); - }, - - ArrayExpression: alwaysTrue, - ArrowFunctionExpression: alwaysTrue, - BinaryExpression: alwaysTrue, - ChainExpression(node) { - return Checker.isDisallowed(node.expression); - }, - ClassExpression: alwaysTrue, - ConditionalExpression(node) { - if (allowTernary) { - return Checker.isDisallowed(node.consequent) || Checker.isDisallowed(node.alternate); - } - return true; - }, - FunctionExpression: alwaysTrue, - Identifier: alwaysTrue, - JSXElement() { - return enforceForJSX; - }, - JSXFragment() { - return enforceForJSX; - }, - Literal: alwaysTrue, - LogicalExpression(node) { - if (allowShortCircuit) { - return Checker.isDisallowed(node.right); - } - return true; - }, - MemberExpression: alwaysTrue, - MetaProperty: alwaysTrue, - ObjectExpression: alwaysTrue, - SequenceExpression: alwaysTrue, - TaggedTemplateExpression() { - return !allowTaggedTemplates; - }, - TemplateLiteral: alwaysTrue, - ThisExpression: alwaysTrue, - UnaryExpression(node) { - return node.operator !== "void" && node.operator !== "delete"; - } - }); - - return { - ExpressionStatement(node) { - if (Checker.isDisallowed(node.expression) && !isDirective(node)) { - context.report({ node, messageId: "unusedExpression" }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unused-labels.js b/node_modules/eslint/lib/rules/no-unused-labels.js deleted file mode 100644 index 9aa1067c6..000000000 --- a/node_modules/eslint/lib/rules/no-unused-labels.js +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @fileoverview Rule to disallow unused labels. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unused labels", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unused-labels" - }, - - schema: [], - - fixable: "code", - - messages: { - unused: "'{{name}}:' is defined but never used." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - let scopeInfo = null; - - /** - * Adds a scope info to the stack. - * @param {ASTNode} node A node to add. This is a LabeledStatement. - * @returns {void} - */ - function enterLabeledScope(node) { - scopeInfo = { - label: node.label.name, - used: false, - upper: scopeInfo - }; - } - - /** - * Removes the top of the stack. - * At the same time, this reports the label if it's never used. - * @param {ASTNode} node A node to report. This is a LabeledStatement. - * @returns {void} - */ - function exitLabeledScope(node) { - if (!scopeInfo.used) { - context.report({ - node: node.label, - messageId: "unused", - data: node.label, - fix(fixer) { - - /* - * Only perform a fix if there are no comments between the label and the body. This will be the case - * when there is exactly one token/comment (the ":") between the label and the body. - */ - if (sourceCode.getTokenAfter(node.label, { includeComments: true }) === - sourceCode.getTokenBefore(node.body, { includeComments: true })) { - return fixer.removeRange([node.range[0], node.body.range[0]]); - } - - return null; - } - }); - } - - scopeInfo = scopeInfo.upper; - } - - /** - * Marks the label of a given node as used. - * @param {ASTNode} node A node to mark. This is a BreakStatement or - * ContinueStatement. - * @returns {void} - */ - function markAsUsed(node) { - if (!node.label) { - return; - } - - const label = node.label.name; - let info = scopeInfo; - - while (info) { - if (info.label === label) { - info.used = true; - break; - } - info = info.upper; - } - } - - return { - LabeledStatement: enterLabeledScope, - "LabeledStatement:exit": exitLabeledScope, - BreakStatement: markAsUsed, - ContinueStatement: markAsUsed - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unused-private-class-members.js b/node_modules/eslint/lib/rules/no-unused-private-class-members.js deleted file mode 100644 index 037be7d3e..000000000 --- a/node_modules/eslint/lib/rules/no-unused-private-class-members.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * @fileoverview Rule to flag declared but unused private class members - * @author Tim van der Lippe - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow unused private class members", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-unused-private-class-members" - }, - - schema: [], - - messages: { - unusedPrivateClassMember: "'{{classMemberName}}' is defined but never used." - } - }, - - create(context) { - const trackedClasses = []; - - /** - * Check whether the current node is in a write only assignment. - * @param {ASTNode} privateIdentifierNode Node referring to a private identifier - * @returns {boolean} Whether the node is in a write only assignment - * @private - */ - function isWriteOnlyAssignment(privateIdentifierNode) { - const parentStatement = privateIdentifierNode.parent.parent; - const isAssignmentExpression = parentStatement.type === "AssignmentExpression"; - - if (!isAssignmentExpression && - parentStatement.type !== "ForInStatement" && - parentStatement.type !== "ForOfStatement" && - parentStatement.type !== "AssignmentPattern") { - return false; - } - - // It is a write-only usage, since we still allow usages on the right for reads - if (parentStatement.left !== privateIdentifierNode.parent) { - return false; - } - - // For any other operator (such as '+=') we still consider it a read operation - if (isAssignmentExpression && parentStatement.operator !== "=") { - - /* - * However, if the read operation is "discarded" in an empty statement, then - * we consider it write only. - */ - return parentStatement.parent.type === "ExpressionStatement"; - } - - return true; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - // Collect all declared members up front and assume they are all unused - ClassBody(classBodyNode) { - const privateMembers = new Map(); - - trackedClasses.unshift(privateMembers); - for (const bodyMember of classBodyNode.body) { - if (bodyMember.type === "PropertyDefinition" || bodyMember.type === "MethodDefinition") { - if (bodyMember.key.type === "PrivateIdentifier") { - privateMembers.set(bodyMember.key.name, { - declaredNode: bodyMember, - isAccessor: bodyMember.type === "MethodDefinition" && - (bodyMember.kind === "set" || bodyMember.kind === "get") - }); - } - } - } - }, - - /* - * Process all usages of the private identifier and remove a member from - * `declaredAndUnusedPrivateMembers` if we deem it used. - */ - PrivateIdentifier(privateIdentifierNode) { - const classBody = trackedClasses.find(classProperties => classProperties.has(privateIdentifierNode.name)); - - // Can't happen, as it is a parser to have a missing class body, but let's code defensively here. - if (!classBody) { - return; - } - - // In case any other usage was already detected, we can short circuit the logic here. - const memberDefinition = classBody.get(privateIdentifierNode.name); - - if (memberDefinition.isUsed) { - return; - } - - // The definition of the class member itself - if (privateIdentifierNode.parent.type === "PropertyDefinition" || - privateIdentifierNode.parent.type === "MethodDefinition") { - return; - } - - /* - * Any usage of an accessor is considered a read, as the getter/setter can have - * side-effects in its definition. - */ - if (memberDefinition.isAccessor) { - memberDefinition.isUsed = true; - return; - } - - // Any assignments to this member, except for assignments that also read - if (isWriteOnlyAssignment(privateIdentifierNode)) { - return; - } - - const wrappingExpressionType = privateIdentifierNode.parent.parent.type; - const parentOfWrappingExpressionType = privateIdentifierNode.parent.parent.parent.type; - - // A statement which only increments (`this.#x++;`) - if (wrappingExpressionType === "UpdateExpression" && - parentOfWrappingExpressionType === "ExpressionStatement") { - return; - } - - /* - * ({ x: this.#usedInDestructuring } = bar); - * - * But should treat the following as a read: - * ({ [this.#x]: a } = foo); - */ - if (wrappingExpressionType === "Property" && - parentOfWrappingExpressionType === "ObjectPattern" && - privateIdentifierNode.parent.parent.value === privateIdentifierNode.parent) { - return; - } - - // [...this.#unusedInRestPattern] = bar; - if (wrappingExpressionType === "RestElement") { - return; - } - - // [this.#unusedInAssignmentPattern] = bar; - if (wrappingExpressionType === "ArrayPattern") { - return; - } - - /* - * We can't delete the memberDefinition, as we need to keep track of which member we are marking as used. - * In the case of nested classes, we only mark the first member we encounter as used. If you were to delete - * the member, then any subsequent usage could incorrectly mark the member of an encapsulating parent class - * as used, which is incorrect. - */ - memberDefinition.isUsed = true; - }, - - /* - * Post-process the class members and report any remaining members. - * Since private members can only be accessed in the current class context, - * we can safely assume that all usages are within the current class body. - */ - "ClassBody:exit"() { - const unusedPrivateMembers = trackedClasses.shift(); - - for (const [classMemberName, { declaredNode, isUsed }] of unusedPrivateMembers.entries()) { - if (isUsed) { - continue; - } - context.report({ - node: declaredNode, - loc: declaredNode.key.loc, - messageId: "unusedPrivateClassMember", - data: { - classMemberName: `#${classMemberName}` - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-unused-vars.js b/node_modules/eslint/lib/rules/no-unused-vars.js deleted file mode 100644 index be8af43dd..000000000 --- a/node_modules/eslint/lib/rules/no-unused-vars.js +++ /dev/null @@ -1,717 +0,0 @@ -/** - * @fileoverview Rule to flag declared but unused variables - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** - * Bag of data used for formatting the `unusedVar` lint message. - * @typedef {Object} UnusedVarMessageData - * @property {string} varName The name of the unused var. - * @property {'defined'|'assigned a value'} action Description of the vars state. - * @property {string} additional Any additional info to be appended at the end. - */ - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow unused variables", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unused-vars" - }, - - schema: [ - { - oneOf: [ - { - enum: ["all", "local"] - }, - { - type: "object", - properties: { - vars: { - enum: ["all", "local"] - }, - varsIgnorePattern: { - type: "string" - }, - args: { - enum: ["all", "after-used", "none"] - }, - ignoreRestSiblings: { - type: "boolean" - }, - argsIgnorePattern: { - type: "string" - }, - caughtErrors: { - enum: ["all", "none"] - }, - caughtErrorsIgnorePattern: { - type: "string" - }, - destructuredArrayIgnorePattern: { - type: "string" - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - unusedVar: "'{{varName}}' is {{action}} but never used{{additional}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - const REST_PROPERTY_TYPE = /^(?:RestElement|(?:Experimental)?RestProperty)$/u; - - const config = { - vars: "all", - args: "after-used", - ignoreRestSiblings: false, - caughtErrors: "none" - }; - - const firstOption = context.options[0]; - - if (firstOption) { - if (typeof firstOption === "string") { - config.vars = firstOption; - } else { - config.vars = firstOption.vars || config.vars; - config.args = firstOption.args || config.args; - config.ignoreRestSiblings = firstOption.ignoreRestSiblings || config.ignoreRestSiblings; - config.caughtErrors = firstOption.caughtErrors || config.caughtErrors; - - if (firstOption.varsIgnorePattern) { - config.varsIgnorePattern = new RegExp(firstOption.varsIgnorePattern, "u"); - } - - if (firstOption.argsIgnorePattern) { - config.argsIgnorePattern = new RegExp(firstOption.argsIgnorePattern, "u"); - } - - if (firstOption.caughtErrorsIgnorePattern) { - config.caughtErrorsIgnorePattern = new RegExp(firstOption.caughtErrorsIgnorePattern, "u"); - } - - if (firstOption.destructuredArrayIgnorePattern) { - config.destructuredArrayIgnorePattern = new RegExp(firstOption.destructuredArrayIgnorePattern, "u"); - } - } - } - - /** - * Generates the message data about the variable being defined and unused, - * including the ignore pattern if configured. - * @param {Variable} unusedVar eslint-scope variable object. - * @returns {UnusedVarMessageData} The message data to be used with this unused variable. - */ - function getDefinedMessageData(unusedVar) { - const defType = unusedVar.defs && unusedVar.defs[0] && unusedVar.defs[0].type; - let type; - let pattern; - - if (defType === "CatchClause" && config.caughtErrorsIgnorePattern) { - type = "args"; - pattern = config.caughtErrorsIgnorePattern.toString(); - } else if (defType === "Parameter" && config.argsIgnorePattern) { - type = "args"; - pattern = config.argsIgnorePattern.toString(); - } else if (defType !== "Parameter" && config.varsIgnorePattern) { - type = "vars"; - pattern = config.varsIgnorePattern.toString(); - } - - const additional = type ? `. Allowed unused ${type} must match ${pattern}` : ""; - - return { - varName: unusedVar.name, - action: "defined", - additional - }; - } - - /** - * Generate the warning message about the variable being - * assigned and unused, including the ignore pattern if configured. - * @param {Variable} unusedVar eslint-scope variable object. - * @returns {UnusedVarMessageData} The message data to be used with this unused variable. - */ - function getAssignedMessageData(unusedVar) { - const def = unusedVar.defs[0]; - let additional = ""; - - if (config.destructuredArrayIgnorePattern && def && def.name.parent.type === "ArrayPattern") { - additional = `. Allowed unused elements of array destructuring patterns must match ${config.destructuredArrayIgnorePattern.toString()}`; - } else if (config.varsIgnorePattern) { - additional = `. Allowed unused vars must match ${config.varsIgnorePattern.toString()}`; - } - - return { - varName: unusedVar.name, - action: "assigned a value", - additional - }; - } - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - const STATEMENT_TYPE = /(?:Statement|Declaration)$/u; - - /** - * Determines if a given variable is being exported from a module. - * @param {Variable} variable eslint-scope variable object. - * @returns {boolean} True if the variable is exported, false if not. - * @private - */ - function isExported(variable) { - - const definition = variable.defs[0]; - - if (definition) { - - let node = definition.node; - - if (node.type === "VariableDeclarator") { - node = node.parent; - } else if (definition.type === "Parameter") { - return false; - } - - return node.parent.type.indexOf("Export") === 0; - } - return false; - - } - - /** - * Checks whether a node is a sibling of the rest property or not. - * @param {ASTNode} node a node to check - * @returns {boolean} True if the node is a sibling of the rest property, otherwise false. - */ - function hasRestSibling(node) { - return node.type === "Property" && - node.parent.type === "ObjectPattern" && - REST_PROPERTY_TYPE.test(node.parent.properties[node.parent.properties.length - 1].type); - } - - /** - * Determines if a variable has a sibling rest property - * @param {Variable} variable eslint-scope variable object. - * @returns {boolean} True if the variable is exported, false if not. - * @private - */ - function hasRestSpreadSibling(variable) { - if (config.ignoreRestSiblings) { - const hasRestSiblingDefinition = variable.defs.some(def => hasRestSibling(def.name.parent)); - const hasRestSiblingReference = variable.references.some(ref => hasRestSibling(ref.identifier.parent)); - - return hasRestSiblingDefinition || hasRestSiblingReference; - } - - return false; - } - - /** - * Determines if a reference is a read operation. - * @param {Reference} ref An eslint-scope Reference - * @returns {boolean} whether the given reference represents a read operation - * @private - */ - function isReadRef(ref) { - return ref.isRead(); - } - - /** - * Determine if an identifier is referencing an enclosing function name. - * @param {Reference} ref The reference to check. - * @param {ASTNode[]} nodes The candidate function nodes. - * @returns {boolean} True if it's a self-reference, false if not. - * @private - */ - function isSelfReference(ref, nodes) { - let scope = ref.from; - - while (scope) { - if (nodes.includes(scope.block)) { - return true; - } - - scope = scope.upper; - } - - return false; - } - - /** - * Gets a list of function definitions for a specified variable. - * @param {Variable} variable eslint-scope variable object. - * @returns {ASTNode[]} Function nodes. - * @private - */ - function getFunctionDefinitions(variable) { - const functionDefinitions = []; - - variable.defs.forEach(def => { - const { type, node } = def; - - // FunctionDeclarations - if (type === "FunctionName") { - functionDefinitions.push(node); - } - - // FunctionExpressions - if (type === "Variable" && node.init && - (node.init.type === "FunctionExpression" || node.init.type === "ArrowFunctionExpression")) { - functionDefinitions.push(node.init); - } - }); - return functionDefinitions; - } - - /** - * Checks the position of given nodes. - * @param {ASTNode} inner A node which is expected as inside. - * @param {ASTNode} outer A node which is expected as outside. - * @returns {boolean} `true` if the `inner` node exists in the `outer` node. - * @private - */ - function isInside(inner, outer) { - return ( - inner.range[0] >= outer.range[0] && - inner.range[1] <= outer.range[1] - ); - } - - /** - * Checks whether a given node is unused expression or not. - * @param {ASTNode} node The node itself - * @returns {boolean} The node is an unused expression. - * @private - */ - function isUnusedExpression(node) { - const parent = node.parent; - - if (parent.type === "ExpressionStatement") { - return true; - } - - if (parent.type === "SequenceExpression") { - const isLastExpression = parent.expressions[parent.expressions.length - 1] === node; - - if (!isLastExpression) { - return true; - } - return isUnusedExpression(parent); - } - - return false; - } - - /** - * If a given reference is left-hand side of an assignment, this gets - * the right-hand side node of the assignment. - * - * In the following cases, this returns null. - * - * - The reference is not the LHS of an assignment expression. - * - The reference is inside of a loop. - * - The reference is inside of a function scope which is different from - * the declaration. - * @param {eslint-scope.Reference} ref A reference to check. - * @param {ASTNode} prevRhsNode The previous RHS node. - * @returns {ASTNode|null} The RHS node or null. - * @private - */ - function getRhsNode(ref, prevRhsNode) { - const id = ref.identifier; - const parent = id.parent; - const refScope = ref.from.variableScope; - const varScope = ref.resolved.scope.variableScope; - const canBeUsedLater = refScope !== varScope || astUtils.isInLoop(id); - - /* - * Inherits the previous node if this reference is in the node. - * This is for `a = a + a`-like code. - */ - if (prevRhsNode && isInside(id, prevRhsNode)) { - return prevRhsNode; - } - - if (parent.type === "AssignmentExpression" && - isUnusedExpression(parent) && - id === parent.left && - !canBeUsedLater - ) { - return parent.right; - } - return null; - } - - /** - * Checks whether a given function node is stored to somewhere or not. - * If the function node is stored, the function can be used later. - * @param {ASTNode} funcNode A function node to check. - * @param {ASTNode} rhsNode The RHS node of the previous assignment. - * @returns {boolean} `true` if under the following conditions: - * - the funcNode is assigned to a variable. - * - the funcNode is bound as an argument of a function call. - * - the function is bound to a property and the object satisfies above conditions. - * @private - */ - function isStorableFunction(funcNode, rhsNode) { - let node = funcNode; - let parent = funcNode.parent; - - while (parent && isInside(parent, rhsNode)) { - switch (parent.type) { - case "SequenceExpression": - if (parent.expressions[parent.expressions.length - 1] !== node) { - return false; - } - break; - - case "CallExpression": - case "NewExpression": - return parent.callee !== node; - - case "AssignmentExpression": - case "TaggedTemplateExpression": - case "YieldExpression": - return true; - - default: - if (STATEMENT_TYPE.test(parent.type)) { - - /* - * If it encountered statements, this is a complex pattern. - * Since analyzing complex patterns is hard, this returns `true` to avoid false positive. - */ - return true; - } - } - - node = parent; - parent = parent.parent; - } - - return false; - } - - /** - * Checks whether a given Identifier node exists inside of a function node which can be used later. - * - * "can be used later" means: - * - the function is assigned to a variable. - * - the function is bound to a property and the object can be used later. - * - the function is bound as an argument of a function call. - * - * If a reference exists in a function which can be used later, the reference is read when the function is called. - * @param {ASTNode} id An Identifier node to check. - * @param {ASTNode} rhsNode The RHS node of the previous assignment. - * @returns {boolean} `true` if the `id` node exists inside of a function node which can be used later. - * @private - */ - function isInsideOfStorableFunction(id, rhsNode) { - const funcNode = astUtils.getUpperFunction(id); - - return ( - funcNode && - isInside(funcNode, rhsNode) && - isStorableFunction(funcNode, rhsNode) - ); - } - - /** - * Checks whether a given reference is a read to update itself or not. - * @param {eslint-scope.Reference} ref A reference to check. - * @param {ASTNode} rhsNode The RHS node of the previous assignment. - * @returns {boolean} The reference is a read to update itself. - * @private - */ - function isReadForItself(ref, rhsNode) { - const id = ref.identifier; - const parent = id.parent; - - return ref.isRead() && ( - - // self update. e.g. `a += 1`, `a++` - ( - ( - parent.type === "AssignmentExpression" && - parent.left === id && - isUnusedExpression(parent) - ) || - ( - parent.type === "UpdateExpression" && - isUnusedExpression(parent) - ) - ) || - - // in RHS of an assignment for itself. e.g. `a = a + 1` - ( - rhsNode && - isInside(id, rhsNode) && - !isInsideOfStorableFunction(id, rhsNode) - ) - ); - } - - /** - * Determine if an identifier is used either in for-in or for-of loops. - * @param {Reference} ref The reference to check. - * @returns {boolean} whether reference is used in the for-in loops - * @private - */ - function isForInOfRef(ref) { - let target = ref.identifier.parent; - - - // "for (var ...) { return; }" - if (target.type === "VariableDeclarator") { - target = target.parent.parent; - } - - if (target.type !== "ForInStatement" && target.type !== "ForOfStatement") { - return false; - } - - // "for (...) { return; }" - if (target.body.type === "BlockStatement") { - target = target.body.body[0]; - - // "for (...) return;" - } else { - target = target.body; - } - - // For empty loop body - if (!target) { - return false; - } - - return target.type === "ReturnStatement"; - } - - /** - * Determines if the variable is used. - * @param {Variable} variable The variable to check. - * @returns {boolean} True if the variable is used - * @private - */ - function isUsedVariable(variable) { - const functionNodes = getFunctionDefinitions(variable), - isFunctionDefinition = functionNodes.length > 0; - let rhsNode = null; - - return variable.references.some(ref => { - if (isForInOfRef(ref)) { - return true; - } - - const forItself = isReadForItself(ref, rhsNode); - - rhsNode = getRhsNode(ref, rhsNode); - - return ( - isReadRef(ref) && - !forItself && - !(isFunctionDefinition && isSelfReference(ref, functionNodes)) - ); - }); - } - - /** - * Checks whether the given variable is after the last used parameter. - * @param {eslint-scope.Variable} variable The variable to check. - * @returns {boolean} `true` if the variable is defined after the last - * used parameter. - */ - function isAfterLastUsedArg(variable) { - const def = variable.defs[0]; - const params = sourceCode.getDeclaredVariables(def.node); - const posteriorParams = params.slice(params.indexOf(variable) + 1); - - // If any used parameters occur after this parameter, do not report. - return !posteriorParams.some(v => v.references.length > 0 || v.eslintUsed); - } - - /** - * Gets an array of variables without read references. - * @param {Scope} scope an eslint-scope Scope object. - * @param {Variable[]} unusedVars an array that saving result. - * @returns {Variable[]} unused variables of the scope and descendant scopes. - * @private - */ - function collectUnusedVariables(scope, unusedVars) { - const variables = scope.variables; - const childScopes = scope.childScopes; - let i, l; - - if (scope.type !== "global" || config.vars === "all") { - for (i = 0, l = variables.length; i < l; ++i) { - const variable = variables[i]; - - // skip a variable of class itself name in the class scope - if (scope.type === "class" && scope.block.id === variable.identifiers[0]) { - continue; - } - - // skip function expression names and variables marked with markVariableAsUsed() - if (scope.functionExpressionScope || variable.eslintUsed) { - continue; - } - - // skip implicit "arguments" variable - if (scope.type === "function" && variable.name === "arguments" && variable.identifiers.length === 0) { - continue; - } - - // explicit global variables don't have definitions. - const def = variable.defs[0]; - - if (def) { - const type = def.type; - const refUsedInArrayPatterns = variable.references.some(ref => ref.identifier.parent.type === "ArrayPattern"); - - // skip elements of array destructuring patterns - if ( - ( - def.name.parent.type === "ArrayPattern" || - refUsedInArrayPatterns - ) && - config.destructuredArrayIgnorePattern && - config.destructuredArrayIgnorePattern.test(def.name.name) - ) { - continue; - } - - // skip catch variables - if (type === "CatchClause") { - if (config.caughtErrors === "none") { - continue; - } - - // skip ignored parameters - if (config.caughtErrorsIgnorePattern && config.caughtErrorsIgnorePattern.test(def.name.name)) { - continue; - } - } - - if (type === "Parameter") { - - // skip any setter argument - if ((def.node.parent.type === "Property" || def.node.parent.type === "MethodDefinition") && def.node.parent.kind === "set") { - continue; - } - - // if "args" option is "none", skip any parameter - if (config.args === "none") { - continue; - } - - // skip ignored parameters - if (config.argsIgnorePattern && config.argsIgnorePattern.test(def.name.name)) { - continue; - } - - // if "args" option is "after-used", skip used variables - if (config.args === "after-used" && astUtils.isFunction(def.name.parent) && !isAfterLastUsedArg(variable)) { - continue; - } - } else { - - // skip ignored variables - if (config.varsIgnorePattern && config.varsIgnorePattern.test(def.name.name)) { - continue; - } - } - } - - if (!isUsedVariable(variable) && !isExported(variable) && !hasRestSpreadSibling(variable)) { - unusedVars.push(variable); - } - } - } - - for (i = 0, l = childScopes.length; i < l; ++i) { - collectUnusedVariables(childScopes[i], unusedVars); - } - - return unusedVars; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - "Program:exit"(programNode) { - const unusedVars = collectUnusedVariables(sourceCode.getScope(programNode), []); - - for (let i = 0, l = unusedVars.length; i < l; ++i) { - const unusedVar = unusedVars[i]; - - // Report the first declaration. - if (unusedVar.defs.length > 0) { - - // report last write reference, https://github.com/eslint/eslint/issues/14324 - const writeReferences = unusedVar.references.filter(ref => ref.isWrite() && ref.from.variableScope === unusedVar.scope.variableScope); - - let referenceToReport; - - if (writeReferences.length > 0) { - referenceToReport = writeReferences[writeReferences.length - 1]; - } - - context.report({ - node: referenceToReport ? referenceToReport.identifier : unusedVar.identifiers[0], - messageId: "unusedVar", - data: unusedVar.references.some(ref => ref.isWrite()) - ? getAssignedMessageData(unusedVar) - : getDefinedMessageData(unusedVar) - }); - - // If there are no regular declaration, report the first `/*globals*/` comment directive. - } else if (unusedVar.eslintExplicitGlobalComments) { - const directiveComment = unusedVar.eslintExplicitGlobalComments[0]; - - context.report({ - node: programNode, - loc: astUtils.getNameLocationInGlobalDirectiveComment(sourceCode, directiveComment, unusedVar.name), - messageId: "unusedVar", - data: getDefinedMessageData(unusedVar) - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-use-before-define.js b/node_modules/eslint/lib/rules/no-use-before-define.js deleted file mode 100644 index 9d6b04340..000000000 --- a/node_modules/eslint/lib/rules/no-use-before-define.js +++ /dev/null @@ -1,348 +0,0 @@ -/** - * @fileoverview Rule to flag use of variables before they are defined - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const SENTINEL_TYPE = /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/u; -const FOR_IN_OF_TYPE = /^For(?:In|Of)Statement$/u; - -/** - * Parses a given value as options. - * @param {any} options A value to parse. - * @returns {Object} The parsed options. - */ -function parseOptions(options) { - let functions = true; - let classes = true; - let variables = true; - let allowNamedExports = false; - - if (typeof options === "string") { - functions = (options !== "nofunc"); - } else if (typeof options === "object" && options !== null) { - functions = options.functions !== false; - classes = options.classes !== false; - variables = options.variables !== false; - allowNamedExports = !!options.allowNamedExports; - } - - return { functions, classes, variables, allowNamedExports }; -} - -/** - * Checks whether or not a given location is inside of the range of a given node. - * @param {ASTNode} node An node to check. - * @param {number} location A location to check. - * @returns {boolean} `true` if the location is inside of the range of the node. - */ -function isInRange(node, location) { - return node && node.range[0] <= location && location <= node.range[1]; -} - -/** - * Checks whether or not a given location is inside of the range of a class static initializer. - * Static initializers are static blocks and initializers of static fields. - * @param {ASTNode} node `ClassBody` node to check static initializers. - * @param {number} location A location to check. - * @returns {boolean} `true` if the location is inside of a class static initializer. - */ -function isInClassStaticInitializerRange(node, location) { - return node.body.some(classMember => ( - ( - classMember.type === "StaticBlock" && - isInRange(classMember, location) - ) || - ( - classMember.type === "PropertyDefinition" && - classMember.static && - classMember.value && - isInRange(classMember.value, location) - ) - )); -} - -/** - * Checks whether a given scope is the scope of a class static initializer. - * Static initializers are static blocks and initializers of static fields. - * @param {eslint-scope.Scope} scope A scope to check. - * @returns {boolean} `true` if the scope is a class static initializer scope. - */ -function isClassStaticInitializerScope(scope) { - if (scope.type === "class-static-block") { - return true; - } - - if (scope.type === "class-field-initializer") { - - // `scope.block` is PropertyDefinition#value node - const propertyDefinition = scope.block.parent; - - return propertyDefinition.static; - } - - return false; -} - -/** - * Checks whether a given reference is evaluated in an execution context - * that isn't the one where the variable it refers to is defined. - * Execution contexts are: - * - top-level - * - functions - * - class field initializers (implicit functions) - * - class static blocks (implicit functions) - * Static class field initializers and class static blocks are automatically run during the class definition evaluation, - * and therefore we'll consider them as a part of the parent execution context. - * Example: - * - * const x = 1; - * - * x; // returns `false` - * () => x; // returns `true` - * - * class C { - * field = x; // returns `true` - * static field = x; // returns `false` - * - * method() { - * x; // returns `true` - * } - * - * static method() { - * x; // returns `true` - * } - * - * static { - * x; // returns `false` - * } - * } - * @param {eslint-scope.Reference} reference A reference to check. - * @returns {boolean} `true` if the reference is from a separate execution context. - */ -function isFromSeparateExecutionContext(reference) { - const variable = reference.resolved; - let scope = reference.from; - - // Scope#variableScope represents execution context - while (variable.scope.variableScope !== scope.variableScope) { - if (isClassStaticInitializerScope(scope.variableScope)) { - scope = scope.variableScope.upper; - } else { - return true; - } - } - - return false; -} - -/** - * Checks whether or not a given reference is evaluated during the initialization of its variable. - * - * This returns `true` in the following cases: - * - * var a = a - * var [a = a] = list - * var {a = a} = obj - * for (var a in a) {} - * for (var a of a) {} - * var C = class { [C]; }; - * var C = class { static foo = C; }; - * var C = class { static { foo = C; } }; - * class C extends C {} - * class C extends (class { static foo = C; }) {} - * class C { [C]; } - * @param {Reference} reference A reference to check. - * @returns {boolean} `true` if the reference is evaluated during the initialization. - */ -function isEvaluatedDuringInitialization(reference) { - if (isFromSeparateExecutionContext(reference)) { - - /* - * Even if the reference appears in the initializer, it isn't evaluated during the initialization. - * For example, `const x = () => x;` is valid. - */ - return false; - } - - const location = reference.identifier.range[1]; - const definition = reference.resolved.defs[0]; - - if (definition.type === "ClassName") { - - // `ClassDeclaration` or `ClassExpression` - const classDefinition = definition.node; - - return ( - isInRange(classDefinition, location) && - - /* - * Class binding is initialized before running static initializers. - * For example, `class C { static foo = C; static { bar = C; } }` is valid. - */ - !isInClassStaticInitializerRange(classDefinition.body, location) - ); - } - - let node = definition.name.parent; - - while (node) { - if (node.type === "VariableDeclarator") { - if (isInRange(node.init, location)) { - return true; - } - if (FOR_IN_OF_TYPE.test(node.parent.parent.type) && - isInRange(node.parent.parent.right, location) - ) { - return true; - } - break; - } else if (node.type === "AssignmentPattern") { - if (isInRange(node.right, location)) { - return true; - } - } else if (SENTINEL_TYPE.test(node.type)) { - break; - } - - node = node.parent; - } - - return false; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow the use of variables before they are defined", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-use-before-define" - }, - - schema: [ - { - oneOf: [ - { - enum: ["nofunc"] - }, - { - type: "object", - properties: { - functions: { type: "boolean" }, - classes: { type: "boolean" }, - variables: { type: "boolean" }, - allowNamedExports: { type: "boolean" } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - usedBeforeDefined: "'{{name}}' was used before it was defined." - } - }, - - create(context) { - const options = parseOptions(context.options[0]); - const sourceCode = context.sourceCode; - - /** - * Determines whether a given reference should be checked. - * - * Returns `false` if the reference is: - * - initialization's (e.g., `let a = 1`). - * - referring to an undefined variable (i.e., if it's an unresolved reference). - * - referring to a variable that is defined, but not in the given source code - * (e.g., global environment variable or `arguments` in functions). - * - allowed by options. - * @param {eslint-scope.Reference} reference The reference - * @returns {boolean} `true` if the reference should be checked - */ - function shouldCheck(reference) { - if (reference.init) { - return false; - } - - const { identifier } = reference; - - if ( - options.allowNamedExports && - identifier.parent.type === "ExportSpecifier" && - identifier.parent.local === identifier - ) { - return false; - } - - const variable = reference.resolved; - - if (!variable || variable.defs.length === 0) { - return false; - } - - const definitionType = variable.defs[0].type; - - if (!options.functions && definitionType === "FunctionName") { - return false; - } - - if ( - ( - !options.variables && definitionType === "Variable" || - !options.classes && definitionType === "ClassName" - ) && - - // don't skip checking the reference if it's in the same execution context, because of TDZ - isFromSeparateExecutionContext(reference) - ) { - return false; - } - - return true; - } - - /** - * Finds and validates all references in a given scope and its child scopes. - * @param {eslint-scope.Scope} scope The scope object. - * @returns {void} - */ - function checkReferencesInScope(scope) { - scope.references.filter(shouldCheck).forEach(reference => { - const variable = reference.resolved; - const definitionIdentifier = variable.defs[0].name; - - if ( - reference.identifier.range[1] < definitionIdentifier.range[1] || - isEvaluatedDuringInitialization(reference) - ) { - context.report({ - node: reference.identifier, - messageId: "usedBeforeDefined", - data: reference.identifier - }); - } - }); - - scope.childScopes.forEach(checkReferencesInScope); - } - - return { - Program(node) { - checkReferencesInScope(sourceCode.getScope(node)); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-backreference.js b/node_modules/eslint/lib/rules/no-useless-backreference.js deleted file mode 100644 index c99ac4114..000000000 --- a/node_modules/eslint/lib/rules/no-useless-backreference.js +++ /dev/null @@ -1,194 +0,0 @@ -/** - * @fileoverview Rule to disallow useless backreferences in regular expressions - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { CALL, CONSTRUCT, ReferenceTracker, getStringIfConstant } = require("@eslint-community/eslint-utils"); -const { RegExpParser, visitRegExpAST } = require("@eslint-community/regexpp"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const parser = new RegExpParser(); - -/** - * Finds the path from the given `regexpp` AST node to the root node. - * @param {regexpp.Node} node Node. - * @returns {regexpp.Node[]} Array that starts with the given node and ends with the root node. - */ -function getPathToRoot(node) { - const path = []; - let current = node; - - do { - path.push(current); - current = current.parent; - } while (current); - - return path; -} - -/** - * Determines whether the given `regexpp` AST node is a lookaround node. - * @param {regexpp.Node} node Node. - * @returns {boolean} `true` if it is a lookaround node. - */ -function isLookaround(node) { - return node.type === "Assertion" && - (node.kind === "lookahead" || node.kind === "lookbehind"); -} - -/** - * Determines whether the given `regexpp` AST node is a negative lookaround node. - * @param {regexpp.Node} node Node. - * @returns {boolean} `true` if it is a negative lookaround node. - */ -function isNegativeLookaround(node) { - return isLookaround(node) && node.negate; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow useless backreferences in regular expressions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-useless-backreference" - }, - - schema: [], - - messages: { - nested: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' from within that group.", - forward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which appears later in the pattern.", - backward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which appears before in the same lookbehind.", - disjunctive: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which is in another alternative.", - intoNegativeLookaround: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which is in a negative lookaround." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Checks and reports useless backreferences in the given regular expression. - * @param {ASTNode} node Node that represents regular expression. A regex literal or RegExp constructor call. - * @param {string} pattern Regular expression pattern. - * @param {string} flags Regular expression flags. - * @returns {void} - */ - function checkRegex(node, pattern, flags) { - let regExpAST; - - try { - regExpAST = parser.parsePattern(pattern, 0, pattern.length, flags.includes("u")); - } catch { - - // Ignore regular expressions with syntax errors - return; - } - - visitRegExpAST(regExpAST, { - onBackreferenceEnter(bref) { - const group = bref.resolved, - brefPath = getPathToRoot(bref), - groupPath = getPathToRoot(group); - let messageId = null; - - if (brefPath.includes(group)) { - - // group is bref's ancestor => bref is nested ('nested reference') => group hasn't matched yet when bref starts to match. - messageId = "nested"; - } else { - - // Start from the root to find the lowest common ancestor. - let i = brefPath.length - 1, - j = groupPath.length - 1; - - do { - i--; - j--; - } while (brefPath[i] === groupPath[j]); - - const indexOfLowestCommonAncestor = j + 1, - groupCut = groupPath.slice(0, indexOfLowestCommonAncestor), - commonPath = groupPath.slice(indexOfLowestCommonAncestor), - lowestCommonLookaround = commonPath.find(isLookaround), - isMatchingBackward = lowestCommonLookaround && lowestCommonLookaround.kind === "lookbehind"; - - if (!isMatchingBackward && bref.end <= group.start) { - - // bref is left, group is right ('forward reference') => group hasn't matched yet when bref starts to match. - messageId = "forward"; - } else if (isMatchingBackward && group.end <= bref.start) { - - // the opposite of the previous when the regex is matching backward in a lookbehind context. - messageId = "backward"; - } else if (groupCut[groupCut.length - 1].type === "Alternative") { - - // group's and bref's ancestor nodes below the lowest common ancestor are sibling alternatives => they're disjunctive. - messageId = "disjunctive"; - } else if (groupCut.some(isNegativeLookaround)) { - - // group is in a negative lookaround which isn't bref's ancestor => group has already failed when bref starts to match. - messageId = "intoNegativeLookaround"; - } - } - - if (messageId) { - context.report({ - node, - messageId, - data: { - bref: bref.raw, - group: group.raw - } - }); - } - } - }); - } - - return { - "Literal[regex]"(node) { - const { pattern, flags } = node.regex; - - checkRegex(node, pattern, flags); - }, - Program(node) { - const scope = sourceCode.getScope(node), - tracker = new ReferenceTracker(scope), - traceMap = { - RegExp: { - [CALL]: true, - [CONSTRUCT]: true - } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(traceMap)) { - const [patternNode, flagsNode] = refNode.arguments, - pattern = getStringIfConstant(patternNode, scope), - flags = getStringIfConstant(flagsNode, scope); - - if (typeof pattern === "string") { - checkRegex(refNode, pattern, flags || ""); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-call.js b/node_modules/eslint/lib/rules/no-useless-call.js deleted file mode 100644 index dea2b47a4..000000000 --- a/node_modules/eslint/lib/rules/no-useless-call.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @fileoverview A rule to disallow unnecessary `.call()` and `.apply()`. - * @author Toru Nagashima - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a node is a `.call()`/`.apply()`. - * @param {ASTNode} node A CallExpression node to check. - * @returns {boolean} Whether or not the node is a `.call()`/`.apply()`. - */ -function isCallOrNonVariadicApply(node) { - const callee = astUtils.skipChainExpression(node.callee); - - return ( - callee.type === "MemberExpression" && - callee.property.type === "Identifier" && - callee.computed === false && - ( - (callee.property.name === "call" && node.arguments.length >= 1) || - (callee.property.name === "apply" && node.arguments.length === 2 && node.arguments[1].type === "ArrayExpression") - ) - ); -} - - -/** - * Checks whether or not `thisArg` is not changed by `.call()`/`.apply()`. - * @param {ASTNode|null} expectedThis The node that is the owner of the applied function. - * @param {ASTNode} thisArg The node that is given to the first argument of the `.call()`/`.apply()`. - * @param {SourceCode} sourceCode The ESLint source code object. - * @returns {boolean} Whether or not `thisArg` is not changed by `.call()`/`.apply()`. - */ -function isValidThisArg(expectedThis, thisArg, sourceCode) { - if (!expectedThis) { - return astUtils.isNullOrUndefined(thisArg); - } - return astUtils.equalTokens(expectedThis, thisArg, sourceCode); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary calls to `.call()` and `.apply()`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-useless-call" - }, - - schema: [], - - messages: { - unnecessaryCall: "Unnecessary '.{{name}}()'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - CallExpression(node) { - if (!isCallOrNonVariadicApply(node)) { - return; - } - - const callee = astUtils.skipChainExpression(node.callee); - const applied = astUtils.skipChainExpression(callee.object); - const expectedThis = (applied.type === "MemberExpression") ? applied.object : null; - const thisArg = node.arguments[0]; - - if (isValidThisArg(expectedThis, thisArg, sourceCode)) { - context.report({ node, messageId: "unnecessaryCall", data: { name: callee.property.name } }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-catch.js b/node_modules/eslint/lib/rules/no-useless-catch.js deleted file mode 100644 index e02013db6..000000000 --- a/node_modules/eslint/lib/rules/no-useless-catch.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @fileoverview Reports useless `catch` clauses that just rethrow their error. - * @author Teddy Katz - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary `catch` clauses", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-useless-catch" - }, - - schema: [], - - messages: { - unnecessaryCatchClause: "Unnecessary catch clause.", - unnecessaryCatch: "Unnecessary try/catch wrapper." - } - }, - - create(context) { - return { - CatchClause(node) { - if ( - node.param && - node.param.type === "Identifier" && - node.body.body.length && - node.body.body[0].type === "ThrowStatement" && - node.body.body[0].argument.type === "Identifier" && - node.body.body[0].argument.name === node.param.name - ) { - if (node.parent.finalizer) { - context.report({ - node, - messageId: "unnecessaryCatchClause" - }); - } else { - context.report({ - node: node.parent, - messageId: "unnecessaryCatch" - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-computed-key.js b/node_modules/eslint/lib/rules/no-useless-computed-key.js deleted file mode 100644 index f2d9f3341..000000000 --- a/node_modules/eslint/lib/rules/no-useless-computed-key.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * @fileoverview Rule to disallow unnecessary computed property keys in object literals - * @author Burak Yigit Kaya - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines whether the computed key syntax is unnecessarily used for the given node. - * In particular, it determines whether removing the square brackets and using the content between them - * directly as the key (e.g. ['foo'] -> 'foo') would produce valid syntax and preserve the same behavior. - * Valid non-computed keys are only: identifiers, number literals and string literals. - * Only literals can preserve the same behavior, with a few exceptions for specific node types: - * Property - * - { ["__proto__"]: foo } defines a property named "__proto__" - * { "__proto__": foo } defines object's prototype - * PropertyDefinition - * - class C { ["constructor"]; } defines an instance field named "constructor" - * class C { "constructor"; } produces a parsing error - * - class C { static ["constructor"]; } defines a static field named "constructor" - * class C { static "constructor"; } produces a parsing error - * - class C { static ["prototype"]; } produces a runtime error (doesn't break the whole script) - * class C { static "prototype"; } produces a parsing error (breaks the whole script) - * MethodDefinition - * - class C { ["constructor"]() {} } defines a prototype method named "constructor" - * class C { "constructor"() {} } defines the constructor - * - class C { static ["prototype"]() {} } produces a runtime error (doesn't break the whole script) - * class C { static "prototype"() {} } produces a parsing error (breaks the whole script) - * @param {ASTNode} node The node to check. It can be `Property`, `PropertyDefinition` or `MethodDefinition`. - * @throws {Error} (Unreachable.) - * @returns {void} `true` if the node has useless computed key. - */ -function hasUselessComputedKey(node) { - if (!node.computed) { - return false; - } - - const { key } = node; - - if (key.type !== "Literal") { - return false; - } - - const { value } = key; - - if (typeof value !== "number" && typeof value !== "string") { - return false; - } - - switch (node.type) { - case "Property": - return value !== "__proto__"; - - case "PropertyDefinition": - if (node.static) { - return value !== "constructor" && value !== "prototype"; - } - - return value !== "constructor"; - - case "MethodDefinition": - if (node.static) { - return value !== "prototype"; - } - - return value !== "constructor"; - - /* c8 ignore next */ - default: - throw new Error(`Unexpected node type: ${node.type}`); - } - -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary computed property keys in objects and classes", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-useless-computed-key" - }, - - schema: [{ - type: "object", - properties: { - enforceForClassMembers: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - fixable: "code", - - messages: { - unnecessarilyComputedProperty: "Unnecessarily computed property [{{property}}] found." - } - }, - create(context) { - const sourceCode = context.sourceCode; - const enforceForClassMembers = context.options[0] && context.options[0].enforceForClassMembers; - - /** - * Reports a given node if it violated this rule. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function check(node) { - if (hasUselessComputedKey(node)) { - const { key } = node; - - context.report({ - node, - messageId: "unnecessarilyComputedProperty", - data: { property: sourceCode.getText(key) }, - fix(fixer) { - const leftSquareBracket = sourceCode.getTokenBefore(key, astUtils.isOpeningBracketToken); - const rightSquareBracket = sourceCode.getTokenAfter(key, astUtils.isClosingBracketToken); - - // If there are comments between the brackets and the property name, don't do a fix. - if (sourceCode.commentsExistBetween(leftSquareBracket, rightSquareBracket)) { - return null; - } - - const tokenBeforeLeftBracket = sourceCode.getTokenBefore(leftSquareBracket); - - // Insert a space before the key to avoid changing identifiers, e.g. ({ get[2]() {} }) to ({ get2() {} }) - const needsSpaceBeforeKey = tokenBeforeLeftBracket.range[1] === leftSquareBracket.range[0] && - !astUtils.canTokensBeAdjacent(tokenBeforeLeftBracket, sourceCode.getFirstToken(key)); - - const replacementKey = (needsSpaceBeforeKey ? " " : "") + key.raw; - - return fixer.replaceTextRange([leftSquareBracket.range[0], rightSquareBracket.range[1]], replacementKey); - } - }); - } - } - - /** - * A no-op function to act as placeholder for checking a node when the `enforceForClassMembers` option is `false`. - * @returns {void} - * @private - */ - function noop() {} - - return { - Property: check, - MethodDefinition: enforceForClassMembers ? check : noop, - PropertyDefinition: enforceForClassMembers ? check : noop - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-concat.js b/node_modules/eslint/lib/rules/no-useless-concat.js deleted file mode 100644 index c566c62be..000000000 --- a/node_modules/eslint/lib/rules/no-useless-concat.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * @fileoverview disallow unnecessary concatenation of template strings - * @author Henry Zhu - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a given node is a concatenation. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is a concatenation. - */ -function isConcatenation(node) { - return node.type === "BinaryExpression" && node.operator === "+"; -} - -/** - * Checks if the given token is a `+` token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a `+` token. - */ -function isConcatOperatorToken(token) { - return token.value === "+" && token.type === "Punctuator"; -} - -/** - * Get's the right most node on the left side of a BinaryExpression with + operator. - * @param {ASTNode} node A BinaryExpression node to check. - * @returns {ASTNode} node - */ -function getLeft(node) { - let left = node.left; - - while (isConcatenation(left)) { - left = left.right; - } - return left; -} - -/** - * Get's the left most node on the right side of a BinaryExpression with + operator. - * @param {ASTNode} node A BinaryExpression node to check. - * @returns {ASTNode} node - */ -function getRight(node) { - let right = node.right; - - while (isConcatenation(right)) { - right = right.left; - } - return right; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary concatenation of literals or template literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-useless-concat" - }, - - schema: [], - - messages: { - unexpectedConcat: "Unexpected string concatenation of literals." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - BinaryExpression(node) { - - // check if not concatenation - if (node.operator !== "+") { - return; - } - - // account for the `foo + "a" + "b"` case - const left = getLeft(node); - const right = getRight(node); - - if (astUtils.isStringLiteral(left) && - astUtils.isStringLiteral(right) && - astUtils.isTokenOnSameLine(left, right) - ) { - const operatorToken = sourceCode.getFirstTokenBetween(left, right, isConcatOperatorToken); - - context.report({ - node, - loc: operatorToken.loc, - messageId: "unexpectedConcat" - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-constructor.js b/node_modules/eslint/lib/rules/no-useless-constructor.js deleted file mode 100644 index 2b9c18e51..000000000 --- a/node_modules/eslint/lib/rules/no-useless-constructor.js +++ /dev/null @@ -1,189 +0,0 @@ -/** - * @fileoverview Rule to flag the use of redundant constructors in classes. - * @author Alberto Rodríguez - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether a given array of statements is a single call of `super`. - * @param {ASTNode[]} body An array of statements to check. - * @returns {boolean} `true` if the body is a single call of `super`. - */ -function isSingleSuperCall(body) { - return ( - body.length === 1 && - body[0].type === "ExpressionStatement" && - body[0].expression.type === "CallExpression" && - body[0].expression.callee.type === "Super" - ); -} - -/** - * Checks whether a given node is a pattern which doesn't have any side effects. - * Default parameters and Destructuring parameters can have side effects. - * @param {ASTNode} node A pattern node. - * @returns {boolean} `true` if the node doesn't have any side effects. - */ -function isSimple(node) { - return node.type === "Identifier" || node.type === "RestElement"; -} - -/** - * Checks whether a given array of expressions is `...arguments` or not. - * `super(...arguments)` passes all arguments through. - * @param {ASTNode[]} superArgs An array of expressions to check. - * @returns {boolean} `true` if the superArgs is `...arguments`. - */ -function isSpreadArguments(superArgs) { - return ( - superArgs.length === 1 && - superArgs[0].type === "SpreadElement" && - superArgs[0].argument.type === "Identifier" && - superArgs[0].argument.name === "arguments" - ); -} - -/** - * Checks whether given 2 nodes are identifiers which have the same name or not. - * @param {ASTNode} ctorParam A node to check. - * @param {ASTNode} superArg A node to check. - * @returns {boolean} `true` if the nodes are identifiers which have the same - * name. - */ -function isValidIdentifierPair(ctorParam, superArg) { - return ( - ctorParam.type === "Identifier" && - superArg.type === "Identifier" && - ctorParam.name === superArg.name - ); -} - -/** - * Checks whether given 2 nodes are a rest/spread pair which has the same values. - * @param {ASTNode} ctorParam A node to check. - * @param {ASTNode} superArg A node to check. - * @returns {boolean} `true` if the nodes are a rest/spread pair which has the - * same values. - */ -function isValidRestSpreadPair(ctorParam, superArg) { - return ( - ctorParam.type === "RestElement" && - superArg.type === "SpreadElement" && - isValidIdentifierPair(ctorParam.argument, superArg.argument) - ); -} - -/** - * Checks whether given 2 nodes have the same value or not. - * @param {ASTNode} ctorParam A node to check. - * @param {ASTNode} superArg A node to check. - * @returns {boolean} `true` if the nodes have the same value or not. - */ -function isValidPair(ctorParam, superArg) { - return ( - isValidIdentifierPair(ctorParam, superArg) || - isValidRestSpreadPair(ctorParam, superArg) - ); -} - -/** - * Checks whether the parameters of a constructor and the arguments of `super()` - * have the same values or not. - * @param {ASTNode} ctorParams The parameters of a constructor to check. - * @param {ASTNode} superArgs The arguments of `super()` to check. - * @returns {boolean} `true` if those have the same values. - */ -function isPassingThrough(ctorParams, superArgs) { - if (ctorParams.length !== superArgs.length) { - return false; - } - - for (let i = 0; i < ctorParams.length; ++i) { - if (!isValidPair(ctorParams[i], superArgs[i])) { - return false; - } - } - - return true; -} - -/** - * Checks whether the constructor body is a redundant super call. - * @param {Array} body constructor body content. - * @param {Array} ctorParams The params to check against super call. - * @returns {boolean} true if the constructor body is redundant - */ -function isRedundantSuperCall(body, ctorParams) { - return ( - isSingleSuperCall(body) && - ctorParams.every(isSimple) && - ( - isSpreadArguments(body[0].expression.arguments) || - isPassingThrough(ctorParams, body[0].expression.arguments) - ) - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary constructors", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-useless-constructor" - }, - - schema: [], - - messages: { - noUselessConstructor: "Useless constructor." - } - }, - - create(context) { - - /** - * Checks whether a node is a redundant constructor - * @param {ASTNode} node node to check - * @returns {void} - */ - function checkForConstructor(node) { - if (node.kind !== "constructor") { - return; - } - - /* - * Prevent crashing on parsers which do not require class constructor - * to have a body, e.g. typescript and flow - */ - if (!node.value.body) { - return; - } - - const body = node.value.body.body; - const ctorParams = node.value.params; - const superClass = node.parent.parent.superClass; - - if (superClass ? isRedundantSuperCall(body, ctorParams) : (body.length === 0)) { - context.report({ - node, - messageId: "noUselessConstructor" - }); - } - } - - return { - MethodDefinition: checkForConstructor - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-escape.js b/node_modules/eslint/lib/rules/no-useless-escape.js deleted file mode 100644 index 8304d915f..000000000 --- a/node_modules/eslint/lib/rules/no-useless-escape.js +++ /dev/null @@ -1,254 +0,0 @@ -/** - * @fileoverview Look for useless escapes in strings and regexes - * @author Onur Temizkan - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** - * Returns the union of two sets. - * @param {Set} setA The first set - * @param {Set} setB The second set - * @returns {Set} The union of the two sets - */ -function union(setA, setB) { - return new Set(function *() { - yield* setA; - yield* setB; - }()); -} - -const VALID_STRING_ESCAPES = union(new Set("\\nrvtbfux"), astUtils.LINEBREAKS); -const REGEX_GENERAL_ESCAPES = new Set("\\bcdDfnpPrsStvwWxu0123456789]"); -const REGEX_NON_CHARCLASS_ESCAPES = union(REGEX_GENERAL_ESCAPES, new Set("^/.$*+?[{}|()Bk")); - -/** - * Parses a regular expression into a list of characters with character class info. - * @param {string} regExpText The raw text used to create the regular expression - * @returns {Object[]} A list of characters, each with info on escaping and whether they're in a character class. - * @example - * - * parseRegExp("a\\b[cd-]"); - * - * // returns: - * [ - * { text: "a", index: 0, escaped: false, inCharClass: false, startsCharClass: false, endsCharClass: false }, - * { text: "b", index: 2, escaped: true, inCharClass: false, startsCharClass: false, endsCharClass: false }, - * { text: "c", index: 4, escaped: false, inCharClass: true, startsCharClass: true, endsCharClass: false }, - * { text: "d", index: 5, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false }, - * { text: "-", index: 6, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false } - * ]; - * - */ -function parseRegExp(regExpText) { - const charList = []; - - regExpText.split("").reduce((state, char, index) => { - if (!state.escapeNextChar) { - if (char === "\\") { - return Object.assign(state, { escapeNextChar: true }); - } - if (char === "[" && !state.inCharClass) { - return Object.assign(state, { inCharClass: true, startingCharClass: true }); - } - if (char === "]" && state.inCharClass) { - if (charList.length && charList[charList.length - 1].inCharClass) { - charList[charList.length - 1].endsCharClass = true; - } - return Object.assign(state, { inCharClass: false, startingCharClass: false }); - } - } - charList.push({ - text: char, - index, - escaped: state.escapeNextChar, - inCharClass: state.inCharClass, - startsCharClass: state.startingCharClass, - endsCharClass: false - }); - return Object.assign(state, { escapeNextChar: false, startingCharClass: false }); - }, { escapeNextChar: false, inCharClass: false, startingCharClass: false }); - - return charList; -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary escape characters", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-useless-escape" - }, - - hasSuggestions: true, - - messages: { - unnecessaryEscape: "Unnecessary escape character: \\{{character}}.", - removeEscape: "Remove the `\\`. This maintains the current functionality.", - escapeBackslash: "Replace the `\\` with `\\\\` to include the actual backslash character." - }, - - schema: [] - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Reports a node - * @param {ASTNode} node The node to report - * @param {number} startOffset The backslash's offset from the start of the node - * @param {string} character The uselessly escaped character (not including the backslash) - * @returns {void} - */ - function report(node, startOffset, character) { - const rangeStart = node.range[0] + startOffset; - const range = [rangeStart, rangeStart + 1]; - const start = sourceCode.getLocFromIndex(rangeStart); - - context.report({ - node, - loc: { - start, - end: { line: start.line, column: start.column + 1 } - }, - messageId: "unnecessaryEscape", - data: { character }, - suggest: [ - { - messageId: "removeEscape", - fix(fixer) { - return fixer.removeRange(range); - } - }, - { - messageId: "escapeBackslash", - fix(fixer) { - return fixer.insertTextBeforeRange(range, "\\"); - } - } - ] - }); - } - - /** - * Checks if the escape character in given string slice is unnecessary. - * @private - * @param {ASTNode} node node to validate. - * @param {string} match string slice to validate. - * @returns {void} - */ - function validateString(node, match) { - const isTemplateElement = node.type === "TemplateElement"; - const escapedChar = match[0][1]; - let isUnnecessaryEscape = !VALID_STRING_ESCAPES.has(escapedChar); - let isQuoteEscape; - - if (isTemplateElement) { - isQuoteEscape = escapedChar === "`"; - - if (escapedChar === "$") { - - // Warn if `\$` is not followed by `{` - isUnnecessaryEscape = match.input[match.index + 2] !== "{"; - } else if (escapedChar === "{") { - - /* - * Warn if `\{` is not preceded by `$`. If preceded by `$`, escaping - * is necessary and the rule should not warn. If preceded by `/$`, the rule - * will warn for the `/$` instead, as it is the first unnecessarily escaped character. - */ - isUnnecessaryEscape = match.input[match.index - 1] !== "$"; - } - } else { - isQuoteEscape = escapedChar === node.raw[0]; - } - - if (isUnnecessaryEscape && !isQuoteEscape) { - report(node, match.index, match[0].slice(1)); - } - } - - /** - * Checks if a node has an escape. - * @param {ASTNode} node node to check. - * @returns {void} - */ - function check(node) { - const isTemplateElement = node.type === "TemplateElement"; - - if ( - isTemplateElement && - node.parent && - node.parent.parent && - node.parent.parent.type === "TaggedTemplateExpression" && - node.parent === node.parent.parent.quasi - ) { - - // Don't report tagged template literals, because the backslash character is accessible to the tag function. - return; - } - - if (typeof node.value === "string" || isTemplateElement) { - - /* - * JSXAttribute doesn't have any escape sequence: https://facebook.github.io/jsx/. - * In addition, backticks are not supported by JSX yet: https://github.com/facebook/jsx/issues/25. - */ - if (node.parent.type === "JSXAttribute" || node.parent.type === "JSXElement" || node.parent.type === "JSXFragment") { - return; - } - - const value = isTemplateElement ? sourceCode.getText(node) : node.raw; - const pattern = /\\[^\d]/gu; - let match; - - while ((match = pattern.exec(value))) { - validateString(node, match); - } - } else if (node.regex) { - parseRegExp(node.regex.pattern) - - /* - * The '-' character is a special case, because it's only valid to escape it if it's in a character - * class, and is not at either edge of the character class. To account for this, don't consider '-' - * characters to be valid in general, and filter out '-' characters that appear in the middle of a - * character class. - */ - .filter(charInfo => !(charInfo.text === "-" && charInfo.inCharClass && !charInfo.startsCharClass && !charInfo.endsCharClass)) - - /* - * The '^' character is also a special case; it must always be escaped outside of character classes, but - * it only needs to be escaped in character classes if it's at the beginning of the character class. To - * account for this, consider it to be a valid escape character outside of character classes, and filter - * out '^' characters that appear at the start of a character class. - */ - .filter(charInfo => !(charInfo.text === "^" && charInfo.startsCharClass)) - - // Filter out characters that aren't escaped. - .filter(charInfo => charInfo.escaped) - - // Filter out characters that are valid to escape, based on their position in the regular expression. - .filter(charInfo => !(charInfo.inCharClass ? REGEX_GENERAL_ESCAPES : REGEX_NON_CHARCLASS_ESCAPES).has(charInfo.text)) - - // Report all the remaining characters. - .forEach(charInfo => report(node, charInfo.index, charInfo.text)); - } - - } - - return { - Literal: check, - TemplateElement: check - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-rename.js b/node_modules/eslint/lib/rules/no-useless-rename.js deleted file mode 100644 index 0c818fb2c..000000000 --- a/node_modules/eslint/lib/rules/no-useless-rename.js +++ /dev/null @@ -1,172 +0,0 @@ -/** - * @fileoverview Disallow renaming import, export, and destructured assignments to the same name. - * @author Kai Cataldo - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow renaming import, export, and destructured assignments to the same name", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-useless-rename" - }, - - fixable: "code", - - schema: [ - { - type: "object", - properties: { - ignoreDestructuring: { type: "boolean", default: false }, - ignoreImport: { type: "boolean", default: false }, - ignoreExport: { type: "boolean", default: false } - }, - additionalProperties: false - } - ], - - messages: { - unnecessarilyRenamed: "{{type}} {{name}} unnecessarily renamed." - } - }, - - create(context) { - const sourceCode = context.sourceCode, - options = context.options[0] || {}, - ignoreDestructuring = options.ignoreDestructuring === true, - ignoreImport = options.ignoreImport === true, - ignoreExport = options.ignoreExport === true; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Reports error for unnecessarily renamed assignments - * @param {ASTNode} node node to report - * @param {ASTNode} initial node with initial name value - * @param {string} type the type of the offending node - * @returns {void} - */ - function reportError(node, initial, type) { - const name = initial.type === "Identifier" ? initial.name : initial.value; - - return context.report({ - node, - messageId: "unnecessarilyRenamed", - data: { - name, - type - }, - fix(fixer) { - const replacementNode = node.type === "Property" ? node.value : node.local; - - if (sourceCode.getCommentsInside(node).length > sourceCode.getCommentsInside(replacementNode).length) { - return null; - } - - // Don't autofix code such as `({foo: (foo) = a} = obj);`, parens are not allowed in shorthand properties. - if ( - replacementNode.type === "AssignmentPattern" && - astUtils.isParenthesised(sourceCode, replacementNode.left) - ) { - return null; - } - - return fixer.replaceText(node, sourceCode.getText(replacementNode)); - } - }); - } - - /** - * Checks whether a destructured assignment is unnecessarily renamed - * @param {ASTNode} node node to check - * @returns {void} - */ - function checkDestructured(node) { - if (ignoreDestructuring) { - return; - } - - for (const property of node.properties) { - - /** - * Properties using shorthand syntax and rest elements can not be renamed. - * If the property is computed, we have no idea if a rename is useless or not. - */ - if (property.type !== "Property" || property.shorthand || property.computed) { - continue; - } - - const key = (property.key.type === "Identifier" && property.key.name) || (property.key.type === "Literal" && property.key.value); - const renamedKey = property.value.type === "AssignmentPattern" ? property.value.left.name : property.value.name; - - if (key === renamedKey) { - reportError(property, property.key, "Destructuring assignment"); - } - } - } - - /** - * Checks whether an import is unnecessarily renamed - * @param {ASTNode} node node to check - * @returns {void} - */ - function checkImport(node) { - if (ignoreImport) { - return; - } - - if ( - node.imported.range[0] !== node.local.range[0] && - astUtils.getModuleExportName(node.imported) === node.local.name - ) { - reportError(node, node.imported, "Import"); - } - } - - /** - * Checks whether an export is unnecessarily renamed - * @param {ASTNode} node node to check - * @returns {void} - */ - function checkExport(node) { - if (ignoreExport) { - return; - } - - if ( - node.local.range[0] !== node.exported.range[0] && - astUtils.getModuleExportName(node.local) === astUtils.getModuleExportName(node.exported) - ) { - reportError(node, node.local, "Export"); - } - - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - ObjectPattern: checkDestructured, - ImportSpecifier: checkImport, - ExportSpecifier: checkExport - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-return.js b/node_modules/eslint/lib/rules/no-useless-return.js deleted file mode 100644 index db1ccae97..000000000 --- a/node_modules/eslint/lib/rules/no-useless-return.js +++ /dev/null @@ -1,305 +0,0 @@ -/** - * @fileoverview Disallow redundant return statements - * @author Teddy Katz - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"), - FixTracker = require("./utils/fix-tracker"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Removes the given element from the array. - * @param {Array} array The source array to remove. - * @param {any} element The target item to remove. - * @returns {void} - */ -function remove(array, element) { - const index = array.indexOf(element); - - if (index !== -1) { - array.splice(index, 1); - } -} - -/** - * Checks whether it can remove the given return statement or not. - * @param {ASTNode} node The return statement node to check. - * @returns {boolean} `true` if the node is removable. - */ -function isRemovable(node) { - return astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type); -} - -/** - * Checks whether the given return statement is in a `finally` block or not. - * @param {ASTNode} node The return statement node to check. - * @returns {boolean} `true` if the node is in a `finally` block. - */ -function isInFinally(node) { - for ( - let currentNode = node; - currentNode && currentNode.parent && !astUtils.isFunction(currentNode); - currentNode = currentNode.parent - ) { - if (currentNode.parent.type === "TryStatement" && currentNode.parent.finalizer === currentNode) { - return true; - } - } - - return false; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow redundant return statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-useless-return" - }, - - fixable: "code", - schema: [], - - messages: { - unnecessaryReturn: "Unnecessary return statement." - } - }, - - create(context) { - const segmentInfoMap = new WeakMap(); - const usedUnreachableSegments = new WeakSet(); - const sourceCode = context.sourceCode; - let scopeInfo = null; - - /** - * Checks whether the given segment is terminated by a return statement or not. - * @param {CodePathSegment} segment The segment to check. - * @returns {boolean} `true` if the segment is terminated by a return statement, or if it's still a part of unreachable. - */ - function isReturned(segment) { - const info = segmentInfoMap.get(segment); - - return !info || info.returned; - } - - /** - * Collects useless return statements from the given previous segments. - * - * A previous segment may be an unreachable segment. - * In that case, the information object of the unreachable segment is not - * initialized because `onCodePathSegmentStart` event is not notified for - * unreachable segments. - * This goes to the previous segments of the unreachable segment recursively - * if the unreachable segment was generated by a return statement. Otherwise, - * this ignores the unreachable segment. - * - * This behavior would simulate code paths for the case that the return - * statement does not exist. - * @param {ASTNode[]} uselessReturns The collected return statements. - * @param {CodePathSegment[]} prevSegments The previous segments to traverse. - * @param {WeakSet} [providedTraversedSegments] A set of segments that have already been traversed in this call - * @returns {ASTNode[]} `uselessReturns`. - */ - function getUselessReturns(uselessReturns, prevSegments, providedTraversedSegments) { - const traversedSegments = providedTraversedSegments || new WeakSet(); - - for (const segment of prevSegments) { - if (!segment.reachable) { - if (!traversedSegments.has(segment)) { - traversedSegments.add(segment); - getUselessReturns( - uselessReturns, - segment.allPrevSegments.filter(isReturned), - traversedSegments - ); - } - continue; - } - - uselessReturns.push(...segmentInfoMap.get(segment).uselessReturns); - } - - return uselessReturns; - } - - /** - * Removes the return statements on the given segment from the useless return - * statement list. - * - * This segment may be an unreachable segment. - * In that case, the information object of the unreachable segment is not - * initialized because `onCodePathSegmentStart` event is not notified for - * unreachable segments. - * This goes to the previous segments of the unreachable segment recursively - * if the unreachable segment was generated by a return statement. Otherwise, - * this ignores the unreachable segment. - * - * This behavior would simulate code paths for the case that the return - * statement does not exist. - * @param {CodePathSegment} segment The segment to get return statements. - * @returns {void} - */ - function markReturnStatementsOnSegmentAsUsed(segment) { - if (!segment.reachable) { - usedUnreachableSegments.add(segment); - segment.allPrevSegments - .filter(isReturned) - .filter(prevSegment => !usedUnreachableSegments.has(prevSegment)) - .forEach(markReturnStatementsOnSegmentAsUsed); - return; - } - - const info = segmentInfoMap.get(segment); - - for (const node of info.uselessReturns) { - remove(scopeInfo.uselessReturns, node); - } - info.uselessReturns = []; - } - - /** - * Removes the return statements on the current segments from the useless - * return statement list. - * - * This function will be called at every statement except FunctionDeclaration, - * BlockStatement, and BreakStatement. - * - * - FunctionDeclarations are always executed whether it's returned or not. - * - BlockStatements do nothing. - * - BreakStatements go the next merely. - * @returns {void} - */ - function markReturnStatementsOnCurrentSegmentsAsUsed() { - scopeInfo - .codePath - .currentSegments - .forEach(markReturnStatementsOnSegmentAsUsed); - } - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - - // Makes and pushes a new scope information. - onCodePathStart(codePath) { - scopeInfo = { - upper: scopeInfo, - uselessReturns: [], - codePath - }; - }, - - // Reports useless return statements if exist. - onCodePathEnd() { - for (const node of scopeInfo.uselessReturns) { - context.report({ - node, - loc: node.loc, - messageId: "unnecessaryReturn", - fix(fixer) { - if (isRemovable(node) && !sourceCode.getCommentsInside(node).length) { - - /* - * Extend the replacement range to include the - * entire function to avoid conflicting with - * no-else-return. - * https://github.com/eslint/eslint/issues/8026 - */ - return new FixTracker(fixer, sourceCode) - .retainEnclosingFunction(node) - .remove(node); - } - return null; - } - }); - } - - scopeInfo = scopeInfo.upper; - }, - - /* - * Initializes segments. - * NOTE: This event is notified for only reachable segments. - */ - onCodePathSegmentStart(segment) { - const info = { - uselessReturns: getUselessReturns([], segment.allPrevSegments), - returned: false - }; - - // Stores the info. - segmentInfoMap.set(segment, info); - }, - - // Adds ReturnStatement node to check whether it's useless or not. - ReturnStatement(node) { - if (node.argument) { - markReturnStatementsOnCurrentSegmentsAsUsed(); - } - if ( - node.argument || - astUtils.isInLoop(node) || - isInFinally(node) || - - // Ignore `return` statements in unreachable places (https://github.com/eslint/eslint/issues/11647). - !scopeInfo.codePath.currentSegments.some(s => s.reachable) - ) { - return; - } - - for (const segment of scopeInfo.codePath.currentSegments) { - const info = segmentInfoMap.get(segment); - - if (info) { - info.uselessReturns.push(node); - info.returned = true; - } - } - scopeInfo.uselessReturns.push(node); - }, - - /* - * Registers for all statement nodes except FunctionDeclaration, BlockStatement, BreakStatement. - * Removes return statements of the current segments from the useless return statement list. - */ - ClassDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, - ContinueStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - DebuggerStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - DoWhileStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - EmptyStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - ExpressionStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - ForInStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - ForOfStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - ForStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - IfStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - ImportDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, - LabeledStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - SwitchStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - ThrowStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - TryStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - VariableDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, - WhileStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - WithStatement: markReturnStatementsOnCurrentSegmentsAsUsed, - ExportNamedDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, - ExportDefaultDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, - ExportAllDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-var.js b/node_modules/eslint/lib/rules/no-var.js deleted file mode 100644 index d45a91a1d..000000000 --- a/node_modules/eslint/lib/rules/no-var.js +++ /dev/null @@ -1,334 +0,0 @@ -/** - * @fileoverview Rule to check for the usage of var. - * @author Jamund Ferguson - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Check whether a given variable is a global variable or not. - * @param {eslint-scope.Variable} variable The variable to check. - * @returns {boolean} `true` if the variable is a global variable. - */ -function isGlobal(variable) { - return Boolean(variable.scope) && variable.scope.type === "global"; -} - -/** - * Finds the nearest function scope or global scope walking up the scope - * hierarchy. - * @param {eslint-scope.Scope} scope The scope to traverse. - * @returns {eslint-scope.Scope} a function scope or global scope containing the given - * scope. - */ -function getEnclosingFunctionScope(scope) { - let currentScope = scope; - - while (currentScope.type !== "function" && currentScope.type !== "global") { - currentScope = currentScope.upper; - } - return currentScope; -} - -/** - * Checks whether the given variable has any references from a more specific - * function expression (i.e. a closure). - * @param {eslint-scope.Variable} variable A variable to check. - * @returns {boolean} `true` if the variable is used from a closure. - */ -function isReferencedInClosure(variable) { - const enclosingFunctionScope = getEnclosingFunctionScope(variable.scope); - - return variable.references.some(reference => - getEnclosingFunctionScope(reference.from) !== enclosingFunctionScope); -} - -/** - * Checks whether the given node is the assignee of a loop. - * @param {ASTNode} node A VariableDeclaration node to check. - * @returns {boolean} `true` if the declaration is assigned as part of loop - * iteration. - */ -function isLoopAssignee(node) { - return (node.parent.type === "ForOfStatement" || node.parent.type === "ForInStatement") && - node === node.parent.left; -} - -/** - * Checks whether the given variable declaration is immediately initialized. - * @param {ASTNode} node A VariableDeclaration node to check. - * @returns {boolean} `true` if the declaration has an initializer. - */ -function isDeclarationInitialized(node) { - return node.declarations.every(declarator => declarator.init !== null); -} - -const SCOPE_NODE_TYPE = /^(?:Program|BlockStatement|SwitchStatement|ForStatement|ForInStatement|ForOfStatement)$/u; - -/** - * Gets the scope node which directly contains a given node. - * @param {ASTNode} node A node to get. This is a `VariableDeclaration` or - * an `Identifier`. - * @returns {ASTNode} A scope node. This is one of `Program`, `BlockStatement`, - * `SwitchStatement`, `ForStatement`, `ForInStatement`, and - * `ForOfStatement`. - */ -function getScopeNode(node) { - for (let currentNode = node; currentNode; currentNode = currentNode.parent) { - if (SCOPE_NODE_TYPE.test(currentNode.type)) { - return currentNode; - } - } - - /* c8 ignore next */ - return null; -} - -/** - * Checks whether a given variable is redeclared or not. - * @param {eslint-scope.Variable} variable A variable to check. - * @returns {boolean} `true` if the variable is redeclared. - */ -function isRedeclared(variable) { - return variable.defs.length >= 2; -} - -/** - * Checks whether a given variable is used from outside of the specified scope. - * @param {ASTNode} scopeNode A scope node to check. - * @returns {Function} The predicate function which checks whether a given - * variable is used from outside of the specified scope. - */ -function isUsedFromOutsideOf(scopeNode) { - - /** - * Checks whether a given reference is inside of the specified scope or not. - * @param {eslint-scope.Reference} reference A reference to check. - * @returns {boolean} `true` if the reference is inside of the specified - * scope. - */ - function isOutsideOfScope(reference) { - const scope = scopeNode.range; - const id = reference.identifier.range; - - return id[0] < scope[0] || id[1] > scope[1]; - } - - return function(variable) { - return variable.references.some(isOutsideOfScope); - }; -} - -/** - * Creates the predicate function which checks whether a variable has their references in TDZ. - * - * The predicate function would return `true`: - * - * - if a reference is before the declarator. E.g. (var a = b, b = 1;)(var {a = b, b} = {};) - * - if a reference is in the expression of their default value. E.g. (var {a = a} = {};) - * - if a reference is in the expression of their initializer. E.g. (var a = a;) - * @param {ASTNode} node The initializer node of VariableDeclarator. - * @returns {Function} The predicate function. - * @private - */ -function hasReferenceInTDZ(node) { - const initStart = node.range[0]; - const initEnd = node.range[1]; - - return variable => { - const id = variable.defs[0].name; - const idStart = id.range[0]; - const defaultValue = (id.parent.type === "AssignmentPattern" ? id.parent.right : null); - const defaultStart = defaultValue && defaultValue.range[0]; - const defaultEnd = defaultValue && defaultValue.range[1]; - - return variable.references.some(reference => { - const start = reference.identifier.range[0]; - const end = reference.identifier.range[1]; - - return !reference.init && ( - start < idStart || - (defaultValue !== null && start >= defaultStart && end <= defaultEnd) || - (!astUtils.isFunction(node) && start >= initStart && end <= initEnd) - ); - }); - }; -} - -/** - * Checks whether a given variable has name that is allowed for 'var' declarations, - * but disallowed for `let` declarations. - * @param {eslint-scope.Variable} variable The variable to check. - * @returns {boolean} `true` if the variable has a disallowed name. - */ -function hasNameDisallowedForLetDeclarations(variable) { - return variable.name === "let"; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require `let` or `const` instead of `var`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-var" - }, - - schema: [], - fixable: "code", - - messages: { - unexpectedVar: "Unexpected var, use let or const instead." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Checks whether the variables which are defined by the given declarator node have their references in TDZ. - * @param {ASTNode} declarator The VariableDeclarator node to check. - * @returns {boolean} `true` if one of the variables which are defined by the given declarator node have their references in TDZ. - */ - function hasSelfReferenceInTDZ(declarator) { - if (!declarator.init) { - return false; - } - const variables = sourceCode.getDeclaredVariables(declarator); - - return variables.some(hasReferenceInTDZ(declarator.init)); - } - - /** - * Checks whether it can fix a given variable declaration or not. - * It cannot fix if the following cases: - * - * - A variable is a global variable. - * - A variable is declared on a SwitchCase node. - * - A variable is redeclared. - * - A variable is used from outside the scope. - * - A variable is used from a closure within a loop. - * - A variable might be used before it is assigned within a loop. - * - A variable might be used in TDZ. - * - A variable is declared in statement position (e.g. a single-line `IfStatement`) - * - A variable has name that is disallowed for `let` declarations. - * - * ## A variable is declared on a SwitchCase node. - * - * If this rule modifies 'var' declarations on a SwitchCase node, it - * would generate the warnings of 'no-case-declarations' rule. And the - * 'eslint:recommended' preset includes 'no-case-declarations' rule, so - * this rule doesn't modify those declarations. - * - * ## A variable is redeclared. - * - * The language spec disallows redeclarations of `let` declarations. - * Those variables would cause syntax errors. - * - * ## A variable is used from outside the scope. - * - * The language spec disallows accesses from outside of the scope for - * `let` declarations. Those variables would cause reference errors. - * - * ## A variable is used from a closure within a loop. - * - * A `var` declaration within a loop shares the same variable instance - * across all loop iterations, while a `let` declaration creates a new - * instance for each iteration. This means if a variable in a loop is - * referenced by any closure, changing it from `var` to `let` would - * change the behavior in a way that is generally unsafe. - * - * ## A variable might be used before it is assigned within a loop. - * - * Within a loop, a `let` declaration without an initializer will be - * initialized to null, while a `var` declaration will retain its value - * from the previous iteration, so it is only safe to change `var` to - * `let` if we can statically determine that the variable is always - * assigned a value before its first access in the loop body. To keep - * the implementation simple, we only convert `var` to `let` within - * loops when the variable is a loop assignee or the declaration has an - * initializer. - * @param {ASTNode} node A variable declaration node to check. - * @returns {boolean} `true` if it can fix the node. - */ - function canFix(node) { - const variables = sourceCode.getDeclaredVariables(node); - const scopeNode = getScopeNode(node); - - if (node.parent.type === "SwitchCase" || - node.declarations.some(hasSelfReferenceInTDZ) || - variables.some(isGlobal) || - variables.some(isRedeclared) || - variables.some(isUsedFromOutsideOf(scopeNode)) || - variables.some(hasNameDisallowedForLetDeclarations) - ) { - return false; - } - - if (astUtils.isInLoop(node)) { - if (variables.some(isReferencedInClosure)) { - return false; - } - if (!isLoopAssignee(node) && !isDeclarationInitialized(node)) { - return false; - } - } - - if ( - !isLoopAssignee(node) && - !(node.parent.type === "ForStatement" && node.parent.init === node) && - !astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type) - ) { - - // If the declaration is not in a block, e.g. `if (foo) var bar = 1;`, then it can't be fixed. - return false; - } - - return true; - } - - /** - * Reports a given variable declaration node. - * @param {ASTNode} node A variable declaration node to report. - * @returns {void} - */ - function report(node) { - context.report({ - node, - messageId: "unexpectedVar", - - fix(fixer) { - const varToken = sourceCode.getFirstToken(node, { filter: t => t.value === "var" }); - - return canFix(node) - ? fixer.replaceText(varToken, "let") - : null; - } - }); - } - - return { - "VariableDeclaration:exit"(node) { - if (node.kind === "var") { - report(node); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-void.js b/node_modules/eslint/lib/rules/no-void.js deleted file mode 100644 index 9546d7a62..000000000 --- a/node_modules/eslint/lib/rules/no-void.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @fileoverview Rule to disallow use of void operator. - * @author Mike Sidorov - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `void` operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-void" - }, - - messages: { - noVoid: "Expected 'undefined' and instead saw 'void'." - }, - - schema: [ - { - type: "object", - properties: { - allowAsStatement: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ] - }, - - create(context) { - const allowAsStatement = - context.options[0] && context.options[0].allowAsStatement; - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - 'UnaryExpression[operator="void"]'(node) { - if ( - allowAsStatement && - node.parent && - node.parent.type === "ExpressionStatement" - ) { - return; - } - context.report({ - node, - messageId: "noVoid" - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-warning-comments.js b/node_modules/eslint/lib/rules/no-warning-comments.js deleted file mode 100644 index c415bee7a..000000000 --- a/node_modules/eslint/lib/rules/no-warning-comments.js +++ /dev/null @@ -1,201 +0,0 @@ -/** - * @fileoverview Rule that warns about used warning comments - * @author Alexander Schmidt - */ - -"use strict"; - -const escapeRegExp = require("escape-string-regexp"); -const astUtils = require("./utils/ast-utils"); - -const CHAR_LIMIT = 40; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow specified warning terms in comments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-warning-comments" - }, - - schema: [ - { - type: "object", - properties: { - terms: { - type: "array", - items: { - type: "string" - } - }, - location: { - enum: ["start", "anywhere"] - }, - decoration: { - type: "array", - items: { - type: "string", - pattern: "^\\S$" - }, - minItems: 1, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedComment: "Unexpected '{{matchedTerm}}' comment: '{{comment}}'." - } - }, - - create(context) { - const sourceCode = context.sourceCode, - configuration = context.options[0] || {}, - warningTerms = configuration.terms || ["todo", "fixme", "xxx"], - location = configuration.location || "start", - decoration = [...configuration.decoration || []].join(""), - selfConfigRegEx = /\bno-warning-comments\b/u; - - /** - * Convert a warning term into a RegExp which will match a comment containing that whole word in the specified - * location ("start" or "anywhere"). If the term starts or ends with non word characters, then the match will not - * require word boundaries on that side. - * @param {string} term A term to convert to a RegExp - * @returns {RegExp} The term converted to a RegExp - */ - function convertToRegExp(term) { - const escaped = escapeRegExp(term); - const escapedDecoration = escapeRegExp(decoration); - - /* - * When matching at the start, ignore leading whitespace, and - * there's no need to worry about word boundaries. - * - * These expressions for the prefix and suffix are designed as follows: - * ^ handles any terms at the beginning of a comment. - * e.g. terms ["TODO"] matches `//TODO something` - * $ handles any terms at the end of a comment - * e.g. terms ["TODO"] matches `// something TODO` - * \b handles terms preceded/followed by word boundary - * e.g. terms: ["!FIX", "FIX!"] matches `// FIX!something` or `// something!FIX` - * terms: ["FIX"] matches `// FIX!` or `// !FIX`, but not `// fixed or affix` - * - * For location start: - * [\s]* handles optional leading spaces - * e.g. terms ["TODO"] matches `// TODO something` - * [\s\*]* (where "\*" is the escaped string of decoration) - * handles optional leading spaces or decoration characters (for "start" location only) - * e.g. terms ["TODO"] matches `/**** TODO something ... ` - */ - const wordBoundary = "\\b"; - - let prefix = ""; - - if (location === "start") { - prefix = `^[\\s${escapedDecoration}]*`; - } else if (/^\w/u.test(term)) { - prefix = wordBoundary; - } - - const suffix = /\w$/u.test(term) ? wordBoundary : ""; - const flags = "iu"; // Case-insensitive with Unicode case folding. - - /* - * For location "start", the typical regex is: - * /^[\s]*ESCAPED_TERM\b/iu. - * Or if decoration characters are specified (e.g. "*"), then any of - * those characters may appear in any order at the start: - * /^[\s\*]*ESCAPED_TERM\b/iu. - * - * For location "anywhere" the typical regex is - * /\bESCAPED_TERM\b/iu - * - * If it starts or ends with non-word character, the prefix and suffix are empty, respectively. - */ - return new RegExp(`${prefix}${escaped}${suffix}`, flags); - } - - const warningRegExps = warningTerms.map(convertToRegExp); - - /** - * Checks the specified comment for matches of the configured warning terms and returns the matches. - * @param {string} comment The comment which is checked. - * @returns {Array} All matched warning terms for this comment. - */ - function commentContainsWarningTerm(comment) { - const matches = []; - - warningRegExps.forEach((regex, index) => { - if (regex.test(comment)) { - matches.push(warningTerms[index]); - } - }); - - return matches; - } - - /** - * Checks the specified node for matching warning comments and reports them. - * @param {ASTNode} node The AST node being checked. - * @returns {void} undefined. - */ - function checkComment(node) { - const comment = node.value; - - if ( - astUtils.isDirectiveComment(node) && - selfConfigRegEx.test(comment) - ) { - return; - } - - const matches = commentContainsWarningTerm(comment); - - matches.forEach(matchedTerm => { - let commentToDisplay = ""; - let truncated = false; - - for (const c of comment.trim().split(/\s+/u)) { - const tmp = commentToDisplay ? `${commentToDisplay} ${c}` : c; - - if (tmp.length <= CHAR_LIMIT) { - commentToDisplay = tmp; - } else { - truncated = true; - break; - } - } - - context.report({ - node, - messageId: "unexpectedComment", - data: { - matchedTerm, - comment: `${commentToDisplay}${ - truncated ? "..." : "" - }` - } - }); - }); - } - - return { - Program() { - const comments = sourceCode.getAllComments(); - - comments - .filter(token => token.type !== "Shebang") - .forEach(checkComment); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-whitespace-before-property.js b/node_modules/eslint/lib/rules/no-whitespace-before-property.js deleted file mode 100644 index 1153314af..000000000 --- a/node_modules/eslint/lib/rules/no-whitespace-before-property.js +++ /dev/null @@ -1,113 +0,0 @@ -/** - * @fileoverview Rule to disallow whitespace before properties - * @author Kai Cataldo - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Disallow whitespace before properties", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-whitespace-before-property" - }, - - fixable: "whitespace", - schema: [], - - messages: { - unexpectedWhitespace: "Unexpected whitespace before property {{propName}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Reports whitespace before property token - * @param {ASTNode} node the node to report in the event of an error - * @param {Token} leftToken the left token - * @param {Token} rightToken the right token - * @returns {void} - * @private - */ - function reportError(node, leftToken, rightToken) { - context.report({ - node, - messageId: "unexpectedWhitespace", - data: { - propName: sourceCode.getText(node.property) - }, - fix(fixer) { - let replacementText = ""; - - if (!node.computed && !node.optional && astUtils.isDecimalInteger(node.object)) { - - /* - * If the object is a number literal, fixing it to something like 5.toString() would cause a SyntaxError. - * Don't fix this case. - */ - return null; - } - - // Don't fix if comments exist. - if (sourceCode.commentsExistBetween(leftToken, rightToken)) { - return null; - } - - if (node.optional) { - replacementText = "?."; - } else if (!node.computed) { - replacementText = "."; - } - - return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], replacementText); - } - }); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - MemberExpression(node) { - let rightToken; - let leftToken; - - if (!astUtils.isTokenOnSameLine(node.object, node.property)) { - return; - } - - if (node.computed) { - rightToken = sourceCode.getTokenBefore(node.property, astUtils.isOpeningBracketToken); - leftToken = sourceCode.getTokenBefore(rightToken, node.optional ? 1 : 0); - } else { - rightToken = sourceCode.getFirstToken(node.property); - leftToken = sourceCode.getTokenBefore(rightToken, 1); - } - - if (sourceCode.isSpaceBetweenTokens(leftToken, rightToken)) { - reportError(node, leftToken, rightToken); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-with.js b/node_modules/eslint/lib/rules/no-with.js deleted file mode 100644 index 0fb2c4519..000000000 --- a/node_modules/eslint/lib/rules/no-with.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @fileoverview Rule to flag use of with statement - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `with` statements", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-with" - }, - - schema: [], - - messages: { - unexpectedWith: "Unexpected use of 'with' statement." - } - }, - - create(context) { - - return { - WithStatement(node) { - context.report({ node, messageId: "unexpectedWith" }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/nonblock-statement-body-position.js b/node_modules/eslint/lib/rules/nonblock-statement-body-position.js deleted file mode 100644 index 1ea2770ce..000000000 --- a/node_modules/eslint/lib/rules/nonblock-statement-body-position.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * @fileoverview enforce the location of single-line statements - * @author Teddy Katz - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const POSITION_SCHEMA = { enum: ["beside", "below", "any"] }; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce the location of single-line statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/nonblock-statement-body-position" - }, - - fixable: "whitespace", - - schema: [ - POSITION_SCHEMA, - { - properties: { - overrides: { - properties: { - if: POSITION_SCHEMA, - else: POSITION_SCHEMA, - while: POSITION_SCHEMA, - do: POSITION_SCHEMA, - for: POSITION_SCHEMA - }, - additionalProperties: false - } - }, - additionalProperties: false - } - ], - - messages: { - expectNoLinebreak: "Expected no linebreak before this statement.", - expectLinebreak: "Expected a linebreak before this statement." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - //---------------------------------------------------------------------- - // Helpers - //---------------------------------------------------------------------- - - /** - * Gets the applicable preference for a particular keyword - * @param {string} keywordName The name of a keyword, e.g. 'if' - * @returns {string} The applicable option for the keyword, e.g. 'beside' - */ - function getOption(keywordName) { - return context.options[1] && context.options[1].overrides && context.options[1].overrides[keywordName] || - context.options[0] || - "beside"; - } - - /** - * Validates the location of a single-line statement - * @param {ASTNode} node The single-line statement - * @param {string} keywordName The applicable keyword name for the single-line statement - * @returns {void} - */ - function validateStatement(node, keywordName) { - const option = getOption(keywordName); - - if (node.type === "BlockStatement" || option === "any") { - return; - } - - const tokenBefore = sourceCode.getTokenBefore(node); - - if (tokenBefore.loc.end.line === node.loc.start.line && option === "below") { - context.report({ - node, - messageId: "expectLinebreak", - fix: fixer => fixer.insertTextBefore(node, "\n") - }); - } else if (tokenBefore.loc.end.line !== node.loc.start.line && option === "beside") { - context.report({ - node, - messageId: "expectNoLinebreak", - fix(fixer) { - if (sourceCode.getText().slice(tokenBefore.range[1], node.range[0]).trim()) { - return null; - } - return fixer.replaceTextRange([tokenBefore.range[1], node.range[0]], " "); - } - }); - } - } - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - IfStatement(node) { - validateStatement(node.consequent, "if"); - - // Check the `else` node, but don't check 'else if' statements. - if (node.alternate && node.alternate.type !== "IfStatement") { - validateStatement(node.alternate, "else"); - } - }, - WhileStatement: node => validateStatement(node.body, "while"), - DoWhileStatement: node => validateStatement(node.body, "do"), - ForStatement: node => validateStatement(node.body, "for"), - ForInStatement: node => validateStatement(node.body, "for"), - ForOfStatement: node => validateStatement(node.body, "for") - }; - } -}; diff --git a/node_modules/eslint/lib/rules/object-curly-newline.js b/node_modules/eslint/lib/rules/object-curly-newline.js deleted file mode 100644 index caf198231..000000000 --- a/node_modules/eslint/lib/rules/object-curly-newline.js +++ /dev/null @@ -1,321 +0,0 @@ -/** - * @fileoverview Rule to require or disallow line breaks inside braces. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -// Schema objects. -const OPTION_VALUE = { - oneOf: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - multiline: { - type: "boolean" - }, - minProperties: { - type: "integer", - minimum: 0 - }, - consistent: { - type: "boolean" - } - }, - additionalProperties: false, - minProperties: 1 - } - ] -}; - -/** - * Normalizes a given option value. - * @param {string|Object|undefined} value An option value to parse. - * @returns {{multiline: boolean, minProperties: number, consistent: boolean}} Normalized option object. - */ -function normalizeOptionValue(value) { - let multiline = false; - let minProperties = Number.POSITIVE_INFINITY; - let consistent = false; - - if (value) { - if (value === "always") { - minProperties = 0; - } else if (value === "never") { - minProperties = Number.POSITIVE_INFINITY; - } else { - multiline = Boolean(value.multiline); - minProperties = value.minProperties || Number.POSITIVE_INFINITY; - consistent = Boolean(value.consistent); - } - } else { - consistent = true; - } - - return { multiline, minProperties, consistent }; -} - -/** - * Checks if a value is an object. - * @param {any} value The value to check - * @returns {boolean} `true` if the value is an object, otherwise `false` - */ -function isObject(value) { - return typeof value === "object" && value !== null; -} - -/** - * Checks if an option is a node-specific option - * @param {any} option The option to check - * @returns {boolean} `true` if the option is node-specific, otherwise `false` - */ -function isNodeSpecificOption(option) { - return isObject(option) || typeof option === "string"; -} - -/** - * Normalizes a given option value. - * @param {string|Object|undefined} options An option value to parse. - * @returns {{ - * ObjectExpression: {multiline: boolean, minProperties: number, consistent: boolean}, - * ObjectPattern: {multiline: boolean, minProperties: number, consistent: boolean}, - * ImportDeclaration: {multiline: boolean, minProperties: number, consistent: boolean}, - * ExportNamedDeclaration : {multiline: boolean, minProperties: number, consistent: boolean} - * }} Normalized option object. - */ -function normalizeOptions(options) { - if (isObject(options) && Object.values(options).some(isNodeSpecificOption)) { - return { - ObjectExpression: normalizeOptionValue(options.ObjectExpression), - ObjectPattern: normalizeOptionValue(options.ObjectPattern), - ImportDeclaration: normalizeOptionValue(options.ImportDeclaration), - ExportNamedDeclaration: normalizeOptionValue(options.ExportDeclaration) - }; - } - - const value = normalizeOptionValue(options); - - return { ObjectExpression: value, ObjectPattern: value, ImportDeclaration: value, ExportNamedDeclaration: value }; -} - -/** - * Determines if ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration - * node needs to be checked for missing line breaks - * @param {ASTNode} node Node under inspection - * @param {Object} options option specific to node type - * @param {Token} first First object property - * @param {Token} last Last object property - * @returns {boolean} `true` if node needs to be checked for missing line breaks - */ -function areLineBreaksRequired(node, options, first, last) { - let objectProperties; - - if (node.type === "ObjectExpression" || node.type === "ObjectPattern") { - objectProperties = node.properties; - } else { - - // is ImportDeclaration or ExportNamedDeclaration - objectProperties = node.specifiers - .filter(s => s.type === "ImportSpecifier" || s.type === "ExportSpecifier"); - } - - return objectProperties.length >= options.minProperties || - ( - options.multiline && - objectProperties.length > 0 && - first.loc.start.line !== last.loc.end.line - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent line breaks after opening and before closing braces", - recommended: false, - url: "https://eslint.org/docs/latest/rules/object-curly-newline" - }, - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - OPTION_VALUE, - { - type: "object", - properties: { - ObjectExpression: OPTION_VALUE, - ObjectPattern: OPTION_VALUE, - ImportDeclaration: OPTION_VALUE, - ExportDeclaration: OPTION_VALUE - }, - additionalProperties: false, - minProperties: 1 - } - ] - } - ], - - messages: { - unexpectedLinebreakBeforeClosingBrace: "Unexpected line break before this closing brace.", - unexpectedLinebreakAfterOpeningBrace: "Unexpected line break after this opening brace.", - expectedLinebreakBeforeClosingBrace: "Expected a line break before this closing brace.", - expectedLinebreakAfterOpeningBrace: "Expected a line break after this opening brace." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const normalizedOptions = normalizeOptions(context.options[0]); - - /** - * Reports a given node if it violated this rule. - * @param {ASTNode} node A node to check. This is an ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration node. - * @returns {void} - */ - function check(node) { - const options = normalizedOptions[node.type]; - - if ( - (node.type === "ImportDeclaration" && - !node.specifiers.some(specifier => specifier.type === "ImportSpecifier")) || - (node.type === "ExportNamedDeclaration" && - !node.specifiers.some(specifier => specifier.type === "ExportSpecifier")) - ) { - return; - } - - const openBrace = sourceCode.getFirstToken(node, token => token.value === "{"); - - let closeBrace; - - if (node.typeAnnotation) { - closeBrace = sourceCode.getTokenBefore(node.typeAnnotation); - } else { - closeBrace = sourceCode.getLastToken(node, token => token.value === "}"); - } - - let first = sourceCode.getTokenAfter(openBrace, { includeComments: true }); - let last = sourceCode.getTokenBefore(closeBrace, { includeComments: true }); - - const needsLineBreaks = areLineBreaksRequired(node, options, first, last); - - const hasCommentsFirstToken = astUtils.isCommentToken(first); - const hasCommentsLastToken = astUtils.isCommentToken(last); - - /* - * Use tokens or comments to check multiline or not. - * But use only tokens to check whether line breaks are needed. - * This allows: - * var obj = { // eslint-disable-line foo - * a: 1 - * } - */ - first = sourceCode.getTokenAfter(openBrace); - last = sourceCode.getTokenBefore(closeBrace); - - if (needsLineBreaks) { - if (astUtils.isTokenOnSameLine(openBrace, first)) { - context.report({ - messageId: "expectedLinebreakAfterOpeningBrace", - node, - loc: openBrace.loc, - fix(fixer) { - if (hasCommentsFirstToken) { - return null; - } - - return fixer.insertTextAfter(openBrace, "\n"); - } - }); - } - if (astUtils.isTokenOnSameLine(last, closeBrace)) { - context.report({ - messageId: "expectedLinebreakBeforeClosingBrace", - node, - loc: closeBrace.loc, - fix(fixer) { - if (hasCommentsLastToken) { - return null; - } - - return fixer.insertTextBefore(closeBrace, "\n"); - } - }); - } - } else { - const consistent = options.consistent; - const hasLineBreakBetweenOpenBraceAndFirst = !astUtils.isTokenOnSameLine(openBrace, first); - const hasLineBreakBetweenCloseBraceAndLast = !astUtils.isTokenOnSameLine(last, closeBrace); - - if ( - (!consistent && hasLineBreakBetweenOpenBraceAndFirst) || - (consistent && hasLineBreakBetweenOpenBraceAndFirst && !hasLineBreakBetweenCloseBraceAndLast) - ) { - context.report({ - messageId: "unexpectedLinebreakAfterOpeningBrace", - node, - loc: openBrace.loc, - fix(fixer) { - if (hasCommentsFirstToken) { - return null; - } - - return fixer.removeRange([ - openBrace.range[1], - first.range[0] - ]); - } - }); - } - if ( - (!consistent && hasLineBreakBetweenCloseBraceAndLast) || - (consistent && !hasLineBreakBetweenOpenBraceAndFirst && hasLineBreakBetweenCloseBraceAndLast) - ) { - context.report({ - messageId: "unexpectedLinebreakBeforeClosingBrace", - node, - loc: closeBrace.loc, - fix(fixer) { - if (hasCommentsLastToken) { - return null; - } - - return fixer.removeRange([ - last.range[1], - closeBrace.range[0] - ]); - } - }); - } - } - } - - return { - ObjectExpression: check, - ObjectPattern: check, - ImportDeclaration: check, - ExportNamedDeclaration: check - }; - } -}; diff --git a/node_modules/eslint/lib/rules/object-curly-spacing.js b/node_modules/eslint/lib/rules/object-curly-spacing.js deleted file mode 100644 index 41ca428fe..000000000 --- a/node_modules/eslint/lib/rules/object-curly-spacing.js +++ /dev/null @@ -1,308 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside of object literals. - * @author Jamund Ferguson - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing inside braces", - recommended: false, - url: "https://eslint.org/docs/latest/rules/object-curly-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - arraysInObjects: { - type: "boolean" - }, - objectsInObjects: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - requireSpaceBefore: "A space is required before '{{token}}'.", - requireSpaceAfter: "A space is required after '{{token}}'.", - unexpectedSpaceBefore: "There should be no space before '{{token}}'.", - unexpectedSpaceAfter: "There should be no space after '{{token}}'." - } - }, - - create(context) { - const spaced = context.options[0] === "always", - sourceCode = context.sourceCode; - - /** - * Determines whether an option is set, relative to the spacing option. - * If spaced is "always", then check whether option is set to false. - * If spaced is "never", then check whether option is set to true. - * @param {Object} option The option to exclude. - * @returns {boolean} Whether or not the property is excluded. - */ - function isOptionSet(option) { - return context.options[1] ? context.options[1][option] === !spaced : false; - } - - const options = { - spaced, - arraysInObjectsException: isOptionSet("arraysInObjects"), - objectsInObjectsException: isOptionSet("objectsInObjects") - }; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportNoBeginningSpace(node, token) { - const nextToken = context.sourceCode.getTokenAfter(token, { includeComments: true }); - - context.report({ - node, - loc: { start: token.loc.end, end: nextToken.loc.start }, - messageId: "unexpectedSpaceAfter", - data: { - token: token.value - }, - fix(fixer) { - return fixer.removeRange([token.range[1], nextToken.range[0]]); - } - }); - } - - /** - * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportNoEndingSpace(node, token) { - const previousToken = context.sourceCode.getTokenBefore(token, { includeComments: true }); - - context.report({ - node, - loc: { start: previousToken.loc.end, end: token.loc.start }, - messageId: "unexpectedSpaceBefore", - data: { - token: token.value - }, - fix(fixer) { - return fixer.removeRange([previousToken.range[1], token.range[0]]); - } - }); - } - - /** - * Reports that there should be a space after the first token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportRequiredBeginningSpace(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "requireSpaceAfter", - data: { - token: token.value - }, - fix(fixer) { - return fixer.insertTextAfter(token, " "); - } - }); - } - - /** - * Reports that there should be a space before the last token - * @param {ASTNode} node The node to report in the event of an error. - * @param {Token} token The token to use for the report. - * @returns {void} - */ - function reportRequiredEndingSpace(node, token) { - context.report({ - node, - loc: token.loc, - messageId: "requireSpaceBefore", - data: { - token: token.value - }, - fix(fixer) { - return fixer.insertTextBefore(token, " "); - } - }); - } - - /** - * Determines if spacing in curly braces is valid. - * @param {ASTNode} node The AST node to check. - * @param {Token} first The first token to check (should be the opening brace) - * @param {Token} second The second token to check (should be first after the opening brace) - * @param {Token} penultimate The penultimate token to check (should be last before closing brace) - * @param {Token} last The last token to check (should be closing brace) - * @returns {void} - */ - function validateBraceSpacing(node, first, second, penultimate, last) { - if (astUtils.isTokenOnSameLine(first, second)) { - const firstSpaced = sourceCode.isSpaceBetweenTokens(first, second); - - if (options.spaced && !firstSpaced) { - reportRequiredBeginningSpace(node, first); - } - if (!options.spaced && firstSpaced && second.type !== "Line") { - reportNoBeginningSpace(node, first); - } - } - - if (astUtils.isTokenOnSameLine(penultimate, last)) { - const shouldCheckPenultimate = ( - options.arraysInObjectsException && astUtils.isClosingBracketToken(penultimate) || - options.objectsInObjectsException && astUtils.isClosingBraceToken(penultimate) - ); - const penultimateType = shouldCheckPenultimate && sourceCode.getNodeByRangeIndex(penultimate.range[0]).type; - - const closingCurlyBraceMustBeSpaced = ( - options.arraysInObjectsException && penultimateType === "ArrayExpression" || - options.objectsInObjectsException && (penultimateType === "ObjectExpression" || penultimateType === "ObjectPattern") - ) ? !options.spaced : options.spaced; - - const lastSpaced = sourceCode.isSpaceBetweenTokens(penultimate, last); - - if (closingCurlyBraceMustBeSpaced && !lastSpaced) { - reportRequiredEndingSpace(node, last); - } - if (!closingCurlyBraceMustBeSpaced && lastSpaced) { - reportNoEndingSpace(node, last); - } - } - } - - /** - * Gets '}' token of an object node. - * - * Because the last token of object patterns might be a type annotation, - * this traverses tokens preceded by the last property, then returns the - * first '}' token. - * @param {ASTNode} node The node to get. This node is an - * ObjectExpression or an ObjectPattern. And this node has one or - * more properties. - * @returns {Token} '}' token. - */ - function getClosingBraceOfObject(node) { - const lastProperty = node.properties[node.properties.length - 1]; - - return sourceCode.getTokenAfter(lastProperty, astUtils.isClosingBraceToken); - } - - /** - * Reports a given object node if spacing in curly braces is invalid. - * @param {ASTNode} node An ObjectExpression or ObjectPattern node to check. - * @returns {void} - */ - function checkForObject(node) { - if (node.properties.length === 0) { - return; - } - - const first = sourceCode.getFirstToken(node), - last = getClosingBraceOfObject(node), - second = sourceCode.getTokenAfter(first, { includeComments: true }), - penultimate = sourceCode.getTokenBefore(last, { includeComments: true }); - - validateBraceSpacing(node, first, second, penultimate, last); - } - - /** - * Reports a given import node if spacing in curly braces is invalid. - * @param {ASTNode} node An ImportDeclaration node to check. - * @returns {void} - */ - function checkForImport(node) { - if (node.specifiers.length === 0) { - return; - } - - let firstSpecifier = node.specifiers[0]; - const lastSpecifier = node.specifiers[node.specifiers.length - 1]; - - if (lastSpecifier.type !== "ImportSpecifier") { - return; - } - if (firstSpecifier.type !== "ImportSpecifier") { - firstSpecifier = node.specifiers[1]; - } - - const first = sourceCode.getTokenBefore(firstSpecifier), - last = sourceCode.getTokenAfter(lastSpecifier, astUtils.isNotCommaToken), - second = sourceCode.getTokenAfter(first, { includeComments: true }), - penultimate = sourceCode.getTokenBefore(last, { includeComments: true }); - - validateBraceSpacing(node, first, second, penultimate, last); - } - - /** - * Reports a given export node if spacing in curly braces is invalid. - * @param {ASTNode} node An ExportNamedDeclaration node to check. - * @returns {void} - */ - function checkForExport(node) { - if (node.specifiers.length === 0) { - return; - } - - const firstSpecifier = node.specifiers[0], - lastSpecifier = node.specifiers[node.specifiers.length - 1], - first = sourceCode.getTokenBefore(firstSpecifier), - last = sourceCode.getTokenAfter(lastSpecifier, astUtils.isNotCommaToken), - second = sourceCode.getTokenAfter(first, { includeComments: true }), - penultimate = sourceCode.getTokenBefore(last, { includeComments: true }); - - validateBraceSpacing(node, first, second, penultimate, last); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - // var {x} = y; - ObjectPattern: checkForObject, - - // var y = {x: 'y'} - ObjectExpression: checkForObject, - - // import {y} from 'x'; - ImportDeclaration: checkForImport, - - // export {name} from 'yo'; - ExportNamedDeclaration: checkForExport - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/object-property-newline.js b/node_modules/eslint/lib/rules/object-property-newline.js deleted file mode 100644 index deca9b555..000000000 --- a/node_modules/eslint/lib/rules/object-property-newline.js +++ /dev/null @@ -1,99 +0,0 @@ -/** - * @fileoverview Rule to enforce placing object properties on separate lines. - * @author Vitor Balocco - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce placing object properties on separate lines", - recommended: false, - url: "https://eslint.org/docs/latest/rules/object-property-newline" - }, - - schema: [ - { - type: "object", - properties: { - allowAllPropertiesOnSameLine: { - type: "boolean", - default: false - }, - allowMultiplePropertiesPerLine: { // Deprecated - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - fixable: "whitespace", - - messages: { - propertiesOnNewlineAll: "Object properties must go on a new line if they aren't all on the same line.", - propertiesOnNewline: "Object properties must go on a new line." - } - }, - - create(context) { - const allowSameLine = context.options[0] && ( - (context.options[0].allowAllPropertiesOnSameLine || context.options[0].allowMultiplePropertiesPerLine /* Deprecated */) - ); - const messageId = allowSameLine - ? "propertiesOnNewlineAll" - : "propertiesOnNewline"; - - const sourceCode = context.sourceCode; - - return { - ObjectExpression(node) { - if (allowSameLine) { - if (node.properties.length > 1) { - const firstTokenOfFirstProperty = sourceCode.getFirstToken(node.properties[0]); - const lastTokenOfLastProperty = sourceCode.getLastToken(node.properties[node.properties.length - 1]); - - if (firstTokenOfFirstProperty.loc.end.line === lastTokenOfLastProperty.loc.start.line) { - - // All keys and values are on the same line - return; - } - } - } - - for (let i = 1; i < node.properties.length; i++) { - const lastTokenOfPreviousProperty = sourceCode.getLastToken(node.properties[i - 1]); - const firstTokenOfCurrentProperty = sourceCode.getFirstToken(node.properties[i]); - - if (lastTokenOfPreviousProperty.loc.end.line === firstTokenOfCurrentProperty.loc.start.line) { - context.report({ - node, - loc: firstTokenOfCurrentProperty.loc, - messageId, - fix(fixer) { - const comma = sourceCode.getTokenBefore(firstTokenOfCurrentProperty); - const rangeAfterComma = [comma.range[1], firstTokenOfCurrentProperty.range[0]]; - - // Don't perform a fix if there are any comments between the comma and the next property. - if (sourceCode.text.slice(rangeAfterComma[0], rangeAfterComma[1]).trim()) { - return null; - } - - return fixer.replaceTextRange(rangeAfterComma, "\n"); - } - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/object-shorthand.js b/node_modules/eslint/lib/rules/object-shorthand.js deleted file mode 100644 index e4cb3a445..000000000 --- a/node_modules/eslint/lib/rules/object-shorthand.js +++ /dev/null @@ -1,520 +0,0 @@ -/** - * @fileoverview Rule to enforce concise object methods and properties. - * @author Jamund Ferguson - */ - -"use strict"; - -const OPTIONS = { - always: "always", - never: "never", - methods: "methods", - properties: "properties", - consistent: "consistent", - consistentAsNeeded: "consistent-as-needed" -}; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require or disallow method and property shorthand syntax for object literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/object-shorthand" - }, - - fixable: "code", - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["always", "methods", "properties", "never", "consistent", "consistent-as-needed"] - } - ], - minItems: 0, - maxItems: 1 - }, - { - type: "array", - items: [ - { - enum: ["always", "methods", "properties"] - }, - { - type: "object", - properties: { - avoidQuotes: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - }, - { - type: "array", - items: [ - { - enum: ["always", "methods"] - }, - { - type: "object", - properties: { - ignoreConstructors: { - type: "boolean" - }, - methodsIgnorePattern: { - type: "string" - }, - avoidQuotes: { - type: "boolean" - }, - avoidExplicitReturnArrows: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - } - ] - }, - - messages: { - expectedAllPropertiesShorthanded: "Expected shorthand for all properties.", - expectedLiteralMethodLongform: "Expected longform method syntax for string literal keys.", - expectedPropertyShorthand: "Expected property shorthand.", - expectedPropertyLongform: "Expected longform property syntax.", - expectedMethodShorthand: "Expected method shorthand.", - expectedMethodLongform: "Expected longform method syntax.", - unexpectedMix: "Unexpected mix of shorthand and non-shorthand properties." - } - }, - - create(context) { - const APPLY = context.options[0] || OPTIONS.always; - const APPLY_TO_METHODS = APPLY === OPTIONS.methods || APPLY === OPTIONS.always; - const APPLY_TO_PROPS = APPLY === OPTIONS.properties || APPLY === OPTIONS.always; - const APPLY_NEVER = APPLY === OPTIONS.never; - const APPLY_CONSISTENT = APPLY === OPTIONS.consistent; - const APPLY_CONSISTENT_AS_NEEDED = APPLY === OPTIONS.consistentAsNeeded; - - const PARAMS = context.options[1] || {}; - const IGNORE_CONSTRUCTORS = PARAMS.ignoreConstructors; - const METHODS_IGNORE_PATTERN = PARAMS.methodsIgnorePattern - ? new RegExp(PARAMS.methodsIgnorePattern, "u") - : null; - const AVOID_QUOTES = PARAMS.avoidQuotes; - const AVOID_EXPLICIT_RETURN_ARROWS = !!PARAMS.avoidExplicitReturnArrows; - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - const CTOR_PREFIX_REGEX = /[^_$0-9]/u; - - /** - * Determines if the first character of the name is a capital letter. - * @param {string} name The name of the node to evaluate. - * @returns {boolean} True if the first character of the property name is a capital letter, false if not. - * @private - */ - function isConstructor(name) { - const match = CTOR_PREFIX_REGEX.exec(name); - - // Not a constructor if name has no characters apart from '_', '$' and digits e.g. '_', '$$', '_8' - if (!match) { - return false; - } - - const firstChar = name.charAt(match.index); - - return firstChar === firstChar.toUpperCase(); - } - - /** - * Determines if the property can have a shorthand form. - * @param {ASTNode} property Property AST node - * @returns {boolean} True if the property can have a shorthand form - * @private - */ - function canHaveShorthand(property) { - return (property.kind !== "set" && property.kind !== "get" && property.type !== "SpreadElement" && property.type !== "SpreadProperty" && property.type !== "ExperimentalSpreadProperty"); - } - - /** - * Checks whether a node is a string literal. - * @param {ASTNode} node Any AST node. - * @returns {boolean} `true` if it is a string literal. - */ - function isStringLiteral(node) { - return node.type === "Literal" && typeof node.value === "string"; - } - - /** - * Determines if the property is a shorthand or not. - * @param {ASTNode} property Property AST node - * @returns {boolean} True if the property is considered shorthand, false if not. - * @private - */ - function isShorthand(property) { - - // property.method is true when `{a(){}}`. - return (property.shorthand || property.method); - } - - /** - * Determines if the property's key and method or value are named equally. - * @param {ASTNode} property Property AST node - * @returns {boolean} True if the key and value are named equally, false if not. - * @private - */ - function isRedundant(property) { - const value = property.value; - - if (value.type === "FunctionExpression") { - return !value.id; // Only anonymous should be shorthand method. - } - if (value.type === "Identifier") { - return astUtils.getStaticPropertyName(property) === value.name; - } - - return false; - } - - /** - * Ensures that an object's properties are consistently shorthand, or not shorthand at all. - * @param {ASTNode} node Property AST node - * @param {boolean} checkRedundancy Whether to check longform redundancy - * @returns {void} - */ - function checkConsistency(node, checkRedundancy) { - - // We are excluding getters/setters and spread properties as they are considered neither longform nor shorthand. - const properties = node.properties.filter(canHaveShorthand); - - // Do we still have properties left after filtering the getters and setters? - if (properties.length > 0) { - const shorthandProperties = properties.filter(isShorthand); - - /* - * If we do not have an equal number of longform properties as - * shorthand properties, we are using the annotations inconsistently - */ - if (shorthandProperties.length !== properties.length) { - - // We have at least 1 shorthand property - if (shorthandProperties.length > 0) { - context.report({ node, messageId: "unexpectedMix" }); - } else if (checkRedundancy) { - - /* - * If all properties of the object contain a method or value with a name matching it's key, - * all the keys are redundant. - */ - const canAlwaysUseShorthand = properties.every(isRedundant); - - if (canAlwaysUseShorthand) { - context.report({ node, messageId: "expectedAllPropertiesShorthanded" }); - } - } - } - } - } - - /** - * Fixes a FunctionExpression node by making it into a shorthand property. - * @param {SourceCodeFixer} fixer The fixer object - * @param {ASTNode} node A `Property` node that has a `FunctionExpression` or `ArrowFunctionExpression` as its value - * @returns {Object} A fix for this node - */ - function makeFunctionShorthand(fixer, node) { - const firstKeyToken = node.computed - ? sourceCode.getFirstToken(node, astUtils.isOpeningBracketToken) - : sourceCode.getFirstToken(node.key); - const lastKeyToken = node.computed - ? sourceCode.getFirstTokenBetween(node.key, node.value, astUtils.isClosingBracketToken) - : sourceCode.getLastToken(node.key); - const keyText = sourceCode.text.slice(firstKeyToken.range[0], lastKeyToken.range[1]); - let keyPrefix = ""; - - // key: /* */ () => {} - if (sourceCode.commentsExistBetween(lastKeyToken, node.value)) { - return null; - } - - if (node.value.async) { - keyPrefix += "async "; - } - if (node.value.generator) { - keyPrefix += "*"; - } - - const fixRange = [firstKeyToken.range[0], node.range[1]]; - const methodPrefix = keyPrefix + keyText; - - if (node.value.type === "FunctionExpression") { - const functionToken = sourceCode.getTokens(node.value).find(token => token.type === "Keyword" && token.value === "function"); - const tokenBeforeParams = node.value.generator ? sourceCode.getTokenAfter(functionToken) : functionToken; - - return fixer.replaceTextRange( - fixRange, - methodPrefix + sourceCode.text.slice(tokenBeforeParams.range[1], node.value.range[1]) - ); - } - - const arrowToken = sourceCode.getTokenBefore(node.value.body, astUtils.isArrowToken); - const fnBody = sourceCode.text.slice(arrowToken.range[1], node.value.range[1]); - - let shouldAddParensAroundParameters = false; - let tokenBeforeParams; - - if (node.value.params.length === 0) { - tokenBeforeParams = sourceCode.getFirstToken(node.value, astUtils.isOpeningParenToken); - } else { - tokenBeforeParams = sourceCode.getTokenBefore(node.value.params[0]); - } - - if (node.value.params.length === 1) { - const hasParen = astUtils.isOpeningParenToken(tokenBeforeParams); - const isTokenOutsideNode = tokenBeforeParams.range[0] < node.range[0]; - - shouldAddParensAroundParameters = !hasParen || isTokenOutsideNode; - } - - const sliceStart = shouldAddParensAroundParameters - ? node.value.params[0].range[0] - : tokenBeforeParams.range[0]; - const sliceEnd = sourceCode.getTokenBefore(arrowToken).range[1]; - - const oldParamText = sourceCode.text.slice(sliceStart, sliceEnd); - const newParamText = shouldAddParensAroundParameters ? `(${oldParamText})` : oldParamText; - - return fixer.replaceTextRange( - fixRange, - methodPrefix + newParamText + fnBody - ); - - } - - /** - * Fixes a FunctionExpression node by making it into a longform property. - * @param {SourceCodeFixer} fixer The fixer object - * @param {ASTNode} node A `Property` node that has a `FunctionExpression` as its value - * @returns {Object} A fix for this node - */ - function makeFunctionLongform(fixer, node) { - const firstKeyToken = node.computed ? sourceCode.getTokens(node).find(token => token.value === "[") : sourceCode.getFirstToken(node.key); - const lastKeyToken = node.computed ? sourceCode.getTokensBetween(node.key, node.value).find(token => token.value === "]") : sourceCode.getLastToken(node.key); - const keyText = sourceCode.text.slice(firstKeyToken.range[0], lastKeyToken.range[1]); - let functionHeader = "function"; - - if (node.value.async) { - functionHeader = `async ${functionHeader}`; - } - if (node.value.generator) { - functionHeader = `${functionHeader}*`; - } - - return fixer.replaceTextRange([node.range[0], lastKeyToken.range[1]], `${keyText}: ${functionHeader}`); - } - - /* - * To determine whether a given arrow function has a lexical identifier (`this`, `arguments`, `super`, or `new.target`), - * create a stack of functions that define these identifiers (i.e. all functions except arrow functions) as the AST is - * traversed. Whenever a new function is encountered, create a new entry on the stack (corresponding to a different lexical - * scope of `this`), and whenever a function is exited, pop that entry off the stack. When an arrow function is entered, - * keep a reference to it on the current stack entry, and remove that reference when the arrow function is exited. - * When a lexical identifier is encountered, mark all the arrow functions on the current stack entry by adding them - * to an `arrowsWithLexicalIdentifiers` set. Any arrow function in that set will not be reported by this rule, - * because converting it into a method would change the value of one of the lexical identifiers. - */ - const lexicalScopeStack = []; - const arrowsWithLexicalIdentifiers = new WeakSet(); - const argumentsIdentifiers = new WeakSet(); - - /** - * Enters a function. This creates a new lexical identifier scope, so a new Set of arrow functions is pushed onto the stack. - * Also, this marks all `arguments` identifiers so that they can be detected later. - * @param {ASTNode} node The node representing the function. - * @returns {void} - */ - function enterFunction(node) { - lexicalScopeStack.unshift(new Set()); - sourceCode.getScope(node).variables.filter(variable => variable.name === "arguments").forEach(variable => { - variable.references.map(ref => ref.identifier).forEach(identifier => argumentsIdentifiers.add(identifier)); - }); - } - - /** - * Exits a function. This pops the current set of arrow functions off the lexical scope stack. - * @returns {void} - */ - function exitFunction() { - lexicalScopeStack.shift(); - } - - /** - * Marks the current function as having a lexical keyword. This implies that all arrow functions - * in the current lexical scope contain a reference to this lexical keyword. - * @returns {void} - */ - function reportLexicalIdentifier() { - lexicalScopeStack[0].forEach(arrowFunction => arrowsWithLexicalIdentifiers.add(arrowFunction)); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - Program: enterFunction, - FunctionDeclaration: enterFunction, - FunctionExpression: enterFunction, - "Program:exit": exitFunction, - "FunctionDeclaration:exit": exitFunction, - "FunctionExpression:exit": exitFunction, - - ArrowFunctionExpression(node) { - lexicalScopeStack[0].add(node); - }, - "ArrowFunctionExpression:exit"(node) { - lexicalScopeStack[0].delete(node); - }, - - ThisExpression: reportLexicalIdentifier, - Super: reportLexicalIdentifier, - MetaProperty(node) { - if (node.meta.name === "new" && node.property.name === "target") { - reportLexicalIdentifier(); - } - }, - Identifier(node) { - if (argumentsIdentifiers.has(node)) { - reportLexicalIdentifier(); - } - }, - - ObjectExpression(node) { - if (APPLY_CONSISTENT) { - checkConsistency(node, false); - } else if (APPLY_CONSISTENT_AS_NEEDED) { - checkConsistency(node, true); - } - }, - - "Property:exit"(node) { - const isConciseProperty = node.method || node.shorthand; - - // Ignore destructuring assignment - if (node.parent.type === "ObjectPattern") { - return; - } - - // getters and setters are ignored - if (node.kind === "get" || node.kind === "set") { - return; - } - - // only computed methods can fail the following checks - if (node.computed && node.value.type !== "FunctionExpression" && node.value.type !== "ArrowFunctionExpression") { - return; - } - - //-------------------------------------------------------------- - // Checks for property/method shorthand. - if (isConciseProperty) { - if (node.method && (APPLY_NEVER || AVOID_QUOTES && isStringLiteral(node.key))) { - const messageId = APPLY_NEVER ? "expectedMethodLongform" : "expectedLiteralMethodLongform"; - - // { x() {} } should be written as { x: function() {} } - context.report({ - node, - messageId, - fix: fixer => makeFunctionLongform(fixer, node) - }); - } else if (APPLY_NEVER) { - - // { x } should be written as { x: x } - context.report({ - node, - messageId: "expectedPropertyLongform", - fix: fixer => fixer.insertTextAfter(node.key, `: ${node.key.name}`) - }); - } - } else if (APPLY_TO_METHODS && !node.value.id && (node.value.type === "FunctionExpression" || node.value.type === "ArrowFunctionExpression")) { - if (IGNORE_CONSTRUCTORS && node.key.type === "Identifier" && isConstructor(node.key.name)) { - return; - } - - if (METHODS_IGNORE_PATTERN) { - const propertyName = astUtils.getStaticPropertyName(node); - - if (propertyName !== null && METHODS_IGNORE_PATTERN.test(propertyName)) { - return; - } - } - - if (AVOID_QUOTES && isStringLiteral(node.key)) { - return; - } - - // {[x]: function(){}} should be written as {[x]() {}} - if (node.value.type === "FunctionExpression" || - node.value.type === "ArrowFunctionExpression" && - node.value.body.type === "BlockStatement" && - AVOID_EXPLICIT_RETURN_ARROWS && - !arrowsWithLexicalIdentifiers.has(node.value) - ) { - context.report({ - node, - messageId: "expectedMethodShorthand", - fix: fixer => makeFunctionShorthand(fixer, node) - }); - } - } else if (node.value.type === "Identifier" && node.key.name === node.value.name && APPLY_TO_PROPS) { - - // {x: x} should be written as {x} - context.report({ - node, - messageId: "expectedPropertyShorthand", - fix(fixer) { - return fixer.replaceText(node, node.value.name); - } - }); - } else if (node.value.type === "Identifier" && node.key.type === "Literal" && node.key.value === node.value.name && APPLY_TO_PROPS) { - if (AVOID_QUOTES) { - return; - } - - // {"x": x} should be written as {x} - context.report({ - node, - messageId: "expectedPropertyShorthand", - fix(fixer) { - return fixer.replaceText(node, node.value.name); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/one-var-declaration-per-line.js b/node_modules/eslint/lib/rules/one-var-declaration-per-line.js deleted file mode 100644 index b1e045b0d..000000000 --- a/node_modules/eslint/lib/rules/one-var-declaration-per-line.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @fileoverview Rule to check multiple var declarations per line - * @author Alberto Rodríguez - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require or disallow newlines around variable declarations", - recommended: false, - url: "https://eslint.org/docs/latest/rules/one-var-declaration-per-line" - }, - - schema: [ - { - enum: ["always", "initializations"] - } - ], - - fixable: "whitespace", - - messages: { - expectVarOnNewline: "Expected variable declaration to be on a new line." - } - }, - - create(context) { - - const always = context.options[0] === "always"; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - - /** - * Determine if provided keyword is a variant of for specifiers - * @private - * @param {string} keyword keyword to test - * @returns {boolean} True if `keyword` is a variant of for specifier - */ - function isForTypeSpecifier(keyword) { - return keyword === "ForStatement" || keyword === "ForInStatement" || keyword === "ForOfStatement"; - } - - /** - * Checks newlines around variable declarations. - * @private - * @param {ASTNode} node `VariableDeclaration` node to test - * @returns {void} - */ - function checkForNewLine(node) { - if (isForTypeSpecifier(node.parent.type)) { - return; - } - - const declarations = node.declarations; - let prev; - - declarations.forEach(current => { - if (prev && prev.loc.end.line === current.loc.start.line) { - if (always || prev.init || current.init) { - context.report({ - node, - messageId: "expectVarOnNewline", - loc: current.loc, - fix: fixer => fixer.insertTextBefore(current, "\n") - }); - } - } - prev = current; - }); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - VariableDeclaration: checkForNewLine - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/one-var.js b/node_modules/eslint/lib/rules/one-var.js deleted file mode 100644 index abb1525b1..000000000 --- a/node_modules/eslint/lib/rules/one-var.js +++ /dev/null @@ -1,567 +0,0 @@ -/** - * @fileoverview A rule to control the use of single variable declarations. - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines whether the given node is in a statement list. - * @param {ASTNode} node node to check - * @returns {boolean} `true` if the given node is in a statement list - */ -function isInStatementList(node) { - return astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce variables to be declared either together or separately in functions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/one-var" - }, - - fixable: "code", - - schema: [ - { - oneOf: [ - { - enum: ["always", "never", "consecutive"] - }, - { - type: "object", - properties: { - separateRequires: { - type: "boolean" - }, - var: { - enum: ["always", "never", "consecutive"] - }, - let: { - enum: ["always", "never", "consecutive"] - }, - const: { - enum: ["always", "never", "consecutive"] - } - }, - additionalProperties: false - }, - { - type: "object", - properties: { - initialized: { - enum: ["always", "never", "consecutive"] - }, - uninitialized: { - enum: ["always", "never", "consecutive"] - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - combineUninitialized: "Combine this with the previous '{{type}}' statement with uninitialized variables.", - combineInitialized: "Combine this with the previous '{{type}}' statement with initialized variables.", - splitUninitialized: "Split uninitialized '{{type}}' declarations into multiple statements.", - splitInitialized: "Split initialized '{{type}}' declarations into multiple statements.", - splitRequires: "Split requires to be separated into a single block.", - combine: "Combine this with the previous '{{type}}' statement.", - split: "Split '{{type}}' declarations into multiple statements." - } - }, - - create(context) { - const MODE_ALWAYS = "always"; - const MODE_NEVER = "never"; - const MODE_CONSECUTIVE = "consecutive"; - const mode = context.options[0] || MODE_ALWAYS; - - const options = {}; - - if (typeof mode === "string") { // simple options configuration with just a string - options.var = { uninitialized: mode, initialized: mode }; - options.let = { uninitialized: mode, initialized: mode }; - options.const = { uninitialized: mode, initialized: mode }; - } else if (typeof mode === "object") { // options configuration is an object - options.separateRequires = !!mode.separateRequires; - options.var = { uninitialized: mode.var, initialized: mode.var }; - options.let = { uninitialized: mode.let, initialized: mode.let }; - options.const = { uninitialized: mode.const, initialized: mode.const }; - if (Object.prototype.hasOwnProperty.call(mode, "uninitialized")) { - options.var.uninitialized = mode.uninitialized; - options.let.uninitialized = mode.uninitialized; - options.const.uninitialized = mode.uninitialized; - } - if (Object.prototype.hasOwnProperty.call(mode, "initialized")) { - options.var.initialized = mode.initialized; - options.let.initialized = mode.initialized; - options.const.initialized = mode.initialized; - } - } - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - const functionStack = []; - const blockStack = []; - - /** - * Increments the blockStack counter. - * @returns {void} - * @private - */ - function startBlock() { - blockStack.push({ - let: { initialized: false, uninitialized: false }, - const: { initialized: false, uninitialized: false } - }); - } - - /** - * Increments the functionStack counter. - * @returns {void} - * @private - */ - function startFunction() { - functionStack.push({ initialized: false, uninitialized: false }); - startBlock(); - } - - /** - * Decrements the blockStack counter. - * @returns {void} - * @private - */ - function endBlock() { - blockStack.pop(); - } - - /** - * Decrements the functionStack counter. - * @returns {void} - * @private - */ - function endFunction() { - functionStack.pop(); - endBlock(); - } - - /** - * Check if a variable declaration is a require. - * @param {ASTNode} decl variable declaration Node - * @returns {bool} if decl is a require, return true; else return false. - * @private - */ - function isRequire(decl) { - return decl.init && decl.init.type === "CallExpression" && decl.init.callee.name === "require"; - } - - /** - * Records whether initialized/uninitialized/required variables are defined in current scope. - * @param {string} statementType node.kind, one of: "var", "let", or "const" - * @param {ASTNode[]} declarations List of declarations - * @param {Object} currentScope The scope being investigated - * @returns {void} - * @private - */ - function recordTypes(statementType, declarations, currentScope) { - for (let i = 0; i < declarations.length; i++) { - if (declarations[i].init === null) { - if (options[statementType] && options[statementType].uninitialized === MODE_ALWAYS) { - currentScope.uninitialized = true; - } - } else { - if (options[statementType] && options[statementType].initialized === MODE_ALWAYS) { - if (options.separateRequires && isRequire(declarations[i])) { - currentScope.required = true; - } else { - currentScope.initialized = true; - } - } - } - } - } - - /** - * Determines the current scope (function or block) - * @param {string} statementType node.kind, one of: "var", "let", or "const" - * @returns {Object} The scope associated with statementType - */ - function getCurrentScope(statementType) { - let currentScope; - - if (statementType === "var") { - currentScope = functionStack[functionStack.length - 1]; - } else if (statementType === "let") { - currentScope = blockStack[blockStack.length - 1].let; - } else if (statementType === "const") { - currentScope = blockStack[blockStack.length - 1].const; - } - return currentScope; - } - - /** - * Counts the number of initialized and uninitialized declarations in a list of declarations - * @param {ASTNode[]} declarations List of declarations - * @returns {Object} Counts of 'uninitialized' and 'initialized' declarations - * @private - */ - function countDeclarations(declarations) { - const counts = { uninitialized: 0, initialized: 0 }; - - for (let i = 0; i < declarations.length; i++) { - if (declarations[i].init === null) { - counts.uninitialized++; - } else { - counts.initialized++; - } - } - return counts; - } - - /** - * Determines if there is more than one var statement in the current scope. - * @param {string} statementType node.kind, one of: "var", "let", or "const" - * @param {ASTNode[]} declarations List of declarations - * @returns {boolean} Returns true if it is the first var declaration, false if not. - * @private - */ - function hasOnlyOneStatement(statementType, declarations) { - - const declarationCounts = countDeclarations(declarations); - const currentOptions = options[statementType] || {}; - const currentScope = getCurrentScope(statementType); - const hasRequires = declarations.some(isRequire); - - if (currentOptions.uninitialized === MODE_ALWAYS && currentOptions.initialized === MODE_ALWAYS) { - if (currentScope.uninitialized || currentScope.initialized) { - if (!hasRequires) { - return false; - } - } - } - - if (declarationCounts.uninitialized > 0) { - if (currentOptions.uninitialized === MODE_ALWAYS && currentScope.uninitialized) { - return false; - } - } - if (declarationCounts.initialized > 0) { - if (currentOptions.initialized === MODE_ALWAYS && currentScope.initialized) { - if (!hasRequires) { - return false; - } - } - } - if (currentScope.required && hasRequires) { - return false; - } - recordTypes(statementType, declarations, currentScope); - return true; - } - - /** - * Fixer to join VariableDeclaration's into a single declaration - * @param {VariableDeclarator[]} declarations The `VariableDeclaration` to join - * @returns {Function} The fixer function - */ - function joinDeclarations(declarations) { - const declaration = declarations[0]; - const body = Array.isArray(declaration.parent.parent.body) ? declaration.parent.parent.body : []; - const currentIndex = body.findIndex(node => node.range[0] === declaration.parent.range[0]); - const previousNode = body[currentIndex - 1]; - - return fixer => { - const type = sourceCode.getTokenBefore(declaration); - const prevSemi = sourceCode.getTokenBefore(type); - const res = []; - - if (previousNode && previousNode.kind === sourceCode.getText(type)) { - if (prevSemi.value === ";") { - res.push(fixer.replaceText(prevSemi, ",")); - } else { - res.push(fixer.insertTextAfter(prevSemi, ",")); - } - res.push(fixer.replaceText(type, "")); - } - - return res; - }; - } - - /** - * Fixer to split a VariableDeclaration into individual declarations - * @param {VariableDeclaration} declaration The `VariableDeclaration` to split - * @returns {Function|null} The fixer function - */ - function splitDeclarations(declaration) { - const { parent } = declaration; - - // don't autofix code such as: if (foo) var x, y; - if (!isInStatementList(parent.type === "ExportNamedDeclaration" ? parent : declaration)) { - return null; - } - - return fixer => declaration.declarations.map(declarator => { - const tokenAfterDeclarator = sourceCode.getTokenAfter(declarator); - - if (tokenAfterDeclarator === null) { - return null; - } - - const afterComma = sourceCode.getTokenAfter(tokenAfterDeclarator, { includeComments: true }); - - if (tokenAfterDeclarator.value !== ",") { - return null; - } - - const exportPlacement = declaration.parent.type === "ExportNamedDeclaration" ? "export " : ""; - - /* - * `var x,y` - * tokenAfterDeclarator ^^ afterComma - */ - if (afterComma.range[0] === tokenAfterDeclarator.range[1]) { - return fixer.replaceText(tokenAfterDeclarator, `; ${exportPlacement}${declaration.kind} `); - } - - /* - * `var x, - * tokenAfterDeclarator ^ - * y` - * ^ afterComma - */ - if ( - afterComma.loc.start.line > tokenAfterDeclarator.loc.end.line || - afterComma.type === "Line" || - afterComma.type === "Block" - ) { - let lastComment = afterComma; - - while (lastComment.type === "Line" || lastComment.type === "Block") { - lastComment = sourceCode.getTokenAfter(lastComment, { includeComments: true }); - } - - return fixer.replaceTextRange( - [tokenAfterDeclarator.range[0], lastComment.range[0]], - `;${sourceCode.text.slice(tokenAfterDeclarator.range[1], lastComment.range[0])}${exportPlacement}${declaration.kind} ` - ); - } - - return fixer.replaceText(tokenAfterDeclarator, `; ${exportPlacement}${declaration.kind}`); - }).filter(x => x); - } - - /** - * Checks a given VariableDeclaration node for errors. - * @param {ASTNode} node The VariableDeclaration node to check - * @returns {void} - * @private - */ - function checkVariableDeclaration(node) { - const parent = node.parent; - const type = node.kind; - - if (!options[type]) { - return; - } - - const declarations = node.declarations; - const declarationCounts = countDeclarations(declarations); - const mixedRequires = declarations.some(isRequire) && !declarations.every(isRequire); - - if (options[type].initialized === MODE_ALWAYS) { - if (options.separateRequires && mixedRequires) { - context.report({ - node, - messageId: "splitRequires" - }); - } - } - - // consecutive - const nodeIndex = (parent.body && parent.body.length > 0 && parent.body.indexOf(node)) || 0; - - if (nodeIndex > 0) { - const previousNode = parent.body[nodeIndex - 1]; - const isPreviousNodeDeclaration = previousNode.type === "VariableDeclaration"; - const declarationsWithPrevious = declarations.concat(previousNode.declarations || []); - - if ( - isPreviousNodeDeclaration && - previousNode.kind === type && - !(declarationsWithPrevious.some(isRequire) && !declarationsWithPrevious.every(isRequire)) - ) { - const previousDeclCounts = countDeclarations(previousNode.declarations); - - if (options[type].initialized === MODE_CONSECUTIVE && options[type].uninitialized === MODE_CONSECUTIVE) { - context.report({ - node, - messageId: "combine", - data: { - type - }, - fix: joinDeclarations(declarations) - }); - } else if (options[type].initialized === MODE_CONSECUTIVE && declarationCounts.initialized > 0 && previousDeclCounts.initialized > 0) { - context.report({ - node, - messageId: "combineInitialized", - data: { - type - }, - fix: joinDeclarations(declarations) - }); - } else if (options[type].uninitialized === MODE_CONSECUTIVE && - declarationCounts.uninitialized > 0 && - previousDeclCounts.uninitialized > 0) { - context.report({ - node, - messageId: "combineUninitialized", - data: { - type - }, - fix: joinDeclarations(declarations) - }); - } - } - } - - // always - if (!hasOnlyOneStatement(type, declarations)) { - if (options[type].initialized === MODE_ALWAYS && options[type].uninitialized === MODE_ALWAYS) { - context.report({ - node, - messageId: "combine", - data: { - type - }, - fix: joinDeclarations(declarations) - }); - } else { - if (options[type].initialized === MODE_ALWAYS && declarationCounts.initialized > 0) { - context.report({ - node, - messageId: "combineInitialized", - data: { - type - }, - fix: joinDeclarations(declarations) - }); - } - if (options[type].uninitialized === MODE_ALWAYS && declarationCounts.uninitialized > 0) { - if (node.parent.left === node && (node.parent.type === "ForInStatement" || node.parent.type === "ForOfStatement")) { - return; - } - context.report({ - node, - messageId: "combineUninitialized", - data: { - type - }, - fix: joinDeclarations(declarations) - }); - } - } - } - - // never - if (parent.type !== "ForStatement" || parent.init !== node) { - const totalDeclarations = declarationCounts.uninitialized + declarationCounts.initialized; - - if (totalDeclarations > 1) { - if (options[type].initialized === MODE_NEVER && options[type].uninitialized === MODE_NEVER) { - - // both initialized and uninitialized - context.report({ - node, - messageId: "split", - data: { - type - }, - fix: splitDeclarations(node) - }); - } else if (options[type].initialized === MODE_NEVER && declarationCounts.initialized > 0) { - - // initialized - context.report({ - node, - messageId: "splitInitialized", - data: { - type - }, - fix: splitDeclarations(node) - }); - } else if (options[type].uninitialized === MODE_NEVER && declarationCounts.uninitialized > 0) { - - // uninitialized - context.report({ - node, - messageId: "splitUninitialized", - data: { - type - }, - fix: splitDeclarations(node) - }); - } - } - } - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - Program: startFunction, - FunctionDeclaration: startFunction, - FunctionExpression: startFunction, - ArrowFunctionExpression: startFunction, - StaticBlock: startFunction, // StaticBlock creates a new scope for `var` variables - - BlockStatement: startBlock, - ForStatement: startBlock, - ForInStatement: startBlock, - ForOfStatement: startBlock, - SwitchStatement: startBlock, - VariableDeclaration: checkVariableDeclaration, - "ForStatement:exit": endBlock, - "ForOfStatement:exit": endBlock, - "ForInStatement:exit": endBlock, - "SwitchStatement:exit": endBlock, - "BlockStatement:exit": endBlock, - - "Program:exit": endFunction, - "FunctionDeclaration:exit": endFunction, - "FunctionExpression:exit": endFunction, - "ArrowFunctionExpression:exit": endFunction, - "StaticBlock:exit": endFunction - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/operator-assignment.js b/node_modules/eslint/lib/rules/operator-assignment.js deleted file mode 100644 index f71d73be7..000000000 --- a/node_modules/eslint/lib/rules/operator-assignment.js +++ /dev/null @@ -1,209 +0,0 @@ -/** - * @fileoverview Rule to replace assignment expressions with operator assignment - * @author Brandon Mills - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether an operator is commutative and has an operator assignment - * shorthand form. - * @param {string} operator Operator to check. - * @returns {boolean} True if the operator is commutative and has a - * shorthand form. - */ -function isCommutativeOperatorWithShorthand(operator) { - return ["*", "&", "^", "|"].includes(operator); -} - -/** - * Checks whether an operator is not commutative and has an operator assignment - * shorthand form. - * @param {string} operator Operator to check. - * @returns {boolean} True if the operator is not commutative and has - * a shorthand form. - */ -function isNonCommutativeOperatorWithShorthand(operator) { - return ["+", "-", "/", "%", "<<", ">>", ">>>", "**"].includes(operator); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** - * Determines if the left side of a node can be safely fixed (i.e. if it activates the same getters/setters and) - * toString calls regardless of whether assignment shorthand is used) - * @param {ASTNode} node The node on the left side of the expression - * @returns {boolean} `true` if the node can be fixed - */ -function canBeFixed(node) { - return ( - node.type === "Identifier" || - ( - node.type === "MemberExpression" && - (node.object.type === "Identifier" || node.object.type === "ThisExpression") && - (!node.computed || node.property.type === "Literal") - ) - ); -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require or disallow assignment operator shorthand where possible", - recommended: false, - url: "https://eslint.org/docs/latest/rules/operator-assignment" - }, - - schema: [ - { - enum: ["always", "never"] - } - ], - - fixable: "code", - messages: { - replaced: "Assignment (=) can be replaced with operator assignment ({{operator}}).", - unexpected: "Unexpected operator assignment ({{operator}}) shorthand." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Returns the operator token of an AssignmentExpression or BinaryExpression - * @param {ASTNode} node An AssignmentExpression or BinaryExpression node - * @returns {Token} The operator token in the node - */ - function getOperatorToken(node) { - return sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); - } - - /** - * Ensures that an assignment uses the shorthand form where possible. - * @param {ASTNode} node An AssignmentExpression node. - * @returns {void} - */ - function verify(node) { - if (node.operator !== "=" || node.right.type !== "BinaryExpression") { - return; - } - - const left = node.left; - const expr = node.right; - const operator = expr.operator; - - if (isCommutativeOperatorWithShorthand(operator) || isNonCommutativeOperatorWithShorthand(operator)) { - const replacementOperator = `${operator}=`; - - if (astUtils.isSameReference(left, expr.left, true)) { - context.report({ - node, - messageId: "replaced", - data: { operator: replacementOperator }, - fix(fixer) { - if (canBeFixed(left) && canBeFixed(expr.left)) { - const equalsToken = getOperatorToken(node); - const operatorToken = getOperatorToken(expr); - const leftText = sourceCode.getText().slice(node.range[0], equalsToken.range[0]); - const rightText = sourceCode.getText().slice(operatorToken.range[1], node.right.range[1]); - - // Check for comments that would be removed. - if (sourceCode.commentsExistBetween(equalsToken, operatorToken)) { - return null; - } - - return fixer.replaceText(node, `${leftText}${replacementOperator}${rightText}`); - } - return null; - } - }); - } else if (astUtils.isSameReference(left, expr.right, true) && isCommutativeOperatorWithShorthand(operator)) { - - /* - * This case can't be fixed safely. - * If `a` and `b` both have custom valueOf() behavior, then fixing `a = b * a` to `a *= b` would - * change the execution order of the valueOf() functions. - */ - context.report({ - node, - messageId: "replaced", - data: { operator: replacementOperator } - }); - } - } - } - - /** - * Warns if an assignment expression uses operator assignment shorthand. - * @param {ASTNode} node An AssignmentExpression node. - * @returns {void} - */ - function prohibit(node) { - if (node.operator !== "=" && !astUtils.isLogicalAssignmentOperator(node.operator)) { - context.report({ - node, - messageId: "unexpected", - data: { operator: node.operator }, - fix(fixer) { - if (canBeFixed(node.left)) { - const firstToken = sourceCode.getFirstToken(node); - const operatorToken = getOperatorToken(node); - const leftText = sourceCode.getText().slice(node.range[0], operatorToken.range[0]); - const newOperator = node.operator.slice(0, -1); - let rightText; - - // Check for comments that would be duplicated. - if (sourceCode.commentsExistBetween(firstToken, operatorToken)) { - return null; - } - - // If this change would modify precedence (e.g. `foo *= bar + 1` => `foo = foo * (bar + 1)`), parenthesize the right side. - if ( - astUtils.getPrecedence(node.right) <= astUtils.getPrecedence({ type: "BinaryExpression", operator: newOperator }) && - !astUtils.isParenthesised(sourceCode, node.right) - ) { - rightText = `${sourceCode.text.slice(operatorToken.range[1], node.right.range[0])}(${sourceCode.getText(node.right)})`; - } else { - const tokenAfterOperator = sourceCode.getTokenAfter(operatorToken, { includeComments: true }); - let rightTextPrefix = ""; - - if ( - operatorToken.range[1] === tokenAfterOperator.range[0] && - !astUtils.canTokensBeAdjacent({ type: "Punctuator", value: newOperator }, tokenAfterOperator) - ) { - rightTextPrefix = " "; // foo+=+bar -> foo= foo+ +bar - } - - rightText = `${rightTextPrefix}${sourceCode.text.slice(operatorToken.range[1], node.range[1])}`; - } - - return fixer.replaceText(node, `${leftText}= ${leftText}${newOperator}${rightText}`); - } - return null; - } - }); - } - } - - return { - AssignmentExpression: context.options[0] !== "never" ? verify : prohibit - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/operator-linebreak.js b/node_modules/eslint/lib/rules/operator-linebreak.js deleted file mode 100644 index 2b609f635..000000000 --- a/node_modules/eslint/lib/rules/operator-linebreak.js +++ /dev/null @@ -1,250 +0,0 @@ -/** - * @fileoverview Operator linebreak - enforces operator linebreak style of two types: after and before - * @author Benoît Zugmeyer - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent linebreak style for operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/operator-linebreak" - }, - - schema: [ - { - enum: ["after", "before", "none", null] - }, - { - type: "object", - properties: { - overrides: { - type: "object", - additionalProperties: { - enum: ["after", "before", "none", "ignore"] - } - } - }, - additionalProperties: false - } - ], - - fixable: "code", - - messages: { - operatorAtBeginning: "'{{operator}}' should be placed at the beginning of the line.", - operatorAtEnd: "'{{operator}}' should be placed at the end of the line.", - badLinebreak: "Bad line breaking before and after '{{operator}}'.", - noLinebreak: "There should be no line break before or after '{{operator}}'." - } - }, - - create(context) { - - const usedDefaultGlobal = !context.options[0]; - const globalStyle = context.options[0] || "after"; - const options = context.options[1] || {}; - const styleOverrides = options.overrides ? Object.assign({}, options.overrides) : {}; - - if (usedDefaultGlobal && !styleOverrides["?"]) { - styleOverrides["?"] = "before"; - } - - if (usedDefaultGlobal && !styleOverrides[":"]) { - styleOverrides[":"] = "before"; - } - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Gets a fixer function to fix rule issues - * @param {Token} operatorToken The operator token of an expression - * @param {string} desiredStyle The style for the rule. One of 'before', 'after', 'none' - * @returns {Function} A fixer function - */ - function getFixer(operatorToken, desiredStyle) { - return fixer => { - const tokenBefore = sourceCode.getTokenBefore(operatorToken); - const tokenAfter = sourceCode.getTokenAfter(operatorToken); - const textBefore = sourceCode.text.slice(tokenBefore.range[1], operatorToken.range[0]); - const textAfter = sourceCode.text.slice(operatorToken.range[1], tokenAfter.range[0]); - const hasLinebreakBefore = !astUtils.isTokenOnSameLine(tokenBefore, operatorToken); - const hasLinebreakAfter = !astUtils.isTokenOnSameLine(operatorToken, tokenAfter); - let newTextBefore, newTextAfter; - - if (hasLinebreakBefore !== hasLinebreakAfter && desiredStyle !== "none") { - - // If there is a comment before and after the operator, don't do a fix. - if (sourceCode.getTokenBefore(operatorToken, { includeComments: true }) !== tokenBefore && - sourceCode.getTokenAfter(operatorToken, { includeComments: true }) !== tokenAfter) { - - return null; - } - - /* - * If there is only one linebreak and it's on the wrong side of the operator, swap the text before and after the operator. - * foo && - * bar - * would get fixed to - * foo - * && bar - */ - newTextBefore = textAfter; - newTextAfter = textBefore; - } else { - const LINEBREAK_REGEX = astUtils.createGlobalLinebreakMatcher(); - - // Otherwise, if no linebreak is desired and no comments interfere, replace the linebreaks with empty strings. - newTextBefore = desiredStyle === "before" || textBefore.trim() ? textBefore : textBefore.replace(LINEBREAK_REGEX, ""); - newTextAfter = desiredStyle === "after" || textAfter.trim() ? textAfter : textAfter.replace(LINEBREAK_REGEX, ""); - - // If there was no change (due to interfering comments), don't output a fix. - if (newTextBefore === textBefore && newTextAfter === textAfter) { - return null; - } - } - - if (newTextAfter === "" && tokenAfter.type === "Punctuator" && "+-".includes(operatorToken.value) && tokenAfter.value === operatorToken.value) { - - // To avoid accidentally creating a ++ or -- operator, insert a space if the operator is a +/- and the following token is a unary +/-. - newTextAfter += " "; - } - - return fixer.replaceTextRange([tokenBefore.range[1], tokenAfter.range[0]], newTextBefore + operatorToken.value + newTextAfter); - }; - } - - /** - * Checks the operator placement - * @param {ASTNode} node The node to check - * @param {ASTNode} rightSide The node that comes after the operator in `node` - * @param {string} operator The operator - * @private - * @returns {void} - */ - function validateNode(node, rightSide, operator) { - - /* - * Find the operator token by searching from the right side, because between the left side and the operator - * there could be additional tokens from type annotations. Search specifically for the token which - * value equals the operator, in order to skip possible opening parentheses before the right side node. - */ - const operatorToken = sourceCode.getTokenBefore(rightSide, token => token.value === operator); - const leftToken = sourceCode.getTokenBefore(operatorToken); - const rightToken = sourceCode.getTokenAfter(operatorToken); - const operatorStyleOverride = styleOverrides[operator]; - const style = operatorStyleOverride || globalStyle; - const fix = getFixer(operatorToken, style); - - // if single line - if (astUtils.isTokenOnSameLine(leftToken, operatorToken) && - astUtils.isTokenOnSameLine(operatorToken, rightToken)) { - - // do nothing. - - } else if (operatorStyleOverride !== "ignore" && !astUtils.isTokenOnSameLine(leftToken, operatorToken) && - !astUtils.isTokenOnSameLine(operatorToken, rightToken)) { - - // lone operator - context.report({ - node, - loc: operatorToken.loc, - messageId: "badLinebreak", - data: { - operator - }, - fix - }); - - } else if (style === "before" && astUtils.isTokenOnSameLine(leftToken, operatorToken)) { - - context.report({ - node, - loc: operatorToken.loc, - messageId: "operatorAtBeginning", - data: { - operator - }, - fix - }); - - } else if (style === "after" && astUtils.isTokenOnSameLine(operatorToken, rightToken)) { - - context.report({ - node, - loc: operatorToken.loc, - messageId: "operatorAtEnd", - data: { - operator - }, - fix - }); - - } else if (style === "none") { - - context.report({ - node, - loc: operatorToken.loc, - messageId: "noLinebreak", - data: { - operator - }, - fix - }); - - } - } - - /** - * Validates a binary expression using `validateNode` - * @param {BinaryExpression|LogicalExpression|AssignmentExpression} node node to be validated - * @returns {void} - */ - function validateBinaryExpression(node) { - validateNode(node, node.right, node.operator); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - BinaryExpression: validateBinaryExpression, - LogicalExpression: validateBinaryExpression, - AssignmentExpression: validateBinaryExpression, - VariableDeclarator(node) { - if (node.init) { - validateNode(node, node.init, "="); - } - }, - PropertyDefinition(node) { - if (node.value) { - validateNode(node, node.value, "="); - } - }, - ConditionalExpression(node) { - validateNode(node, node.consequent, "?"); - validateNode(node, node.alternate, ":"); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/padded-blocks.js b/node_modules/eslint/lib/rules/padded-blocks.js deleted file mode 100644 index c6d1372ac..000000000 --- a/node_modules/eslint/lib/rules/padded-blocks.js +++ /dev/null @@ -1,307 +0,0 @@ -/** - * @fileoverview A rule to ensure blank lines within blocks. - * @author Mathias Schreck - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow padding within blocks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/padded-blocks" - }, - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - blocks: { - enum: ["always", "never"] - }, - switches: { - enum: ["always", "never"] - }, - classes: { - enum: ["always", "never"] - } - }, - additionalProperties: false, - minProperties: 1 - } - ] - }, - { - type: "object", - properties: { - allowSingleLineBlocks: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - alwaysPadBlock: "Block must be padded by blank lines.", - neverPadBlock: "Block must not be padded by blank lines." - } - }, - - create(context) { - const options = {}; - const typeOptions = context.options[0] || "always"; - const exceptOptions = context.options[1] || {}; - - if (typeof typeOptions === "string") { - const shouldHavePadding = typeOptions === "always"; - - options.blocks = shouldHavePadding; - options.switches = shouldHavePadding; - options.classes = shouldHavePadding; - } else { - if (Object.prototype.hasOwnProperty.call(typeOptions, "blocks")) { - options.blocks = typeOptions.blocks === "always"; - } - if (Object.prototype.hasOwnProperty.call(typeOptions, "switches")) { - options.switches = typeOptions.switches === "always"; - } - if (Object.prototype.hasOwnProperty.call(typeOptions, "classes")) { - options.classes = typeOptions.classes === "always"; - } - } - - if (Object.prototype.hasOwnProperty.call(exceptOptions, "allowSingleLineBlocks")) { - options.allowSingleLineBlocks = exceptOptions.allowSingleLineBlocks === true; - } - - const sourceCode = context.sourceCode; - - /** - * Gets the open brace token from a given node. - * @param {ASTNode} node A BlockStatement or SwitchStatement node from which to get the open brace. - * @returns {Token} The token of the open brace. - */ - function getOpenBrace(node) { - if (node.type === "SwitchStatement") { - return sourceCode.getTokenBefore(node.cases[0]); - } - - if (node.type === "StaticBlock") { - return sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token - } - - // `BlockStatement` or `ClassBody` - return sourceCode.getFirstToken(node); - } - - /** - * Checks if the given parameter is a comment node - * @param {ASTNode|Token} node An AST node or token - * @returns {boolean} True if node is a comment - */ - function isComment(node) { - return node.type === "Line" || node.type === "Block"; - } - - /** - * Checks if there is padding between two tokens - * @param {Token} first The first token - * @param {Token} second The second token - * @returns {boolean} True if there is at least a line between the tokens - */ - function isPaddingBetweenTokens(first, second) { - return second.loc.start.line - first.loc.end.line >= 2; - } - - - /** - * Checks if the given token has a blank line after it. - * @param {Token} token The token to check. - * @returns {boolean} Whether or not the token is followed by a blank line. - */ - function getFirstBlockToken(token) { - let prev, - first = token; - - do { - prev = first; - first = sourceCode.getTokenAfter(first, { includeComments: true }); - } while (isComment(first) && first.loc.start.line === prev.loc.end.line); - - return first; - } - - /** - * Checks if the given token is preceded by a blank line. - * @param {Token} token The token to check - * @returns {boolean} Whether or not the token is preceded by a blank line - */ - function getLastBlockToken(token) { - let last = token, - next; - - do { - next = last; - last = sourceCode.getTokenBefore(last, { includeComments: true }); - } while (isComment(last) && last.loc.end.line === next.loc.start.line); - - return last; - } - - /** - * Checks if a node should be padded, according to the rule config. - * @param {ASTNode} node The AST node to check. - * @throws {Error} (Unreachable) - * @returns {boolean} True if the node should be padded, false otherwise. - */ - function requirePaddingFor(node) { - switch (node.type) { - case "BlockStatement": - case "StaticBlock": - return options.blocks; - case "SwitchStatement": - return options.switches; - case "ClassBody": - return options.classes; - - /* c8 ignore next */ - default: - throw new Error("unreachable"); - } - } - - /** - * Checks the given BlockStatement node to be padded if the block is not empty. - * @param {ASTNode} node The AST node of a BlockStatement. - * @returns {void} undefined. - */ - function checkPadding(node) { - const openBrace = getOpenBrace(node), - firstBlockToken = getFirstBlockToken(openBrace), - tokenBeforeFirst = sourceCode.getTokenBefore(firstBlockToken, { includeComments: true }), - closeBrace = sourceCode.getLastToken(node), - lastBlockToken = getLastBlockToken(closeBrace), - tokenAfterLast = sourceCode.getTokenAfter(lastBlockToken, { includeComments: true }), - blockHasTopPadding = isPaddingBetweenTokens(tokenBeforeFirst, firstBlockToken), - blockHasBottomPadding = isPaddingBetweenTokens(lastBlockToken, tokenAfterLast); - - if (options.allowSingleLineBlocks && astUtils.isTokenOnSameLine(tokenBeforeFirst, tokenAfterLast)) { - return; - } - - if (requirePaddingFor(node)) { - - if (!blockHasTopPadding) { - context.report({ - node, - loc: { - start: tokenBeforeFirst.loc.start, - end: firstBlockToken.loc.start - }, - fix(fixer) { - return fixer.insertTextAfter(tokenBeforeFirst, "\n"); - }, - messageId: "alwaysPadBlock" - }); - } - if (!blockHasBottomPadding) { - context.report({ - node, - loc: { - end: tokenAfterLast.loc.start, - start: lastBlockToken.loc.end - }, - fix(fixer) { - return fixer.insertTextBefore(tokenAfterLast, "\n"); - }, - messageId: "alwaysPadBlock" - }); - } - } else { - if (blockHasTopPadding) { - - context.report({ - node, - loc: { - start: tokenBeforeFirst.loc.start, - end: firstBlockToken.loc.start - }, - fix(fixer) { - return fixer.replaceTextRange([tokenBeforeFirst.range[1], firstBlockToken.range[0] - firstBlockToken.loc.start.column], "\n"); - }, - messageId: "neverPadBlock" - }); - } - - if (blockHasBottomPadding) { - - context.report({ - node, - loc: { - end: tokenAfterLast.loc.start, - start: lastBlockToken.loc.end - }, - messageId: "neverPadBlock", - fix(fixer) { - return fixer.replaceTextRange([lastBlockToken.range[1], tokenAfterLast.range[0] - tokenAfterLast.loc.start.column], "\n"); - } - }); - } - } - } - - const rule = {}; - - if (Object.prototype.hasOwnProperty.call(options, "switches")) { - rule.SwitchStatement = function(node) { - if (node.cases.length === 0) { - return; - } - checkPadding(node); - }; - } - - if (Object.prototype.hasOwnProperty.call(options, "blocks")) { - rule.BlockStatement = function(node) { - if (node.body.length === 0) { - return; - } - checkPadding(node); - }; - rule.StaticBlock = rule.BlockStatement; - } - - if (Object.prototype.hasOwnProperty.call(options, "classes")) { - rule.ClassBody = function(node) { - if (node.body.length === 0) { - return; - } - checkPadding(node); - }; - } - - return rule; - } -}; diff --git a/node_modules/eslint/lib/rules/padding-line-between-statements.js b/node_modules/eslint/lib/rules/padding-line-between-statements.js deleted file mode 100644 index be7e2e404..000000000 --- a/node_modules/eslint/lib/rules/padding-line-between-statements.js +++ /dev/null @@ -1,632 +0,0 @@ -/** - * @fileoverview Rule to require or disallow newlines between statements - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const LT = `[${Array.from(astUtils.LINEBREAKS).join("")}]`; -const PADDING_LINE_SEQUENCE = new RegExp( - String.raw`^(\s*?${LT})\s*${LT}(\s*;?)$`, - "u" -); -const CJS_EXPORT = /^(?:module\s*\.\s*)?exports(?:\s*\.|\s*\[|$)/u; -const CJS_IMPORT = /^require\(/u; - -/** - * Creates tester which check if a node starts with specific keyword. - * @param {string} keyword The keyword to test. - * @returns {Object} the created tester. - * @private - */ -function newKeywordTester(keyword) { - return { - test: (node, sourceCode) => - sourceCode.getFirstToken(node).value === keyword - }; -} - -/** - * Creates tester which check if a node starts with specific keyword and spans a single line. - * @param {string} keyword The keyword to test. - * @returns {Object} the created tester. - * @private - */ -function newSinglelineKeywordTester(keyword) { - return { - test: (node, sourceCode) => - node.loc.start.line === node.loc.end.line && - sourceCode.getFirstToken(node).value === keyword - }; -} - -/** - * Creates tester which check if a node starts with specific keyword and spans multiple lines. - * @param {string} keyword The keyword to test. - * @returns {Object} the created tester. - * @private - */ -function newMultilineKeywordTester(keyword) { - return { - test: (node, sourceCode) => - node.loc.start.line !== node.loc.end.line && - sourceCode.getFirstToken(node).value === keyword - }; -} - -/** - * Creates tester which check if a node is specific type. - * @param {string} type The node type to test. - * @returns {Object} the created tester. - * @private - */ -function newNodeTypeTester(type) { - return { - test: node => - node.type === type - }; -} - -/** - * Checks the given node is an expression statement of IIFE. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is an expression statement of IIFE. - * @private - */ -function isIIFEStatement(node) { - if (node.type === "ExpressionStatement") { - let call = astUtils.skipChainExpression(node.expression); - - if (call.type === "UnaryExpression") { - call = astUtils.skipChainExpression(call.argument); - } - return call.type === "CallExpression" && astUtils.isFunction(call.callee); - } - return false; -} - -/** - * Checks whether the given node is a block-like statement. - * This checks the last token of the node is the closing brace of a block. - * @param {SourceCode} sourceCode The source code to get tokens. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is a block-like statement. - * @private - */ -function isBlockLikeStatement(sourceCode, node) { - - // do-while with a block is a block-like statement. - if (node.type === "DoWhileStatement" && node.body.type === "BlockStatement") { - return true; - } - - /* - * IIFE is a block-like statement specially from - * JSCS#disallowPaddingNewLinesAfterBlocks. - */ - if (isIIFEStatement(node)) { - return true; - } - - // Checks the last token is a closing brace of blocks. - const lastToken = sourceCode.getLastToken(node, astUtils.isNotSemicolonToken); - const belongingNode = lastToken && astUtils.isClosingBraceToken(lastToken) - ? sourceCode.getNodeByRangeIndex(lastToken.range[0]) - : null; - - return Boolean(belongingNode) && ( - belongingNode.type === "BlockStatement" || - belongingNode.type === "SwitchStatement" - ); -} - -/** - * Check whether the given node is a directive or not. - * @param {ASTNode} node The node to check. - * @param {SourceCode} sourceCode The source code object to get tokens. - * @returns {boolean} `true` if the node is a directive. - */ -function isDirective(node, sourceCode) { - return ( - node.type === "ExpressionStatement" && - ( - node.parent.type === "Program" || - ( - node.parent.type === "BlockStatement" && - astUtils.isFunction(node.parent.parent) - ) - ) && - node.expression.type === "Literal" && - typeof node.expression.value === "string" && - !astUtils.isParenthesised(sourceCode, node.expression) - ); -} - -/** - * Check whether the given node is a part of directive prologue or not. - * @param {ASTNode} node The node to check. - * @param {SourceCode} sourceCode The source code object to get tokens. - * @returns {boolean} `true` if the node is a part of directive prologue. - */ -function isDirectivePrologue(node, sourceCode) { - if (isDirective(node, sourceCode)) { - for (const sibling of node.parent.body) { - if (sibling === node) { - break; - } - if (!isDirective(sibling, sourceCode)) { - return false; - } - } - return true; - } - return false; -} - -/** - * Gets the actual last token. - * - * If a semicolon is semicolon-less style's semicolon, this ignores it. - * For example: - * - * foo() - * ;[1, 2, 3].forEach(bar) - * @param {SourceCode} sourceCode The source code to get tokens. - * @param {ASTNode} node The node to get. - * @returns {Token} The actual last token. - * @private - */ -function getActualLastToken(sourceCode, node) { - const semiToken = sourceCode.getLastToken(node); - const prevToken = sourceCode.getTokenBefore(semiToken); - const nextToken = sourceCode.getTokenAfter(semiToken); - const isSemicolonLessStyle = Boolean( - prevToken && - nextToken && - prevToken.range[0] >= node.range[0] && - astUtils.isSemicolonToken(semiToken) && - semiToken.loc.start.line !== prevToken.loc.end.line && - semiToken.loc.end.line === nextToken.loc.start.line - ); - - return isSemicolonLessStyle ? prevToken : semiToken; -} - -/** - * This returns the concatenation of the first 2 captured strings. - * @param {string} _ Unused. Whole matched string. - * @param {string} trailingSpaces The trailing spaces of the first line. - * @param {string} indentSpaces The indentation spaces of the last line. - * @returns {string} The concatenation of trailingSpaces and indentSpaces. - * @private - */ -function replacerToRemovePaddingLines(_, trailingSpaces, indentSpaces) { - return trailingSpaces + indentSpaces; -} - -/** - * Check and report statements for `any` configuration. - * It does nothing. - * @returns {void} - * @private - */ -function verifyForAny() { -} - -/** - * Check and report statements for `never` configuration. - * This autofix removes blank lines between the given 2 statements. - * However, if comments exist between 2 blank lines, it does not remove those - * blank lines automatically. - * @param {RuleContext} context The rule context to report. - * @param {ASTNode} _ Unused. The previous node to check. - * @param {ASTNode} nextNode The next node to check. - * @param {Array} paddingLines The array of token pairs that blank - * lines exist between the pair. - * @returns {void} - * @private - */ -function verifyForNever(context, _, nextNode, paddingLines) { - if (paddingLines.length === 0) { - return; - } - - context.report({ - node: nextNode, - messageId: "unexpectedBlankLine", - fix(fixer) { - if (paddingLines.length >= 2) { - return null; - } - - const prevToken = paddingLines[0][0]; - const nextToken = paddingLines[0][1]; - const start = prevToken.range[1]; - const end = nextToken.range[0]; - const text = context.sourceCode.text - .slice(start, end) - .replace(PADDING_LINE_SEQUENCE, replacerToRemovePaddingLines); - - return fixer.replaceTextRange([start, end], text); - } - }); -} - -/** - * Check and report statements for `always` configuration. - * This autofix inserts a blank line between the given 2 statements. - * If the `prevNode` has trailing comments, it inserts a blank line after the - * trailing comments. - * @param {RuleContext} context The rule context to report. - * @param {ASTNode} prevNode The previous node to check. - * @param {ASTNode} nextNode The next node to check. - * @param {Array} paddingLines The array of token pairs that blank - * lines exist between the pair. - * @returns {void} - * @private - */ -function verifyForAlways(context, prevNode, nextNode, paddingLines) { - if (paddingLines.length > 0) { - return; - } - - context.report({ - node: nextNode, - messageId: "expectedBlankLine", - fix(fixer) { - const sourceCode = context.sourceCode; - let prevToken = getActualLastToken(sourceCode, prevNode); - const nextToken = sourceCode.getFirstTokenBetween( - prevToken, - nextNode, - { - includeComments: true, - - /** - * Skip the trailing comments of the previous node. - * This inserts a blank line after the last trailing comment. - * - * For example: - * - * foo(); // trailing comment. - * // comment. - * bar(); - * - * Get fixed to: - * - * foo(); // trailing comment. - * - * // comment. - * bar(); - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is not a trailing comment. - * @private - */ - filter(token) { - if (astUtils.isTokenOnSameLine(prevToken, token)) { - prevToken = token; - return false; - } - return true; - } - } - ) || nextNode; - const insertText = astUtils.isTokenOnSameLine(prevToken, nextToken) - ? "\n\n" - : "\n"; - - return fixer.insertTextAfter(prevToken, insertText); - } - }); -} - -/** - * Types of blank lines. - * `any`, `never`, and `always` are defined. - * Those have `verify` method to check and report statements. - * @private - */ -const PaddingTypes = { - any: { verify: verifyForAny }, - never: { verify: verifyForNever }, - always: { verify: verifyForAlways } -}; - -/** - * Types of statements. - * Those have `test` method to check it matches to the given statement. - * @private - */ -const StatementTypes = { - "*": { test: () => true }, - "block-like": { - test: (node, sourceCode) => isBlockLikeStatement(sourceCode, node) - }, - "cjs-export": { - test: (node, sourceCode) => - node.type === "ExpressionStatement" && - node.expression.type === "AssignmentExpression" && - CJS_EXPORT.test(sourceCode.getText(node.expression.left)) - }, - "cjs-import": { - test: (node, sourceCode) => - node.type === "VariableDeclaration" && - node.declarations.length > 0 && - Boolean(node.declarations[0].init) && - CJS_IMPORT.test(sourceCode.getText(node.declarations[0].init)) - }, - directive: { - test: isDirectivePrologue - }, - expression: { - test: (node, sourceCode) => - node.type === "ExpressionStatement" && - !isDirectivePrologue(node, sourceCode) - }, - iife: { - test: isIIFEStatement - }, - "multiline-block-like": { - test: (node, sourceCode) => - node.loc.start.line !== node.loc.end.line && - isBlockLikeStatement(sourceCode, node) - }, - "multiline-expression": { - test: (node, sourceCode) => - node.loc.start.line !== node.loc.end.line && - node.type === "ExpressionStatement" && - !isDirectivePrologue(node, sourceCode) - }, - - "multiline-const": newMultilineKeywordTester("const"), - "multiline-let": newMultilineKeywordTester("let"), - "multiline-var": newMultilineKeywordTester("var"), - "singleline-const": newSinglelineKeywordTester("const"), - "singleline-let": newSinglelineKeywordTester("let"), - "singleline-var": newSinglelineKeywordTester("var"), - - block: newNodeTypeTester("BlockStatement"), - empty: newNodeTypeTester("EmptyStatement"), - function: newNodeTypeTester("FunctionDeclaration"), - - break: newKeywordTester("break"), - case: newKeywordTester("case"), - class: newKeywordTester("class"), - const: newKeywordTester("const"), - continue: newKeywordTester("continue"), - debugger: newKeywordTester("debugger"), - default: newKeywordTester("default"), - do: newKeywordTester("do"), - export: newKeywordTester("export"), - for: newKeywordTester("for"), - if: newKeywordTester("if"), - import: newKeywordTester("import"), - let: newKeywordTester("let"), - return: newKeywordTester("return"), - switch: newKeywordTester("switch"), - throw: newKeywordTester("throw"), - try: newKeywordTester("try"), - var: newKeywordTester("var"), - while: newKeywordTester("while"), - with: newKeywordTester("with") -}; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow padding lines between statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/padding-line-between-statements" - }, - - fixable: "whitespace", - - schema: { - definitions: { - paddingType: { - enum: Object.keys(PaddingTypes) - }, - statementType: { - anyOf: [ - { enum: Object.keys(StatementTypes) }, - { - type: "array", - items: { enum: Object.keys(StatementTypes) }, - minItems: 1, - uniqueItems: true - } - ] - } - }, - type: "array", - items: { - type: "object", - properties: { - blankLine: { $ref: "#/definitions/paddingType" }, - prev: { $ref: "#/definitions/statementType" }, - next: { $ref: "#/definitions/statementType" } - }, - additionalProperties: false, - required: ["blankLine", "prev", "next"] - } - }, - - messages: { - unexpectedBlankLine: "Unexpected blank line before this statement.", - expectedBlankLine: "Expected blank line before this statement." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const configureList = context.options || []; - let scopeInfo = null; - - /** - * Processes to enter to new scope. - * This manages the current previous statement. - * @returns {void} - * @private - */ - function enterScope() { - scopeInfo = { - upper: scopeInfo, - prevNode: null - }; - } - - /** - * Processes to exit from the current scope. - * @returns {void} - * @private - */ - function exitScope() { - scopeInfo = scopeInfo.upper; - } - - /** - * Checks whether the given node matches the given type. - * @param {ASTNode} node The statement node to check. - * @param {string|string[]} type The statement type to check. - * @returns {boolean} `true` if the statement node matched the type. - * @private - */ - function match(node, type) { - let innerStatementNode = node; - - while (innerStatementNode.type === "LabeledStatement") { - innerStatementNode = innerStatementNode.body; - } - if (Array.isArray(type)) { - return type.some(match.bind(null, innerStatementNode)); - } - return StatementTypes[type].test(innerStatementNode, sourceCode); - } - - /** - * Finds the last matched configure from configureList. - * @param {ASTNode} prevNode The previous statement to match. - * @param {ASTNode} nextNode The current statement to match. - * @returns {Object} The tester of the last matched configure. - * @private - */ - function getPaddingType(prevNode, nextNode) { - for (let i = configureList.length - 1; i >= 0; --i) { - const configure = configureList[i]; - const matched = - match(prevNode, configure.prev) && - match(nextNode, configure.next); - - if (matched) { - return PaddingTypes[configure.blankLine]; - } - } - return PaddingTypes.any; - } - - /** - * Gets padding line sequences between the given 2 statements. - * Comments are separators of the padding line sequences. - * @param {ASTNode} prevNode The previous statement to count. - * @param {ASTNode} nextNode The current statement to count. - * @returns {Array} The array of token pairs. - * @private - */ - function getPaddingLineSequences(prevNode, nextNode) { - const pairs = []; - let prevToken = getActualLastToken(sourceCode, prevNode); - - if (nextNode.loc.start.line - prevToken.loc.end.line >= 2) { - do { - const token = sourceCode.getTokenAfter( - prevToken, - { includeComments: true } - ); - - if (token.loc.start.line - prevToken.loc.end.line >= 2) { - pairs.push([prevToken, token]); - } - prevToken = token; - - } while (prevToken.range[0] < nextNode.range[0]); - } - - return pairs; - } - - /** - * Verify padding lines between the given node and the previous node. - * @param {ASTNode} node The node to verify. - * @returns {void} - * @private - */ - function verify(node) { - const parentType = node.parent.type; - const validParent = - astUtils.STATEMENT_LIST_PARENTS.has(parentType) || - parentType === "SwitchStatement"; - - if (!validParent) { - return; - } - - // Save this node as the current previous statement. - const prevNode = scopeInfo.prevNode; - - // Verify. - if (prevNode) { - const type = getPaddingType(prevNode, node); - const paddingLines = getPaddingLineSequences(prevNode, node); - - type.verify(context, prevNode, node, paddingLines); - } - - scopeInfo.prevNode = node; - } - - /** - * Verify padding lines between the given node and the previous node. - * Then process to enter to new scope. - * @param {ASTNode} node The node to verify. - * @returns {void} - * @private - */ - function verifyThenEnterScope(node) { - verify(node); - enterScope(); - } - - return { - Program: enterScope, - BlockStatement: enterScope, - SwitchStatement: enterScope, - StaticBlock: enterScope, - "Program:exit": exitScope, - "BlockStatement:exit": exitScope, - "SwitchStatement:exit": exitScope, - "StaticBlock:exit": exitScope, - - ":statement": verify, - - SwitchCase: verifyThenEnterScope, - "SwitchCase:exit": exitScope - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-arrow-callback.js b/node_modules/eslint/lib/rules/prefer-arrow-callback.js deleted file mode 100644 index d22e508be..000000000 --- a/node_modules/eslint/lib/rules/prefer-arrow-callback.js +++ /dev/null @@ -1,381 +0,0 @@ -/** - * @fileoverview A rule to suggest using arrow functions as callbacks. - * @author Toru Nagashima - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether or not a given variable is a function name. - * @param {eslint-scope.Variable} variable A variable to check. - * @returns {boolean} `true` if the variable is a function name. - */ -function isFunctionName(variable) { - return variable && variable.defs[0].type === "FunctionName"; -} - -/** - * Checks whether or not a given MetaProperty node equals to a given value. - * @param {ASTNode} node A MetaProperty node to check. - * @param {string} metaName The name of `MetaProperty.meta`. - * @param {string} propertyName The name of `MetaProperty.property`. - * @returns {boolean} `true` if the node is the specific value. - */ -function checkMetaProperty(node, metaName, propertyName) { - return node.meta.name === metaName && node.property.name === propertyName; -} - -/** - * Gets the variable object of `arguments` which is defined implicitly. - * @param {eslint-scope.Scope} scope A scope to get. - * @returns {eslint-scope.Variable} The found variable object. - */ -function getVariableOfArguments(scope) { - const variables = scope.variables; - - for (let i = 0; i < variables.length; ++i) { - const variable = variables[i]; - - if (variable.name === "arguments") { - - /* - * If there was a parameter which is named "arguments", the - * implicit "arguments" is not defined. - * So does fast return with null. - */ - return (variable.identifiers.length === 0) ? variable : null; - } - } - - /* c8 ignore next */ - return null; -} - -/** - * Checks whether or not a given node is a callback. - * @param {ASTNode} node A node to check. - * @throws {Error} (Unreachable.) - * @returns {Object} - * {boolean} retv.isCallback - `true` if the node is a callback. - * {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`. - */ -function getCallbackInfo(node) { - const retv = { isCallback: false, isLexicalThis: false }; - let currentNode = node; - let parent = node.parent; - let bound = false; - - while (currentNode) { - switch (parent.type) { - - // Checks parents recursively. - - case "LogicalExpression": - case "ChainExpression": - case "ConditionalExpression": - break; - - // Checks whether the parent node is `.bind(this)` call. - case "MemberExpression": - if ( - parent.object === currentNode && - !parent.property.computed && - parent.property.type === "Identifier" && - parent.property.name === "bind" - ) { - const maybeCallee = parent.parent.type === "ChainExpression" - ? parent.parent - : parent; - - if (astUtils.isCallee(maybeCallee)) { - if (!bound) { - bound = true; // Use only the first `.bind()` to make `isLexicalThis` value. - retv.isLexicalThis = ( - maybeCallee.parent.arguments.length === 1 && - maybeCallee.parent.arguments[0].type === "ThisExpression" - ); - } - parent = maybeCallee.parent; - } else { - return retv; - } - } else { - return retv; - } - break; - - // Checks whether the node is a callback. - case "CallExpression": - case "NewExpression": - if (parent.callee !== currentNode) { - retv.isCallback = true; - } - return retv; - - default: - return retv; - } - - currentNode = parent; - parent = parent.parent; - } - - /* c8 ignore next */ - throw new Error("unreachable"); -} - -/** - * Checks whether a simple list of parameters contains any duplicates. This does not handle complex - * parameter lists (e.g. with destructuring), since complex parameter lists are a SyntaxError with duplicate - * parameter names anyway. Instead, it always returns `false` for complex parameter lists. - * @param {ASTNode[]} paramsList The list of parameters for a function - * @returns {boolean} `true` if the list of parameters contains any duplicates - */ -function hasDuplicateParams(paramsList) { - return paramsList.every(param => param.type === "Identifier") && paramsList.length !== new Set(paramsList.map(param => param.name)).size; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require using arrow functions for callbacks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-arrow-callback" - }, - - schema: [ - { - type: "object", - properties: { - allowNamedFunctions: { - type: "boolean", - default: false - }, - allowUnboundThis: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - fixable: "code", - - messages: { - preferArrowCallback: "Unexpected function expression." - } - }, - - create(context) { - const options = context.options[0] || {}; - - const allowUnboundThis = options.allowUnboundThis !== false; // default to true - const allowNamedFunctions = options.allowNamedFunctions; - const sourceCode = context.sourceCode; - - /* - * {Array<{this: boolean, super: boolean, meta: boolean}>} - * - this - A flag which shows there are one or more ThisExpression. - * - super - A flag which shows there are one or more Super. - * - meta - A flag which shows there are one or more MethProperty. - */ - let stack = []; - - /** - * Pushes new function scope with all `false` flags. - * @returns {void} - */ - function enterScope() { - stack.push({ this: false, super: false, meta: false }); - } - - /** - * Pops a function scope from the stack. - * @returns {{this: boolean, super: boolean, meta: boolean}} The information of the last scope. - */ - function exitScope() { - return stack.pop(); - } - - return { - - // Reset internal state. - Program() { - stack = []; - }, - - // If there are below, it cannot replace with arrow functions merely. - ThisExpression() { - const info = stack[stack.length - 1]; - - if (info) { - info.this = true; - } - }, - - Super() { - const info = stack[stack.length - 1]; - - if (info) { - info.super = true; - } - }, - - MetaProperty(node) { - const info = stack[stack.length - 1]; - - if (info && checkMetaProperty(node, "new", "target")) { - info.meta = true; - } - }, - - // To skip nested scopes. - FunctionDeclaration: enterScope, - "FunctionDeclaration:exit": exitScope, - - // Main. - FunctionExpression: enterScope, - "FunctionExpression:exit"(node) { - const scopeInfo = exitScope(); - - // Skip named function expressions - if (allowNamedFunctions && node.id && node.id.name) { - return; - } - - // Skip generators. - if (node.generator) { - return; - } - - // Skip recursive functions. - const nameVar = sourceCode.getDeclaredVariables(node)[0]; - - if (isFunctionName(nameVar) && nameVar.references.length > 0) { - return; - } - - // Skip if it's using arguments. - const variable = getVariableOfArguments(sourceCode.getScope(node)); - - if (variable && variable.references.length > 0) { - return; - } - - // Reports if it's a callback which can replace with arrows. - const callbackInfo = getCallbackInfo(node); - - if (callbackInfo.isCallback && - (!allowUnboundThis || !scopeInfo.this || callbackInfo.isLexicalThis) && - !scopeInfo.super && - !scopeInfo.meta - ) { - context.report({ - node, - messageId: "preferArrowCallback", - *fix(fixer) { - if ((!callbackInfo.isLexicalThis && scopeInfo.this) || hasDuplicateParams(node.params)) { - - /* - * If the callback function does not have .bind(this) and contains a reference to `this`, there - * is no way to determine what `this` should be, so don't perform any fixes. - * If the callback function has duplicates in its list of parameters (possible in sloppy mode), - * don't replace it with an arrow function, because this is a SyntaxError with arrow functions. - */ - return; - } - - // Remove `.bind(this)` if exists. - if (callbackInfo.isLexicalThis) { - const memberNode = node.parent; - - /* - * If `.bind(this)` exists but the parent is not `.bind(this)`, don't remove it automatically. - * E.g. `(foo || function(){}).bind(this)` - */ - if (memberNode.type !== "MemberExpression") { - return; - } - - const callNode = memberNode.parent; - const firstTokenToRemove = sourceCode.getTokenAfter(memberNode.object, astUtils.isNotClosingParenToken); - const lastTokenToRemove = sourceCode.getLastToken(callNode); - - /* - * If the member expression is parenthesized, don't remove the right paren. - * E.g. `(function(){}.bind)(this)` - * ^^^^^^^^^^^^ - */ - if (astUtils.isParenthesised(sourceCode, memberNode)) { - return; - } - - // If comments exist in the `.bind(this)`, don't remove those. - if (sourceCode.commentsExistBetween(firstTokenToRemove, lastTokenToRemove)) { - return; - } - - yield fixer.removeRange([firstTokenToRemove.range[0], lastTokenToRemove.range[1]]); - } - - // Convert the function expression to an arrow function. - const functionToken = sourceCode.getFirstToken(node, node.async ? 1 : 0); - const leftParenToken = sourceCode.getTokenAfter(functionToken, astUtils.isOpeningParenToken); - const tokenBeforeBody = sourceCode.getTokenBefore(node.body); - - if (sourceCode.commentsExistBetween(functionToken, leftParenToken)) { - - // Remove only extra tokens to keep comments. - yield fixer.remove(functionToken); - if (node.id) { - yield fixer.remove(node.id); - } - } else { - - // Remove extra tokens and spaces. - yield fixer.removeRange([functionToken.range[0], leftParenToken.range[0]]); - } - yield fixer.insertTextAfter(tokenBeforeBody, " =>"); - - // Get the node that will become the new arrow function. - let replacedNode = callbackInfo.isLexicalThis ? node.parent.parent : node; - - if (replacedNode.type === "ChainExpression") { - replacedNode = replacedNode.parent; - } - - /* - * If the replaced node is part of a BinaryExpression, LogicalExpression, or MemberExpression, then - * the arrow function needs to be parenthesized, because `foo || () => {}` is invalid syntax even - * though `foo || function() {}` is valid. - */ - if ( - replacedNode.parent.type !== "CallExpression" && - replacedNode.parent.type !== "ConditionalExpression" && - !astUtils.isParenthesised(sourceCode, replacedNode) && - !astUtils.isParenthesised(sourceCode, node) - ) { - yield fixer.insertTextBefore(replacedNode, "("); - yield fixer.insertTextAfter(replacedNode, ")"); - } - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-const.js b/node_modules/eslint/lib/rules/prefer-const.js deleted file mode 100644 index b43975e9b..000000000 --- a/node_modules/eslint/lib/rules/prefer-const.js +++ /dev/null @@ -1,501 +0,0 @@ -/** - * @fileoverview A rule to suggest using of const declaration for variables that are never reassigned after declared. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const FixTracker = require("./utils/fix-tracker"); -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const PATTERN_TYPE = /^(?:.+?Pattern|RestElement|SpreadProperty|ExperimentalRestProperty|Property)$/u; -const DECLARATION_HOST_TYPE = /^(?:Program|BlockStatement|StaticBlock|SwitchCase)$/u; -const DESTRUCTURING_HOST_TYPE = /^(?:VariableDeclarator|AssignmentExpression)$/u; - -/** - * Checks whether a given node is located at `ForStatement.init` or not. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is located at `ForStatement.init`. - */ -function isInitOfForStatement(node) { - return node.parent.type === "ForStatement" && node.parent.init === node; -} - -/** - * Checks whether a given Identifier node becomes a VariableDeclaration or not. - * @param {ASTNode} identifier An Identifier node to check. - * @returns {boolean} `true` if the node can become a VariableDeclaration. - */ -function canBecomeVariableDeclaration(identifier) { - let node = identifier.parent; - - while (PATTERN_TYPE.test(node.type)) { - node = node.parent; - } - - return ( - node.type === "VariableDeclarator" || - ( - node.type === "AssignmentExpression" && - node.parent.type === "ExpressionStatement" && - DECLARATION_HOST_TYPE.test(node.parent.parent.type) - ) - ); -} - -/** - * Checks if an property or element is from outer scope or function parameters - * in destructing pattern. - * @param {string} name A variable name to be checked. - * @param {eslint-scope.Scope} initScope A scope to start find. - * @returns {boolean} Indicates if the variable is from outer scope or function parameters. - */ -function isOuterVariableInDestructing(name, initScope) { - - if (initScope.through.some(ref => ref.resolved && ref.resolved.name === name)) { - return true; - } - - const variable = astUtils.getVariableByName(initScope, name); - - if (variable !== null) { - return variable.defs.some(def => def.type === "Parameter"); - } - - return false; -} - -/** - * Gets the VariableDeclarator/AssignmentExpression node that a given reference - * belongs to. - * This is used to detect a mix of reassigned and never reassigned in a - * destructuring. - * @param {eslint-scope.Reference} reference A reference to get. - * @returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or - * null. - */ -function getDestructuringHost(reference) { - if (!reference.isWrite()) { - return null; - } - let node = reference.identifier.parent; - - while (PATTERN_TYPE.test(node.type)) { - node = node.parent; - } - - if (!DESTRUCTURING_HOST_TYPE.test(node.type)) { - return null; - } - return node; -} - -/** - * Determines if a destructuring assignment node contains - * any MemberExpression nodes. This is used to determine if a - * variable that is only written once using destructuring can be - * safely converted into a const declaration. - * @param {ASTNode} node The ObjectPattern or ArrayPattern node to check. - * @returns {boolean} True if the destructuring pattern contains - * a MemberExpression, false if not. - */ -function hasMemberExpressionAssignment(node) { - switch (node.type) { - case "ObjectPattern": - return node.properties.some(prop => { - if (prop) { - - /* - * Spread elements have an argument property while - * others have a value property. Because different - * parsers use different node types for spread elements, - * we just check if there is an argument property. - */ - return hasMemberExpressionAssignment(prop.argument || prop.value); - } - - return false; - }); - - case "ArrayPattern": - return node.elements.some(element => { - if (element) { - return hasMemberExpressionAssignment(element); - } - - return false; - }); - - case "AssignmentPattern": - return hasMemberExpressionAssignment(node.left); - - case "MemberExpression": - return true; - - // no default - } - - return false; -} - -/** - * Gets an identifier node of a given variable. - * - * If the initialization exists or one or more reading references exist before - * the first assignment, the identifier node is the node of the declaration. - * Otherwise, the identifier node is the node of the first assignment. - * - * If the variable should not change to const, this function returns null. - * - If the variable is reassigned. - * - If the variable is never initialized nor assigned. - * - If the variable is initialized in a different scope from the declaration. - * - If the unique assignment of the variable cannot change to a declaration. - * e.g. `if (a) b = 1` / `return (b = 1)` - * - If the variable is declared in the global scope and `eslintUsed` is `true`. - * `/*exported foo` directive comment makes such variables. This rule does not - * warn such variables because this rule cannot distinguish whether the - * exported variables are reassigned or not. - * @param {eslint-scope.Variable} variable A variable to get. - * @param {boolean} ignoreReadBeforeAssign - * The value of `ignoreReadBeforeAssign` option. - * @returns {ASTNode|null} - * An Identifier node if the variable should change to const. - * Otherwise, null. - */ -function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) { - if (variable.eslintUsed && variable.scope.type === "global") { - return null; - } - - // Finds the unique WriteReference. - let writer = null; - let isReadBeforeInit = false; - const references = variable.references; - - for (let i = 0; i < references.length; ++i) { - const reference = references[i]; - - if (reference.isWrite()) { - const isReassigned = ( - writer !== null && - writer.identifier !== reference.identifier - ); - - if (isReassigned) { - return null; - } - - const destructuringHost = getDestructuringHost(reference); - - if (destructuringHost !== null && destructuringHost.left !== void 0) { - const leftNode = destructuringHost.left; - let hasOuterVariables = false, - hasNonIdentifiers = false; - - if (leftNode.type === "ObjectPattern") { - const properties = leftNode.properties; - - hasOuterVariables = properties - .filter(prop => prop.value) - .map(prop => prop.value.name) - .some(name => isOuterVariableInDestructing(name, variable.scope)); - - hasNonIdentifiers = hasMemberExpressionAssignment(leftNode); - - } else if (leftNode.type === "ArrayPattern") { - const elements = leftNode.elements; - - hasOuterVariables = elements - .map(element => element && element.name) - .some(name => isOuterVariableInDestructing(name, variable.scope)); - - hasNonIdentifiers = hasMemberExpressionAssignment(leftNode); - } - - if (hasOuterVariables || hasNonIdentifiers) { - return null; - } - - } - - writer = reference; - - } else if (reference.isRead() && writer === null) { - if (ignoreReadBeforeAssign) { - return null; - } - isReadBeforeInit = true; - } - } - - /* - * If the assignment is from a different scope, ignore it. - * If the assignment cannot change to a declaration, ignore it. - */ - const shouldBeConst = ( - writer !== null && - writer.from === variable.scope && - canBecomeVariableDeclaration(writer.identifier) - ); - - if (!shouldBeConst) { - return null; - } - - if (isReadBeforeInit) { - return variable.defs[0].name; - } - - return writer.identifier; -} - -/** - * Groups by the VariableDeclarator/AssignmentExpression node that each - * reference of given variables belongs to. - * This is used to detect a mix of reassigned and never reassigned in a - * destructuring. - * @param {eslint-scope.Variable[]} variables Variables to group by destructuring. - * @param {boolean} ignoreReadBeforeAssign - * The value of `ignoreReadBeforeAssign` option. - * @returns {Map} Grouped identifier nodes. - */ -function groupByDestructuring(variables, ignoreReadBeforeAssign) { - const identifierMap = new Map(); - - for (let i = 0; i < variables.length; ++i) { - const variable = variables[i]; - const references = variable.references; - const identifier = getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign); - let prevId = null; - - for (let j = 0; j < references.length; ++j) { - const reference = references[j]; - const id = reference.identifier; - - /* - * Avoid counting a reference twice or more for default values of - * destructuring. - */ - if (id === prevId) { - continue; - } - prevId = id; - - // Add the identifier node into the destructuring group. - const group = getDestructuringHost(reference); - - if (group) { - if (identifierMap.has(group)) { - identifierMap.get(group).push(identifier); - } else { - identifierMap.set(group, [identifier]); - } - } - } - } - - return identifierMap; -} - -/** - * Finds the nearest parent of node with a given type. - * @param {ASTNode} node The node to search from. - * @param {string} type The type field of the parent node. - * @param {Function} shouldStop A predicate that returns true if the traversal should stop, and false otherwise. - * @returns {ASTNode} The closest ancestor with the specified type; null if no such ancestor exists. - */ -function findUp(node, type, shouldStop) { - if (!node || shouldStop(node)) { - return null; - } - if (node.type === type) { - return node; - } - return findUp(node.parent, type, shouldStop); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require `const` declarations for variables that are never reassigned after declared", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-const" - }, - - fixable: "code", - - schema: [ - { - type: "object", - properties: { - destructuring: { enum: ["any", "all"], default: "any" }, - ignoreReadBeforeAssign: { type: "boolean", default: false } - }, - additionalProperties: false - } - ], - messages: { - useConst: "'{{name}}' is never reassigned. Use 'const' instead." - } - }, - - create(context) { - const options = context.options[0] || {}; - const sourceCode = context.sourceCode; - const shouldMatchAnyDestructuredVariable = options.destructuring !== "all"; - const ignoreReadBeforeAssign = options.ignoreReadBeforeAssign === true; - const variables = []; - let reportCount = 0; - let checkedId = null; - let checkedName = ""; - - - /** - * Reports given identifier nodes if all of the nodes should be declared - * as const. - * - * The argument 'nodes' is an array of Identifier nodes. - * This node is the result of 'getIdentifierIfShouldBeConst()', so it's - * nullable. In simple declaration or assignment cases, the length of - * the array is 1. In destructuring cases, the length of the array can - * be 2 or more. - * @param {(eslint-scope.Reference|null)[]} nodes - * References which are grouped by destructuring to report. - * @returns {void} - */ - function checkGroup(nodes) { - const nodesToReport = nodes.filter(Boolean); - - if (nodes.length && (shouldMatchAnyDestructuredVariable || nodesToReport.length === nodes.length)) { - const varDeclParent = findUp(nodes[0], "VariableDeclaration", parentNode => parentNode.type.endsWith("Statement")); - const isVarDecParentNull = varDeclParent === null; - - if (!isVarDecParentNull && varDeclParent.declarations.length > 0) { - const firstDeclaration = varDeclParent.declarations[0]; - - if (firstDeclaration.init) { - const firstDecParent = firstDeclaration.init.parent; - - /* - * First we check the declaration type and then depending on - * if the type is a "VariableDeclarator" or its an "ObjectPattern" - * we compare the name and id from the first identifier, if the names are different - * we assign the new name, id and reset the count of reportCount and nodeCount in - * order to check each block for the number of reported errors and base our fix - * based on comparing nodes.length and nodesToReport.length. - */ - - if (firstDecParent.type === "VariableDeclarator") { - - if (firstDecParent.id.name !== checkedName) { - checkedName = firstDecParent.id.name; - reportCount = 0; - } - - if (firstDecParent.id.type === "ObjectPattern") { - if (firstDecParent.init.name !== checkedName) { - checkedName = firstDecParent.init.name; - reportCount = 0; - } - } - - if (firstDecParent.id !== checkedId) { - checkedId = firstDecParent.id; - reportCount = 0; - } - } - } - } - - let shouldFix = varDeclParent && - - // Don't do a fix unless all variables in the declarations are initialized (or it's in a for-in or for-of loop) - (varDeclParent.parent.type === "ForInStatement" || varDeclParent.parent.type === "ForOfStatement" || - varDeclParent.declarations.every(declaration => declaration.init)) && - - /* - * If options.destructuring is "all", then this warning will not occur unless - * every assignment in the destructuring should be const. In that case, it's safe - * to apply the fix. - */ - nodesToReport.length === nodes.length; - - if (!isVarDecParentNull && varDeclParent.declarations && varDeclParent.declarations.length !== 1) { - - if (varDeclParent && varDeclParent.declarations && varDeclParent.declarations.length >= 1) { - - /* - * Add nodesToReport.length to a count, then comparing the count to the length - * of the declarations in the current block. - */ - - reportCount += nodesToReport.length; - - let totalDeclarationsCount = 0; - - varDeclParent.declarations.forEach(declaration => { - if (declaration.id.type === "ObjectPattern") { - totalDeclarationsCount += declaration.id.properties.length; - } else if (declaration.id.type === "ArrayPattern") { - totalDeclarationsCount += declaration.id.elements.length; - } else { - totalDeclarationsCount += 1; - } - }); - - shouldFix = shouldFix && (reportCount === totalDeclarationsCount); - } - } - - nodesToReport.forEach(node => { - context.report({ - node, - messageId: "useConst", - data: node, - fix: shouldFix - ? fixer => { - const letKeywordToken = sourceCode.getFirstToken(varDeclParent, t => t.value === varDeclParent.kind); - - /** - * Extend the replacement range to the whole declaration, - * in order to prevent other fixes in the same pass - * https://github.com/eslint/eslint/issues/13899 - */ - return new FixTracker(fixer, sourceCode) - .retainRange(varDeclParent.range) - .replaceTextRange(letKeywordToken.range, "const"); - } - : null - }); - }); - } - } - - return { - "Program:exit"() { - groupByDestructuring(variables, ignoreReadBeforeAssign).forEach(checkGroup); - }, - - VariableDeclaration(node) { - if (node.kind === "let" && !isInitOfForStatement(node)) { - variables.push(...sourceCode.getDeclaredVariables(node)); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-destructuring.js b/node_modules/eslint/lib/rules/prefer-destructuring.js deleted file mode 100644 index c6075c55b..000000000 --- a/node_modules/eslint/lib/rules/prefer-destructuring.js +++ /dev/null @@ -1,301 +0,0 @@ -/** - * @fileoverview Prefer destructuring from arrays and objects - * @author Alex LaFroscia - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const PRECEDENCE_OF_ASSIGNMENT_EXPR = astUtils.getPrecedence({ type: "AssignmentExpression" }); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require destructuring from arrays and/or objects", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-destructuring" - }, - - fixable: "code", - - schema: [ - { - - /* - * old support {array: Boolean, object: Boolean} - * new support {VariableDeclarator: {}, AssignmentExpression: {}} - */ - oneOf: [ - { - type: "object", - properties: { - VariableDeclarator: { - type: "object", - properties: { - array: { - type: "boolean" - }, - object: { - type: "boolean" - } - }, - additionalProperties: false - }, - AssignmentExpression: { - type: "object", - properties: { - array: { - type: "boolean" - }, - object: { - type: "boolean" - } - }, - additionalProperties: false - } - }, - additionalProperties: false - }, - { - type: "object", - properties: { - array: { - type: "boolean" - }, - object: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - }, - { - type: "object", - properties: { - enforceForRenamedProperties: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - preferDestructuring: "Use {{type}} destructuring." - } - }, - create(context) { - - const enabledTypes = context.options[0]; - const enforceForRenamedProperties = context.options[1] && context.options[1].enforceForRenamedProperties; - let normalizedOptions = { - VariableDeclarator: { array: true, object: true }, - AssignmentExpression: { array: true, object: true } - }; - - if (enabledTypes) { - normalizedOptions = typeof enabledTypes.array !== "undefined" || typeof enabledTypes.object !== "undefined" - ? { VariableDeclarator: enabledTypes, AssignmentExpression: enabledTypes } - : enabledTypes; - } - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Checks if destructuring type should be checked. - * @param {string} nodeType "AssignmentExpression" or "VariableDeclarator" - * @param {string} destructuringType "array" or "object" - * @returns {boolean} `true` if the destructuring type should be checked for the given node - */ - function shouldCheck(nodeType, destructuringType) { - return normalizedOptions && - normalizedOptions[nodeType] && - normalizedOptions[nodeType][destructuringType]; - } - - /** - * Determines if the given node is accessing an array index - * - * This is used to differentiate array index access from object property - * access. - * @param {ASTNode} node the node to evaluate - * @returns {boolean} whether or not the node is an integer - */ - function isArrayIndexAccess(node) { - return Number.isInteger(node.property.value); - } - - /** - * Report that the given node should use destructuring - * @param {ASTNode} reportNode the node to report - * @param {string} type the type of destructuring that should have been done - * @param {Function|null} fix the fix function or null to pass to context.report - * @returns {void} - */ - function report(reportNode, type, fix) { - context.report({ - node: reportNode, - messageId: "preferDestructuring", - data: { type }, - fix - }); - } - - /** - * Determines if a node should be fixed into object destructuring - * - * The fixer only fixes the simplest case of object destructuring, - * like: `let x = a.x`; - * - * Assignment expression is not fixed. - * Array destructuring is not fixed. - * Renamed property is not fixed. - * @param {ASTNode} node the node to evaluate - * @returns {boolean} whether or not the node should be fixed - */ - function shouldFix(node) { - return node.type === "VariableDeclarator" && - node.id.type === "Identifier" && - node.init.type === "MemberExpression" && - !node.init.computed && - node.init.property.type === "Identifier" && - node.id.name === node.init.property.name; - } - - /** - * Fix a node into object destructuring. - * This function only handles the simplest case of object destructuring, - * see {@link shouldFix}. - * @param {SourceCodeFixer} fixer the fixer object - * @param {ASTNode} node the node to be fixed. - * @returns {Object} a fix for the node - */ - function fixIntoObjectDestructuring(fixer, node) { - const rightNode = node.init; - const sourceCode = context.sourceCode; - - // Don't fix if that would remove any comments. Only comments inside `rightNode.object` can be preserved. - if (sourceCode.getCommentsInside(node).length > sourceCode.getCommentsInside(rightNode.object).length) { - return null; - } - - let objectText = sourceCode.getText(rightNode.object); - - if (astUtils.getPrecedence(rightNode.object) < PRECEDENCE_OF_ASSIGNMENT_EXPR) { - objectText = `(${objectText})`; - } - - return fixer.replaceText( - node, - `{${rightNode.property.name}} = ${objectText}` - ); - } - - /** - * Check that the `prefer-destructuring` rules are followed based on the - * given left- and right-hand side of the assignment. - * - * Pulled out into a separate method so that VariableDeclarators and - * AssignmentExpressions can share the same verification logic. - * @param {ASTNode} leftNode the left-hand side of the assignment - * @param {ASTNode} rightNode the right-hand side of the assignment - * @param {ASTNode} reportNode the node to report the error on - * @returns {void} - */ - function performCheck(leftNode, rightNode, reportNode) { - if ( - rightNode.type !== "MemberExpression" || - rightNode.object.type === "Super" || - rightNode.property.type === "PrivateIdentifier" - ) { - return; - } - - if (isArrayIndexAccess(rightNode)) { - if (shouldCheck(reportNode.type, "array")) { - report(reportNode, "array", null); - } - return; - } - - const fix = shouldFix(reportNode) - ? fixer => fixIntoObjectDestructuring(fixer, reportNode) - : null; - - if (shouldCheck(reportNode.type, "object") && enforceForRenamedProperties) { - report(reportNode, "object", fix); - return; - } - - if (shouldCheck(reportNode.type, "object")) { - const property = rightNode.property; - - if ( - (property.type === "Literal" && leftNode.name === property.value) || - (property.type === "Identifier" && leftNode.name === property.name && !rightNode.computed) - ) { - report(reportNode, "object", fix); - } - } - } - - /** - * Check if a given variable declarator is coming from an property access - * that should be using destructuring instead - * @param {ASTNode} node the variable declarator to check - * @returns {void} - */ - function checkVariableDeclarator(node) { - - // Skip if variable is declared without assignment - if (!node.init) { - return; - } - - // We only care about member expressions past this point - if (node.init.type !== "MemberExpression") { - return; - } - - performCheck(node.id, node.init, node); - } - - /** - * Run the `prefer-destructuring` check on an AssignmentExpression - * @param {ASTNode} node the AssignmentExpression node - * @returns {void} - */ - function checkAssignmentExpression(node) { - if (node.operator === "=") { - performCheck(node.left, node.right, node); - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - VariableDeclarator: checkVariableDeclarator, - AssignmentExpression: checkAssignmentExpression - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js b/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js deleted file mode 100644 index dd4ba2c8e..000000000 --- a/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js +++ /dev/null @@ -1,190 +0,0 @@ -/** - * @fileoverview Rule to disallow Math.pow in favor of the ** operator - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { CALL, ReferenceTracker } = require("@eslint-community/eslint-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const PRECEDENCE_OF_EXPONENTIATION_EXPR = astUtils.getPrecedence({ type: "BinaryExpression", operator: "**" }); - -/** - * Determines whether the given node needs parens if used as the base in an exponentiation binary expression. - * @param {ASTNode} base The node to check. - * @returns {boolean} `true` if the node needs to be parenthesised. - */ -function doesBaseNeedParens(base) { - return ( - - // '**' is right-associative, parens are needed when Math.pow(a ** b, c) is converted to (a ** b) ** c - astUtils.getPrecedence(base) <= PRECEDENCE_OF_EXPONENTIATION_EXPR || - - // An unary operator cannot be used immediately before an exponentiation expression - base.type === "AwaitExpression" || - base.type === "UnaryExpression" - ); -} - -/** - * Determines whether the given node needs parens if used as the exponent in an exponentiation binary expression. - * @param {ASTNode} exponent The node to check. - * @returns {boolean} `true` if the node needs to be parenthesised. - */ -function doesExponentNeedParens(exponent) { - - // '**' is right-associative, there is no need for parens when Math.pow(a, b ** c) is converted to a ** b ** c - return astUtils.getPrecedence(exponent) < PRECEDENCE_OF_EXPONENTIATION_EXPR; -} - -/** - * Determines whether an exponentiation binary expression at the place of the given node would need parens. - * @param {ASTNode} node A node that would be replaced by an exponentiation binary expression. - * @param {SourceCode} sourceCode A SourceCode object. - * @returns {boolean} `true` if the expression needs to be parenthesised. - */ -function doesExponentiationExpressionNeedParens(node, sourceCode) { - const parent = node.parent.type === "ChainExpression" ? node.parent.parent : node.parent; - - const needsParens = ( - parent.type === "ClassDeclaration" || - ( - parent.type.endsWith("Expression") && - astUtils.getPrecedence(parent) >= PRECEDENCE_OF_EXPONENTIATION_EXPR && - !(parent.type === "BinaryExpression" && parent.operator === "**" && parent.right === node) && - !((parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.includes(node)) && - !(parent.type === "MemberExpression" && parent.computed && parent.property === node) && - !(parent.type === "ArrayExpression") - ) - ); - - return needsParens && !astUtils.isParenthesised(sourceCode, node); -} - -/** - * Optionally parenthesizes given text. - * @param {string} text The text to parenthesize. - * @param {boolean} shouldParenthesize If `true`, the text will be parenthesised. - * @returns {string} parenthesised or unchanged text. - */ -function parenthesizeIfShould(text, shouldParenthesize) { - return shouldParenthesize ? `(${text})` : text; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow the use of `Math.pow` in favor of the `**` operator", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-exponentiation-operator" - }, - - schema: [], - fixable: "code", - - messages: { - useExponentiation: "Use the '**' operator instead of 'Math.pow'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Reports the given node. - * @param {ASTNode} node 'Math.pow()' node to report. - * @returns {void} - */ - function report(node) { - context.report({ - node, - messageId: "useExponentiation", - fix(fixer) { - if ( - node.arguments.length !== 2 || - node.arguments.some(arg => arg.type === "SpreadElement") || - sourceCode.getCommentsInside(node).length > 0 - ) { - return null; - } - - const base = node.arguments[0], - exponent = node.arguments[1], - baseText = sourceCode.getText(base), - exponentText = sourceCode.getText(exponent), - shouldParenthesizeBase = doesBaseNeedParens(base), - shouldParenthesizeExponent = doesExponentNeedParens(exponent), - shouldParenthesizeAll = doesExponentiationExpressionNeedParens(node, sourceCode); - - let prefix = "", - suffix = ""; - - if (!shouldParenthesizeAll) { - if (!shouldParenthesizeBase) { - const firstReplacementToken = sourceCode.getFirstToken(base), - tokenBefore = sourceCode.getTokenBefore(node); - - if ( - tokenBefore && - tokenBefore.range[1] === node.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, firstReplacementToken) - ) { - prefix = " "; // a+Math.pow(++b, c) -> a+ ++b**c - } - } - if (!shouldParenthesizeExponent) { - const lastReplacementToken = sourceCode.getLastToken(exponent), - tokenAfter = sourceCode.getTokenAfter(node); - - if ( - tokenAfter && - node.range[1] === tokenAfter.range[0] && - !astUtils.canTokensBeAdjacent(lastReplacementToken, tokenAfter) - ) { - suffix = " "; // Math.pow(a, b)in c -> a**b in c - } - } - } - - const baseReplacement = parenthesizeIfShould(baseText, shouldParenthesizeBase), - exponentReplacement = parenthesizeIfShould(exponentText, shouldParenthesizeExponent), - replacement = parenthesizeIfShould(`${baseReplacement}**${exponentReplacement}`, shouldParenthesizeAll); - - return fixer.replaceText(node, `${prefix}${replacement}${suffix}`); - } - }); - } - - return { - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const trackMap = { - Math: { - pow: { [CALL]: true } - } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(trackMap)) { - report(refNode); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-named-capture-group.js b/node_modules/eslint/lib/rules/prefer-named-capture-group.js deleted file mode 100644 index 8fb68de17..000000000 --- a/node_modules/eslint/lib/rules/prefer-named-capture-group.js +++ /dev/null @@ -1,175 +0,0 @@ -/** - * @fileoverview Rule to enforce requiring named capture groups in regular expression. - * @author Pig Fang - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { - CALL, - CONSTRUCT, - ReferenceTracker, - getStringIfConstant -} = require("@eslint-community/eslint-utils"); -const regexpp = require("@eslint-community/regexpp"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const parser = new regexpp.RegExpParser(); - -/** - * Creates fixer suggestions for the regex, if statically determinable. - * @param {number} groupStart Starting index of the regex group. - * @param {string} pattern The regular expression pattern to be checked. - * @param {string} rawText Source text of the regexNode. - * @param {ASTNode} regexNode AST node which contains the regular expression. - * @returns {Array} Fixer suggestions for the regex, if statically determinable. - */ -function suggestIfPossible(groupStart, pattern, rawText, regexNode) { - switch (regexNode.type) { - case "Literal": - if (typeof regexNode.value === "string" && rawText.includes("\\")) { - return null; - } - break; - case "TemplateLiteral": - if (regexNode.expressions.length || rawText.slice(1, -1) !== pattern) { - return null; - } - break; - default: - return null; - } - - const start = regexNode.range[0] + groupStart + 2; - - return [ - { - fix(fixer) { - const existingTemps = pattern.match(/temp\d+/gu) || []; - const highestTempCount = existingTemps.reduce( - (previous, next) => - Math.max(previous, Number(next.slice("temp".length))), - 0 - ); - - return fixer.insertTextBeforeRange( - [start, start], - `?` - ); - }, - messageId: "addGroupName" - }, - { - fix(fixer) { - return fixer.insertTextBeforeRange( - [start, start], - "?:" - ); - }, - messageId: "addNonCapture" - } - ]; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce using named capture group in regular expression", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-named-capture-group" - }, - - hasSuggestions: true, - - schema: [], - - messages: { - addGroupName: "Add name to capture group.", - addNonCapture: "Convert group to non-capturing.", - required: "Capture group '{{group}}' should be converted to a named or non-capturing group." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Function to check regular expression. - * @param {string} pattern The regular expression pattern to be checked. - * @param {ASTNode} node AST node which contains the regular expression or a call/new expression. - * @param {ASTNode} regexNode AST node which contains the regular expression. - * @param {boolean} uFlag Flag indicates whether unicode mode is enabled or not. - * @returns {void} - */ - function checkRegex(pattern, node, regexNode, uFlag) { - let ast; - - try { - ast = parser.parsePattern(pattern, 0, pattern.length, uFlag); - } catch { - - // ignore regex syntax errors - return; - } - - regexpp.visitRegExpAST(ast, { - onCapturingGroupEnter(group) { - if (!group.name) { - const rawText = sourceCode.getText(regexNode); - const suggest = suggestIfPossible(group.start, pattern, rawText, regexNode); - - context.report({ - node, - messageId: "required", - data: { - group: group.raw - }, - suggest - }); - } - } - }); - } - - return { - Literal(node) { - if (node.regex) { - checkRegex(node.regex.pattern, node, node, node.regex.flags.includes("u")); - } - }, - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const traceMap = { - RegExp: { - [CALL]: true, - [CONSTRUCT]: true - } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(traceMap)) { - const regex = getStringIfConstant(refNode.arguments[0]); - const flags = getStringIfConstant(refNode.arguments[1]); - - if (regex) { - checkRegex(regex, refNode, refNode.arguments[0], flags && flags.includes("u")); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-numeric-literals.js b/node_modules/eslint/lib/rules/prefer-numeric-literals.js deleted file mode 100644 index 118d6dce4..000000000 --- a/node_modules/eslint/lib/rules/prefer-numeric-literals.js +++ /dev/null @@ -1,148 +0,0 @@ -/** - * @fileoverview Rule to disallow `parseInt()` in favor of binary, octal, and hexadecimal literals - * @author Annie Zhang, Henry Zhu - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const radixMap = new Map([ - [2, { system: "binary", literalPrefix: "0b" }], - [8, { system: "octal", literalPrefix: "0o" }], - [16, { system: "hexadecimal", literalPrefix: "0x" }] -]); - -/** - * Checks to see if a CallExpression's callee node is `parseInt` or - * `Number.parseInt`. - * @param {ASTNode} calleeNode The callee node to evaluate. - * @returns {boolean} True if the callee is `parseInt` or `Number.parseInt`, - * false otherwise. - */ -function isParseInt(calleeNode) { - return ( - astUtils.isSpecificId(calleeNode, "parseInt") || - astUtils.isSpecificMemberAccess(calleeNode, "Number", "parseInt") - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-numeric-literals" - }, - - schema: [], - - messages: { - useLiteral: "Use {{system}} literals instead of {{functionName}}()." - }, - - fixable: "code" - }, - - create(context) { - const sourceCode = context.sourceCode; - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - - "CallExpression[arguments.length=2]"(node) { - const [strNode, radixNode] = node.arguments, - str = astUtils.getStaticStringValue(strNode), - radix = radixNode.value; - - if ( - str !== null && - astUtils.isStringLiteral(strNode) && - radixNode.type === "Literal" && - typeof radix === "number" && - radixMap.has(radix) && - isParseInt(node.callee) - ) { - - const { system, literalPrefix } = radixMap.get(radix); - - context.report({ - node, - messageId: "useLiteral", - data: { - system, - functionName: sourceCode.getText(node.callee) - }, - fix(fixer) { - if (sourceCode.getCommentsInside(node).length) { - return null; - } - - const replacement = `${literalPrefix}${str}`; - - if (+replacement !== parseInt(str, radix)) { - - /* - * If the newly-produced literal would be invalid, (e.g. 0b1234), - * or it would yield an incorrect parseInt result for some other reason, don't make a fix. - * - * If `str` had numeric separators, `+replacement` will evaluate to `NaN` because unary `+` - * per the specification doesn't support numeric separators. Thus, the above condition will be `true` - * (`NaN !== anything` is always `true`) regardless of the `parseInt(str, radix)` value. - * Consequently, no autofixes will be made. This is correct behavior because `parseInt` also - * doesn't support numeric separators, but it does parse part of the string before the first `_`, - * so the autofix would be invalid: - * - * parseInt("1_1", 2) // === 1 - * 0b1_1 // === 3 - */ - return null; - } - - const tokenBefore = sourceCode.getTokenBefore(node), - tokenAfter = sourceCode.getTokenAfter(node); - let prefix = "", - suffix = ""; - - if ( - tokenBefore && - tokenBefore.range[1] === node.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, replacement) - ) { - prefix = " "; - } - - if ( - tokenAfter && - node.range[1] === tokenAfter.range[0] && - !astUtils.canTokensBeAdjacent(replacement, tokenAfter) - ) { - suffix = " "; - } - - return fixer.replaceText(node, `${prefix}${replacement}${suffix}`); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-object-has-own.js b/node_modules/eslint/lib/rules/prefer-object-has-own.js deleted file mode 100644 index 97ea64fa6..000000000 --- a/node_modules/eslint/lib/rules/prefer-object-has-own.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @fileoverview Prefers Object.hasOwn() instead of Object.prototype.hasOwnProperty.call() - * @author Nitin Kumar - * @author Gautam Arora - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks if the given node is considered to be an access to a property of `Object.prototype`. - * @param {ASTNode} node `MemberExpression` node to evaluate. - * @returns {boolean} `true` if `node.object` is `Object`, `Object.prototype`, or `{}` (empty 'ObjectExpression' node). - */ -function hasLeftHandObject(node) { - - /* - * ({}).hasOwnProperty.call(obj, prop) - `true` - * ({ foo }.hasOwnProperty.call(obj, prop)) - `false`, object literal should be empty - */ - if (node.object.type === "ObjectExpression" && node.object.properties.length === 0) { - return true; - } - - const objectNodeToCheck = node.object.type === "MemberExpression" && astUtils.getStaticPropertyName(node.object) === "prototype" ? node.object.object : node.object; - - if (objectNodeToCheck.type === "Identifier" && objectNodeToCheck.name === "Object") { - return true; - } - - return false; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - docs: { - description: - "Disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-object-has-own" - }, - schema: [], - messages: { - useHasOwn: "Use 'Object.hasOwn()' instead of 'Object.prototype.hasOwnProperty.call()'." - }, - fixable: "code" - }, - create(context) { - - const sourceCode = context.sourceCode; - - return { - CallExpression(node) { - if (!(node.callee.type === "MemberExpression" && node.callee.object.type === "MemberExpression")) { - return; - } - - const calleePropertyName = astUtils.getStaticPropertyName(node.callee); - const objectPropertyName = astUtils.getStaticPropertyName(node.callee.object); - const isObject = hasLeftHandObject(node.callee.object); - - // check `Object` scope - const scope = sourceCode.getScope(node); - const variable = astUtils.getVariableByName(scope, "Object"); - - if ( - calleePropertyName === "call" && - objectPropertyName === "hasOwnProperty" && - isObject && - variable && variable.scope.type === "global" - ) { - context.report({ - node, - messageId: "useHasOwn", - fix(fixer) { - - if (sourceCode.getCommentsInside(node.callee).length > 0) { - return null; - } - - const tokenJustBeforeNode = sourceCode.getTokenBefore(node.callee, { includeComments: true }); - - // for https://github.com/eslint/eslint/pull/15346#issuecomment-991417335 - if ( - tokenJustBeforeNode && - tokenJustBeforeNode.range[1] === node.callee.range[0] && - !astUtils.canTokensBeAdjacent(tokenJustBeforeNode, "Object.hasOwn") - ) { - return fixer.replaceText(node.callee, " Object.hasOwn"); - } - - return fixer.replaceText(node.callee, "Object.hasOwn"); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-object-spread.js b/node_modules/eslint/lib/rules/prefer-object-spread.js deleted file mode 100644 index 60b0c3175..000000000 --- a/node_modules/eslint/lib/rules/prefer-object-spread.js +++ /dev/null @@ -1,298 +0,0 @@ -/** - * @fileoverview Prefers object spread property over Object.assign - * @author Sharmila Jesupaul - */ - -"use strict"; - -const { CALL, ReferenceTracker } = require("@eslint-community/eslint-utils"); -const { - isCommaToken, - isOpeningParenToken, - isClosingParenToken, - isParenthesised -} = require("./utils/ast-utils"); - -const ANY_SPACE = /\s/u; - -/** - * Helper that checks if the Object.assign call has array spread - * @param {ASTNode} node The node that the rule warns on - * @returns {boolean} - Returns true if the Object.assign call has array spread - */ -function hasArraySpread(node) { - return node.arguments.some(arg => arg.type === "SpreadElement"); -} - -/** - * Determines whether the given node is an accessor property (getter/setter). - * @param {ASTNode} node Node to check. - * @returns {boolean} `true` if the node is a getter or a setter. - */ -function isAccessorProperty(node) { - return node.type === "Property" && - (node.kind === "get" || node.kind === "set"); -} - -/** - * Determines whether the given object expression node has accessor properties (getters/setters). - * @param {ASTNode} node `ObjectExpression` node to check. - * @returns {boolean} `true` if the node has at least one getter/setter. - */ -function hasAccessors(node) { - return node.properties.some(isAccessorProperty); -} - -/** - * Determines whether the given call expression node has object expression arguments with accessor properties (getters/setters). - * @param {ASTNode} node `CallExpression` node to check. - * @returns {boolean} `true` if the node has at least one argument that is an object expression with at least one getter/setter. - */ -function hasArgumentsWithAccessors(node) { - return node.arguments - .filter(arg => arg.type === "ObjectExpression") - .some(hasAccessors); -} - -/** - * Helper that checks if the node needs parentheses to be valid JS. - * The default is to wrap the node in parentheses to avoid parsing errors. - * @param {ASTNode} node The node that the rule warns on - * @param {Object} sourceCode in context sourcecode object - * @returns {boolean} - Returns true if the node needs parentheses - */ -function needsParens(node, sourceCode) { - const parent = node.parent; - - switch (parent.type) { - case "VariableDeclarator": - case "ArrayExpression": - case "ReturnStatement": - case "CallExpression": - case "Property": - return false; - case "AssignmentExpression": - return parent.left === node && !isParenthesised(sourceCode, node); - default: - return !isParenthesised(sourceCode, node); - } -} - -/** - * Determines if an argument needs parentheses. The default is to not add parens. - * @param {ASTNode} node The node to be checked. - * @param {Object} sourceCode in context sourcecode object - * @returns {boolean} True if the node needs parentheses - */ -function argNeedsParens(node, sourceCode) { - switch (node.type) { - case "AssignmentExpression": - case "ArrowFunctionExpression": - case "ConditionalExpression": - return !isParenthesised(sourceCode, node); - default: - return false; - } -} - -/** - * Get the parenthesis tokens of a given ObjectExpression node. - * This includes the braces of the object literal and enclosing parentheses. - * @param {ASTNode} node The node to get. - * @param {Token} leftArgumentListParen The opening paren token of the argument list. - * @param {SourceCode} sourceCode The source code object to get tokens. - * @returns {Token[]} The parenthesis tokens of the node. This is sorted by the location. - */ -function getParenTokens(node, leftArgumentListParen, sourceCode) { - const parens = [sourceCode.getFirstToken(node), sourceCode.getLastToken(node)]; - let leftNext = sourceCode.getTokenBefore(node); - let rightNext = sourceCode.getTokenAfter(node); - - // Note: don't include the parens of the argument list. - while ( - leftNext && - rightNext && - leftNext.range[0] > leftArgumentListParen.range[0] && - isOpeningParenToken(leftNext) && - isClosingParenToken(rightNext) - ) { - parens.push(leftNext, rightNext); - leftNext = sourceCode.getTokenBefore(leftNext); - rightNext = sourceCode.getTokenAfter(rightNext); - } - - return parens.sort((a, b) => a.range[0] - b.range[0]); -} - -/** - * Get the range of a given token and around whitespaces. - * @param {Token} token The token to get range. - * @param {SourceCode} sourceCode The source code object to get tokens. - * @returns {number} The end of the range of the token and around whitespaces. - */ -function getStartWithSpaces(token, sourceCode) { - const text = sourceCode.text; - let start = token.range[0]; - - // If the previous token is a line comment then skip this step to avoid commenting this token out. - { - const prevToken = sourceCode.getTokenBefore(token, { includeComments: true }); - - if (prevToken && prevToken.type === "Line") { - return start; - } - } - - // Detect spaces before the token. - while (ANY_SPACE.test(text[start - 1] || "")) { - start -= 1; - } - - return start; -} - -/** - * Get the range of a given token and around whitespaces. - * @param {Token} token The token to get range. - * @param {SourceCode} sourceCode The source code object to get tokens. - * @returns {number} The start of the range of the token and around whitespaces. - */ -function getEndWithSpaces(token, sourceCode) { - const text = sourceCode.text; - let end = token.range[1]; - - // Detect spaces after the token. - while (ANY_SPACE.test(text[end] || "")) { - end += 1; - } - - return end; -} - -/** - * Autofixes the Object.assign call to use an object spread instead. - * @param {ASTNode|null} node The node that the rule warns on, i.e. the Object.assign call - * @param {string} sourceCode sourceCode of the Object.assign call - * @returns {Function} autofixer - replaces the Object.assign with a spread object. - */ -function defineFixer(node, sourceCode) { - return function *(fixer) { - const leftParen = sourceCode.getTokenAfter(node.callee, isOpeningParenToken); - const rightParen = sourceCode.getLastToken(node); - - // Remove everything before the opening paren: callee `Object.assign`, type arguments, and whitespace between the callee and the paren. - yield fixer.removeRange([node.range[0], leftParen.range[0]]); - - // Replace the parens of argument list to braces. - if (needsParens(node, sourceCode)) { - yield fixer.replaceText(leftParen, "({"); - yield fixer.replaceText(rightParen, "})"); - } else { - yield fixer.replaceText(leftParen, "{"); - yield fixer.replaceText(rightParen, "}"); - } - - // Process arguments. - for (const argNode of node.arguments) { - const innerParens = getParenTokens(argNode, leftParen, sourceCode); - const left = innerParens.shift(); - const right = innerParens.pop(); - - if (argNode.type === "ObjectExpression") { - const maybeTrailingComma = sourceCode.getLastToken(argNode, 1); - const maybeArgumentComma = sourceCode.getTokenAfter(right); - - /* - * Make bare this object literal. - * And remove spaces inside of the braces for better formatting. - */ - for (const innerParen of innerParens) { - yield fixer.remove(innerParen); - } - const leftRange = [left.range[0], getEndWithSpaces(left, sourceCode)]; - const rightRange = [ - Math.max(getStartWithSpaces(right, sourceCode), leftRange[1]), // Ensure ranges don't overlap - right.range[1] - ]; - - yield fixer.removeRange(leftRange); - yield fixer.removeRange(rightRange); - - // Remove the comma of this argument if it's duplication. - if ( - (argNode.properties.length === 0 || isCommaToken(maybeTrailingComma)) && - isCommaToken(maybeArgumentComma) - ) { - yield fixer.remove(maybeArgumentComma); - } - } else { - - // Make spread. - if (argNeedsParens(argNode, sourceCode)) { - yield fixer.insertTextBefore(left, "...("); - yield fixer.insertTextAfter(right, ")"); - } else { - yield fixer.insertTextBefore(left, "..."); - } - } - } - }; -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: - "Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-object-spread" - }, - - schema: [], - fixable: "code", - - messages: { - useSpreadMessage: "Use an object spread instead of `Object.assign` eg: `{ ...foo }`.", - useLiteralMessage: "Use an object literal instead of `Object.assign`. eg: `{ foo: bar }`." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const trackMap = { - Object: { - assign: { [CALL]: true } - } - }; - - // Iterate all calls of `Object.assign` (only of the global variable `Object`). - for (const { node: refNode } of tracker.iterateGlobalReferences(trackMap)) { - if ( - refNode.arguments.length >= 1 && - refNode.arguments[0].type === "ObjectExpression" && - !hasArraySpread(refNode) && - !( - refNode.arguments.length > 1 && - hasArgumentsWithAccessors(refNode) - ) - ) { - const messageId = refNode.arguments.length === 1 - ? "useLiteralMessage" - : "useSpreadMessage"; - const fix = defineFixer(refNode, sourceCode); - - context.report({ node: refNode, messageId, fix }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js b/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js deleted file mode 100644 index e990265e9..000000000 --- a/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @fileoverview restrict values that can be used as Promise rejection reasons - * @author Teddy Katz - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require using Error objects as Promise rejection reasons", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-promise-reject-errors" - }, - - fixable: null, - - schema: [ - { - type: "object", - properties: { - allowEmptyReject: { type: "boolean", default: false } - }, - additionalProperties: false - } - ], - - messages: { - rejectAnError: "Expected the Promise rejection reason to be an Error." - } - }, - - create(context) { - - const ALLOW_EMPTY_REJECT = context.options.length && context.options[0].allowEmptyReject; - const sourceCode = context.sourceCode; - - //---------------------------------------------------------------------- - // Helpers - //---------------------------------------------------------------------- - - /** - * Checks the argument of a reject() or Promise.reject() CallExpression, and reports it if it can't be an Error - * @param {ASTNode} callExpression A CallExpression node which is used to reject a Promise - * @returns {void} - */ - function checkRejectCall(callExpression) { - if (!callExpression.arguments.length && ALLOW_EMPTY_REJECT) { - return; - } - if ( - !callExpression.arguments.length || - !astUtils.couldBeError(callExpression.arguments[0]) || - callExpression.arguments[0].type === "Identifier" && callExpression.arguments[0].name === "undefined" - ) { - context.report({ - node: callExpression, - messageId: "rejectAnError" - }); - } - } - - /** - * Determines whether a function call is a Promise.reject() call - * @param {ASTNode} node A CallExpression node - * @returns {boolean} `true` if the call is a Promise.reject() call - */ - function isPromiseRejectCall(node) { - return astUtils.isSpecificMemberAccess(node.callee, "Promise", "reject"); - } - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - - // Check `Promise.reject(value)` calls. - CallExpression(node) { - if (isPromiseRejectCall(node)) { - checkRejectCall(node); - } - }, - - /* - * Check for `new Promise((resolve, reject) => {})`, and check for reject() calls. - * This function is run on "NewExpression:exit" instead of "NewExpression" to ensure that - * the nodes in the expression already have the `parent` property. - */ - "NewExpression:exit"(node) { - if ( - node.callee.type === "Identifier" && node.callee.name === "Promise" && - node.arguments.length && astUtils.isFunction(node.arguments[0]) && - node.arguments[0].params.length > 1 && node.arguments[0].params[1].type === "Identifier" - ) { - sourceCode.getDeclaredVariables(node.arguments[0]) - - /* - * Find the first variable that matches the second parameter's name. - * If the first parameter has the same name as the second parameter, then the variable will actually - * be "declared" when the first parameter is evaluated, but then it will be immediately overwritten - * by the second parameter. It's not possible for an expression with the variable to be evaluated before - * the variable is overwritten, because functions with duplicate parameters cannot have destructuring or - * default assignments in their parameter lists. Therefore, it's not necessary to explicitly account for - * this case. - */ - .find(variable => variable.name === node.arguments[0].params[1].name) - - // Get the references to that variable. - .references - - // Only check the references that read the parameter's value. - .filter(ref => ref.isRead()) - - // Only check the references that are used as the callee in a function call, e.g. `reject(foo)`. - .filter(ref => ref.identifier.parent.type === "CallExpression" && ref.identifier === ref.identifier.parent.callee) - - // Check the argument of the function call to determine whether it's an Error. - .forEach(ref => checkRejectCall(ref.identifier.parent)); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-reflect.js b/node_modules/eslint/lib/rules/prefer-reflect.js deleted file mode 100644 index d579b486b..000000000 --- a/node_modules/eslint/lib/rules/prefer-reflect.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - * @fileoverview Rule to suggest using "Reflect" api over Function/Object methods - * @author Keith Cirkel - * @deprecated in ESLint v3.9.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require `Reflect` methods where applicable", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-reflect" - }, - - deprecated: true, - - replacedBy: [], - - schema: [ - { - type: "object", - properties: { - exceptions: { - type: "array", - items: { - enum: [ - "apply", - "call", - "delete", - "defineProperty", - "getOwnPropertyDescriptor", - "getPrototypeOf", - "setPrototypeOf", - "isExtensible", - "getOwnPropertyNames", - "preventExtensions" - ] - }, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - preferReflect: "Avoid using {{existing}}, instead use {{substitute}}." - } - }, - - create(context) { - const existingNames = { - apply: "Function.prototype.apply", - call: "Function.prototype.call", - defineProperty: "Object.defineProperty", - getOwnPropertyDescriptor: "Object.getOwnPropertyDescriptor", - getPrototypeOf: "Object.getPrototypeOf", - setPrototypeOf: "Object.setPrototypeOf", - isExtensible: "Object.isExtensible", - getOwnPropertyNames: "Object.getOwnPropertyNames", - preventExtensions: "Object.preventExtensions" - }; - - const reflectSubstitutes = { - apply: "Reflect.apply", - call: "Reflect.apply", - defineProperty: "Reflect.defineProperty", - getOwnPropertyDescriptor: "Reflect.getOwnPropertyDescriptor", - getPrototypeOf: "Reflect.getPrototypeOf", - setPrototypeOf: "Reflect.setPrototypeOf", - isExtensible: "Reflect.isExtensible", - getOwnPropertyNames: "Reflect.getOwnPropertyNames", - preventExtensions: "Reflect.preventExtensions" - }; - - const exceptions = (context.options[0] || {}).exceptions || []; - - /** - * Reports the Reflect violation based on the `existing` and `substitute` - * @param {Object} node The node that violates the rule. - * @param {string} existing The existing method name that has been used. - * @param {string} substitute The Reflect substitute that should be used. - * @returns {void} - */ - function report(node, existing, substitute) { - context.report({ - node, - messageId: "preferReflect", - data: { - existing, - substitute - } - }); - } - - return { - CallExpression(node) { - const methodName = (node.callee.property || {}).name; - const isReflectCall = (node.callee.object || {}).name === "Reflect"; - const hasReflectSubstitute = Object.prototype.hasOwnProperty.call(reflectSubstitutes, methodName); - const userConfiguredException = exceptions.includes(methodName); - - if (hasReflectSubstitute && !isReflectCall && !userConfiguredException) { - report(node, existingNames[methodName], reflectSubstitutes[methodName]); - } - }, - UnaryExpression(node) { - const isDeleteOperator = node.operator === "delete"; - const targetsIdentifier = node.argument.type === "Identifier"; - const userConfiguredException = exceptions.includes("delete"); - - if (isDeleteOperator && !targetsIdentifier && !userConfiguredException) { - report(node, "the delete keyword", "Reflect.deleteProperty"); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-regex-literals.js b/node_modules/eslint/lib/rules/prefer-regex-literals.js deleted file mode 100644 index 39e295064..000000000 --- a/node_modules/eslint/lib/rules/prefer-regex-literals.js +++ /dev/null @@ -1,510 +0,0 @@ -/** - * @fileoverview Rule to disallow use of the `RegExp` constructor in favor of regular expression literals - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { CALL, CONSTRUCT, ReferenceTracker, findVariable } = require("@eslint-community/eslint-utils"); -const { RegExpValidator, visitRegExpAST, RegExpParser } = require("@eslint-community/regexpp"); -const { canTokensBeAdjacent } = require("./utils/ast-utils"); -const { REGEXPP_LATEST_ECMA_VERSION } = require("./utils/regular-expressions"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines whether the given node is a string literal. - * @param {ASTNode} node Node to check. - * @returns {boolean} True if the node is a string literal. - */ -function isStringLiteral(node) { - return node.type === "Literal" && typeof node.value === "string"; -} - -/** - * Determines whether the given node is a regex literal. - * @param {ASTNode} node Node to check. - * @returns {boolean} True if the node is a regex literal. - */ -function isRegexLiteral(node) { - return node.type === "Literal" && Object.prototype.hasOwnProperty.call(node, "regex"); -} - -/** - * Determines whether the given node is a template literal without expressions. - * @param {ASTNode} node Node to check. - * @returns {boolean} True if the node is a template literal without expressions. - */ -function isStaticTemplateLiteral(node) { - return node.type === "TemplateLiteral" && node.expressions.length === 0; -} - -const validPrecedingTokens = new Set([ - "(", - ";", - "[", - ",", - "=", - "+", - "*", - "-", - "?", - "~", - "%", - "**", - "!", - "typeof", - "instanceof", - "&&", - "||", - "??", - "return", - "...", - "delete", - "void", - "in", - "<", - ">", - "<=", - ">=", - "==", - "===", - "!=", - "!==", - "<<", - ">>", - ">>>", - "&", - "|", - "^", - ":", - "{", - "=>", - "*=", - "<<=", - ">>=", - ">>>=", - "^=", - "|=", - "&=", - "??=", - "||=", - "&&=", - "**=", - "+=", - "-=", - "/=", - "%=", - "/", - "do", - "break", - "continue", - "debugger", - "case", - "throw" -]); - - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow use of the `RegExp` constructor in favor of regular expression literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-regex-literals" - }, - - hasSuggestions: true, - - schema: [ - { - type: "object", - properties: { - disallowRedundantWrapping: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedRegExp: "Use a regular expression literal instead of the 'RegExp' constructor.", - replaceWithLiteral: "Replace with an equivalent regular expression literal.", - replaceWithLiteralAndFlags: "Replace with an equivalent regular expression literal with flags '{{ flags }}'.", - replaceWithIntendedLiteralAndFlags: "Replace with a regular expression literal with flags '{{ flags }}'.", - unexpectedRedundantRegExp: "Regular expression literal is unnecessarily wrapped within a 'RegExp' constructor.", - unexpectedRedundantRegExpWithFlags: "Use regular expression literal with flags instead of the 'RegExp' constructor." - } - }, - - create(context) { - const [{ disallowRedundantWrapping = false } = {}] = context.options; - const sourceCode = context.sourceCode; - - /** - * Determines whether the given identifier node is a reference to a global variable. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} True if the identifier is a reference to a global variable. - */ - function isGlobalReference(node) { - const scope = sourceCode.getScope(node); - const variable = findVariable(scope, node); - - return variable !== null && variable.scope.type === "global" && variable.defs.length === 0; - } - - /** - * Determines whether the given node is a String.raw`` tagged template expression - * with a static template literal. - * @param {ASTNode} node Node to check. - * @returns {boolean} True if the node is String.raw`` with a static template. - */ - function isStringRawTaggedStaticTemplateLiteral(node) { - return node.type === "TaggedTemplateExpression" && - astUtils.isSpecificMemberAccess(node.tag, "String", "raw") && - isGlobalReference(astUtils.skipChainExpression(node.tag).object) && - isStaticTemplateLiteral(node.quasi); - } - - /** - * Gets the value of a string - * @param {ASTNode} node The node to get the string of. - * @returns {string|null} The value of the node. - */ - function getStringValue(node) { - if (isStringLiteral(node)) { - return node.value; - } - - if (isStaticTemplateLiteral(node)) { - return node.quasis[0].value.cooked; - } - - if (isStringRawTaggedStaticTemplateLiteral(node)) { - return node.quasi.quasis[0].value.raw; - } - - return null; - } - - /** - * Determines whether the given node is considered to be a static string by the logic of this rule. - * @param {ASTNode} node Node to check. - * @returns {boolean} True if the node is a static string. - */ - function isStaticString(node) { - return isStringLiteral(node) || - isStaticTemplateLiteral(node) || - isStringRawTaggedStaticTemplateLiteral(node); - } - - /** - * Determines whether the relevant arguments of the given are all static string literals. - * @param {ASTNode} node Node to check. - * @returns {boolean} True if all arguments are static strings. - */ - function hasOnlyStaticStringArguments(node) { - const args = node.arguments; - - if ((args.length === 1 || args.length === 2) && args.every(isStaticString)) { - return true; - } - - return false; - } - - /** - * Determines whether the arguments of the given node indicate that a regex literal is unnecessarily wrapped. - * @param {ASTNode} node Node to check. - * @returns {boolean} True if the node already contains a regex literal argument. - */ - function isUnnecessarilyWrappedRegexLiteral(node) { - const args = node.arguments; - - if (args.length === 1 && isRegexLiteral(args[0])) { - return true; - } - - if (args.length === 2 && isRegexLiteral(args[0]) && isStaticString(args[1])) { - return true; - } - - return false; - } - - /** - * Returns a ecmaVersion compatible for regexpp. - * @param {number} ecmaVersion The ecmaVersion to convert. - * @returns {import("regexpp/ecma-versions").EcmaVersion} The resulting ecmaVersion compatible for regexpp. - */ - function getRegexppEcmaVersion(ecmaVersion) { - if (ecmaVersion <= 5) { - return 5; - } - return Math.min(ecmaVersion, REGEXPP_LATEST_ECMA_VERSION); - } - - const regexppEcmaVersion = getRegexppEcmaVersion(context.languageOptions.ecmaVersion); - - /** - * Makes a character escaped or else returns null. - * @param {string} character The character to escape. - * @returns {string} The resulting escaped character. - */ - function resolveEscapes(character) { - switch (character) { - case "\n": - case "\\\n": - return "\\n"; - - case "\r": - case "\\\r": - return "\\r"; - - case "\t": - case "\\\t": - return "\\t"; - - case "\v": - case "\\\v": - return "\\v"; - - case "\f": - case "\\\f": - return "\\f"; - - case "/": - return "\\/"; - - default: - return null; - } - } - - /** - * Checks whether the given regex and flags are valid for the ecma version or not. - * @param {string} pattern The regex pattern to check. - * @param {string | undefined} flags The regex flags to check. - * @returns {boolean} True if the given regex pattern and flags are valid for the ecma version. - */ - function isValidRegexForEcmaVersion(pattern, flags) { - const validator = new RegExpValidator({ ecmaVersion: regexppEcmaVersion }); - - try { - validator.validatePattern(pattern, 0, pattern.length, flags ? flags.includes("u") : false); - if (flags) { - validator.validateFlags(flags); - } - return true; - } catch { - return false; - } - } - - /** - * Checks whether two given regex flags contain the same flags or not. - * @param {string} flagsA The regex flags. - * @param {string} flagsB The regex flags. - * @returns {boolean} True if two regex flags contain same flags. - */ - function areFlagsEqual(flagsA, flagsB) { - return [...flagsA].sort().join("") === [...flagsB].sort().join(""); - } - - - /** - * Merges two regex flags. - * @param {string} flagsA The regex flags. - * @param {string} flagsB The regex flags. - * @returns {string} The merged regex flags. - */ - function mergeRegexFlags(flagsA, flagsB) { - const flagsSet = new Set([ - ...flagsA, - ...flagsB - ]); - - return [...flagsSet].join(""); - } - - /** - * Checks whether a give node can be fixed to the given regex pattern and flags. - * @param {ASTNode} node The node to check. - * @param {string} pattern The regex pattern to check. - * @param {string} flags The regex flags - * @returns {boolean} True if a node can be fixed to the given regex pattern and flags. - */ - function canFixTo(node, pattern, flags) { - const tokenBefore = sourceCode.getTokenBefore(node); - - return sourceCode.getCommentsInside(node).length === 0 && - (!tokenBefore || validPrecedingTokens.has(tokenBefore.value)) && - isValidRegexForEcmaVersion(pattern, flags); - } - - /** - * Returns a safe output code considering the before and after tokens. - * @param {ASTNode} node The regex node. - * @param {string} newRegExpValue The new regex expression value. - * @returns {string} The output code. - */ - function getSafeOutput(node, newRegExpValue) { - const tokenBefore = sourceCode.getTokenBefore(node); - const tokenAfter = sourceCode.getTokenAfter(node); - - return (tokenBefore && !canTokensBeAdjacent(tokenBefore, newRegExpValue) && tokenBefore.range[1] === node.range[0] ? " " : "") + - newRegExpValue + - (tokenAfter && !canTokensBeAdjacent(newRegExpValue, tokenAfter) && node.range[1] === tokenAfter.range[0] ? " " : ""); - - } - - return { - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const traceMap = { - RegExp: { - [CALL]: true, - [CONSTRUCT]: true - } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(traceMap)) { - if (disallowRedundantWrapping && isUnnecessarilyWrappedRegexLiteral(refNode)) { - const regexNode = refNode.arguments[0]; - - if (refNode.arguments.length === 2) { - const suggests = []; - - const argFlags = getStringValue(refNode.arguments[1]) || ""; - - if (canFixTo(refNode, regexNode.regex.pattern, argFlags)) { - suggests.push({ - messageId: "replaceWithLiteralAndFlags", - pattern: regexNode.regex.pattern, - flags: argFlags - }); - } - - const literalFlags = regexNode.regex.flags || ""; - const mergedFlags = mergeRegexFlags(literalFlags, argFlags); - - if ( - !areFlagsEqual(mergedFlags, argFlags) && - canFixTo(refNode, regexNode.regex.pattern, mergedFlags) - ) { - suggests.push({ - messageId: "replaceWithIntendedLiteralAndFlags", - pattern: regexNode.regex.pattern, - flags: mergedFlags - }); - } - - context.report({ - node: refNode, - messageId: "unexpectedRedundantRegExpWithFlags", - suggest: suggests.map(({ flags, pattern, messageId }) => ({ - messageId, - data: { - flags - }, - fix(fixer) { - return fixer.replaceText(refNode, getSafeOutput(refNode, `/${pattern}/${flags}`)); - } - })) - }); - } else { - const outputs = []; - - if (canFixTo(refNode, regexNode.regex.pattern, regexNode.regex.flags)) { - outputs.push(sourceCode.getText(regexNode)); - } - - - context.report({ - node: refNode, - messageId: "unexpectedRedundantRegExp", - suggest: outputs.map(output => ({ - messageId: "replaceWithLiteral", - fix(fixer) { - return fixer.replaceText( - refNode, - getSafeOutput(refNode, output) - ); - } - })) - }); - } - } else if (hasOnlyStaticStringArguments(refNode)) { - let regexContent = getStringValue(refNode.arguments[0]); - let noFix = false; - let flags; - - if (refNode.arguments[1]) { - flags = getStringValue(refNode.arguments[1]); - } - - if (!canFixTo(refNode, regexContent, flags)) { - noFix = true; - } - - if (!/^[-a-zA-Z0-9\\[\](){} \t\r\n\v\f!@#$%^&*+^_=/~`.> accumulator + sourceText.slice(token.range[1], allTokens[index + 1].range[0]), ""); - } - - /** - * Returns a template literal form of the given node. - * @param {ASTNode} currentNode A node that should be converted to a template literal - * @param {string} textBeforeNode Text that should appear before the node - * @param {string} textAfterNode Text that should appear after the node - * @returns {string} A string form of this node, represented as a template literal - */ - function getTemplateLiteral(currentNode, textBeforeNode, textAfterNode) { - if (currentNode.type === "Literal" && typeof currentNode.value === "string") { - - /* - * If the current node is a string literal, escape any instances of ${ or ` to prevent them from being interpreted - * as a template placeholder. However, if the code already contains a backslash before the ${ or ` - * for some reason, don't add another backslash, because that would change the meaning of the code (it would cause - * an actual backslash character to appear before the dollar sign). - */ - return `\`${currentNode.raw.slice(1, -1).replace(/\\*(\$\{|`)/gu, matched => { - if (matched.lastIndexOf("\\") % 2) { - return `\\${matched}`; - } - return matched; - - // Unescape any quotes that appear in the original Literal that no longer need to be escaped. - }).replace(new RegExp(`\\\\${currentNode.raw[0]}`, "gu"), currentNode.raw[0])}\``; - } - - if (currentNode.type === "TemplateLiteral") { - return sourceCode.getText(currentNode); - } - - if (isConcatenation(currentNode) && hasStringLiteral(currentNode)) { - const plusSign = sourceCode.getFirstTokenBetween(currentNode.left, currentNode.right, token => token.value === "+"); - const textBeforePlus = getTextBetween(currentNode.left, plusSign); - const textAfterPlus = getTextBetween(plusSign, currentNode.right); - const leftEndsWithCurly = endsWithTemplateCurly(currentNode.left); - const rightStartsWithCurly = startsWithTemplateCurly(currentNode.right); - - if (leftEndsWithCurly) { - - // If the left side of the expression ends with a template curly, add the extra text to the end of the curly bracket. - // `foo${bar}` /* comment */ + 'baz' --> `foo${bar /* comment */ }${baz}` - return getTemplateLiteral(currentNode.left, textBeforeNode, textBeforePlus + textAfterPlus).slice(0, -1) + - getTemplateLiteral(currentNode.right, null, textAfterNode).slice(1); - } - if (rightStartsWithCurly) { - - // Otherwise, if the right side of the expression starts with a template curly, add the text there. - // 'foo' /* comment */ + `${bar}baz` --> `foo${ /* comment */ bar}baz` - return getTemplateLiteral(currentNode.left, textBeforeNode, null).slice(0, -1) + - getTemplateLiteral(currentNode.right, textBeforePlus + textAfterPlus, textAfterNode).slice(1); - } - - /* - * Otherwise, these nodes should not be combined into a template curly, since there is nowhere to put - * the text between them. - */ - return `${getTemplateLiteral(currentNode.left, textBeforeNode, null)}${textBeforePlus}+${textAfterPlus}${getTemplateLiteral(currentNode.right, textAfterNode, null)}`; - } - - return `\`\${${textBeforeNode || ""}${sourceCode.getText(currentNode)}${textAfterNode || ""}}\``; - } - - /** - * Returns a fixer object that converts a non-string binary expression to a template literal - * @param {SourceCodeFixer} fixer The fixer object - * @param {ASTNode} node A node that should be converted to a template literal - * @returns {Object} A fix for this binary expression - */ - function fixNonStringBinaryExpression(fixer, node) { - const topBinaryExpr = getTopConcatBinaryExpression(node.parent); - - if (hasOctalOrNonOctalDecimalEscapeSequence(topBinaryExpr)) { - return null; - } - - return fixer.replaceText(topBinaryExpr, getTemplateLiteral(topBinaryExpr, null, null)); - } - - /** - * Reports if a given node is string concatenation with non string literals. - * @param {ASTNode} node A node to check. - * @returns {void} - */ - function checkForStringConcat(node) { - if (!astUtils.isStringLiteral(node) || !isConcatenation(node.parent)) { - return; - } - - const topBinaryExpr = getTopConcatBinaryExpression(node.parent); - - // Checks whether or not this node had been checked already. - if (done[topBinaryExpr.range[0]]) { - return; - } - done[topBinaryExpr.range[0]] = true; - - if (hasNonStringLiteral(topBinaryExpr)) { - context.report({ - node: topBinaryExpr, - messageId: "unexpectedStringConcatenation", - fix: fixer => fixNonStringBinaryExpression(fixer, node) - }); - } - } - - return { - Program() { - done = Object.create(null); - }, - - Literal: checkForStringConcat, - TemplateLiteral: checkForStringConcat - }; - } -}; diff --git a/node_modules/eslint/lib/rules/quote-props.js b/node_modules/eslint/lib/rules/quote-props.js deleted file mode 100644 index 8abab150c..000000000 --- a/node_modules/eslint/lib/rules/quote-props.js +++ /dev/null @@ -1,307 +0,0 @@ -/** - * @fileoverview Rule to flag non-quoted property names in object literals. - * @author Mathias Bynens - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const espree = require("espree"); -const astUtils = require("./utils/ast-utils"); -const keywords = require("./utils/keywords"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require quotes around object literal property names", - recommended: false, - url: "https://eslint.org/docs/latest/rules/quote-props" - }, - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["always", "as-needed", "consistent", "consistent-as-needed"] - } - ], - minItems: 0, - maxItems: 1 - }, - { - type: "array", - items: [ - { - enum: ["always", "as-needed", "consistent", "consistent-as-needed"] - }, - { - type: "object", - properties: { - keywords: { - type: "boolean" - }, - unnecessary: { - type: "boolean" - }, - numbers: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - } - ] - }, - - fixable: "code", - messages: { - requireQuotesDueToReservedWord: "Properties should be quoted as '{{property}}' is a reserved word.", - inconsistentlyQuotedProperty: "Inconsistently quoted property '{{key}}' found.", - unnecessarilyQuotedProperty: "Unnecessarily quoted property '{{property}}' found.", - unquotedReservedProperty: "Unquoted reserved word '{{property}}' used as key.", - unquotedNumericProperty: "Unquoted number literal '{{property}}' used as key.", - unquotedPropertyFound: "Unquoted property '{{property}}' found.", - redundantQuoting: "Properties shouldn't be quoted as all quotes are redundant." - } - }, - - create(context) { - - const MODE = context.options[0], - KEYWORDS = context.options[1] && context.options[1].keywords, - CHECK_UNNECESSARY = !context.options[1] || context.options[1].unnecessary !== false, - NUMBERS = context.options[1] && context.options[1].numbers, - - sourceCode = context.sourceCode; - - - /** - * Checks whether a certain string constitutes an ES3 token - * @param {string} tokenStr The string to be checked. - * @returns {boolean} `true` if it is an ES3 token. - */ - function isKeyword(tokenStr) { - return keywords.includes(tokenStr); - } - - /** - * Checks if an espree-tokenized key has redundant quotes (i.e. whether quotes are unnecessary) - * @param {string} rawKey The raw key value from the source - * @param {espreeTokens} tokens The espree-tokenized node key - * @param {boolean} [skipNumberLiterals=false] Indicates whether number literals should be checked - * @returns {boolean} Whether or not a key has redundant quotes. - * @private - */ - function areQuotesRedundant(rawKey, tokens, skipNumberLiterals) { - return tokens.length === 1 && tokens[0].start === 0 && tokens[0].end === rawKey.length && - (["Identifier", "Keyword", "Null", "Boolean"].includes(tokens[0].type) || - (tokens[0].type === "Numeric" && !skipNumberLiterals && String(+tokens[0].value) === tokens[0].value)); - } - - /** - * Returns a string representation of a property node with quotes removed - * @param {ASTNode} key Key AST Node, which may or may not be quoted - * @returns {string} A replacement string for this property - */ - function getUnquotedKey(key) { - return key.type === "Identifier" ? key.name : key.value; - } - - /** - * Returns a string representation of a property node with quotes added - * @param {ASTNode} key Key AST Node, which may or may not be quoted - * @returns {string} A replacement string for this property - */ - function getQuotedKey(key) { - if (key.type === "Literal" && typeof key.value === "string") { - - // If the key is already a string literal, don't replace the quotes with double quotes. - return sourceCode.getText(key); - } - - // Otherwise, the key is either an identifier or a number literal. - return `"${key.type === "Identifier" ? key.name : key.value}"`; - } - - /** - * Ensures that a property's key is quoted only when necessary - * @param {ASTNode} node Property AST node - * @returns {void} - */ - function checkUnnecessaryQuotes(node) { - const key = node.key; - - if (node.method || node.computed || node.shorthand) { - return; - } - - if (key.type === "Literal" && typeof key.value === "string") { - let tokens; - - try { - tokens = espree.tokenize(key.value); - } catch { - return; - } - - if (tokens.length !== 1) { - return; - } - - const isKeywordToken = isKeyword(tokens[0].value); - - if (isKeywordToken && KEYWORDS) { - return; - } - - if (CHECK_UNNECESSARY && areQuotesRedundant(key.value, tokens, NUMBERS)) { - context.report({ - node, - messageId: "unnecessarilyQuotedProperty", - data: { property: key.value }, - fix: fixer => fixer.replaceText(key, getUnquotedKey(key)) - }); - } - } else if (KEYWORDS && key.type === "Identifier" && isKeyword(key.name)) { - context.report({ - node, - messageId: "unquotedReservedProperty", - data: { property: key.name }, - fix: fixer => fixer.replaceText(key, getQuotedKey(key)) - }); - } else if (NUMBERS && key.type === "Literal" && astUtils.isNumericLiteral(key)) { - context.report({ - node, - messageId: "unquotedNumericProperty", - data: { property: key.value }, - fix: fixer => fixer.replaceText(key, getQuotedKey(key)) - }); - } - } - - /** - * Ensures that a property's key is quoted - * @param {ASTNode} node Property AST node - * @returns {void} - */ - function checkOmittedQuotes(node) { - const key = node.key; - - if (!node.method && !node.computed && !node.shorthand && !(key.type === "Literal" && typeof key.value === "string")) { - context.report({ - node, - messageId: "unquotedPropertyFound", - data: { property: key.name || key.value }, - fix: fixer => fixer.replaceText(key, getQuotedKey(key)) - }); - } - } - - /** - * Ensures that an object's keys are consistently quoted, optionally checks for redundancy of quotes - * @param {ASTNode} node Property AST node - * @param {boolean} checkQuotesRedundancy Whether to check quotes' redundancy - * @returns {void} - */ - function checkConsistency(node, checkQuotesRedundancy) { - const quotedProps = [], - unquotedProps = []; - let keywordKeyName = null, - necessaryQuotes = false; - - node.properties.forEach(property => { - const key = property.key; - - if (!key || property.method || property.computed || property.shorthand) { - return; - } - - if (key.type === "Literal" && typeof key.value === "string") { - - quotedProps.push(property); - - if (checkQuotesRedundancy) { - let tokens; - - try { - tokens = espree.tokenize(key.value); - } catch { - necessaryQuotes = true; - return; - } - - necessaryQuotes = necessaryQuotes || !areQuotesRedundant(key.value, tokens) || KEYWORDS && isKeyword(tokens[0].value); - } - } else if (KEYWORDS && checkQuotesRedundancy && key.type === "Identifier" && isKeyword(key.name)) { - unquotedProps.push(property); - necessaryQuotes = true; - keywordKeyName = key.name; - } else { - unquotedProps.push(property); - } - }); - - if (checkQuotesRedundancy && quotedProps.length && !necessaryQuotes) { - quotedProps.forEach(property => { - context.report({ - node: property, - messageId: "redundantQuoting", - fix: fixer => fixer.replaceText(property.key, getUnquotedKey(property.key)) - }); - }); - } else if (unquotedProps.length && keywordKeyName) { - unquotedProps.forEach(property => { - context.report({ - node: property, - messageId: "requireQuotesDueToReservedWord", - data: { property: keywordKeyName }, - fix: fixer => fixer.replaceText(property.key, getQuotedKey(property.key)) - }); - }); - } else if (quotedProps.length && unquotedProps.length) { - unquotedProps.forEach(property => { - context.report({ - node: property, - messageId: "inconsistentlyQuotedProperty", - data: { key: property.key.name || property.key.value }, - fix: fixer => fixer.replaceText(property.key, getQuotedKey(property.key)) - }); - }); - } - } - - return { - Property(node) { - if (MODE === "always" || !MODE) { - checkOmittedQuotes(node); - } - if (MODE === "as-needed") { - checkUnnecessaryQuotes(node); - } - }, - ObjectExpression(node) { - if (MODE === "consistent") { - checkConsistency(node, false); - } - if (MODE === "consistent-as-needed") { - checkConsistency(node, true); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/quotes.js b/node_modules/eslint/lib/rules/quotes.js deleted file mode 100644 index 9efb9809a..000000000 --- a/node_modules/eslint/lib/rules/quotes.js +++ /dev/null @@ -1,347 +0,0 @@ -/** - * @fileoverview A rule to choose between single and double quote marks - * @author Matt DuVall , Brandon Payton - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Constants -//------------------------------------------------------------------------------ - -const QUOTE_SETTINGS = { - double: { - quote: "\"", - alternateQuote: "'", - description: "doublequote" - }, - single: { - quote: "'", - alternateQuote: "\"", - description: "singlequote" - }, - backtick: { - quote: "`", - alternateQuote: "\"", - description: "backtick" - } -}; - -// An unescaped newline is a newline preceded by an even number of backslashes. -const UNESCAPED_LINEBREAK_PATTERN = new RegExp(String.raw`(^|[^\\])(\\\\)*[${Array.from(astUtils.LINEBREAKS).join("")}]`, "u"); - -/** - * Switches quoting of javascript string between ' " and ` - * escaping and unescaping as necessary. - * Only escaping of the minimal set of characters is changed. - * Note: escaping of newlines when switching from backtick to other quotes is not handled. - * @param {string} str A string to convert. - * @returns {string} The string with changed quotes. - * @private - */ -QUOTE_SETTINGS.double.convert = -QUOTE_SETTINGS.single.convert = -QUOTE_SETTINGS.backtick.convert = function(str) { - const newQuote = this.quote; - const oldQuote = str[0]; - - if (newQuote === oldQuote) { - return str; - } - return newQuote + str.slice(1, -1).replace(/\\(\$\{|\r\n?|\n|.)|["'`]|\$\{|(\r\n?|\n)/gu, (match, escaped, newline) => { - if (escaped === oldQuote || oldQuote === "`" && escaped === "${") { - return escaped; // unescape - } - if (match === newQuote || newQuote === "`" && match === "${") { - return `\\${match}`; // escape - } - if (newline && oldQuote === "`") { - return "\\n"; // escape newlines - } - return match; - }) + newQuote; -}; - -const AVOID_ESCAPE = "avoid-escape"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce the consistent use of either backticks, double, or single quotes", - recommended: false, - url: "https://eslint.org/docs/latest/rules/quotes" - }, - - fixable: "code", - - schema: [ - { - enum: ["single", "double", "backtick"] - }, - { - anyOf: [ - { - enum: ["avoid-escape"] - }, - { - type: "object", - properties: { - avoidEscape: { - type: "boolean" - }, - allowTemplateLiterals: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - wrongQuotes: "Strings must use {{description}}." - } - }, - - create(context) { - - const quoteOption = context.options[0], - settings = QUOTE_SETTINGS[quoteOption || "double"], - options = context.options[1], - allowTemplateLiterals = options && options.allowTemplateLiterals === true, - sourceCode = context.sourceCode; - let avoidEscape = options && options.avoidEscape === true; - - // deprecated - if (options === AVOID_ESCAPE) { - avoidEscape = true; - } - - /** - * Determines if a given node is part of JSX syntax. - * - * This function returns `true` in the following cases: - * - * - `
` ... If the literal is an attribute value, the parent of the literal is `JSXAttribute`. - * - `
foo
` ... If the literal is a text content, the parent of the literal is `JSXElement`. - * - `<>foo` ... If the literal is a text content, the parent of the literal is `JSXFragment`. - * - * In particular, this function returns `false` in the following cases: - * - * - `
` - * - `
{"foo"}
` - * - * In both cases, inside of the braces is handled as normal JavaScript. - * The braces are `JSXExpressionContainer` nodes. - * @param {ASTNode} node The Literal node to check. - * @returns {boolean} True if the node is a part of JSX, false if not. - * @private - */ - function isJSXLiteral(node) { - return node.parent.type === "JSXAttribute" || node.parent.type === "JSXElement" || node.parent.type === "JSXFragment"; - } - - /** - * Checks whether or not a given node is a directive. - * The directive is a `ExpressionStatement` which has only a string literal. - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is a directive. - * @private - */ - function isDirective(node) { - return ( - node.type === "ExpressionStatement" && - node.expression.type === "Literal" && - typeof node.expression.value === "string" - ); - } - - /** - * Checks whether or not a given node is a part of directive prologues. - * See also: http://www.ecma-international.org/ecma-262/6.0/#sec-directive-prologues-and-the-use-strict-directive - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is a part of directive prologues. - * @private - */ - function isPartOfDirectivePrologue(node) { - const block = node.parent.parent; - - if (block.type !== "Program" && (block.type !== "BlockStatement" || !astUtils.isFunction(block.parent))) { - return false; - } - - // Check the node is at a prologue. - for (let i = 0; i < block.body.length; ++i) { - const statement = block.body[i]; - - if (statement === node.parent) { - return true; - } - if (!isDirective(statement)) { - break; - } - } - - return false; - } - - /** - * Checks whether or not a given node is allowed as non backtick. - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is allowed as non backtick. - * @private - */ - function isAllowedAsNonBacktick(node) { - const parent = node.parent; - - switch (parent.type) { - - // Directive Prologues. - case "ExpressionStatement": - return isPartOfDirectivePrologue(node); - - // LiteralPropertyName. - case "Property": - case "PropertyDefinition": - case "MethodDefinition": - return parent.key === node && !parent.computed; - - // ModuleSpecifier. - case "ImportDeclaration": - case "ExportNamedDeclaration": - return parent.source === node; - - // ModuleExportName or ModuleSpecifier. - case "ExportAllDeclaration": - return parent.exported === node || parent.source === node; - - // ModuleExportName. - case "ImportSpecifier": - return parent.imported === node; - - // ModuleExportName. - case "ExportSpecifier": - return parent.local === node || parent.exported === node; - - // Others don't allow. - default: - return false; - } - } - - /** - * Checks whether or not a given TemplateLiteral node is actually using any of the special features provided by template literal strings. - * @param {ASTNode} node A TemplateLiteral node to check. - * @returns {boolean} Whether or not the TemplateLiteral node is using any of the special features provided by template literal strings. - * @private - */ - function isUsingFeatureOfTemplateLiteral(node) { - const hasTag = node.parent.type === "TaggedTemplateExpression" && node === node.parent.quasi; - - if (hasTag) { - return true; - } - - const hasStringInterpolation = node.expressions.length > 0; - - if (hasStringInterpolation) { - return true; - } - - const isMultilineString = node.quasis.length >= 1 && UNESCAPED_LINEBREAK_PATTERN.test(node.quasis[0].value.raw); - - if (isMultilineString) { - return true; - } - - return false; - } - - return { - - Literal(node) { - const val = node.value, - rawVal = node.raw; - - if (settings && typeof val === "string") { - let isValid = (quoteOption === "backtick" && isAllowedAsNonBacktick(node)) || - isJSXLiteral(node) || - astUtils.isSurroundedBy(rawVal, settings.quote); - - if (!isValid && avoidEscape) { - isValid = astUtils.isSurroundedBy(rawVal, settings.alternateQuote) && rawVal.includes(settings.quote); - } - - if (!isValid) { - context.report({ - node, - messageId: "wrongQuotes", - data: { - description: settings.description - }, - fix(fixer) { - if (quoteOption === "backtick" && astUtils.hasOctalOrNonOctalDecimalEscapeSequence(rawVal)) { - - /* - * An octal or non-octal decimal escape sequence in a template literal would - * produce syntax error, even in non-strict mode. - */ - return null; - } - - return fixer.replaceText(node, settings.convert(node.raw)); - } - }); - } - } - }, - - TemplateLiteral(node) { - - // Don't throw an error if backticks are expected or a template literal feature is in use. - if ( - allowTemplateLiterals || - quoteOption === "backtick" || - isUsingFeatureOfTemplateLiteral(node) - ) { - return; - } - - context.report({ - node, - messageId: "wrongQuotes", - data: { - description: settings.description - }, - fix(fixer) { - if (isPartOfDirectivePrologue(node)) { - - /* - * TemplateLiterals in a directive prologue aren't actually directives, but if they're - * in the directive prologue, then fixing them might turn them into directives and change - * the behavior of the code. - */ - return null; - } - return fixer.replaceText(node, settings.convert(sourceCode.getText(node))); - } - }); - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/radix.js b/node_modules/eslint/lib/rules/radix.js deleted file mode 100644 index 7df97d986..000000000 --- a/node_modules/eslint/lib/rules/radix.js +++ /dev/null @@ -1,198 +0,0 @@ -/** - * @fileoverview Rule to flag use of parseInt without a radix argument - * @author James Allardice - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const MODE_ALWAYS = "always", - MODE_AS_NEEDED = "as-needed"; - -const validRadixValues = new Set(Array.from({ length: 37 - 2 }, (_, index) => index + 2)); - -/** - * Checks whether a given variable is shadowed or not. - * @param {eslint-scope.Variable} variable A variable to check. - * @returns {boolean} `true` if the variable is shadowed. - */ -function isShadowed(variable) { - return variable.defs.length >= 1; -} - -/** - * Checks whether a given node is a MemberExpression of `parseInt` method or not. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is a MemberExpression of `parseInt` - * method. - */ -function isParseIntMethod(node) { - return ( - node.type === "MemberExpression" && - !node.computed && - node.property.type === "Identifier" && - node.property.name === "parseInt" - ); -} - -/** - * Checks whether a given node is a valid value of radix or not. - * - * The following values are invalid. - * - * - A literal except integers between 2 and 36. - * - undefined. - * @param {ASTNode} radix A node of radix to check. - * @returns {boolean} `true` if the node is valid. - */ -function isValidRadix(radix) { - return !( - (radix.type === "Literal" && !validRadixValues.has(radix.value)) || - (radix.type === "Identifier" && radix.name === "undefined") - ); -} - -/** - * Checks whether a given node is a default value of radix or not. - * @param {ASTNode} radix A node of radix to check. - * @returns {boolean} `true` if the node is the literal node of `10`. - */ -function isDefaultRadix(radix) { - return radix.type === "Literal" && radix.value === 10; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce the consistent use of the radix argument when using `parseInt()`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/radix" - }, - - hasSuggestions: true, - - schema: [ - { - enum: ["always", "as-needed"] - } - ], - - messages: { - missingParameters: "Missing parameters.", - redundantRadix: "Redundant radix parameter.", - missingRadix: "Missing radix parameter.", - invalidRadix: "Invalid radix parameter, must be an integer between 2 and 36.", - addRadixParameter10: "Add radix parameter `10` for parsing decimal numbers." - } - }, - - create(context) { - const mode = context.options[0] || MODE_ALWAYS; - const sourceCode = context.sourceCode; - - /** - * Checks the arguments of a given CallExpression node and reports it if it - * offends this rule. - * @param {ASTNode} node A CallExpression node to check. - * @returns {void} - */ - function checkArguments(node) { - const args = node.arguments; - - switch (args.length) { - case 0: - context.report({ - node, - messageId: "missingParameters" - }); - break; - - case 1: - if (mode === MODE_ALWAYS) { - context.report({ - node, - messageId: "missingRadix", - suggest: [ - { - messageId: "addRadixParameter10", - fix(fixer) { - const tokens = sourceCode.getTokens(node); - const lastToken = tokens[tokens.length - 1]; // Parenthesis. - const secondToLastToken = tokens[tokens.length - 2]; // May or may not be a comma. - const hasTrailingComma = secondToLastToken.type === "Punctuator" && secondToLastToken.value === ","; - - return fixer.insertTextBefore(lastToken, hasTrailingComma ? " 10," : ", 10"); - } - } - ] - }); - } - break; - - default: - if (mode === MODE_AS_NEEDED && isDefaultRadix(args[1])) { - context.report({ - node, - messageId: "redundantRadix" - }); - } else if (!isValidRadix(args[1])) { - context.report({ - node, - messageId: "invalidRadix" - }); - } - break; - } - } - - return { - "Program:exit"(node) { - const scope = sourceCode.getScope(node); - let variable; - - // Check `parseInt()` - variable = astUtils.getVariableByName(scope, "parseInt"); - if (variable && !isShadowed(variable)) { - variable.references.forEach(reference => { - const idNode = reference.identifier; - - if (astUtils.isCallee(idNode)) { - checkArguments(idNode.parent); - } - }); - } - - // Check `Number.parseInt()` - variable = astUtils.getVariableByName(scope, "Number"); - if (variable && !isShadowed(variable)) { - variable.references.forEach(reference => { - const parentNode = reference.identifier.parent; - const maybeCallee = parentNode.parent.type === "ChainExpression" - ? parentNode.parent - : parentNode; - - if (isParseIntMethod(parentNode) && astUtils.isCallee(maybeCallee)) { - checkArguments(maybeCallee.parent); - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/require-atomic-updates.js b/node_modules/eslint/lib/rules/require-atomic-updates.js deleted file mode 100644 index ba369a203..000000000 --- a/node_modules/eslint/lib/rules/require-atomic-updates.js +++ /dev/null @@ -1,317 +0,0 @@ -/** - * @fileoverview disallow assignments that can lead to race conditions due to usage of `await` or `yield` - * @author Teddy Katz - * @author Toru Nagashima - */ -"use strict"; - -/** - * Make the map from identifiers to each reference. - * @param {escope.Scope} scope The scope to get references. - * @param {Map} [outReferenceMap] The map from identifier nodes to each reference object. - * @returns {Map} `referenceMap`. - */ -function createReferenceMap(scope, outReferenceMap = new Map()) { - for (const reference of scope.references) { - if (reference.resolved === null) { - continue; - } - - outReferenceMap.set(reference.identifier, reference); - } - for (const childScope of scope.childScopes) { - if (childScope.type !== "function") { - createReferenceMap(childScope, outReferenceMap); - } - } - - return outReferenceMap; -} - -/** - * Get `reference.writeExpr` of a given reference. - * If it's the read reference of MemberExpression in LHS, returns RHS in order to address `a.b = await a` - * @param {escope.Reference} reference The reference to get. - * @returns {Expression|null} The `reference.writeExpr`. - */ -function getWriteExpr(reference) { - if (reference.writeExpr) { - return reference.writeExpr; - } - let node = reference.identifier; - - while (node) { - const t = node.parent.type; - - if (t === "AssignmentExpression" && node.parent.left === node) { - return node.parent.right; - } - if (t === "MemberExpression" && node.parent.object === node) { - node = node.parent; - continue; - } - - break; - } - - return null; -} - -/** - * Checks if an expression is a variable that can only be observed within the given function. - * @param {Variable|null} variable The variable to check - * @param {boolean} isMemberAccess If `true` then this is a member access. - * @returns {boolean} `true` if the variable is local to the given function, and is never referenced in a closure. - */ -function isLocalVariableWithoutEscape(variable, isMemberAccess) { - if (!variable) { - return false; // A global variable which was not defined. - } - - // If the reference is a property access and the variable is a parameter, it handles the variable is not local. - if (isMemberAccess && variable.defs.some(d => d.type === "Parameter")) { - return false; - } - - const functionScope = variable.scope.variableScope; - - return variable.references.every(reference => - reference.from.variableScope === functionScope); -} - -/** - * Represents segment information. - */ -class SegmentInfo { - constructor() { - this.info = new WeakMap(); - } - - /** - * Initialize the segment information. - * @param {PathSegment} segment The segment to initialize. - * @returns {void} - */ - initialize(segment) { - const outdatedReadVariables = new Set(); - const freshReadVariables = new Set(); - - for (const prevSegment of segment.prevSegments) { - const info = this.info.get(prevSegment); - - if (info) { - info.outdatedReadVariables.forEach(Set.prototype.add, outdatedReadVariables); - info.freshReadVariables.forEach(Set.prototype.add, freshReadVariables); - } - } - - this.info.set(segment, { outdatedReadVariables, freshReadVariables }); - } - - /** - * Mark a given variable as read on given segments. - * @param {PathSegment[]} segments The segments that it read the variable on. - * @param {Variable} variable The variable to be read. - * @returns {void} - */ - markAsRead(segments, variable) { - for (const segment of segments) { - const info = this.info.get(segment); - - if (info) { - info.freshReadVariables.add(variable); - - // If a variable is freshly read again, then it's no more out-dated. - info.outdatedReadVariables.delete(variable); - } - } - } - - /** - * Move `freshReadVariables` to `outdatedReadVariables`. - * @param {PathSegment[]} segments The segments to process. - * @returns {void} - */ - makeOutdated(segments) { - for (const segment of segments) { - const info = this.info.get(segment); - - if (info) { - info.freshReadVariables.forEach(Set.prototype.add, info.outdatedReadVariables); - info.freshReadVariables.clear(); - } - } - } - - /** - * Check if a given variable is outdated on the current segments. - * @param {PathSegment[]} segments The current segments. - * @param {Variable} variable The variable to check. - * @returns {boolean} `true` if the variable is outdated on the segments. - */ - isOutdated(segments, variable) { - for (const segment of segments) { - const info = this.info.get(segment); - - if (info && info.outdatedReadVariables.has(variable)) { - return true; - } - } - return false; - } -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow assignments that can lead to race conditions due to usage of `await` or `yield`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/require-atomic-updates" - }, - - fixable: null, - - schema: [{ - type: "object", - properties: { - allowProperties: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - - messages: { - nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`.", - nonAtomicObjectUpdate: "Possible race condition: `{{value}}` might be assigned based on an outdated state of `{{object}}`." - } - }, - - create(context) { - const allowProperties = !!context.options[0] && context.options[0].allowProperties; - - const sourceCode = context.sourceCode; - const assignmentReferences = new Map(); - const segmentInfo = new SegmentInfo(); - let stack = null; - - return { - onCodePathStart(codePath, node) { - const scope = sourceCode.getScope(node); - const shouldVerify = - scope.type === "function" && - (scope.block.async || scope.block.generator); - - stack = { - upper: stack, - codePath, - referenceMap: shouldVerify ? createReferenceMap(scope) : null - }; - }, - onCodePathEnd() { - stack = stack.upper; - }, - - // Initialize the segment information. - onCodePathSegmentStart(segment) { - segmentInfo.initialize(segment); - }, - - // Handle references to prepare verification. - Identifier(node) { - const { codePath, referenceMap } = stack; - const reference = referenceMap && referenceMap.get(node); - - // Ignore if this is not a valid variable reference. - if (!reference) { - return; - } - const variable = reference.resolved; - const writeExpr = getWriteExpr(reference); - const isMemberAccess = reference.identifier.parent.type === "MemberExpression"; - - // Add a fresh read variable. - if (reference.isRead() && !(writeExpr && writeExpr.parent.operator === "=")) { - segmentInfo.markAsRead(codePath.currentSegments, variable); - } - - /* - * Register the variable to verify after ESLint traversed the `writeExpr` node - * if this reference is an assignment to a variable which is referred from other closure. - */ - if (writeExpr && - writeExpr.parent.right === writeExpr && // ← exclude variable declarations. - !isLocalVariableWithoutEscape(variable, isMemberAccess) - ) { - let refs = assignmentReferences.get(writeExpr); - - if (!refs) { - refs = []; - assignmentReferences.set(writeExpr, refs); - } - - refs.push(reference); - } - }, - - /* - * Verify assignments. - * If the reference exists in `outdatedReadVariables` list, report it. - */ - ":expression:exit"(node) { - const { codePath, referenceMap } = stack; - - // referenceMap exists if this is in a resumable function scope. - if (!referenceMap) { - return; - } - - // Mark the read variables on this code path as outdated. - if (node.type === "AwaitExpression" || node.type === "YieldExpression") { - segmentInfo.makeOutdated(codePath.currentSegments); - } - - // Verify. - const references = assignmentReferences.get(node); - - if (references) { - assignmentReferences.delete(node); - - for (const reference of references) { - const variable = reference.resolved; - - if (segmentInfo.isOutdated(codePath.currentSegments, variable)) { - if (node.parent.left === reference.identifier) { - context.report({ - node: node.parent, - messageId: "nonAtomicUpdate", - data: { - value: variable.name - } - }); - } else if (!allowProperties) { - context.report({ - node: node.parent, - messageId: "nonAtomicObjectUpdate", - data: { - value: sourceCode.getText(node.parent.left), - object: variable.name - } - }); - } - - } - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/require-await.js b/node_modules/eslint/lib/rules/require-await.js deleted file mode 100644 index 952dde543..000000000 --- a/node_modules/eslint/lib/rules/require-await.js +++ /dev/null @@ -1,113 +0,0 @@ -/** - * @fileoverview Rule to disallow async functions which have no `await` expression. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Capitalize the 1st letter of the given text. - * @param {string} text The text to capitalize. - * @returns {string} The text that the 1st letter was capitalized. - */ -function capitalizeFirstLetter(text) { - return text[0].toUpperCase() + text.slice(1); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow async functions which have no `await` expression", - recommended: false, - url: "https://eslint.org/docs/latest/rules/require-await" - }, - - schema: [], - - messages: { - missingAwait: "{{name}} has no 'await' expression." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - let scopeInfo = null; - - /** - * Push the scope info object to the stack. - * @returns {void} - */ - function enterFunction() { - scopeInfo = { - upper: scopeInfo, - hasAwait: false - }; - } - - /** - * Pop the top scope info object from the stack. - * Also, it reports the function if needed. - * @param {ASTNode} node The node to report. - * @returns {void} - */ - function exitFunction(node) { - if (!node.generator && node.async && !scopeInfo.hasAwait && !astUtils.isEmptyFunction(node)) { - context.report({ - node, - loc: astUtils.getFunctionHeadLoc(node, sourceCode), - messageId: "missingAwait", - data: { - name: capitalizeFirstLetter( - astUtils.getFunctionNameWithKind(node) - ) - } - }); - } - - scopeInfo = scopeInfo.upper; - } - - return { - FunctionDeclaration: enterFunction, - FunctionExpression: enterFunction, - ArrowFunctionExpression: enterFunction, - "FunctionDeclaration:exit": exitFunction, - "FunctionExpression:exit": exitFunction, - "ArrowFunctionExpression:exit": exitFunction, - - AwaitExpression() { - if (!scopeInfo) { - return; - } - - scopeInfo.hasAwait = true; - }, - ForOfStatement(node) { - if (!scopeInfo) { - return; - } - - if (node.await) { - scopeInfo.hasAwait = true; - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/require-jsdoc.js b/node_modules/eslint/lib/rules/require-jsdoc.js deleted file mode 100644 index b6fedf228..000000000 --- a/node_modules/eslint/lib/rules/require-jsdoc.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @fileoverview Rule to check for jsdoc presence. - * @author Gyandeep Singh - * @deprecated in ESLint v5.10.0 - */ -"use strict"; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require JSDoc comments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/require-jsdoc" - }, - - schema: [ - { - type: "object", - properties: { - require: { - type: "object", - properties: { - ClassDeclaration: { - type: "boolean", - default: false - }, - MethodDefinition: { - type: "boolean", - default: false - }, - FunctionDeclaration: { - type: "boolean", - default: true - }, - ArrowFunctionExpression: { - type: "boolean", - default: false - }, - FunctionExpression: { - type: "boolean", - default: false - } - }, - additionalProperties: false, - default: {} - } - }, - additionalProperties: false - } - ], - - deprecated: true, - replacedBy: [], - - messages: { - missingJSDocComment: "Missing JSDoc comment." - } - }, - - create(context) { - const source = context.sourceCode; - const DEFAULT_OPTIONS = { - FunctionDeclaration: true, - MethodDefinition: false, - ClassDeclaration: false, - ArrowFunctionExpression: false, - FunctionExpression: false - }; - const options = Object.assign(DEFAULT_OPTIONS, context.options[0] && context.options[0].require); - - /** - * Report the error message - * @param {ASTNode} node node to report - * @returns {void} - */ - function report(node) { - context.report({ node, messageId: "missingJSDocComment" }); - } - - /** - * Check if the jsdoc comment is present or not. - * @param {ASTNode} node node to examine - * @returns {void} - */ - function checkJsDoc(node) { - const jsdocComment = source.getJSDocComment(node); - - if (!jsdocComment) { - report(node); - } - } - - return { - FunctionDeclaration(node) { - if (options.FunctionDeclaration) { - checkJsDoc(node); - } - }, - FunctionExpression(node) { - if ( - (options.MethodDefinition && node.parent.type === "MethodDefinition") || - (options.FunctionExpression && (node.parent.type === "VariableDeclarator" || (node.parent.type === "Property" && node === node.parent.value))) - ) { - checkJsDoc(node); - } - }, - ClassDeclaration(node) { - if (options.ClassDeclaration) { - checkJsDoc(node); - } - }, - ArrowFunctionExpression(node) { - if (options.ArrowFunctionExpression && node.parent.type === "VariableDeclarator") { - checkJsDoc(node); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/require-unicode-regexp.js b/node_modules/eslint/lib/rules/require-unicode-regexp.js deleted file mode 100644 index f748753a2..000000000 --- a/node_modules/eslint/lib/rules/require-unicode-regexp.js +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @fileoverview Rule to enforce the use of `u` flag on RegExp. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { - CALL, - CONSTRUCT, - ReferenceTracker, - getStringIfConstant -} = require("@eslint-community/eslint-utils"); -const astUtils = require("./utils/ast-utils.js"); -const { isValidWithUnicodeFlag } = require("./utils/regular-expressions"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce the use of `u` flag on RegExp", - recommended: false, - url: "https://eslint.org/docs/latest/rules/require-unicode-regexp" - }, - - hasSuggestions: true, - - messages: { - addUFlag: "Add the 'u' flag.", - requireUFlag: "Use the 'u' flag." - }, - - schema: [] - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - "Literal[regex]"(node) { - const flags = node.regex.flags || ""; - - if (!flags.includes("u")) { - context.report({ - messageId: "requireUFlag", - node, - suggest: isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, node.regex.pattern) - ? [ - { - fix(fixer) { - return fixer.insertTextAfter(node, "u"); - }, - messageId: "addUFlag" - } - ] - : null - }); - } - }, - - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const trackMap = { - RegExp: { [CALL]: true, [CONSTRUCT]: true } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(trackMap)) { - const [patternNode, flagsNode] = refNode.arguments; - - if (patternNode && patternNode.type === "SpreadElement") { - continue; - } - const pattern = getStringIfConstant(patternNode, scope); - const flags = getStringIfConstant(flagsNode, scope); - - if (!flagsNode || (typeof flags === "string" && !flags.includes("u"))) { - context.report({ - messageId: "requireUFlag", - node: refNode, - suggest: typeof pattern === "string" && isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, pattern) - ? [ - { - fix(fixer) { - if (flagsNode) { - if ((flagsNode.type === "Literal" && typeof flagsNode.value === "string") || flagsNode.type === "TemplateLiteral") { - const flagsNodeText = sourceCode.getText(flagsNode); - - return fixer.replaceText(flagsNode, [ - flagsNodeText.slice(0, flagsNodeText.length - 1), - flagsNodeText.slice(flagsNodeText.length - 1) - ].join("u")); - } - - // We intentionally don't suggest concatenating + "u" to non-literals - return null; - } - - const penultimateToken = sourceCode.getLastToken(refNode, { skip: 1 }); // skip closing parenthesis - - return fixer.insertTextAfter( - penultimateToken, - astUtils.isCommaToken(penultimateToken) - ? ' "u",' - : ', "u"' - ); - }, - messageId: "addUFlag" - } - ] - : null - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/require-yield.js b/node_modules/eslint/lib/rules/require-yield.js deleted file mode 100644 index f801af0ab..000000000 --- a/node_modules/eslint/lib/rules/require-yield.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @fileoverview Rule to flag the generator functions that does not have yield. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require generator functions to contain `yield`", - recommended: true, - url: "https://eslint.org/docs/latest/rules/require-yield" - }, - - schema: [], - - messages: { - missingYield: "This generator function does not have 'yield'." - } - }, - - create(context) { - const stack = []; - - /** - * If the node is a generator function, start counting `yield` keywords. - * @param {Node} node A function node to check. - * @returns {void} - */ - function beginChecking(node) { - if (node.generator) { - stack.push(0); - } - } - - /** - * If the node is a generator function, end counting `yield` keywords, then - * reports result. - * @param {Node} node A function node to check. - * @returns {void} - */ - function endChecking(node) { - if (!node.generator) { - return; - } - - const countYield = stack.pop(); - - if (countYield === 0 && node.body.body.length > 0) { - context.report({ node, messageId: "missingYield" }); - } - } - - return { - FunctionDeclaration: beginChecking, - "FunctionDeclaration:exit": endChecking, - FunctionExpression: beginChecking, - "FunctionExpression:exit": endChecking, - - // Increases the count of `yield` keyword. - YieldExpression() { - - if (stack.length > 0) { - stack[stack.length - 1] += 1; - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/rest-spread-spacing.js b/node_modules/eslint/lib/rules/rest-spread-spacing.js deleted file mode 100644 index 779123808..000000000 --- a/node_modules/eslint/lib/rules/rest-spread-spacing.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @fileoverview Enforce spacing between rest and spread operators and their expressions. - * @author Kai Cataldo - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce spacing between rest and spread operators and their expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/rest-spread-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never"] - } - ], - - messages: { - unexpectedWhitespace: "Unexpected whitespace after {{type}} operator.", - expectedWhitespace: "Expected whitespace after {{type}} operator." - } - }, - - create(context) { - const sourceCode = context.sourceCode, - alwaysSpace = context.options[0] === "always"; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Checks whitespace between rest/spread operators and their expressions - * @param {ASTNode} node The node to check - * @returns {void} - */ - function checkWhiteSpace(node) { - const operator = sourceCode.getFirstToken(node), - nextToken = sourceCode.getTokenAfter(operator), - hasWhitespace = sourceCode.isSpaceBetweenTokens(operator, nextToken); - let type; - - switch (node.type) { - case "SpreadElement": - type = "spread"; - if (node.parent.type === "ObjectExpression") { - type += " property"; - } - break; - case "RestElement": - type = "rest"; - if (node.parent.type === "ObjectPattern") { - type += " property"; - } - break; - case "ExperimentalSpreadProperty": - type = "spread property"; - break; - case "ExperimentalRestProperty": - type = "rest property"; - break; - default: - return; - } - - if (alwaysSpace && !hasWhitespace) { - context.report({ - node, - loc: operator.loc, - messageId: "expectedWhitespace", - data: { - type - }, - fix(fixer) { - return fixer.replaceTextRange([operator.range[1], nextToken.range[0]], " "); - } - }); - } else if (!alwaysSpace && hasWhitespace) { - context.report({ - node, - loc: { - start: operator.loc.end, - end: nextToken.loc.start - }, - messageId: "unexpectedWhitespace", - data: { - type - }, - fix(fixer) { - return fixer.removeRange([operator.range[1], nextToken.range[0]]); - } - }); - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - SpreadElement: checkWhiteSpace, - RestElement: checkWhiteSpace, - ExperimentalSpreadProperty: checkWhiteSpace, - ExperimentalRestProperty: checkWhiteSpace - }; - } -}; diff --git a/node_modules/eslint/lib/rules/semi-spacing.js b/node_modules/eslint/lib/rules/semi-spacing.js deleted file mode 100644 index 770f62d41..000000000 --- a/node_modules/eslint/lib/rules/semi-spacing.js +++ /dev/null @@ -1,245 +0,0 @@ -/** - * @fileoverview Validates spacing before and after semicolon - * @author Mathias Schreck - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing before and after semicolons", - recommended: false, - url: "https://eslint.org/docs/latest/rules/semi-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - before: { - type: "boolean", - default: false - }, - after: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedWhitespaceBefore: "Unexpected whitespace before semicolon.", - unexpectedWhitespaceAfter: "Unexpected whitespace after semicolon.", - missingWhitespaceBefore: "Missing whitespace before semicolon.", - missingWhitespaceAfter: "Missing whitespace after semicolon." - } - }, - - create(context) { - - const config = context.options[0], - sourceCode = context.sourceCode; - let requireSpaceBefore = false, - requireSpaceAfter = true; - - if (typeof config === "object") { - requireSpaceBefore = config.before; - requireSpaceAfter = config.after; - } - - /** - * Checks if a given token has leading whitespace. - * @param {Object} token The token to check. - * @returns {boolean} True if the given token has leading space, false if not. - */ - function hasLeadingSpace(token) { - const tokenBefore = sourceCode.getTokenBefore(token); - - return tokenBefore && astUtils.isTokenOnSameLine(tokenBefore, token) && sourceCode.isSpaceBetweenTokens(tokenBefore, token); - } - - /** - * Checks if a given token has trailing whitespace. - * @param {Object} token The token to check. - * @returns {boolean} True if the given token has trailing space, false if not. - */ - function hasTrailingSpace(token) { - const tokenAfter = sourceCode.getTokenAfter(token); - - return tokenAfter && astUtils.isTokenOnSameLine(token, tokenAfter) && sourceCode.isSpaceBetweenTokens(token, tokenAfter); - } - - /** - * Checks if the given token is the last token in its line. - * @param {Token} token The token to check. - * @returns {boolean} Whether or not the token is the last in its line. - */ - function isLastTokenInCurrentLine(token) { - const tokenAfter = sourceCode.getTokenAfter(token); - - return !(tokenAfter && astUtils.isTokenOnSameLine(token, tokenAfter)); - } - - /** - * Checks if the given token is the first token in its line - * @param {Token} token The token to check. - * @returns {boolean} Whether or not the token is the first in its line. - */ - function isFirstTokenInCurrentLine(token) { - const tokenBefore = sourceCode.getTokenBefore(token); - - return !(tokenBefore && astUtils.isTokenOnSameLine(token, tokenBefore)); - } - - /** - * Checks if the next token of a given token is a closing parenthesis. - * @param {Token} token The token to check. - * @returns {boolean} Whether or not the next token of a given token is a closing parenthesis. - */ - function isBeforeClosingParen(token) { - const nextToken = sourceCode.getTokenAfter(token); - - return (nextToken && astUtils.isClosingBraceToken(nextToken) || astUtils.isClosingParenToken(nextToken)); - } - - /** - * Report location example : - * - * for unexpected space `before` - * - * var a = 'b' ; - * ^^^ - * - * for unexpected space `after` - * - * var a = 'b'; c = 10; - * ^^ - * - * Reports if the given token has invalid spacing. - * @param {Token} token The semicolon token to check. - * @param {ASTNode} node The corresponding node of the token. - * @returns {void} - */ - function checkSemicolonSpacing(token, node) { - if (astUtils.isSemicolonToken(token)) { - if (hasLeadingSpace(token)) { - if (!requireSpaceBefore) { - const tokenBefore = sourceCode.getTokenBefore(token); - const loc = { - start: tokenBefore.loc.end, - end: token.loc.start - }; - - context.report({ - node, - loc, - messageId: "unexpectedWhitespaceBefore", - fix(fixer) { - - return fixer.removeRange([tokenBefore.range[1], token.range[0]]); - } - }); - } - } else { - if (requireSpaceBefore) { - const loc = token.loc; - - context.report({ - node, - loc, - messageId: "missingWhitespaceBefore", - fix(fixer) { - return fixer.insertTextBefore(token, " "); - } - }); - } - } - - if (!isFirstTokenInCurrentLine(token) && !isLastTokenInCurrentLine(token) && !isBeforeClosingParen(token)) { - if (hasTrailingSpace(token)) { - if (!requireSpaceAfter) { - const tokenAfter = sourceCode.getTokenAfter(token); - const loc = { - start: token.loc.end, - end: tokenAfter.loc.start - }; - - context.report({ - node, - loc, - messageId: "unexpectedWhitespaceAfter", - fix(fixer) { - - return fixer.removeRange([token.range[1], tokenAfter.range[0]]); - } - }); - } - } else { - if (requireSpaceAfter) { - const loc = token.loc; - - context.report({ - node, - loc, - messageId: "missingWhitespaceAfter", - fix(fixer) { - return fixer.insertTextAfter(token, " "); - } - }); - } - } - } - } - } - - /** - * Checks the spacing of the semicolon with the assumption that the last token is the semicolon. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkNode(node) { - const token = sourceCode.getLastToken(node); - - checkSemicolonSpacing(token, node); - } - - return { - VariableDeclaration: checkNode, - ExpressionStatement: checkNode, - BreakStatement: checkNode, - ContinueStatement: checkNode, - DebuggerStatement: checkNode, - DoWhileStatement: checkNode, - ReturnStatement: checkNode, - ThrowStatement: checkNode, - ImportDeclaration: checkNode, - ExportNamedDeclaration: checkNode, - ExportAllDeclaration: checkNode, - ExportDefaultDeclaration: checkNode, - ForStatement(node) { - if (node.init) { - checkSemicolonSpacing(sourceCode.getTokenAfter(node.init), node); - } - - if (node.test) { - checkSemicolonSpacing(sourceCode.getTokenAfter(node.test), node); - } - }, - PropertyDefinition: checkNode - }; - } -}; diff --git a/node_modules/eslint/lib/rules/semi-style.js b/node_modules/eslint/lib/rules/semi-style.js deleted file mode 100644 index 67ed1e478..000000000 --- a/node_modules/eslint/lib/rules/semi-style.js +++ /dev/null @@ -1,155 +0,0 @@ -/** - * @fileoverview Rule to enforce location of semicolons. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const SELECTOR = [ - "BreakStatement", "ContinueStatement", "DebuggerStatement", - "DoWhileStatement", "ExportAllDeclaration", - "ExportDefaultDeclaration", "ExportNamedDeclaration", - "ExpressionStatement", "ImportDeclaration", "ReturnStatement", - "ThrowStatement", "VariableDeclaration", "PropertyDefinition" -].join(","); - -/** - * Get the child node list of a given node. - * This returns `BlockStatement#body`, `StaticBlock#body`, `Program#body`, - * `ClassBody#body`, or `SwitchCase#consequent`. - * This is used to check whether a node is the first/last child. - * @param {Node} node A node to get child node list. - * @returns {Node[]|null} The child node list. - */ -function getChildren(node) { - const t = node.type; - - if ( - t === "BlockStatement" || - t === "StaticBlock" || - t === "Program" || - t === "ClassBody" - ) { - return node.body; - } - if (t === "SwitchCase") { - return node.consequent; - } - return null; -} - -/** - * Check whether a given node is the last statement in the parent block. - * @param {Node} node A node to check. - * @returns {boolean} `true` if the node is the last statement in the parent block. - */ -function isLastChild(node) { - const t = node.parent.type; - - if (t === "IfStatement" && node.parent.consequent === node && node.parent.alternate) { // before `else` keyword. - return true; - } - if (t === "DoWhileStatement") { // before `while` keyword. - return true; - } - const nodeList = getChildren(node.parent); - - return nodeList !== null && nodeList[nodeList.length - 1] === node; // before `}` or etc. -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce location of semicolons", - recommended: false, - url: "https://eslint.org/docs/latest/rules/semi-style" - }, - - schema: [{ enum: ["last", "first"] }], - fixable: "whitespace", - - messages: { - expectedSemiColon: "Expected this semicolon to be at {{pos}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const option = context.options[0] || "last"; - - /** - * Check the given semicolon token. - * @param {Token} semiToken The semicolon token to check. - * @param {"first"|"last"} expected The expected location to check. - * @returns {void} - */ - function check(semiToken, expected) { - const prevToken = sourceCode.getTokenBefore(semiToken); - const nextToken = sourceCode.getTokenAfter(semiToken); - const prevIsSameLine = !prevToken || astUtils.isTokenOnSameLine(prevToken, semiToken); - const nextIsSameLine = !nextToken || astUtils.isTokenOnSameLine(semiToken, nextToken); - - if ((expected === "last" && !prevIsSameLine) || (expected === "first" && !nextIsSameLine)) { - context.report({ - loc: semiToken.loc, - messageId: "expectedSemiColon", - data: { - pos: (expected === "last") - ? "the end of the previous line" - : "the beginning of the next line" - }, - fix(fixer) { - if (prevToken && nextToken && sourceCode.commentsExistBetween(prevToken, nextToken)) { - return null; - } - - const start = prevToken ? prevToken.range[1] : semiToken.range[0]; - const end = nextToken ? nextToken.range[0] : semiToken.range[1]; - const text = (expected === "last") ? ";\n" : "\n;"; - - return fixer.replaceTextRange([start, end], text); - } - }); - } - } - - return { - [SELECTOR](node) { - if (option === "first" && isLastChild(node)) { - return; - } - - const lastToken = sourceCode.getLastToken(node); - - if (astUtils.isSemicolonToken(lastToken)) { - check(lastToken, option); - } - }, - - ForStatement(node) { - const firstSemi = node.init && sourceCode.getTokenAfter(node.init, astUtils.isSemicolonToken); - const secondSemi = node.test && sourceCode.getTokenAfter(node.test, astUtils.isSemicolonToken); - - if (firstSemi) { - check(firstSemi, "last"); - } - if (secondSemi) { - check(secondSemi, "last"); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/semi.js b/node_modules/eslint/lib/rules/semi.js deleted file mode 100644 index 6a473535d..000000000 --- a/node_modules/eslint/lib/rules/semi.js +++ /dev/null @@ -1,435 +0,0 @@ -/** - * @fileoverview Rule to flag missing semicolons. - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const FixTracker = require("./utils/fix-tracker"); -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow semicolons instead of ASI", - recommended: false, - url: "https://eslint.org/docs/latest/rules/semi" - }, - - fixable: "code", - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["never"] - }, - { - type: "object", - properties: { - beforeStatementContinuationChars: { - enum: ["always", "any", "never"] - } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - }, - { - type: "array", - items: [ - { - enum: ["always"] - }, - { - type: "object", - properties: { - omitLastInOneLineBlock: { type: "boolean" }, - omitLastInOneLineClassBody: { type: "boolean" } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - } - ] - }, - - messages: { - missingSemi: "Missing semicolon.", - extraSemi: "Extra semicolon." - } - }, - - create(context) { - - const OPT_OUT_PATTERN = /^[-[(/+`]/u; // One of [(/+-` - const unsafeClassFieldNames = new Set(["get", "set", "static"]); - const unsafeClassFieldFollowers = new Set(["*", "in", "instanceof"]); - const options = context.options[1]; - const never = context.options[0] === "never"; - const exceptOneLine = Boolean(options && options.omitLastInOneLineBlock); - const exceptOneLineClassBody = Boolean(options && options.omitLastInOneLineClassBody); - const beforeStatementContinuationChars = options && options.beforeStatementContinuationChars || "any"; - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Reports a semicolon error with appropriate location and message. - * @param {ASTNode} node The node with an extra or missing semicolon. - * @param {boolean} missing True if the semicolon is missing. - * @returns {void} - */ - function report(node, missing) { - const lastToken = sourceCode.getLastToken(node); - let messageId, - fix, - loc; - - if (!missing) { - messageId = "missingSemi"; - loc = { - start: lastToken.loc.end, - end: astUtils.getNextLocation(sourceCode, lastToken.loc.end) - }; - fix = function(fixer) { - return fixer.insertTextAfter(lastToken, ";"); - }; - } else { - messageId = "extraSemi"; - loc = lastToken.loc; - fix = function(fixer) { - - /* - * Expand the replacement range to include the surrounding - * tokens to avoid conflicting with no-extra-semi. - * https://github.com/eslint/eslint/issues/7928 - */ - return new FixTracker(fixer, sourceCode) - .retainSurroundingTokens(lastToken) - .remove(lastToken); - }; - } - - context.report({ - node, - loc, - messageId, - fix - }); - - } - - /** - * Check whether a given semicolon token is redundant. - * @param {Token} semiToken A semicolon token to check. - * @returns {boolean} `true` if the next token is `;` or `}`. - */ - function isRedundantSemi(semiToken) { - const nextToken = sourceCode.getTokenAfter(semiToken); - - return ( - !nextToken || - astUtils.isClosingBraceToken(nextToken) || - astUtils.isSemicolonToken(nextToken) - ); - } - - /** - * Check whether a given token is the closing brace of an arrow function. - * @param {Token} lastToken A token to check. - * @returns {boolean} `true` if the token is the closing brace of an arrow function. - */ - function isEndOfArrowBlock(lastToken) { - if (!astUtils.isClosingBraceToken(lastToken)) { - return false; - } - const node = sourceCode.getNodeByRangeIndex(lastToken.range[0]); - - return ( - node.type === "BlockStatement" && - node.parent.type === "ArrowFunctionExpression" - ); - } - - /** - * Checks if a given PropertyDefinition node followed by a semicolon - * can safely remove that semicolon. It is not to safe to remove if - * the class field name is "get", "set", or "static", or if - * followed by a generator method. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node cannot have the semicolon - * removed. - */ - function maybeClassFieldAsiHazard(node) { - - if (node.type !== "PropertyDefinition") { - return false; - } - - /* - * Computed property names and non-identifiers are always safe - * as they can be distinguished from keywords easily. - */ - const needsNameCheck = !node.computed && node.key.type === "Identifier"; - - /* - * Certain names are problematic unless they also have a - * a way to distinguish between keywords and property - * names. - */ - if (needsNameCheck && unsafeClassFieldNames.has(node.key.name)) { - - /* - * Special case: If the field name is `static`, - * it is only valid if the field is marked as static, - * so "static static" is okay but "static" is not. - */ - const isStaticStatic = node.static && node.key.name === "static"; - - /* - * For other unsafe names, we only care if there is no - * initializer. No initializer = hazard. - */ - if (!isStaticStatic && !node.value) { - return true; - } - } - - const followingToken = sourceCode.getTokenAfter(node); - - return unsafeClassFieldFollowers.has(followingToken.value); - } - - /** - * Check whether a given node is on the same line with the next token. - * @param {Node} node A statement node to check. - * @returns {boolean} `true` if the node is on the same line with the next token. - */ - function isOnSameLineWithNextToken(node) { - const prevToken = sourceCode.getLastToken(node, 1); - const nextToken = sourceCode.getTokenAfter(node); - - return !!nextToken && astUtils.isTokenOnSameLine(prevToken, nextToken); - } - - /** - * Check whether a given node can connect the next line if the next line is unreliable. - * @param {Node} node A statement node to check. - * @returns {boolean} `true` if the node can connect the next line. - */ - function maybeAsiHazardAfter(node) { - const t = node.type; - - if (t === "DoWhileStatement" || - t === "BreakStatement" || - t === "ContinueStatement" || - t === "DebuggerStatement" || - t === "ImportDeclaration" || - t === "ExportAllDeclaration" - ) { - return false; - } - if (t === "ReturnStatement") { - return Boolean(node.argument); - } - if (t === "ExportNamedDeclaration") { - return Boolean(node.declaration); - } - if (isEndOfArrowBlock(sourceCode.getLastToken(node, 1))) { - return false; - } - - return true; - } - - /** - * Check whether a given token can connect the previous statement. - * @param {Token} token A token to check. - * @returns {boolean} `true` if the token is one of `[`, `(`, `/`, `+`, `-`, ```, `++`, and `--`. - */ - function maybeAsiHazardBefore(token) { - return ( - Boolean(token) && - OPT_OUT_PATTERN.test(token.value) && - token.value !== "++" && - token.value !== "--" - ); - } - - /** - * Check if the semicolon of a given node is unnecessary, only true if: - * - next token is a valid statement divider (`;` or `}`). - * - next token is on a new line and the node is not connectable to the new line. - * @param {Node} node A statement node to check. - * @returns {boolean} whether the semicolon is unnecessary. - */ - function canRemoveSemicolon(node) { - if (isRedundantSemi(sourceCode.getLastToken(node))) { - return true; // `;;` or `;}` - } - if (maybeClassFieldAsiHazard(node)) { - return false; - } - if (isOnSameLineWithNextToken(node)) { - return false; // One liner. - } - - // continuation characters should not apply to class fields - if ( - node.type !== "PropertyDefinition" && - beforeStatementContinuationChars === "never" && - !maybeAsiHazardAfter(node) - ) { - return true; // ASI works. This statement doesn't connect to the next. - } - if (!maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) { - return true; // ASI works. The next token doesn't connect to this statement. - } - - return false; - } - - /** - * Checks a node to see if it's the last item in a one-liner block. - * Block is any `BlockStatement` or `StaticBlock` node. Block is a one-liner if its - * braces (and consequently everything between them) are on the same line. - * @param {ASTNode} node The node to check. - * @returns {boolean} whether the node is the last item in a one-liner block. - */ - function isLastInOneLinerBlock(node) { - const parent = node.parent; - const nextToken = sourceCode.getTokenAfter(node); - - if (!nextToken || nextToken.value !== "}") { - return false; - } - - if (parent.type === "BlockStatement") { - return parent.loc.start.line === parent.loc.end.line; - } - - if (parent.type === "StaticBlock") { - const openingBrace = sourceCode.getFirstToken(parent, { skip: 1 }); // skip the `static` token - - return openingBrace.loc.start.line === parent.loc.end.line; - } - - return false; - } - - /** - * Checks a node to see if it's the last item in a one-liner `ClassBody` node. - * ClassBody is a one-liner if its braces (and consequently everything between them) are on the same line. - * @param {ASTNode} node The node to check. - * @returns {boolean} whether the node is the last item in a one-liner ClassBody. - */ - function isLastInOneLinerClassBody(node) { - const parent = node.parent; - const nextToken = sourceCode.getTokenAfter(node); - - if (!nextToken || nextToken.value !== "}") { - return false; - } - - if (parent.type === "ClassBody") { - return parent.loc.start.line === parent.loc.end.line; - } - - return false; - } - - /** - * Checks a node to see if it's followed by a semicolon. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkForSemicolon(node) { - const isSemi = astUtils.isSemicolonToken(sourceCode.getLastToken(node)); - - if (never) { - if (isSemi && canRemoveSemicolon(node)) { - report(node, true); - } else if ( - !isSemi && beforeStatementContinuationChars === "always" && - node.type !== "PropertyDefinition" && - maybeAsiHazardBefore(sourceCode.getTokenAfter(node)) - ) { - report(node); - } - } else { - const oneLinerBlock = (exceptOneLine && isLastInOneLinerBlock(node)); - const oneLinerClassBody = (exceptOneLineClassBody && isLastInOneLinerClassBody(node)); - const oneLinerBlockOrClassBody = oneLinerBlock || oneLinerClassBody; - - if (isSemi && oneLinerBlockOrClassBody) { - report(node, true); - } else if (!isSemi && !oneLinerBlockOrClassBody) { - report(node); - } - } - } - - /** - * Checks to see if there's a semicolon after a variable declaration. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkForSemicolonForVariableDeclaration(node) { - const parent = node.parent; - - if ((parent.type !== "ForStatement" || parent.init !== node) && - (!/^For(?:In|Of)Statement/u.test(parent.type) || parent.left !== node) - ) { - checkForSemicolon(node); - } - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - VariableDeclaration: checkForSemicolonForVariableDeclaration, - ExpressionStatement: checkForSemicolon, - ReturnStatement: checkForSemicolon, - ThrowStatement: checkForSemicolon, - DoWhileStatement: checkForSemicolon, - DebuggerStatement: checkForSemicolon, - BreakStatement: checkForSemicolon, - ContinueStatement: checkForSemicolon, - ImportDeclaration: checkForSemicolon, - ExportAllDeclaration: checkForSemicolon, - ExportNamedDeclaration(node) { - if (!node.declaration) { - checkForSemicolon(node); - } - }, - ExportDefaultDeclaration(node) { - if (!/(?:Class|Function)Declaration/u.test(node.declaration.type)) { - checkForSemicolon(node); - } - }, - PropertyDefinition: checkForSemicolon - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/sort-imports.js b/node_modules/eslint/lib/rules/sort-imports.js deleted file mode 100644 index 04814ed6f..000000000 --- a/node_modules/eslint/lib/rules/sort-imports.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * @fileoverview Rule to require sorting of import declarations - * @author Christian Schuller - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce sorted import declarations within modules", - recommended: false, - url: "https://eslint.org/docs/latest/rules/sort-imports" - }, - - schema: [ - { - type: "object", - properties: { - ignoreCase: { - type: "boolean", - default: false - }, - memberSyntaxSortOrder: { - type: "array", - items: { - enum: ["none", "all", "multiple", "single"] - }, - uniqueItems: true, - minItems: 4, - maxItems: 4 - }, - ignoreDeclarationSort: { - type: "boolean", - default: false - }, - ignoreMemberSort: { - type: "boolean", - default: false - }, - allowSeparatedGroups: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - fixable: "code", - - messages: { - sortImportsAlphabetically: "Imports should be sorted alphabetically.", - sortMembersAlphabetically: "Member '{{memberName}}' of the import declaration should be sorted alphabetically.", - unexpectedSyntaxOrder: "Expected '{{syntaxA}}' syntax before '{{syntaxB}}' syntax." - } - }, - - create(context) { - - const configuration = context.options[0] || {}, - ignoreCase = configuration.ignoreCase || false, - ignoreDeclarationSort = configuration.ignoreDeclarationSort || false, - ignoreMemberSort = configuration.ignoreMemberSort || false, - memberSyntaxSortOrder = configuration.memberSyntaxSortOrder || ["none", "all", "multiple", "single"], - allowSeparatedGroups = configuration.allowSeparatedGroups || false, - sourceCode = context.sourceCode; - let previousDeclaration = null; - - /** - * Gets the used member syntax style. - * - * import "my-module.js" --> none - * import * as myModule from "my-module.js" --> all - * import {myMember} from "my-module.js" --> single - * import {foo, bar} from "my-module.js" --> multiple - * @param {ASTNode} node the ImportDeclaration node. - * @returns {string} used member parameter style, ["all", "multiple", "single"] - */ - function usedMemberSyntax(node) { - if (node.specifiers.length === 0) { - return "none"; - } - if (node.specifiers[0].type === "ImportNamespaceSpecifier") { - return "all"; - } - if (node.specifiers.length === 1) { - return "single"; - } - return "multiple"; - - } - - /** - * Gets the group by member parameter index for given declaration. - * @param {ASTNode} node the ImportDeclaration node. - * @returns {number} the declaration group by member index. - */ - function getMemberParameterGroupIndex(node) { - return memberSyntaxSortOrder.indexOf(usedMemberSyntax(node)); - } - - /** - * Gets the local name of the first imported module. - * @param {ASTNode} node the ImportDeclaration node. - * @returns {?string} the local name of the first imported module. - */ - function getFirstLocalMemberName(node) { - if (node.specifiers[0]) { - return node.specifiers[0].local.name; - } - return null; - - } - - /** - * Calculates number of lines between two nodes. It is assumed that the given `left` node appears before - * the given `right` node in the source code. Lines are counted from the end of the `left` node till the - * start of the `right` node. If the given nodes are on the same line, it returns `0`, same as if they were - * on two consecutive lines. - * @param {ASTNode} left node that appears before the given `right` node. - * @param {ASTNode} right node that appears after the given `left` node. - * @returns {number} number of lines between nodes. - */ - function getNumberOfLinesBetween(left, right) { - return Math.max(right.loc.start.line - left.loc.end.line - 1, 0); - } - - return { - ImportDeclaration(node) { - if (!ignoreDeclarationSort) { - if ( - previousDeclaration && - allowSeparatedGroups && - getNumberOfLinesBetween(previousDeclaration, node) > 0 - ) { - - // reset declaration sort - previousDeclaration = null; - } - - if (previousDeclaration) { - const currentMemberSyntaxGroupIndex = getMemberParameterGroupIndex(node), - previousMemberSyntaxGroupIndex = getMemberParameterGroupIndex(previousDeclaration); - let currentLocalMemberName = getFirstLocalMemberName(node), - previousLocalMemberName = getFirstLocalMemberName(previousDeclaration); - - if (ignoreCase) { - previousLocalMemberName = previousLocalMemberName && previousLocalMemberName.toLowerCase(); - currentLocalMemberName = currentLocalMemberName && currentLocalMemberName.toLowerCase(); - } - - /* - * When the current declaration uses a different member syntax, - * then check if the ordering is correct. - * Otherwise, make a default string compare (like rule sort-vars to be consistent) of the first used local member name. - */ - if (currentMemberSyntaxGroupIndex !== previousMemberSyntaxGroupIndex) { - if (currentMemberSyntaxGroupIndex < previousMemberSyntaxGroupIndex) { - context.report({ - node, - messageId: "unexpectedSyntaxOrder", - data: { - syntaxA: memberSyntaxSortOrder[currentMemberSyntaxGroupIndex], - syntaxB: memberSyntaxSortOrder[previousMemberSyntaxGroupIndex] - } - }); - } - } else { - if (previousLocalMemberName && - currentLocalMemberName && - currentLocalMemberName < previousLocalMemberName - ) { - context.report({ - node, - messageId: "sortImportsAlphabetically" - }); - } - } - } - - previousDeclaration = node; - } - - if (!ignoreMemberSort) { - const importSpecifiers = node.specifiers.filter(specifier => specifier.type === "ImportSpecifier"); - const getSortableName = ignoreCase ? specifier => specifier.local.name.toLowerCase() : specifier => specifier.local.name; - const firstUnsortedIndex = importSpecifiers.map(getSortableName).findIndex((name, index, array) => array[index - 1] > name); - - if (firstUnsortedIndex !== -1) { - context.report({ - node: importSpecifiers[firstUnsortedIndex], - messageId: "sortMembersAlphabetically", - data: { memberName: importSpecifiers[firstUnsortedIndex].local.name }, - fix(fixer) { - if (importSpecifiers.some(specifier => - sourceCode.getCommentsBefore(specifier).length || sourceCode.getCommentsAfter(specifier).length)) { - - // If there are comments in the ImportSpecifier list, don't rearrange the specifiers. - return null; - } - - return fixer.replaceTextRange( - [importSpecifiers[0].range[0], importSpecifiers[importSpecifiers.length - 1].range[1]], - importSpecifiers - - // Clone the importSpecifiers array to avoid mutating it - .slice() - - // Sort the array into the desired order - .sort((specifierA, specifierB) => { - const aName = getSortableName(specifierA); - const bName = getSortableName(specifierB); - - return aName > bName ? 1 : -1; - }) - - // Build a string out of the sorted list of import specifiers and the text between the originals - .reduce((sourceText, specifier, index) => { - const textAfterSpecifier = index === importSpecifiers.length - 1 - ? "" - : sourceCode.getText().slice(importSpecifiers[index].range[1], importSpecifiers[index + 1].range[0]); - - return sourceText + sourceCode.getText(specifier) + textAfterSpecifier; - }, "") - ); - } - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/sort-keys.js b/node_modules/eslint/lib/rules/sort-keys.js deleted file mode 100644 index 088b5890f..000000000 --- a/node_modules/eslint/lib/rules/sort-keys.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * @fileoverview Rule to require object keys to be sorted - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"), - naturalCompare = require("natural-compare"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Gets the property name of the given `Property` node. - * - * - If the property's key is an `Identifier` node, this returns the key's name - * whether it's a computed property or not. - * - If the property has a static name, this returns the static name. - * - Otherwise, this returns null. - * @param {ASTNode} node The `Property` node to get. - * @returns {string|null} The property name or null. - * @private - */ -function getPropertyName(node) { - const staticName = astUtils.getStaticPropertyName(node); - - if (staticName !== null) { - return staticName; - } - - return node.key.name || null; -} - -/** - * Functions which check that the given 2 names are in specific order. - * - * Postfix `I` is meant insensitive. - * Postfix `N` is meant natural. - * @private - */ -const isValidOrders = { - asc(a, b) { - return a <= b; - }, - ascI(a, b) { - return a.toLowerCase() <= b.toLowerCase(); - }, - ascN(a, b) { - return naturalCompare(a, b) <= 0; - }, - ascIN(a, b) { - return naturalCompare(a.toLowerCase(), b.toLowerCase()) <= 0; - }, - desc(a, b) { - return isValidOrders.asc(b, a); - }, - descI(a, b) { - return isValidOrders.ascI(b, a); - }, - descN(a, b) { - return isValidOrders.ascN(b, a); - }, - descIN(a, b) { - return isValidOrders.ascIN(b, a); - } -}; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require object keys to be sorted", - recommended: false, - url: "https://eslint.org/docs/latest/rules/sort-keys" - }, - - schema: [ - { - enum: ["asc", "desc"] - }, - { - type: "object", - properties: { - caseSensitive: { - type: "boolean", - default: true - }, - natural: { - type: "boolean", - default: false - }, - minKeys: { - type: "integer", - minimum: 2, - default: 2 - }, - allowLineSeparatedGroups: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - sortKeys: "Expected object keys to be in {{natural}}{{insensitive}}{{order}}ending order. '{{thisName}}' should be before '{{prevName}}'." - } - }, - - create(context) { - - // Parse options. - const order = context.options[0] || "asc"; - const options = context.options[1]; - const insensitive = options && options.caseSensitive === false; - const natural = options && options.natural; - const minKeys = options && options.minKeys; - const allowLineSeparatedGroups = options && options.allowLineSeparatedGroups || false; - const isValidOrder = isValidOrders[ - order + (insensitive ? "I" : "") + (natural ? "N" : "") - ]; - - // The stack to save the previous property's name for each object literals. - let stack = null; - const sourceCode = context.sourceCode; - - return { - ObjectExpression(node) { - stack = { - upper: stack, - prevNode: null, - prevBlankLine: false, - prevName: null, - numKeys: node.properties.length - }; - }, - - "ObjectExpression:exit"() { - stack = stack.upper; - }, - - SpreadElement(node) { - if (node.parent.type === "ObjectExpression") { - stack.prevName = null; - } - }, - - Property(node) { - if (node.parent.type === "ObjectPattern") { - return; - } - - const prevName = stack.prevName; - const numKeys = stack.numKeys; - const thisName = getPropertyName(node); - - // Get tokens between current node and previous node - const tokens = stack.prevNode && sourceCode - .getTokensBetween(stack.prevNode, node, { includeComments: true }); - - let isBlankLineBetweenNodes = stack.prevBlankLine; - - if (tokens) { - - // check blank line between tokens - tokens.forEach((token, index) => { - const previousToken = tokens[index - 1]; - - if (previousToken && (token.loc.start.line - previousToken.loc.end.line > 1)) { - isBlankLineBetweenNodes = true; - } - }); - - // check blank line between the current node and the last token - if (!isBlankLineBetweenNodes && (node.loc.start.line - tokens[tokens.length - 1].loc.end.line > 1)) { - isBlankLineBetweenNodes = true; - } - - // check blank line between the first token and the previous node - if (!isBlankLineBetweenNodes && (tokens[0].loc.start.line - stack.prevNode.loc.end.line > 1)) { - isBlankLineBetweenNodes = true; - } - } - - stack.prevNode = node; - - if (thisName !== null) { - stack.prevName = thisName; - } - - if (allowLineSeparatedGroups && isBlankLineBetweenNodes) { - stack.prevBlankLine = thisName === null; - return; - } - - if (prevName === null || thisName === null || numKeys < minKeys) { - return; - } - - if (!isValidOrder(prevName, thisName)) { - context.report({ - node, - loc: node.key.loc, - messageId: "sortKeys", - data: { - thisName, - prevName, - order, - insensitive: insensitive ? "insensitive " : "", - natural: natural ? "natural " : "" - } - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/sort-vars.js b/node_modules/eslint/lib/rules/sort-vars.js deleted file mode 100644 index 8fd723fd4..000000000 --- a/node_modules/eslint/lib/rules/sort-vars.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @fileoverview Rule to require sorting of variables within a single Variable Declaration block - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require variables within the same declaration block to be sorted", - recommended: false, - url: "https://eslint.org/docs/latest/rules/sort-vars" - }, - - schema: [ - { - type: "object", - properties: { - ignoreCase: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - fixable: "code", - - messages: { - sortVars: "Variables within the same declaration block should be sorted alphabetically." - } - }, - - create(context) { - - const configuration = context.options[0] || {}, - ignoreCase = configuration.ignoreCase || false, - sourceCode = context.sourceCode; - - return { - VariableDeclaration(node) { - const idDeclarations = node.declarations.filter(decl => decl.id.type === "Identifier"); - const getSortableName = ignoreCase ? decl => decl.id.name.toLowerCase() : decl => decl.id.name; - const unfixable = idDeclarations.some(decl => decl.init !== null && decl.init.type !== "Literal"); - let fixed = false; - - idDeclarations.slice(1).reduce((memo, decl) => { - const lastVariableName = getSortableName(memo), - currentVariableName = getSortableName(decl); - - if (currentVariableName < lastVariableName) { - context.report({ - node: decl, - messageId: "sortVars", - fix(fixer) { - if (unfixable || fixed) { - return null; - } - return fixer.replaceTextRange( - [idDeclarations[0].range[0], idDeclarations[idDeclarations.length - 1].range[1]], - idDeclarations - - // Clone the idDeclarations array to avoid mutating it - .slice() - - // Sort the array into the desired order - .sort((declA, declB) => { - const aName = getSortableName(declA); - const bName = getSortableName(declB); - - return aName > bName ? 1 : -1; - }) - - // Build a string out of the sorted list of identifier declarations and the text between the originals - .reduce((sourceText, identifier, index) => { - const textAfterIdentifier = index === idDeclarations.length - 1 - ? "" - : sourceCode.getText().slice(idDeclarations[index].range[1], idDeclarations[index + 1].range[0]); - - return sourceText + sourceCode.getText(identifier) + textAfterIdentifier; - }, "") - - ); - } - }); - fixed = true; - return memo; - } - return decl; - - }, idDeclarations[0]); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/space-before-blocks.js b/node_modules/eslint/lib/rules/space-before-blocks.js deleted file mode 100644 index a580a4f22..000000000 --- a/node_modules/eslint/lib/rules/space-before-blocks.js +++ /dev/null @@ -1,201 +0,0 @@ -/** - * @fileoverview A rule to ensure whitespace before blocks. - * @author Mathias Schreck - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Checks whether the given node represents the body of a function. - * @param {ASTNode} node the node to check. - * @returns {boolean} `true` if the node is function body. - */ -function isFunctionBody(node) { - const parent = node.parent; - - return ( - node.type === "BlockStatement" && - astUtils.isFunction(parent) && - parent.body === node - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing before blocks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/space-before-blocks" - }, - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - keywords: { - enum: ["always", "never", "off"] - }, - functions: { - enum: ["always", "never", "off"] - }, - classes: { - enum: ["always", "never", "off"] - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - unexpectedSpace: "Unexpected space before opening brace.", - missingSpace: "Missing space before opening brace." - } - }, - - create(context) { - const config = context.options[0], - sourceCode = context.sourceCode; - let alwaysFunctions = true, - alwaysKeywords = true, - alwaysClasses = true, - neverFunctions = false, - neverKeywords = false, - neverClasses = false; - - if (typeof config === "object") { - alwaysFunctions = config.functions === "always"; - alwaysKeywords = config.keywords === "always"; - alwaysClasses = config.classes === "always"; - neverFunctions = config.functions === "never"; - neverKeywords = config.keywords === "never"; - neverClasses = config.classes === "never"; - } else if (config === "never") { - alwaysFunctions = false; - alwaysKeywords = false; - alwaysClasses = false; - neverFunctions = true; - neverKeywords = true; - neverClasses = true; - } - - /** - * Checks whether the spacing before the given block is already controlled by another rule: - * - `arrow-spacing` checks spaces after `=>`. - * - `keyword-spacing` checks spaces after keywords in certain contexts. - * - `switch-colon-spacing` checks spaces after `:` of switch cases. - * @param {Token} precedingToken first token before the block. - * @param {ASTNode|Token} node `BlockStatement` node or `{` token of a `SwitchStatement` node. - * @returns {boolean} `true` if requiring or disallowing spaces before the given block could produce conflicts with other rules. - */ - function isConflicted(precedingToken, node) { - return ( - astUtils.isArrowToken(precedingToken) || - ( - astUtils.isKeywordToken(precedingToken) && - !isFunctionBody(node) - ) || - ( - astUtils.isColonToken(precedingToken) && - node.parent && - node.parent.type === "SwitchCase" && - precedingToken === astUtils.getSwitchCaseColonToken(node.parent, sourceCode) - ) - ); - } - - /** - * Checks the given BlockStatement node has a preceding space if it doesn’t start on a new line. - * @param {ASTNode|Token} node The AST node of a BlockStatement. - * @returns {void} undefined. - */ - function checkPrecedingSpace(node) { - const precedingToken = sourceCode.getTokenBefore(node); - - if (precedingToken && !isConflicted(precedingToken, node) && astUtils.isTokenOnSameLine(precedingToken, node)) { - const hasSpace = sourceCode.isSpaceBetweenTokens(precedingToken, node); - let requireSpace; - let requireNoSpace; - - if (isFunctionBody(node)) { - requireSpace = alwaysFunctions; - requireNoSpace = neverFunctions; - } else if (node.type === "ClassBody") { - requireSpace = alwaysClasses; - requireNoSpace = neverClasses; - } else { - requireSpace = alwaysKeywords; - requireNoSpace = neverKeywords; - } - - if (requireSpace && !hasSpace) { - context.report({ - node, - messageId: "missingSpace", - fix(fixer) { - return fixer.insertTextBefore(node, " "); - } - }); - } else if (requireNoSpace && hasSpace) { - context.report({ - node, - messageId: "unexpectedSpace", - fix(fixer) { - return fixer.removeRange([precedingToken.range[1], node.range[0]]); - } - }); - } - } - } - - /** - * Checks if the CaseBlock of an given SwitchStatement node has a preceding space. - * @param {ASTNode} node The node of a SwitchStatement. - * @returns {void} undefined. - */ - function checkSpaceBeforeCaseBlock(node) { - const cases = node.cases; - let openingBrace; - - if (cases.length > 0) { - openingBrace = sourceCode.getTokenBefore(cases[0]); - } else { - openingBrace = sourceCode.getLastToken(node, 1); - } - - checkPrecedingSpace(openingBrace); - } - - return { - BlockStatement: checkPrecedingSpace, - ClassBody: checkPrecedingSpace, - SwitchStatement: checkSpaceBeforeCaseBlock - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/space-before-function-paren.js b/node_modules/eslint/lib/rules/space-before-function-paren.js deleted file mode 100644 index c5faa8cf4..000000000 --- a/node_modules/eslint/lib/rules/space-before-function-paren.js +++ /dev/null @@ -1,164 +0,0 @@ -/** - * @fileoverview Rule to validate spacing before function paren. - * @author Mathias Schreck - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing before `function` definition opening parenthesis", - recommended: false, - url: "https://eslint.org/docs/latest/rules/space-before-function-paren" - }, - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - anonymous: { - enum: ["always", "never", "ignore"] - }, - named: { - enum: ["always", "never", "ignore"] - }, - asyncArrow: { - enum: ["always", "never", "ignore"] - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - unexpectedSpace: "Unexpected space before function parentheses.", - missingSpace: "Missing space before function parentheses." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const baseConfig = typeof context.options[0] === "string" ? context.options[0] : "always"; - const overrideConfig = typeof context.options[0] === "object" ? context.options[0] : {}; - - /** - * Determines whether a function has a name. - * @param {ASTNode} node The function node. - * @returns {boolean} Whether the function has a name. - */ - function isNamedFunction(node) { - if (node.id) { - return true; - } - - const parent = node.parent; - - return parent.type === "MethodDefinition" || - (parent.type === "Property" && - ( - parent.kind === "get" || - parent.kind === "set" || - parent.method - ) - ); - } - - /** - * Gets the config for a given function - * @param {ASTNode} node The function node - * @returns {string} "always", "never", or "ignore" - */ - function getConfigForFunction(node) { - if (node.type === "ArrowFunctionExpression") { - - // Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar - if (node.async && astUtils.isOpeningParenToken(sourceCode.getFirstToken(node, { skip: 1 }))) { - return overrideConfig.asyncArrow || baseConfig; - } - } else if (isNamedFunction(node)) { - return overrideConfig.named || baseConfig; - - // `generator-star-spacing` should warn anonymous generators. E.g. `function* () {}` - } else if (!node.generator) { - return overrideConfig.anonymous || baseConfig; - } - - return "ignore"; - } - - /** - * Checks the parens of a function node - * @param {ASTNode} node A function node - * @returns {void} - */ - function checkFunction(node) { - const functionConfig = getConfigForFunction(node); - - if (functionConfig === "ignore") { - return; - } - - const rightToken = sourceCode.getFirstToken(node, astUtils.isOpeningParenToken); - const leftToken = sourceCode.getTokenBefore(rightToken); - const hasSpacing = sourceCode.isSpaceBetweenTokens(leftToken, rightToken); - - if (hasSpacing && functionConfig === "never") { - context.report({ - node, - loc: { - start: leftToken.loc.end, - end: rightToken.loc.start - }, - messageId: "unexpectedSpace", - fix(fixer) { - const comments = sourceCode.getCommentsBefore(rightToken); - - // Don't fix anything if there's a single line comment between the left and the right token - if (comments.some(comment => comment.type === "Line")) { - return null; - } - return fixer.replaceTextRange( - [leftToken.range[1], rightToken.range[0]], - comments.reduce((text, comment) => text + sourceCode.getText(comment), "") - ); - } - }); - } else if (!hasSpacing && functionConfig === "always") { - context.report({ - node, - loc: rightToken.loc, - messageId: "missingSpace", - fix: fixer => fixer.insertTextAfter(leftToken, " ") - }); - } - } - - return { - ArrowFunctionExpression: checkFunction, - FunctionDeclaration: checkFunction, - FunctionExpression: checkFunction - }; - } -}; diff --git a/node_modules/eslint/lib/rules/space-in-parens.js b/node_modules/eslint/lib/rules/space-in-parens.js deleted file mode 100644 index c6c06d29a..000000000 --- a/node_modules/eslint/lib/rules/space-in-parens.js +++ /dev/null @@ -1,282 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside of parentheses. - * @author Jonathan Rajavuori - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing inside parentheses", - recommended: false, - url: "https://eslint.org/docs/latest/rules/space-in-parens" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - exceptions: { - type: "array", - items: { - enum: ["{}", "[]", "()", "empty"] - }, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - missingOpeningSpace: "There must be a space after this paren.", - missingClosingSpace: "There must be a space before this paren.", - rejectedOpeningSpace: "There should be no space after this paren.", - rejectedClosingSpace: "There should be no space before this paren." - } - }, - - create(context) { - const ALWAYS = context.options[0] === "always", - exceptionsArrayOptions = (context.options[1] && context.options[1].exceptions) || [], - options = {}; - - let exceptions; - - if (exceptionsArrayOptions.length) { - options.braceException = exceptionsArrayOptions.includes("{}"); - options.bracketException = exceptionsArrayOptions.includes("[]"); - options.parenException = exceptionsArrayOptions.includes("()"); - options.empty = exceptionsArrayOptions.includes("empty"); - } - - /** - * Produces an object with the opener and closer exception values - * @returns {Object} `openers` and `closers` exception values - * @private - */ - function getExceptions() { - const openers = [], - closers = []; - - if (options.braceException) { - openers.push("{"); - closers.push("}"); - } - - if (options.bracketException) { - openers.push("["); - closers.push("]"); - } - - if (options.parenException) { - openers.push("("); - closers.push(")"); - } - - if (options.empty) { - openers.push(")"); - closers.push("("); - } - - return { - openers, - closers - }; - } - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - const sourceCode = context.sourceCode; - - /** - * Determines if a token is one of the exceptions for the opener paren - * @param {Object} token The token to check - * @returns {boolean} True if the token is one of the exceptions for the opener paren - */ - function isOpenerException(token) { - return exceptions.openers.includes(token.value); - } - - /** - * Determines if a token is one of the exceptions for the closer paren - * @param {Object} token The token to check - * @returns {boolean} True if the token is one of the exceptions for the closer paren - */ - function isCloserException(token) { - return exceptions.closers.includes(token.value); - } - - /** - * Determines if an opening paren is immediately followed by a required space - * @param {Object} openingParenToken The paren token - * @param {Object} tokenAfterOpeningParen The token after it - * @returns {boolean} True if the opening paren is missing a required space - */ - function openerMissingSpace(openingParenToken, tokenAfterOpeningParen) { - if (sourceCode.isSpaceBetweenTokens(openingParenToken, tokenAfterOpeningParen)) { - return false; - } - - if (!options.empty && astUtils.isClosingParenToken(tokenAfterOpeningParen)) { - return false; - } - - if (ALWAYS) { - return !isOpenerException(tokenAfterOpeningParen); - } - return isOpenerException(tokenAfterOpeningParen); - } - - /** - * Determines if an opening paren is immediately followed by a disallowed space - * @param {Object} openingParenToken The paren token - * @param {Object} tokenAfterOpeningParen The token after it - * @returns {boolean} True if the opening paren has a disallowed space - */ - function openerRejectsSpace(openingParenToken, tokenAfterOpeningParen) { - if (!astUtils.isTokenOnSameLine(openingParenToken, tokenAfterOpeningParen)) { - return false; - } - - if (tokenAfterOpeningParen.type === "Line") { - return false; - } - - if (!sourceCode.isSpaceBetweenTokens(openingParenToken, tokenAfterOpeningParen)) { - return false; - } - - if (ALWAYS) { - return isOpenerException(tokenAfterOpeningParen); - } - return !isOpenerException(tokenAfterOpeningParen); - } - - /** - * Determines if a closing paren is immediately preceded by a required space - * @param {Object} tokenBeforeClosingParen The token before the paren - * @param {Object} closingParenToken The paren token - * @returns {boolean} True if the closing paren is missing a required space - */ - function closerMissingSpace(tokenBeforeClosingParen, closingParenToken) { - if (sourceCode.isSpaceBetweenTokens(tokenBeforeClosingParen, closingParenToken)) { - return false; - } - - if (!options.empty && astUtils.isOpeningParenToken(tokenBeforeClosingParen)) { - return false; - } - - if (ALWAYS) { - return !isCloserException(tokenBeforeClosingParen); - } - return isCloserException(tokenBeforeClosingParen); - } - - /** - * Determines if a closer paren is immediately preceded by a disallowed space - * @param {Object} tokenBeforeClosingParen The token before the paren - * @param {Object} closingParenToken The paren token - * @returns {boolean} True if the closing paren has a disallowed space - */ - function closerRejectsSpace(tokenBeforeClosingParen, closingParenToken) { - if (!astUtils.isTokenOnSameLine(tokenBeforeClosingParen, closingParenToken)) { - return false; - } - - if (!sourceCode.isSpaceBetweenTokens(tokenBeforeClosingParen, closingParenToken)) { - return false; - } - - if (ALWAYS) { - return isCloserException(tokenBeforeClosingParen); - } - return !isCloserException(tokenBeforeClosingParen); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - Program: function checkParenSpaces(node) { - exceptions = getExceptions(); - const tokens = sourceCode.tokensAndComments; - - tokens.forEach((token, i) => { - const prevToken = tokens[i - 1]; - const nextToken = tokens[i + 1]; - - // if token is not an opening or closing paren token, do nothing - if (!astUtils.isOpeningParenToken(token) && !astUtils.isClosingParenToken(token)) { - return; - } - - // if token is an opening paren and is not followed by a required space - if (token.value === "(" && openerMissingSpace(token, nextToken)) { - context.report({ - node, - loc: token.loc, - messageId: "missingOpeningSpace", - fix(fixer) { - return fixer.insertTextAfter(token, " "); - } - }); - } - - // if token is an opening paren and is followed by a disallowed space - if (token.value === "(" && openerRejectsSpace(token, nextToken)) { - context.report({ - node, - loc: { start: token.loc.end, end: nextToken.loc.start }, - messageId: "rejectedOpeningSpace", - fix(fixer) { - return fixer.removeRange([token.range[1], nextToken.range[0]]); - } - }); - } - - // if token is a closing paren and is not preceded by a required space - if (token.value === ")" && closerMissingSpace(prevToken, token)) { - context.report({ - node, - loc: token.loc, - messageId: "missingClosingSpace", - fix(fixer) { - return fixer.insertTextBefore(token, " "); - } - }); - } - - // if token is a closing paren and is preceded by a disallowed space - if (token.value === ")" && closerRejectsSpace(prevToken, token)) { - context.report({ - node, - loc: { start: prevToken.loc.end, end: token.loc.start }, - messageId: "rejectedClosingSpace", - fix(fixer) { - return fixer.removeRange([prevToken.range[1], token.range[0]]); - } - }); - } - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/space-infix-ops.js b/node_modules/eslint/lib/rules/space-infix-ops.js deleted file mode 100644 index 81a95f83b..000000000 --- a/node_modules/eslint/lib/rules/space-infix-ops.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * @fileoverview Require spaces around infix operators - * @author Michael Ficarra - */ -"use strict"; - -const { isEqToken } = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require spacing around infix operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/space-infix-ops" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - int32Hint: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - missingSpace: "Operator '{{operator}}' must be spaced." - } - }, - - create(context) { - const int32Hint = context.options[0] ? context.options[0].int32Hint === true : false; - const sourceCode = context.sourceCode; - - /** - * Returns the first token which violates the rule - * @param {ASTNode} left The left node of the main node - * @param {ASTNode} right The right node of the main node - * @param {string} op The operator of the main node - * @returns {Object} The violator token or null - * @private - */ - function getFirstNonSpacedToken(left, right, op) { - const operator = sourceCode.getFirstTokenBetween(left, right, token => token.value === op); - const prev = sourceCode.getTokenBefore(operator); - const next = sourceCode.getTokenAfter(operator); - - if (!sourceCode.isSpaceBetweenTokens(prev, operator) || !sourceCode.isSpaceBetweenTokens(operator, next)) { - return operator; - } - - return null; - } - - /** - * Reports an AST node as a rule violation - * @param {ASTNode} mainNode The node to report - * @param {Object} culpritToken The token which has a problem - * @returns {void} - * @private - */ - function report(mainNode, culpritToken) { - context.report({ - node: mainNode, - loc: culpritToken.loc, - messageId: "missingSpace", - data: { - operator: culpritToken.value - }, - fix(fixer) { - const previousToken = sourceCode.getTokenBefore(culpritToken); - const afterToken = sourceCode.getTokenAfter(culpritToken); - let fixString = ""; - - if (culpritToken.range[0] - previousToken.range[1] === 0) { - fixString = " "; - } - - fixString += culpritToken.value; - - if (afterToken.range[0] - culpritToken.range[1] === 0) { - fixString += " "; - } - - return fixer.replaceText(culpritToken, fixString); - } - }); - } - - /** - * Check if the node is binary then report - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkBinary(node) { - const leftNode = (node.left.typeAnnotation) ? node.left.typeAnnotation : node.left; - const rightNode = node.right; - - // search for = in AssignmentPattern nodes - const operator = node.operator || "="; - - const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode, operator); - - if (nonSpacedNode) { - if (!(int32Hint && sourceCode.getText(node).endsWith("|0"))) { - report(node, nonSpacedNode); - } - } - } - - /** - * Check if the node is conditional - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkConditional(node) { - const nonSpacedConsequentNode = getFirstNonSpacedToken(node.test, node.consequent, "?"); - const nonSpacedAlternateNode = getFirstNonSpacedToken(node.consequent, node.alternate, ":"); - - if (nonSpacedConsequentNode) { - report(node, nonSpacedConsequentNode); - } - - if (nonSpacedAlternateNode) { - report(node, nonSpacedAlternateNode); - } - } - - /** - * Check if the node is a variable - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkVar(node) { - const leftNode = (node.id.typeAnnotation) ? node.id.typeAnnotation : node.id; - const rightNode = node.init; - - if (rightNode) { - const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode, "="); - - if (nonSpacedNode) { - report(node, nonSpacedNode); - } - } - } - - return { - AssignmentExpression: checkBinary, - AssignmentPattern: checkBinary, - BinaryExpression: checkBinary, - LogicalExpression: checkBinary, - ConditionalExpression: checkConditional, - VariableDeclarator: checkVar, - - PropertyDefinition(node) { - if (!node.value) { - return; - } - - /* - * Because of computed properties and type annotations, some - * tokens may exist between `node.key` and `=`. - * Therefore, find the `=` from the right. - */ - const operatorToken = sourceCode.getTokenBefore(node.value, isEqToken); - const leftToken = sourceCode.getTokenBefore(operatorToken); - const rightToken = sourceCode.getTokenAfter(operatorToken); - - if ( - !sourceCode.isSpaceBetweenTokens(leftToken, operatorToken) || - !sourceCode.isSpaceBetweenTokens(operatorToken, rightToken) - ) { - report(node, operatorToken); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/space-unary-ops.js b/node_modules/eslint/lib/rules/space-unary-ops.js deleted file mode 100644 index 381381d6e..000000000 --- a/node_modules/eslint/lib/rules/space-unary-ops.js +++ /dev/null @@ -1,321 +0,0 @@ -/** - * @fileoverview This rule should require or disallow spaces before or after unary operations. - * @author Marcin Kumorek - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent spacing before or after unary operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/space-unary-ops" - }, - - fixable: "whitespace", - - schema: [ - { - type: "object", - properties: { - words: { - type: "boolean", - default: true - }, - nonwords: { - type: "boolean", - default: false - }, - overrides: { - type: "object", - additionalProperties: { - type: "boolean" - } - } - }, - additionalProperties: false - } - ], - messages: { - unexpectedBefore: "Unexpected space before unary operator '{{operator}}'.", - unexpectedAfter: "Unexpected space after unary operator '{{operator}}'.", - unexpectedAfterWord: "Unexpected space after unary word operator '{{word}}'.", - wordOperator: "Unary word operator '{{word}}' must be followed by whitespace.", - operator: "Unary operator '{{operator}}' must be followed by whitespace.", - beforeUnaryExpressions: "Space is required before unary expressions '{{token}}'." - } - }, - - create(context) { - const options = context.options[0] || { words: true, nonwords: false }; - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Check if the node is the first "!" in a "!!" convert to Boolean expression - * @param {ASTnode} node AST node - * @returns {boolean} Whether or not the node is first "!" in "!!" - */ - function isFirstBangInBangBangExpression(node) { - return node && node.type === "UnaryExpression" && node.argument.operator === "!" && - node.argument && node.argument.type === "UnaryExpression" && node.argument.operator === "!"; - } - - /** - * Checks if an override exists for a given operator. - * @param {string} operator Operator - * @returns {boolean} Whether or not an override has been provided for the operator - */ - function overrideExistsForOperator(operator) { - return options.overrides && Object.prototype.hasOwnProperty.call(options.overrides, operator); - } - - /** - * Gets the value that the override was set to for this operator - * @param {string} operator Operator - * @returns {boolean} Whether or not an override enforces a space with this operator - */ - function overrideEnforcesSpaces(operator) { - return options.overrides[operator]; - } - - /** - * Verify Unary Word Operator has spaces after the word operator - * @param {ASTnode} node AST node - * @param {Object} firstToken first token from the AST node - * @param {Object} secondToken second token from the AST node - * @param {string} word The word to be used for reporting - * @returns {void} - */ - function verifyWordHasSpaces(node, firstToken, secondToken, word) { - if (secondToken.range[0] === firstToken.range[1]) { - context.report({ - node, - messageId: "wordOperator", - data: { - word - }, - fix(fixer) { - return fixer.insertTextAfter(firstToken, " "); - } - }); - } - } - - /** - * Verify Unary Word Operator doesn't have spaces after the word operator - * @param {ASTnode} node AST node - * @param {Object} firstToken first token from the AST node - * @param {Object} secondToken second token from the AST node - * @param {string} word The word to be used for reporting - * @returns {void} - */ - function verifyWordDoesntHaveSpaces(node, firstToken, secondToken, word) { - if (astUtils.canTokensBeAdjacent(firstToken, secondToken)) { - if (secondToken.range[0] > firstToken.range[1]) { - context.report({ - node, - messageId: "unexpectedAfterWord", - data: { - word - }, - fix(fixer) { - return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); - } - }); - } - } - } - - /** - * Check Unary Word Operators for spaces after the word operator - * @param {ASTnode} node AST node - * @param {Object} firstToken first token from the AST node - * @param {Object} secondToken second token from the AST node - * @param {string} word The word to be used for reporting - * @returns {void} - */ - function checkUnaryWordOperatorForSpaces(node, firstToken, secondToken, word) { - if (overrideExistsForOperator(word)) { - if (overrideEnforcesSpaces(word)) { - verifyWordHasSpaces(node, firstToken, secondToken, word); - } else { - verifyWordDoesntHaveSpaces(node, firstToken, secondToken, word); - } - } else if (options.words) { - verifyWordHasSpaces(node, firstToken, secondToken, word); - } else { - verifyWordDoesntHaveSpaces(node, firstToken, secondToken, word); - } - } - - /** - * Verifies YieldExpressions satisfy spacing requirements - * @param {ASTnode} node AST node - * @returns {void} - */ - function checkForSpacesAfterYield(node) { - const tokens = sourceCode.getFirstTokens(node, 3), - word = "yield"; - - if (!node.argument || node.delegate) { - return; - } - - checkUnaryWordOperatorForSpaces(node, tokens[0], tokens[1], word); - } - - /** - * Verifies AwaitExpressions satisfy spacing requirements - * @param {ASTNode} node AwaitExpression AST node - * @returns {void} - */ - function checkForSpacesAfterAwait(node) { - const tokens = sourceCode.getFirstTokens(node, 3); - - checkUnaryWordOperatorForSpaces(node, tokens[0], tokens[1], "await"); - } - - /** - * Verifies UnaryExpression, UpdateExpression and NewExpression have spaces before or after the operator - * @param {ASTnode} node AST node - * @param {Object} firstToken First token in the expression - * @param {Object} secondToken Second token in the expression - * @returns {void} - */ - function verifyNonWordsHaveSpaces(node, firstToken, secondToken) { - if (node.prefix) { - if (isFirstBangInBangBangExpression(node)) { - return; - } - if (firstToken.range[1] === secondToken.range[0]) { - context.report({ - node, - messageId: "operator", - data: { - operator: firstToken.value - }, - fix(fixer) { - return fixer.insertTextAfter(firstToken, " "); - } - }); - } - } else { - if (firstToken.range[1] === secondToken.range[0]) { - context.report({ - node, - messageId: "beforeUnaryExpressions", - data: { - token: secondToken.value - }, - fix(fixer) { - return fixer.insertTextBefore(secondToken, " "); - } - }); - } - } - } - - /** - * Verifies UnaryExpression, UpdateExpression and NewExpression don't have spaces before or after the operator - * @param {ASTnode} node AST node - * @param {Object} firstToken First token in the expression - * @param {Object} secondToken Second token in the expression - * @returns {void} - */ - function verifyNonWordsDontHaveSpaces(node, firstToken, secondToken) { - if (node.prefix) { - if (secondToken.range[0] > firstToken.range[1]) { - context.report({ - node, - messageId: "unexpectedAfter", - data: { - operator: firstToken.value - }, - fix(fixer) { - if (astUtils.canTokensBeAdjacent(firstToken, secondToken)) { - return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); - } - return null; - } - }); - } - } else { - if (secondToken.range[0] > firstToken.range[1]) { - context.report({ - node, - messageId: "unexpectedBefore", - data: { - operator: secondToken.value - }, - fix(fixer) { - return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); - } - }); - } - } - } - - /** - * Verifies UnaryExpression, UpdateExpression and NewExpression satisfy spacing requirements - * @param {ASTnode} node AST node - * @returns {void} - */ - function checkForSpaces(node) { - const tokens = node.type === "UpdateExpression" && !node.prefix - ? sourceCode.getLastTokens(node, 2) - : sourceCode.getFirstTokens(node, 2); - const firstToken = tokens[0]; - const secondToken = tokens[1]; - - if ((node.type === "NewExpression" || node.prefix) && firstToken.type === "Keyword") { - checkUnaryWordOperatorForSpaces(node, firstToken, secondToken, firstToken.value); - return; - } - - const operator = node.prefix ? tokens[0].value : tokens[1].value; - - if (overrideExistsForOperator(operator)) { - if (overrideEnforcesSpaces(operator)) { - verifyNonWordsHaveSpaces(node, firstToken, secondToken); - } else { - verifyNonWordsDontHaveSpaces(node, firstToken, secondToken); - } - } else if (options.nonwords) { - verifyNonWordsHaveSpaces(node, firstToken, secondToken); - } else { - verifyNonWordsDontHaveSpaces(node, firstToken, secondToken); - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - UnaryExpression: checkForSpaces, - UpdateExpression: checkForSpaces, - NewExpression: checkForSpaces, - YieldExpression: checkForSpacesAfterYield, - AwaitExpression: checkForSpacesAfterAwait - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/spaced-comment.js b/node_modules/eslint/lib/rules/spaced-comment.js deleted file mode 100644 index 2eb7f0e30..000000000 --- a/node_modules/eslint/lib/rules/spaced-comment.js +++ /dev/null @@ -1,382 +0,0 @@ -/** - * @fileoverview Source code for spaced-comments rule - * @author Gyandeep Singh - */ -"use strict"; - -const escapeRegExp = require("escape-string-regexp"); -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Escapes the control characters of a given string. - * @param {string} s A string to escape. - * @returns {string} An escaped string. - */ -function escape(s) { - return `(?:${escapeRegExp(s)})`; -} - -/** - * Escapes the control characters of a given string. - * And adds a repeat flag. - * @param {string} s A string to escape. - * @returns {string} An escaped string. - */ -function escapeAndRepeat(s) { - return `${escape(s)}+`; -} - -/** - * Parses `markers` option. - * If markers don't include `"*"`, this adds `"*"` to allow JSDoc comments. - * @param {string[]} [markers] A marker list. - * @returns {string[]} A marker list. - */ -function parseMarkersOption(markers) { - - // `*` is a marker for JSDoc comments. - if (!markers.includes("*")) { - return markers.concat("*"); - } - - return markers; -} - -/** - * Creates string pattern for exceptions. - * Generated pattern: - * - * 1. A space or an exception pattern sequence. - * @param {string[]} exceptions An exception pattern list. - * @returns {string} A regular expression string for exceptions. - */ -function createExceptionsPattern(exceptions) { - let pattern = ""; - - /* - * A space or an exception pattern sequence. - * [] ==> "\s" - * ["-"] ==> "(?:\s|\-+$)" - * ["-", "="] ==> "(?:\s|(?:\-+|=+)$)" - * ["-", "=", "--=="] ==> "(?:\s|(?:\-+|=+|(?:\-\-==)+)$)" ==> https://jex.im/regulex/#!embed=false&flags=&re=(%3F%3A%5Cs%7C(%3F%3A%5C-%2B%7C%3D%2B%7C(%3F%3A%5C-%5C-%3D%3D)%2B)%24) - */ - if (exceptions.length === 0) { - - // a space. - pattern += "\\s"; - } else { - - // a space or... - pattern += "(?:\\s|"; - - if (exceptions.length === 1) { - - // a sequence of the exception pattern. - pattern += escapeAndRepeat(exceptions[0]); - } else { - - // a sequence of one of the exception patterns. - pattern += "(?:"; - pattern += exceptions.map(escapeAndRepeat).join("|"); - pattern += ")"; - } - pattern += `(?:$|[${Array.from(astUtils.LINEBREAKS).join("")}]))`; - } - - return pattern; -} - -/** - * Creates RegExp object for `always` mode. - * Generated pattern for beginning of comment: - * - * 1. First, a marker or nothing. - * 2. Next, a space or an exception pattern sequence. - * @param {string[]} markers A marker list. - * @param {string[]} exceptions An exception pattern list. - * @returns {RegExp} A RegExp object for the beginning of a comment in `always` mode. - */ -function createAlwaysStylePattern(markers, exceptions) { - let pattern = "^"; - - /* - * A marker or nothing. - * ["*"] ==> "\*?" - * ["*", "!"] ==> "(?:\*|!)?" - * ["*", "/", "!<"] ==> "(?:\*|\/|(?:!<))?" ==> https://jex.im/regulex/#!embed=false&flags=&re=(%3F%3A%5C*%7C%5C%2F%7C(%3F%3A!%3C))%3F - */ - if (markers.length === 1) { - - // the marker. - pattern += escape(markers[0]); - } else { - - // one of markers. - pattern += "(?:"; - pattern += markers.map(escape).join("|"); - pattern += ")"; - } - - pattern += "?"; // or nothing. - pattern += createExceptionsPattern(exceptions); - - return new RegExp(pattern, "u"); -} - -/** - * Creates RegExp object for `never` mode. - * Generated pattern for beginning of comment: - * - * 1. First, a marker or nothing (captured). - * 2. Next, a space or a tab. - * @param {string[]} markers A marker list. - * @returns {RegExp} A RegExp object for `never` mode. - */ -function createNeverStylePattern(markers) { - const pattern = `^(${markers.map(escape).join("|")})?[ \t]+`; - - return new RegExp(pattern, "u"); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce consistent spacing after the `//` or `/*` in a comment", - recommended: false, - url: "https://eslint.org/docs/latest/rules/spaced-comment" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - exceptions: { - type: "array", - items: { - type: "string" - } - }, - markers: { - type: "array", - items: { - type: "string" - } - }, - line: { - type: "object", - properties: { - exceptions: { - type: "array", - items: { - type: "string" - } - }, - markers: { - type: "array", - items: { - type: "string" - } - } - }, - additionalProperties: false - }, - block: { - type: "object", - properties: { - exceptions: { - type: "array", - items: { - type: "string" - } - }, - markers: { - type: "array", - items: { - type: "string" - } - }, - balanced: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedSpaceAfterMarker: "Unexpected space or tab after marker ({{refChar}}) in comment.", - expectedExceptionAfter: "Expected exception block, space or tab after '{{refChar}}' in comment.", - unexpectedSpaceBefore: "Unexpected space or tab before '*/' in comment.", - unexpectedSpaceAfter: "Unexpected space or tab after '{{refChar}}' in comment.", - expectedSpaceBefore: "Expected space or tab before '*/' in comment.", - expectedSpaceAfter: "Expected space or tab after '{{refChar}}' in comment." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - // Unless the first option is never, require a space - const requireSpace = context.options[0] !== "never"; - - /* - * Parse the second options. - * If markers don't include `"*"`, it's added automatically for JSDoc - * comments. - */ - const config = context.options[1] || {}; - const balanced = config.block && config.block.balanced; - - const styleRules = ["block", "line"].reduce((rule, type) => { - const markers = parseMarkersOption(config[type] && config[type].markers || config.markers || []); - const exceptions = config[type] && config[type].exceptions || config.exceptions || []; - const endNeverPattern = "[ \t]+$"; - - // Create RegExp object for valid patterns. - rule[type] = { - beginRegex: requireSpace ? createAlwaysStylePattern(markers, exceptions) : createNeverStylePattern(markers), - endRegex: balanced && requireSpace ? new RegExp(`${createExceptionsPattern(exceptions)}$`, "u") : new RegExp(endNeverPattern, "u"), - hasExceptions: exceptions.length > 0, - captureMarker: new RegExp(`^(${markers.map(escape).join("|")})`, "u"), - markers: new Set(markers) - }; - - return rule; - }, {}); - - /** - * Reports a beginning spacing error with an appropriate message. - * @param {ASTNode} node A comment node to check. - * @param {string} messageId An error message to report. - * @param {Array} match An array of match results for markers. - * @param {string} refChar Character used for reference in the error message. - * @returns {void} - */ - function reportBegin(node, messageId, match, refChar) { - const type = node.type.toLowerCase(), - commentIdentifier = type === "block" ? "/*" : "//"; - - context.report({ - node, - fix(fixer) { - const start = node.range[0]; - let end = start + 2; - - if (requireSpace) { - if (match) { - end += match[0].length; - } - return fixer.insertTextAfterRange([start, end], " "); - } - end += match[0].length; - return fixer.replaceTextRange([start, end], commentIdentifier + (match[1] ? match[1] : "")); - - }, - messageId, - data: { refChar } - }); - } - - /** - * Reports an ending spacing error with an appropriate message. - * @param {ASTNode} node A comment node to check. - * @param {string} messageId An error message to report. - * @param {string} match An array of the matched whitespace characters. - * @returns {void} - */ - function reportEnd(node, messageId, match) { - context.report({ - node, - fix(fixer) { - if (requireSpace) { - return fixer.insertTextAfterRange([node.range[0], node.range[1] - 2], " "); - } - const end = node.range[1] - 2, - start = end - match[0].length; - - return fixer.replaceTextRange([start, end], ""); - - }, - messageId - }); - } - - /** - * Reports a given comment if it's invalid. - * @param {ASTNode} node a comment node to check. - * @returns {void} - */ - function checkCommentForSpace(node) { - const type = node.type.toLowerCase(), - rule = styleRules[type], - commentIdentifier = type === "block" ? "/*" : "//"; - - // Ignores empty comments and comments that consist only of a marker. - if (node.value.length === 0 || rule.markers.has(node.value)) { - return; - } - - const beginMatch = rule.beginRegex.exec(node.value); - const endMatch = rule.endRegex.exec(node.value); - - // Checks. - if (requireSpace) { - if (!beginMatch) { - const hasMarker = rule.captureMarker.exec(node.value); - const marker = hasMarker ? commentIdentifier + hasMarker[0] : commentIdentifier; - - if (rule.hasExceptions) { - reportBegin(node, "expectedExceptionAfter", hasMarker, marker); - } else { - reportBegin(node, "expectedSpaceAfter", hasMarker, marker); - } - } - - if (balanced && type === "block" && !endMatch) { - reportEnd(node, "expectedSpaceBefore"); - } - } else { - if (beginMatch) { - if (!beginMatch[1]) { - reportBegin(node, "unexpectedSpaceAfter", beginMatch, commentIdentifier); - } else { - reportBegin(node, "unexpectedSpaceAfterMarker", beginMatch, beginMatch[1]); - } - } - - if (balanced && type === "block" && endMatch) { - reportEnd(node, "unexpectedSpaceBefore", endMatch); - } - } - } - - return { - Program() { - const comments = sourceCode.getAllComments(); - - comments.filter(token => token.type !== "Shebang").forEach(checkCommentForSpace); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/strict.js b/node_modules/eslint/lib/rules/strict.js deleted file mode 100644 index f9dd7500b..000000000 --- a/node_modules/eslint/lib/rules/strict.js +++ /dev/null @@ -1,277 +0,0 @@ -/** - * @fileoverview Rule to control usage of strict mode directives. - * @author Brandon Mills - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Gets all of the Use Strict Directives in the Directive Prologue of a group of - * statements. - * @param {ASTNode[]} statements Statements in the program or function body. - * @returns {ASTNode[]} All of the Use Strict Directives. - */ -function getUseStrictDirectives(statements) { - const directives = []; - - for (let i = 0; i < statements.length; i++) { - const statement = statements[i]; - - if ( - statement.type === "ExpressionStatement" && - statement.expression.type === "Literal" && - statement.expression.value === "use strict" - ) { - directives[i] = statement; - } else { - break; - } - } - - return directives; -} - -/** - * Checks whether a given parameter is a simple parameter. - * @param {ASTNode} node A pattern node to check. - * @returns {boolean} `true` if the node is an Identifier node. - */ -function isSimpleParameter(node) { - return node.type === "Identifier"; -} - -/** - * Checks whether a given parameter list is a simple parameter list. - * @param {ASTNode[]} params A parameter list to check. - * @returns {boolean} `true` if the every parameter is an Identifier node. - */ -function isSimpleParameterList(params) { - return params.every(isSimpleParameter); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require or disallow strict mode directives", - recommended: false, - url: "https://eslint.org/docs/latest/rules/strict" - }, - - schema: [ - { - enum: ["never", "global", "function", "safe"] - } - ], - - fixable: "code", - messages: { - function: "Use the function form of 'use strict'.", - global: "Use the global form of 'use strict'.", - multiple: "Multiple 'use strict' directives.", - never: "Strict mode is not permitted.", - unnecessary: "Unnecessary 'use strict' directive.", - module: "'use strict' is unnecessary inside of modules.", - implied: "'use strict' is unnecessary when implied strict mode is enabled.", - unnecessaryInClasses: "'use strict' is unnecessary inside of classes.", - nonSimpleParameterList: "'use strict' directive inside a function with non-simple parameter list throws a syntax error since ES2016.", - wrap: "Wrap {{name}} in a function with 'use strict' directive." - } - }, - - create(context) { - - const ecmaFeatures = context.parserOptions.ecmaFeatures || {}, - scopes = [], - classScopes = []; - let mode = context.options[0] || "safe"; - - if (ecmaFeatures.impliedStrict) { - mode = "implied"; - } else if (mode === "safe") { - mode = ecmaFeatures.globalReturn || context.languageOptions.sourceType === "commonjs" ? "global" : "function"; - } - - /** - * Determines whether a reported error should be fixed, depending on the error type. - * @param {string} errorType The type of error - * @returns {boolean} `true` if the reported error should be fixed - */ - function shouldFix(errorType) { - return errorType === "multiple" || errorType === "unnecessary" || errorType === "module" || errorType === "implied" || errorType === "unnecessaryInClasses"; - } - - /** - * Gets a fixer function to remove a given 'use strict' directive. - * @param {ASTNode} node The directive that should be removed - * @returns {Function} A fixer function - */ - function getFixFunction(node) { - return fixer => fixer.remove(node); - } - - /** - * Report a slice of an array of nodes with a given message. - * @param {ASTNode[]} nodes Nodes. - * @param {string} start Index to start from. - * @param {string} end Index to end before. - * @param {string} messageId Message to display. - * @param {boolean} fix `true` if the directive should be fixed (i.e. removed) - * @returns {void} - */ - function reportSlice(nodes, start, end, messageId, fix) { - nodes.slice(start, end).forEach(node => { - context.report({ node, messageId, fix: fix ? getFixFunction(node) : null }); - }); - } - - /** - * Report all nodes in an array with a given message. - * @param {ASTNode[]} nodes Nodes. - * @param {string} messageId Message id to display. - * @param {boolean} fix `true` if the directive should be fixed (i.e. removed) - * @returns {void} - */ - function reportAll(nodes, messageId, fix) { - reportSlice(nodes, 0, nodes.length, messageId, fix); - } - - /** - * Report all nodes in an array, except the first, with a given message. - * @param {ASTNode[]} nodes Nodes. - * @param {string} messageId Message id to display. - * @param {boolean} fix `true` if the directive should be fixed (i.e. removed) - * @returns {void} - */ - function reportAllExceptFirst(nodes, messageId, fix) { - reportSlice(nodes, 1, nodes.length, messageId, fix); - } - - /** - * Entering a function in 'function' mode pushes a new nested scope onto the - * stack. The new scope is true if the nested function is strict mode code. - * @param {ASTNode} node The function declaration or expression. - * @param {ASTNode[]} useStrictDirectives The Use Strict Directives of the node. - * @returns {void} - */ - function enterFunctionInFunctionMode(node, useStrictDirectives) { - const isInClass = classScopes.length > 0, - isParentGlobal = scopes.length === 0 && classScopes.length === 0, - isParentStrict = scopes.length > 0 && scopes[scopes.length - 1], - isStrict = useStrictDirectives.length > 0; - - if (isStrict) { - if (!isSimpleParameterList(node.params)) { - context.report({ node: useStrictDirectives[0], messageId: "nonSimpleParameterList" }); - } else if (isParentStrict) { - context.report({ node: useStrictDirectives[0], messageId: "unnecessary", fix: getFixFunction(useStrictDirectives[0]) }); - } else if (isInClass) { - context.report({ node: useStrictDirectives[0], messageId: "unnecessaryInClasses", fix: getFixFunction(useStrictDirectives[0]) }); - } - - reportAllExceptFirst(useStrictDirectives, "multiple", true); - } else if (isParentGlobal) { - if (isSimpleParameterList(node.params)) { - context.report({ node, messageId: "function" }); - } else { - context.report({ - node, - messageId: "wrap", - data: { name: astUtils.getFunctionNameWithKind(node) } - }); - } - } - - scopes.push(isParentStrict || isStrict); - } - - /** - * Exiting a function in 'function' mode pops its scope off the stack. - * @returns {void} - */ - function exitFunctionInFunctionMode() { - scopes.pop(); - } - - /** - * Enter a function and either: - * - Push a new nested scope onto the stack (in 'function' mode). - * - Report all the Use Strict Directives (in the other modes). - * @param {ASTNode} node The function declaration or expression. - * @returns {void} - */ - function enterFunction(node) { - const isBlock = node.body.type === "BlockStatement", - useStrictDirectives = isBlock - ? getUseStrictDirectives(node.body.body) : []; - - if (mode === "function") { - enterFunctionInFunctionMode(node, useStrictDirectives); - } else if (useStrictDirectives.length > 0) { - if (isSimpleParameterList(node.params)) { - reportAll(useStrictDirectives, mode, shouldFix(mode)); - } else { - context.report({ node: useStrictDirectives[0], messageId: "nonSimpleParameterList" }); - reportAllExceptFirst(useStrictDirectives, "multiple", true); - } - } - } - - const rule = { - Program(node) { - const useStrictDirectives = getUseStrictDirectives(node.body); - - if (node.sourceType === "module") { - mode = "module"; - } - - if (mode === "global") { - if (node.body.length > 0 && useStrictDirectives.length === 0) { - context.report({ node, messageId: "global" }); - } - reportAllExceptFirst(useStrictDirectives, "multiple", true); - } else { - reportAll(useStrictDirectives, mode, shouldFix(mode)); - } - }, - FunctionDeclaration: enterFunction, - FunctionExpression: enterFunction, - ArrowFunctionExpression: enterFunction - }; - - if (mode === "function") { - Object.assign(rule, { - - // Inside of class bodies are always strict mode. - ClassBody() { - classScopes.push(true); - }, - "ClassBody:exit"() { - classScopes.pop(); - }, - - "FunctionDeclaration:exit": exitFunctionInFunctionMode, - "FunctionExpression:exit": exitFunctionInFunctionMode, - "ArrowFunctionExpression:exit": exitFunctionInFunctionMode - }); - } - - return rule; - } -}; diff --git a/node_modules/eslint/lib/rules/switch-colon-spacing.js b/node_modules/eslint/lib/rules/switch-colon-spacing.js deleted file mode 100644 index 45e401822..000000000 --- a/node_modules/eslint/lib/rules/switch-colon-spacing.js +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @fileoverview Rule to enforce spacing around colons of switch statements. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce spacing around colons of switch statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/switch-colon-spacing" - }, - - schema: [ - { - type: "object", - properties: { - before: { type: "boolean", default: false }, - after: { type: "boolean", default: true } - }, - additionalProperties: false - } - ], - fixable: "whitespace", - messages: { - expectedBefore: "Expected space(s) before this colon.", - expectedAfter: "Expected space(s) after this colon.", - unexpectedBefore: "Unexpected space(s) before this colon.", - unexpectedAfter: "Unexpected space(s) after this colon." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const options = context.options[0] || {}; - const beforeSpacing = options.before === true; // false by default - const afterSpacing = options.after !== false; // true by default - - /** - * Check whether the spacing between the given 2 tokens is valid or not. - * @param {Token} left The left token to check. - * @param {Token} right The right token to check. - * @param {boolean} expected The expected spacing to check. `true` if there should be a space. - * @returns {boolean} `true` if the spacing between the tokens is valid. - */ - function isValidSpacing(left, right, expected) { - return ( - astUtils.isClosingBraceToken(right) || - !astUtils.isTokenOnSameLine(left, right) || - sourceCode.isSpaceBetweenTokens(left, right) === expected - ); - } - - /** - * Check whether comments exist between the given 2 tokens. - * @param {Token} left The left token to check. - * @param {Token} right The right token to check. - * @returns {boolean} `true` if comments exist between the given 2 tokens. - */ - function commentsExistBetween(left, right) { - return sourceCode.getFirstTokenBetween( - left, - right, - { - includeComments: true, - filter: astUtils.isCommentToken - } - ) !== null; - } - - /** - * Fix the spacing between the given 2 tokens. - * @param {RuleFixer} fixer The fixer to fix. - * @param {Token} left The left token of fix range. - * @param {Token} right The right token of fix range. - * @param {boolean} spacing The spacing style. `true` if there should be a space. - * @returns {Fix|null} The fix object. - */ - function fix(fixer, left, right, spacing) { - if (commentsExistBetween(left, right)) { - return null; - } - if (spacing) { - return fixer.insertTextAfter(left, " "); - } - return fixer.removeRange([left.range[1], right.range[0]]); - } - - return { - SwitchCase(node) { - const colonToken = astUtils.getSwitchCaseColonToken(node, sourceCode); - const beforeToken = sourceCode.getTokenBefore(colonToken); - const afterToken = sourceCode.getTokenAfter(colonToken); - - if (!isValidSpacing(beforeToken, colonToken, beforeSpacing)) { - context.report({ - node, - loc: colonToken.loc, - messageId: beforeSpacing ? "expectedBefore" : "unexpectedBefore", - fix: fixer => fix(fixer, beforeToken, colonToken, beforeSpacing) - }); - } - if (!isValidSpacing(colonToken, afterToken, afterSpacing)) { - context.report({ - node, - loc: colonToken.loc, - messageId: afterSpacing ? "expectedAfter" : "unexpectedAfter", - fix: fixer => fix(fixer, colonToken, afterToken, afterSpacing) - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/symbol-description.js b/node_modules/eslint/lib/rules/symbol-description.js deleted file mode 100644 index 4528f09cf..000000000 --- a/node_modules/eslint/lib/rules/symbol-description.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @fileoverview Rule to enforce description with the `Symbol` object - * @author Jarek Rencz - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require symbol descriptions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/symbol-description" - }, - fixable: null, - schema: [], - messages: { - expected: "Expected Symbol to have a description." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Reports if node does not conform the rule in case rule is set to - * report missing description - * @param {ASTNode} node A CallExpression node to check. - * @returns {void} - */ - function checkArgument(node) { - if (node.arguments.length === 0) { - context.report({ - node, - messageId: "expected" - }); - } - } - - return { - "Program:exit"(node) { - const scope = sourceCode.getScope(node); - const variable = astUtils.getVariableByName(scope, "Symbol"); - - if (variable && variable.defs.length === 0) { - variable.references.forEach(reference => { - const idNode = reference.identifier; - - if (astUtils.isCallee(idNode)) { - checkArgument(idNode.parent); - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/template-curly-spacing.js b/node_modules/eslint/lib/rules/template-curly-spacing.js deleted file mode 100644 index cc9bbe306..000000000 --- a/node_modules/eslint/lib/rules/template-curly-spacing.js +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @fileoverview Rule to enforce spacing around embedded expressions of template strings - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow spacing around embedded expressions of template strings", - recommended: false, - url: "https://eslint.org/docs/latest/rules/template-curly-spacing" - }, - - fixable: "whitespace", - - schema: [ - { enum: ["always", "never"] } - ], - messages: { - expectedBefore: "Expected space(s) before '}'.", - expectedAfter: "Expected space(s) after '${'.", - unexpectedBefore: "Unexpected space(s) before '}'.", - unexpectedAfter: "Unexpected space(s) after '${'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const always = context.options[0] === "always"; - - /** - * Checks spacing before `}` of a given token. - * @param {Token} token A token to check. This is a Template token. - * @returns {void} - */ - function checkSpacingBefore(token) { - if (!token.value.startsWith("}")) { - return; // starts with a backtick, this is the first template element in the template literal - } - - const prevToken = sourceCode.getTokenBefore(token, { includeComments: true }), - hasSpace = sourceCode.isSpaceBetween(prevToken, token); - - if (!astUtils.isTokenOnSameLine(prevToken, token)) { - return; - } - - if (always && !hasSpace) { - context.report({ - loc: { - start: token.loc.start, - end: { - line: token.loc.start.line, - column: token.loc.start.column + 1 - } - }, - messageId: "expectedBefore", - fix: fixer => fixer.insertTextBefore(token, " ") - }); - } - - if (!always && hasSpace) { - context.report({ - loc: { - start: prevToken.loc.end, - end: token.loc.start - }, - messageId: "unexpectedBefore", - fix: fixer => fixer.removeRange([prevToken.range[1], token.range[0]]) - }); - } - } - - /** - * Checks spacing after `${` of a given token. - * @param {Token} token A token to check. This is a Template token. - * @returns {void} - */ - function checkSpacingAfter(token) { - if (!token.value.endsWith("${")) { - return; // ends with a backtick, this is the last template element in the template literal - } - - const nextToken = sourceCode.getTokenAfter(token, { includeComments: true }), - hasSpace = sourceCode.isSpaceBetween(token, nextToken); - - if (!astUtils.isTokenOnSameLine(token, nextToken)) { - return; - } - - if (always && !hasSpace) { - context.report({ - loc: { - start: { - line: token.loc.end.line, - column: token.loc.end.column - 2 - }, - end: token.loc.end - }, - messageId: "expectedAfter", - fix: fixer => fixer.insertTextAfter(token, " ") - }); - } - - if (!always && hasSpace) { - context.report({ - loc: { - start: token.loc.end, - end: nextToken.loc.start - }, - messageId: "unexpectedAfter", - fix: fixer => fixer.removeRange([token.range[1], nextToken.range[0]]) - }); - } - } - - return { - TemplateElement(node) { - const token = sourceCode.getFirstToken(node); - - checkSpacingBefore(token); - checkSpacingAfter(token); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/template-tag-spacing.js b/node_modules/eslint/lib/rules/template-tag-spacing.js deleted file mode 100644 index 9bfdfc228..000000000 --- a/node_modules/eslint/lib/rules/template-tag-spacing.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @fileoverview Rule to check spacing between template tags and their literals - * @author Jonathan Wilsson - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow spacing between template tags and their literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/template-tag-spacing" - }, - - fixable: "whitespace", - - schema: [ - { enum: ["always", "never"] } - ], - messages: { - unexpected: "Unexpected space between template tag and template literal.", - missing: "Missing space between template tag and template literal." - } - }, - - create(context) { - const never = context.options[0] !== "always"; - const sourceCode = context.sourceCode; - - /** - * Check if a space is present between a template tag and its literal - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function checkSpacing(node) { - const tagToken = sourceCode.getTokenBefore(node.quasi); - const literalToken = sourceCode.getFirstToken(node.quasi); - const hasWhitespace = sourceCode.isSpaceBetweenTokens(tagToken, literalToken); - - if (never && hasWhitespace) { - context.report({ - node, - loc: { - start: tagToken.loc.end, - end: literalToken.loc.start - }, - messageId: "unexpected", - fix(fixer) { - const comments = sourceCode.getCommentsBefore(node.quasi); - - // Don't fix anything if there's a single line comment after the template tag - if (comments.some(comment => comment.type === "Line")) { - return null; - } - - return fixer.replaceTextRange( - [tagToken.range[1], literalToken.range[0]], - comments.reduce((text, comment) => text + sourceCode.getText(comment), "") - ); - } - }); - } else if (!never && !hasWhitespace) { - context.report({ - node, - loc: { - start: node.loc.start, - end: literalToken.loc.start - }, - messageId: "missing", - fix(fixer) { - return fixer.insertTextAfter(tagToken, " "); - } - }); - } - } - - return { - TaggedTemplateExpression: checkSpacing - }; - } -}; diff --git a/node_modules/eslint/lib/rules/unicode-bom.js b/node_modules/eslint/lib/rules/unicode-bom.js deleted file mode 100644 index 09971d26e..000000000 --- a/node_modules/eslint/lib/rules/unicode-bom.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @fileoverview Require or disallow Unicode BOM - * @author Andrew Johnston - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow Unicode byte order mark (BOM)", - recommended: false, - url: "https://eslint.org/docs/latest/rules/unicode-bom" - }, - - fixable: "whitespace", - - schema: [ - { - enum: ["always", "never"] - } - ], - messages: { - expected: "Expected Unicode BOM (Byte Order Mark).", - unexpected: "Unexpected Unicode BOM (Byte Order Mark)." - } - }, - - create(context) { - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - Program: function checkUnicodeBOM(node) { - - const sourceCode = context.sourceCode, - location = { column: 0, line: 1 }, - requireBOM = context.options[0] || "never"; - - if (!sourceCode.hasBOM && (requireBOM === "always")) { - context.report({ - node, - loc: location, - messageId: "expected", - fix(fixer) { - return fixer.insertTextBeforeRange([0, 1], "\uFEFF"); - } - }); - } else if (sourceCode.hasBOM && (requireBOM === "never")) { - context.report({ - node, - loc: location, - messageId: "unexpected", - fix(fixer) { - return fixer.removeRange([-1, 0]); - } - }); - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/use-isnan.js b/node_modules/eslint/lib/rules/use-isnan.js deleted file mode 100644 index 21dc39529..000000000 --- a/node_modules/eslint/lib/rules/use-isnan.js +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @fileoverview Rule to flag comparisons to the value NaN - * @author James Allardice - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines if the given node is a NaN `Identifier` node. - * @param {ASTNode|null} node The node to check. - * @returns {boolean} `true` if the node is 'NaN' identifier. - */ -function isNaNIdentifier(node) { - return Boolean(node) && ( - astUtils.isSpecificId(node, "NaN") || - astUtils.isSpecificMemberAccess(node, "Number", "NaN") - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Require calls to `isNaN()` when checking for `NaN`", - recommended: true, - url: "https://eslint.org/docs/latest/rules/use-isnan" - }, - - schema: [ - { - type: "object", - properties: { - enforceForSwitchCase: { - type: "boolean", - default: true - }, - enforceForIndexOf: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - comparisonWithNaN: "Use the isNaN function to compare with NaN.", - switchNaN: "'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch.", - caseNaN: "'case NaN' can never match. Use Number.isNaN before the switch.", - indexOfNaN: "Array prototype method '{{ methodName }}' cannot find NaN." - } - }, - - create(context) { - - const enforceForSwitchCase = !context.options[0] || context.options[0].enforceForSwitchCase; - const enforceForIndexOf = context.options[0] && context.options[0].enforceForIndexOf; - - /** - * Checks the given `BinaryExpression` node for `foo === NaN` and other comparisons. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkBinaryExpression(node) { - if ( - /^(?:[<>]|[!=]=)=?$/u.test(node.operator) && - (isNaNIdentifier(node.left) || isNaNIdentifier(node.right)) - ) { - context.report({ node, messageId: "comparisonWithNaN" }); - } - } - - /** - * Checks the discriminant and all case clauses of the given `SwitchStatement` node for `switch(NaN)` and `case NaN:` - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkSwitchStatement(node) { - if (isNaNIdentifier(node.discriminant)) { - context.report({ node, messageId: "switchNaN" }); - } - - for (const switchCase of node.cases) { - if (isNaNIdentifier(switchCase.test)) { - context.report({ node: switchCase, messageId: "caseNaN" }); - } - } - } - - /** - * Checks the given `CallExpression` node for `.indexOf(NaN)` and `.lastIndexOf(NaN)`. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkCallExpression(node) { - const callee = astUtils.skipChainExpression(node.callee); - - if (callee.type === "MemberExpression") { - const methodName = astUtils.getStaticPropertyName(callee); - - if ( - (methodName === "indexOf" || methodName === "lastIndexOf") && - node.arguments.length === 1 && - isNaNIdentifier(node.arguments[0]) - ) { - context.report({ node, messageId: "indexOfNaN", data: { methodName } }); - } - } - } - - const listeners = { - BinaryExpression: checkBinaryExpression - }; - - if (enforceForSwitchCase) { - listeners.SwitchStatement = checkSwitchStatement; - } - - if (enforceForIndexOf) { - listeners.CallExpression = checkCallExpression; - } - - return listeners; - } -}; diff --git a/node_modules/eslint/lib/rules/utils/ast-utils.js b/node_modules/eslint/lib/rules/utils/ast-utils.js deleted file mode 100644 index f4a18cff7..000000000 --- a/node_modules/eslint/lib/rules/utils/ast-utils.js +++ /dev/null @@ -1,2124 +0,0 @@ -/** - * @fileoverview Common utils for AST. - * @author Gyandeep Singh - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const esutils = require("esutils"); -const espree = require("espree"); -const escapeRegExp = require("escape-string-regexp"); -const { - breakableTypePattern, - createGlobalLinebreakMatcher, - lineBreakPattern, - shebangPattern -} = require("../../shared/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u; -const anyLoopPattern = /^(?:DoWhile|For|ForIn|ForOf|While)Statement$/u; -const arrayOrTypedArrayPattern = /Array$/u; -const arrayMethodPattern = /^(?:every|filter|find|findIndex|forEach|map|some)$/u; -const bindOrCallOrApplyPattern = /^(?:bind|call|apply)$/u; -const thisTagPattern = /^[\s*]*@this/mu; - - -const COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|globals?\s+|exported\s+|jscs)/u; -const ESLINT_DIRECTIVE_PATTERN = /^(?:eslint[- ]|(?:globals?|exported) )/u; -const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]); - -// A set of node types that can contain a list of statements -const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "StaticBlock", "SwitchCase"]); - -const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u; - -// Tests the presence of at least one LegacyOctalEscapeSequence or NonOctalDecimalEscapeSequence in a raw string -const OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN = /^(?:[^\\]|\\.)*\\(?:[1-9]|0[0-9])/su; - -const LOGICAL_ASSIGNMENT_OPERATORS = new Set(["&&=", "||=", "??="]); - -/** - * Checks reference if is non initializer and writable. - * @param {Reference} reference A reference to check. - * @param {int} index The index of the reference in the references. - * @param {Reference[]} references The array that the reference belongs to. - * @returns {boolean} Success/Failure - * @private - */ -function isModifyingReference(reference, index, references) { - const identifier = reference.identifier; - - /* - * Destructuring assignments can have multiple default value, so - * possibly there are multiple writeable references for the same - * identifier. - */ - const modifyingDifferentIdentifier = index === 0 || - references[index - 1].identifier !== identifier; - - return (identifier && - reference.init === false && - reference.isWrite() && - modifyingDifferentIdentifier - ); -} - -/** - * Checks whether the given string starts with uppercase or not. - * @param {string} s The string to check. - * @returns {boolean} `true` if the string starts with uppercase. - */ -function startsWithUpperCase(s) { - return s[0] !== s[0].toLocaleLowerCase(); -} - -/** - * Checks whether or not a node is a constructor. - * @param {ASTNode} node A function node to check. - * @returns {boolean} Whether or not a node is a constructor. - */ -function isES5Constructor(node) { - return (node.id && startsWithUpperCase(node.id.name)); -} - -/** - * Finds a function node from ancestors of a node. - * @param {ASTNode} node A start node to find. - * @returns {Node|null} A found function node. - */ -function getUpperFunction(node) { - for (let currentNode = node; currentNode; currentNode = currentNode.parent) { - if (anyFunctionPattern.test(currentNode.type)) { - return currentNode; - } - } - return null; -} - -/** - * Checks whether a given node is a function node or not. - * The following types are function nodes: - * - * - ArrowFunctionExpression - * - FunctionDeclaration - * - FunctionExpression - * @param {ASTNode|null} node A node to check. - * @returns {boolean} `true` if the node is a function node. - */ -function isFunction(node) { - return Boolean(node && anyFunctionPattern.test(node.type)); -} - -/** - * Checks whether a given node is a loop node or not. - * The following types are loop nodes: - * - * - DoWhileStatement - * - ForInStatement - * - ForOfStatement - * - ForStatement - * - WhileStatement - * @param {ASTNode|null} node A node to check. - * @returns {boolean} `true` if the node is a loop node. - */ -function isLoop(node) { - return Boolean(node && anyLoopPattern.test(node.type)); -} - -/** - * Checks whether the given node is in a loop or not. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is in a loop. - */ -function isInLoop(node) { - for (let currentNode = node; currentNode && !isFunction(currentNode); currentNode = currentNode.parent) { - if (isLoop(currentNode)) { - return true; - } - } - - return false; -} - -/** - * Determines whether the given node is a `null` literal. - * @param {ASTNode} node The node to check - * @returns {boolean} `true` if the node is a `null` literal - */ -function isNullLiteral(node) { - - /* - * Checking `node.value === null` does not guarantee that a literal is a null literal. - * When parsing values that cannot be represented in the current environment (e.g. unicode - * regexes in Node 4), `node.value` is set to `null` because it wouldn't be possible to - * set `node.value` to a unicode regex. To make sure a literal is actually `null`, check - * `node.regex` instead. Also see: https://github.com/eslint/eslint/issues/8020 - */ - return node.type === "Literal" && node.value === null && !node.regex && !node.bigint; -} - -/** - * Checks whether or not a node is `null` or `undefined`. - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is a `null` or `undefined`. - * @public - */ -function isNullOrUndefined(node) { - return ( - isNullLiteral(node) || - (node.type === "Identifier" && node.name === "undefined") || - (node.type === "UnaryExpression" && node.operator === "void") - ); -} - -/** - * Checks whether or not a node is callee. - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is callee. - */ -function isCallee(node) { - return node.parent.type === "CallExpression" && node.parent.callee === node; -} - -/** - * Returns the result of the string conversion applied to the evaluated value of the given expression node, - * if it can be determined statically. - * - * This function returns a `string` value for all `Literal` nodes and simple `TemplateLiteral` nodes only. - * In all other cases, this function returns `null`. - * @param {ASTNode} node Expression node. - * @returns {string|null} String value if it can be determined. Otherwise, `null`. - */ -function getStaticStringValue(node) { - switch (node.type) { - case "Literal": - if (node.value === null) { - if (isNullLiteral(node)) { - return String(node.value); // "null" - } - if (node.regex) { - return `/${node.regex.pattern}/${node.regex.flags}`; - } - if (node.bigint) { - return node.bigint; - } - - // Otherwise, this is an unknown literal. The function will return null. - - } else { - return String(node.value); - } - break; - case "TemplateLiteral": - if (node.expressions.length === 0 && node.quasis.length === 1) { - return node.quasis[0].value.cooked; - } - break; - - // no default - } - - return null; -} - -/** - * Gets the property name of a given node. - * The node can be a MemberExpression, a Property, or a MethodDefinition. - * - * If the name is dynamic, this returns `null`. - * - * For examples: - * - * a.b // => "b" - * a["b"] // => "b" - * a['b'] // => "b" - * a[`b`] // => "b" - * a[100] // => "100" - * a[b] // => null - * a["a" + "b"] // => null - * a[tag`b`] // => null - * a[`${b}`] // => null - * - * let a = {b: 1} // => "b" - * let a = {["b"]: 1} // => "b" - * let a = {['b']: 1} // => "b" - * let a = {[`b`]: 1} // => "b" - * let a = {[100]: 1} // => "100" - * let a = {[b]: 1} // => null - * let a = {["a" + "b"]: 1} // => null - * let a = {[tag`b`]: 1} // => null - * let a = {[`${b}`]: 1} // => null - * @param {ASTNode} node The node to get. - * @returns {string|null} The property name if static. Otherwise, null. - */ -function getStaticPropertyName(node) { - let prop; - - switch (node && node.type) { - case "ChainExpression": - return getStaticPropertyName(node.expression); - - case "Property": - case "PropertyDefinition": - case "MethodDefinition": - prop = node.key; - break; - - case "MemberExpression": - prop = node.property; - break; - - // no default - } - - if (prop) { - if (prop.type === "Identifier" && !node.computed) { - return prop.name; - } - - return getStaticStringValue(prop); - } - - return null; -} - -/** - * Retrieve `ChainExpression#expression` value if the given node a `ChainExpression` node. Otherwise, pass through it. - * @param {ASTNode} node The node to address. - * @returns {ASTNode} The `ChainExpression#expression` value if the node is a `ChainExpression` node. Otherwise, the node. - */ -function skipChainExpression(node) { - return node && node.type === "ChainExpression" ? node.expression : node; -} - -/** - * Check if the `actual` is an expected value. - * @param {string} actual The string value to check. - * @param {string | RegExp} expected The expected string value or pattern. - * @returns {boolean} `true` if the `actual` is an expected value. - */ -function checkText(actual, expected) { - return typeof expected === "string" - ? actual === expected - : expected.test(actual); -} - -/** - * Check if a given node is an Identifier node with a given name. - * @param {ASTNode} node The node to check. - * @param {string | RegExp} name The expected name or the expected pattern of the object name. - * @returns {boolean} `true` if the node is an Identifier node with the name. - */ -function isSpecificId(node, name) { - return node.type === "Identifier" && checkText(node.name, name); -} - -/** - * Check if a given node is member access with a given object name and property name pair. - * This is regardless of optional or not. - * @param {ASTNode} node The node to check. - * @param {string | RegExp | null} objectName The expected name or the expected pattern of the object name. If this is nullish, this method doesn't check object. - * @param {string | RegExp | null} propertyName The expected name or the expected pattern of the property name. If this is nullish, this method doesn't check property. - * @returns {boolean} `true` if the node is member access with the object name and property name pair. - * The node is a `MemberExpression` or `ChainExpression`. - */ -function isSpecificMemberAccess(node, objectName, propertyName) { - const checkNode = skipChainExpression(node); - - if (checkNode.type !== "MemberExpression") { - return false; - } - - if (objectName && !isSpecificId(checkNode.object, objectName)) { - return false; - } - - if (propertyName) { - const actualPropertyName = getStaticPropertyName(checkNode); - - if (typeof actualPropertyName !== "string" || !checkText(actualPropertyName, propertyName)) { - return false; - } - } - - return true; -} - -/** - * Check if two literal nodes are the same value. - * @param {ASTNode} left The Literal node to compare. - * @param {ASTNode} right The other Literal node to compare. - * @returns {boolean} `true` if the two literal nodes are the same value. - */ -function equalLiteralValue(left, right) { - - // RegExp literal. - if (left.regex || right.regex) { - return Boolean( - left.regex && - right.regex && - left.regex.pattern === right.regex.pattern && - left.regex.flags === right.regex.flags - ); - } - - // BigInt literal. - if (left.bigint || right.bigint) { - return left.bigint === right.bigint; - } - - return left.value === right.value; -} - -/** - * Check if two expressions reference the same value. For example: - * a = a - * a.b = a.b - * a[0] = a[0] - * a['b'] = a['b'] - * @param {ASTNode} left The left side of the comparison. - * @param {ASTNode} right The right side of the comparison. - * @param {boolean} [disableStaticComputedKey] Don't address `a.b` and `a["b"]` are the same if `true`. For backward compatibility. - * @returns {boolean} `true` if both sides match and reference the same value. - */ -function isSameReference(left, right, disableStaticComputedKey = false) { - if (left.type !== right.type) { - - // Handle `a.b` and `a?.b` are samely. - if (left.type === "ChainExpression") { - return isSameReference(left.expression, right, disableStaticComputedKey); - } - if (right.type === "ChainExpression") { - return isSameReference(left, right.expression, disableStaticComputedKey); - } - - return false; - } - - switch (left.type) { - case "Super": - case "ThisExpression": - return true; - - case "Identifier": - case "PrivateIdentifier": - return left.name === right.name; - case "Literal": - return equalLiteralValue(left, right); - - case "ChainExpression": - return isSameReference(left.expression, right.expression, disableStaticComputedKey); - - case "MemberExpression": { - if (!disableStaticComputedKey) { - const nameA = getStaticPropertyName(left); - - // x.y = x["y"] - if (nameA !== null) { - return ( - isSameReference(left.object, right.object, disableStaticComputedKey) && - nameA === getStaticPropertyName(right) - ); - } - } - - /* - * x[0] = x[0] - * x[y] = x[y] - * x.y = x.y - */ - return ( - left.computed === right.computed && - isSameReference(left.object, right.object, disableStaticComputedKey) && - isSameReference(left.property, right.property, disableStaticComputedKey) - ); - } - - default: - return false; - } -} - -/** - * Checks whether or not a node is `Reflect.apply`. - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is a `Reflect.apply`. - */ -function isReflectApply(node) { - return isSpecificMemberAccess(node, "Reflect", "apply"); -} - -/** - * Checks whether or not a node is `Array.from`. - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is a `Array.from`. - */ -function isArrayFromMethod(node) { - return isSpecificMemberAccess(node, arrayOrTypedArrayPattern, "from"); -} - -/** - * Checks whether or not a node is a method which has `thisArg`. - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is a method which has `thisArg`. - */ -function isMethodWhichHasThisArg(node) { - return isSpecificMemberAccess(node, null, arrayMethodPattern); -} - -/** - * Creates the negate function of the given function. - * @param {Function} f The function to negate. - * @returns {Function} Negated function. - */ -function negate(f) { - return token => !f(token); -} - -/** - * Checks whether or not a node has a `@this` tag in its comments. - * @param {ASTNode} node A node to check. - * @param {SourceCode} sourceCode A SourceCode instance to get comments. - * @returns {boolean} Whether or not the node has a `@this` tag in its comments. - */ -function hasJSDocThisTag(node, sourceCode) { - const jsdocComment = sourceCode.getJSDocComment(node); - - if (jsdocComment && thisTagPattern.test(jsdocComment.value)) { - return true; - } - - // Checks `@this` in its leading comments for callbacks, - // because callbacks don't have its JSDoc comment. - // e.g. - // sinon.test(/* @this sinon.Sandbox */function() { this.spy(); }); - return sourceCode.getCommentsBefore(node).some(comment => thisTagPattern.test(comment.value)); -} - -/** - * Determines if a node is surrounded by parentheses. - * @param {SourceCode} sourceCode The ESLint source code object - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is parenthesised. - * @private - */ -function isParenthesised(sourceCode, node) { - const previousToken = sourceCode.getTokenBefore(node), - nextToken = sourceCode.getTokenAfter(node); - - return Boolean(previousToken && nextToken) && - previousToken.value === "(" && previousToken.range[1] <= node.range[0] && - nextToken.value === ")" && nextToken.range[0] >= node.range[1]; -} - -/** - * Checks if the given token is a `=` token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a `=` token. - */ -function isEqToken(token) { - return token.value === "=" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is an arrow token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is an arrow token. - */ -function isArrowToken(token) { - return token.value === "=>" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is a comma token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a comma token. - */ -function isCommaToken(token) { - return token.value === "," && token.type === "Punctuator"; -} - -/** - * Checks if the given token is a dot token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a dot token. - */ -function isDotToken(token) { - return token.value === "." && token.type === "Punctuator"; -} - -/** - * Checks if the given token is a `?.` token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a `?.` token. - */ -function isQuestionDotToken(token) { - return token.value === "?." && token.type === "Punctuator"; -} - -/** - * Checks if the given token is a semicolon token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a semicolon token. - */ -function isSemicolonToken(token) { - return token.value === ";" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is a colon token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a colon token. - */ -function isColonToken(token) { - return token.value === ":" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is an opening parenthesis token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is an opening parenthesis token. - */ -function isOpeningParenToken(token) { - return token.value === "(" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is a closing parenthesis token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a closing parenthesis token. - */ -function isClosingParenToken(token) { - return token.value === ")" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is an opening square bracket token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is an opening square bracket token. - */ -function isOpeningBracketToken(token) { - return token.value === "[" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is a closing square bracket token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a closing square bracket token. - */ -function isClosingBracketToken(token) { - return token.value === "]" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is an opening brace token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is an opening brace token. - */ -function isOpeningBraceToken(token) { - return token.value === "{" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is a closing brace token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a closing brace token. - */ -function isClosingBraceToken(token) { - return token.value === "}" && token.type === "Punctuator"; -} - -/** - * Checks if the given token is a comment token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a comment token. - */ -function isCommentToken(token) { - return token.type === "Line" || token.type === "Block" || token.type === "Shebang"; -} - -/** - * Checks if the given token is a keyword token or not. - * @param {Token} token The token to check. - * @returns {boolean} `true` if the token is a keyword token. - */ -function isKeywordToken(token) { - return token.type === "Keyword"; -} - -/** - * Gets the `(` token of the given function node. - * @param {ASTNode} node The function node to get. - * @param {SourceCode} sourceCode The source code object to get tokens. - * @returns {Token} `(` token. - */ -function getOpeningParenOfParams(node, sourceCode) { - - // If the node is an arrow function and doesn't have parens, this returns the identifier of the first param. - if (node.type === "ArrowFunctionExpression" && node.params.length === 1) { - const argToken = sourceCode.getFirstToken(node.params[0]); - const maybeParenToken = sourceCode.getTokenBefore(argToken); - - return isOpeningParenToken(maybeParenToken) ? maybeParenToken : argToken; - } - - // Otherwise, returns paren. - return node.id - ? sourceCode.getTokenAfter(node.id, isOpeningParenToken) - : sourceCode.getFirstToken(node, isOpeningParenToken); -} - -/** - * Checks whether or not the tokens of two given nodes are same. - * @param {ASTNode} left A node 1 to compare. - * @param {ASTNode} right A node 2 to compare. - * @param {SourceCode} sourceCode The ESLint source code object. - * @returns {boolean} the source code for the given node. - */ -function equalTokens(left, right, sourceCode) { - const tokensL = sourceCode.getTokens(left); - const tokensR = sourceCode.getTokens(right); - - if (tokensL.length !== tokensR.length) { - return false; - } - for (let i = 0; i < tokensL.length; ++i) { - if (tokensL[i].type !== tokensR[i].type || - tokensL[i].value !== tokensR[i].value - ) { - return false; - } - } - - return true; -} - -/** - * Check if the given node is a true logical expression or not. - * - * The three binary expressions logical-or (`||`), logical-and (`&&`), and - * coalesce (`??`) are known as `ShortCircuitExpression`. - * But ESTree represents those by `LogicalExpression` node. - * - * This function rejects coalesce expressions of `LogicalExpression` node. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is `&&` or `||`. - * @see https://tc39.es/ecma262/#prod-ShortCircuitExpression - */ -function isLogicalExpression(node) { - return ( - node.type === "LogicalExpression" && - (node.operator === "&&" || node.operator === "||") - ); -} - -/** - * Check if the given node is a nullish coalescing expression or not. - * - * The three binary expressions logical-or (`||`), logical-and (`&&`), and - * coalesce (`??`) are known as `ShortCircuitExpression`. - * But ESTree represents those by `LogicalExpression` node. - * - * This function finds only coalesce expressions of `LogicalExpression` node. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is `??`. - */ -function isCoalesceExpression(node) { - return node.type === "LogicalExpression" && node.operator === "??"; -} - -/** - * Check if given two nodes are the pair of a logical expression and a coalesce expression. - * @param {ASTNode} left A node to check. - * @param {ASTNode} right Another node to check. - * @returns {boolean} `true` if the two nodes are the pair of a logical expression and a coalesce expression. - */ -function isMixedLogicalAndCoalesceExpressions(left, right) { - return ( - (isLogicalExpression(left) && isCoalesceExpression(right)) || - (isCoalesceExpression(left) && isLogicalExpression(right)) - ); -} - -/** - * Checks if the given operator is a logical assignment operator. - * @param {string} operator The operator to check. - * @returns {boolean} `true` if the operator is a logical assignment operator. - */ -function isLogicalAssignmentOperator(operator) { - return LOGICAL_ASSIGNMENT_OPERATORS.has(operator); -} - -/** - * Get the colon token of the given SwitchCase node. - * @param {ASTNode} node The SwitchCase node to get. - * @param {SourceCode} sourceCode The source code object to get tokens. - * @returns {Token} The colon token of the node. - */ -function getSwitchCaseColonToken(node, sourceCode) { - if (node.test) { - return sourceCode.getTokenAfter(node.test, isColonToken); - } - return sourceCode.getFirstToken(node, 1); -} - -/** - * Gets ESM module export name represented by the given node. - * @param {ASTNode} node `Identifier` or string `Literal` node in a position - * that represents a module export name: - * - `ImportSpecifier#imported` - * - `ExportSpecifier#local` (if it is a re-export from another module) - * - `ExportSpecifier#exported` - * - `ExportAllDeclaration#exported` - * @returns {string} The module export name. - */ -function getModuleExportName(node) { - if (node.type === "Identifier") { - return node.name; - } - - // string literal - return node.value; -} - -/** - * Returns literal's value converted to the Boolean type - * @param {ASTNode} node any `Literal` node - * @returns {boolean | null} `true` when node is truthy, `false` when node is falsy, - * `null` when it cannot be determined. - */ -function getBooleanValue(node) { - if (node.value === null) { - - /* - * it might be a null literal or bigint/regex literal in unsupported environments . - * https://github.com/estree/estree/blob/14df8a024956ea289bd55b9c2226a1d5b8a473ee/es5.md#regexpliteral - * https://github.com/estree/estree/blob/14df8a024956ea289bd55b9c2226a1d5b8a473ee/es2020.md#bigintliteral - */ - - if (node.raw === "null") { - return false; - } - - // regex is always truthy - if (typeof node.regex === "object") { - return true; - } - - return null; - } - - return !!node.value; -} - -/** - * Checks if a branch node of LogicalExpression short circuits the whole condition - * @param {ASTNode} node The branch of main condition which needs to be checked - * @param {string} operator The operator of the main LogicalExpression. - * @returns {boolean} true when condition short circuits whole condition - */ -function isLogicalIdentity(node, operator) { - switch (node.type) { - case "Literal": - return (operator === "||" && getBooleanValue(node) === true) || - (operator === "&&" && getBooleanValue(node) === false); - - case "UnaryExpression": - return (operator === "&&" && node.operator === "void"); - - case "LogicalExpression": - - /* - * handles `a && false || b` - * `false` is an identity element of `&&` but not `||` - */ - return operator === node.operator && - ( - isLogicalIdentity(node.left, operator) || - isLogicalIdentity(node.right, operator) - ); - - case "AssignmentExpression": - return ["||=", "&&="].includes(node.operator) && - operator === node.operator.slice(0, -1) && - isLogicalIdentity(node.right, operator); - - // no default - } - return false; -} - -/** - * Checks if an identifier is a reference to a global variable. - * @param {Scope} scope The scope in which the identifier is referenced. - * @param {ASTNode} node An identifier node to check. - * @returns {boolean} `true` if the identifier is a reference to a global variable. - */ -function isReferenceToGlobalVariable(scope, node) { - const reference = scope.references.find(ref => ref.identifier === node); - - return Boolean( - reference && - reference.resolved && - reference.resolved.scope.type === "global" && - reference.resolved.defs.length === 0 - ); -} - - -/** - * Checks if a node has a constant truthiness value. - * @param {Scope} scope Scope in which the node appears. - * @param {ASTNode} node The AST node to check. - * @param {boolean} inBooleanPosition `true` if checking the test of a - * condition. `false` in all other cases. When `false`, checks if -- for - * both string and number -- if coerced to that type, the value will - * be constant. - * @returns {boolean} true when node's truthiness is constant - * @private - */ -function isConstant(scope, node, inBooleanPosition) { - - // node.elements can return null values in the case of sparse arrays ex. [,] - if (!node) { - return true; - } - switch (node.type) { - case "Literal": - case "ArrowFunctionExpression": - case "FunctionExpression": - return true; - case "ClassExpression": - case "ObjectExpression": - - /** - * In theory objects like: - * - * `{toString: () => a}` - * `{valueOf: () => a}` - * - * Or a classes like: - * - * `class { static toString() { return a } }` - * `class { static valueOf() { return a } }` - * - * Are not constant verifiably when `inBooleanPosition` is - * false, but it's an edge case we've opted not to handle. - */ - return true; - case "TemplateLiteral": - return (inBooleanPosition && node.quasis.some(quasi => quasi.value.cooked.length)) || - node.expressions.every(exp => isConstant(scope, exp, false)); - - case "ArrayExpression": { - if (!inBooleanPosition) { - return node.elements.every(element => isConstant(scope, element, false)); - } - return true; - } - - case "UnaryExpression": - if ( - node.operator === "void" || - node.operator === "typeof" && inBooleanPosition - ) { - return true; - } - - if (node.operator === "!") { - return isConstant(scope, node.argument, true); - } - - return isConstant(scope, node.argument, false); - - case "BinaryExpression": - return isConstant(scope, node.left, false) && - isConstant(scope, node.right, false) && - node.operator !== "in"; - - case "LogicalExpression": { - const isLeftConstant = isConstant(scope, node.left, inBooleanPosition); - const isRightConstant = isConstant(scope, node.right, inBooleanPosition); - const isLeftShortCircuit = (isLeftConstant && isLogicalIdentity(node.left, node.operator)); - const isRightShortCircuit = (inBooleanPosition && isRightConstant && isLogicalIdentity(node.right, node.operator)); - - return (isLeftConstant && isRightConstant) || - isLeftShortCircuit || - isRightShortCircuit; - } - case "NewExpression": - return inBooleanPosition; - case "AssignmentExpression": - if (node.operator === "=") { - return isConstant(scope, node.right, inBooleanPosition); - } - - if (["||=", "&&="].includes(node.operator) && inBooleanPosition) { - return isLogicalIdentity(node.right, node.operator.slice(0, -1)); - } - - return false; - - case "SequenceExpression": - return isConstant(scope, node.expressions[node.expressions.length - 1], inBooleanPosition); - case "SpreadElement": - return isConstant(scope, node.argument, inBooleanPosition); - case "CallExpression": - if (node.callee.type === "Identifier" && node.callee.name === "Boolean") { - if (node.arguments.length === 0 || isConstant(scope, node.arguments[0], true)) { - return isReferenceToGlobalVariable(scope, node.callee); - } - } - return false; - case "Identifier": - return node.name === "undefined" && isReferenceToGlobalVariable(scope, node); - - // no default - } - return false; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - COMMENTS_IGNORE_PATTERN, - LINEBREAKS, - LINEBREAK_MATCHER: lineBreakPattern, - SHEBANG_MATCHER: shebangPattern, - STATEMENT_LIST_PARENTS, - - /** - * Determines whether two adjacent tokens are on the same line. - * @param {Object} left The left token object. - * @param {Object} right The right token object. - * @returns {boolean} Whether or not the tokens are on the same line. - * @public - */ - isTokenOnSameLine(left, right) { - return left.loc.end.line === right.loc.start.line; - }, - - isNullOrUndefined, - isCallee, - isES5Constructor, - getUpperFunction, - isFunction, - isLoop, - isInLoop, - isArrayFromMethod, - isParenthesised, - createGlobalLinebreakMatcher, - equalTokens, - - isArrowToken, - isClosingBraceToken, - isClosingBracketToken, - isClosingParenToken, - isColonToken, - isCommaToken, - isCommentToken, - isDotToken, - isQuestionDotToken, - isKeywordToken, - isNotClosingBraceToken: negate(isClosingBraceToken), - isNotClosingBracketToken: negate(isClosingBracketToken), - isNotClosingParenToken: negate(isClosingParenToken), - isNotColonToken: negate(isColonToken), - isNotCommaToken: negate(isCommaToken), - isNotDotToken: negate(isDotToken), - isNotQuestionDotToken: negate(isQuestionDotToken), - isNotOpeningBraceToken: negate(isOpeningBraceToken), - isNotOpeningBracketToken: negate(isOpeningBracketToken), - isNotOpeningParenToken: negate(isOpeningParenToken), - isNotSemicolonToken: negate(isSemicolonToken), - isOpeningBraceToken, - isOpeningBracketToken, - isOpeningParenToken, - isSemicolonToken, - isEqToken, - - /** - * Checks whether or not a given node is a string literal. - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is a string literal. - */ - isStringLiteral(node) { - return ( - (node.type === "Literal" && typeof node.value === "string") || - node.type === "TemplateLiteral" - ); - }, - - /** - * Checks whether a given node is a breakable statement or not. - * The node is breakable if the node is one of the following type: - * - * - DoWhileStatement - * - ForInStatement - * - ForOfStatement - * - ForStatement - * - SwitchStatement - * - WhileStatement - * @param {ASTNode} node A node to check. - * @returns {boolean} `true` if the node is breakable. - */ - isBreakableStatement(node) { - return breakableTypePattern.test(node.type); - }, - - /** - * Gets references which are non initializer and writable. - * @param {Reference[]} references An array of references. - * @returns {Reference[]} An array of only references which are non initializer and writable. - * @public - */ - getModifyingReferences(references) { - return references.filter(isModifyingReference); - }, - - /** - * Validate that a string passed in is surrounded by the specified character - * @param {string} val The text to check. - * @param {string} character The character to see if it's surrounded by. - * @returns {boolean} True if the text is surrounded by the character, false if not. - * @private - */ - isSurroundedBy(val, character) { - return val[0] === character && val[val.length - 1] === character; - }, - - /** - * Returns whether the provided node is an ESLint directive comment or not - * @param {Line|Block} node The comment token to be checked - * @returns {boolean} `true` if the node is an ESLint directive comment - */ - isDirectiveComment(node) { - const comment = node.value.trim(); - - return ( - node.type === "Line" && comment.startsWith("eslint-") || - node.type === "Block" && ESLINT_DIRECTIVE_PATTERN.test(comment) - ); - }, - - /** - * Gets the trailing statement of a given node. - * - * if (code) - * consequent; - * - * When taking this `IfStatement`, returns `consequent;` statement. - * @param {ASTNode} A node to get. - * @returns {ASTNode|null} The trailing statement's node. - */ - getTrailingStatement: esutils.ast.trailingStatement, - - /** - * Finds the variable by a given name in a given scope and its upper scopes. - * @param {eslint-scope.Scope} initScope A scope to start find. - * @param {string} name A variable name to find. - * @returns {eslint-scope.Variable|null} A found variable or `null`. - */ - getVariableByName(initScope, name) { - let scope = initScope; - - while (scope) { - const variable = scope.set.get(name); - - if (variable) { - return variable; - } - - scope = scope.upper; - } - - return null; - }, - - /** - * Checks whether or not a given function node is the default `this` binding. - * - * First, this checks the node: - * - * - The given node is not in `PropertyDefinition#value` position. - * - The given node is not `StaticBlock`. - * - The function name does not start with uppercase. It's a convention to capitalize the names - * of constructor functions. This check is not performed if `capIsConstructor` is set to `false`. - * - The function does not have a JSDoc comment that has a @this tag. - * - * Next, this checks the location of the node. - * If the location is below, this judges `this` is valid. - * - * - The location is not on an object literal. - * - The location is not assigned to a variable which starts with an uppercase letter. Applies to anonymous - * functions only, as the name of the variable is considered to be the name of the function in this case. - * This check is not performed if `capIsConstructor` is set to `false`. - * - The location is not on an ES2015 class. - * - Its `bind`/`call`/`apply` method is not called directly. - * - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given. - * @param {ASTNode} node A function node to check. It also can be an implicit function, like `StaticBlock` - * or any expression that is `PropertyDefinition#value` node. - * @param {SourceCode} sourceCode A SourceCode instance to get comments. - * @param {boolean} [capIsConstructor = true] `false` disables the assumption that functions which name starts - * with an uppercase or are assigned to a variable which name starts with an uppercase are constructors. - * @returns {boolean} The function node is the default `this` binding. - */ - isDefaultThisBinding(node, sourceCode, { capIsConstructor = true } = {}) { - - /* - * Class field initializers are implicit functions, but ESTree doesn't have the AST node of field initializers. - * Therefore, A expression node at `PropertyDefinition#value` is a function. - * In this case, `this` is always not default binding. - */ - if (node.parent.type === "PropertyDefinition" && node.parent.value === node) { - return false; - } - - // Class static blocks are implicit functions. In this case, `this` is always not default binding. - if (node.type === "StaticBlock") { - return false; - } - - if ( - (capIsConstructor && isES5Constructor(node)) || - hasJSDocThisTag(node, sourceCode) - ) { - return false; - } - const isAnonymous = node.id === null; - let currentNode = node; - - while (currentNode) { - const parent = currentNode.parent; - - switch (parent.type) { - - /* - * Looks up the destination. - * e.g., obj.foo = nativeFoo || function foo() { ... }; - */ - case "LogicalExpression": - case "ConditionalExpression": - case "ChainExpression": - currentNode = parent; - break; - - /* - * If the upper function is IIFE, checks the destination of the return value. - * e.g. - * obj.foo = (function() { - * // setup... - * return function foo() { ... }; - * })(); - * obj.foo = (() => - * function foo() { ... } - * )(); - */ - case "ReturnStatement": { - const func = getUpperFunction(parent); - - if (func === null || !isCallee(func)) { - return true; - } - currentNode = func.parent; - break; - } - case "ArrowFunctionExpression": - if (currentNode !== parent.body || !isCallee(parent)) { - return true; - } - currentNode = parent.parent; - break; - - /* - * e.g. - * var obj = { foo() { ... } }; - * var obj = { foo: function() { ... } }; - * class A { constructor() { ... } } - * class A { foo() { ... } } - * class A { get foo() { ... } } - * class A { set foo() { ... } } - * class A { static foo() { ... } } - * class A { foo = function() { ... } } - */ - case "Property": - case "PropertyDefinition": - case "MethodDefinition": - return parent.value !== currentNode; - - /* - * e.g. - * obj.foo = function foo() { ... }; - * Foo = function() { ... }; - * [obj.foo = function foo() { ... }] = a; - * [Foo = function() { ... }] = a; - */ - case "AssignmentExpression": - case "AssignmentPattern": - if (parent.left.type === "MemberExpression") { - return false; - } - if ( - capIsConstructor && - isAnonymous && - parent.left.type === "Identifier" && - startsWithUpperCase(parent.left.name) - ) { - return false; - } - return true; - - /* - * e.g. - * var Foo = function() { ... }; - */ - case "VariableDeclarator": - return !( - capIsConstructor && - isAnonymous && - parent.init === currentNode && - parent.id.type === "Identifier" && - startsWithUpperCase(parent.id.name) - ); - - /* - * e.g. - * var foo = function foo() { ... }.bind(obj); - * (function foo() { ... }).call(obj); - * (function foo() { ... }).apply(obj, []); - */ - case "MemberExpression": - if ( - parent.object === currentNode && - isSpecificMemberAccess(parent, null, bindOrCallOrApplyPattern) - ) { - const maybeCalleeNode = parent.parent.type === "ChainExpression" - ? parent.parent - : parent; - - return !( - isCallee(maybeCalleeNode) && - maybeCalleeNode.parent.arguments.length >= 1 && - !isNullOrUndefined(maybeCalleeNode.parent.arguments[0]) - ); - } - return true; - - /* - * e.g. - * Reflect.apply(function() {}, obj, []); - * Array.from([], function() {}, obj); - * list.forEach(function() {}, obj); - */ - case "CallExpression": - if (isReflectApply(parent.callee)) { - return ( - parent.arguments.length !== 3 || - parent.arguments[0] !== currentNode || - isNullOrUndefined(parent.arguments[1]) - ); - } - if (isArrayFromMethod(parent.callee)) { - return ( - parent.arguments.length !== 3 || - parent.arguments[1] !== currentNode || - isNullOrUndefined(parent.arguments[2]) - ); - } - if (isMethodWhichHasThisArg(parent.callee)) { - return ( - parent.arguments.length !== 2 || - parent.arguments[0] !== currentNode || - isNullOrUndefined(parent.arguments[1]) - ); - } - return true; - - // Otherwise `this` is default. - default: - return true; - } - } - - /* c8 ignore next */ - return true; - }, - - /** - * Get the precedence level based on the node type - * @param {ASTNode} node node to evaluate - * @returns {int} precedence level - * @private - */ - getPrecedence(node) { - switch (node.type) { - case "SequenceExpression": - return 0; - - case "AssignmentExpression": - case "ArrowFunctionExpression": - case "YieldExpression": - return 1; - - case "ConditionalExpression": - return 3; - - case "LogicalExpression": - switch (node.operator) { - case "||": - case "??": - return 4; - case "&&": - return 5; - - // no default - } - - /* falls through */ - - case "BinaryExpression": - - switch (node.operator) { - case "|": - return 6; - case "^": - return 7; - case "&": - return 8; - case "==": - case "!=": - case "===": - case "!==": - return 9; - case "<": - case "<=": - case ">": - case ">=": - case "in": - case "instanceof": - return 10; - case "<<": - case ">>": - case ">>>": - return 11; - case "+": - case "-": - return 12; - case "*": - case "/": - case "%": - return 13; - case "**": - return 15; - - // no default - } - - /* falls through */ - - case "UnaryExpression": - case "AwaitExpression": - return 16; - - case "UpdateExpression": - return 17; - - case "CallExpression": - case "ChainExpression": - case "ImportExpression": - return 18; - - case "NewExpression": - return 19; - - default: - return 20; - } - }, - - /** - * Checks whether the given node is an empty block node or not. - * @param {ASTNode|null} node The node to check. - * @returns {boolean} `true` if the node is an empty block. - */ - isEmptyBlock(node) { - return Boolean(node && node.type === "BlockStatement" && node.body.length === 0); - }, - - /** - * Checks whether the given node is an empty function node or not. - * @param {ASTNode|null} node The node to check. - * @returns {boolean} `true` if the node is an empty function. - */ - isEmptyFunction(node) { - return isFunction(node) && module.exports.isEmptyBlock(node.body); - }, - - /** - * Get directives from directive prologue of a Program or Function node. - * @param {ASTNode} node The node to check. - * @returns {ASTNode[]} The directives found in the directive prologue. - */ - getDirectivePrologue(node) { - const directives = []; - - // Directive prologues only occur at the top of files or functions. - if ( - node.type === "Program" || - node.type === "FunctionDeclaration" || - node.type === "FunctionExpression" || - - /* - * Do not check arrow functions with implicit return. - * `() => "use strict";` returns the string `"use strict"`. - */ - (node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement") - ) { - const statements = node.type === "Program" ? node.body : node.body.body; - - for (const statement of statements) { - if ( - statement.type === "ExpressionStatement" && - statement.expression.type === "Literal" - ) { - directives.push(statement); - } else { - break; - } - } - } - - return directives; - }, - - - /** - * Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added - * after the node will be parsed as a decimal point, rather than a property-access dot. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if this node is a decimal integer. - * @example - * - * 0 // true - * 5 // true - * 50 // true - * 5_000 // true - * 1_234_56 // true - * 08 // true - * 0192 // true - * 5. // false - * .5 // false - * 5.0 // false - * 5.00_00 // false - * 05 // false - * 0x5 // false - * 0b101 // false - * 0b11_01 // false - * 0o5 // false - * 5e0 // false - * 5e1_000 // false - * 5n // false - * 1_000n // false - * "5" // false - * - */ - isDecimalInteger(node) { - return node.type === "Literal" && typeof node.value === "number" && - DECIMAL_INTEGER_PATTERN.test(node.raw); - }, - - /** - * Determines whether this token is a decimal integer numeric token. - * This is similar to isDecimalInteger(), but for tokens. - * @param {Token} token The token to check. - * @returns {boolean} `true` if this token is a decimal integer. - */ - isDecimalIntegerNumericToken(token) { - return token.type === "Numeric" && DECIMAL_INTEGER_PATTERN.test(token.value); - }, - - /** - * Gets the name and kind of the given function node. - * - * - `function foo() {}` .................... `function 'foo'` - * - `(function foo() {})` .................. `function 'foo'` - * - `(function() {})` ...................... `function` - * - `function* foo() {}` ................... `generator function 'foo'` - * - `(function* foo() {})` ................. `generator function 'foo'` - * - `(function*() {})` ..................... `generator function` - * - `() => {}` ............................. `arrow function` - * - `async () => {}` ....................... `async arrow function` - * - `({ foo: function foo() {} })` ......... `method 'foo'` - * - `({ foo: function() {} })` ............. `method 'foo'` - * - `({ ['foo']: function() {} })` ......... `method 'foo'` - * - `({ [foo]: function() {} })` ........... `method` - * - `({ foo() {} })` ....................... `method 'foo'` - * - `({ foo: function* foo() {} })` ........ `generator method 'foo'` - * - `({ foo: function*() {} })` ............ `generator method 'foo'` - * - `({ ['foo']: function*() {} })` ........ `generator method 'foo'` - * - `({ [foo]: function*() {} })` .......... `generator method` - * - `({ *foo() {} })` ...................... `generator method 'foo'` - * - `({ foo: async function foo() {} })` ... `async method 'foo'` - * - `({ foo: async function() {} })` ....... `async method 'foo'` - * - `({ ['foo']: async function() {} })` ... `async method 'foo'` - * - `({ [foo]: async function() {} })` ..... `async method` - * - `({ async foo() {} })` ................. `async method 'foo'` - * - `({ get foo() {} })` ................... `getter 'foo'` - * - `({ set foo(a) {} })` .................. `setter 'foo'` - * - `class A { constructor() {} }` ......... `constructor` - * - `class A { foo() {} }` ................. `method 'foo'` - * - `class A { *foo() {} }` ................ `generator method 'foo'` - * - `class A { async foo() {} }` ........... `async method 'foo'` - * - `class A { ['foo']() {} }` ............. `method 'foo'` - * - `class A { *['foo']() {} }` ............ `generator method 'foo'` - * - `class A { async ['foo']() {} }` ....... `async method 'foo'` - * - `class A { [foo]() {} }` ............... `method` - * - `class A { *[foo]() {} }` .............. `generator method` - * - `class A { async [foo]() {} }` ......... `async method` - * - `class A { get foo() {} }` ............. `getter 'foo'` - * - `class A { set foo(a) {} }` ............ `setter 'foo'` - * - `class A { static foo() {} }` .......... `static method 'foo'` - * - `class A { static *foo() {} }` ......... `static generator method 'foo'` - * - `class A { static async foo() {} }` .... `static async method 'foo'` - * - `class A { static get foo() {} }` ...... `static getter 'foo'` - * - `class A { static set foo(a) {} }` ..... `static setter 'foo'` - * - `class A { foo = () => {}; }` .......... `method 'foo'` - * - `class A { foo = function() {}; }` ..... `method 'foo'` - * - `class A { foo = function bar() {}; }` . `method 'foo'` - * - `class A { static foo = () => {}; }` ... `static method 'foo'` - * - `class A { '#foo' = () => {}; }` ....... `method '#foo'` - * - `class A { #foo = () => {}; }` ......... `private method #foo` - * - `class A { static #foo = () => {}; }` .. `static private method #foo` - * - `class A { '#foo'() {} }` .............. `method '#foo'` - * - `class A { #foo() {} }` ................ `private method #foo` - * - `class A { static #foo() {} }` ......... `static private method #foo` - * @param {ASTNode} node The function node to get. - * @returns {string} The name and kind of the function node. - */ - getFunctionNameWithKind(node) { - const parent = node.parent; - const tokens = []; - - if (parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { - - // The proposal uses `static` word consistently before visibility words: https://github.com/tc39/proposal-static-class-features - if (parent.static) { - tokens.push("static"); - } - if (!parent.computed && parent.key.type === "PrivateIdentifier") { - tokens.push("private"); - } - } - if (node.async) { - tokens.push("async"); - } - if (node.generator) { - tokens.push("generator"); - } - - if (parent.type === "Property" || parent.type === "MethodDefinition") { - if (parent.kind === "constructor") { - return "constructor"; - } - if (parent.kind === "get") { - tokens.push("getter"); - } else if (parent.kind === "set") { - tokens.push("setter"); - } else { - tokens.push("method"); - } - } else if (parent.type === "PropertyDefinition") { - tokens.push("method"); - } else { - if (node.type === "ArrowFunctionExpression") { - tokens.push("arrow"); - } - tokens.push("function"); - } - - if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { - if (!parent.computed && parent.key.type === "PrivateIdentifier") { - tokens.push(`#${parent.key.name}`); - } else { - const name = getStaticPropertyName(parent); - - if (name !== null) { - tokens.push(`'${name}'`); - } else if (node.id) { - tokens.push(`'${node.id.name}'`); - } - } - } else if (node.id) { - tokens.push(`'${node.id.name}'`); - } - - return tokens.join(" "); - }, - - /** - * Gets the location of the given function node for reporting. - * - * - `function foo() {}` - * ^^^^^^^^^^^^ - * - `(function foo() {})` - * ^^^^^^^^^^^^ - * - `(function() {})` - * ^^^^^^^^ - * - `function* foo() {}` - * ^^^^^^^^^^^^^ - * - `(function* foo() {})` - * ^^^^^^^^^^^^^ - * - `(function*() {})` - * ^^^^^^^^^ - * - `() => {}` - * ^^ - * - `async () => {}` - * ^^ - * - `({ foo: function foo() {} })` - * ^^^^^^^^^^^^^^^^^ - * - `({ foo: function() {} })` - * ^^^^^^^^^^^^^ - * - `({ ['foo']: function() {} })` - * ^^^^^^^^^^^^^^^^^ - * - `({ [foo]: function() {} })` - * ^^^^^^^^^^^^^^^ - * - `({ foo() {} })` - * ^^^ - * - `({ foo: function* foo() {} })` - * ^^^^^^^^^^^^^^^^^^ - * - `({ foo: function*() {} })` - * ^^^^^^^^^^^^^^ - * - `({ ['foo']: function*() {} })` - * ^^^^^^^^^^^^^^^^^^ - * - `({ [foo]: function*() {} })` - * ^^^^^^^^^^^^^^^^ - * - `({ *foo() {} })` - * ^^^^ - * - `({ foo: async function foo() {} })` - * ^^^^^^^^^^^^^^^^^^^^^^^ - * - `({ foo: async function() {} })` - * ^^^^^^^^^^^^^^^^^^^ - * - `({ ['foo']: async function() {} })` - * ^^^^^^^^^^^^^^^^^^^^^^^ - * - `({ [foo]: async function() {} })` - * ^^^^^^^^^^^^^^^^^^^^^ - * - `({ async foo() {} })` - * ^^^^^^^^^ - * - `({ get foo() {} })` - * ^^^^^^^ - * - `({ set foo(a) {} })` - * ^^^^^^^ - * - `class A { constructor() {} }` - * ^^^^^^^^^^^ - * - `class A { foo() {} }` - * ^^^ - * - `class A { *foo() {} }` - * ^^^^ - * - `class A { async foo() {} }` - * ^^^^^^^^^ - * - `class A { ['foo']() {} }` - * ^^^^^^^ - * - `class A { *['foo']() {} }` - * ^^^^^^^^ - * - `class A { async ['foo']() {} }` - * ^^^^^^^^^^^^^ - * - `class A { [foo]() {} }` - * ^^^^^ - * - `class A { *[foo]() {} }` - * ^^^^^^ - * - `class A { async [foo]() {} }` - * ^^^^^^^^^^^ - * - `class A { get foo() {} }` - * ^^^^^^^ - * - `class A { set foo(a) {} }` - * ^^^^^^^ - * - `class A { static foo() {} }` - * ^^^^^^^^^^ - * - `class A { static *foo() {} }` - * ^^^^^^^^^^^ - * - `class A { static async foo() {} }` - * ^^^^^^^^^^^^^^^^ - * - `class A { static get foo() {} }` - * ^^^^^^^^^^^^^^ - * - `class A { static set foo(a) {} }` - * ^^^^^^^^^^^^^^ - * - `class A { foo = function() {} }` - * ^^^^^^^^^^^^^^ - * - `class A { static foo = function() {} }` - * ^^^^^^^^^^^^^^^^^^^^^ - * - `class A { foo = (a, b) => {} }` - * ^^^^^^ - * @param {ASTNode} node The function node to get. - * @param {SourceCode} sourceCode The source code object to get tokens. - * @returns {string} The location of the function node for reporting. - */ - getFunctionHeadLoc(node, sourceCode) { - const parent = node.parent; - let start = null; - let end = null; - - if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { - start = parent.loc.start; - end = getOpeningParenOfParams(node, sourceCode).loc.start; - } else if (node.type === "ArrowFunctionExpression") { - const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken); - - start = arrowToken.loc.start; - end = arrowToken.loc.end; - } else { - start = node.loc.start; - end = getOpeningParenOfParams(node, sourceCode).loc.start; - } - - return { - start: Object.assign({}, start), - end: Object.assign({}, end) - }; - }, - - /** - * Gets next location when the result is not out of bound, otherwise returns null. - * - * Assumptions: - * - * - The given location represents a valid location in the given source code. - * - Columns are 0-based. - * - Lines are 1-based. - * - Column immediately after the last character in a line (not incl. linebreaks) is considered to be a valid location. - * - If the source code ends with a linebreak, `sourceCode.lines` array will have an extra element (empty string) at the end. - * The start (column 0) of that extra line is considered to be a valid location. - * - * Examples of successive locations (line, column): - * - * code: foo - * locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> null - * - * code: foo - * locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> (2, 0) -> null - * - * code: foo - * locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> (2, 0) -> null - * - * code: ab - * locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> null - * - * code: ab - * locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> (3, 0) -> null - * - * code: ab - * locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> (3, 0) -> null - * - * code: a - * locations: (1, 0) -> (1, 1) -> (2, 0) -> (3, 0) -> null - * - * code: - * locations: (1, 0) -> (2, 0) -> null - * - * code: - * locations: (1, 0) -> null - * @param {SourceCode} sourceCode The sourceCode - * @param {{line: number, column: number}} location The location - * @returns {{line: number, column: number} | null} Next location - */ - getNextLocation(sourceCode, { line, column }) { - if (column < sourceCode.lines[line - 1].length) { - return { - line, - column: column + 1 - }; - } - - if (line < sourceCode.lines.length) { - return { - line: line + 1, - column: 0 - }; - } - - return null; - }, - - /** - * Gets the parenthesized text of a node. This is similar to sourceCode.getText(node), but it also includes any parentheses - * surrounding the node. - * @param {SourceCode} sourceCode The source code object - * @param {ASTNode} node An expression node - * @returns {string} The text representing the node, with all surrounding parentheses included - */ - getParenthesisedText(sourceCode, node) { - let leftToken = sourceCode.getFirstToken(node); - let rightToken = sourceCode.getLastToken(node); - - while ( - sourceCode.getTokenBefore(leftToken) && - sourceCode.getTokenBefore(leftToken).type === "Punctuator" && - sourceCode.getTokenBefore(leftToken).value === "(" && - sourceCode.getTokenAfter(rightToken) && - sourceCode.getTokenAfter(rightToken).type === "Punctuator" && - sourceCode.getTokenAfter(rightToken).value === ")" - ) { - leftToken = sourceCode.getTokenBefore(leftToken); - rightToken = sourceCode.getTokenAfter(rightToken); - } - - return sourceCode.getText().slice(leftToken.range[0], rightToken.range[1]); - }, - - /** - * Determine if a node has a possibility to be an Error object - * @param {ASTNode} node ASTNode to check - * @returns {boolean} True if there is a chance it contains an Error obj - */ - couldBeError(node) { - switch (node.type) { - case "Identifier": - case "CallExpression": - case "NewExpression": - case "MemberExpression": - case "TaggedTemplateExpression": - case "YieldExpression": - case "AwaitExpression": - case "ChainExpression": - return true; // possibly an error object. - - case "AssignmentExpression": - if (["=", "&&="].includes(node.operator)) { - return module.exports.couldBeError(node.right); - } - - if (["||=", "??="].includes(node.operator)) { - return module.exports.couldBeError(node.left) || module.exports.couldBeError(node.right); - } - - /** - * All other assignment operators are mathematical assignment operators (arithmetic or bitwise). - * An assignment expression with a mathematical operator can either evaluate to a primitive value, - * or throw, depending on the operands. Thus, it cannot evaluate to an `Error` object. - */ - return false; - - case "SequenceExpression": { - const exprs = node.expressions; - - return exprs.length !== 0 && module.exports.couldBeError(exprs[exprs.length - 1]); - } - - case "LogicalExpression": - - /* - * If the && operator short-circuits, the left side was falsy and therefore not an error, and if it - * doesn't short-circuit, it takes the value from the right side, so the right side must always be - * a plausible error. A future improvement could verify that the left side could be truthy by - * excluding falsy literals. - */ - if (node.operator === "&&") { - return module.exports.couldBeError(node.right); - } - - return module.exports.couldBeError(node.left) || module.exports.couldBeError(node.right); - - case "ConditionalExpression": - return module.exports.couldBeError(node.consequent) || module.exports.couldBeError(node.alternate); - - default: - return false; - } - }, - - /** - * Check if a given node is a numeric literal or not. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is a number or bigint literal. - */ - isNumericLiteral(node) { - return ( - node.type === "Literal" && - (typeof node.value === "number" || Boolean(node.bigint)) - ); - }, - - /** - * Determines whether two tokens can safely be placed next to each other without merging into a single token - * @param {Token|string} leftValue The left token. If this is a string, it will be tokenized and the last token will be used. - * @param {Token|string} rightValue The right token. If this is a string, it will be tokenized and the first token will be used. - * @returns {boolean} If the tokens cannot be safely placed next to each other, returns `false`. If the tokens can be placed - * next to each other, behavior is undefined (although it should return `true` in most cases). - */ - canTokensBeAdjacent(leftValue, rightValue) { - const espreeOptions = { - ecmaVersion: espree.latestEcmaVersion, - comment: true, - range: true - }; - - let leftToken; - - if (typeof leftValue === "string") { - let tokens; - - try { - tokens = espree.tokenize(leftValue, espreeOptions); - } catch { - return false; - } - - const comments = tokens.comments; - - leftToken = tokens[tokens.length - 1]; - if (comments.length) { - const lastComment = comments[comments.length - 1]; - - if (!leftToken || lastComment.range[0] > leftToken.range[0]) { - leftToken = lastComment; - } - } - } else { - leftToken = leftValue; - } - - /* - * If a hashbang comment was passed as a token object from SourceCode, - * its type will be "Shebang" because of the way ESLint itself handles hashbangs. - * If a hashbang comment was passed in a string and then tokenized in this function, - * its type will be "Hashbang" because of the way Espree tokenizes hashbangs. - */ - if (leftToken.type === "Shebang" || leftToken.type === "Hashbang") { - return false; - } - - let rightToken; - - if (typeof rightValue === "string") { - let tokens; - - try { - tokens = espree.tokenize(rightValue, espreeOptions); - } catch { - return false; - } - - const comments = tokens.comments; - - rightToken = tokens[0]; - if (comments.length) { - const firstComment = comments[0]; - - if (!rightToken || firstComment.range[0] < rightToken.range[0]) { - rightToken = firstComment; - } - } - } else { - rightToken = rightValue; - } - - if (leftToken.type === "Punctuator" || rightToken.type === "Punctuator") { - if (leftToken.type === "Punctuator" && rightToken.type === "Punctuator") { - const PLUS_TOKENS = new Set(["+", "++"]); - const MINUS_TOKENS = new Set(["-", "--"]); - - return !( - PLUS_TOKENS.has(leftToken.value) && PLUS_TOKENS.has(rightToken.value) || - MINUS_TOKENS.has(leftToken.value) && MINUS_TOKENS.has(rightToken.value) - ); - } - if (leftToken.type === "Punctuator" && leftToken.value === "/") { - return !["Block", "Line", "RegularExpression"].includes(rightToken.type); - } - return true; - } - - if ( - leftToken.type === "String" || rightToken.type === "String" || - leftToken.type === "Template" || rightToken.type === "Template" - ) { - return true; - } - - if (leftToken.type !== "Numeric" && rightToken.type === "Numeric" && rightToken.value.startsWith(".")) { - return true; - } - - if (leftToken.type === "Block" || rightToken.type === "Block" || rightToken.type === "Line") { - return true; - } - - if (rightToken.type === "PrivateIdentifier") { - return true; - } - - return false; - }, - - /** - * Get the `loc` object of a given name in a `/*globals` directive comment. - * @param {SourceCode} sourceCode The source code to convert index to loc. - * @param {Comment} comment The `/*globals` directive comment which include the name. - * @param {string} name The name to find. - * @returns {SourceLocation} The `loc` object. - */ - getNameLocationInGlobalDirectiveComment(sourceCode, comment, name) { - const namePattern = new RegExp(`[\\s,]${escapeRegExp(name)}(?:$|[\\s,:])`, "gu"); - - // To ignore the first text "global". - namePattern.lastIndex = comment.value.indexOf("global") + 6; - - // Search a given variable name. - const match = namePattern.exec(comment.value); - - // Convert the index to loc. - const start = sourceCode.getLocFromIndex( - comment.range[0] + - "/*".length + - (match ? match.index + 1 : 0) - ); - const end = { - line: start.line, - column: start.column + (match ? name.length : 1) - }; - - return { start, end }; - }, - - /** - * Determines whether the given raw string contains an octal escape sequence - * or a non-octal decimal escape sequence ("\8", "\9"). - * - * "\1", "\2" ... "\7", "\8", "\9" - * "\00", "\01" ... "\07", "\08", "\09" - * - * "\0", when not followed by a digit, is not an octal escape sequence. - * @param {string} rawString A string in its raw representation. - * @returns {boolean} `true` if the string contains at least one octal escape sequence - * or at least one non-octal decimal escape sequence. - */ - hasOctalOrNonOctalDecimalEscapeSequence(rawString) { - return OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN.test(rawString); - }, - - isReferenceToGlobalVariable, - isLogicalExpression, - isCoalesceExpression, - isMixedLogicalAndCoalesceExpressions, - isNullLiteral, - getStaticStringValue, - getStaticPropertyName, - skipChainExpression, - isSpecificId, - isSpecificMemberAccess, - equalLiteralValue, - isSameReference, - isLogicalAssignmentOperator, - getSwitchCaseColonToken, - getModuleExportName, - isConstant -}; diff --git a/node_modules/eslint/lib/rules/utils/fix-tracker.js b/node_modules/eslint/lib/rules/utils/fix-tracker.js deleted file mode 100644 index 589870b39..000000000 --- a/node_modules/eslint/lib/rules/utils/fix-tracker.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @fileoverview Helper class to aid in constructing fix commands. - * @author Alan Pierce - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./ast-utils"); - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * A helper class to combine fix options into a fix command. Currently, it - * exposes some "retain" methods that extend the range of the text being - * replaced so that other fixes won't touch that region in the same pass. - */ -class FixTracker { - - /** - * Create a new FixTracker. - * @param {ruleFixer} fixer A ruleFixer instance. - * @param {SourceCode} sourceCode A SourceCode object for the current code. - */ - constructor(fixer, sourceCode) { - this.fixer = fixer; - this.sourceCode = sourceCode; - this.retainedRange = null; - } - - /** - * Mark the given range as "retained", meaning that other fixes may not - * may not modify this region in the same pass. - * @param {int[]} range The range to retain. - * @returns {FixTracker} The same RuleFixer, for chained calls. - */ - retainRange(range) { - this.retainedRange = range; - return this; - } - - /** - * Given a node, find the function containing it (or the entire program) and - * mark it as retained, meaning that other fixes may not modify it in this - * pass. This is useful for avoiding conflicts in fixes that modify control - * flow. - * @param {ASTNode} node The node to use as a starting point. - * @returns {FixTracker} The same RuleFixer, for chained calls. - */ - retainEnclosingFunction(node) { - const functionNode = astUtils.getUpperFunction(node); - - return this.retainRange(functionNode ? functionNode.range : this.sourceCode.ast.range); - } - - /** - * Given a node or token, find the token before and afterward, and mark that - * range as retained, meaning that other fixes may not modify it in this - * pass. This is useful for avoiding conflicts in fixes that make a small - * change to the code where the AST should not be changed. - * @param {ASTNode|Token} nodeOrToken The node or token to use as a starting - * point. The token to the left and right are use in the range. - * @returns {FixTracker} The same RuleFixer, for chained calls. - */ - retainSurroundingTokens(nodeOrToken) { - const tokenBefore = this.sourceCode.getTokenBefore(nodeOrToken) || nodeOrToken; - const tokenAfter = this.sourceCode.getTokenAfter(nodeOrToken) || nodeOrToken; - - return this.retainRange([tokenBefore.range[0], tokenAfter.range[1]]); - } - - /** - * Create a fix command that replaces the given range with the given text, - * accounting for any retained ranges. - * @param {int[]} range The range to remove in the fix. - * @param {string} text The text to insert in place of the range. - * @returns {Object} The fix command. - */ - replaceTextRange(range, text) { - let actualRange; - - if (this.retainedRange) { - actualRange = [ - Math.min(this.retainedRange[0], range[0]), - Math.max(this.retainedRange[1], range[1]) - ]; - } else { - actualRange = range; - } - - return this.fixer.replaceTextRange( - actualRange, - this.sourceCode.text.slice(actualRange[0], range[0]) + - text + - this.sourceCode.text.slice(range[1], actualRange[1]) - ); - } - - /** - * Create a fix command that removes the given node or token, accounting for - * any retained ranges. - * @param {ASTNode|Token} nodeOrToken The node or token to remove. - * @returns {Object} The fix command. - */ - remove(nodeOrToken) { - return this.replaceTextRange(nodeOrToken.range, ""); - } -} - -module.exports = FixTracker; diff --git a/node_modules/eslint/lib/rules/utils/keywords.js b/node_modules/eslint/lib/rules/utils/keywords.js deleted file mode 100644 index 3fbb77771..000000000 --- a/node_modules/eslint/lib/rules/utils/keywords.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @fileoverview A shared list of ES3 keywords. - * @author Josh Perez - */ -"use strict"; - -module.exports = [ - "abstract", - "boolean", - "break", - "byte", - "case", - "catch", - "char", - "class", - "const", - "continue", - "debugger", - "default", - "delete", - "do", - "double", - "else", - "enum", - "export", - "extends", - "false", - "final", - "finally", - "float", - "for", - "function", - "goto", - "if", - "implements", - "import", - "in", - "instanceof", - "int", - "interface", - "long", - "native", - "new", - "null", - "package", - "private", - "protected", - "public", - "return", - "short", - "static", - "super", - "switch", - "synchronized", - "this", - "throw", - "throws", - "transient", - "true", - "try", - "typeof", - "var", - "void", - "volatile", - "while", - "with" -]; diff --git a/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js b/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js deleted file mode 100644 index 7f116a268..000000000 --- a/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * @fileoverview `Map` to load rules lazily. - * @author Toru Nagashima - */ -"use strict"; - -const debug = require("debug")("eslint:rules"); - -/** @typedef {import("./types").Rule} Rule */ - -/** - * The `Map` object that loads each rule when it's accessed. - * @example - * const rules = new LazyLoadingRuleMap([ - * ["eqeqeq", () => require("eqeqeq")], - * ["semi", () => require("semi")], - * ["no-unused-vars", () => require("no-unused-vars")] - * ]); - * - * rules.get("semi"); // call `() => require("semi")` here. - * - * @extends {Map Rule>} - */ -class LazyLoadingRuleMap extends Map { - - /** - * Initialize this map. - * @param {Array<[string, function(): Rule]>} loaders The rule loaders. - */ - constructor(loaders) { - let remaining = loaders.length; - - super( - debug.enabled - ? loaders.map(([ruleId, load]) => { - let cache = null; - - return [ - ruleId, - () => { - if (!cache) { - debug("Loading rule %o (remaining=%d)", ruleId, --remaining); - cache = load(); - } - return cache; - } - ]; - }) - : loaders - ); - - // `super(...iterable)` uses `this.set()`, so disable it here. - Object.defineProperty(LazyLoadingRuleMap.prototype, "set", { - configurable: true, - value: void 0 - }); - } - - /** - * Get a rule. - * Each rule will be loaded on the first access. - * @param {string} ruleId The rule ID to get. - * @returns {Rule|undefined} The rule. - */ - get(ruleId) { - const load = super.get(ruleId); - - return load && load(); - } - - /** - * Iterate rules. - * @returns {IterableIterator} Rules. - */ - *values() { - for (const load of super.values()) { - yield load(); - } - } - - /** - * Iterate rules. - * @returns {IterableIterator<[string, Rule]>} Rules. - */ - *entries() { - for (const [ruleId, load] of super.entries()) { - yield [ruleId, load()]; - } - } - - /** - * Call a function with each rule. - * @param {Function} callbackFn The callback function. - * @param {any} [thisArg] The object to pass to `this` of the callback function. - * @returns {void} - */ - forEach(callbackFn, thisArg) { - for (const [ruleId, load] of super.entries()) { - callbackFn.call(thisArg, load(), ruleId, this); - } - } -} - -// Forbid mutation. -Object.defineProperties(LazyLoadingRuleMap.prototype, { - clear: { configurable: true, value: void 0 }, - delete: { configurable: true, value: void 0 }, - [Symbol.iterator]: { - configurable: true, - writable: true, - value: LazyLoadingRuleMap.prototype.entries - } -}); - -module.exports = { LazyLoadingRuleMap }; diff --git a/node_modules/eslint/lib/rules/utils/patterns/letters.js b/node_modules/eslint/lib/rules/utils/patterns/letters.js deleted file mode 100644 index 9bb2de310..000000000 --- a/node_modules/eslint/lib/rules/utils/patterns/letters.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @fileoverview Pattern for detecting any letter (even letters outside of ASCII). - * NOTE: This file was generated using this script in JSCS based on the Unicode 7.0.0 standard: https://github.com/jscs-dev/node-jscs/blob/f5ed14427deb7e7aac84f3056a5aab2d9f3e563e/publish/helpers/generate-patterns.js - * Do not edit this file by hand-- please use https://github.com/mathiasbynens/regenerate to regenerate the regular expression exported from this file. - * @author Kevin Partington - * @license MIT License (from JSCS). See below. - */ - -/* - * The MIT License (MIT) - * - * Copyright 2013-2016 Dulin Marat and other 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. - */ - -"use strict"; - -module.exports = /[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/u; diff --git a/node_modules/eslint/lib/rules/utils/regular-expressions.js b/node_modules/eslint/lib/rules/utils/regular-expressions.js deleted file mode 100644 index 234a1cb8b..000000000 --- a/node_modules/eslint/lib/rules/utils/regular-expressions.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @fileoverview Common utils for regular expressions. - * @author Josh Goldberg - * @author Toru Nagashima - */ - -"use strict"; - -const { RegExpValidator } = require("@eslint-community/regexpp"); - -const REGEXPP_LATEST_ECMA_VERSION = 2022; - -/** - * Checks if the given regular expression pattern would be valid with the `u` flag. - * @param {number} ecmaVersion ECMAScript version to parse in. - * @param {string} pattern The regular expression pattern to verify. - * @returns {boolean} `true` if the pattern would be valid with the `u` flag. - * `false` if the pattern would be invalid with the `u` flag or the configured - * ecmaVersion doesn't support the `u` flag. - */ -function isValidWithUnicodeFlag(ecmaVersion, pattern) { - if (ecmaVersion <= 5) { // ecmaVersion <= 5 doesn't support the 'u' flag - return false; - } - - const validator = new RegExpValidator({ - ecmaVersion: Math.min(ecmaVersion, REGEXPP_LATEST_ECMA_VERSION) - }); - - try { - validator.validatePattern(pattern, void 0, void 0, /* uFlag = */ true); - } catch { - return false; - } - - return true; -} - -module.exports = { - isValidWithUnicodeFlag, - REGEXPP_LATEST_ECMA_VERSION -}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/index.js b/node_modules/eslint/lib/rules/utils/unicode/index.js deleted file mode 100644 index 02eea502d..000000000 --- a/node_modules/eslint/lib/rules/utils/unicode/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @author Toru Nagashima - */ -"use strict"; - -module.exports = { - isCombiningCharacter: require("./is-combining-character"), - isEmojiModifier: require("./is-emoji-modifier"), - isRegionalIndicatorSymbol: require("./is-regional-indicator-symbol"), - isSurrogatePair: require("./is-surrogate-pair") -}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js b/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js deleted file mode 100644 index 0498b99a2..000000000 --- a/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @author Toru Nagashima - */ -"use strict"; - -/** - * Check whether a given character is a combining mark or not. - * @param {number} codePoint The character code to check. - * @returns {boolean} `true` if the character belongs to the category, any of `Mc`, `Me`, and `Mn`. - */ -module.exports = function isCombiningCharacter(codePoint) { - return /^[\p{Mc}\p{Me}\p{Mn}]$/u.test(String.fromCodePoint(codePoint)); -}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js b/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js deleted file mode 100644 index 1bd5f557d..000000000 --- a/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @author Toru Nagashima - */ -"use strict"; - -/** - * Check whether a given character is an emoji modifier. - * @param {number} code The character code to check. - * @returns {boolean} `true` if the character is an emoji modifier. - */ -module.exports = function isEmojiModifier(code) { - return code >= 0x1F3FB && code <= 0x1F3FF; -}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js b/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js deleted file mode 100644 index c48ed46ef..000000000 --- a/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @author Toru Nagashima - */ -"use strict"; - -/** - * Check whether a given character is a regional indicator symbol. - * @param {number} code The character code to check. - * @returns {boolean} `true` if the character is a regional indicator symbol. - */ -module.exports = function isRegionalIndicatorSymbol(code) { - return code >= 0x1F1E6 && code <= 0x1F1FF; -}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js b/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js deleted file mode 100644 index b8e5c1cac..000000000 --- a/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @author Toru Nagashima - */ -"use strict"; - -/** - * Check whether given two characters are a surrogate pair. - * @param {number} lead The code of the lead character. - * @param {number} tail The code of the tail character. - * @returns {boolean} `true` if the character pair is a surrogate pair. - */ -module.exports = function isSurrogatePair(lead, tail) { - return lead >= 0xD800 && lead < 0xDC00 && tail >= 0xDC00 && tail < 0xE000; -}; diff --git a/node_modules/eslint/lib/rules/valid-jsdoc.js b/node_modules/eslint/lib/rules/valid-jsdoc.js deleted file mode 100644 index 919975fe1..000000000 --- a/node_modules/eslint/lib/rules/valid-jsdoc.js +++ /dev/null @@ -1,516 +0,0 @@ -/** - * @fileoverview Validates JSDoc comments are syntactically correct - * @author Nicholas C. Zakas - * @deprecated in ESLint v5.10.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const doctrine = require("doctrine"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce valid JSDoc comments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/valid-jsdoc" - }, - - schema: [ - { - type: "object", - properties: { - prefer: { - type: "object", - additionalProperties: { - type: "string" - } - }, - preferType: { - type: "object", - additionalProperties: { - type: "string" - } - }, - requireReturn: { - type: "boolean", - default: true - }, - requireParamDescription: { - type: "boolean", - default: true - }, - requireReturnDescription: { - type: "boolean", - default: true - }, - matchDescription: { - type: "string" - }, - requireReturnType: { - type: "boolean", - default: true - }, - requireParamType: { - type: "boolean", - default: true - } - }, - additionalProperties: false - } - ], - - fixable: "code", - messages: { - unexpectedTag: "Unexpected @{{title}} tag; function has no return statement.", - expected: "Expected JSDoc for '{{name}}' but found '{{jsdocName}}'.", - use: "Use @{{name}} instead.", - useType: "Use '{{expectedTypeName}}' instead of '{{currentTypeName}}'.", - syntaxError: "JSDoc syntax error.", - missingBrace: "JSDoc type missing brace.", - missingParamDesc: "Missing JSDoc parameter description for '{{name}}'.", - missingParamType: "Missing JSDoc parameter type for '{{name}}'.", - missingReturnType: "Missing JSDoc return type.", - missingReturnDesc: "Missing JSDoc return description.", - missingReturn: "Missing JSDoc @{{returns}} for function.", - missingParam: "Missing JSDoc for parameter '{{name}}'.", - duplicateParam: "Duplicate JSDoc parameter '{{name}}'.", - unsatisfiedDesc: "JSDoc description does not satisfy the regex pattern." - }, - - deprecated: true, - replacedBy: [] - }, - - create(context) { - - const options = context.options[0] || {}, - prefer = options.prefer || {}, - sourceCode = context.sourceCode, - - // these both default to true, so you have to explicitly make them false - requireReturn = options.requireReturn !== false, - requireParamDescription = options.requireParamDescription !== false, - requireReturnDescription = options.requireReturnDescription !== false, - requireReturnType = options.requireReturnType !== false, - requireParamType = options.requireParamType !== false, - preferType = options.preferType || {}, - checkPreferType = Object.keys(preferType).length !== 0; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - // Using a stack to store if a function returns or not (handling nested functions) - const fns = []; - - /** - * Check if node type is a Class - * @param {ASTNode} node node to check. - * @returns {boolean} True is its a class - * @private - */ - function isTypeClass(node) { - return node.type === "ClassExpression" || node.type === "ClassDeclaration"; - } - - /** - * When parsing a new function, store it in our function stack. - * @param {ASTNode} node A function node to check. - * @returns {void} - * @private - */ - function startFunction(node) { - fns.push({ - returnPresent: (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") || - isTypeClass(node) || node.async - }); - } - - /** - * Indicate that return has been found in the current function. - * @param {ASTNode} node The return node. - * @returns {void} - * @private - */ - function addReturn(node) { - const functionState = fns[fns.length - 1]; - - if (functionState && node.argument !== null) { - functionState.returnPresent = true; - } - } - - /** - * Check if return tag type is void or undefined - * @param {Object} tag JSDoc tag - * @returns {boolean} True if its of type void or undefined - * @private - */ - function isValidReturnType(tag) { - return tag.type === null || tag.type.name === "void" || tag.type.type === "UndefinedLiteral"; - } - - /** - * Check if type should be validated based on some exceptions - * @param {Object} type JSDoc tag - * @returns {boolean} True if it can be validated - * @private - */ - function canTypeBeValidated(type) { - return type !== "UndefinedLiteral" && // {undefined} as there is no name property available. - type !== "NullLiteral" && // {null} - type !== "NullableLiteral" && // {?} - type !== "FunctionType" && // {function(a)} - type !== "AllLiteral"; // {*} - } - - /** - * Extract the current and expected type based on the input type object - * @param {Object} type JSDoc tag - * @returns {{currentType: Doctrine.Type, expectedTypeName: string}} The current type annotation and - * the expected name of the annotation - * @private - */ - function getCurrentExpectedTypes(type) { - let currentType; - - if (type.name) { - currentType = type; - } else if (type.expression) { - currentType = type.expression; - } - - return { - currentType, - expectedTypeName: currentType && preferType[currentType.name] - }; - } - - /** - * Gets the location of a JSDoc node in a file - * @param {Token} jsdocComment The comment that this node is parsed from - * @param {{range: number[]}} parsedJsdocNode A tag or other node which was parsed from this comment - * @returns {{start: SourceLocation, end: SourceLocation}} The 0-based source location for the tag - */ - function getAbsoluteRange(jsdocComment, parsedJsdocNode) { - return { - start: sourceCode.getLocFromIndex(jsdocComment.range[0] + 2 + parsedJsdocNode.range[0]), - end: sourceCode.getLocFromIndex(jsdocComment.range[0] + 2 + parsedJsdocNode.range[1]) - }; - } - - /** - * Validate type for a given JSDoc node - * @param {Object} jsdocNode JSDoc node - * @param {Object} type JSDoc tag - * @returns {void} - * @private - */ - function validateType(jsdocNode, type) { - if (!type || !canTypeBeValidated(type.type)) { - return; - } - - const typesToCheck = []; - let elements = []; - - switch (type.type) { - case "TypeApplication": // {Array.} - elements = type.applications[0].type === "UnionType" ? type.applications[0].elements : type.applications; - typesToCheck.push(getCurrentExpectedTypes(type)); - break; - case "RecordType": // {{20:String}} - elements = type.fields; - break; - case "UnionType": // {String|number|Test} - case "ArrayType": // {[String, number, Test]} - elements = type.elements; - break; - case "FieldType": // Array.<{count: number, votes: number}> - if (type.value) { - typesToCheck.push(getCurrentExpectedTypes(type.value)); - } - break; - default: - typesToCheck.push(getCurrentExpectedTypes(type)); - } - - elements.forEach(validateType.bind(null, jsdocNode)); - - typesToCheck.forEach(typeToCheck => { - if (typeToCheck.expectedTypeName && - typeToCheck.expectedTypeName !== typeToCheck.currentType.name) { - context.report({ - node: jsdocNode, - messageId: "useType", - loc: getAbsoluteRange(jsdocNode, typeToCheck.currentType), - data: { - currentTypeName: typeToCheck.currentType.name, - expectedTypeName: typeToCheck.expectedTypeName - }, - fix(fixer) { - return fixer.replaceTextRange( - typeToCheck.currentType.range.map(indexInComment => jsdocNode.range[0] + 2 + indexInComment), - typeToCheck.expectedTypeName - ); - } - }); - } - }); - } - - /** - * Validate the JSDoc node and output warnings if anything is wrong. - * @param {ASTNode} node The AST node to check. - * @returns {void} - * @private - */ - function checkJSDoc(node) { - const jsdocNode = sourceCode.getJSDocComment(node), - functionData = fns.pop(), - paramTagsByName = Object.create(null), - paramTags = []; - let hasReturns = false, - returnsTag, - hasConstructor = false, - isInterface = false, - isOverride = false, - isAbstract = false; - - // make sure only to validate JSDoc comments - if (jsdocNode) { - let jsdoc; - - try { - jsdoc = doctrine.parse(jsdocNode.value, { - strict: true, - unwrap: true, - sloppy: true, - range: true - }); - } catch (ex) { - - if (/braces/iu.test(ex.message)) { - context.report({ node: jsdocNode, messageId: "missingBrace" }); - } else { - context.report({ node: jsdocNode, messageId: "syntaxError" }); - } - - return; - } - - jsdoc.tags.forEach(tag => { - - switch (tag.title.toLowerCase()) { - - case "param": - case "arg": - case "argument": - paramTags.push(tag); - break; - - case "return": - case "returns": - hasReturns = true; - returnsTag = tag; - break; - - case "constructor": - case "class": - hasConstructor = true; - break; - - case "override": - case "inheritdoc": - isOverride = true; - break; - - case "abstract": - case "virtual": - isAbstract = true; - break; - - case "interface": - isInterface = true; - break; - - // no default - } - - // check tag preferences - if (Object.prototype.hasOwnProperty.call(prefer, tag.title) && tag.title !== prefer[tag.title]) { - const entireTagRange = getAbsoluteRange(jsdocNode, tag); - - context.report({ - node: jsdocNode, - messageId: "use", - loc: { - start: entireTagRange.start, - end: { - line: entireTagRange.start.line, - column: entireTagRange.start.column + `@${tag.title}`.length - } - }, - data: { name: prefer[tag.title] }, - fix(fixer) { - return fixer.replaceTextRange( - [ - jsdocNode.range[0] + tag.range[0] + 3, - jsdocNode.range[0] + tag.range[0] + tag.title.length + 3 - ], - prefer[tag.title] - ); - } - }); - } - - // validate the types - if (checkPreferType && tag.type) { - validateType(jsdocNode, tag.type); - } - }); - - paramTags.forEach(param => { - if (requireParamType && !param.type) { - context.report({ - node: jsdocNode, - messageId: "missingParamType", - loc: getAbsoluteRange(jsdocNode, param), - data: { name: param.name } - }); - } - if (!param.description && requireParamDescription) { - context.report({ - node: jsdocNode, - messageId: "missingParamDesc", - loc: getAbsoluteRange(jsdocNode, param), - data: { name: param.name } - }); - } - if (paramTagsByName[param.name]) { - context.report({ - node: jsdocNode, - messageId: "duplicateParam", - loc: getAbsoluteRange(jsdocNode, param), - data: { name: param.name } - }); - } else if (!param.name.includes(".")) { - paramTagsByName[param.name] = param; - } - }); - - if (hasReturns) { - if (!requireReturn && !functionData.returnPresent && (returnsTag.type === null || !isValidReturnType(returnsTag)) && !isAbstract) { - context.report({ - node: jsdocNode, - messageId: "unexpectedTag", - loc: getAbsoluteRange(jsdocNode, returnsTag), - data: { - title: returnsTag.title - } - }); - } else { - if (requireReturnType && !returnsTag.type) { - context.report({ node: jsdocNode, messageId: "missingReturnType" }); - } - - if (!isValidReturnType(returnsTag) && !returnsTag.description && requireReturnDescription) { - context.report({ node: jsdocNode, messageId: "missingReturnDesc" }); - } - } - } - - // check for functions missing @returns - if (!isOverride && !hasReturns && !hasConstructor && !isInterface && - node.parent.kind !== "get" && node.parent.kind !== "constructor" && - node.parent.kind !== "set" && !isTypeClass(node)) { - if (requireReturn || (functionData.returnPresent && !node.async)) { - context.report({ - node: jsdocNode, - messageId: "missingReturn", - data: { - returns: prefer.returns || "returns" - } - }); - } - } - - // check the parameters - const jsdocParamNames = Object.keys(paramTagsByName); - - if (node.params) { - node.params.forEach((param, paramsIndex) => { - const bindingParam = param.type === "AssignmentPattern" - ? param.left - : param; - - // TODO(nzakas): Figure out logical things to do with destructured, default, rest params - if (bindingParam.type === "Identifier") { - const name = bindingParam.name; - - if (jsdocParamNames[paramsIndex] && (name !== jsdocParamNames[paramsIndex])) { - context.report({ - node: jsdocNode, - messageId: "expected", - loc: getAbsoluteRange(jsdocNode, paramTagsByName[jsdocParamNames[paramsIndex]]), - data: { - name, - jsdocName: jsdocParamNames[paramsIndex] - } - }); - } else if (!paramTagsByName[name] && !isOverride) { - context.report({ - node: jsdocNode, - messageId: "missingParam", - data: { - name - } - }); - } - } - }); - } - - if (options.matchDescription) { - const regex = new RegExp(options.matchDescription, "u"); - - if (!regex.test(jsdoc.description)) { - context.report({ node: jsdocNode, messageId: "unsatisfiedDesc" }); - } - } - - } - - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - ArrowFunctionExpression: startFunction, - FunctionExpression: startFunction, - FunctionDeclaration: startFunction, - ClassExpression: startFunction, - ClassDeclaration: startFunction, - "ArrowFunctionExpression:exit": checkJSDoc, - "FunctionExpression:exit": checkJSDoc, - "FunctionDeclaration:exit": checkJSDoc, - "ClassExpression:exit": checkJSDoc, - "ClassDeclaration:exit": checkJSDoc, - ReturnStatement: addReturn - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/valid-typeof.js b/node_modules/eslint/lib/rules/valid-typeof.js deleted file mode 100644 index 82af130f9..000000000 --- a/node_modules/eslint/lib/rules/valid-typeof.js +++ /dev/null @@ -1,121 +0,0 @@ -/** - * @fileoverview Ensures that the results of typeof are compared against a valid string - * @author Ian Christian Myers - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Enforce comparing `typeof` expressions against valid strings", - recommended: true, - url: "https://eslint.org/docs/latest/rules/valid-typeof" - }, - - hasSuggestions: true, - - schema: [ - { - type: "object", - properties: { - requireStringLiterals: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - messages: { - invalidValue: "Invalid typeof comparison value.", - notString: "Typeof comparisons should be to string literals.", - suggestString: 'Use `"{{type}}"` instead of `{{type}}`.' - } - }, - - create(context) { - - const VALID_TYPES = new Set(["symbol", "undefined", "object", "boolean", "number", "string", "function", "bigint"]), - OPERATORS = new Set(["==", "===", "!=", "!=="]); - const sourceCode = context.sourceCode; - const requireStringLiterals = context.options[0] && context.options[0].requireStringLiterals; - - let globalScope; - - /** - * Checks whether the given node represents a reference to a global variable that is not declared in the source code. - * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a reference to a global variable. - */ - function isReferenceToGlobalVariable(node) { - const variable = globalScope.set.get(node.name); - - return variable && variable.defs.length === 0 && - variable.references.some(ref => ref.identifier === node); - } - - /** - * Determines whether a node is a typeof expression. - * @param {ASTNode} node The node - * @returns {boolean} `true` if the node is a typeof expression - */ - function isTypeofExpression(node) { - return node.type === "UnaryExpression" && node.operator === "typeof"; - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - Program(node) { - globalScope = sourceCode.getScope(node); - }, - - UnaryExpression(node) { - if (isTypeofExpression(node)) { - const { parent } = node; - - if (parent.type === "BinaryExpression" && OPERATORS.has(parent.operator)) { - const sibling = parent.left === node ? parent.right : parent.left; - - if (sibling.type === "Literal" || sibling.type === "TemplateLiteral" && !sibling.expressions.length) { - const value = sibling.type === "Literal" ? sibling.value : sibling.quasis[0].value.cooked; - - if (!VALID_TYPES.has(value)) { - context.report({ node: sibling, messageId: "invalidValue" }); - } - } else if (sibling.type === "Identifier" && sibling.name === "undefined" && isReferenceToGlobalVariable(sibling)) { - context.report({ - node: sibling, - messageId: requireStringLiterals ? "notString" : "invalidValue", - suggest: [ - { - messageId: "suggestString", - data: { type: "undefined" }, - fix(fixer) { - return fixer.replaceText(sibling, '"undefined"'); - } - } - ] - }); - } else if (requireStringLiterals && !isTypeofExpression(sibling)) { - context.report({ node: sibling, messageId: "notString" }); - } - } - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/vars-on-top.js b/node_modules/eslint/lib/rules/vars-on-top.js deleted file mode 100644 index 81f5d62d0..000000000 --- a/node_modules/eslint/lib/rules/vars-on-top.js +++ /dev/null @@ -1,157 +0,0 @@ -/** - * @fileoverview Rule to enforce var declarations are only at the top of a function. - * @author Danny Fritz - * @author Gyandeep Singh - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require `var` declarations be placed at the top of their containing scope", - recommended: false, - url: "https://eslint.org/docs/latest/rules/vars-on-top" - }, - - schema: [], - messages: { - top: "All 'var' declarations must be at the top of the function scope." - } - }, - - create(context) { - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Has AST suggesting a directive. - * @param {ASTNode} node any node - * @returns {boolean} whether the given node structurally represents a directive - */ - function looksLikeDirective(node) { - return node.type === "ExpressionStatement" && - node.expression.type === "Literal" && typeof node.expression.value === "string"; - } - - /** - * Check to see if its a ES6 import declaration - * @param {ASTNode} node any node - * @returns {boolean} whether the given node represents a import declaration - */ - function looksLikeImport(node) { - return node.type === "ImportDeclaration" || node.type === "ImportSpecifier" || - node.type === "ImportDefaultSpecifier" || node.type === "ImportNamespaceSpecifier"; - } - - /** - * Checks whether a given node is a variable declaration or not. - * @param {ASTNode} node any node - * @returns {boolean} `true` if the node is a variable declaration. - */ - function isVariableDeclaration(node) { - return ( - node.type === "VariableDeclaration" || - ( - node.type === "ExportNamedDeclaration" && - node.declaration && - node.declaration.type === "VariableDeclaration" - ) - ); - } - - /** - * Checks whether this variable is on top of the block body - * @param {ASTNode} node The node to check - * @param {ASTNode[]} statements collection of ASTNodes for the parent node block - * @returns {boolean} True if var is on top otherwise false - */ - function isVarOnTop(node, statements) { - const l = statements.length; - let i = 0; - - // Skip over directives and imports. Static blocks don't have either. - if (node.parent.type !== "StaticBlock") { - for (; i < l; ++i) { - if (!looksLikeDirective(statements[i]) && !looksLikeImport(statements[i])) { - break; - } - } - } - - for (; i < l; ++i) { - if (!isVariableDeclaration(statements[i])) { - return false; - } - if (statements[i] === node) { - return true; - } - } - - return false; - } - - /** - * Checks whether variable is on top at the global level - * @param {ASTNode} node The node to check - * @param {ASTNode} parent Parent of the node - * @returns {void} - */ - function globalVarCheck(node, parent) { - if (!isVarOnTop(node, parent.body)) { - context.report({ node, messageId: "top" }); - } - } - - /** - * Checks whether variable is on top at functional block scope level - * @param {ASTNode} node The node to check - * @returns {void} - */ - function blockScopeVarCheck(node) { - const { parent } = node; - - if ( - parent.type === "BlockStatement" && - /Function/u.test(parent.parent.type) && - isVarOnTop(node, parent.body) - ) { - return; - } - - if ( - parent.type === "StaticBlock" && - isVarOnTop(node, parent.body) - ) { - return; - } - - context.report({ node, messageId: "top" }); - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - "VariableDeclaration[kind='var']"(node) { - if (node.parent.type === "ExportNamedDeclaration") { - globalVarCheck(node.parent, node.parent.parent); - } else if (node.parent.type === "Program") { - globalVarCheck(node, node.parent); - } else { - blockScopeVarCheck(node); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/wrap-iife.js b/node_modules/eslint/lib/rules/wrap-iife.js deleted file mode 100644 index 4c448fa79..000000000 --- a/node_modules/eslint/lib/rules/wrap-iife.js +++ /dev/null @@ -1,204 +0,0 @@ -/** - * @fileoverview Rule to flag when IIFE is not wrapped in parens - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const eslintUtils = require("@eslint-community/eslint-utils"); - -//---------------------------------------------------------------------- -// Helpers -//---------------------------------------------------------------------- - -/** - * Check if the given node is callee of a `NewExpression` node - * @param {ASTNode} node node to check - * @returns {boolean} True if the node is callee of a `NewExpression` node - * @private - */ -function isCalleeOfNewExpression(node) { - const maybeCallee = node.parent.type === "ChainExpression" - ? node.parent - : node; - - return ( - maybeCallee.parent.type === "NewExpression" && - maybeCallee.parent.callee === maybeCallee - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require parentheses around immediate `function` invocations", - recommended: false, - url: "https://eslint.org/docs/latest/rules/wrap-iife" - }, - - schema: [ - { - enum: ["outside", "inside", "any"] - }, - { - type: "object", - properties: { - functionPrototypeMethods: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - fixable: "code", - messages: { - wrapInvocation: "Wrap an immediate function invocation in parentheses.", - wrapExpression: "Wrap only the function expression in parens.", - moveInvocation: "Move the invocation into the parens that contain the function." - } - }, - - create(context) { - - const style = context.options[0] || "outside"; - const includeFunctionPrototypeMethods = context.options[1] && context.options[1].functionPrototypeMethods; - - const sourceCode = context.sourceCode; - - /** - * Check if the node is wrapped in any (). All parens count: grouping parens and parens for constructs such as if() - * @param {ASTNode} node node to evaluate - * @returns {boolean} True if it is wrapped in any parens - * @private - */ - function isWrappedInAnyParens(node) { - return astUtils.isParenthesised(sourceCode, node); - } - - /** - * Check if the node is wrapped in grouping (). Parens for constructs such as if() don't count - * @param {ASTNode} node node to evaluate - * @returns {boolean} True if it is wrapped in grouping parens - * @private - */ - function isWrappedInGroupingParens(node) { - return eslintUtils.isParenthesized(1, node, sourceCode); - } - - /** - * Get the function node from an IIFE - * @param {ASTNode} node node to evaluate - * @returns {ASTNode} node that is the function expression of the given IIFE, or null if none exist - */ - function getFunctionNodeFromIIFE(node) { - const callee = astUtils.skipChainExpression(node.callee); - - if (callee.type === "FunctionExpression") { - return callee; - } - - if (includeFunctionPrototypeMethods && - callee.type === "MemberExpression" && - callee.object.type === "FunctionExpression" && - (astUtils.getStaticPropertyName(callee) === "call" || astUtils.getStaticPropertyName(callee) === "apply") - ) { - return callee.object; - } - - return null; - } - - - return { - CallExpression(node) { - const innerNode = getFunctionNodeFromIIFE(node); - - if (!innerNode) { - return; - } - - const isCallExpressionWrapped = isWrappedInAnyParens(node), - isFunctionExpressionWrapped = isWrappedInAnyParens(innerNode); - - if (!isCallExpressionWrapped && !isFunctionExpressionWrapped) { - context.report({ - node, - messageId: "wrapInvocation", - fix(fixer) { - const nodeToSurround = style === "inside" ? innerNode : node; - - return fixer.replaceText(nodeToSurround, `(${sourceCode.getText(nodeToSurround)})`); - } - }); - } else if (style === "inside" && !isFunctionExpressionWrapped) { - context.report({ - node, - messageId: "wrapExpression", - fix(fixer) { - - // The outer call expression will always be wrapped at this point. - - if (isWrappedInGroupingParens(node) && !isCalleeOfNewExpression(node)) { - - /* - * Parenthesize the function expression and remove unnecessary grouping parens around the call expression. - * Replace the range between the end of the function expression and the end of the call expression. - * for example, in `(function(foo) {}(bar))`, the range `(bar))` should get replaced with `)(bar)`. - */ - - const parenAfter = sourceCode.getTokenAfter(node); - - return fixer.replaceTextRange( - [innerNode.range[1], parenAfter.range[1]], - `)${sourceCode.getText().slice(innerNode.range[1], parenAfter.range[0])}` - ); - } - - /* - * Call expression is wrapped in mandatory parens such as if(), or in necessary grouping parens. - * These parens cannot be removed, so just parenthesize the function expression. - */ - - return fixer.replaceText(innerNode, `(${sourceCode.getText(innerNode)})`); - } - }); - } else if (style === "outside" && !isCallExpressionWrapped) { - context.report({ - node, - messageId: "moveInvocation", - fix(fixer) { - - /* - * The inner function expression will always be wrapped at this point. - * It's only necessary to replace the range between the end of the function expression - * and the call expression. For example, in `(function(foo) {})(bar)`, the range `)(bar)` - * should get replaced with `(bar))`. - */ - const parenAfter = sourceCode.getTokenAfter(innerNode); - - return fixer.replaceTextRange( - [parenAfter.range[0], node.range[1]], - `${sourceCode.getText().slice(parenAfter.range[1], node.range[1])})` - ); - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/wrap-regex.js b/node_modules/eslint/lib/rules/wrap-regex.js deleted file mode 100644 index 8166c252f..000000000 --- a/node_modules/eslint/lib/rules/wrap-regex.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @fileoverview Rule to flag when regex literals are not wrapped in parens - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require parenthesis around regex literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/wrap-regex" - }, - - schema: [], - fixable: "code", - - messages: { - requireParens: "Wrap the regexp literal in parens to disambiguate the slash." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - - Literal(node) { - const token = sourceCode.getFirstToken(node), - nodeType = token.type; - - if (nodeType === "RegularExpression") { - const beforeToken = sourceCode.getTokenBefore(node); - const afterToken = sourceCode.getTokenAfter(node); - const { parent } = node; - - if (parent.type === "MemberExpression" && parent.object === node && - !(beforeToken && beforeToken.value === "(" && afterToken && afterToken.value === ")")) { - context.report({ - node, - messageId: "requireParens", - fix: fixer => fixer.replaceText(node, `(${sourceCode.getText(node)})`) - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/yield-star-spacing.js b/node_modules/eslint/lib/rules/yield-star-spacing.js deleted file mode 100644 index 9f9d918ae..000000000 --- a/node_modules/eslint/lib/rules/yield-star-spacing.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - * @fileoverview Rule to check the spacing around the * in yield* expressions. - * @author Bryan Smith - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Require or disallow spacing around the `*` in `yield*` expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/yield-star-spacing" - }, - - fixable: "whitespace", - - schema: [ - { - oneOf: [ - { - enum: ["before", "after", "both", "neither"] - }, - { - type: "object", - properties: { - before: { type: "boolean" }, - after: { type: "boolean" } - }, - additionalProperties: false - } - ] - } - ], - messages: { - missingBefore: "Missing space before *.", - missingAfter: "Missing space after *.", - unexpectedBefore: "Unexpected space before *.", - unexpectedAfter: "Unexpected space after *." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - const mode = (function(option) { - if (!option || typeof option === "string") { - return { - before: { before: true, after: false }, - after: { before: false, after: true }, - both: { before: true, after: true }, - neither: { before: false, after: false } - }[option || "after"]; - } - return option; - }(context.options[0])); - - /** - * Checks the spacing between two tokens before or after the star token. - * @param {string} side Either "before" or "after". - * @param {Token} leftToken `function` keyword token if side is "before", or - * star token if side is "after". - * @param {Token} rightToken Star token if side is "before", or identifier - * token if side is "after". - * @returns {void} - */ - function checkSpacing(side, leftToken, rightToken) { - if (sourceCode.isSpaceBetweenTokens(leftToken, rightToken) !== mode[side]) { - const after = leftToken.value === "*"; - const spaceRequired = mode[side]; - const node = after ? leftToken : rightToken; - let messageId = ""; - - if (spaceRequired) { - messageId = side === "before" ? "missingBefore" : "missingAfter"; - } else { - messageId = side === "before" ? "unexpectedBefore" : "unexpectedAfter"; - } - - context.report({ - node, - messageId, - fix(fixer) { - if (spaceRequired) { - if (after) { - return fixer.insertTextAfter(node, " "); - } - return fixer.insertTextBefore(node, " "); - } - return fixer.removeRange([leftToken.range[1], rightToken.range[0]]); - } - }); - } - } - - /** - * Enforces the spacing around the star if node is a yield* expression. - * @param {ASTNode} node A yield expression node. - * @returns {void} - */ - function checkExpression(node) { - if (!node.delegate) { - return; - } - - const tokens = sourceCode.getFirstTokens(node, 3); - const yieldToken = tokens[0]; - const starToken = tokens[1]; - const nextToken = tokens[2]; - - checkSpacing("before", yieldToken, starToken); - checkSpacing("after", starToken, nextToken); - } - - return { - YieldExpression: checkExpression - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/yoda.js b/node_modules/eslint/lib/rules/yoda.js deleted file mode 100644 index 60a6ad2f2..000000000 --- a/node_modules/eslint/lib/rules/yoda.js +++ /dev/null @@ -1,362 +0,0 @@ -/** - * @fileoverview Rule to require or disallow yoda comparisons - * @author Nicholas C. Zakas - */ -"use strict"; - -//-------------------------------------------------------------------------- -// Requirements -//-------------------------------------------------------------------------- - -const astUtils = require("./utils/ast-utils"); - -//-------------------------------------------------------------------------- -// Helpers -//-------------------------------------------------------------------------- - -/** - * Determines whether an operator is a comparison operator. - * @param {string} operator The operator to check. - * @returns {boolean} Whether or not it is a comparison operator. - */ -function isComparisonOperator(operator) { - return /^(==|===|!=|!==|<|>|<=|>=)$/u.test(operator); -} - -/** - * Determines whether an operator is an equality operator. - * @param {string} operator The operator to check. - * @returns {boolean} Whether or not it is an equality operator. - */ -function isEqualityOperator(operator) { - return /^(==|===)$/u.test(operator); -} - -/** - * Determines whether an operator is one used in a range test. - * Allowed operators are `<` and `<=`. - * @param {string} operator The operator to check. - * @returns {boolean} Whether the operator is used in range tests. - */ -function isRangeTestOperator(operator) { - return ["<", "<="].includes(operator); -} - -/** - * Determines whether a non-Literal node is a negative number that should be - * treated as if it were a single Literal node. - * @param {ASTNode} node Node to test. - * @returns {boolean} True if the node is a negative number that looks like a - * real literal and should be treated as such. - */ -function isNegativeNumericLiteral(node) { - return ( - node.type === "UnaryExpression" && - node.operator === "-" && - node.prefix && - astUtils.isNumericLiteral(node.argument) - ); -} - -/** - * Determines whether a node is a Template Literal which can be determined statically. - * @param {ASTNode} node Node to test - * @returns {boolean} True if the node is a Template Literal without expression. - */ -function isStaticTemplateLiteral(node) { - return node.type === "TemplateLiteral" && node.expressions.length === 0; -} - -/** - * Determines whether a non-Literal node should be treated as a single Literal node. - * @param {ASTNode} node Node to test - * @returns {boolean} True if the node should be treated as a single Literal node. - */ -function looksLikeLiteral(node) { - return isNegativeNumericLiteral(node) || isStaticTemplateLiteral(node); -} - -/** - * Attempts to derive a Literal node from nodes that are treated like literals. - * @param {ASTNode} node Node to normalize. - * @returns {ASTNode} One of the following options. - * 1. The original node if the node is already a Literal - * 2. A normalized Literal node with the negative number as the value if the - * node represents a negative number literal. - * 3. A normalized Literal node with the string as the value if the node is - * a Template Literal without expression. - * 4. Otherwise `null`. - */ -function getNormalizedLiteral(node) { - if (node.type === "Literal") { - return node; - } - - if (isNegativeNumericLiteral(node)) { - return { - type: "Literal", - value: -node.argument.value, - raw: `-${node.argument.value}` - }; - } - - if (isStaticTemplateLiteral(node)) { - return { - type: "Literal", - value: node.quasis[0].value.cooked, - raw: node.quasis[0].value.raw - }; - } - - return null; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: 'Require or disallow "Yoda" conditions', - recommended: false, - url: "https://eslint.org/docs/latest/rules/yoda" - }, - - schema: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - exceptRange: { - type: "boolean", - default: false - }, - onlyEquality: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - fixable: "code", - messages: { - expected: - "Expected literal to be on the {{expectedSide}} side of {{operator}}." - } - }, - - create(context) { - - // Default to "never" (!always) if no option - const always = context.options[0] === "always"; - const exceptRange = - context.options[1] && context.options[1].exceptRange; - const onlyEquality = - context.options[1] && context.options[1].onlyEquality; - - const sourceCode = context.sourceCode; - - /** - * Determines whether node represents a range test. - * A range test is a "between" test like `(0 <= x && x < 1)` or an "outside" - * test like `(x < 0 || 1 <= x)`. It must be wrapped in parentheses, and - * both operators must be `<` or `<=`. Finally, the literal on the left side - * must be less than or equal to the literal on the right side so that the - * test makes any sense. - * @param {ASTNode} node LogicalExpression node to test. - * @returns {boolean} Whether node is a range test. - */ - function isRangeTest(node) { - const left = node.left, - right = node.right; - - /** - * Determines whether node is of the form `0 <= x && x < 1`. - * @returns {boolean} Whether node is a "between" range test. - */ - function isBetweenTest() { - if (node.operator === "&&" && astUtils.isSameReference(left.right, right.left)) { - const leftLiteral = getNormalizedLiteral(left.left); - const rightLiteral = getNormalizedLiteral(right.right); - - if (leftLiteral === null && rightLiteral === null) { - return false; - } - - if (rightLiteral === null || leftLiteral === null) { - return true; - } - - if (leftLiteral.value <= rightLiteral.value) { - return true; - } - } - return false; - } - - /** - * Determines whether node is of the form `x < 0 || 1 <= x`. - * @returns {boolean} Whether node is an "outside" range test. - */ - function isOutsideTest() { - if (node.operator === "||" && astUtils.isSameReference(left.left, right.right)) { - const leftLiteral = getNormalizedLiteral(left.right); - const rightLiteral = getNormalizedLiteral(right.left); - - if (leftLiteral === null && rightLiteral === null) { - return false; - } - - if (rightLiteral === null || leftLiteral === null) { - return true; - } - - if (leftLiteral.value <= rightLiteral.value) { - return true; - } - } - - return false; - } - - /** - * Determines whether node is wrapped in parentheses. - * @returns {boolean} Whether node is preceded immediately by an open - * paren token and followed immediately by a close - * paren token. - */ - function isParenWrapped() { - return astUtils.isParenthesised(sourceCode, node); - } - - return ( - node.type === "LogicalExpression" && - left.type === "BinaryExpression" && - right.type === "BinaryExpression" && - isRangeTestOperator(left.operator) && - isRangeTestOperator(right.operator) && - (isBetweenTest() || isOutsideTest()) && - isParenWrapped() - ); - } - - const OPERATOR_FLIP_MAP = { - "===": "===", - "!==": "!==", - "==": "==", - "!=": "!=", - "<": ">", - ">": "<", - "<=": ">=", - ">=": "<=" - }; - - /** - * Returns a string representation of a BinaryExpression node with its sides/operator flipped around. - * @param {ASTNode} node The BinaryExpression node - * @returns {string} A string representation of the node with the sides and operator flipped - */ - function getFlippedString(node) { - const operatorToken = sourceCode.getFirstTokenBetween( - node.left, - node.right, - token => token.value === node.operator - ); - const lastLeftToken = sourceCode.getTokenBefore(operatorToken); - const firstRightToken = sourceCode.getTokenAfter(operatorToken); - - const source = sourceCode.getText(); - - const leftText = source.slice( - node.range[0], - lastLeftToken.range[1] - ); - const textBeforeOperator = source.slice( - lastLeftToken.range[1], - operatorToken.range[0] - ); - const textAfterOperator = source.slice( - operatorToken.range[1], - firstRightToken.range[0] - ); - const rightText = source.slice( - firstRightToken.range[0], - node.range[1] - ); - - const tokenBefore = sourceCode.getTokenBefore(node); - const tokenAfter = sourceCode.getTokenAfter(node); - let prefix = ""; - let suffix = ""; - - if ( - tokenBefore && - tokenBefore.range[1] === node.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, firstRightToken) - ) { - prefix = " "; - } - - if ( - tokenAfter && - node.range[1] === tokenAfter.range[0] && - !astUtils.canTokensBeAdjacent(lastLeftToken, tokenAfter) - ) { - suffix = " "; - } - - return ( - prefix + - rightText + - textBeforeOperator + - OPERATOR_FLIP_MAP[operatorToken.value] + - textAfterOperator + - leftText + - suffix - ); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - BinaryExpression(node) { - const expectedLiteral = always ? node.left : node.right; - const expectedNonLiteral = always ? node.right : node.left; - - // If `expectedLiteral` is not a literal, and `expectedNonLiteral` is a literal, raise an error. - if ( - (expectedNonLiteral.type === "Literal" || - looksLikeLiteral(expectedNonLiteral)) && - !( - expectedLiteral.type === "Literal" || - looksLikeLiteral(expectedLiteral) - ) && - !(!isEqualityOperator(node.operator) && onlyEquality) && - isComparisonOperator(node.operator) && - !(exceptRange && isRangeTest(node.parent)) - ) { - context.report({ - node, - messageId: "expected", - data: { - operator: node.operator, - expectedSide: always ? "left" : "right" - }, - fix: fixer => - fixer.replaceText(node, getFlippedString(node)) - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/shared/ajv.js b/node_modules/eslint/lib/shared/ajv.js deleted file mode 100644 index f4f6a6218..000000000 --- a/node_modules/eslint/lib/shared/ajv.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @fileoverview The instance of Ajv validator. - * @author Evgeny Poberezkin - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Ajv = require("ajv"), - metaSchema = require("ajv/lib/refs/json-schema-draft-04.json"); - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = (additionalOptions = {}) => { - const ajv = new Ajv({ - meta: false, - useDefaults: true, - validateSchema: false, - missingRefs: "ignore", - verbose: true, - schemaId: "auto", - ...additionalOptions - }); - - ajv.addMetaSchema(metaSchema); - // eslint-disable-next-line no-underscore-dangle -- Ajv's API - ajv._opts.defaultMeta = metaSchema.id; - - return ajv; -}; diff --git a/node_modules/eslint/lib/shared/ast-utils.js b/node_modules/eslint/lib/shared/ast-utils.js deleted file mode 100644 index 4ebd49c3c..000000000 --- a/node_modules/eslint/lib/shared/ast-utils.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @fileoverview Common utils for AST. - * - * This file contains only shared items for core and rules. - * If you make a utility for rules, please see `../rules/utils/ast-utils.js`. - * - * @author Toru Nagashima - */ -"use strict"; - -const breakableTypePattern = /^(?:(?:Do)?While|For(?:In|Of)?|Switch)Statement$/u; -const lineBreakPattern = /\r\n|[\r\n\u2028\u2029]/u; -const shebangPattern = /^#!([^\r\n]+)/u; - -/** - * Creates a version of the `lineBreakPattern` regex with the global flag. - * Global regexes are mutable, so this needs to be a function instead of a constant. - * @returns {RegExp} A global regular expression that matches line terminators - */ -function createGlobalLinebreakMatcher() { - return new RegExp(lineBreakPattern.source, "gu"); -} - -module.exports = { - breakableTypePattern, - lineBreakPattern, - createGlobalLinebreakMatcher, - shebangPattern -}; diff --git a/node_modules/eslint/lib/shared/config-validator.js b/node_modules/eslint/lib/shared/config-validator.js deleted file mode 100644 index 47353ac48..000000000 --- a/node_modules/eslint/lib/shared/config-validator.js +++ /dev/null @@ -1,347 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * @fileoverview Validates configs. - * @author Brandon Mills - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const - util = require("util"), - configSchema = require("../../conf/config-schema"), - BuiltInRules = require("../rules"), - { - Legacy: { - ConfigOps, - environments: BuiltInEnvironments - } - } = require("@eslint/eslintrc"), - { emitDeprecationWarning } = require("./deprecation-warnings"); - -const ajv = require("./ajv")(); -const ruleValidators = new WeakMap(); -const noop = Function.prototype; - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ -let validateSchema; -const severityMap = { - error: 2, - warn: 1, - off: 0 -}; - -/** - * Gets a complete options schema for a rule. - * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object - * @returns {Object} JSON Schema for the rule's options. - */ -function getRuleOptionsSchema(rule) { - if (!rule) { - return null; - } - - const schema = rule.schema || rule.meta && rule.meta.schema; - - // Given a tuple of schemas, insert warning level at the beginning - if (Array.isArray(schema)) { - if (schema.length) { - return { - type: "array", - items: schema, - minItems: 0, - maxItems: schema.length - }; - } - return { - type: "array", - minItems: 0, - maxItems: 0 - }; - - } - - // Given a full schema, leave it alone - return schema || null; -} - -/** - * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. - * @param {options} options The given options for the rule. - * @throws {Error} Wrong severity value. - * @returns {number|string} The rule's severity value - */ -function validateRuleSeverity(options) { - const severity = Array.isArray(options) ? options[0] : options; - const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity; - - if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { - return normSeverity; - } - - throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`); - -} - -/** - * Validates the non-severity options passed to a rule, based on its schema. - * @param {{create: Function}} rule The rule to validate - * @param {Array} localOptions The options for the rule, excluding severity - * @throws {Error} Any rule validation errors. - * @returns {void} - */ -function validateRuleSchema(rule, localOptions) { - if (!ruleValidators.has(rule)) { - const schema = getRuleOptionsSchema(rule); - - if (schema) { - ruleValidators.set(rule, ajv.compile(schema)); - } - } - - const validateRule = ruleValidators.get(rule); - - if (validateRule) { - validateRule(localOptions); - if (validateRule.errors) { - throw new Error(validateRule.errors.map( - error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` - ).join("")); - } - } -} - -/** - * Validates a rule's options against its schema. - * @param {{create: Function}|null} rule The rule that the config is being validated for - * @param {string} ruleId The rule's unique name. - * @param {Array|number} options The given options for the rule. - * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined, - * no source is prepended to the message. - * @throws {Error} Upon any bad rule configuration. - * @returns {void} - */ -function validateRuleOptions(rule, ruleId, options, source = null) { - try { - const severity = validateRuleSeverity(options); - - if (severity !== 0) { - validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); - } - } catch (err) { - const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; - - if (typeof source === "string") { - throw new Error(`${source}:\n\t${enhancedMessage}`); - } else { - throw new Error(enhancedMessage); - } - } -} - -/** - * Validates an environment object - * @param {Object} environment The environment config object to validate. - * @param {string} source The name of the configuration source to report in any errors. - * @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments. - * @returns {void} - */ -function validateEnvironment( - environment, - source, - getAdditionalEnv = noop -) { - - // not having an environment is ok - if (!environment) { - return; - } - - Object.keys(environment).forEach(id => { - const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null; - - if (!env) { - const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; - - throw new Error(message); - } - }); -} - -/** - * Validates a rules config object - * @param {Object} rulesConfig The rules config object to validate. - * @param {string} source The name of the configuration source to report in any errors. - * @param {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules - * @returns {void} - */ -function validateRules( - rulesConfig, - source, - getAdditionalRule = noop -) { - if (!rulesConfig) { - return; - } - - Object.keys(rulesConfig).forEach(id => { - const rule = getAdditionalRule(id) || BuiltInRules.get(id) || null; - - validateRuleOptions(rule, id, rulesConfig[id], source); - }); -} - -/** - * Validates a `globals` section of a config file - * @param {Object} globalsConfig The `globals` section - * @param {string|null} source The name of the configuration source to report in the event of an error. - * @returns {void} - */ -function validateGlobals(globalsConfig, source = null) { - if (!globalsConfig) { - return; - } - - Object.entries(globalsConfig) - .forEach(([configuredGlobal, configuredValue]) => { - try { - ConfigOps.normalizeConfigGlobal(configuredValue); - } catch (err) { - throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`); - } - }); -} - -/** - * Validate `processor` configuration. - * @param {string|undefined} processorName The processor name. - * @param {string} source The name of config file. - * @param {(id:string) => Processor} getProcessor The getter of defined processors. - * @throws {Error} For invalid processor configuration. - * @returns {void} - */ -function validateProcessor(processorName, source, getProcessor) { - if (processorName && !getProcessor(processorName)) { - throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`); - } -} - -/** - * Formats an array of schema validation errors. - * @param {Array} errors An array of error messages to format. - * @returns {string} Formatted error message - */ -function formatErrors(errors) { - return errors.map(error => { - if (error.keyword === "additionalProperties") { - const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty; - - return `Unexpected top-level property "${formattedPropertyPath}"`; - } - if (error.keyword === "type") { - const formattedField = error.dataPath.slice(1); - const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema; - const formattedValue = JSON.stringify(error.data); - - return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; - } - - const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; - - return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`; - }).map(message => `\t- ${message}.\n`).join(""); -} - -/** - * Validates the top level properties of the config object. - * @param {Object} config The config object to validate. - * @param {string} source The name of the configuration source to report in any errors. - * @throws {Error} For any config invalid per the schema. - * @returns {void} - */ -function validateConfigSchema(config, source = null) { - validateSchema = validateSchema || ajv.compile(configSchema); - - if (!validateSchema(config)) { - throw new Error(`ESLint configuration in ${source} is invalid:\n${formatErrors(validateSchema.errors)}`); - } - - if (Object.hasOwnProperty.call(config, "ecmaFeatures")) { - emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES"); - } -} - -/** - * Validates an entire config object. - * @param {Object} config The config object to validate. - * @param {string} source The name of the configuration source to report in any errors. - * @param {(ruleId:string) => Object} [getAdditionalRule] A map from strings to loaded rules. - * @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded envs. - * @returns {void} - */ -function validate(config, source, getAdditionalRule, getAdditionalEnv) { - validateConfigSchema(config, source); - validateRules(config.rules, source, getAdditionalRule); - validateEnvironment(config.env, source, getAdditionalEnv); - validateGlobals(config.globals, source); - - for (const override of config.overrides || []) { - validateRules(override.rules, source, getAdditionalRule); - validateEnvironment(override.env, source, getAdditionalEnv); - validateGlobals(config.globals, source); - } -} - -const validated = new WeakSet(); - -/** - * Validate config array object. - * @param {ConfigArray} configArray The config array to validate. - * @returns {void} - */ -function validateConfigArray(configArray) { - const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments); - const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors); - const getPluginRule = Map.prototype.get.bind(configArray.pluginRules); - - // Validate. - for (const element of configArray) { - if (validated.has(element)) { - continue; - } - validated.add(element); - - validateEnvironment(element.env, element.name, getPluginEnv); - validateGlobals(element.globals, element.name); - validateProcessor(element.processor, element.name, getPluginProcessor); - validateRules(element.rules, element.name, getPluginRule); - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - getRuleOptionsSchema, - validate, - validateConfigArray, - validateConfigSchema, - validateRuleOptions -}; diff --git a/node_modules/eslint/lib/shared/deprecation-warnings.js b/node_modules/eslint/lib/shared/deprecation-warnings.js deleted file mode 100644 index d09cafb07..000000000 --- a/node_modules/eslint/lib/shared/deprecation-warnings.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @fileoverview Provide the function that emits deprecation warnings. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const path = require("path"); - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -// Definitions for deprecation warnings. -const deprecationWarningMessages = { - ESLINT_LEGACY_ECMAFEATURES: - "The 'ecmaFeatures' config file property is deprecated and has no effect." -}; - -const sourceFileErrorCache = new Set(); - -/** - * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted - * for each unique file path, but repeated invocations with the same file path have no effect. - * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active. - * @param {string} source The name of the configuration source to report the warning for. - * @param {string} errorCode The warning message to show. - * @returns {void} - */ -function emitDeprecationWarning(source, errorCode) { - const cacheKey = JSON.stringify({ source, errorCode }); - - if (sourceFileErrorCache.has(cacheKey)) { - return; - } - - sourceFileErrorCache.add(cacheKey); - - const rel = path.relative(process.cwd(), source); - const message = deprecationWarningMessages[errorCode]; - - process.emitWarning( - `${message} (found in "${rel}")`, - "DeprecationWarning", - errorCode - ); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - emitDeprecationWarning -}; diff --git a/node_modules/eslint/lib/shared/directives.js b/node_modules/eslint/lib/shared/directives.js deleted file mode 100644 index ff67b00a5..000000000 --- a/node_modules/eslint/lib/shared/directives.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @fileoverview Common utils for directives. - * - * This file contains only shared items for directives. - * If you make a utility for rules, please see `../rules/utils/ast-utils.js`. - * - * @author gfyoung - */ -"use strict"; - -const directivesPattern = /^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u; - -module.exports = { - directivesPattern -}; diff --git a/node_modules/eslint/lib/shared/logging.js b/node_modules/eslint/lib/shared/logging.js deleted file mode 100644 index fd5e8a648..000000000 --- a/node_modules/eslint/lib/shared/logging.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @fileoverview Handle logging for ESLint - * @author Gyandeep Singh - */ - -"use strict"; - -/* eslint no-console: "off" -- Logging util */ - -/* c8 ignore next */ -module.exports = { - - /** - * Cover for console.log - * @param {...any} args The elements to log. - * @returns {void} - */ - info(...args) { - console.log(...args); - }, - - /** - * Cover for console.error - * @param {...any} args The elements to log. - * @returns {void} - */ - error(...args) { - console.error(...args); - } -}; diff --git a/node_modules/eslint/lib/shared/relative-module-resolver.js b/node_modules/eslint/lib/shared/relative-module-resolver.js deleted file mode 100644 index 18a694983..000000000 --- a/node_modules/eslint/lib/shared/relative-module-resolver.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * Utility for resolving a module relative to another module - * @author Teddy Katz - */ - -"use strict"; - -const { createRequire } = require("module"); - -module.exports = { - - /** - * Resolves a Node module relative to another module - * @param {string} moduleName The name of a Node module, or a path to a Node module. - * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be - * a file rather than a directory, but the file need not actually exist. - * @throws {Error} Any error from `module.createRequire` or its `resolve`. - * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath` - */ - resolve(moduleName, relativeToPath) { - try { - return createRequire(relativeToPath).resolve(moduleName); - } catch (error) { - - // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future. - if ( - typeof error === "object" && - error !== null && - error.code === "MODULE_NOT_FOUND" && - !error.requireStack && - error.message.includes(moduleName) - ) { - error.message += `\nRequire stack:\n- ${relativeToPath}`; - } - throw error; - } - } -}; diff --git a/node_modules/eslint/lib/shared/runtime-info.js b/node_modules/eslint/lib/shared/runtime-info.js deleted file mode 100644 index b99ad1038..000000000 --- a/node_modules/eslint/lib/shared/runtime-info.js +++ /dev/null @@ -1,167 +0,0 @@ -/** - * @fileoverview Utility to get information about the execution environment. - * @author Kai Cataldo - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const path = require("path"); -const spawn = require("cross-spawn"); -const os = require("os"); -const log = require("../shared/logging"); -const packageJson = require("../../package.json"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Generates and returns execution environment information. - * @returns {string} A string that contains execution environment information. - */ -function environment() { - const cache = new Map(); - - /** - * Checks if a path is a child of a directory. - * @param {string} parentPath The parent path to check. - * @param {string} childPath The path to check. - * @returns {boolean} Whether or not the given path is a child of a directory. - */ - function isChildOfDirectory(parentPath, childPath) { - return !path.relative(parentPath, childPath).startsWith(".."); - } - - /** - * Synchronously executes a shell command and formats the result. - * @param {string} cmd The command to execute. - * @param {Array} args The arguments to be executed with the command. - * @throws {Error} As may be collected by `cross-spawn.sync`. - * @returns {string} The version returned by the command. - */ - function execCommand(cmd, args) { - const key = [cmd, ...args].join(" "); - - if (cache.has(key)) { - return cache.get(key); - } - - const process = spawn.sync(cmd, args, { encoding: "utf8" }); - - if (process.error) { - throw process.error; - } - - const result = process.stdout.trim(); - - cache.set(key, result); - return result; - } - - /** - * Normalizes a version number. - * @param {string} versionStr The string to normalize. - * @returns {string} The normalized version number. - */ - function normalizeVersionStr(versionStr) { - return versionStr.startsWith("v") ? versionStr : `v${versionStr}`; - } - - /** - * Gets bin version. - * @param {string} bin The bin to check. - * @throws {Error} As may be collected by `cross-spawn.sync`. - * @returns {string} The normalized version returned by the command. - */ - function getBinVersion(bin) { - const binArgs = ["--version"]; - - try { - return normalizeVersionStr(execCommand(bin, binArgs)); - } catch (e) { - log.error(`Error finding ${bin} version running the command \`${bin} ${binArgs.join(" ")}\``); - throw e; - } - } - - /** - * Gets installed npm package version. - * @param {string} pkg The package to check. - * @param {boolean} global Whether to check globally or not. - * @throws {Error} As may be collected by `cross-spawn.sync`. - * @returns {string} The normalized version returned by the command. - */ - function getNpmPackageVersion(pkg, { global = false } = {}) { - const npmBinArgs = ["bin", "-g"]; - const npmLsArgs = ["ls", "--depth=0", "--json", pkg]; - - if (global) { - npmLsArgs.push("-g"); - } - - try { - const parsedStdout = JSON.parse(execCommand("npm", npmLsArgs)); - - /* - * Checking globally returns an empty JSON object, while local checks - * include the name and version of the local project. - */ - if (Object.keys(parsedStdout).length === 0 || !(parsedStdout.dependencies && parsedStdout.dependencies.eslint)) { - return "Not found"; - } - - const [, processBinPath] = process.argv; - let npmBinPath; - - try { - npmBinPath = execCommand("npm", npmBinArgs); - } catch (e) { - log.error(`Error finding npm binary path when running command \`npm ${npmBinArgs.join(" ")}\``); - throw e; - } - - const isGlobal = isChildOfDirectory(npmBinPath, processBinPath); - let pkgVersion = parsedStdout.dependencies.eslint.version; - - if ((global && isGlobal) || (!global && !isGlobal)) { - pkgVersion += " (Currently used)"; - } - - return normalizeVersionStr(pkgVersion); - } catch (e) { - log.error(`Error finding ${pkg} version running the command \`npm ${npmLsArgs.join(" ")}\``); - throw e; - } - } - - return [ - "Environment Info:", - "", - `Node version: ${getBinVersion("node")}`, - `npm version: ${getBinVersion("npm")}`, - `Local ESLint version: ${getNpmPackageVersion("eslint", { global: false })}`, - `Global ESLint version: ${getNpmPackageVersion("eslint", { global: true })}`, - `Operating System: ${os.platform()} ${os.release()}` - ].join("\n"); -} - -/** - * Returns version of currently executing ESLint. - * @returns {string} The version from the currently executing ESLint's package.json. - */ -function version() { - return `v${packageJson.version}`; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - environment, - version -}; diff --git a/node_modules/eslint/lib/shared/string-utils.js b/node_modules/eslint/lib/shared/string-utils.js deleted file mode 100644 index ed0781e57..000000000 --- a/node_modules/eslint/lib/shared/string-utils.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @fileoverview Utilities to operate on strings. - * @author Stephen Wade - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Graphemer = require("graphemer").default; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -// eslint-disable-next-line no-control-regex -- intentionally including control characters -const ASCII_REGEX = /^[\u0000-\u007f]*$/u; - -/** @type {Graphemer | undefined} */ -let splitter; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Converts the first letter of a string to uppercase. - * @param {string} string The string to operate on - * @returns {string} The converted string - */ -function upperCaseFirst(string) { - if (string.length <= 1) { - return string.toUpperCase(); - } - return string[0].toUpperCase() + string.slice(1); -} - -/** - * Counts graphemes in a given string. - * @param {string} value A string to count graphemes. - * @returns {number} The number of graphemes in `value`. - */ -function getGraphemeCount(value) { - if (ASCII_REGEX.test(value)) { - return value.length; - } - - if (!splitter) { - splitter = new Graphemer(); - } - - return splitter.countGraphemes(value); -} - -module.exports = { - upperCaseFirst, - getGraphemeCount -}; diff --git a/node_modules/eslint/lib/shared/traverser.js b/node_modules/eslint/lib/shared/traverser.js deleted file mode 100644 index 38b4e2151..000000000 --- a/node_modules/eslint/lib/shared/traverser.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * @fileoverview Traverser to traverse AST trees. - * @author Nicholas C. Zakas - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const vk = require("eslint-visitor-keys"); -const debug = require("debug")("eslint:traverser"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Do nothing. - * @returns {void} - */ -function noop() { - - // do nothing. -} - -/** - * Check whether the given value is an ASTNode or not. - * @param {any} x The value to check. - * @returns {boolean} `true` if the value is an ASTNode. - */ -function isNode(x) { - return x !== null && typeof x === "object" && typeof x.type === "string"; -} - -/** - * Get the visitor keys of a given node. - * @param {Object} visitorKeys The map of visitor keys. - * @param {ASTNode} node The node to get their visitor keys. - * @returns {string[]} The visitor keys of the node. - */ -function getVisitorKeys(visitorKeys, node) { - let keys = visitorKeys[node.type]; - - if (!keys) { - keys = vk.getKeys(node); - debug("Unknown node type \"%s\": Estimated visitor keys %j", node.type, keys); - } - - return keys; -} - -/** - * The traverser class to traverse AST trees. - */ -class Traverser { - constructor() { - this._current = null; - this._parents = []; - this._skipped = false; - this._broken = false; - this._visitorKeys = null; - this._enter = null; - this._leave = null; - } - - /** - * Gives current node. - * @returns {ASTNode} The current node. - */ - current() { - return this._current; - } - - /** - * Gives a copy of the ancestor nodes. - * @returns {ASTNode[]} The ancestor nodes. - */ - parents() { - return this._parents.slice(0); - } - - /** - * Break the current traversal. - * @returns {void} - */ - break() { - this._broken = true; - } - - /** - * Skip child nodes for the current traversal. - * @returns {void} - */ - skip() { - this._skipped = true; - } - - /** - * Traverse the given AST tree. - * @param {ASTNode} node The root node to traverse. - * @param {Object} options The option object. - * @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`. - * @param {Function} [options.enter=noop] The callback function which is called on entering each node. - * @param {Function} [options.leave=noop] The callback function which is called on leaving each node. - * @returns {void} - */ - traverse(node, options) { - this._current = null; - this._parents = []; - this._skipped = false; - this._broken = false; - this._visitorKeys = options.visitorKeys || vk.KEYS; - this._enter = options.enter || noop; - this._leave = options.leave || noop; - this._traverse(node, null); - } - - /** - * Traverse the given AST tree recursively. - * @param {ASTNode} node The current node. - * @param {ASTNode|null} parent The parent node. - * @returns {void} - * @private - */ - _traverse(node, parent) { - if (!isNode(node)) { - return; - } - - this._current = node; - this._skipped = false; - this._enter(node, parent); - - if (!this._skipped && !this._broken) { - const keys = getVisitorKeys(this._visitorKeys, node); - - if (keys.length >= 1) { - this._parents.push(node); - for (let i = 0; i < keys.length && !this._broken; ++i) { - const child = node[keys[i]]; - - if (Array.isArray(child)) { - for (let j = 0; j < child.length && !this._broken; ++j) { - this._traverse(child[j], node); - } - } else { - this._traverse(child, node); - } - } - this._parents.pop(); - } - } - - if (!this._broken) { - this._leave(node, parent); - } - - this._current = parent; - } - - /** - * Calculates the keys to use for traversal. - * @param {ASTNode} node The node to read keys from. - * @returns {string[]} An array of keys to visit on the node. - * @private - */ - static getKeys(node) { - return vk.getKeys(node); - } - - /** - * Traverse the given AST tree. - * @param {ASTNode} node The root node to traverse. - * @param {Object} options The option object. - * @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`. - * @param {Function} [options.enter=noop] The callback function which is called on entering each node. - * @param {Function} [options.leave=noop] The callback function which is called on leaving each node. - * @returns {void} - */ - static traverse(node, options) { - new Traverser().traverse(node, options); - } - - /** - * The default visitor keys. - * @type {Object} - */ - static get DEFAULT_VISITOR_KEYS() { - return vk.KEYS; - } -} - -module.exports = Traverser; diff --git a/node_modules/eslint/lib/shared/types.js b/node_modules/eslint/lib/shared/types.js deleted file mode 100644 index 5c1046258..000000000 --- a/node_modules/eslint/lib/shared/types.js +++ /dev/null @@ -1,216 +0,0 @@ -/** - * @fileoverview Define common types for input completion. - * @author Toru Nagashima - */ -"use strict"; - -/** @type {any} */ -module.exports = {}; - -/** @typedef {boolean | "off" | "readable" | "readonly" | "writable" | "writeable"} GlobalConf */ -/** @typedef {0 | 1 | 2 | "off" | "warn" | "error"} SeverityConf */ -/** @typedef {SeverityConf | [SeverityConf, ...any[]]} RuleConf */ - -/** - * @typedef {Object} EcmaFeatures - * @property {boolean} [globalReturn] Enabling `return` statements at the top-level. - * @property {boolean} [jsx] Enabling JSX syntax. - * @property {boolean} [impliedStrict] Enabling strict mode always. - */ - -/** - * @typedef {Object} ParserOptions - * @property {EcmaFeatures} [ecmaFeatures] The optional features. - * @property {3|5|6|7|8|9|10|11|12|13|14|2015|2016|2017|2018|2019|2020|2021|2022|2023} [ecmaVersion] The ECMAScript version (or revision number). - * @property {"script"|"module"} [sourceType] The source code type. - * @property {boolean} [allowReserved] Allowing the use of reserved words as identifiers in ES3. - */ - -/** - * @typedef {Object} LanguageOptions - * @property {number|"latest"} [ecmaVersion] The ECMAScript version (or revision number). - * @property {Record} [globals] The global variable settings. - * @property {"script"|"module"|"commonjs"} [sourceType] The source code type. - * @property {string|Object} [parser] The parser to use. - * @property {Object} [parserOptions] The parser options to use. - */ - -/** - * @typedef {Object} ConfigData - * @property {Record} [env] The environment settings. - * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. - * @property {Record} [globals] The global variable settings. - * @property {string | string[]} [ignorePatterns] The glob patterns that ignore to lint. - * @property {boolean} [noInlineConfig] The flag that disables directive comments. - * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. - * @property {string} [parser] The path to a parser or the package name of a parser. - * @property {ParserOptions} [parserOptions] The parser options. - * @property {string[]} [plugins] The plugin specifiers. - * @property {string} [processor] The processor specifier. - * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. - * @property {boolean} [root] The root flag. - * @property {Record} [rules] The rule settings. - * @property {Object} [settings] The shared settings. - */ - -/** - * @typedef {Object} OverrideConfigData - * @property {Record} [env] The environment settings. - * @property {string | string[]} [excludedFiles] The glob patterns for excluded files. - * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. - * @property {string | string[]} files The glob patterns for target files. - * @property {Record} [globals] The global variable settings. - * @property {boolean} [noInlineConfig] The flag that disables directive comments. - * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. - * @property {string} [parser] The path to a parser or the package name of a parser. - * @property {ParserOptions} [parserOptions] The parser options. - * @property {string[]} [plugins] The plugin specifiers. - * @property {string} [processor] The processor specifier. - * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. - * @property {Record} [rules] The rule settings. - * @property {Object} [settings] The shared settings. - */ - -/** - * @typedef {Object} ParseResult - * @property {Object} ast The AST. - * @property {ScopeManager} [scopeManager] The scope manager of the AST. - * @property {Record} [services] The services that the parser provides. - * @property {Record} [visitorKeys] The visitor keys of the AST. - */ - -/** - * @typedef {Object} Parser - * @property {(text:string, options:ParserOptions) => Object} parse The definition of global variables. - * @property {(text:string, options:ParserOptions) => ParseResult} [parseForESLint] The parser options that will be enabled under this environment. - */ - -/** - * @typedef {Object} Environment - * @property {Record} [globals] The definition of global variables. - * @property {ParserOptions} [parserOptions] The parser options that will be enabled under this environment. - */ - -/** - * @typedef {Object} LintMessage - * @property {number|undefined} column The 1-based column number. - * @property {number} [endColumn] The 1-based column number of the end location. - * @property {number} [endLine] The 1-based line number of the end location. - * @property {boolean} [fatal] If `true` then this is a fatal error. - * @property {{range:[number,number], text:string}} [fix] Information for autofix. - * @property {number|undefined} line The 1-based line number. - * @property {string} message The error message. - * @property {string} [messageId] The ID of the message in the rule's meta. - * @property {(string|null)} nodeType Type of node - * @property {string|null} ruleId The ID of the rule which makes this message. - * @property {0|1|2} severity The severity of this message. - * @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions. - */ - -/** - * @typedef {Object} SuppressedLintMessage - * @property {number|undefined} column The 1-based column number. - * @property {number} [endColumn] The 1-based column number of the end location. - * @property {number} [endLine] The 1-based line number of the end location. - * @property {boolean} [fatal] If `true` then this is a fatal error. - * @property {{range:[number,number], text:string}} [fix] Information for autofix. - * @property {number|undefined} line The 1-based line number. - * @property {string} message The error message. - * @property {string} [messageId] The ID of the message in the rule's meta. - * @property {(string|null)} nodeType Type of node - * @property {string|null} ruleId The ID of the rule which makes this message. - * @property {0|1|2} severity The severity of this message. - * @property {Array<{kind: string, justification: string}>} suppressions The suppression info. - * @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions. - */ - -/** - * @typedef {Object} SuggestionResult - * @property {string} desc A short description. - * @property {string} [messageId] Id referencing a message for the description. - * @property {{ text: string, range: number[] }} fix fix result info - */ - -/** - * @typedef {Object} Processor - * @property {(text:string, filename:string) => Array} [preprocess] The function to extract code blocks. - * @property {(messagesList:LintMessage[][], filename:string) => LintMessage[]} [postprocess] The function to merge messages. - * @property {boolean} [supportsAutofix] If `true` then it means the processor supports autofix. - */ - -/** - * @typedef {Object} RuleMetaDocs - * @property {string} description The description of the rule. - * @property {boolean} recommended If `true` then the rule is included in `eslint:recommended` preset. - * @property {string} url The URL of the rule documentation. - */ - -/** - * @typedef {Object} RuleMeta - * @property {boolean} [deprecated] If `true` then the rule has been deprecated. - * @property {RuleMetaDocs} docs The document information of the rule. - * @property {"code"|"whitespace"} [fixable] The autofix type. - * @property {boolean} [hasSuggestions] If `true` then the rule provides suggestions. - * @property {Record} [messages] The messages the rule reports. - * @property {string[]} [replacedBy] The IDs of the alternative rules. - * @property {Array|Object} schema The option schema of the rule. - * @property {"problem"|"suggestion"|"layout"} type The rule type. - */ - -/** - * @typedef {Object} Rule - * @property {Function} create The factory of the rule. - * @property {RuleMeta} meta The meta data of the rule. - */ - -/** - * @typedef {Object} Plugin - * @property {Record} [configs] The definition of plugin configs. - * @property {Record} [environments] The definition of plugin environments. - * @property {Record} [processors] The definition of plugin processors. - * @property {Record} [rules] The definition of plugin rules. - */ - -/** - * Information of deprecated rules. - * @typedef {Object} DeprecatedRuleInfo - * @property {string} ruleId The rule ID. - * @property {string[]} replacedBy The rule IDs that replace this deprecated rule. - */ - -/** - * A linting result. - * @typedef {Object} LintResult - * @property {string} filePath The path to the file that was linted. - * @property {LintMessage[]} messages All of the messages for the result. - * @property {SuppressedLintMessage[]} suppressedMessages All of the suppressed messages for the result. - * @property {number} errorCount Number of errors for the result. - * @property {number} fatalErrorCount Number of fatal errors for the result. - * @property {number} warningCount Number of warnings for the result. - * @property {number} fixableErrorCount Number of fixable errors for the result. - * @property {number} fixableWarningCount Number of fixable warnings for the result. - * @property {string} [source] The source code of the file that was linted. - * @property {string} [output] The source code of the file that was linted, with as many fixes applied as possible. - * @property {DeprecatedRuleInfo[]} usedDeprecatedRules The list of used deprecated rules. - */ - -/** - * Information provided when the maximum warning threshold is exceeded. - * @typedef {Object} MaxWarningsExceeded - * @property {number} maxWarnings Number of warnings to trigger nonzero exit code. - * @property {number} foundWarnings Number of warnings found while linting. - */ - -/** - * Metadata about results for formatters. - * @typedef {Object} ResultsMeta - * @property {MaxWarningsExceeded} [maxWarningsExceeded] Present if the maxWarnings threshold was exceeded. - */ - -/** - * A formatter function. - * @callback FormatterFunction - * @param {LintResult[]} results The list of linting results. - * @param {{cwd: string, maxWarningsExceeded?: MaxWarningsExceeded, rulesMeta: Record}} [context] A context object. - * @returns {string | Promise} Formatted text. - */ diff --git a/node_modules/eslint/lib/source-code/index.js b/node_modules/eslint/lib/source-code/index.js deleted file mode 100644 index 76e27869f..000000000 --- a/node_modules/eslint/lib/source-code/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -module.exports = { - SourceCode: require("./source-code") -}; diff --git a/node_modules/eslint/lib/source-code/source-code.js b/node_modules/eslint/lib/source-code/source-code.js deleted file mode 100644 index 07c0d2948..000000000 --- a/node_modules/eslint/lib/source-code/source-code.js +++ /dev/null @@ -1,729 +0,0 @@ -/** - * @fileoverview Abstraction of JavaScript source code. - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const - { isCommentToken } = require("@eslint-community/eslint-utils"), - TokenStore = require("./token-store"), - astUtils = require("../shared/ast-utils"), - Traverser = require("../shared/traverser"); - -//------------------------------------------------------------------------------ -// Type Definitions -//------------------------------------------------------------------------------ - -/** @typedef {import("eslint-scope").Variable} Variable */ - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -/** - * Validates that the given AST has the required information. - * @param {ASTNode} ast The Program node of the AST to check. - * @throws {Error} If the AST doesn't contain the correct information. - * @returns {void} - * @private - */ -function validate(ast) { - if (!ast.tokens) { - throw new Error("AST is missing the tokens array."); - } - - if (!ast.comments) { - throw new Error("AST is missing the comments array."); - } - - if (!ast.loc) { - throw new Error("AST is missing location information."); - } - - if (!ast.range) { - throw new Error("AST is missing range information"); - } -} - -/** - * Check to see if its a ES6 export declaration. - * @param {ASTNode} astNode An AST node. - * @returns {boolean} whether the given node represents an export declaration. - * @private - */ -function looksLikeExport(astNode) { - return astNode.type === "ExportDefaultDeclaration" || astNode.type === "ExportNamedDeclaration" || - astNode.type === "ExportAllDeclaration" || astNode.type === "ExportSpecifier"; -} - -/** - * Merges two sorted lists into a larger sorted list in O(n) time. - * @param {Token[]} tokens The list of tokens. - * @param {Token[]} comments The list of comments. - * @returns {Token[]} A sorted list of tokens and comments. - * @private - */ -function sortedMerge(tokens, comments) { - const result = []; - let tokenIndex = 0; - let commentIndex = 0; - - while (tokenIndex < tokens.length || commentIndex < comments.length) { - if (commentIndex >= comments.length || tokenIndex < tokens.length && tokens[tokenIndex].range[0] < comments[commentIndex].range[0]) { - result.push(tokens[tokenIndex++]); - } else { - result.push(comments[commentIndex++]); - } - } - - return result; -} - -/** - * Determines if two nodes or tokens overlap. - * @param {ASTNode|Token} first The first node or token to check. - * @param {ASTNode|Token} second The second node or token to check. - * @returns {boolean} True if the two nodes or tokens overlap. - * @private - */ -function nodesOrTokensOverlap(first, second) { - return (first.range[0] <= second.range[0] && first.range[1] >= second.range[0]) || - (second.range[0] <= first.range[0] && second.range[1] >= first.range[0]); -} - -/** - * Determines if two nodes or tokens have at least one whitespace character - * between them. Order does not matter. Returns false if the given nodes or - * tokens overlap. - * @param {SourceCode} sourceCode The source code object. - * @param {ASTNode|Token} first The first node or token to check between. - * @param {ASTNode|Token} second The second node or token to check between. - * @param {boolean} checkInsideOfJSXText If `true` is present, check inside of JSXText tokens for backward compatibility. - * @returns {boolean} True if there is a whitespace character between - * any of the tokens found between the two given nodes or tokens. - * @public - */ -function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) { - if (nodesOrTokensOverlap(first, second)) { - return false; - } - - const [startingNodeOrToken, endingNodeOrToken] = first.range[1] <= second.range[0] - ? [first, second] - : [second, first]; - const firstToken = sourceCode.getLastToken(startingNodeOrToken) || startingNodeOrToken; - const finalToken = sourceCode.getFirstToken(endingNodeOrToken) || endingNodeOrToken; - let currentToken = firstToken; - - while (currentToken !== finalToken) { - const nextToken = sourceCode.getTokenAfter(currentToken, { includeComments: true }); - - if ( - currentToken.range[1] !== nextToken.range[0] || - - /* - * For backward compatibility, check spaces in JSXText. - * https://github.com/eslint/eslint/issues/12614 - */ - ( - checkInsideOfJSXText && - nextToken !== finalToken && - nextToken.type === "JSXText" && - /\s/u.test(nextToken.value) - ) - ) { - return true; - } - - currentToken = nextToken; - } - - return false; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -const caches = Symbol("caches"); - -/** - * Represents parsed source code. - */ -class SourceCode extends TokenStore { - - /** - * @param {string|Object} textOrConfig The source code text or config object. - * @param {string} textOrConfig.text The source code text. - * @param {ASTNode} textOrConfig.ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. - * @param {Object|null} textOrConfig.parserServices The parser services. - * @param {ScopeManager|null} textOrConfig.scopeManager The scope of this source code. - * @param {Object|null} textOrConfig.visitorKeys The visitor keys to traverse AST. - * @param {ASTNode} [astIfNoConfig] The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. - */ - constructor(textOrConfig, astIfNoConfig) { - let text, ast, parserServices, scopeManager, visitorKeys; - - // Process overloading. - if (typeof textOrConfig === "string") { - text = textOrConfig; - ast = astIfNoConfig; - } else if (typeof textOrConfig === "object" && textOrConfig !== null) { - text = textOrConfig.text; - ast = textOrConfig.ast; - parserServices = textOrConfig.parserServices; - scopeManager = textOrConfig.scopeManager; - visitorKeys = textOrConfig.visitorKeys; - } - - validate(ast); - super(ast.tokens, ast.comments); - - /** - * General purpose caching for the class. - */ - this[caches] = new Map([ - ["scopes", new WeakMap()] - ]); - - /** - * The flag to indicate that the source code has Unicode BOM. - * @type {boolean} - */ - this.hasBOM = (text.charCodeAt(0) === 0xFEFF); - - /** - * The original text source code. - * BOM was stripped from this text. - * @type {string} - */ - this.text = (this.hasBOM ? text.slice(1) : text); - - /** - * The parsed AST for the source code. - * @type {ASTNode} - */ - this.ast = ast; - - /** - * The parser services of this source code. - * @type {Object} - */ - this.parserServices = parserServices || {}; - - /** - * The scope of this source code. - * @type {ScopeManager|null} - */ - this.scopeManager = scopeManager || null; - - /** - * The visitor keys to traverse AST. - * @type {Object} - */ - this.visitorKeys = visitorKeys || Traverser.DEFAULT_VISITOR_KEYS; - - // Check the source text for the presence of a shebang since it is parsed as a standard line comment. - const shebangMatched = this.text.match(astUtils.shebangPattern); - const hasShebang = shebangMatched && ast.comments.length && ast.comments[0].value === shebangMatched[1]; - - if (hasShebang) { - ast.comments[0].type = "Shebang"; - } - - this.tokensAndComments = sortedMerge(ast.tokens, ast.comments); - - /** - * The source code split into lines according to ECMA-262 specification. - * This is done to avoid each rule needing to do so separately. - * @type {string[]} - */ - this.lines = []; - this.lineStartIndices = [0]; - - const lineEndingPattern = astUtils.createGlobalLinebreakMatcher(); - let match; - - /* - * Previously, this was implemented using a regex that - * matched a sequence of non-linebreak characters followed by a - * linebreak, then adding the lengths of the matches. However, - * this caused a catastrophic backtracking issue when the end - * of a file contained a large number of non-newline characters. - * To avoid this, the current implementation just matches newlines - * and uses match.index to get the correct line start indices. - */ - while ((match = lineEndingPattern.exec(this.text))) { - this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1], match.index)); - this.lineStartIndices.push(match.index + match[0].length); - } - this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1])); - - // Cache for comments found using getComments(). - this._commentCache = new WeakMap(); - - // don't allow modification of this object - Object.freeze(this); - Object.freeze(this.lines); - } - - /** - * Split the source code into multiple lines based on the line delimiters. - * @param {string} text Source code as a string. - * @returns {string[]} Array of source code lines. - * @public - */ - static splitLines(text) { - return text.split(astUtils.createGlobalLinebreakMatcher()); - } - - /** - * Gets the source code for the given node. - * @param {ASTNode} [node] The AST node to get the text for. - * @param {int} [beforeCount] The number of characters before the node to retrieve. - * @param {int} [afterCount] The number of characters after the node to retrieve. - * @returns {string} The text representing the AST node. - * @public - */ - getText(node, beforeCount, afterCount) { - if (node) { - return this.text.slice(Math.max(node.range[0] - (beforeCount || 0), 0), - node.range[1] + (afterCount || 0)); - } - return this.text; - } - - /** - * Gets the entire source text split into an array of lines. - * @returns {Array} The source text as an array of lines. - * @public - */ - getLines() { - return this.lines; - } - - /** - * Retrieves an array containing all comments in the source code. - * @returns {ASTNode[]} An array of comment nodes. - * @public - */ - getAllComments() { - return this.ast.comments; - } - - /** - * Gets all comments for the given node. - * @param {ASTNode} node The AST node to get the comments for. - * @returns {Object} An object containing a leading and trailing array - * of comments indexed by their position. - * @public - * @deprecated replaced by getCommentsBefore(), getCommentsAfter(), and getCommentsInside(). - */ - getComments(node) { - if (this._commentCache.has(node)) { - return this._commentCache.get(node); - } - - const comments = { - leading: [], - trailing: [] - }; - - /* - * Return all comments as leading comments of the Program node when - * there is no executable code. - */ - if (node.type === "Program") { - if (node.body.length === 0) { - comments.leading = node.comments; - } - } else { - - /* - * Return comments as trailing comments of nodes that only contain - * comments (to mimic the comment attachment behavior present in Espree). - */ - if ((node.type === "BlockStatement" || node.type === "ClassBody") && node.body.length === 0 || - node.type === "ObjectExpression" && node.properties.length === 0 || - node.type === "ArrayExpression" && node.elements.length === 0 || - node.type === "SwitchStatement" && node.cases.length === 0 - ) { - comments.trailing = this.getTokens(node, { - includeComments: true, - filter: isCommentToken - }); - } - - /* - * Iterate over tokens before and after node and collect comment tokens. - * Do not include comments that exist outside of the parent node - * to avoid duplication. - */ - let currentToken = this.getTokenBefore(node, { includeComments: true }); - - while (currentToken && isCommentToken(currentToken)) { - if (node.parent && node.parent.type !== "Program" && (currentToken.start < node.parent.start)) { - break; - } - comments.leading.push(currentToken); - currentToken = this.getTokenBefore(currentToken, { includeComments: true }); - } - - comments.leading.reverse(); - - currentToken = this.getTokenAfter(node, { includeComments: true }); - - while (currentToken && isCommentToken(currentToken)) { - if (node.parent && node.parent.type !== "Program" && (currentToken.end > node.parent.end)) { - break; - } - comments.trailing.push(currentToken); - currentToken = this.getTokenAfter(currentToken, { includeComments: true }); - } - } - - this._commentCache.set(node, comments); - return comments; - } - - /** - * Retrieves the JSDoc comment for a given node. - * @param {ASTNode} node The AST node to get the comment for. - * @returns {Token|null} The Block comment token containing the JSDoc comment - * for the given node or null if not found. - * @public - * @deprecated - */ - getJSDocComment(node) { - - /** - * Checks for the presence of a JSDoc comment for the given node and returns it. - * @param {ASTNode} astNode The AST node to get the comment for. - * @returns {Token|null} The Block comment token containing the JSDoc comment - * for the given node or null if not found. - * @private - */ - const findJSDocComment = astNode => { - const tokenBefore = this.getTokenBefore(astNode, { includeComments: true }); - - if ( - tokenBefore && - isCommentToken(tokenBefore) && - tokenBefore.type === "Block" && - tokenBefore.value.charAt(0) === "*" && - astNode.loc.start.line - tokenBefore.loc.end.line <= 1 - ) { - return tokenBefore; - } - - return null; - }; - let parent = node.parent; - - switch (node.type) { - case "ClassDeclaration": - case "FunctionDeclaration": - return findJSDocComment(looksLikeExport(parent) ? parent : node); - - case "ClassExpression": - return findJSDocComment(parent.parent); - - case "ArrowFunctionExpression": - case "FunctionExpression": - if (parent.type !== "CallExpression" && parent.type !== "NewExpression") { - while ( - !this.getCommentsBefore(parent).length && - !/Function/u.test(parent.type) && - parent.type !== "MethodDefinition" && - parent.type !== "Property" - ) { - parent = parent.parent; - - if (!parent) { - break; - } - } - - if (parent && parent.type !== "FunctionDeclaration" && parent.type !== "Program") { - return findJSDocComment(parent); - } - } - - return findJSDocComment(node); - - // falls through - default: - return null; - } - } - - /** - * Gets the deepest node containing a range index. - * @param {int} index Range index of the desired node. - * @returns {ASTNode} The node if found or null if not found. - * @public - */ - getNodeByRangeIndex(index) { - let result = null; - - Traverser.traverse(this.ast, { - visitorKeys: this.visitorKeys, - enter(node) { - if (node.range[0] <= index && index < node.range[1]) { - result = node; - } else { - this.skip(); - } - }, - leave(node) { - if (node === result) { - this.break(); - } - } - }); - - return result; - } - - /** - * Determines if two nodes or tokens have at least one whitespace character - * between them. Order does not matter. Returns false if the given nodes or - * tokens overlap. - * @param {ASTNode|Token} first The first node or token to check between. - * @param {ASTNode|Token} second The second node or token to check between. - * @returns {boolean} True if there is a whitespace character between - * any of the tokens found between the two given nodes or tokens. - * @public - */ - isSpaceBetween(first, second) { - return isSpaceBetween(this, first, second, false); - } - - /** - * Determines if two nodes or tokens have at least one whitespace character - * between them. Order does not matter. Returns false if the given nodes or - * tokens overlap. - * For backward compatibility, this method returns true if there are - * `JSXText` tokens that contain whitespaces between the two. - * @param {ASTNode|Token} first The first node or token to check between. - * @param {ASTNode|Token} second The second node or token to check between. - * @returns {boolean} True if there is a whitespace character between - * any of the tokens found between the two given nodes or tokens. - * @deprecated in favor of isSpaceBetween(). - * @public - */ - isSpaceBetweenTokens(first, second) { - return isSpaceBetween(this, first, second, true); - } - - /** - * Converts a source text index into a (line, column) pair. - * @param {number} index The index of a character in a file - * @throws {TypeError} If non-numeric index or index out of range. - * @returns {Object} A {line, column} location object with a 0-indexed column - * @public - */ - getLocFromIndex(index) { - if (typeof index !== "number") { - throw new TypeError("Expected `index` to be a number."); - } - - if (index < 0 || index > this.text.length) { - throw new RangeError(`Index out of range (requested index ${index}, but source text has length ${this.text.length}).`); - } - - /* - * For an argument of this.text.length, return the location one "spot" past the last character - * of the file. If the last character is a linebreak, the location will be column 0 of the next - * line; otherwise, the location will be in the next column on the same line. - * - * See getIndexFromLoc for the motivation for this special case. - */ - if (index === this.text.length) { - return { line: this.lines.length, column: this.lines[this.lines.length - 1].length }; - } - - /* - * To figure out which line index is on, determine the last place at which index could - * be inserted into lineStartIndices to keep the list sorted. - */ - const lineNumber = index >= this.lineStartIndices[this.lineStartIndices.length - 1] - ? this.lineStartIndices.length - : this.lineStartIndices.findIndex(el => index < el); - - return { line: lineNumber, column: index - this.lineStartIndices[lineNumber - 1] }; - } - - /** - * Converts a (line, column) pair into a range index. - * @param {Object} loc A line/column location - * @param {number} loc.line The line number of the location (1-indexed) - * @param {number} loc.column The column number of the location (0-indexed) - * @throws {TypeError|RangeError} If `loc` is not an object with a numeric - * `line` and `column`, if the `line` is less than or equal to zero or - * the line or column is out of the expected range. - * @returns {number} The range index of the location in the file. - * @public - */ - getIndexFromLoc(loc) { - if (typeof loc !== "object" || typeof loc.line !== "number" || typeof loc.column !== "number") { - throw new TypeError("Expected `loc` to be an object with numeric `line` and `column` properties."); - } - - if (loc.line <= 0) { - throw new RangeError(`Line number out of range (line ${loc.line} requested). Line numbers should be 1-based.`); - } - - if (loc.line > this.lineStartIndices.length) { - throw new RangeError(`Line number out of range (line ${loc.line} requested, but only ${this.lineStartIndices.length} lines present).`); - } - - const lineStartIndex = this.lineStartIndices[loc.line - 1]; - const lineEndIndex = loc.line === this.lineStartIndices.length ? this.text.length : this.lineStartIndices[loc.line]; - const positionIndex = lineStartIndex + loc.column; - - /* - * By design, getIndexFromLoc({ line: lineNum, column: 0 }) should return the start index of - * the given line, provided that the line number is valid element of this.lines. Since the - * last element of this.lines is an empty string for files with trailing newlines, add a - * special case where getting the index for the first location after the end of the file - * will return the length of the file, rather than throwing an error. This allows rules to - * use getIndexFromLoc consistently without worrying about edge cases at the end of a file. - */ - if ( - loc.line === this.lineStartIndices.length && positionIndex > lineEndIndex || - loc.line < this.lineStartIndices.length && positionIndex >= lineEndIndex - ) { - throw new RangeError(`Column number out of range (column ${loc.column} requested, but the length of line ${loc.line} is ${lineEndIndex - lineStartIndex}).`); - } - - return positionIndex; - } - - /** - * Gets the scope for the given node - * @param {ASTNode} currentNode The node to get the scope of - * @returns {eslint-scope.Scope} The scope information for this node - * @throws {TypeError} If the `currentNode` argument is missing. - */ - getScope(currentNode) { - - if (!currentNode) { - throw new TypeError("Missing required argument: node."); - } - - // check cache first - const cache = this[caches].get("scopes"); - const cachedScope = cache.get(currentNode); - - if (cachedScope) { - return cachedScope; - } - - // On Program node, get the outermost scope to avoid return Node.js special function scope or ES modules scope. - const inner = currentNode.type !== "Program"; - - for (let node = currentNode; node; node = node.parent) { - const scope = this.scopeManager.acquire(node, inner); - - if (scope) { - if (scope.type === "function-expression-name") { - cache.set(currentNode, scope.childScopes[0]); - return scope.childScopes[0]; - } - - cache.set(currentNode, scope); - return scope; - } - } - - cache.set(currentNode, this.scopeManager.scopes[0]); - return this.scopeManager.scopes[0]; - } - - /** - * Get the variables that `node` defines. - * This is a convenience method that passes through - * to the same method on the `scopeManager`. - * @param {ASTNode} node The node for which the variables are obtained. - * @returns {Array} An array of variable nodes representing - * the variables that `node` defines. - */ - getDeclaredVariables(node) { - return this.scopeManager.getDeclaredVariables(node); - } - - /* eslint-disable class-methods-use-this -- node is owned by SourceCode */ - /** - * Gets all the ancestors of a given node - * @param {ASTNode} node The node - * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting - * from the root node at index 0 and going inwards to the parent node. - * @throws {TypeError} When `node` is missing. - */ - getAncestors(node) { - - if (!node) { - throw new TypeError("Missing required argument: node."); - } - - const ancestorsStartingAtParent = []; - - for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) { - ancestorsStartingAtParent.push(ancestor); - } - - return ancestorsStartingAtParent.reverse(); - } - /* eslint-enable class-methods-use-this -- node is owned by SourceCode */ - - /** - * Marks a variable as used in the current scope - * @param {string} name The name of the variable to mark as used. - * @param {ASTNode} [refNode] The closest node to the variable reference. - * @returns {boolean} True if the variable was found and marked as used, false if not. - */ - markVariableAsUsed(name, refNode = this.ast) { - - const currentScope = this.getScope(refNode); - let initialScope = currentScope; - - /* - * When we are in an ESM or CommonJS module, we need to start searching - * from the top-level scope, not the global scope. For ESM the top-level - * scope is the module scope; for CommonJS the top-level scope is the - * outer function scope. - * - * Without this check, we might miss a variable declared with `var` at - * the top-level because it won't exist in the global scope. - */ - if ( - currentScope.type === "global" && - currentScope.childScopes.length > 0 && - - // top-level scopes refer to a `Program` node - currentScope.childScopes[0].block === this.ast - ) { - initialScope = currentScope.childScopes[0]; - } - - for (let scope = initialScope; scope; scope = scope.upper) { - const variable = scope.variables.find(scopeVar => scopeVar.name === name); - - if (variable) { - variable.eslintUsed = true; - return true; - } - } - - return false; - } - - -} - -module.exports = SourceCode; diff --git a/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js b/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js deleted file mode 100644 index 7255a6226..000000000 --- a/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @fileoverview Define the cursor which iterates tokens and comments in reverse. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Cursor = require("./cursor"); -const utils = require("./utils"); - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The cursor which iterates tokens and comments in reverse. - */ -module.exports = class BackwardTokenCommentCursor extends Cursor { - - /** - * Initializes this cursor. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - */ - constructor(tokens, comments, indexMap, startLoc, endLoc) { - super(); - this.tokens = tokens; - this.comments = comments; - this.tokenIndex = utils.getLastIndex(tokens, indexMap, endLoc); - this.commentIndex = utils.search(comments, endLoc) - 1; - this.border = startLoc; - } - - /** @inheritdoc */ - moveNext() { - const token = (this.tokenIndex >= 0) ? this.tokens[this.tokenIndex] : null; - const comment = (this.commentIndex >= 0) ? this.comments[this.commentIndex] : null; - - if (token && (!comment || token.range[1] > comment.range[1])) { - this.current = token; - this.tokenIndex -= 1; - } else if (comment) { - this.current = comment; - this.commentIndex -= 1; - } else { - this.current = null; - } - - return Boolean(this.current) && (this.border === -1 || this.current.range[0] >= this.border); - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js b/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js deleted file mode 100644 index 454a24497..000000000 --- a/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @fileoverview Define the cursor which iterates tokens only in reverse. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Cursor = require("./cursor"); -const utils = require("./utils"); - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The cursor which iterates tokens only in reverse. - */ -module.exports = class BackwardTokenCursor extends Cursor { - - /** - * Initializes this cursor. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - */ - constructor(tokens, comments, indexMap, startLoc, endLoc) { - super(); - this.tokens = tokens; - this.index = utils.getLastIndex(tokens, indexMap, endLoc); - this.indexEnd = utils.getFirstIndex(tokens, indexMap, startLoc); - } - - /** @inheritdoc */ - moveNext() { - if (this.index >= this.indexEnd) { - this.current = this.tokens[this.index]; - this.index -= 1; - return true; - } - return false; - } - - /* - * - * Shorthand for performance. - * - */ - - /** @inheritdoc */ - getOneToken() { - return (this.index >= this.indexEnd) ? this.tokens[this.index] : null; - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/cursor.js b/node_modules/eslint/lib/source-code/token-store/cursor.js deleted file mode 100644 index 0b726006e..000000000 --- a/node_modules/eslint/lib/source-code/token-store/cursor.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @fileoverview Define the abstract class about cursors which iterate tokens. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The abstract class about cursors which iterate tokens. - * - * This class has 2 abstract methods. - * - * - `current: Token | Comment | null` ... The current token. - * - `moveNext(): boolean` ... Moves this cursor to the next token. If the next token didn't exist, it returns `false`. - * - * This is similar to ES2015 Iterators. - * However, Iterators were slow (at 2017-01), so I created this class as similar to C# IEnumerable. - * - * There are the following known sub classes. - * - * - ForwardTokenCursor .......... The cursor which iterates tokens only. - * - BackwardTokenCursor ......... The cursor which iterates tokens only in reverse. - * - ForwardTokenCommentCursor ... The cursor which iterates tokens and comments. - * - BackwardTokenCommentCursor .. The cursor which iterates tokens and comments in reverse. - * - DecorativeCursor - * - FilterCursor ............ The cursor which ignores the specified tokens. - * - SkipCursor .............. The cursor which ignores the first few tokens. - * - LimitCursor ............. The cursor which limits the count of tokens. - * - */ -module.exports = class Cursor { - - /** - * Initializes this cursor. - */ - constructor() { - this.current = null; - } - - /** - * Gets the first token. - * This consumes this cursor. - * @returns {Token|Comment} The first token or null. - */ - getOneToken() { - return this.moveNext() ? this.current : null; - } - - /** - * Gets the first tokens. - * This consumes this cursor. - * @returns {(Token|Comment)[]} All tokens. - */ - getAllTokens() { - const tokens = []; - - while (this.moveNext()) { - tokens.push(this.current); - } - - return tokens; - } - - /** - * Moves this cursor to the next token. - * @returns {boolean} `true` if the next token exists. - * @abstract - */ - /* c8 ignore next */ - moveNext() { // eslint-disable-line class-methods-use-this -- Unused - throw new Error("Not implemented."); - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/cursors.js b/node_modules/eslint/lib/source-code/token-store/cursors.js deleted file mode 100644 index 30c72b69b..000000000 --- a/node_modules/eslint/lib/source-code/token-store/cursors.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @fileoverview Define 2 token factories; forward and backward. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const BackwardTokenCommentCursor = require("./backward-token-comment-cursor"); -const BackwardTokenCursor = require("./backward-token-cursor"); -const FilterCursor = require("./filter-cursor"); -const ForwardTokenCommentCursor = require("./forward-token-comment-cursor"); -const ForwardTokenCursor = require("./forward-token-cursor"); -const LimitCursor = require("./limit-cursor"); -const SkipCursor = require("./skip-cursor"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * The cursor factory. - * @private - */ -class CursorFactory { - - /** - * Initializes this cursor. - * @param {Function} TokenCursor The class of the cursor which iterates tokens only. - * @param {Function} TokenCommentCursor The class of the cursor which iterates the mix of tokens and comments. - */ - constructor(TokenCursor, TokenCommentCursor) { - this.TokenCursor = TokenCursor; - this.TokenCommentCursor = TokenCommentCursor; - } - - /** - * Creates a base cursor instance that can be decorated by createCursor. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - * @param {boolean} includeComments The flag to iterate comments as well. - * @returns {Cursor} The created base cursor. - */ - createBaseCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments) { - const Cursor = includeComments ? this.TokenCommentCursor : this.TokenCursor; - - return new Cursor(tokens, comments, indexMap, startLoc, endLoc); - } - - /** - * Creates a cursor that iterates tokens with normalized options. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - * @param {boolean} includeComments The flag to iterate comments as well. - * @param {Function|null} filter The predicate function to choose tokens. - * @param {number} skip The count of tokens the cursor skips. - * @param {number} count The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. - * @returns {Cursor} The created cursor. - */ - createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, skip, count) { - let cursor = this.createBaseCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments); - - if (filter) { - cursor = new FilterCursor(cursor, filter); - } - if (skip >= 1) { - cursor = new SkipCursor(cursor, skip); - } - if (count >= 0) { - cursor = new LimitCursor(cursor, count); - } - - return cursor; - } -} - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -exports.forward = new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor); -exports.backward = new CursorFactory(BackwardTokenCursor, BackwardTokenCommentCursor); diff --git a/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js b/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js deleted file mode 100644 index 3ee7b0b39..000000000 --- a/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @fileoverview Define the abstract class about cursors which manipulate another cursor. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Cursor = require("./cursor"); - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The abstract class about cursors which manipulate another cursor. - */ -module.exports = class DecorativeCursor extends Cursor { - - /** - * Initializes this cursor. - * @param {Cursor} cursor The cursor to be decorated. - */ - constructor(cursor) { - super(); - this.cursor = cursor; - } - - /** @inheritdoc */ - moveNext() { - const retv = this.cursor.moveNext(); - - this.current = this.cursor.current; - - return retv; - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/filter-cursor.js b/node_modules/eslint/lib/source-code/token-store/filter-cursor.js deleted file mode 100644 index 08c4f2203..000000000 --- a/node_modules/eslint/lib/source-code/token-store/filter-cursor.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @fileoverview Define the cursor which ignores specified tokens. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const DecorativeCursor = require("./decorative-cursor"); - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The decorative cursor which ignores specified tokens. - */ -module.exports = class FilterCursor extends DecorativeCursor { - - /** - * Initializes this cursor. - * @param {Cursor} cursor The cursor to be decorated. - * @param {Function} predicate The predicate function to decide tokens this cursor iterates. - */ - constructor(cursor, predicate) { - super(cursor); - this.predicate = predicate; - } - - /** @inheritdoc */ - moveNext() { - const predicate = this.predicate; - - while (super.moveNext()) { - if (predicate(this.current)) { - return true; - } - } - return false; - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js b/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js deleted file mode 100644 index 50c7a394f..000000000 --- a/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @fileoverview Define the cursor which iterates tokens and comments. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Cursor = require("./cursor"); -const utils = require("./utils"); - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The cursor which iterates tokens and comments. - */ -module.exports = class ForwardTokenCommentCursor extends Cursor { - - /** - * Initializes this cursor. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - */ - constructor(tokens, comments, indexMap, startLoc, endLoc) { - super(); - this.tokens = tokens; - this.comments = comments; - this.tokenIndex = utils.getFirstIndex(tokens, indexMap, startLoc); - this.commentIndex = utils.search(comments, startLoc); - this.border = endLoc; - } - - /** @inheritdoc */ - moveNext() { - const token = (this.tokenIndex < this.tokens.length) ? this.tokens[this.tokenIndex] : null; - const comment = (this.commentIndex < this.comments.length) ? this.comments[this.commentIndex] : null; - - if (token && (!comment || token.range[0] < comment.range[0])) { - this.current = token; - this.tokenIndex += 1; - } else if (comment) { - this.current = comment; - this.commentIndex += 1; - } else { - this.current = null; - } - - return Boolean(this.current) && (this.border === -1 || this.current.range[1] <= this.border); - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js b/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js deleted file mode 100644 index e8c186096..000000000 --- a/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @fileoverview Define the cursor which iterates tokens only. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Cursor = require("./cursor"); -const utils = require("./utils"); - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The cursor which iterates tokens only. - */ -module.exports = class ForwardTokenCursor extends Cursor { - - /** - * Initializes this cursor. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - */ - constructor(tokens, comments, indexMap, startLoc, endLoc) { - super(); - this.tokens = tokens; - this.index = utils.getFirstIndex(tokens, indexMap, startLoc); - this.indexEnd = utils.getLastIndex(tokens, indexMap, endLoc); - } - - /** @inheritdoc */ - moveNext() { - if (this.index <= this.indexEnd) { - this.current = this.tokens[this.index]; - this.index += 1; - return true; - } - return false; - } - - /* - * - * Shorthand for performance. - * - */ - - /** @inheritdoc */ - getOneToken() { - return (this.index <= this.indexEnd) ? this.tokens[this.index] : null; - } - - /** @inheritdoc */ - getAllTokens() { - return this.tokens.slice(this.index, this.indexEnd + 1); - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/index.js b/node_modules/eslint/lib/source-code/token-store/index.js deleted file mode 100644 index 46a96b2f4..000000000 --- a/node_modules/eslint/lib/source-code/token-store/index.js +++ /dev/null @@ -1,627 +0,0 @@ -/** - * @fileoverview Object to handle access and retrieval of tokens. - * @author Brandon Mills - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const assert = require("assert"); -const { isCommentToken } = require("@eslint-community/eslint-utils"); -const cursors = require("./cursors"); -const ForwardTokenCursor = require("./forward-token-cursor"); -const PaddedTokenCursor = require("./padded-token-cursor"); -const utils = require("./utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const TOKENS = Symbol("tokens"); -const COMMENTS = Symbol("comments"); -const INDEX_MAP = Symbol("indexMap"); - -/** - * Creates the map from locations to indices in `tokens`. - * - * The first/last location of tokens is mapped to the index of the token. - * The first/last location of comments is mapped to the index of the next token of each comment. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @returns {Object} The map from locations to indices in `tokens`. - * @private - */ -function createIndexMap(tokens, comments) { - const map = Object.create(null); - let tokenIndex = 0; - let commentIndex = 0; - let nextStart = 0; - let range = null; - - while (tokenIndex < tokens.length || commentIndex < comments.length) { - nextStart = (commentIndex < comments.length) ? comments[commentIndex].range[0] : Number.MAX_SAFE_INTEGER; - while (tokenIndex < tokens.length && (range = tokens[tokenIndex].range)[0] < nextStart) { - map[range[0]] = tokenIndex; - map[range[1] - 1] = tokenIndex; - tokenIndex += 1; - } - - nextStart = (tokenIndex < tokens.length) ? tokens[tokenIndex].range[0] : Number.MAX_SAFE_INTEGER; - while (commentIndex < comments.length && (range = comments[commentIndex].range)[0] < nextStart) { - map[range[0]] = tokenIndex; - map[range[1] - 1] = tokenIndex; - commentIndex += 1; - } - } - - return map; -} - -/** - * Creates the cursor iterates tokens with options. - * @param {CursorFactory} factory The cursor factory to initialize cursor. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - * @param {number|Function|Object} [opts=0] The option object. If this is a number then it's `opts.skip`. If this is a function then it's `opts.filter`. - * @param {boolean} [opts.includeComments=false] The flag to iterate comments as well. - * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. - * @param {number} [opts.skip=0] The count of tokens the cursor skips. - * @returns {Cursor} The created cursor. - * @private - */ -function createCursorWithSkip(factory, tokens, comments, indexMap, startLoc, endLoc, opts) { - let includeComments = false; - let skip = 0; - let filter = null; - - if (typeof opts === "number") { - skip = opts | 0; - } else if (typeof opts === "function") { - filter = opts; - } else if (opts) { - includeComments = !!opts.includeComments; - skip = opts.skip | 0; - filter = opts.filter || null; - } - assert(skip >= 0, "options.skip should be zero or a positive integer."); - assert(!filter || typeof filter === "function", "options.filter should be a function."); - - return factory.createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, skip, -1); -} - -/** - * Creates the cursor iterates tokens with options. - * @param {CursorFactory} factory The cursor factory to initialize cursor. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - * @param {number|Function|Object} [opts=0] The option object. If this is a number then it's `opts.count`. If this is a function then it's `opts.filter`. - * @param {boolean} [opts.includeComments] The flag to iterate comments as well. - * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. - * @param {number} [opts.count=0] The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. - * @returns {Cursor} The created cursor. - * @private - */ -function createCursorWithCount(factory, tokens, comments, indexMap, startLoc, endLoc, opts) { - let includeComments = false; - let count = 0; - let countExists = false; - let filter = null; - - if (typeof opts === "number") { - count = opts | 0; - countExists = true; - } else if (typeof opts === "function") { - filter = opts; - } else if (opts) { - includeComments = !!opts.includeComments; - count = opts.count | 0; - countExists = typeof opts.count === "number"; - filter = opts.filter || null; - } - assert(count >= 0, "options.count should be zero or a positive integer."); - assert(!filter || typeof filter === "function", "options.filter should be a function."); - - return factory.createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, 0, countExists ? count : -1); -} - -/** - * Creates the cursor iterates tokens with options. - * This is overload function of the below. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - * @param {Function|Object} opts The option object. If this is a function then it's `opts.filter`. - * @param {boolean} [opts.includeComments] The flag to iterate comments as well. - * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. - * @param {number} [opts.count=0] The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. - * @returns {Cursor} The created cursor. - * @private - */ -/** - * Creates the cursor iterates tokens with options. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - * @param {number} [beforeCount=0] The number of tokens before the node to retrieve. - * @param {boolean} [afterCount=0] The number of tokens after the node to retrieve. - * @returns {Cursor} The created cursor. - * @private - */ -function createCursorWithPadding(tokens, comments, indexMap, startLoc, endLoc, beforeCount, afterCount) { - if (typeof beforeCount === "undefined" && typeof afterCount === "undefined") { - return new ForwardTokenCursor(tokens, comments, indexMap, startLoc, endLoc); - } - if (typeof beforeCount === "number" || typeof beforeCount === "undefined") { - return new PaddedTokenCursor(tokens, comments, indexMap, startLoc, endLoc, beforeCount | 0, afterCount | 0); - } - return createCursorWithCount(cursors.forward, tokens, comments, indexMap, startLoc, endLoc, beforeCount); -} - -/** - * Gets comment tokens that are adjacent to the current cursor position. - * @param {Cursor} cursor A cursor instance. - * @returns {Array} An array of comment tokens adjacent to the current cursor position. - * @private - */ -function getAdjacentCommentTokensFromCursor(cursor) { - const tokens = []; - let currentToken = cursor.getOneToken(); - - while (currentToken && isCommentToken(currentToken)) { - tokens.push(currentToken); - currentToken = cursor.getOneToken(); - } - - return tokens; -} - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The token store. - * - * This class provides methods to get tokens by locations as fast as possible. - * The methods are a part of public API, so we should be careful if it changes this class. - * - * People can get tokens in O(1) by the hash map which is mapping from the location of tokens/comments to tokens. - * Also people can get a mix of tokens and comments in O(log k), the k is the number of comments. - * Assuming that comments to be much fewer than tokens, this does not make hash map from token's locations to comments to reduce memory cost. - * This uses binary-searching instead for comments. - */ -module.exports = class TokenStore { - - /** - * Initializes this token store. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - */ - constructor(tokens, comments) { - this[TOKENS] = tokens; - this[COMMENTS] = comments; - this[INDEX_MAP] = createIndexMap(tokens, comments); - } - - //-------------------------------------------------------------------------- - // Gets single token. - //-------------------------------------------------------------------------- - - /** - * Gets the token starting at the specified index. - * @param {number} offset Index of the start of the token's range. - * @param {Object} [options=0] The option object. - * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. - * @returns {Token|null} The token starting at index, or null if no such token. - */ - getTokenByRangeStart(offset, options) { - const includeComments = options && options.includeComments; - const token = cursors.forward.createBaseCursor( - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - offset, - -1, - includeComments - ).getOneToken(); - - if (token && token.range[0] === offset) { - return token; - } - return null; - } - - /** - * Gets the first token of the given node. - * @param {ASTNode} node The AST node. - * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] The predicate function to choose tokens. - * @param {number} [options.skip=0] The count of tokens the cursor skips. - * @returns {Token|null} An object representing the token. - */ - getFirstToken(node, options) { - return createCursorWithSkip( - cursors.forward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - node.range[0], - node.range[1], - options - ).getOneToken(); - } - - /** - * Gets the last token of the given node. - * @param {ASTNode} node The AST node. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() - * @returns {Token|null} An object representing the token. - */ - getLastToken(node, options) { - return createCursorWithSkip( - cursors.backward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - node.range[0], - node.range[1], - options - ).getOneToken(); - } - - /** - * Gets the token that precedes a given node or token. - * @param {ASTNode|Token|Comment} node The AST node or token. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() - * @returns {Token|null} An object representing the token. - */ - getTokenBefore(node, options) { - return createCursorWithSkip( - cursors.backward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - -1, - node.range[0], - options - ).getOneToken(); - } - - /** - * Gets the token that follows a given node or token. - * @param {ASTNode|Token|Comment} node The AST node or token. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() - * @returns {Token|null} An object representing the token. - */ - getTokenAfter(node, options) { - return createCursorWithSkip( - cursors.forward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - node.range[1], - -1, - options - ).getOneToken(); - } - - /** - * Gets the first token between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left Node before the desired token range. - * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() - * @returns {Token|null} An object representing the token. - */ - getFirstTokenBetween(left, right, options) { - return createCursorWithSkip( - cursors.forward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - left.range[1], - right.range[0], - options - ).getOneToken(); - } - - /** - * Gets the last token between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left Node before the desired token range. - * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() - * @returns {Token|null} An object representing the token. - */ - getLastTokenBetween(left, right, options) { - return createCursorWithSkip( - cursors.backward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - left.range[1], - right.range[0], - options - ).getOneToken(); - } - - /** - * Gets the token that precedes a given node or token in the token stream. - * This is defined for backward compatibility. Use `includeComments` option instead. - * TODO: We have a plan to remove this in a future major version. - * @param {ASTNode|Token|Comment} node The AST node or token. - * @param {number} [skip=0] A number of tokens to skip. - * @returns {Token|null} An object representing the token. - * @deprecated - */ - getTokenOrCommentBefore(node, skip) { - return this.getTokenBefore(node, { includeComments: true, skip }); - } - - /** - * Gets the token that follows a given node or token in the token stream. - * This is defined for backward compatibility. Use `includeComments` option instead. - * TODO: We have a plan to remove this in a future major version. - * @param {ASTNode|Token|Comment} node The AST node or token. - * @param {number} [skip=0] A number of tokens to skip. - * @returns {Token|null} An object representing the token. - * @deprecated - */ - getTokenOrCommentAfter(node, skip) { - return this.getTokenAfter(node, { includeComments: true, skip }); - } - - //-------------------------------------------------------------------------- - // Gets multiple tokens. - //-------------------------------------------------------------------------- - - /** - * Gets the first `count` tokens of the given node. - * @param {ASTNode} node The AST node. - * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] The predicate function to choose tokens. - * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. - * @returns {Token[]} Tokens. - */ - getFirstTokens(node, options) { - return createCursorWithCount( - cursors.forward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - node.range[0], - node.range[1], - options - ).getAllTokens(); - } - - /** - * Gets the last `count` tokens of the given node. - * @param {ASTNode} node The AST node. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() - * @returns {Token[]} Tokens. - */ - getLastTokens(node, options) { - return createCursorWithCount( - cursors.backward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - node.range[0], - node.range[1], - options - ).getAllTokens().reverse(); - } - - /** - * Gets the `count` tokens that precedes a given node or token. - * @param {ASTNode|Token|Comment} node The AST node or token. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() - * @returns {Token[]} Tokens. - */ - getTokensBefore(node, options) { - return createCursorWithCount( - cursors.backward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - -1, - node.range[0], - options - ).getAllTokens().reverse(); - } - - /** - * Gets the `count` tokens that follows a given node or token. - * @param {ASTNode|Token|Comment} node The AST node or token. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() - * @returns {Token[]} Tokens. - */ - getTokensAfter(node, options) { - return createCursorWithCount( - cursors.forward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - node.range[1], - -1, - options - ).getAllTokens(); - } - - /** - * Gets the first `count` tokens between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left Node before the desired token range. - * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() - * @returns {Token[]} Tokens between left and right. - */ - getFirstTokensBetween(left, right, options) { - return createCursorWithCount( - cursors.forward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - left.range[1], - right.range[0], - options - ).getAllTokens(); - } - - /** - * Gets the last `count` tokens between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left Node before the desired token range. - * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() - * @returns {Token[]} Tokens between left and right. - */ - getLastTokensBetween(left, right, options) { - return createCursorWithCount( - cursors.backward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - left.range[1], - right.range[0], - options - ).getAllTokens().reverse(); - } - - /** - * Gets all tokens that are related to the given node. - * @param {ASTNode} node The AST node. - * @param {Function|Object} options The option object. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] The predicate function to choose tokens. - * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. - * @returns {Token[]} Array of objects representing tokens. - */ - /** - * Gets all tokens that are related to the given node. - * @param {ASTNode} node The AST node. - * @param {int} [beforeCount=0] The number of tokens before the node to retrieve. - * @param {int} [afterCount=0] The number of tokens after the node to retrieve. - * @returns {Token[]} Array of objects representing tokens. - */ - getTokens(node, beforeCount, afterCount) { - return createCursorWithPadding( - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - node.range[0], - node.range[1], - beforeCount, - afterCount - ).getAllTokens(); - } - - /** - * Gets all of the tokens between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left Node before the desired token range. - * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {Function|Object} options The option object. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] The predicate function to choose tokens. - * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. - * @returns {Token[]} Tokens between left and right. - */ - /** - * Gets all of the tokens between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left Node before the desired token range. - * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {int} [padding=0] Number of extra tokens on either side of center. - * @returns {Token[]} Tokens between left and right. - */ - getTokensBetween(left, right, padding) { - return createCursorWithPadding( - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - left.range[1], - right.range[0], - padding, - padding - ).getAllTokens(); - } - - //-------------------------------------------------------------------------- - // Others. - //-------------------------------------------------------------------------- - - /** - * Checks whether any comments exist or not between the given 2 nodes. - * @param {ASTNode} left The node to check. - * @param {ASTNode} right The node to check. - * @returns {boolean} `true` if one or more comments exist. - */ - commentsExistBetween(left, right) { - const index = utils.search(this[COMMENTS], left.range[1]); - - return ( - index < this[COMMENTS].length && - this[COMMENTS][index].range[1] <= right.range[0] - ); - } - - /** - * Gets all comment tokens directly before the given node or token. - * @param {ASTNode|token} nodeOrToken The AST node or token to check for adjacent comment tokens. - * @returns {Array} An array of comments in occurrence order. - */ - getCommentsBefore(nodeOrToken) { - const cursor = createCursorWithCount( - cursors.backward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - -1, - nodeOrToken.range[0], - { includeComments: true } - ); - - return getAdjacentCommentTokensFromCursor(cursor).reverse(); - } - - /** - * Gets all comment tokens directly after the given node or token. - * @param {ASTNode|token} nodeOrToken The AST node or token to check for adjacent comment tokens. - * @returns {Array} An array of comments in occurrence order. - */ - getCommentsAfter(nodeOrToken) { - const cursor = createCursorWithCount( - cursors.forward, - this[TOKENS], - this[COMMENTS], - this[INDEX_MAP], - nodeOrToken.range[1], - -1, - { includeComments: true } - ); - - return getAdjacentCommentTokensFromCursor(cursor); - } - - /** - * Gets all comment tokens inside the given node. - * @param {ASTNode} node The AST node to get the comments for. - * @returns {Array} An array of comments in occurrence order. - */ - getCommentsInside(node) { - return this.getTokens(node, { - includeComments: true, - filter: isCommentToken - }); - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/limit-cursor.js b/node_modules/eslint/lib/source-code/token-store/limit-cursor.js deleted file mode 100644 index 0fd92a776..000000000 --- a/node_modules/eslint/lib/source-code/token-store/limit-cursor.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @fileoverview Define the cursor which limits the number of tokens. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const DecorativeCursor = require("./decorative-cursor"); - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The decorative cursor which limits the number of tokens. - */ -module.exports = class LimitCursor extends DecorativeCursor { - - /** - * Initializes this cursor. - * @param {Cursor} cursor The cursor to be decorated. - * @param {number} count The count of tokens this cursor iterates. - */ - constructor(cursor, count) { - super(cursor); - this.count = count; - } - - /** @inheritdoc */ - moveNext() { - if (this.count > 0) { - this.count -= 1; - return super.moveNext(); - } - return false; - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js b/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js deleted file mode 100644 index 89349fa1c..000000000 --- a/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @fileoverview Define the cursor which iterates tokens only, with inflated range. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const ForwardTokenCursor = require("./forward-token-cursor"); - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The cursor which iterates tokens only, with inflated range. - * This is for the backward compatibility of padding options. - */ -module.exports = class PaddedTokenCursor extends ForwardTokenCursor { - - /** - * Initializes this cursor. - * @param {Token[]} tokens The array of tokens. - * @param {Comment[]} comments The array of comments. - * @param {Object} indexMap The map from locations to indices in `tokens`. - * @param {number} startLoc The start location of the iteration range. - * @param {number} endLoc The end location of the iteration range. - * @param {number} beforeCount The number of tokens this cursor iterates before start. - * @param {number} afterCount The number of tokens this cursor iterates after end. - */ - constructor(tokens, comments, indexMap, startLoc, endLoc, beforeCount, afterCount) { - super(tokens, comments, indexMap, startLoc, endLoc); - this.index = Math.max(0, this.index - beforeCount); - this.indexEnd = Math.min(tokens.length - 1, this.indexEnd + afterCount); - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/skip-cursor.js b/node_modules/eslint/lib/source-code/token-store/skip-cursor.js deleted file mode 100644 index f068f531c..000000000 --- a/node_modules/eslint/lib/source-code/token-store/skip-cursor.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @fileoverview Define the cursor which ignores the first few tokens. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const DecorativeCursor = require("./decorative-cursor"); - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The decorative cursor which ignores the first few tokens. - */ -module.exports = class SkipCursor extends DecorativeCursor { - - /** - * Initializes this cursor. - * @param {Cursor} cursor The cursor to be decorated. - * @param {number} count The count of tokens this cursor skips. - */ - constructor(cursor, count) { - super(cursor); - this.count = count; - } - - /** @inheritdoc */ - moveNext() { - while (this.count > 0) { - this.count -= 1; - if (!super.moveNext()) { - return false; - } - } - return super.moveNext(); - } -}; diff --git a/node_modules/eslint/lib/source-code/token-store/utils.js b/node_modules/eslint/lib/source-code/token-store/utils.js deleted file mode 100644 index 3e0147032..000000000 --- a/node_modules/eslint/lib/source-code/token-store/utils.js +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @fileoverview Define utility functions for token store. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * Finds the index of the first token which is after the given location. - * If it was not found, this returns `tokens.length`. - * @param {(Token|Comment)[]} tokens It searches the token in this list. - * @param {number} location The location to search. - * @returns {number} The found index or `tokens.length`. - */ -exports.search = function search(tokens, location) { - for (let minIndex = 0, maxIndex = tokens.length - 1; minIndex <= maxIndex;) { - - /* - * Calculate the index in the middle between minIndex and maxIndex. - * `| 0` is used to round a fractional value down to the nearest integer: this is similar to - * using `Math.trunc()` or `Math.floor()`, but performance tests have shown this method to - * be faster. - */ - const index = (minIndex + maxIndex) / 2 | 0; - const token = tokens[index]; - const tokenStartLocation = token.range[0]; - - if (location <= tokenStartLocation) { - if (index === minIndex) { - return index; - } - maxIndex = index; - } else { - minIndex = index + 1; - } - } - return tokens.length; -}; - -/** - * Gets the index of the `startLoc` in `tokens`. - * `startLoc` can be the value of `node.range[1]`, so this checks about `startLoc - 1` as well. - * @param {(Token|Comment)[]} tokens The tokens to find an index. - * @param {Object} indexMap The map from locations to indices. - * @param {number} startLoc The location to get an index. - * @returns {number} The index. - */ -exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) { - if (startLoc in indexMap) { - return indexMap[startLoc]; - } - if ((startLoc - 1) in indexMap) { - const index = indexMap[startLoc - 1]; - const token = tokens[index]; - - // If the mapped index is out of bounds, the returned cursor index will point after the end of the tokens array. - if (!token) { - return tokens.length; - } - - /* - * For the map of "comment's location -> token's index", it points the next token of a comment. - * In that case, +1 is unnecessary. - */ - if (token.range[0] >= startLoc) { - return index; - } - return index + 1; - } - return 0; -}; - -/** - * Gets the index of the `endLoc` in `tokens`. - * The information of end locations are recorded at `endLoc - 1` in `indexMap`, so this checks about `endLoc - 1` as well. - * @param {(Token|Comment)[]} tokens The tokens to find an index. - * @param {Object} indexMap The map from locations to indices. - * @param {number} endLoc The location to get an index. - * @returns {number} The index. - */ -exports.getLastIndex = function getLastIndex(tokens, indexMap, endLoc) { - if (endLoc in indexMap) { - return indexMap[endLoc] - 1; - } - if ((endLoc - 1) in indexMap) { - const index = indexMap[endLoc - 1]; - const token = tokens[index]; - - // If the mapped index is out of bounds, the returned cursor index will point before the end of the tokens array. - if (!token) { - return tokens.length - 1; - } - - /* - * For the map of "comment's location -> token's index", it points the next token of a comment. - * In that case, -1 is necessary. - */ - if (token.range[1] > endLoc) { - return index - 1; - } - return index; - } - return tokens.length - 1; -}; diff --git a/node_modules/eslint/lib/unsupported-api.js b/node_modules/eslint/lib/unsupported-api.js deleted file mode 100644 index b688608ca..000000000 --- a/node_modules/eslint/lib/unsupported-api.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @fileoverview APIs that are not officially supported by ESLint. - * These APIs may change or be removed at any time. Use at your - * own risk. - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const { FileEnumerator } = require("./cli-engine/file-enumerator"); -const { FlatESLint, shouldUseFlatConfig } = require("./eslint/flat-eslint"); -const FlatRuleTester = require("./rule-tester/flat-rule-tester"); - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -module.exports = { - builtinRules: require("./rules"), - FlatESLint, - shouldUseFlatConfig, - FlatRuleTester, - FileEnumerator -}; diff --git a/node_modules/eslint/messages/all-files-ignored.js b/node_modules/eslint/messages/all-files-ignored.js deleted file mode 100644 index 70877a4d8..000000000 --- a/node_modules/eslint/messages/all-files-ignored.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -module.exports = function(it) { - const { pattern } = it; - - return ` -You are linting "${pattern}", but all of the files matching the glob pattern "${pattern}" are ignored. - -If you don't want to lint these files, remove the pattern "${pattern}" from the list of arguments passed to ESLint. - -If you do want to lint these files, try the following solutions: - -* Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored. -* Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/extend-config-missing.js b/node_modules/eslint/messages/extend-config-missing.js deleted file mode 100644 index 5b3498fcd..000000000 --- a/node_modules/eslint/messages/extend-config-missing.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -module.exports = function(it) { - const { configName, importerName } = it; - - return ` -ESLint couldn't find the config "${configName}" to extend from. Please check that the name of the config is correct. - -The config "${configName}" was referenced from the config file in "${importerName}". - -If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/failed-to-read-json.js b/node_modules/eslint/messages/failed-to-read-json.js deleted file mode 100644 index e7c6cb587..000000000 --- a/node_modules/eslint/messages/failed-to-read-json.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -module.exports = function(it) { - const { path, message } = it; - - return ` -Failed to read JSON file at ${path}: - -${message} -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/file-not-found.js b/node_modules/eslint/messages/file-not-found.js deleted file mode 100644 index 1a62fcf96..000000000 --- a/node_modules/eslint/messages/file-not-found.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -module.exports = function(it) { - const { pattern, globDisabled } = it; - - return ` -No files matching the pattern "${pattern}"${globDisabled ? " (with disabling globs)" : ""} were found. -Please check for typing mistakes in the pattern. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/invalid-rule-options.js b/node_modules/eslint/messages/invalid-rule-options.js deleted file mode 100644 index 9a8acc934..000000000 --- a/node_modules/eslint/messages/invalid-rule-options.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -const { stringifyValueForError } = require("./shared"); - -module.exports = function({ ruleId, value }) { - return ` -Configuration for rule "${ruleId}" is invalid. Each rule must have a severity ("off", 0, "warn", 1, "error", or 2) and may be followed by additional options for the rule. - -You passed '${stringifyValueForError(value, 4)}', which doesn't contain a valid severity. - -If you're attempting to configure rule options, perhaps you meant: - - "${ruleId}": ["error", ${stringifyValueForError(value, 8)}] - -See https://eslint.org/docs/latest/use/configure/rules#using-configuration-files for configuring rules. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/invalid-rule-severity.js b/node_modules/eslint/messages/invalid-rule-severity.js deleted file mode 100644 index 3f13183c6..000000000 --- a/node_modules/eslint/messages/invalid-rule-severity.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -const { stringifyValueForError } = require("./shared"); - -module.exports = function({ ruleId, value }) { - return ` -Configuration for rule "${ruleId}" is invalid. Expected severity of "off", 0, "warn", 1, "error", or 2. - -You passed '${stringifyValueForError(value, 4)}'. - -See https://eslint.org/docs/latest/use/configure/rules#using-configuration-files for configuring rules. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/no-config-found.js b/node_modules/eslint/messages/no-config-found.js deleted file mode 100644 index 21cf549eb..000000000 --- a/node_modules/eslint/messages/no-config-found.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -module.exports = function(it) { - const { directoryPath } = it; - - return ` -ESLint couldn't find a configuration file. To set up a configuration file for this project, please run: - - npm init @eslint/config - -ESLint looked for configuration files in ${directoryPath} and its ancestors. If it found none, it then looked in your home directory. - -If you think you already have a configuration file or if you need more help, please stop by the ESLint Discord server: https://eslint.org/chat -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/plugin-conflict.js b/node_modules/eslint/messages/plugin-conflict.js deleted file mode 100644 index c8c060e2f..000000000 --- a/node_modules/eslint/messages/plugin-conflict.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -module.exports = function(it) { - const { pluginId, plugins } = it; - - let result = `ESLint couldn't determine the plugin "${pluginId}" uniquely. -`; - - for (const { filePath, importerName } of plugins) { - result += ` -- ${filePath} (loaded in "${importerName}")`; - } - - result += ` - -Please remove the "plugins" setting from either config or remove either plugin installation. - -If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. -`; - - return result; -}; diff --git a/node_modules/eslint/messages/plugin-invalid.js b/node_modules/eslint/messages/plugin-invalid.js deleted file mode 100644 index 8b471d4a3..000000000 --- a/node_modules/eslint/messages/plugin-invalid.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -module.exports = function(it) { - const { configName, importerName } = it; - - return ` -"${configName}" is invalid syntax for a config specifier. - -* If your intention is to extend from a configuration exported from the plugin, add the configuration name after a slash: e.g. "${configName}/myConfig". -* If this is the name of a shareable config instead of a plugin, remove the "plugin:" prefix: i.e. "${configName.slice("plugin:".length)}". - -"${configName}" was referenced from the config file in "${importerName}". - -If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/plugin-missing.js b/node_modules/eslint/messages/plugin-missing.js deleted file mode 100644 index 0b7d34e3a..000000000 --- a/node_modules/eslint/messages/plugin-missing.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -module.exports = function(it) { - const { pluginName, resolvePluginsRelativeTo, importerName } = it; - - return ` -ESLint couldn't find the plugin "${pluginName}". - -(The package "${pluginName}" was not found when loaded as a Node module from the directory "${resolvePluginsRelativeTo}".) - -It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: - - npm install ${pluginName}@latest --save-dev - -The plugin "${pluginName}" was referenced from the config file in "${importerName}". - -If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/print-config-with-directory-path.js b/node_modules/eslint/messages/print-config-with-directory-path.js deleted file mode 100644 index 4559c8d6d..000000000 --- a/node_modules/eslint/messages/print-config-with-directory-path.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -module.exports = function() { - return ` -The '--print-config' CLI option requires a path to a source code file rather than a directory. -See also: https://eslint.org/docs/latest/use/command-line-interface#--print-config -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/shared.js b/node_modules/eslint/messages/shared.js deleted file mode 100644 index 8c6e9b921..000000000 --- a/node_modules/eslint/messages/shared.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @fileoverview Shared utilities for error messages. - * @author Josh Goldberg - */ - -"use strict"; - -/** - * Converts a value to a string that may be printed in errors. - * @param {any} value The invalid value. - * @param {number} indentation How many spaces to indent - * @returns {string} The value, stringified. - */ -function stringifyValueForError(value, indentation) { - return value ? JSON.stringify(value, null, 4).replace(/\n/gu, `\n${" ".repeat(indentation)}`) : `${value}`; -} - -module.exports = { stringifyValueForError }; diff --git a/node_modules/eslint/messages/whitespace-found.js b/node_modules/eslint/messages/whitespace-found.js deleted file mode 100644 index 8a801bcec..000000000 --- a/node_modules/eslint/messages/whitespace-found.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -module.exports = function(it) { - const { pluginName } = it; - - return ` -ESLint couldn't find the plugin "${pluginName}". because there is whitespace in the name. Please check your configuration and remove all whitespace from the plugin name. - -If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. -`.trimStart(); -}; diff --git a/node_modules/eslint/package.json b/node_modules/eslint/package.json deleted file mode 100644 index ae6e8b35f..000000000 --- a/node_modules/eslint/package.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "name": "eslint", - "version": "8.41.0", - "author": "Nicholas C. Zakas ", - "description": "An AST-based pattern checker for JavaScript.", - "bin": { - "eslint": "./bin/eslint.js" - }, - "main": "./lib/api.js", - "exports": { - "./package.json": "./package.json", - ".": "./lib/api.js", - "./use-at-your-own-risk": "./lib/unsupported-api.js" - }, - "scripts": { - "build:docs:update-links": "node tools/fetch-docs-links.js", - "build:site": "node Makefile.js gensite", - "build:webpack": "node Makefile.js webpack", - "build:readme": "node tools/update-readme.js", - "lint": "node Makefile.js lint", - "lint:docs:js": "node Makefile.js lintDocsJS", - "lint:fix": "node Makefile.js lint -- fix", - "lint:fix:docs:js": "node Makefile.js lintDocsJS -- fix", - "release:generate:alpha": "node Makefile.js generatePrerelease -- alpha", - "release:generate:beta": "node Makefile.js generatePrerelease -- beta", - "release:generate:latest": "node Makefile.js generateRelease", - "release:generate:rc": "node Makefile.js generatePrerelease -- rc", - "release:publish": "node Makefile.js publishRelease", - "test": "node Makefile.js test", - "test:cli": "mocha", - "test:fuzz": "node Makefile.js fuzz", - "test:performance": "node Makefile.js perf" - }, - "gitHooks": { - "pre-commit": "lint-staged" - }, - "lint-staged": { - "*.js": "eslint --fix", - "*.md": "markdownlint --fix", - "lib/rules/*.js": [ - "node tools/update-eslint-all.js", - "git add packages/js/src/configs/eslint-all.js" - ], - "docs/src/rules/*.md": [ - "node tools/fetch-docs-links.js", - "git add docs/src/_data/further_reading_links.json" - ], - "docs/**/*.svg": "npx svgo -r --multipass" - }, - "files": [ - "LICENSE", - "README.md", - "bin", - "conf", - "lib", - "messages" - ], - "repository": "eslint/eslint", - "funding": "https://opencollective.com/eslint", - "homepage": "https://eslint.org", - "bugs": "https://github.com/eslint/eslint/issues/", - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.3", - "@eslint/js": "8.41.0", - "@humanwhocodes/config-array": "^0.11.8", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.0", - "eslint-visitor-keys": "^3.4.1", - "espree": "^9.5.2", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0" - }, - "devDependencies": { - "@babel/core": "^7.4.3", - "@babel/preset-env": "^7.4.3", - "babel-loader": "^8.0.5", - "c8": "^7.12.0", - "chai": "^4.0.1", - "cheerio": "^0.22.0", - "common-tags": "^1.8.0", - "core-js": "^3.1.3", - "ejs": "^3.0.2", - "eslint": "file:.", - "eslint-config-eslint": "file:packages/eslint-config-eslint", - "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-eslint-plugin": "^4.4.0", - "eslint-plugin-internal-rules": "file:tools/internal-rules", - "eslint-plugin-jsdoc": "^38.1.6", - "eslint-plugin-n": "^15.2.4", - "eslint-plugin-unicorn": "^42.0.0", - "eslint-release": "^3.2.0", - "eslump": "^3.0.0", - "esprima": "^4.0.1", - "fast-glob": "^3.2.11", - "fs-teardown": "^0.1.3", - "glob": "^7.1.6", - "got": "^11.8.3", - "gray-matter": "^4.0.3", - "karma": "^6.1.1", - "karma-chrome-launcher": "^3.1.0", - "karma-mocha": "^2.0.1", - "karma-mocha-reporter": "^2.2.5", - "karma-webpack": "^5.0.0", - "lint-staged": "^11.0.0", - "load-perf": "^0.2.0", - "markdownlint": "^0.25.1", - "markdownlint-cli": "^0.31.1", - "marked": "^4.0.8", - "memfs": "^3.0.1", - "metascraper": "^5.25.7", - "metascraper-description": "^5.25.7", - "metascraper-image": "^5.29.3", - "metascraper-logo": "^5.25.7", - "metascraper-logo-favicon": "^5.25.7", - "metascraper-title": "^5.25.7", - "mocha": "^8.3.2", - "mocha-junit-reporter": "^2.0.0", - "node-polyfill-webpack-plugin": "^1.0.3", - "npm-license": "^0.3.3", - "pirates": "^4.0.5", - "progress": "^2.0.3", - "proxyquire": "^2.0.1", - "puppeteer": "^13.7.0", - "recast": "^0.20.4", - "regenerator-runtime": "^0.13.2", - "semver": "^7.3.5", - "shelljs": "^0.8.2", - "sinon": "^11.0.0", - "temp": "^0.9.0", - "webpack": "^5.23.0", - "webpack-cli": "^4.5.0", - "yorkie": "^2.0.0" - }, - "keywords": [ - "ast", - "lint", - "javascript", - "ecmascript", - "espree" - ], - "license": "MIT", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } -} diff --git a/node_modules/espree/LICENSE b/node_modules/espree/LICENSE deleted file mode 100644 index b18469ff2..000000000 --- a/node_modules/espree/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -BSD 2-Clause License - -Copyright (c) Open JS Foundation -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/espree/README.md b/node_modules/espree/README.md deleted file mode 100644 index 8a38f247a..000000000 --- a/node_modules/espree/README.md +++ /dev/null @@ -1,244 +0,0 @@ -[![npm version](https://img.shields.io/npm/v/espree.svg)](https://www.npmjs.com/package/espree) -[![npm downloads](https://img.shields.io/npm/dm/espree.svg)](https://www.npmjs.com/package/espree) -[![Build Status](https://github.com/eslint/espree/workflows/CI/badge.svg)](https://github.com/eslint/espree/actions) -[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=9348450)](https://www.bountysource.com/trackers/9348450-eslint?utm_source=9348450&utm_medium=shield&utm_campaign=TRACKER_BADGE) - -# Espree - -Espree started out as a fork of [Esprima](http://esprima.org) v1.2.2, the last stable published released of Esprima before work on ECMAScript 6 began. Espree is now built on top of [Acorn](https://github.com/ternjs/acorn), which has a modular architecture that allows extension of core functionality. The goal of Espree is to produce output that is similar to Esprima with a similar API so that it can be used in place of Esprima. - -## Usage - -Install: - -``` -npm i espree -``` - -To use in an ESM file: - -```js -import * as espree from "espree"; - -const ast = espree.parse(code); -``` - -To use in a Common JS file: - -```js -const espree = require("espree"); - -const ast = espree.parse(code); -``` - -## API - -### `parse()` - -`parse` parses the given code and returns a abstract syntax tree (AST). It takes two parameters. - -- `code` [string]() - the code which needs to be parsed. -- `options (Optional)` [Object]() - read more about this [here](#options). - -```js -import * as espree from "espree"; - -const ast = espree.parse(code); -``` - -**Example :** - -```js -const ast = espree.parse('let foo = "bar"', { ecmaVersion: 6 }); -console.log(ast); -``` - -
Output -

- -``` -Node { - type: 'Program', - start: 0, - end: 15, - body: [ - Node { - type: 'VariableDeclaration', - start: 0, - end: 15, - declarations: [Array], - kind: 'let' - } - ], - sourceType: 'script' -} -``` - -

-
- -### `tokenize()` - -`tokenize` returns the tokens of a given code. It takes two parameters. - -- `code` [string]() - the code which needs to be parsed. -- `options (Optional)` [Object]() - read more about this [here](#options). - -Even if `options` is empty or undefined or `options.tokens` is `false`, it assigns it to `true` in order to get the `tokens` array - -**Example :** - -```js -import * as espree from "espree"; - -const tokens = espree.tokenize('let foo = "bar"', { ecmaVersion: 6 }); -console.log(tokens); -``` - -
Output -

- -``` -Token { type: 'Keyword', value: 'let', start: 0, end: 3 }, -Token { type: 'Identifier', value: 'foo', start: 4, end: 7 }, -Token { type: 'Punctuator', value: '=', start: 8, end: 9 }, -Token { type: 'String', value: '"bar"', start: 10, end: 15 } -``` - -

-
- -### `version` - -Returns the current `espree` version - -### `VisitorKeys` - -Returns all visitor keys for traversing the AST from [eslint-visitor-keys](https://github.com/eslint/eslint-visitor-keys) - -### `latestEcmaVersion` - -Returns the latest ECMAScript supported by `espree` - -### `supportedEcmaVersions` - -Returns an array of all supported ECMAScript versions - -## Options - -```js -const options = { - // attach range information to each node - range: false, - - // attach line/column location information to each node - loc: false, - - // create a top-level comments array containing all comments - comment: false, - - // create a top-level tokens array containing all tokens - tokens: false, - - // Set to 3, 5 (the default), 6, 7, 8, 9, 10, 11, 12, 13 or 14 to specify the version of ECMAScript syntax you want to use. - // You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), 2021 (same as 12), 2022 (same as 13) or 2023 (same as 14) to use the year-based naming. - // You can also set "latest" to use the most recently supported version. - ecmaVersion: 3, - - allowReserved: true, // only allowed when ecmaVersion is 3 - - // specify which type of script you're parsing ("script", "module", or "commonjs") - sourceType: "script", - - // specify additional language features - ecmaFeatures: { - - // enable JSX parsing - jsx: false, - - // enable return in global scope (set to true automatically when sourceType is "commonjs") - globalReturn: false, - - // enable implied strict mode (if ecmaVersion >= 5) - impliedStrict: false - } -} -``` - -## Esprima Compatibility Going Forward - -The primary goal is to produce the exact same AST structure and tokens as Esprima, and that takes precedence over anything else. (The AST structure being the [ESTree](https://github.com/estree/estree) API with JSX extensions.) Separate from that, Espree may deviate from what Esprima outputs in terms of where and how comments are attached, as well as what additional information is available on AST nodes. That is to say, Espree may add more things to the AST nodes than Esprima does but the overall AST structure produced will be the same. - -Espree may also deviate from Esprima in the interface it exposes. - -## Contributing - -Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/espree/issues). - -Espree is licensed under a permissive BSD 2-clause license. - -## Security Policy - -We work hard to ensure that Espree is safe for everyone and that security issues are addressed quickly and responsibly. Read the full [security policy](https://github.com/eslint/.github/blob/master/SECURITY.md). - -## Build Commands - -* `npm test` - run all linting and tests -* `npm run lint` - run all linting - -## Differences from Espree 2.x - -* The `tokenize()` method does not use `ecmaFeatures`. Any string will be tokenized completely based on ECMAScript 6 semantics. -* Trailing whitespace no longer is counted as part of a node. -* `let` and `const` declarations are no longer parsed by default. You must opt-in by using an `ecmaVersion` newer than `5` or setting `sourceType` to `module`. -* The `esparse` and `esvalidate` binary scripts have been removed. -* There is no `tolerant` option. We will investigate adding this back in the future. - -## Known Incompatibilities - -In an effort to help those wanting to transition from other parsers to Espree, the following is a list of noteworthy incompatibilities with other parsers. These are known differences that we do not intend to change. - -### Esprima 1.2.2 - -* Esprima counts trailing whitespace as part of each AST node while Espree does not. In Espree, the end of a node is where the last token occurs. -* Espree does not parse `let` and `const` declarations by default. -* Error messages returned for parsing errors are different. -* There are two addition properties on every node and token: `start` and `end`. These represent the same data as `range` and are used internally by Acorn. - -### Esprima 2.x - -* Esprima 2.x uses a different comment attachment algorithm that results in some comments being added in different places than Espree. The algorithm Espree uses is the same one used in Esprima 1.2.2. - -## Frequently Asked Questions - -### Why another parser - -[ESLint](http://eslint.org) had been relying on Esprima as its parser from the beginning. While that was fine when the JavaScript language was evolving slowly, the pace of development increased dramatically and Esprima had fallen behind. ESLint, like many other tools reliant on Esprima, has been stuck in using new JavaScript language features until Esprima updates, and that caused our users frustration. - -We decided the only way for us to move forward was to create our own parser, bringing us inline with JSHint and JSLint, and allowing us to keep implementing new features as we need them. We chose to fork Esprima instead of starting from scratch in order to move as quickly as possible with a compatible API. - -With Espree 2.0.0, we are no longer a fork of Esprima but rather a translation layer between Acorn and Esprima syntax. This allows us to put work back into a community-supported parser (Acorn) that is continuing to grow and evolve while maintaining an Esprima-compatible parser for those utilities still built on Esprima. - -### Have you tried working with Esprima? - -Yes. Since the start of ESLint, we've regularly filed bugs and feature requests with Esprima and will continue to do so. However, there are some different philosophies around how the projects work that need to be worked through. The initial goal was to have Espree track Esprima and eventually merge the two back together, but we ultimately decided that building on top of Acorn was a better choice due to Acorn's plugin support. - -### Why don't you just use Acorn? - -Acorn is a great JavaScript parser that produces an AST that is compatible with Esprima. Unfortunately, ESLint relies on more than just the AST to do its job. It relies on Esprima's tokens and comment attachment features to get a complete picture of the source code. We investigated switching to Acorn, but the inconsistencies between Esprima and Acorn created too much work for a project like ESLint. - -We are building on top of Acorn, however, so that we can contribute back and help make Acorn even better. - -### What ECMAScript features do you support? - -Espree supports all ECMAScript 2022 features and partially supports ECMAScript 2023 features. - -Because ECMAScript 2023 is still under development, we are implementing features as they are finalized. Currently, Espree supports: - -* [Hashbang grammar](https://github.com/tc39/proposal-hashbang) - -See [finished-proposals.md](https://github.com/tc39/proposals/blob/master/finished-proposals.md) to know what features are finalized. - -### How do you determine which experimental features to support? - -In general, we do not support experimental JavaScript features. We may make exceptions from time to time depending on the maturity of the features. diff --git a/node_modules/espree/dist/espree.cjs b/node_modules/espree/dist/espree.cjs deleted file mode 100644 index 6f601e823..000000000 --- a/node_modules/espree/dist/espree.cjs +++ /dev/null @@ -1,939 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var acorn = require('acorn'); -var jsx = require('acorn-jsx'); -var visitorKeys = require('eslint-visitor-keys'); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn); -var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx); -var visitorKeys__namespace = /*#__PURE__*/_interopNamespace(visitorKeys); - -/** - * @fileoverview Translates tokens between Acorn format and Esprima format. - * @author Nicholas C. Zakas - */ -/* eslint no-underscore-dangle: 0 */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// none! - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - - -// Esprima Token Types -const Token = { - Boolean: "Boolean", - EOF: "", - Identifier: "Identifier", - PrivateIdentifier: "PrivateIdentifier", - Keyword: "Keyword", - Null: "Null", - Numeric: "Numeric", - Punctuator: "Punctuator", - String: "String", - RegularExpression: "RegularExpression", - Template: "Template", - JSXIdentifier: "JSXIdentifier", - JSXText: "JSXText" -}; - -/** - * Converts part of a template into an Esprima token. - * @param {AcornToken[]} tokens The Acorn tokens representing the template. - * @param {string} code The source code. - * @returns {EsprimaToken} The Esprima equivalent of the template token. - * @private - */ -function convertTemplatePart(tokens, code) { - const firstToken = tokens[0], - lastTemplateToken = tokens[tokens.length - 1]; - - const token = { - type: Token.Template, - value: code.slice(firstToken.start, lastTemplateToken.end) - }; - - if (firstToken.loc) { - token.loc = { - start: firstToken.loc.start, - end: lastTemplateToken.loc.end - }; - } - - if (firstToken.range) { - token.start = firstToken.range[0]; - token.end = lastTemplateToken.range[1]; - token.range = [token.start, token.end]; - } - - return token; -} - -/** - * Contains logic to translate Acorn tokens into Esprima tokens. - * @param {Object} acornTokTypes The Acorn token types. - * @param {string} code The source code Acorn is parsing. This is necessary - * to correct the "value" property of some tokens. - * @constructor - */ -function TokenTranslator(acornTokTypes, code) { - - // token types - this._acornTokTypes = acornTokTypes; - - // token buffer for templates - this._tokens = []; - - // track the last curly brace - this._curlyBrace = null; - - // the source code - this._code = code; - -} - -TokenTranslator.prototype = { - constructor: TokenTranslator, - - /** - * Translates a single Esprima token to a single Acorn token. This may be - * inaccurate due to how templates are handled differently in Esprima and - * Acorn, but should be accurate for all other tokens. - * @param {AcornToken} token The Acorn token to translate. - * @param {Object} extra Espree extra object. - * @returns {EsprimaToken} The Esprima version of the token. - */ - translate(token, extra) { - - const type = token.type, - tt = this._acornTokTypes; - - if (type === tt.name) { - token.type = Token.Identifier; - - // TODO: See if this is an Acorn bug - if (token.value === "static") { - token.type = Token.Keyword; - } - - if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) { - token.type = Token.Keyword; - } - - } else if (type === tt.privateId) { - token.type = Token.PrivateIdentifier; - - } else if (type === tt.semi || type === tt.comma || - type === tt.parenL || type === tt.parenR || - type === tt.braceL || type === tt.braceR || - type === tt.dot || type === tt.bracketL || - type === tt.colon || type === tt.question || - type === tt.bracketR || type === tt.ellipsis || - type === tt.arrow || type === tt.jsxTagStart || - type === tt.incDec || type === tt.starstar || - type === tt.jsxTagEnd || type === tt.prefix || - type === tt.questionDot || - (type.binop && !type.keyword) || - type.isAssign) { - - token.type = Token.Punctuator; - token.value = this._code.slice(token.start, token.end); - } else if (type === tt.jsxName) { - token.type = Token.JSXIdentifier; - } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { - token.type = Token.JSXText; - } else if (type.keyword) { - if (type.keyword === "true" || type.keyword === "false") { - token.type = Token.Boolean; - } else if (type.keyword === "null") { - token.type = Token.Null; - } else { - token.type = Token.Keyword; - } - } else if (type === tt.num) { - token.type = Token.Numeric; - token.value = this._code.slice(token.start, token.end); - } else if (type === tt.string) { - - if (extra.jsxAttrValueToken) { - extra.jsxAttrValueToken = false; - token.type = Token.JSXText; - } else { - token.type = Token.String; - } - - token.value = this._code.slice(token.start, token.end); - } else if (type === tt.regexp) { - token.type = Token.RegularExpression; - const value = token.value; - - token.regex = { - flags: value.flags, - pattern: value.pattern - }; - token.value = `/${value.pattern}/${value.flags}`; - } - - return token; - }, - - /** - * Function to call during Acorn's onToken handler. - * @param {AcornToken} token The Acorn token. - * @param {Object} extra The Espree extra object. - * @returns {void} - */ - onToken(token, extra) { - - const that = this, - tt = this._acornTokTypes, - tokens = extra.tokens, - templateTokens = this._tokens; - - /** - * Flushes the buffered template tokens and resets the template - * tracking. - * @returns {void} - * @private - */ - function translateTemplateTokens() { - tokens.push(convertTemplatePart(that._tokens, that._code)); - that._tokens = []; - } - - if (token.type === tt.eof) { - - // might be one last curlyBrace - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - } - - return; - } - - if (token.type === tt.backQuote) { - - // if there's already a curly, it's not part of the template - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - this._curlyBrace = null; - } - - templateTokens.push(token); - - // it's the end - if (templateTokens.length > 1) { - translateTemplateTokens(); - } - - return; - } - if (token.type === tt.dollarBraceL) { - templateTokens.push(token); - translateTemplateTokens(); - return; - } - if (token.type === tt.braceR) { - - // if there's already a curly, it's not part of the template - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - } - - // store new curly for later - this._curlyBrace = token; - return; - } - if (token.type === tt.template || token.type === tt.invalidTemplate) { - if (this._curlyBrace) { - templateTokens.push(this._curlyBrace); - this._curlyBrace = null; - } - - templateTokens.push(token); - return; - } - - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - this._curlyBrace = null; - } - - tokens.push(this.translate(token, extra)); - } -}; - -/** - * @fileoverview A collection of methods for processing Espree's options. - * @author Kai Cataldo - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const SUPPORTED_VERSIONS = [ - 3, - 5, - 6, // 2015 - 7, // 2016 - 8, // 2017 - 9, // 2018 - 10, // 2019 - 11, // 2020 - 12, // 2021 - 13, // 2022 - 14 // 2023 -]; - -/** - * Get the latest ECMAScript version supported by Espree. - * @returns {number} The latest ECMAScript version. - */ -function getLatestEcmaVersion() { - return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1]; -} - -/** - * Get the list of ECMAScript versions supported by Espree. - * @returns {number[]} An array containing the supported ECMAScript versions. - */ -function getSupportedEcmaVersions() { - return [...SUPPORTED_VERSIONS]; -} - -/** - * Normalize ECMAScript version from the initial config - * @param {(number|"latest")} ecmaVersion ECMAScript version from the initial config - * @throws {Error} throws an error if the ecmaVersion is invalid. - * @returns {number} normalized ECMAScript version - */ -function normalizeEcmaVersion(ecmaVersion = 5) { - - let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion; - - if (typeof version !== "number") { - throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof ecmaVersion} instead.`); - } - - // Calculate ECMAScript edition number from official year version starting with - // ES2015, which corresponds with ES6 (or a difference of 2009). - if (version >= 2015) { - version -= 2009; - } - - if (!SUPPORTED_VERSIONS.includes(version)) { - throw new Error("Invalid ecmaVersion."); - } - - return version; -} - -/** - * Normalize sourceType from the initial config - * @param {string} sourceType to normalize - * @throws {Error} throw an error if sourceType is invalid - * @returns {string} normalized sourceType - */ -function normalizeSourceType(sourceType = "script") { - if (sourceType === "script" || sourceType === "module") { - return sourceType; - } - - if (sourceType === "commonjs") { - return "script"; - } - - throw new Error("Invalid sourceType."); -} - -/** - * Normalize parserOptions - * @param {Object} options the parser options to normalize - * @throws {Error} throw an error if found invalid option. - * @returns {Object} normalized options - */ -function normalizeOptions(options) { - const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); - const sourceType = normalizeSourceType(options.sourceType); - const ranges = options.range === true; - const locations = options.loc === true; - - if (ecmaVersion !== 3 && options.allowReserved) { - - // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed - throw new Error("`allowReserved` is only supported when ecmaVersion is 3"); - } - if (typeof options.allowReserved !== "undefined" && typeof options.allowReserved !== "boolean") { - throw new Error("`allowReserved`, when present, must be `true` or `false`"); - } - const allowReserved = ecmaVersion === 3 ? (options.allowReserved || "never") : false; - const ecmaFeatures = options.ecmaFeatures || {}; - const allowReturnOutsideFunction = options.sourceType === "commonjs" || - Boolean(ecmaFeatures.globalReturn); - - if (sourceType === "module" && ecmaVersion < 6) { - throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options."); - } - - return Object.assign({}, options, { - ecmaVersion, - sourceType, - ranges, - locations, - allowReserved, - allowReturnOutsideFunction - }); -} - -/* eslint-disable no-param-reassign*/ - - -const STATE = Symbol("espree's internal state"); -const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); - - -/** - * Converts an Acorn comment to a Esprima comment. - * @param {boolean} block True if it's a block comment, false if not. - * @param {string} text The text of the comment. - * @param {int} start The index at which the comment starts. - * @param {int} end The index at which the comment ends. - * @param {Location} startLoc The location at which the comment starts. - * @param {Location} endLoc The location at which the comment ends. - * @param {string} code The source code being parsed. - * @returns {Object} The comment object. - * @private - */ -function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code) { - let type; - - if (block) { - type = "Block"; - } else if (code.slice(start, start + 2) === "#!") { - type = "Hashbang"; - } else { - type = "Line"; - } - - const comment = { - type, - value: text - }; - - if (typeof start === "number") { - comment.start = start; - comment.end = end; - comment.range = [start, end]; - } - - if (typeof startLoc === "object") { - comment.loc = { - start: startLoc, - end: endLoc - }; - } - - return comment; -} - -var espree = () => Parser => { - const tokTypes = Object.assign({}, Parser.acorn.tokTypes); - - if (Parser.acornJsx) { - Object.assign(tokTypes, Parser.acornJsx.tokTypes); - } - - return class Espree extends Parser { - constructor(opts, code) { - if (typeof opts !== "object" || opts === null) { - opts = {}; - } - if (typeof code !== "string" && !(code instanceof String)) { - code = String(code); - } - - // save original source type in case of commonjs - const originalSourceType = opts.sourceType; - const options = normalizeOptions(opts); - const ecmaFeatures = options.ecmaFeatures || {}; - const tokenTranslator = - options.tokens === true - ? new TokenTranslator(tokTypes, code) - : null; - - /* - * Data that is unique to Espree and is not represented internally - * in Acorn. - * - * For ES2023 hashbangs, Espree will call `onComment()` during the - * constructor, so we must define state before having access to - * `this`. - */ - const state = { - originalSourceType: originalSourceType || options.sourceType, - tokens: tokenTranslator ? [] : null, - comments: options.comment === true ? [] : null, - impliedStrict: ecmaFeatures.impliedStrict === true && options.ecmaVersion >= 5, - ecmaVersion: options.ecmaVersion, - jsxAttrValueToken: false, - lastToken: null, - templateElements: [] - }; - - // Initialize acorn parser. - super({ - - // do not use spread, because we don't want to pass any unknown options to acorn - ecmaVersion: options.ecmaVersion, - sourceType: options.sourceType, - ranges: options.ranges, - locations: options.locations, - allowReserved: options.allowReserved, - - // Truthy value is true for backward compatibility. - allowReturnOutsideFunction: options.allowReturnOutsideFunction, - - // Collect tokens - onToken: token => { - if (tokenTranslator) { - - // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. - tokenTranslator.onToken(token, state); - } - if (token.type !== tokTypes.eof) { - state.lastToken = token; - } - }, - - // Collect comments - onComment: (block, text, start, end, startLoc, endLoc) => { - if (state.comments) { - const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code); - - state.comments.push(comment); - } - } - }, code); - - /* - * We put all of this data into a symbol property as a way to avoid - * potential naming conflicts with future versions of Acorn. - */ - this[STATE] = state; - } - - tokenize() { - do { - this.next(); - } while (this.type !== tokTypes.eof); - - // Consume the final eof token - this.next(); - - const extra = this[STATE]; - const tokens = extra.tokens; - - if (extra.comments) { - tokens.comments = extra.comments; - } - - return tokens; - } - - finishNode(...args) { - const result = super.finishNode(...args); - - return this[ESPRIMA_FINISH_NODE](result); - } - - finishNodeAt(...args) { - const result = super.finishNodeAt(...args); - - return this[ESPRIMA_FINISH_NODE](result); - } - - parse() { - const extra = this[STATE]; - const program = super.parse(); - - program.sourceType = extra.originalSourceType; - - if (extra.comments) { - program.comments = extra.comments; - } - if (extra.tokens) { - program.tokens = extra.tokens; - } - - /* - * Adjust opening and closing position of program to match Esprima. - * Acorn always starts programs at range 0 whereas Esprima starts at the - * first AST node's start (the only real difference is when there's leading - * whitespace or leading comments). Acorn also counts trailing whitespace - * as part of the program whereas Esprima only counts up to the last token. - */ - if (program.body.length) { - const [firstNode] = program.body; - - if (program.range) { - program.range[0] = firstNode.range[0]; - } - if (program.loc) { - program.loc.start = firstNode.loc.start; - } - program.start = firstNode.start; - } - if (extra.lastToken) { - if (program.range) { - program.range[1] = extra.lastToken.range[1]; - } - if (program.loc) { - program.loc.end = extra.lastToken.loc.end; - } - program.end = extra.lastToken.end; - } - - - /* - * https://github.com/eslint/espree/issues/349 - * Ensure that template elements have correct range information. - * This is one location where Acorn produces a different value - * for its start and end properties vs. the values present in the - * range property. In order to avoid confusion, we set the start - * and end properties to the values that are present in range. - * This is done here, instead of in finishNode(), because Acorn - * uses the values of start and end internally while parsing, making - * it dangerous to change those values while parsing is ongoing. - * By waiting until the end of parsing, we can safely change these - * values without affect any other part of the process. - */ - this[STATE].templateElements.forEach(templateElement => { - const startOffset = -1; - const endOffset = templateElement.tail ? 1 : 2; - - templateElement.start += startOffset; - templateElement.end += endOffset; - - if (templateElement.range) { - templateElement.range[0] += startOffset; - templateElement.range[1] += endOffset; - } - - if (templateElement.loc) { - templateElement.loc.start.column += startOffset; - templateElement.loc.end.column += endOffset; - } - }); - - return program; - } - - parseTopLevel(node) { - if (this[STATE].impliedStrict) { - this.strict = true; - } - return super.parseTopLevel(node); - } - - /** - * Overwrites the default raise method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @param {string} message The error message. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - raise(pos, message) { - const loc = Parser.acorn.getLineInfo(this.input, pos); - const err = new SyntaxError(message); - - err.index = pos; - err.lineNumber = loc.line; - err.column = loc.column + 1; // acorn uses 0-based columns - throw err; - } - - /** - * Overwrites the default raise method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @param {string} message The error message. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - raiseRecoverable(pos, message) { - this.raise(pos, message); - } - - /** - * Overwrites the default unexpected method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - unexpected(pos) { - let message = "Unexpected token"; - - if (pos !== null && pos !== void 0) { - this.pos = pos; - - if (this.options.locations) { - while (this.pos < this.lineStart) { - this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; - --this.curLine; - } - } - - this.nextToken(); - } - - if (this.end > this.start) { - message += ` ${this.input.slice(this.start, this.end)}`; - } - - this.raise(this.start, message); - } - - /* - * Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX - * uses regular tt.string without any distinction between this and regular JS - * strings. As such, we intercept an attempt to read a JSX string and set a flag - * on extra so that when tokens are converted, the next token will be switched - * to JSXText via onToken. - */ - jsx_readString(quote) { // eslint-disable-line camelcase - const result = super.jsx_readString(quote); - - if (this.type === tokTypes.string) { - this[STATE].jsxAttrValueToken = true; - } - return result; - } - - /** - * Performs last-minute Esprima-specific compatibility checks and fixes. - * @param {ASTNode} result The node to check. - * @returns {ASTNode} The finished node. - */ - [ESPRIMA_FINISH_NODE](result) { - - // Acorn doesn't count the opening and closing backticks as part of templates - // so we have to adjust ranges/locations appropriately. - if (result.type === "TemplateElement") { - - // save template element references to fix start/end later - this[STATE].templateElements.push(result); - } - - if (result.type.includes("Function") && !result.generator) { - result.generator = false; - } - - return result; - } - }; -}; - -const version$1 = "9.5.2"; - -/** - * @fileoverview Main Espree file that converts Acorn into Esprima output. - * - * This file contains code from the following MIT-licensed projects: - * 1. Acorn - * 2. Babylon - * 3. Babel-ESLint - * - * This file also contains code from Esprima, which is BSD licensed. - * - * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS) - * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS) - * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -// To initialize lazily. -const parsers = { - _regular: null, - _jsx: null, - - get regular() { - if (this._regular === null) { - this._regular = acorn__namespace.Parser.extend(espree()); - } - return this._regular; - }, - - get jsx() { - if (this._jsx === null) { - this._jsx = acorn__namespace.Parser.extend(jsx__default["default"](), espree()); - } - return this._jsx; - }, - - get(options) { - const useJsx = Boolean( - options && - options.ecmaFeatures && - options.ecmaFeatures.jsx - ); - - return useJsx ? this.jsx : this.regular; - } -}; - -//------------------------------------------------------------------------------ -// Tokenizer -//------------------------------------------------------------------------------ - -/** - * Tokenizes the given code. - * @param {string} code The code to tokenize. - * @param {Object} options Options defining how to tokenize. - * @returns {Token[]} An array of tokens. - * @throws {SyntaxError} If the input code is invalid. - * @private - */ -function tokenize(code, options) { - const Parser = parsers.get(options); - - // Ensure to collect tokens. - if (!options || options.tokens !== true) { - options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign - } - - return new Parser(options, code).tokenize(); -} - -//------------------------------------------------------------------------------ -// Parser -//------------------------------------------------------------------------------ - -/** - * Parses the given code. - * @param {string} code The code to tokenize. - * @param {Object} options Options defining how to tokenize. - * @returns {ASTNode} The "Program" AST node. - * @throws {SyntaxError} If the input code is invalid. - */ -function parse(code, options) { - const Parser = parsers.get(options); - - return new Parser(options, code).parse(); -} - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -const version = version$1; -const name = "espree"; - -/* istanbul ignore next */ -const VisitorKeys = (function() { - return visitorKeys__namespace.KEYS; -}()); - -// Derive node types from VisitorKeys -/* istanbul ignore next */ -const Syntax = (function() { - let key, - types = {}; - - if (typeof Object.create === "function") { - types = Object.create(null); - } - - for (key in VisitorKeys) { - if (Object.hasOwnProperty.call(VisitorKeys, key)) { - types[key] = key; - } - } - - if (typeof Object.freeze === "function") { - Object.freeze(types); - } - - return types; -}()); - -const latestEcmaVersion = getLatestEcmaVersion(); - -const supportedEcmaVersions = getSupportedEcmaVersions(); - -exports.Syntax = Syntax; -exports.VisitorKeys = VisitorKeys; -exports.latestEcmaVersion = latestEcmaVersion; -exports.name = name; -exports.parse = parse; -exports.supportedEcmaVersions = supportedEcmaVersions; -exports.tokenize = tokenize; -exports.version = version; diff --git a/node_modules/espree/espree.js b/node_modules/espree/espree.js deleted file mode 100644 index 97bda4bd1..000000000 --- a/node_modules/espree/espree.js +++ /dev/null @@ -1,174 +0,0 @@ -/** - * @fileoverview Main Espree file that converts Acorn into Esprima output. - * - * This file contains code from the following MIT-licensed projects: - * 1. Acorn - * 2. Babylon - * 3. Babel-ESLint - * - * This file also contains code from Esprima, which is BSD licensed. - * - * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS) - * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS) - * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* eslint no-undefined:0, no-use-before-define: 0 */ - -import * as acorn from "acorn"; -import jsx from "acorn-jsx"; -import espree from "./lib/espree.js"; -import espreeVersion from "./lib/version.js"; -import * as visitorKeys from "eslint-visitor-keys"; -import { getLatestEcmaVersion, getSupportedEcmaVersions } from "./lib/options.js"; - - -// To initialize lazily. -const parsers = { - _regular: null, - _jsx: null, - - get regular() { - if (this._regular === null) { - this._regular = acorn.Parser.extend(espree()); - } - return this._regular; - }, - - get jsx() { - if (this._jsx === null) { - this._jsx = acorn.Parser.extend(jsx(), espree()); - } - return this._jsx; - }, - - get(options) { - const useJsx = Boolean( - options && - options.ecmaFeatures && - options.ecmaFeatures.jsx - ); - - return useJsx ? this.jsx : this.regular; - } -}; - -//------------------------------------------------------------------------------ -// Tokenizer -//------------------------------------------------------------------------------ - -/** - * Tokenizes the given code. - * @param {string} code The code to tokenize. - * @param {Object} options Options defining how to tokenize. - * @returns {Token[]} An array of tokens. - * @throws {SyntaxError} If the input code is invalid. - * @private - */ -export function tokenize(code, options) { - const Parser = parsers.get(options); - - // Ensure to collect tokens. - if (!options || options.tokens !== true) { - options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign - } - - return new Parser(options, code).tokenize(); -} - -//------------------------------------------------------------------------------ -// Parser -//------------------------------------------------------------------------------ - -/** - * Parses the given code. - * @param {string} code The code to tokenize. - * @param {Object} options Options defining how to tokenize. - * @returns {ASTNode} The "Program" AST node. - * @throws {SyntaxError} If the input code is invalid. - */ -export function parse(code, options) { - const Parser = parsers.get(options); - - return new Parser(options, code).parse(); -} - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -export const version = espreeVersion; -export const name = "espree"; - -/* istanbul ignore next */ -export const VisitorKeys = (function() { - return visitorKeys.KEYS; -}()); - -// Derive node types from VisitorKeys -/* istanbul ignore next */ -export const Syntax = (function() { - let key, - types = {}; - - if (typeof Object.create === "function") { - types = Object.create(null); - } - - for (key in VisitorKeys) { - if (Object.hasOwnProperty.call(VisitorKeys, key)) { - types[key] = key; - } - } - - if (typeof Object.freeze === "function") { - Object.freeze(types); - } - - return types; -}()); - -export const latestEcmaVersion = getLatestEcmaVersion(); - -export const supportedEcmaVersions = getSupportedEcmaVersions(); diff --git a/node_modules/espree/lib/espree.js b/node_modules/espree/lib/espree.js deleted file mode 100644 index 262dd276a..000000000 --- a/node_modules/espree/lib/espree.js +++ /dev/null @@ -1,348 +0,0 @@ -/* eslint-disable no-param-reassign*/ -import TokenTranslator from "./token-translator.js"; -import { normalizeOptions } from "./options.js"; - - -const STATE = Symbol("espree's internal state"); -const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); - - -/** - * Converts an Acorn comment to a Esprima comment. - * @param {boolean} block True if it's a block comment, false if not. - * @param {string} text The text of the comment. - * @param {int} start The index at which the comment starts. - * @param {int} end The index at which the comment ends. - * @param {Location} startLoc The location at which the comment starts. - * @param {Location} endLoc The location at which the comment ends. - * @param {string} code The source code being parsed. - * @returns {Object} The comment object. - * @private - */ -function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code) { - let type; - - if (block) { - type = "Block"; - } else if (code.slice(start, start + 2) === "#!") { - type = "Hashbang"; - } else { - type = "Line"; - } - - const comment = { - type, - value: text - }; - - if (typeof start === "number") { - comment.start = start; - comment.end = end; - comment.range = [start, end]; - } - - if (typeof startLoc === "object") { - comment.loc = { - start: startLoc, - end: endLoc - }; - } - - return comment; -} - -export default () => Parser => { - const tokTypes = Object.assign({}, Parser.acorn.tokTypes); - - if (Parser.acornJsx) { - Object.assign(tokTypes, Parser.acornJsx.tokTypes); - } - - return class Espree extends Parser { - constructor(opts, code) { - if (typeof opts !== "object" || opts === null) { - opts = {}; - } - if (typeof code !== "string" && !(code instanceof String)) { - code = String(code); - } - - // save original source type in case of commonjs - const originalSourceType = opts.sourceType; - const options = normalizeOptions(opts); - const ecmaFeatures = options.ecmaFeatures || {}; - const tokenTranslator = - options.tokens === true - ? new TokenTranslator(tokTypes, code) - : null; - - /* - * Data that is unique to Espree and is not represented internally - * in Acorn. - * - * For ES2023 hashbangs, Espree will call `onComment()` during the - * constructor, so we must define state before having access to - * `this`. - */ - const state = { - originalSourceType: originalSourceType || options.sourceType, - tokens: tokenTranslator ? [] : null, - comments: options.comment === true ? [] : null, - impliedStrict: ecmaFeatures.impliedStrict === true && options.ecmaVersion >= 5, - ecmaVersion: options.ecmaVersion, - jsxAttrValueToken: false, - lastToken: null, - templateElements: [] - }; - - // Initialize acorn parser. - super({ - - // do not use spread, because we don't want to pass any unknown options to acorn - ecmaVersion: options.ecmaVersion, - sourceType: options.sourceType, - ranges: options.ranges, - locations: options.locations, - allowReserved: options.allowReserved, - - // Truthy value is true for backward compatibility. - allowReturnOutsideFunction: options.allowReturnOutsideFunction, - - // Collect tokens - onToken: token => { - if (tokenTranslator) { - - // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. - tokenTranslator.onToken(token, state); - } - if (token.type !== tokTypes.eof) { - state.lastToken = token; - } - }, - - // Collect comments - onComment: (block, text, start, end, startLoc, endLoc) => { - if (state.comments) { - const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code); - - state.comments.push(comment); - } - } - }, code); - - /* - * We put all of this data into a symbol property as a way to avoid - * potential naming conflicts with future versions of Acorn. - */ - this[STATE] = state; - } - - tokenize() { - do { - this.next(); - } while (this.type !== tokTypes.eof); - - // Consume the final eof token - this.next(); - - const extra = this[STATE]; - const tokens = extra.tokens; - - if (extra.comments) { - tokens.comments = extra.comments; - } - - return tokens; - } - - finishNode(...args) { - const result = super.finishNode(...args); - - return this[ESPRIMA_FINISH_NODE](result); - } - - finishNodeAt(...args) { - const result = super.finishNodeAt(...args); - - return this[ESPRIMA_FINISH_NODE](result); - } - - parse() { - const extra = this[STATE]; - const program = super.parse(); - - program.sourceType = extra.originalSourceType; - - if (extra.comments) { - program.comments = extra.comments; - } - if (extra.tokens) { - program.tokens = extra.tokens; - } - - /* - * Adjust opening and closing position of program to match Esprima. - * Acorn always starts programs at range 0 whereas Esprima starts at the - * first AST node's start (the only real difference is when there's leading - * whitespace or leading comments). Acorn also counts trailing whitespace - * as part of the program whereas Esprima only counts up to the last token. - */ - if (program.body.length) { - const [firstNode] = program.body; - - if (program.range) { - program.range[0] = firstNode.range[0]; - } - if (program.loc) { - program.loc.start = firstNode.loc.start; - } - program.start = firstNode.start; - } - if (extra.lastToken) { - if (program.range) { - program.range[1] = extra.lastToken.range[1]; - } - if (program.loc) { - program.loc.end = extra.lastToken.loc.end; - } - program.end = extra.lastToken.end; - } - - - /* - * https://github.com/eslint/espree/issues/349 - * Ensure that template elements have correct range information. - * This is one location where Acorn produces a different value - * for its start and end properties vs. the values present in the - * range property. In order to avoid confusion, we set the start - * and end properties to the values that are present in range. - * This is done here, instead of in finishNode(), because Acorn - * uses the values of start and end internally while parsing, making - * it dangerous to change those values while parsing is ongoing. - * By waiting until the end of parsing, we can safely change these - * values without affect any other part of the process. - */ - this[STATE].templateElements.forEach(templateElement => { - const startOffset = -1; - const endOffset = templateElement.tail ? 1 : 2; - - templateElement.start += startOffset; - templateElement.end += endOffset; - - if (templateElement.range) { - templateElement.range[0] += startOffset; - templateElement.range[1] += endOffset; - } - - if (templateElement.loc) { - templateElement.loc.start.column += startOffset; - templateElement.loc.end.column += endOffset; - } - }); - - return program; - } - - parseTopLevel(node) { - if (this[STATE].impliedStrict) { - this.strict = true; - } - return super.parseTopLevel(node); - } - - /** - * Overwrites the default raise method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @param {string} message The error message. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - raise(pos, message) { - const loc = Parser.acorn.getLineInfo(this.input, pos); - const err = new SyntaxError(message); - - err.index = pos; - err.lineNumber = loc.line; - err.column = loc.column + 1; // acorn uses 0-based columns - throw err; - } - - /** - * Overwrites the default raise method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @param {string} message The error message. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - raiseRecoverable(pos, message) { - this.raise(pos, message); - } - - /** - * Overwrites the default unexpected method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - unexpected(pos) { - let message = "Unexpected token"; - - if (pos !== null && pos !== void 0) { - this.pos = pos; - - if (this.options.locations) { - while (this.pos < this.lineStart) { - this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; - --this.curLine; - } - } - - this.nextToken(); - } - - if (this.end > this.start) { - message += ` ${this.input.slice(this.start, this.end)}`; - } - - this.raise(this.start, message); - } - - /* - * Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX - * uses regular tt.string without any distinction between this and regular JS - * strings. As such, we intercept an attempt to read a JSX string and set a flag - * on extra so that when tokens are converted, the next token will be switched - * to JSXText via onToken. - */ - jsx_readString(quote) { // eslint-disable-line camelcase - const result = super.jsx_readString(quote); - - if (this.type === tokTypes.string) { - this[STATE].jsxAttrValueToken = true; - } - return result; - } - - /** - * Performs last-minute Esprima-specific compatibility checks and fixes. - * @param {ASTNode} result The node to check. - * @returns {ASTNode} The finished node. - */ - [ESPRIMA_FINISH_NODE](result) { - - // Acorn doesn't count the opening and closing backticks as part of templates - // so we have to adjust ranges/locations appropriately. - if (result.type === "TemplateElement") { - - // save template element references to fix start/end later - this[STATE].templateElements.push(result); - } - - if (result.type.includes("Function") && !result.generator) { - result.generator = false; - } - - return result; - } - }; -}; diff --git a/node_modules/espree/lib/features.js b/node_modules/espree/lib/features.js deleted file mode 100644 index 31467d288..000000000 --- a/node_modules/espree/lib/features.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @fileoverview The list of feature flags supported by the parser and their default - * settings. - * @author Nicholas C. Zakas - */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// None! - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -export default { - - // React JSX parsing - jsx: false, - - // allow return statement in global scope - globalReturn: false, - - // allow implied strict mode - impliedStrict: false -}; diff --git a/node_modules/espree/lib/options.js b/node_modules/espree/lib/options.js deleted file mode 100644 index d28480728..000000000 --- a/node_modules/espree/lib/options.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @fileoverview A collection of methods for processing Espree's options. - * @author Kai Cataldo - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const SUPPORTED_VERSIONS = [ - 3, - 5, - 6, // 2015 - 7, // 2016 - 8, // 2017 - 9, // 2018 - 10, // 2019 - 11, // 2020 - 12, // 2021 - 13, // 2022 - 14 // 2023 -]; - -/** - * Get the latest ECMAScript version supported by Espree. - * @returns {number} The latest ECMAScript version. - */ -export function getLatestEcmaVersion() { - return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1]; -} - -/** - * Get the list of ECMAScript versions supported by Espree. - * @returns {number[]} An array containing the supported ECMAScript versions. - */ -export function getSupportedEcmaVersions() { - return [...SUPPORTED_VERSIONS]; -} - -/** - * Normalize ECMAScript version from the initial config - * @param {(number|"latest")} ecmaVersion ECMAScript version from the initial config - * @throws {Error} throws an error if the ecmaVersion is invalid. - * @returns {number} normalized ECMAScript version - */ -function normalizeEcmaVersion(ecmaVersion = 5) { - - let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion; - - if (typeof version !== "number") { - throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof ecmaVersion} instead.`); - } - - // Calculate ECMAScript edition number from official year version starting with - // ES2015, which corresponds with ES6 (or a difference of 2009). - if (version >= 2015) { - version -= 2009; - } - - if (!SUPPORTED_VERSIONS.includes(version)) { - throw new Error("Invalid ecmaVersion."); - } - - return version; -} - -/** - * Normalize sourceType from the initial config - * @param {string} sourceType to normalize - * @throws {Error} throw an error if sourceType is invalid - * @returns {string} normalized sourceType - */ -function normalizeSourceType(sourceType = "script") { - if (sourceType === "script" || sourceType === "module") { - return sourceType; - } - - if (sourceType === "commonjs") { - return "script"; - } - - throw new Error("Invalid sourceType."); -} - -/** - * Normalize parserOptions - * @param {Object} options the parser options to normalize - * @throws {Error} throw an error if found invalid option. - * @returns {Object} normalized options - */ -export function normalizeOptions(options) { - const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); - const sourceType = normalizeSourceType(options.sourceType); - const ranges = options.range === true; - const locations = options.loc === true; - - if (ecmaVersion !== 3 && options.allowReserved) { - - // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed - throw new Error("`allowReserved` is only supported when ecmaVersion is 3"); - } - if (typeof options.allowReserved !== "undefined" && typeof options.allowReserved !== "boolean") { - throw new Error("`allowReserved`, when present, must be `true` or `false`"); - } - const allowReserved = ecmaVersion === 3 ? (options.allowReserved || "never") : false; - const ecmaFeatures = options.ecmaFeatures || {}; - const allowReturnOutsideFunction = options.sourceType === "commonjs" || - Boolean(ecmaFeatures.globalReturn); - - if (sourceType === "module" && ecmaVersion < 6) { - throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options."); - } - - return Object.assign({}, options, { - ecmaVersion, - sourceType, - ranges, - locations, - allowReserved, - allowReturnOutsideFunction - }); -} diff --git a/node_modules/espree/lib/token-translator.js b/node_modules/espree/lib/token-translator.js deleted file mode 100644 index 9aa5e22ee..000000000 --- a/node_modules/espree/lib/token-translator.js +++ /dev/null @@ -1,265 +0,0 @@ -/** - * @fileoverview Translates tokens between Acorn format and Esprima format. - * @author Nicholas C. Zakas - */ -/* eslint no-underscore-dangle: 0 */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// none! - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - - -// Esprima Token Types -const Token = { - Boolean: "Boolean", - EOF: "", - Identifier: "Identifier", - PrivateIdentifier: "PrivateIdentifier", - Keyword: "Keyword", - Null: "Null", - Numeric: "Numeric", - Punctuator: "Punctuator", - String: "String", - RegularExpression: "RegularExpression", - Template: "Template", - JSXIdentifier: "JSXIdentifier", - JSXText: "JSXText" -}; - -/** - * Converts part of a template into an Esprima token. - * @param {AcornToken[]} tokens The Acorn tokens representing the template. - * @param {string} code The source code. - * @returns {EsprimaToken} The Esprima equivalent of the template token. - * @private - */ -function convertTemplatePart(tokens, code) { - const firstToken = tokens[0], - lastTemplateToken = tokens[tokens.length - 1]; - - const token = { - type: Token.Template, - value: code.slice(firstToken.start, lastTemplateToken.end) - }; - - if (firstToken.loc) { - token.loc = { - start: firstToken.loc.start, - end: lastTemplateToken.loc.end - }; - } - - if (firstToken.range) { - token.start = firstToken.range[0]; - token.end = lastTemplateToken.range[1]; - token.range = [token.start, token.end]; - } - - return token; -} - -/** - * Contains logic to translate Acorn tokens into Esprima tokens. - * @param {Object} acornTokTypes The Acorn token types. - * @param {string} code The source code Acorn is parsing. This is necessary - * to correct the "value" property of some tokens. - * @constructor - */ -function TokenTranslator(acornTokTypes, code) { - - // token types - this._acornTokTypes = acornTokTypes; - - // token buffer for templates - this._tokens = []; - - // track the last curly brace - this._curlyBrace = null; - - // the source code - this._code = code; - -} - -TokenTranslator.prototype = { - constructor: TokenTranslator, - - /** - * Translates a single Esprima token to a single Acorn token. This may be - * inaccurate due to how templates are handled differently in Esprima and - * Acorn, but should be accurate for all other tokens. - * @param {AcornToken} token The Acorn token to translate. - * @param {Object} extra Espree extra object. - * @returns {EsprimaToken} The Esprima version of the token. - */ - translate(token, extra) { - - const type = token.type, - tt = this._acornTokTypes; - - if (type === tt.name) { - token.type = Token.Identifier; - - // TODO: See if this is an Acorn bug - if (token.value === "static") { - token.type = Token.Keyword; - } - - if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) { - token.type = Token.Keyword; - } - - } else if (type === tt.privateId) { - token.type = Token.PrivateIdentifier; - - } else if (type === tt.semi || type === tt.comma || - type === tt.parenL || type === tt.parenR || - type === tt.braceL || type === tt.braceR || - type === tt.dot || type === tt.bracketL || - type === tt.colon || type === tt.question || - type === tt.bracketR || type === tt.ellipsis || - type === tt.arrow || type === tt.jsxTagStart || - type === tt.incDec || type === tt.starstar || - type === tt.jsxTagEnd || type === tt.prefix || - type === tt.questionDot || - (type.binop && !type.keyword) || - type.isAssign) { - - token.type = Token.Punctuator; - token.value = this._code.slice(token.start, token.end); - } else if (type === tt.jsxName) { - token.type = Token.JSXIdentifier; - } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { - token.type = Token.JSXText; - } else if (type.keyword) { - if (type.keyword === "true" || type.keyword === "false") { - token.type = Token.Boolean; - } else if (type.keyword === "null") { - token.type = Token.Null; - } else { - token.type = Token.Keyword; - } - } else if (type === tt.num) { - token.type = Token.Numeric; - token.value = this._code.slice(token.start, token.end); - } else if (type === tt.string) { - - if (extra.jsxAttrValueToken) { - extra.jsxAttrValueToken = false; - token.type = Token.JSXText; - } else { - token.type = Token.String; - } - - token.value = this._code.slice(token.start, token.end); - } else if (type === tt.regexp) { - token.type = Token.RegularExpression; - const value = token.value; - - token.regex = { - flags: value.flags, - pattern: value.pattern - }; - token.value = `/${value.pattern}/${value.flags}`; - } - - return token; - }, - - /** - * Function to call during Acorn's onToken handler. - * @param {AcornToken} token The Acorn token. - * @param {Object} extra The Espree extra object. - * @returns {void} - */ - onToken(token, extra) { - - const that = this, - tt = this._acornTokTypes, - tokens = extra.tokens, - templateTokens = this._tokens; - - /** - * Flushes the buffered template tokens and resets the template - * tracking. - * @returns {void} - * @private - */ - function translateTemplateTokens() { - tokens.push(convertTemplatePart(that._tokens, that._code)); - that._tokens = []; - } - - if (token.type === tt.eof) { - - // might be one last curlyBrace - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - } - - return; - } - - if (token.type === tt.backQuote) { - - // if there's already a curly, it's not part of the template - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - this._curlyBrace = null; - } - - templateTokens.push(token); - - // it's the end - if (templateTokens.length > 1) { - translateTemplateTokens(); - } - - return; - } - if (token.type === tt.dollarBraceL) { - templateTokens.push(token); - translateTemplateTokens(); - return; - } - if (token.type === tt.braceR) { - - // if there's already a curly, it's not part of the template - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - } - - // store new curly for later - this._curlyBrace = token; - return; - } - if (token.type === tt.template || token.type === tt.invalidTemplate) { - if (this._curlyBrace) { - templateTokens.push(this._curlyBrace); - this._curlyBrace = null; - } - - templateTokens.push(token); - return; - } - - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - this._curlyBrace = null; - } - - tokens.push(this.translate(token, extra)); - } -}; - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -export default TokenTranslator; diff --git a/node_modules/espree/lib/version.js b/node_modules/espree/lib/version.js deleted file mode 100644 index c98fc2971..000000000 --- a/node_modules/espree/lib/version.js +++ /dev/null @@ -1,3 +0,0 @@ -const version = "9.5.2"; - -export default version; diff --git a/node_modules/espree/package.json b/node_modules/espree/package.json deleted file mode 100644 index 34732cd7e..000000000 --- a/node_modules/espree/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "espree", - "description": "An Esprima-compatible JavaScript parser built on Acorn", - "author": "Nicholas C. Zakas ", - "homepage": "https://github.com/eslint/espree", - "main": "dist/espree.cjs", - "type": "module", - "exports": { - ".": [ - { - "import": "./espree.js", - "require": "./dist/espree.cjs", - "default": "./dist/espree.cjs" - }, - "./dist/espree.cjs" - ], - "./package.json": "./package.json" - }, - "version": "9.5.2", - "files": [ - "lib", - "dist/espree.cjs", - "espree.js" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "repository": "eslint/espree", - "bugs": { - "url": "https://github.com/eslint/espree/issues" - }, - "funding": "https://opencollective.com/eslint", - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.8.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, - "devDependencies": { - "@rollup/plugin-commonjs": "^17.1.0", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^11.2.0", - "c8": "^7.11.0", - "chai": "^4.3.6", - "eslint": "^8.13.0", - "eslint-config-eslint": "^7.0.0", - "eslint-plugin-jsdoc": "^39.2.4", - "eslint-plugin-node": "^11.1.0", - "eslint-release": "^3.2.0", - "esprima-fb": "^8001.2001.0-dev-harmony-fb", - "lint-staged": "^13.2.0", - "mocha": "^9.2.2", - "npm-run-all": "^4.1.5", - "rollup": "^2.41.2", - "shelljs": "^0.3.0", - "yorkie": "^2.0.0" - }, - "keywords": [ - "ast", - "ecmascript", - "javascript", - "parser", - "syntax", - "acorn" - ], - "gitHooks": { - "pre-commit": "lint-staged" - }, - "scripts": { - "unit": "npm-run-all -s unit:*", - "unit:esm": "c8 mocha --color --reporter progress --timeout 30000 'tests/lib/**/*.js'", - "unit:cjs": "mocha --color --reporter progress --timeout 30000 tests/lib/commonjs.cjs", - "test": "npm-run-all -p unit lint", - "lint": "eslint .", - "fixlint": "npm run lint -- --fix", - "build": "rollup -c rollup.config.js", - "build:debug": "npm run build -- -m", - "update-version": "node tools/update-version.js", - "pretest": "npm run build", - "prepublishOnly": "npm run update-version && npm run build", - "sync-docs": "node sync-docs.js", - "generate-release": "eslint-generate-release", - "generate-alpharelease": "eslint-generate-prerelease alpha", - "generate-betarelease": "eslint-generate-prerelease beta", - "generate-rcrelease": "eslint-generate-prerelease rc", - "publish-release": "eslint-publish-release" - } -} diff --git a/node_modules/esprima/ChangeLog b/node_modules/esprima/ChangeLog deleted file mode 100644 index fafe1c98e..000000000 --- a/node_modules/esprima/ChangeLog +++ /dev/null @@ -1,235 +0,0 @@ -2018-06-17: Version 4.0.1 - - * Fix parsing async get/set in a class (issue 1861, 1875) - * Account for different return statement argument (issue 1829, 1897, 1928) - * Correct the handling of HTML comment when parsing a module (issue 1841) - * Fix incorrect parse async with proto-identifier-shorthand (issue 1847) - * Fix negative column in binary expression (issue 1844) - * Fix incorrect YieldExpression in object methods (issue 1834) - * Various documentation fixes - -2017-06-10: Version 4.0.0 - - * Support ES2017 async function and await expression (issue 1079) - * Support ES2017 trailing commas in function parameters (issue 1550) - * Explicitly distinguish parsing a module vs a script (issue 1576) - * Fix JSX non-empty container (issue 1786) - * Allow JSX element in a yield expression (issue 1765) - * Allow `in` expression in a concise body with a function body (issue 1793) - * Setter function argument must not be a rest parameter (issue 1693) - * Limit strict mode directive to functions with a simple parameter list (issue 1677) - * Prohibit any escape sequence in a reserved word (issue 1612) - * Only permit hex digits in hex escape sequence (issue 1619) - * Prohibit labelled class/generator/function declaration (issue 1484) - * Limit function declaration as if statement clause only in non-strict mode (issue 1657) - * Tolerate missing ) in a with and do-while statement (issue 1481) - -2016-12-22: Version 3.1.3 - - * Support binding patterns as rest element (issue 1681) - * Account for different possible arguments of a yield expression (issue 1469) - -2016-11-24: Version 3.1.2 - - * Ensure that import specifier is more restrictive (issue 1615) - * Fix duplicated JSX tokens (issue 1613) - * Scan template literal in a JSX expression container (issue 1622) - * Improve XHTML entity scanning in JSX (issue 1629) - -2016-10-31: Version 3.1.1 - - * Fix assignment expression problem in an export declaration (issue 1596) - * Fix incorrect tokenization of hex digits (issue 1605) - -2016-10-09: Version 3.1.0 - - * Do not implicitly collect comments when comment attachment is specified (issue 1553) - * Fix incorrect handling of duplicated proto shorthand fields (issue 1485) - * Prohibit initialization in some variants of for statements (issue 1309, 1561) - * Fix incorrect parsing of export specifier (issue 1578) - * Fix ESTree compatibility for assignment pattern (issue 1575) - -2016-09-03: Version 3.0.0 - - * Support ES2016 exponentiation expression (issue 1490) - * Support JSX syntax (issue 1467) - * Use the latest Unicode 8.0 (issue 1475) - * Add the support for syntax node delegate (issue 1435) - * Fix ESTree compatibility on meta property (issue 1338) - * Fix ESTree compatibility on default parameter value (issue 1081) - * Fix ESTree compatibility on try handler (issue 1030) - -2016-08-23: Version 2.7.3 - - * Fix tokenizer confusion with a comment (issue 1493, 1516) - -2016-02-02: Version 2.7.2 - - * Fix out-of-bound error location in an invalid string literal (issue 1457) - * Fix shorthand object destructuring defaults in variable declarations (issue 1459) - -2015-12-10: Version 2.7.1 - - * Do not allow trailing comma in a variable declaration (issue 1360) - * Fix assignment to `let` in non-strict mode (issue 1376) - * Fix missing delegate property in YieldExpression (issue 1407) - -2015-10-22: Version 2.7.0 - - * Fix the handling of semicolon in a break statement (issue 1044) - * Run the test suite with major web browsers (issue 1259, 1317) - * Allow `let` as an identifier in non-strict mode (issue 1289) - * Attach orphaned comments as `innerComments` (issue 1328) - * Add the support for token delegator (issue 1332) - -2015-09-01: Version 2.6.0 - - * Properly allow or prohibit `let` in a binding identifier/pattern (issue 1048, 1098) - * Add sourceType field for Program node (issue 1159) - * Ensure that strict mode reserved word binding throw an error (issue 1171) - * Run the test suite with Node.js and IE 11 on Windows (issue 1294) - * Allow binding pattern with no initializer in a for statement (issue 1301) - -2015-07-31: Version 2.5.0 - - * Run the test suite in a browser environment (issue 1004) - * Ensure a comma between imported default binding and named imports (issue 1046) - * Distinguish `yield` as a keyword vs an identifier (issue 1186) - * Support ES6 meta property `new.target` (issue 1203) - * Fix the syntax node for yield with expression (issue 1223) - * Fix the check of duplicated proto in property names (issue 1225) - * Fix ES6 Unicode escape in identifier name (issue 1229) - * Support ES6 IdentifierStart and IdentifierPart (issue 1232) - * Treat await as a reserved word when parsing as a module (issue 1234) - * Recognize identifier characters from Unicode SMP (issue 1244) - * Ensure that export and import can be followed by a comma (issue 1250) - * Fix yield operator precedence (issue 1262) - -2015-07-01: Version 2.4.1 - - * Fix some cases of comment attachment (issue 1071, 1175) - * Fix the handling of destructuring in function arguments (issue 1193) - * Fix invalid ranges in assignment expression (issue 1201) - -2015-06-26: Version 2.4.0 - - * Support ES6 for-of iteration (issue 1047) - * Support ES6 spread arguments (issue 1169) - * Minimize npm payload (issue 1191) - -2015-06-16: Version 2.3.0 - - * Support ES6 generator (issue 1033) - * Improve parsing of regular expressions with `u` flag (issue 1179) - -2015-04-17: Version 2.2.0 - - * Support ES6 import and export declarations (issue 1000) - * Fix line terminator before arrow not recognized as error (issue 1009) - * Support ES6 destructuring (issue 1045) - * Support ES6 template literal (issue 1074) - * Fix the handling of invalid/incomplete string escape sequences (issue 1106) - * Fix ES3 static member access restriction (issue 1120) - * Support for `super` in ES6 class (issue 1147) - -2015-03-09: Version 2.1.0 - - * Support ES6 class (issue 1001) - * Support ES6 rest parameter (issue 1011) - * Expand the location of property getter, setter, and methods (issue 1029) - * Enable TryStatement transition to a single handler (issue 1031) - * Support ES6 computed property name (issue 1037) - * Tolerate unclosed block comment (issue 1041) - * Support ES6 lexical declaration (issue 1065) - -2015-02-06: Version 2.0.0 - - * Support ES6 arrow function (issue 517) - * Support ES6 Unicode code point escape (issue 521) - * Improve the speed and accuracy of comment attachment (issue 522) - * Support ES6 default parameter (issue 519) - * Support ES6 regular expression flags (issue 557) - * Fix scanning of implicit octal literals (issue 565) - * Fix the handling of automatic semicolon insertion (issue 574) - * Support ES6 method definition (issue 620) - * Support ES6 octal integer literal (issue 621) - * Support ES6 binary integer literal (issue 622) - * Support ES6 object literal property value shorthand (issue 624) - -2015-03-03: Version 1.2.5 - - * Fix scanning of implicit octal literals (issue 565) - -2015-02-05: Version 1.2.4 - - * Fix parsing of LeftHandSideExpression in ForInStatement (issue 560) - * Fix the handling of automatic semicolon insertion (issue 574) - -2015-01-18: Version 1.2.3 - - * Fix division by this (issue 616) - -2014-05-18: Version 1.2.2 - - * Fix duplicated tokens when collecting comments (issue 537) - -2014-05-04: Version 1.2.1 - - * Ensure that Program node may still have leading comments (issue 536) - -2014-04-29: Version 1.2.0 - - * Fix semicolon handling for expression statement (issue 462, 533) - * Disallow escaped characters in regular expression flags (issue 503) - * Performance improvement for location tracking (issue 520) - * Improve the speed of comment attachment (issue 522) - -2014-03-26: Version 1.1.1 - - * Fix token handling of forward slash after an array literal (issue 512) - -2014-03-23: Version 1.1.0 - - * Optionally attach comments to the owning syntax nodes (issue 197) - * Simplify binary parsing with stack-based shift reduce (issue 352) - * Always include the raw source of literals (issue 376) - * Add optional input source information (issue 386) - * Tokenizer API for pure lexical scanning (issue 398) - * Improve the web site and its online demos (issue 337, 400, 404) - * Performance improvement for location tracking (issue 417, 424) - * Support HTML comment syntax (issue 451) - * Drop support for legacy browsers (issue 474) - -2013-08-27: Version 1.0.4 - - * Minimize the payload for packages (issue 362) - * Fix missing cases on an empty switch statement (issue 436) - * Support escaped ] in regexp literal character classes (issue 442) - * Tolerate invalid left-hand side expression (issue 130) - -2013-05-17: Version 1.0.3 - - * Variable declaration needs at least one declarator (issue 391) - * Fix benchmark's variance unit conversion (issue 397) - * IE < 9: \v should be treated as vertical tab (issue 405) - * Unary expressions should always have prefix: true (issue 418) - * Catch clause should only accept an identifier (issue 423) - * Tolerate setters without parameter (issue 426) - -2012-11-02: Version 1.0.2 - - Improvement: - - * Fix esvalidate JUnit output upon a syntax error (issue 374) - -2012-10-28: Version 1.0.1 - - Improvements: - - * esvalidate understands shebang in a Unix shell script (issue 361) - * esvalidate treats fatal parsing failure as an error (issue 361) - * Reduce Node.js package via .npmignore (issue 362) - -2012-10-22: Version 1.0.0 - - Initial release. diff --git a/node_modules/esprima/LICENSE.BSD b/node_modules/esprima/LICENSE.BSD deleted file mode 100644 index 7a55160f5..000000000 --- a/node_modules/esprima/LICENSE.BSD +++ /dev/null @@ -1,21 +0,0 @@ -Copyright JS Foundation and other contributors, https://js.foundation/ - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/esprima/README.md b/node_modules/esprima/README.md deleted file mode 100644 index 8fb25e6c1..000000000 --- a/node_modules/esprima/README.md +++ /dev/null @@ -1,46 +0,0 @@ -[![NPM version](https://img.shields.io/npm/v/esprima.svg)](https://www.npmjs.com/package/esprima) -[![npm download](https://img.shields.io/npm/dm/esprima.svg)](https://www.npmjs.com/package/esprima) -[![Build Status](https://img.shields.io/travis/jquery/esprima/master.svg)](https://travis-ci.org/jquery/esprima) -[![Coverage Status](https://img.shields.io/codecov/c/github/jquery/esprima/master.svg)](https://codecov.io/github/jquery/esprima) - -**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance, -standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) -parser written in ECMAScript (also popularly known as -[JavaScript](https://en.wikipedia.org/wiki/JavaScript)). -Esprima is created and maintained by [Ariya Hidayat](https://twitter.com/ariyahidayat), -with the help of [many contributors](https://github.com/jquery/esprima/contributors). - -### Features - -- Full support for ECMAScript 2017 ([ECMA-262 8th Edition](http://www.ecma-international.org/publications/standards/Ecma-262.htm)) -- Sensible [syntax tree format](https://github.com/estree/estree/blob/master/es5.md) as standardized by [ESTree project](https://github.com/estree/estree) -- Experimental support for [JSX](https://facebook.github.io/jsx/), a syntax extension for [React](https://facebook.github.io/react/) -- Optional tracking of syntax node location (index-based and line-column) -- [Heavily tested](http://esprima.org/test/ci.html) (~1500 [unit tests](https://github.com/jquery/esprima/tree/master/test/fixtures) with [full code coverage](https://codecov.io/github/jquery/esprima)) - -### API - -Esprima can be used to perform [lexical analysis](https://en.wikipedia.org/wiki/Lexical_analysis) (tokenization) or [syntactic analysis](https://en.wikipedia.org/wiki/Parsing) (parsing) of a JavaScript program. - -A simple example on Node.js REPL: - -```javascript -> var esprima = require('esprima'); -> var program = 'const answer = 42'; - -> esprima.tokenize(program); -[ { type: 'Keyword', value: 'const' }, - { type: 'Identifier', value: 'answer' }, - { type: 'Punctuator', value: '=' }, - { type: 'Numeric', value: '42' } ] - -> esprima.parseScript(program); -{ type: 'Program', - body: - [ { type: 'VariableDeclaration', - declarations: [Object], - kind: 'const' } ], - sourceType: 'script' } -``` - -For more information, please read the [complete documentation](http://esprima.org/doc). \ No newline at end of file diff --git a/node_modules/esprima/bin/esparse.js b/node_modules/esprima/bin/esparse.js deleted file mode 100755 index 45d05fbb7..000000000 --- a/node_modules/esprima/bin/esparse.js +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/env node -/* - Copyright JS Foundation and other contributors, https://js.foundation/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/*jslint sloppy:true node:true rhino:true */ - -var fs, esprima, fname, forceFile, content, options, syntax; - -if (typeof require === 'function') { - fs = require('fs'); - try { - esprima = require('esprima'); - } catch (e) { - esprima = require('../'); - } -} else if (typeof load === 'function') { - try { - load('esprima.js'); - } catch (e) { - load('../esprima.js'); - } -} - -// Shims to Node.js objects when running under Rhino. -if (typeof console === 'undefined' && typeof process === 'undefined') { - console = { log: print }; - fs = { readFileSync: readFile }; - process = { argv: arguments, exit: quit }; - process.argv.unshift('esparse.js'); - process.argv.unshift('rhino'); -} - -function showUsage() { - console.log('Usage:'); - console.log(' esparse [options] [file.js]'); - console.log(); - console.log('Available options:'); - console.log(); - console.log(' --comment Gather all line and block comments in an array'); - console.log(' --loc Include line-column location info for each syntax node'); - console.log(' --range Include index-based range for each syntax node'); - console.log(' --raw Display the raw value of literals'); - console.log(' --tokens List all tokens in an array'); - console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)'); - console.log(' -v, --version Shows program version'); - console.log(); - process.exit(1); -} - -options = {}; - -process.argv.splice(2).forEach(function (entry) { - - if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') { - if (typeof fname === 'string') { - console.log('Error: more than one input file.'); - process.exit(1); - } else { - fname = entry; - } - } else if (entry === '-h' || entry === '--help') { - showUsage(); - } else if (entry === '-v' || entry === '--version') { - console.log('ECMAScript Parser (using Esprima version', esprima.version, ')'); - console.log(); - process.exit(0); - } else if (entry === '--comment') { - options.comment = true; - } else if (entry === '--loc') { - options.loc = true; - } else if (entry === '--range') { - options.range = true; - } else if (entry === '--raw') { - options.raw = true; - } else if (entry === '--tokens') { - options.tokens = true; - } else if (entry === '--tolerant') { - options.tolerant = true; - } else if (entry === '--') { - forceFile = true; - } else { - console.log('Error: unknown option ' + entry + '.'); - process.exit(1); - } -}); - -// Special handling for regular expression literal since we need to -// convert it to a string literal, otherwise it will be decoded -// as object "{}" and the regular expression would be lost. -function adjustRegexLiteral(key, value) { - if (key === 'value' && value instanceof RegExp) { - value = value.toString(); - } - return value; -} - -function run(content) { - syntax = esprima.parse(content, options); - console.log(JSON.stringify(syntax, adjustRegexLiteral, 4)); -} - -try { - if (fname && (fname !== '-' || forceFile)) { - run(fs.readFileSync(fname, 'utf-8')); - } else { - var content = ''; - process.stdin.resume(); - process.stdin.on('data', function(chunk) { - content += chunk; - }); - process.stdin.on('end', function() { - run(content); - }); - } -} catch (e) { - console.log('Error: ' + e.message); - process.exit(1); -} diff --git a/node_modules/esprima/bin/esvalidate.js b/node_modules/esprima/bin/esvalidate.js deleted file mode 100755 index d49a7e40a..000000000 --- a/node_modules/esprima/bin/esvalidate.js +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/env node -/* - Copyright JS Foundation and other contributors, https://js.foundation/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/*jslint sloppy:true plusplus:true node:true rhino:true */ -/*global phantom:true */ - -var fs, system, esprima, options, fnames, forceFile, count; - -if (typeof esprima === 'undefined') { - // PhantomJS can only require() relative files - if (typeof phantom === 'object') { - fs = require('fs'); - system = require('system'); - esprima = require('./esprima'); - } else if (typeof require === 'function') { - fs = require('fs'); - try { - esprima = require('esprima'); - } catch (e) { - esprima = require('../'); - } - } else if (typeof load === 'function') { - try { - load('esprima.js'); - } catch (e) { - load('../esprima.js'); - } - } -} - -// Shims to Node.js objects when running under PhantomJS 1.7+. -if (typeof phantom === 'object') { - fs.readFileSync = fs.read; - process = { - argv: [].slice.call(system.args), - exit: phantom.exit, - on: function (evt, callback) { - callback(); - } - }; - process.argv.unshift('phantomjs'); -} - -// Shims to Node.js objects when running under Rhino. -if (typeof console === 'undefined' && typeof process === 'undefined') { - console = { log: print }; - fs = { readFileSync: readFile }; - process = { - argv: arguments, - exit: quit, - on: function (evt, callback) { - callback(); - } - }; - process.argv.unshift('esvalidate.js'); - process.argv.unshift('rhino'); -} - -function showUsage() { - console.log('Usage:'); - console.log(' esvalidate [options] [file.js...]'); - console.log(); - console.log('Available options:'); - console.log(); - console.log(' --format=type Set the report format, plain (default) or junit'); - console.log(' -v, --version Print program version'); - console.log(); - process.exit(1); -} - -options = { - format: 'plain' -}; - -fnames = []; - -process.argv.splice(2).forEach(function (entry) { - - if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') { - fnames.push(entry); - } else if (entry === '-h' || entry === '--help') { - showUsage(); - } else if (entry === '-v' || entry === '--version') { - console.log('ECMAScript Validator (using Esprima version', esprima.version, ')'); - console.log(); - process.exit(0); - } else if (entry.slice(0, 9) === '--format=') { - options.format = entry.slice(9); - if (options.format !== 'plain' && options.format !== 'junit') { - console.log('Error: unknown report format ' + options.format + '.'); - process.exit(1); - } - } else if (entry === '--') { - forceFile = true; - } else { - console.log('Error: unknown option ' + entry + '.'); - process.exit(1); - } -}); - -if (fnames.length === 0) { - fnames.push(''); -} - -if (options.format === 'junit') { - console.log(''); - console.log(''); -} - -count = 0; - -function run(fname, content) { - var timestamp, syntax, name; - try { - if (typeof content !== 'string') { - throw content; - } - - if (content[0] === '#' && content[1] === '!') { - content = '//' + content.substr(2, content.length); - } - - timestamp = Date.now(); - syntax = esprima.parse(content, { tolerant: true }); - - if (options.format === 'junit') { - - name = fname; - if (name.lastIndexOf('/') >= 0) { - name = name.slice(name.lastIndexOf('/') + 1); - } - - console.log(''); - - syntax.errors.forEach(function (error) { - var msg = error.message; - msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); - console.log(' '); - console.log(' ' + - error.message + '(' + name + ':' + error.lineNumber + ')' + - ''); - console.log(' '); - }); - - console.log(''); - - } else if (options.format === 'plain') { - - syntax.errors.forEach(function (error) { - var msg = error.message; - msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); - msg = fname + ':' + error.lineNumber + ': ' + msg; - console.log(msg); - ++count; - }); - - } - } catch (e) { - ++count; - if (options.format === 'junit') { - console.log(''); - console.log(' '); - console.log(' ' + - e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') + - ')'); - console.log(' '); - console.log(''); - } else { - console.log(fname + ':' + e.lineNumber + ': ' + e.message.replace(/^Line\ [0-9]*\:\ /, '')); - } - } -} - -fnames.forEach(function (fname) { - var content = ''; - try { - if (fname && (fname !== '-' || forceFile)) { - content = fs.readFileSync(fname, 'utf-8'); - } else { - fname = ''; - process.stdin.resume(); - process.stdin.on('data', function(chunk) { - content += chunk; - }); - process.stdin.on('end', function() { - run(fname, content); - }); - return; - } - } catch (e) { - content = e; - } - run(fname, content); -}); - -process.on('exit', function () { - if (options.format === 'junit') { - console.log(''); - } - - if (count > 0) { - process.exit(1); - } - - if (count === 0 && typeof phantom === 'object') { - process.exit(0); - } -}); diff --git a/node_modules/esprima/dist/esprima.js b/node_modules/esprima/dist/esprima.js deleted file mode 100644 index 2af3eee12..000000000 --- a/node_modules/esprima/dist/esprima.js +++ /dev/null @@ -1,6709 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { -/* istanbul ignore next */ - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); -/* istanbul ignore next */ - else if(typeof exports === 'object') - exports["esprima"] = factory(); - else - root["esprima"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/* istanbul ignore if */ -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /* - Copyright JS Foundation and other contributors, https://js.foundation/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - Object.defineProperty(exports, "__esModule", { value: true }); - var comment_handler_1 = __webpack_require__(1); - var jsx_parser_1 = __webpack_require__(3); - var parser_1 = __webpack_require__(8); - var tokenizer_1 = __webpack_require__(15); - function parse(code, options, delegate) { - var commentHandler = null; - var proxyDelegate = function (node, metadata) { - if (delegate) { - delegate(node, metadata); - } - if (commentHandler) { - commentHandler.visit(node, metadata); - } - }; - var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null; - var collectComment = false; - if (options) { - collectComment = (typeof options.comment === 'boolean' && options.comment); - var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment); - if (collectComment || attachComment) { - commentHandler = new comment_handler_1.CommentHandler(); - commentHandler.attach = attachComment; - options.comment = true; - parserDelegate = proxyDelegate; - } - } - var isModule = false; - if (options && typeof options.sourceType === 'string') { - isModule = (options.sourceType === 'module'); - } - var parser; - if (options && typeof options.jsx === 'boolean' && options.jsx) { - parser = new jsx_parser_1.JSXParser(code, options, parserDelegate); - } - else { - parser = new parser_1.Parser(code, options, parserDelegate); - } - var program = isModule ? parser.parseModule() : parser.parseScript(); - var ast = program; - if (collectComment && commentHandler) { - ast.comments = commentHandler.comments; - } - if (parser.config.tokens) { - ast.tokens = parser.tokens; - } - if (parser.config.tolerant) { - ast.errors = parser.errorHandler.errors; - } - return ast; - } - exports.parse = parse; - function parseModule(code, options, delegate) { - var parsingOptions = options || {}; - parsingOptions.sourceType = 'module'; - return parse(code, parsingOptions, delegate); - } - exports.parseModule = parseModule; - function parseScript(code, options, delegate) { - var parsingOptions = options || {}; - parsingOptions.sourceType = 'script'; - return parse(code, parsingOptions, delegate); - } - exports.parseScript = parseScript; - function tokenize(code, options, delegate) { - var tokenizer = new tokenizer_1.Tokenizer(code, options); - var tokens; - tokens = []; - try { - while (true) { - var token = tokenizer.getNextToken(); - if (!token) { - break; - } - if (delegate) { - token = delegate(token); - } - tokens.push(token); - } - } - catch (e) { - tokenizer.errorHandler.tolerate(e); - } - if (tokenizer.errorHandler.tolerant) { - tokens.errors = tokenizer.errors(); - } - return tokens; - } - exports.tokenize = tokenize; - var syntax_1 = __webpack_require__(2); - exports.Syntax = syntax_1.Syntax; - // Sync with *.json manifests. - exports.version = '4.0.1'; - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var syntax_1 = __webpack_require__(2); - var CommentHandler = (function () { - function CommentHandler() { - this.attach = false; - this.comments = []; - this.stack = []; - this.leading = []; - this.trailing = []; - } - CommentHandler.prototype.insertInnerComments = function (node, metadata) { - // innnerComments for properties empty block - // `function a() {/** comments **\/}` - if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) { - var innerComments = []; - for (var i = this.leading.length - 1; i >= 0; --i) { - var entry = this.leading[i]; - if (metadata.end.offset >= entry.start) { - innerComments.unshift(entry.comment); - this.leading.splice(i, 1); - this.trailing.splice(i, 1); - } - } - if (innerComments.length) { - node.innerComments = innerComments; - } - } - }; - CommentHandler.prototype.findTrailingComments = function (metadata) { - var trailingComments = []; - if (this.trailing.length > 0) { - for (var i = this.trailing.length - 1; i >= 0; --i) { - var entry_1 = this.trailing[i]; - if (entry_1.start >= metadata.end.offset) { - trailingComments.unshift(entry_1.comment); - } - } - this.trailing.length = 0; - return trailingComments; - } - var entry = this.stack[this.stack.length - 1]; - if (entry && entry.node.trailingComments) { - var firstComment = entry.node.trailingComments[0]; - if (firstComment && firstComment.range[0] >= metadata.end.offset) { - trailingComments = entry.node.trailingComments; - delete entry.node.trailingComments; - } - } - return trailingComments; - }; - CommentHandler.prototype.findLeadingComments = function (metadata) { - var leadingComments = []; - var target; - while (this.stack.length > 0) { - var entry = this.stack[this.stack.length - 1]; - if (entry && entry.start >= metadata.start.offset) { - target = entry.node; - this.stack.pop(); - } - else { - break; - } - } - if (target) { - var count = target.leadingComments ? target.leadingComments.length : 0; - for (var i = count - 1; i >= 0; --i) { - var comment = target.leadingComments[i]; - if (comment.range[1] <= metadata.start.offset) { - leadingComments.unshift(comment); - target.leadingComments.splice(i, 1); - } - } - if (target.leadingComments && target.leadingComments.length === 0) { - delete target.leadingComments; - } - return leadingComments; - } - for (var i = this.leading.length - 1; i >= 0; --i) { - var entry = this.leading[i]; - if (entry.start <= metadata.start.offset) { - leadingComments.unshift(entry.comment); - this.leading.splice(i, 1); - } - } - return leadingComments; - }; - CommentHandler.prototype.visitNode = function (node, metadata) { - if (node.type === syntax_1.Syntax.Program && node.body.length > 0) { - return; - } - this.insertInnerComments(node, metadata); - var trailingComments = this.findTrailingComments(metadata); - var leadingComments = this.findLeadingComments(metadata); - if (leadingComments.length > 0) { - node.leadingComments = leadingComments; - } - if (trailingComments.length > 0) { - node.trailingComments = trailingComments; - } - this.stack.push({ - node: node, - start: metadata.start.offset - }); - }; - CommentHandler.prototype.visitComment = function (node, metadata) { - var type = (node.type[0] === 'L') ? 'Line' : 'Block'; - var comment = { - type: type, - value: node.value - }; - if (node.range) { - comment.range = node.range; - } - if (node.loc) { - comment.loc = node.loc; - } - this.comments.push(comment); - if (this.attach) { - var entry = { - comment: { - type: type, - value: node.value, - range: [metadata.start.offset, metadata.end.offset] - }, - start: metadata.start.offset - }; - if (node.loc) { - entry.comment.loc = node.loc; - } - node.type = type; - this.leading.push(entry); - this.trailing.push(entry); - } - }; - CommentHandler.prototype.visit = function (node, metadata) { - if (node.type === 'LineComment') { - this.visitComment(node, metadata); - } - else if (node.type === 'BlockComment') { - this.visitComment(node, metadata); - } - else if (this.attach) { - this.visitNode(node, metadata); - } - }; - return CommentHandler; - }()); - exports.CommentHandler = CommentHandler; - - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Syntax = { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - AwaitExpression: 'AwaitExpression', - BlockStatement: 'BlockStatement', - BinaryExpression: 'BinaryExpression', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DoWhileStatement: 'DoWhileStatement', - DebuggerStatement: 'DebuggerStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForOfStatement: 'ForOfStatement', - ForInStatement: 'ForInStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - Identifier: 'Identifier', - IfStatement: 'IfStatement', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', - LabeledStatement: 'LabeledStatement', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchCase: 'SwitchCase', - SwitchStatement: 'SwitchStatement', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; - - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; -/* istanbul ignore next */ - var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - var character_1 = __webpack_require__(4); - var JSXNode = __webpack_require__(5); - var jsx_syntax_1 = __webpack_require__(6); - var Node = __webpack_require__(7); - var parser_1 = __webpack_require__(8); - var token_1 = __webpack_require__(13); - var xhtml_entities_1 = __webpack_require__(14); - token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier'; - token_1.TokenName[101 /* Text */] = 'JSXText'; - // Fully qualified element name, e.g. returns "svg:path" - function getQualifiedElementName(elementName) { - var qualifiedName; - switch (elementName.type) { - case jsx_syntax_1.JSXSyntax.JSXIdentifier: - var id = elementName; - qualifiedName = id.name; - break; - case jsx_syntax_1.JSXSyntax.JSXNamespacedName: - var ns = elementName; - qualifiedName = getQualifiedElementName(ns.namespace) + ':' + - getQualifiedElementName(ns.name); - break; - case jsx_syntax_1.JSXSyntax.JSXMemberExpression: - var expr = elementName; - qualifiedName = getQualifiedElementName(expr.object) + '.' + - getQualifiedElementName(expr.property); - break; - /* istanbul ignore next */ - default: - break; - } - return qualifiedName; - } - var JSXParser = (function (_super) { - __extends(JSXParser, _super); - function JSXParser(code, options, delegate) { - return _super.call(this, code, options, delegate) || this; - } - JSXParser.prototype.parsePrimaryExpression = function () { - return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this); - }; - JSXParser.prototype.startJSX = function () { - // Unwind the scanner before the lookahead token. - this.scanner.index = this.startMarker.index; - this.scanner.lineNumber = this.startMarker.line; - this.scanner.lineStart = this.startMarker.index - this.startMarker.column; - }; - JSXParser.prototype.finishJSX = function () { - // Prime the next lookahead. - this.nextToken(); - }; - JSXParser.prototype.reenterJSX = function () { - this.startJSX(); - this.expectJSX('}'); - // Pop the closing '}' added from the lookahead. - if (this.config.tokens) { - this.tokens.pop(); - } - }; - JSXParser.prototype.createJSXNode = function () { - this.collectComments(); - return { - index: this.scanner.index, - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - }; - }; - JSXParser.prototype.createJSXChildNode = function () { - return { - index: this.scanner.index, - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - }; - }; - JSXParser.prototype.scanXHTMLEntity = function (quote) { - var result = '&'; - var valid = true; - var terminated = false; - var numeric = false; - var hex = false; - while (!this.scanner.eof() && valid && !terminated) { - var ch = this.scanner.source[this.scanner.index]; - if (ch === quote) { - break; - } - terminated = (ch === ';'); - result += ch; - ++this.scanner.index; - if (!terminated) { - switch (result.length) { - case 2: - // e.g. '{' - numeric = (ch === '#'); - break; - case 3: - if (numeric) { - // e.g. 'A' - hex = (ch === 'x'); - valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0)); - numeric = numeric && !hex; - } - break; - default: - valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0))); - valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0))); - break; - } - } - } - if (valid && terminated && result.length > 2) { - // e.g. 'A' becomes just '#x41' - var str = result.substr(1, result.length - 2); - if (numeric && str.length > 1) { - result = String.fromCharCode(parseInt(str.substr(1), 10)); - } - else if (hex && str.length > 2) { - result = String.fromCharCode(parseInt('0' + str.substr(1), 16)); - } - else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) { - result = xhtml_entities_1.XHTMLEntities[str]; - } - } - return result; - }; - // Scan the next JSX token. This replaces Scanner#lex when in JSX mode. - JSXParser.prototype.lexJSX = function () { - var cp = this.scanner.source.charCodeAt(this.scanner.index); - // < > / : = { } - if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) { - var value = this.scanner.source[this.scanner.index++]; - return { - type: 7 /* Punctuator */, - value: value, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: this.scanner.index - 1, - end: this.scanner.index - }; - } - // " ' - if (cp === 34 || cp === 39) { - var start = this.scanner.index; - var quote = this.scanner.source[this.scanner.index++]; - var str = ''; - while (!this.scanner.eof()) { - var ch = this.scanner.source[this.scanner.index++]; - if (ch === quote) { - break; - } - else if (ch === '&') { - str += this.scanXHTMLEntity(quote); - } - else { - str += ch; - } - } - return { - type: 8 /* StringLiteral */, - value: str, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: start, - end: this.scanner.index - }; - } - // ... or . - if (cp === 46) { - var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1); - var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2); - var value = (n1 === 46 && n2 === 46) ? '...' : '.'; - var start = this.scanner.index; - this.scanner.index += value.length; - return { - type: 7 /* Punctuator */, - value: value, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: start, - end: this.scanner.index - }; - } - // ` - if (cp === 96) { - // Only placeholder, since it will be rescanned as a real assignment expression. - return { - type: 10 /* Template */, - value: '', - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: this.scanner.index, - end: this.scanner.index - }; - } - // Identifer can not contain backslash (char code 92). - if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) { - var start = this.scanner.index; - ++this.scanner.index; - while (!this.scanner.eof()) { - var ch = this.scanner.source.charCodeAt(this.scanner.index); - if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) { - ++this.scanner.index; - } - else if (ch === 45) { - // Hyphen (char code 45) can be part of an identifier. - ++this.scanner.index; - } - else { - break; - } - } - var id = this.scanner.source.slice(start, this.scanner.index); - return { - type: 100 /* Identifier */, - value: id, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: start, - end: this.scanner.index - }; - } - return this.scanner.lex(); - }; - JSXParser.prototype.nextJSXToken = function () { - this.collectComments(); - this.startMarker.index = this.scanner.index; - this.startMarker.line = this.scanner.lineNumber; - this.startMarker.column = this.scanner.index - this.scanner.lineStart; - var token = this.lexJSX(); - this.lastMarker.index = this.scanner.index; - this.lastMarker.line = this.scanner.lineNumber; - this.lastMarker.column = this.scanner.index - this.scanner.lineStart; - if (this.config.tokens) { - this.tokens.push(this.convertToken(token)); - } - return token; - }; - JSXParser.prototype.nextJSXText = function () { - this.startMarker.index = this.scanner.index; - this.startMarker.line = this.scanner.lineNumber; - this.startMarker.column = this.scanner.index - this.scanner.lineStart; - var start = this.scanner.index; - var text = ''; - while (!this.scanner.eof()) { - var ch = this.scanner.source[this.scanner.index]; - if (ch === '{' || ch === '<') { - break; - } - ++this.scanner.index; - text += ch; - if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { - ++this.scanner.lineNumber; - if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') { - ++this.scanner.index; - } - this.scanner.lineStart = this.scanner.index; - } - } - this.lastMarker.index = this.scanner.index; - this.lastMarker.line = this.scanner.lineNumber; - this.lastMarker.column = this.scanner.index - this.scanner.lineStart; - var token = { - type: 101 /* Text */, - value: text, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: start, - end: this.scanner.index - }; - if ((text.length > 0) && this.config.tokens) { - this.tokens.push(this.convertToken(token)); - } - return token; - }; - JSXParser.prototype.peekJSXToken = function () { - var state = this.scanner.saveState(); - this.scanner.scanComments(); - var next = this.lexJSX(); - this.scanner.restoreState(state); - return next; - }; - // Expect the next JSX token to match the specified punctuator. - // If not, an exception will be thrown. - JSXParser.prototype.expectJSX = function (value) { - var token = this.nextJSXToken(); - if (token.type !== 7 /* Punctuator */ || token.value !== value) { - this.throwUnexpectedToken(token); - } - }; - // Return true if the next JSX token matches the specified punctuator. - JSXParser.prototype.matchJSX = function (value) { - var next = this.peekJSXToken(); - return next.type === 7 /* Punctuator */ && next.value === value; - }; - JSXParser.prototype.parseJSXIdentifier = function () { - var node = this.createJSXNode(); - var token = this.nextJSXToken(); - if (token.type !== 100 /* Identifier */) { - this.throwUnexpectedToken(token); - } - return this.finalize(node, new JSXNode.JSXIdentifier(token.value)); - }; - JSXParser.prototype.parseJSXElementName = function () { - var node = this.createJSXNode(); - var elementName = this.parseJSXIdentifier(); - if (this.matchJSX(':')) { - var namespace = elementName; - this.expectJSX(':'); - var name_1 = this.parseJSXIdentifier(); - elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1)); - } - else if (this.matchJSX('.')) { - while (this.matchJSX('.')) { - var object = elementName; - this.expectJSX('.'); - var property = this.parseJSXIdentifier(); - elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property)); - } - } - return elementName; - }; - JSXParser.prototype.parseJSXAttributeName = function () { - var node = this.createJSXNode(); - var attributeName; - var identifier = this.parseJSXIdentifier(); - if (this.matchJSX(':')) { - var namespace = identifier; - this.expectJSX(':'); - var name_2 = this.parseJSXIdentifier(); - attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2)); - } - else { - attributeName = identifier; - } - return attributeName; - }; - JSXParser.prototype.parseJSXStringLiteralAttribute = function () { - var node = this.createJSXNode(); - var token = this.nextJSXToken(); - if (token.type !== 8 /* StringLiteral */) { - this.throwUnexpectedToken(token); - } - var raw = this.getTokenRaw(token); - return this.finalize(node, new Node.Literal(token.value, raw)); - }; - JSXParser.prototype.parseJSXExpressionAttribute = function () { - var node = this.createJSXNode(); - this.expectJSX('{'); - this.finishJSX(); - if (this.match('}')) { - this.tolerateError('JSX attributes must only be assigned a non-empty expression'); - } - var expression = this.parseAssignmentExpression(); - this.reenterJSX(); - return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); - }; - JSXParser.prototype.parseJSXAttributeValue = function () { - return this.matchJSX('{') ? this.parseJSXExpressionAttribute() : - this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute(); - }; - JSXParser.prototype.parseJSXNameValueAttribute = function () { - var node = this.createJSXNode(); - var name = this.parseJSXAttributeName(); - var value = null; - if (this.matchJSX('=')) { - this.expectJSX('='); - value = this.parseJSXAttributeValue(); - } - return this.finalize(node, new JSXNode.JSXAttribute(name, value)); - }; - JSXParser.prototype.parseJSXSpreadAttribute = function () { - var node = this.createJSXNode(); - this.expectJSX('{'); - this.expectJSX('...'); - this.finishJSX(); - var argument = this.parseAssignmentExpression(); - this.reenterJSX(); - return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument)); - }; - JSXParser.prototype.parseJSXAttributes = function () { - var attributes = []; - while (!this.matchJSX('/') && !this.matchJSX('>')) { - var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() : - this.parseJSXNameValueAttribute(); - attributes.push(attribute); - } - return attributes; - }; - JSXParser.prototype.parseJSXOpeningElement = function () { - var node = this.createJSXNode(); - this.expectJSX('<'); - var name = this.parseJSXElementName(); - var attributes = this.parseJSXAttributes(); - var selfClosing = this.matchJSX('/'); - if (selfClosing) { - this.expectJSX('/'); - } - this.expectJSX('>'); - return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); - }; - JSXParser.prototype.parseJSXBoundaryElement = function () { - var node = this.createJSXNode(); - this.expectJSX('<'); - if (this.matchJSX('/')) { - this.expectJSX('/'); - var name_3 = this.parseJSXElementName(); - this.expectJSX('>'); - return this.finalize(node, new JSXNode.JSXClosingElement(name_3)); - } - var name = this.parseJSXElementName(); - var attributes = this.parseJSXAttributes(); - var selfClosing = this.matchJSX('/'); - if (selfClosing) { - this.expectJSX('/'); - } - this.expectJSX('>'); - return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); - }; - JSXParser.prototype.parseJSXEmptyExpression = function () { - var node = this.createJSXChildNode(); - this.collectComments(); - this.lastMarker.index = this.scanner.index; - this.lastMarker.line = this.scanner.lineNumber; - this.lastMarker.column = this.scanner.index - this.scanner.lineStart; - return this.finalize(node, new JSXNode.JSXEmptyExpression()); - }; - JSXParser.prototype.parseJSXExpressionContainer = function () { - var node = this.createJSXNode(); - this.expectJSX('{'); - var expression; - if (this.matchJSX('}')) { - expression = this.parseJSXEmptyExpression(); - this.expectJSX('}'); - } - else { - this.finishJSX(); - expression = this.parseAssignmentExpression(); - this.reenterJSX(); - } - return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); - }; - JSXParser.prototype.parseJSXChildren = function () { - var children = []; - while (!this.scanner.eof()) { - var node = this.createJSXChildNode(); - var token = this.nextJSXText(); - if (token.start < token.end) { - var raw = this.getTokenRaw(token); - var child = this.finalize(node, new JSXNode.JSXText(token.value, raw)); - children.push(child); - } - if (this.scanner.source[this.scanner.index] === '{') { - var container = this.parseJSXExpressionContainer(); - children.push(container); - } - else { - break; - } - } - return children; - }; - JSXParser.prototype.parseComplexJSXElement = function (el) { - var stack = []; - while (!this.scanner.eof()) { - el.children = el.children.concat(this.parseJSXChildren()); - var node = this.createJSXChildNode(); - var element = this.parseJSXBoundaryElement(); - if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) { - var opening = element; - if (opening.selfClosing) { - var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null)); - el.children.push(child); - } - else { - stack.push(el); - el = { node: node, opening: opening, closing: null, children: [] }; - } - } - if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) { - el.closing = element; - var open_1 = getQualifiedElementName(el.opening.name); - var close_1 = getQualifiedElementName(el.closing.name); - if (open_1 !== close_1) { - this.tolerateError('Expected corresponding JSX closing tag for %0', open_1); - } - if (stack.length > 0) { - var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing)); - el = stack[stack.length - 1]; - el.children.push(child); - stack.pop(); - } - else { - break; - } - } - } - return el; - }; - JSXParser.prototype.parseJSXElement = function () { - var node = this.createJSXNode(); - var opening = this.parseJSXOpeningElement(); - var children = []; - var closing = null; - if (!opening.selfClosing) { - var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children }); - children = el.children; - closing = el.closing; - } - return this.finalize(node, new JSXNode.JSXElement(opening, children, closing)); - }; - JSXParser.prototype.parseJSXRoot = function () { - // Pop the opening '<' added from the lookahead. - if (this.config.tokens) { - this.tokens.pop(); - } - this.startJSX(); - var element = this.parseJSXElement(); - this.finishJSX(); - return element; - }; - JSXParser.prototype.isStartOfExpression = function () { - return _super.prototype.isStartOfExpression.call(this) || this.match('<'); - }; - return JSXParser; - }(parser_1.Parser)); - exports.JSXParser = JSXParser; - - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - // See also tools/generate-unicode-regex.js. - var Regex = { - // Unicode v8.0.0 NonAsciiIdentifierStart: - NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, - // Unicode v8.0.0 NonAsciiIdentifierPart: - NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9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0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ - }; - exports.Character = { - /* tslint:disable:no-bitwise */ - fromCodePoint: function (cp) { - return (cp < 0x10000) ? String.fromCharCode(cp) : - String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) + - String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023)); - }, - // https://tc39.github.io/ecma262/#sec-white-space - isWhiteSpace: function (cp) { - return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) || - (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0); - }, - // https://tc39.github.io/ecma262/#sec-line-terminators - isLineTerminator: function (cp) { - return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029); - }, - // https://tc39.github.io/ecma262/#sec-names-and-keywords - isIdentifierStart: function (cp) { - return (cp === 0x24) || (cp === 0x5F) || - (cp >= 0x41 && cp <= 0x5A) || - (cp >= 0x61 && cp <= 0x7A) || - (cp === 0x5C) || - ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp))); - }, - isIdentifierPart: function (cp) { - return (cp === 0x24) || (cp === 0x5F) || - (cp >= 0x41 && cp <= 0x5A) || - (cp >= 0x61 && cp <= 0x7A) || - (cp >= 0x30 && cp <= 0x39) || - (cp === 0x5C) || - ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp))); - }, - // https://tc39.github.io/ecma262/#sec-literals-numeric-literals - isDecimalDigit: function (cp) { - return (cp >= 0x30 && cp <= 0x39); // 0..9 - }, - isHexDigit: function (cp) { - return (cp >= 0x30 && cp <= 0x39) || - (cp >= 0x41 && cp <= 0x46) || - (cp >= 0x61 && cp <= 0x66); // a..f - }, - isOctalDigit: function (cp) { - return (cp >= 0x30 && cp <= 0x37); // 0..7 - } - }; - - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var jsx_syntax_1 = __webpack_require__(6); - /* tslint:disable:max-classes-per-file */ - var JSXClosingElement = (function () { - function JSXClosingElement(name) { - this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement; - this.name = name; - } - return JSXClosingElement; - }()); - exports.JSXClosingElement = JSXClosingElement; - var JSXElement = (function () { - function JSXElement(openingElement, children, closingElement) { - this.type = jsx_syntax_1.JSXSyntax.JSXElement; - this.openingElement = openingElement; - this.children = children; - this.closingElement = closingElement; - } - return JSXElement; - }()); - exports.JSXElement = JSXElement; - var JSXEmptyExpression = (function () { - function JSXEmptyExpression() { - this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression; - } - return JSXEmptyExpression; - }()); - exports.JSXEmptyExpression = JSXEmptyExpression; - var JSXExpressionContainer = (function () { - function JSXExpressionContainer(expression) { - this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer; - this.expression = expression; - } - return JSXExpressionContainer; - }()); - exports.JSXExpressionContainer = JSXExpressionContainer; - var JSXIdentifier = (function () { - function JSXIdentifier(name) { - this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier; - this.name = name; - } - return JSXIdentifier; - }()); - exports.JSXIdentifier = JSXIdentifier; - var JSXMemberExpression = (function () { - function JSXMemberExpression(object, property) { - this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression; - this.object = object; - this.property = property; - } - return JSXMemberExpression; - }()); - exports.JSXMemberExpression = JSXMemberExpression; - var JSXAttribute = (function () { - function JSXAttribute(name, value) { - this.type = jsx_syntax_1.JSXSyntax.JSXAttribute; - this.name = name; - this.value = value; - } - return JSXAttribute; - }()); - exports.JSXAttribute = JSXAttribute; - var JSXNamespacedName = (function () { - function JSXNamespacedName(namespace, name) { - this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName; - this.namespace = namespace; - this.name = name; - } - return JSXNamespacedName; - }()); - exports.JSXNamespacedName = JSXNamespacedName; - var JSXOpeningElement = (function () { - function JSXOpeningElement(name, selfClosing, attributes) { - this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement; - this.name = name; - this.selfClosing = selfClosing; - this.attributes = attributes; - } - return JSXOpeningElement; - }()); - exports.JSXOpeningElement = JSXOpeningElement; - var JSXSpreadAttribute = (function () { - function JSXSpreadAttribute(argument) { - this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute; - this.argument = argument; - } - return JSXSpreadAttribute; - }()); - exports.JSXSpreadAttribute = JSXSpreadAttribute; - var JSXText = (function () { - function JSXText(value, raw) { - this.type = jsx_syntax_1.JSXSyntax.JSXText; - this.value = value; - this.raw = raw; - } - return JSXText; - }()); - exports.JSXText = JSXText; - - -/***/ }, -/* 6 */ -/***/ function(module, exports) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.JSXSyntax = { - JSXAttribute: 'JSXAttribute', - JSXClosingElement: 'JSXClosingElement', - JSXElement: 'JSXElement', - JSXEmptyExpression: 'JSXEmptyExpression', - JSXExpressionContainer: 'JSXExpressionContainer', - JSXIdentifier: 'JSXIdentifier', - JSXMemberExpression: 'JSXMemberExpression', - JSXNamespacedName: 'JSXNamespacedName', - JSXOpeningElement: 'JSXOpeningElement', - JSXSpreadAttribute: 'JSXSpreadAttribute', - JSXText: 'JSXText' - }; - - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var syntax_1 = __webpack_require__(2); - /* tslint:disable:max-classes-per-file */ - var ArrayExpression = (function () { - function ArrayExpression(elements) { - this.type = syntax_1.Syntax.ArrayExpression; - this.elements = elements; - } - return ArrayExpression; - }()); - exports.ArrayExpression = ArrayExpression; - var ArrayPattern = (function () { - function ArrayPattern(elements) { - this.type = syntax_1.Syntax.ArrayPattern; - this.elements = elements; - } - return ArrayPattern; - }()); - exports.ArrayPattern = ArrayPattern; - var ArrowFunctionExpression = (function () { - function ArrowFunctionExpression(params, body, expression) { - this.type = syntax_1.Syntax.ArrowFunctionExpression; - this.id = null; - this.params = params; - this.body = body; - this.generator = false; - this.expression = expression; - this.async = false; - } - return ArrowFunctionExpression; - }()); - exports.ArrowFunctionExpression = ArrowFunctionExpression; - var AssignmentExpression = (function () { - function AssignmentExpression(operator, left, right) { - this.type = syntax_1.Syntax.AssignmentExpression; - this.operator = operator; - this.left = left; - this.right = right; - } - return AssignmentExpression; - }()); - exports.AssignmentExpression = AssignmentExpression; - var AssignmentPattern = (function () { - function AssignmentPattern(left, right) { - this.type = syntax_1.Syntax.AssignmentPattern; - this.left = left; - this.right = right; - } - return AssignmentPattern; - }()); - exports.AssignmentPattern = AssignmentPattern; - var AsyncArrowFunctionExpression = (function () { - function AsyncArrowFunctionExpression(params, body, expression) { - this.type = syntax_1.Syntax.ArrowFunctionExpression; - this.id = null; - this.params = params; - this.body = body; - this.generator = false; - this.expression = expression; - this.async = true; - } - return AsyncArrowFunctionExpression; - }()); - exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression; - var AsyncFunctionDeclaration = (function () { - function AsyncFunctionDeclaration(id, params, body) { - this.type = syntax_1.Syntax.FunctionDeclaration; - this.id = id; - this.params = params; - this.body = body; - this.generator = false; - this.expression = false; - this.async = true; - } - return AsyncFunctionDeclaration; - }()); - exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration; - var AsyncFunctionExpression = (function () { - function AsyncFunctionExpression(id, params, body) { - this.type = syntax_1.Syntax.FunctionExpression; - this.id = id; - this.params = params; - this.body = body; - this.generator = false; - this.expression = false; - this.async = true; - } - return AsyncFunctionExpression; - }()); - exports.AsyncFunctionExpression = AsyncFunctionExpression; - var AwaitExpression = (function () { - function AwaitExpression(argument) { - this.type = syntax_1.Syntax.AwaitExpression; - this.argument = argument; - } - return AwaitExpression; - }()); - exports.AwaitExpression = AwaitExpression; - var BinaryExpression = (function () { - function BinaryExpression(operator, left, right) { - var logical = (operator === '||' || operator === '&&'); - this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression; - this.operator = operator; - this.left = left; - this.right = right; - } - return BinaryExpression; - }()); - exports.BinaryExpression = BinaryExpression; - var BlockStatement = (function () { - function BlockStatement(body) { - this.type = syntax_1.Syntax.BlockStatement; - this.body = body; - } - return BlockStatement; - }()); - exports.BlockStatement = BlockStatement; - var BreakStatement = (function () { - function BreakStatement(label) { - this.type = syntax_1.Syntax.BreakStatement; - this.label = label; - } - return BreakStatement; - }()); - exports.BreakStatement = BreakStatement; - var CallExpression = (function () { - function CallExpression(callee, args) { - this.type = syntax_1.Syntax.CallExpression; - this.callee = callee; - this.arguments = args; - } - return CallExpression; - }()); - exports.CallExpression = CallExpression; - var CatchClause = (function () { - function CatchClause(param, body) { - this.type = syntax_1.Syntax.CatchClause; - this.param = param; - this.body = body; - } - return CatchClause; - }()); - exports.CatchClause = CatchClause; - var ClassBody = (function () { - function ClassBody(body) { - this.type = syntax_1.Syntax.ClassBody; - this.body = body; - } - return ClassBody; - }()); - exports.ClassBody = ClassBody; - var ClassDeclaration = (function () { - function ClassDeclaration(id, superClass, body) { - this.type = syntax_1.Syntax.ClassDeclaration; - this.id = id; - this.superClass = superClass; - this.body = body; - } - return ClassDeclaration; - }()); - exports.ClassDeclaration = ClassDeclaration; - var ClassExpression = (function () { - function ClassExpression(id, superClass, body) { - this.type = syntax_1.Syntax.ClassExpression; - this.id = id; - this.superClass = superClass; - this.body = body; - } - return ClassExpression; - }()); - exports.ClassExpression = ClassExpression; - var ComputedMemberExpression = (function () { - function ComputedMemberExpression(object, property) { - this.type = syntax_1.Syntax.MemberExpression; - this.computed = true; - this.object = object; - this.property = property; - } - return ComputedMemberExpression; - }()); - exports.ComputedMemberExpression = ComputedMemberExpression; - var ConditionalExpression = (function () { - function ConditionalExpression(test, consequent, alternate) { - this.type = syntax_1.Syntax.ConditionalExpression; - this.test = test; - this.consequent = consequent; - this.alternate = alternate; - } - return ConditionalExpression; - }()); - exports.ConditionalExpression = ConditionalExpression; - var ContinueStatement = (function () { - function ContinueStatement(label) { - this.type = syntax_1.Syntax.ContinueStatement; - this.label = label; - } - return ContinueStatement; - }()); - exports.ContinueStatement = ContinueStatement; - var DebuggerStatement = (function () { - function DebuggerStatement() { - this.type = syntax_1.Syntax.DebuggerStatement; - } - return DebuggerStatement; - }()); - exports.DebuggerStatement = DebuggerStatement; - var Directive = (function () { - function Directive(expression, directive) { - this.type = syntax_1.Syntax.ExpressionStatement; - this.expression = expression; - this.directive = directive; - } - return Directive; - }()); - exports.Directive = Directive; - var DoWhileStatement = (function () { - function DoWhileStatement(body, test) { - this.type = syntax_1.Syntax.DoWhileStatement; - this.body = body; - this.test = test; - } - return DoWhileStatement; - }()); - exports.DoWhileStatement = DoWhileStatement; - var EmptyStatement = (function () { - function EmptyStatement() { - this.type = syntax_1.Syntax.EmptyStatement; - } - return EmptyStatement; - }()); - exports.EmptyStatement = EmptyStatement; - var ExportAllDeclaration = (function () { - function ExportAllDeclaration(source) { - this.type = syntax_1.Syntax.ExportAllDeclaration; - this.source = source; - } - return ExportAllDeclaration; - }()); - exports.ExportAllDeclaration = ExportAllDeclaration; - var ExportDefaultDeclaration = (function () { - function ExportDefaultDeclaration(declaration) { - this.type = syntax_1.Syntax.ExportDefaultDeclaration; - this.declaration = declaration; - } - return ExportDefaultDeclaration; - }()); - exports.ExportDefaultDeclaration = ExportDefaultDeclaration; - var ExportNamedDeclaration = (function () { - function ExportNamedDeclaration(declaration, specifiers, source) { - this.type = syntax_1.Syntax.ExportNamedDeclaration; - this.declaration = declaration; - this.specifiers = specifiers; - this.source = source; - } - return ExportNamedDeclaration; - }()); - exports.ExportNamedDeclaration = ExportNamedDeclaration; - var ExportSpecifier = (function () { - function ExportSpecifier(local, exported) { - this.type = syntax_1.Syntax.ExportSpecifier; - this.exported = exported; - this.local = local; - } - return ExportSpecifier; - }()); - exports.ExportSpecifier = ExportSpecifier; - var ExpressionStatement = (function () { - function ExpressionStatement(expression) { - this.type = syntax_1.Syntax.ExpressionStatement; - this.expression = expression; - } - return ExpressionStatement; - }()); - exports.ExpressionStatement = ExpressionStatement; - var ForInStatement = (function () { - function ForInStatement(left, right, body) { - this.type = syntax_1.Syntax.ForInStatement; - this.left = left; - this.right = right; - this.body = body; - this.each = false; - } - return ForInStatement; - }()); - exports.ForInStatement = ForInStatement; - var ForOfStatement = (function () { - function ForOfStatement(left, right, body) { - this.type = syntax_1.Syntax.ForOfStatement; - this.left = left; - this.right = right; - this.body = body; - } - return ForOfStatement; - }()); - exports.ForOfStatement = ForOfStatement; - var ForStatement = (function () { - function ForStatement(init, test, update, body) { - this.type = syntax_1.Syntax.ForStatement; - this.init = init; - this.test = test; - this.update = update; - this.body = body; - } - return ForStatement; - }()); - exports.ForStatement = ForStatement; - var FunctionDeclaration = (function () { - function FunctionDeclaration(id, params, body, generator) { - this.type = syntax_1.Syntax.FunctionDeclaration; - this.id = id; - this.params = params; - this.body = body; - this.generator = generator; - this.expression = false; - this.async = false; - } - return FunctionDeclaration; - }()); - exports.FunctionDeclaration = FunctionDeclaration; - var FunctionExpression = (function () { - function FunctionExpression(id, params, body, generator) { - this.type = syntax_1.Syntax.FunctionExpression; - this.id = id; - this.params = params; - this.body = body; - this.generator = generator; - this.expression = false; - this.async = false; - } - return FunctionExpression; - }()); - exports.FunctionExpression = FunctionExpression; - var Identifier = (function () { - function Identifier(name) { - this.type = syntax_1.Syntax.Identifier; - this.name = name; - } - return Identifier; - }()); - exports.Identifier = Identifier; - var IfStatement = (function () { - function IfStatement(test, consequent, alternate) { - this.type = syntax_1.Syntax.IfStatement; - this.test = test; - this.consequent = consequent; - this.alternate = alternate; - } - return IfStatement; - }()); - exports.IfStatement = IfStatement; - var ImportDeclaration = (function () { - function ImportDeclaration(specifiers, source) { - this.type = syntax_1.Syntax.ImportDeclaration; - this.specifiers = specifiers; - this.source = source; - } - return ImportDeclaration; - }()); - exports.ImportDeclaration = ImportDeclaration; - var ImportDefaultSpecifier = (function () { - function ImportDefaultSpecifier(local) { - this.type = syntax_1.Syntax.ImportDefaultSpecifier; - this.local = local; - } - return ImportDefaultSpecifier; - }()); - exports.ImportDefaultSpecifier = ImportDefaultSpecifier; - var ImportNamespaceSpecifier = (function () { - function ImportNamespaceSpecifier(local) { - this.type = syntax_1.Syntax.ImportNamespaceSpecifier; - this.local = local; - } - return ImportNamespaceSpecifier; - }()); - exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; - var ImportSpecifier = (function () { - function ImportSpecifier(local, imported) { - this.type = syntax_1.Syntax.ImportSpecifier; - this.local = local; - this.imported = imported; - } - return ImportSpecifier; - }()); - exports.ImportSpecifier = ImportSpecifier; - var LabeledStatement = (function () { - function LabeledStatement(label, body) { - this.type = syntax_1.Syntax.LabeledStatement; - this.label = label; - this.body = body; - } - return LabeledStatement; - }()); - exports.LabeledStatement = LabeledStatement; - var Literal = (function () { - function Literal(value, raw) { - this.type = syntax_1.Syntax.Literal; - this.value = value; - this.raw = raw; - } - return Literal; - }()); - exports.Literal = Literal; - var MetaProperty = (function () { - function MetaProperty(meta, property) { - this.type = syntax_1.Syntax.MetaProperty; - this.meta = meta; - this.property = property; - } - return MetaProperty; - }()); - exports.MetaProperty = MetaProperty; - var MethodDefinition = (function () { - function MethodDefinition(key, computed, value, kind, isStatic) { - this.type = syntax_1.Syntax.MethodDefinition; - this.key = key; - this.computed = computed; - this.value = value; - this.kind = kind; - this.static = isStatic; - } - return MethodDefinition; - }()); - exports.MethodDefinition = MethodDefinition; - var Module = (function () { - function Module(body) { - this.type = syntax_1.Syntax.Program; - this.body = body; - this.sourceType = 'module'; - } - return Module; - }()); - exports.Module = Module; - var NewExpression = (function () { - function NewExpression(callee, args) { - this.type = syntax_1.Syntax.NewExpression; - this.callee = callee; - this.arguments = args; - } - return NewExpression; - }()); - exports.NewExpression = NewExpression; - var ObjectExpression = (function () { - function ObjectExpression(properties) { - this.type = syntax_1.Syntax.ObjectExpression; - this.properties = properties; - } - return ObjectExpression; - }()); - exports.ObjectExpression = ObjectExpression; - var ObjectPattern = (function () { - function ObjectPattern(properties) { - this.type = syntax_1.Syntax.ObjectPattern; - this.properties = properties; - } - return ObjectPattern; - }()); - exports.ObjectPattern = ObjectPattern; - var Property = (function () { - function Property(kind, key, computed, value, method, shorthand) { - this.type = syntax_1.Syntax.Property; - this.key = key; - this.computed = computed; - this.value = value; - this.kind = kind; - this.method = method; - this.shorthand = shorthand; - } - return Property; - }()); - exports.Property = Property; - var RegexLiteral = (function () { - function RegexLiteral(value, raw, pattern, flags) { - this.type = syntax_1.Syntax.Literal; - this.value = value; - this.raw = raw; - this.regex = { pattern: pattern, flags: flags }; - } - return RegexLiteral; - }()); - exports.RegexLiteral = RegexLiteral; - var RestElement = (function () { - function RestElement(argument) { - this.type = syntax_1.Syntax.RestElement; - this.argument = argument; - } - return RestElement; - }()); - exports.RestElement = RestElement; - var ReturnStatement = (function () { - function ReturnStatement(argument) { - this.type = syntax_1.Syntax.ReturnStatement; - this.argument = argument; - } - return ReturnStatement; - }()); - exports.ReturnStatement = ReturnStatement; - var Script = (function () { - function Script(body) { - this.type = syntax_1.Syntax.Program; - this.body = body; - this.sourceType = 'script'; - } - return Script; - }()); - exports.Script = Script; - var SequenceExpression = (function () { - function SequenceExpression(expressions) { - this.type = syntax_1.Syntax.SequenceExpression; - this.expressions = expressions; - } - return SequenceExpression; - }()); - exports.SequenceExpression = SequenceExpression; - var SpreadElement = (function () { - function SpreadElement(argument) { - this.type = syntax_1.Syntax.SpreadElement; - this.argument = argument; - } - return SpreadElement; - }()); - exports.SpreadElement = SpreadElement; - var StaticMemberExpression = (function () { - function StaticMemberExpression(object, property) { - this.type = syntax_1.Syntax.MemberExpression; - this.computed = false; - this.object = object; - this.property = property; - } - return StaticMemberExpression; - }()); - exports.StaticMemberExpression = StaticMemberExpression; - var Super = (function () { - function Super() { - this.type = syntax_1.Syntax.Super; - } - return Super; - }()); - exports.Super = Super; - var SwitchCase = (function () { - function SwitchCase(test, consequent) { - this.type = syntax_1.Syntax.SwitchCase; - this.test = test; - this.consequent = consequent; - } - return SwitchCase; - }()); - exports.SwitchCase = SwitchCase; - var SwitchStatement = (function () { - function SwitchStatement(discriminant, cases) { - this.type = syntax_1.Syntax.SwitchStatement; - this.discriminant = discriminant; - this.cases = cases; - } - return SwitchStatement; - }()); - exports.SwitchStatement = SwitchStatement; - var TaggedTemplateExpression = (function () { - function TaggedTemplateExpression(tag, quasi) { - this.type = syntax_1.Syntax.TaggedTemplateExpression; - this.tag = tag; - this.quasi = quasi; - } - return TaggedTemplateExpression; - }()); - exports.TaggedTemplateExpression = TaggedTemplateExpression; - var TemplateElement = (function () { - function TemplateElement(value, tail) { - this.type = syntax_1.Syntax.TemplateElement; - this.value = value; - this.tail = tail; - } - return TemplateElement; - }()); - exports.TemplateElement = TemplateElement; - var TemplateLiteral = (function () { - function TemplateLiteral(quasis, expressions) { - this.type = syntax_1.Syntax.TemplateLiteral; - this.quasis = quasis; - this.expressions = expressions; - } - return TemplateLiteral; - }()); - exports.TemplateLiteral = TemplateLiteral; - var ThisExpression = (function () { - function ThisExpression() { - this.type = syntax_1.Syntax.ThisExpression; - } - return ThisExpression; - }()); - exports.ThisExpression = ThisExpression; - var ThrowStatement = (function () { - function ThrowStatement(argument) { - this.type = syntax_1.Syntax.ThrowStatement; - this.argument = argument; - } - return ThrowStatement; - }()); - exports.ThrowStatement = ThrowStatement; - var TryStatement = (function () { - function TryStatement(block, handler, finalizer) { - this.type = syntax_1.Syntax.TryStatement; - this.block = block; - this.handler = handler; - this.finalizer = finalizer; - } - return TryStatement; - }()); - exports.TryStatement = TryStatement; - var UnaryExpression = (function () { - function UnaryExpression(operator, argument) { - this.type = syntax_1.Syntax.UnaryExpression; - this.operator = operator; - this.argument = argument; - this.prefix = true; - } - return UnaryExpression; - }()); - exports.UnaryExpression = UnaryExpression; - var UpdateExpression = (function () { - function UpdateExpression(operator, argument, prefix) { - this.type = syntax_1.Syntax.UpdateExpression; - this.operator = operator; - this.argument = argument; - this.prefix = prefix; - } - return UpdateExpression; - }()); - exports.UpdateExpression = UpdateExpression; - var VariableDeclaration = (function () { - function VariableDeclaration(declarations, kind) { - this.type = syntax_1.Syntax.VariableDeclaration; - this.declarations = declarations; - this.kind = kind; - } - return VariableDeclaration; - }()); - exports.VariableDeclaration = VariableDeclaration; - var VariableDeclarator = (function () { - function VariableDeclarator(id, init) { - this.type = syntax_1.Syntax.VariableDeclarator; - this.id = id; - this.init = init; - } - return VariableDeclarator; - }()); - exports.VariableDeclarator = VariableDeclarator; - var WhileStatement = (function () { - function WhileStatement(test, body) { - this.type = syntax_1.Syntax.WhileStatement; - this.test = test; - this.body = body; - } - return WhileStatement; - }()); - exports.WhileStatement = WhileStatement; - var WithStatement = (function () { - function WithStatement(object, body) { - this.type = syntax_1.Syntax.WithStatement; - this.object = object; - this.body = body; - } - return WithStatement; - }()); - exports.WithStatement = WithStatement; - var YieldExpression = (function () { - function YieldExpression(argument, delegate) { - this.type = syntax_1.Syntax.YieldExpression; - this.argument = argument; - this.delegate = delegate; - } - return YieldExpression; - }()); - exports.YieldExpression = YieldExpression; - - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var assert_1 = __webpack_require__(9); - var error_handler_1 = __webpack_require__(10); - var messages_1 = __webpack_require__(11); - var Node = __webpack_require__(7); - var scanner_1 = __webpack_require__(12); - var syntax_1 = __webpack_require__(2); - var token_1 = __webpack_require__(13); - var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder'; - var Parser = (function () { - function Parser(code, options, delegate) { - if (options === void 0) { options = {}; } - this.config = { - range: (typeof options.range === 'boolean') && options.range, - loc: (typeof options.loc === 'boolean') && options.loc, - source: null, - tokens: (typeof options.tokens === 'boolean') && options.tokens, - comment: (typeof options.comment === 'boolean') && options.comment, - tolerant: (typeof options.tolerant === 'boolean') && options.tolerant - }; - if (this.config.loc && options.source && options.source !== null) { - this.config.source = String(options.source); - } - this.delegate = delegate; - this.errorHandler = new error_handler_1.ErrorHandler(); - this.errorHandler.tolerant = this.config.tolerant; - this.scanner = new scanner_1.Scanner(code, this.errorHandler); - this.scanner.trackComment = this.config.comment; - this.operatorPrecedence = { - ')': 0, - ';': 0, - ',': 0, - '=': 0, - ']': 0, - '||': 1, - '&&': 2, - '|': 3, - '^': 4, - '&': 5, - '==': 6, - '!=': 6, - '===': 6, - '!==': 6, - '<': 7, - '>': 7, - '<=': 7, - '>=': 7, - '<<': 8, - '>>': 8, - '>>>': 8, - '+': 9, - '-': 9, - '*': 11, - '/': 11, - '%': 11 - }; - this.lookahead = { - type: 2 /* EOF */, - value: '', - lineNumber: this.scanner.lineNumber, - lineStart: 0, - start: 0, - end: 0 - }; - this.hasLineTerminator = false; - this.context = { - isModule: false, - await: false, - allowIn: true, - allowStrictDirective: true, - allowYield: true, - firstCoverInitializedNameError: null, - isAssignmentTarget: false, - isBindingElement: false, - inFunctionBody: false, - inIteration: false, - inSwitch: false, - labelSet: {}, - strict: false - }; - this.tokens = []; - this.startMarker = { - index: 0, - line: this.scanner.lineNumber, - column: 0 - }; - this.lastMarker = { - index: 0, - line: this.scanner.lineNumber, - column: 0 - }; - this.nextToken(); - this.lastMarker = { - index: this.scanner.index, - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - }; - } - Parser.prototype.throwError = function (messageFormat) { - var values = []; - for (var _i = 1; _i < arguments.length; _i++) { - values[_i - 1] = arguments[_i]; - } - var args = Array.prototype.slice.call(arguments, 1); - var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { - assert_1.assert(idx < args.length, 'Message reference must be in range'); - return args[idx]; - }); - var index = this.lastMarker.index; - var line = this.lastMarker.line; - var column = this.lastMarker.column + 1; - throw this.errorHandler.createError(index, line, column, msg); - }; - Parser.prototype.tolerateError = function (messageFormat) { - var values = []; - for (var _i = 1; _i < arguments.length; _i++) { - values[_i - 1] = arguments[_i]; - } - var args = Array.prototype.slice.call(arguments, 1); - var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { - assert_1.assert(idx < args.length, 'Message reference must be in range'); - return args[idx]; - }); - var index = this.lastMarker.index; - var line = this.scanner.lineNumber; - var column = this.lastMarker.column + 1; - this.errorHandler.tolerateError(index, line, column, msg); - }; - // Throw an exception because of the token. - Parser.prototype.unexpectedTokenError = function (token, message) { - var msg = message || messages_1.Messages.UnexpectedToken; - var value; - if (token) { - if (!message) { - msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS : - (token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier : - (token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber : - (token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString : - (token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate : - messages_1.Messages.UnexpectedToken; - if (token.type === 4 /* Keyword */) { - if (this.scanner.isFutureReservedWord(token.value)) { - msg = messages_1.Messages.UnexpectedReserved; - } - else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) { - msg = messages_1.Messages.StrictReservedWord; - } - } - } - value = token.value; - } - else { - value = 'ILLEGAL'; - } - msg = msg.replace('%0', value); - if (token && typeof token.lineNumber === 'number') { - var index = token.start; - var line = token.lineNumber; - var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column; - var column = token.start - lastMarkerLineStart + 1; - return this.errorHandler.createError(index, line, column, msg); - } - else { - var index = this.lastMarker.index; - var line = this.lastMarker.line; - var column = this.lastMarker.column + 1; - return this.errorHandler.createError(index, line, column, msg); - } - }; - Parser.prototype.throwUnexpectedToken = function (token, message) { - throw this.unexpectedTokenError(token, message); - }; - Parser.prototype.tolerateUnexpectedToken = function (token, message) { - this.errorHandler.tolerate(this.unexpectedTokenError(token, message)); - }; - Parser.prototype.collectComments = function () { - if (!this.config.comment) { - this.scanner.scanComments(); - } - else { - var comments = this.scanner.scanComments(); - if (comments.length > 0 && this.delegate) { - for (var i = 0; i < comments.length; ++i) { - var e = comments[i]; - var node = void 0; - node = { - type: e.multiLine ? 'BlockComment' : 'LineComment', - value: this.scanner.source.slice(e.slice[0], e.slice[1]) - }; - if (this.config.range) { - node.range = e.range; - } - if (this.config.loc) { - node.loc = e.loc; - } - var metadata = { - start: { - line: e.loc.start.line, - column: e.loc.start.column, - offset: e.range[0] - }, - end: { - line: e.loc.end.line, - column: e.loc.end.column, - offset: e.range[1] - } - }; - this.delegate(node, metadata); - } - } - } - }; - // From internal representation to an external structure - Parser.prototype.getTokenRaw = function (token) { - return this.scanner.source.slice(token.start, token.end); - }; - Parser.prototype.convertToken = function (token) { - var t = { - type: token_1.TokenName[token.type], - value: this.getTokenRaw(token) - }; - if (this.config.range) { - t.range = [token.start, token.end]; - } - if (this.config.loc) { - t.loc = { - start: { - line: this.startMarker.line, - column: this.startMarker.column - }, - end: { - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - } - }; - } - if (token.type === 9 /* RegularExpression */) { - var pattern = token.pattern; - var flags = token.flags; - t.regex = { pattern: pattern, flags: flags }; - } - return t; - }; - Parser.prototype.nextToken = function () { - var token = this.lookahead; - this.lastMarker.index = this.scanner.index; - this.lastMarker.line = this.scanner.lineNumber; - this.lastMarker.column = this.scanner.index - this.scanner.lineStart; - this.collectComments(); - if (this.scanner.index !== this.startMarker.index) { - this.startMarker.index = this.scanner.index; - this.startMarker.line = this.scanner.lineNumber; - this.startMarker.column = this.scanner.index - this.scanner.lineStart; - } - var next = this.scanner.lex(); - this.hasLineTerminator = (token.lineNumber !== next.lineNumber); - if (next && this.context.strict && next.type === 3 /* Identifier */) { - if (this.scanner.isStrictModeReservedWord(next.value)) { - next.type = 4 /* Keyword */; - } - } - this.lookahead = next; - if (this.config.tokens && next.type !== 2 /* EOF */) { - this.tokens.push(this.convertToken(next)); - } - return token; - }; - Parser.prototype.nextRegexToken = function () { - this.collectComments(); - var token = this.scanner.scanRegExp(); - if (this.config.tokens) { - // Pop the previous token, '/' or '/=' - // This is added from the lookahead token. - this.tokens.pop(); - this.tokens.push(this.convertToken(token)); - } - // Prime the next lookahead. - this.lookahead = token; - this.nextToken(); - return token; - }; - Parser.prototype.createNode = function () { - return { - index: this.startMarker.index, - line: this.startMarker.line, - column: this.startMarker.column - }; - }; - Parser.prototype.startNode = function (token, lastLineStart) { - if (lastLineStart === void 0) { lastLineStart = 0; } - var column = token.start - token.lineStart; - var line = token.lineNumber; - if (column < 0) { - column += lastLineStart; - line--; - } - return { - index: token.start, - line: line, - column: column - }; - }; - Parser.prototype.finalize = function (marker, node) { - if (this.config.range) { - node.range = [marker.index, this.lastMarker.index]; - } - if (this.config.loc) { - node.loc = { - start: { - line: marker.line, - column: marker.column, - }, - end: { - line: this.lastMarker.line, - column: this.lastMarker.column - } - }; - if (this.config.source) { - node.loc.source = this.config.source; - } - } - if (this.delegate) { - var metadata = { - start: { - line: marker.line, - column: marker.column, - offset: marker.index - }, - end: { - line: this.lastMarker.line, - column: this.lastMarker.column, - offset: this.lastMarker.index - } - }; - this.delegate(node, metadata); - } - return node; - }; - // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - Parser.prototype.expect = function (value) { - var token = this.nextToken(); - if (token.type !== 7 /* Punctuator */ || token.value !== value) { - this.throwUnexpectedToken(token); - } - }; - // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). - Parser.prototype.expectCommaSeparator = function () { - if (this.config.tolerant) { - var token = this.lookahead; - if (token.type === 7 /* Punctuator */ && token.value === ',') { - this.nextToken(); - } - else if (token.type === 7 /* Punctuator */ && token.value === ';') { - this.nextToken(); - this.tolerateUnexpectedToken(token); - } - else { - this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken); - } - } - else { - this.expect(','); - } - }; - // Expect the next token to match the specified keyword. - // If not, an exception will be thrown. - Parser.prototype.expectKeyword = function (keyword) { - var token = this.nextToken(); - if (token.type !== 4 /* Keyword */ || token.value !== keyword) { - this.throwUnexpectedToken(token); - } - }; - // Return true if the next token matches the specified punctuator. - Parser.prototype.match = function (value) { - return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value; - }; - // Return true if the next token matches the specified keyword - Parser.prototype.matchKeyword = function (keyword) { - return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword; - }; - // Return true if the next token matches the specified contextual keyword - // (where an identifier is sometimes a keyword depending on the context) - Parser.prototype.matchContextualKeyword = function (keyword) { - return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword; - }; - // Return true if the next token is an assignment operator - Parser.prototype.matchAssign = function () { - if (this.lookahead.type !== 7 /* Punctuator */) { - return false; - } - var op = this.lookahead.value; - return op === '=' || - op === '*=' || - op === '**=' || - op === '/=' || - op === '%=' || - op === '+=' || - op === '-=' || - op === '<<=' || - op === '>>=' || - op === '>>>=' || - op === '&=' || - op === '^=' || - op === '|='; - }; - // Cover grammar support. - // - // When an assignment expression position starts with an left parenthesis, the determination of the type - // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) - // or the first comma. This situation also defers the determination of all the expressions nested in the pair. - // - // There are three productions that can be parsed in a parentheses pair that needs to be determined - // after the outermost pair is closed. They are: - // - // 1. AssignmentExpression - // 2. BindingElements - // 3. AssignmentTargets - // - // In order to avoid exponential backtracking, we use two flags to denote if the production can be - // binding element or assignment target. - // - // The three productions have the relationship: - // - // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression - // - // with a single exception that CoverInitializedName when used directly in an Expression, generates - // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the - // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. - // - // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not - // effect the current flags. This means the production the parser parses is only used as an expression. Therefore - // the CoverInitializedName check is conducted. - // - // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates - // the flags outside of the parser. This means the production the parser parses is used as a part of a potential - // pattern. The CoverInitializedName check is deferred. - Parser.prototype.isolateCoverGrammar = function (parseFunction) { - var previousIsBindingElement = this.context.isBindingElement; - var previousIsAssignmentTarget = this.context.isAssignmentTarget; - var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; - this.context.isBindingElement = true; - this.context.isAssignmentTarget = true; - this.context.firstCoverInitializedNameError = null; - var result = parseFunction.call(this); - if (this.context.firstCoverInitializedNameError !== null) { - this.throwUnexpectedToken(this.context.firstCoverInitializedNameError); - } - this.context.isBindingElement = previousIsBindingElement; - this.context.isAssignmentTarget = previousIsAssignmentTarget; - this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError; - return result; - }; - Parser.prototype.inheritCoverGrammar = function (parseFunction) { - var previousIsBindingElement = this.context.isBindingElement; - var previousIsAssignmentTarget = this.context.isAssignmentTarget; - var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; - this.context.isBindingElement = true; - this.context.isAssignmentTarget = true; - this.context.firstCoverInitializedNameError = null; - var result = parseFunction.call(this); - this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement; - this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget; - this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError; - return result; - }; - Parser.prototype.consumeSemicolon = function () { - if (this.match(';')) { - this.nextToken(); - } - else if (!this.hasLineTerminator) { - if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) { - this.throwUnexpectedToken(this.lookahead); - } - this.lastMarker.index = this.startMarker.index; - this.lastMarker.line = this.startMarker.line; - this.lastMarker.column = this.startMarker.column; - } - }; - // https://tc39.github.io/ecma262/#sec-primary-expression - Parser.prototype.parsePrimaryExpression = function () { - var node = this.createNode(); - var expr; - var token, raw; - switch (this.lookahead.type) { - case 3 /* Identifier */: - if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') { - this.tolerateUnexpectedToken(this.lookahead); - } - expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value)); - break; - case 6 /* NumericLiteral */: - case 8 /* StringLiteral */: - if (this.context.strict && this.lookahead.octal) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral); - } - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - token = this.nextToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.Literal(token.value, raw)); - break; - case 1 /* BooleanLiteral */: - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - token = this.nextToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.Literal(token.value === 'true', raw)); - break; - case 5 /* NullLiteral */: - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - token = this.nextToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.Literal(null, raw)); - break; - case 10 /* Template */: - expr = this.parseTemplateLiteral(); - break; - case 7 /* Punctuator */: - switch (this.lookahead.value) { - case '(': - this.context.isBindingElement = false; - expr = this.inheritCoverGrammar(this.parseGroupExpression); - break; - case '[': - expr = this.inheritCoverGrammar(this.parseArrayInitializer); - break; - case '{': - expr = this.inheritCoverGrammar(this.parseObjectInitializer); - break; - case '/': - case '/=': - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - this.scanner.index = this.startMarker.index; - token = this.nextRegexToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags)); - break; - default: - expr = this.throwUnexpectedToken(this.nextToken()); - } - break; - case 4 /* Keyword */: - if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) { - expr = this.parseIdentifierName(); - } - else if (!this.context.strict && this.matchKeyword('let')) { - expr = this.finalize(node, new Node.Identifier(this.nextToken().value)); - } - else { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - if (this.matchKeyword('function')) { - expr = this.parseFunctionExpression(); - } - else if (this.matchKeyword('this')) { - this.nextToken(); - expr = this.finalize(node, new Node.ThisExpression()); - } - else if (this.matchKeyword('class')) { - expr = this.parseClassExpression(); - } - else { - expr = this.throwUnexpectedToken(this.nextToken()); - } - } - break; - default: - expr = this.throwUnexpectedToken(this.nextToken()); - } - return expr; - }; - // https://tc39.github.io/ecma262/#sec-array-initializer - Parser.prototype.parseSpreadElement = function () { - var node = this.createNode(); - this.expect('...'); - var arg = this.inheritCoverGrammar(this.parseAssignmentExpression); - return this.finalize(node, new Node.SpreadElement(arg)); - }; - Parser.prototype.parseArrayInitializer = function () { - var node = this.createNode(); - var elements = []; - this.expect('['); - while (!this.match(']')) { - if (this.match(',')) { - this.nextToken(); - elements.push(null); - } - else if (this.match('...')) { - var element = this.parseSpreadElement(); - if (!this.match(']')) { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - this.expect(','); - } - elements.push(element); - } - else { - elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); - if (!this.match(']')) { - this.expect(','); - } - } - } - this.expect(']'); - return this.finalize(node, new Node.ArrayExpression(elements)); - }; - // https://tc39.github.io/ecma262/#sec-object-initializer - Parser.prototype.parsePropertyMethod = function (params) { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var previousStrict = this.context.strict; - var previousAllowStrictDirective = this.context.allowStrictDirective; - this.context.allowStrictDirective = params.simple; - var body = this.isolateCoverGrammar(this.parseFunctionSourceElements); - if (this.context.strict && params.firstRestricted) { - this.tolerateUnexpectedToken(params.firstRestricted, params.message); - } - if (this.context.strict && params.stricted) { - this.tolerateUnexpectedToken(params.stricted, params.message); - } - this.context.strict = previousStrict; - this.context.allowStrictDirective = previousAllowStrictDirective; - return body; - }; - Parser.prototype.parsePropertyMethodFunction = function () { - var isGenerator = false; - var node = this.createNode(); - var previousAllowYield = this.context.allowYield; - this.context.allowYield = true; - var params = this.parseFormalParameters(); - var method = this.parsePropertyMethod(params); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); - }; - Parser.prototype.parsePropertyMethodAsyncFunction = function () { - var node = this.createNode(); - var previousAllowYield = this.context.allowYield; - var previousAwait = this.context.await; - this.context.allowYield = false; - this.context.await = true; - var params = this.parseFormalParameters(); - var method = this.parsePropertyMethod(params); - this.context.allowYield = previousAllowYield; - this.context.await = previousAwait; - return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method)); - }; - Parser.prototype.parseObjectPropertyKey = function () { - var node = this.createNode(); - var token = this.nextToken(); - var key; - switch (token.type) { - case 8 /* StringLiteral */: - case 6 /* NumericLiteral */: - if (this.context.strict && token.octal) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral); - } - var raw = this.getTokenRaw(token); - key = this.finalize(node, new Node.Literal(token.value, raw)); - break; - case 3 /* Identifier */: - case 1 /* BooleanLiteral */: - case 5 /* NullLiteral */: - case 4 /* Keyword */: - key = this.finalize(node, new Node.Identifier(token.value)); - break; - case 7 /* Punctuator */: - if (token.value === '[') { - key = this.isolateCoverGrammar(this.parseAssignmentExpression); - this.expect(']'); - } - else { - key = this.throwUnexpectedToken(token); - } - break; - default: - key = this.throwUnexpectedToken(token); - } - return key; - }; - Parser.prototype.isPropertyKey = function (key, value) { - return (key.type === syntax_1.Syntax.Identifier && key.name === value) || - (key.type === syntax_1.Syntax.Literal && key.value === value); - }; - Parser.prototype.parseObjectProperty = function (hasProto) { - var node = this.createNode(); - var token = this.lookahead; - var kind; - var key = null; - var value = null; - var computed = false; - var method = false; - var shorthand = false; - var isAsync = false; - if (token.type === 3 /* Identifier */) { - var id = token.value; - this.nextToken(); - computed = this.match('['); - isAsync = !this.hasLineTerminator && (id === 'async') && - !this.match(':') && !this.match('(') && !this.match('*') && !this.match(','); - key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id)); - } - else if (this.match('*')) { - this.nextToken(); - } - else { - computed = this.match('['); - key = this.parseObjectPropertyKey(); - } - var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); - if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) { - kind = 'get'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - this.context.allowYield = false; - value = this.parseGetterMethod(); - } - else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) { - kind = 'set'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseSetterMethod(); - } - else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { - kind = 'init'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseGeneratorMethod(); - method = true; - } - else { - if (!key) { - this.throwUnexpectedToken(this.lookahead); - } - kind = 'init'; - if (this.match(':') && !isAsync) { - if (!computed && this.isPropertyKey(key, '__proto__')) { - if (hasProto.value) { - this.tolerateError(messages_1.Messages.DuplicateProtoProperty); - } - hasProto.value = true; - } - this.nextToken(); - value = this.inheritCoverGrammar(this.parseAssignmentExpression); - } - else if (this.match('(')) { - value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); - method = true; - } - else if (token.type === 3 /* Identifier */) { - var id = this.finalize(node, new Node.Identifier(token.value)); - if (this.match('=')) { - this.context.firstCoverInitializedNameError = this.lookahead; - this.nextToken(); - shorthand = true; - var init = this.isolateCoverGrammar(this.parseAssignmentExpression); - value = this.finalize(node, new Node.AssignmentPattern(id, init)); - } - else { - shorthand = true; - value = id; - } - } - else { - this.throwUnexpectedToken(this.nextToken()); - } - } - return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand)); - }; - Parser.prototype.parseObjectInitializer = function () { - var node = this.createNode(); - this.expect('{'); - var properties = []; - var hasProto = { value: false }; - while (!this.match('}')) { - properties.push(this.parseObjectProperty(hasProto)); - if (!this.match('}')) { - this.expectCommaSeparator(); - } - } - this.expect('}'); - return this.finalize(node, new Node.ObjectExpression(properties)); - }; - // https://tc39.github.io/ecma262/#sec-template-literals - Parser.prototype.parseTemplateHead = function () { - assert_1.assert(this.lookahead.head, 'Template literal must start with a template head'); - var node = this.createNode(); - var token = this.nextToken(); - var raw = token.value; - var cooked = token.cooked; - return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); - }; - Parser.prototype.parseTemplateElement = function () { - if (this.lookahead.type !== 10 /* Template */) { - this.throwUnexpectedToken(); - } - var node = this.createNode(); - var token = this.nextToken(); - var raw = token.value; - var cooked = token.cooked; - return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); - }; - Parser.prototype.parseTemplateLiteral = function () { - var node = this.createNode(); - var expressions = []; - var quasis = []; - var quasi = this.parseTemplateHead(); - quasis.push(quasi); - while (!quasi.tail) { - expressions.push(this.parseExpression()); - quasi = this.parseTemplateElement(); - quasis.push(quasi); - } - return this.finalize(node, new Node.TemplateLiteral(quasis, expressions)); - }; - // https://tc39.github.io/ecma262/#sec-grouping-operator - Parser.prototype.reinterpretExpressionAsPattern = function (expr) { - switch (expr.type) { - case syntax_1.Syntax.Identifier: - case syntax_1.Syntax.MemberExpression: - case syntax_1.Syntax.RestElement: - case syntax_1.Syntax.AssignmentPattern: - break; - case syntax_1.Syntax.SpreadElement: - expr.type = syntax_1.Syntax.RestElement; - this.reinterpretExpressionAsPattern(expr.argument); - break; - case syntax_1.Syntax.ArrayExpression: - expr.type = syntax_1.Syntax.ArrayPattern; - for (var i = 0; i < expr.elements.length; i++) { - if (expr.elements[i] !== null) { - this.reinterpretExpressionAsPattern(expr.elements[i]); - } - } - break; - case syntax_1.Syntax.ObjectExpression: - expr.type = syntax_1.Syntax.ObjectPattern; - for (var i = 0; i < expr.properties.length; i++) { - this.reinterpretExpressionAsPattern(expr.properties[i].value); - } - break; - case syntax_1.Syntax.AssignmentExpression: - expr.type = syntax_1.Syntax.AssignmentPattern; - delete expr.operator; - this.reinterpretExpressionAsPattern(expr.left); - break; - default: - // Allow other node type for tolerant parsing. - break; - } - }; - Parser.prototype.parseGroupExpression = function () { - var expr; - this.expect('('); - if (this.match(')')) { - this.nextToken(); - if (!this.match('=>')) { - this.expect('=>'); - } - expr = { - type: ArrowParameterPlaceHolder, - params: [], - async: false - }; - } - else { - var startToken = this.lookahead; - var params = []; - if (this.match('...')) { - expr = this.parseRestElement(params); - this.expect(')'); - if (!this.match('=>')) { - this.expect('=>'); - } - expr = { - type: ArrowParameterPlaceHolder, - params: [expr], - async: false - }; - } - else { - var arrow = false; - this.context.isBindingElement = true; - expr = this.inheritCoverGrammar(this.parseAssignmentExpression); - if (this.match(',')) { - var expressions = []; - this.context.isAssignmentTarget = false; - expressions.push(expr); - while (this.lookahead.type !== 2 /* EOF */) { - if (!this.match(',')) { - break; - } - this.nextToken(); - if (this.match(')')) { - this.nextToken(); - for (var i = 0; i < expressions.length; i++) { - this.reinterpretExpressionAsPattern(expressions[i]); - } - arrow = true; - expr = { - type: ArrowParameterPlaceHolder, - params: expressions, - async: false - }; - } - else if (this.match('...')) { - if (!this.context.isBindingElement) { - this.throwUnexpectedToken(this.lookahead); - } - expressions.push(this.parseRestElement(params)); - this.expect(')'); - if (!this.match('=>')) { - this.expect('=>'); - } - this.context.isBindingElement = false; - for (var i = 0; i < expressions.length; i++) { - this.reinterpretExpressionAsPattern(expressions[i]); - } - arrow = true; - expr = { - type: ArrowParameterPlaceHolder, - params: expressions, - async: false - }; - } - else { - expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); - } - if (arrow) { - break; - } - } - if (!arrow) { - expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); - } - } - if (!arrow) { - this.expect(')'); - if (this.match('=>')) { - if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') { - arrow = true; - expr = { - type: ArrowParameterPlaceHolder, - params: [expr], - async: false - }; - } - if (!arrow) { - if (!this.context.isBindingElement) { - this.throwUnexpectedToken(this.lookahead); - } - if (expr.type === syntax_1.Syntax.SequenceExpression) { - for (var i = 0; i < expr.expressions.length; i++) { - this.reinterpretExpressionAsPattern(expr.expressions[i]); - } - } - else { - this.reinterpretExpressionAsPattern(expr); - } - var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]); - expr = { - type: ArrowParameterPlaceHolder, - params: parameters, - async: false - }; - } - } - this.context.isBindingElement = false; - } - } - } - return expr; - }; - // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions - Parser.prototype.parseArguments = function () { - this.expect('('); - var args = []; - if (!this.match(')')) { - while (true) { - var expr = this.match('...') ? this.parseSpreadElement() : - this.isolateCoverGrammar(this.parseAssignmentExpression); - args.push(expr); - if (this.match(')')) { - break; - } - this.expectCommaSeparator(); - if (this.match(')')) { - break; - } - } - } - this.expect(')'); - return args; - }; - Parser.prototype.isIdentifierName = function (token) { - return token.type === 3 /* Identifier */ || - token.type === 4 /* Keyword */ || - token.type === 1 /* BooleanLiteral */ || - token.type === 5 /* NullLiteral */; - }; - Parser.prototype.parseIdentifierName = function () { - var node = this.createNode(); - var token = this.nextToken(); - if (!this.isIdentifierName(token)) { - this.throwUnexpectedToken(token); - } - return this.finalize(node, new Node.Identifier(token.value)); - }; - Parser.prototype.parseNewExpression = function () { - var node = this.createNode(); - var id = this.parseIdentifierName(); - assert_1.assert(id.name === 'new', 'New expression must start with `new`'); - var expr; - if (this.match('.')) { - this.nextToken(); - if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') { - var property = this.parseIdentifierName(); - expr = new Node.MetaProperty(id, property); - } - else { - this.throwUnexpectedToken(this.lookahead); - } - } - else { - var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression); - var args = this.match('(') ? this.parseArguments() : []; - expr = new Node.NewExpression(callee, args); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - return this.finalize(node, expr); - }; - Parser.prototype.parseAsyncArgument = function () { - var arg = this.parseAssignmentExpression(); - this.context.firstCoverInitializedNameError = null; - return arg; - }; - Parser.prototype.parseAsyncArguments = function () { - this.expect('('); - var args = []; - if (!this.match(')')) { - while (true) { - var expr = this.match('...') ? this.parseSpreadElement() : - this.isolateCoverGrammar(this.parseAsyncArgument); - args.push(expr); - if (this.match(')')) { - break; - } - this.expectCommaSeparator(); - if (this.match(')')) { - break; - } - } - } - this.expect(')'); - return args; - }; - Parser.prototype.parseLeftHandSideExpressionAllowCall = function () { - var startToken = this.lookahead; - var maybeAsync = this.matchContextualKeyword('async'); - var previousAllowIn = this.context.allowIn; - this.context.allowIn = true; - var expr; - if (this.matchKeyword('super') && this.context.inFunctionBody) { - expr = this.createNode(); - this.nextToken(); - expr = this.finalize(expr, new Node.Super()); - if (!this.match('(') && !this.match('.') && !this.match('[')) { - this.throwUnexpectedToken(this.lookahead); - } - } - else { - expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); - } - while (true) { - if (this.match('.')) { - this.context.isBindingElement = false; - this.context.isAssignmentTarget = true; - this.expect('.'); - var property = this.parseIdentifierName(); - expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property)); - } - else if (this.match('(')) { - var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber); - this.context.isBindingElement = false; - this.context.isAssignmentTarget = false; - var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments(); - expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args)); - if (asyncArrow && this.match('=>')) { - for (var i = 0; i < args.length; ++i) { - this.reinterpretExpressionAsPattern(args[i]); - } - expr = { - type: ArrowParameterPlaceHolder, - params: args, - async: true - }; - } - } - else if (this.match('[')) { - this.context.isBindingElement = false; - this.context.isAssignmentTarget = true; - this.expect('['); - var property = this.isolateCoverGrammar(this.parseExpression); - this.expect(']'); - expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property)); - } - else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { - var quasi = this.parseTemplateLiteral(); - expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi)); - } - else { - break; - } - } - this.context.allowIn = previousAllowIn; - return expr; - }; - Parser.prototype.parseSuper = function () { - var node = this.createNode(); - this.expectKeyword('super'); - if (!this.match('[') && !this.match('.')) { - this.throwUnexpectedToken(this.lookahead); - } - return this.finalize(node, new Node.Super()); - }; - Parser.prototype.parseLeftHandSideExpression = function () { - assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.'); - var node = this.startNode(this.lookahead); - var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() : - this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); - while (true) { - if (this.match('[')) { - this.context.isBindingElement = false; - this.context.isAssignmentTarget = true; - this.expect('['); - var property = this.isolateCoverGrammar(this.parseExpression); - this.expect(']'); - expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property)); - } - else if (this.match('.')) { - this.context.isBindingElement = false; - this.context.isAssignmentTarget = true; - this.expect('.'); - var property = this.parseIdentifierName(); - expr = this.finalize(node, new Node.StaticMemberExpression(expr, property)); - } - else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { - var quasi = this.parseTemplateLiteral(); - expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi)); - } - else { - break; - } - } - return expr; - }; - // https://tc39.github.io/ecma262/#sec-update-expressions - Parser.prototype.parseUpdateExpression = function () { - var expr; - var startToken = this.lookahead; - if (this.match('++') || this.match('--')) { - var node = this.startNode(startToken); - var token = this.nextToken(); - expr = this.inheritCoverGrammar(this.parseUnaryExpression); - if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { - this.tolerateError(messages_1.Messages.StrictLHSPrefix); - } - if (!this.context.isAssignmentTarget) { - this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); - } - var prefix = true; - expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix)); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - else { - expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall); - if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) { - if (this.match('++') || this.match('--')) { - if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { - this.tolerateError(messages_1.Messages.StrictLHSPostfix); - } - if (!this.context.isAssignmentTarget) { - this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); - } - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var operator = this.nextToken().value; - var prefix = false; - expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix)); - } - } - } - return expr; - }; - // https://tc39.github.io/ecma262/#sec-unary-operators - Parser.prototype.parseAwaitExpression = function () { - var node = this.createNode(); - this.nextToken(); - var argument = this.parseUnaryExpression(); - return this.finalize(node, new Node.AwaitExpression(argument)); - }; - Parser.prototype.parseUnaryExpression = function () { - var expr; - if (this.match('+') || this.match('-') || this.match('~') || this.match('!') || - this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) { - var node = this.startNode(this.lookahead); - var token = this.nextToken(); - expr = this.inheritCoverGrammar(this.parseUnaryExpression); - expr = this.finalize(node, new Node.UnaryExpression(token.value, expr)); - if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) { - this.tolerateError(messages_1.Messages.StrictDelete); - } - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - else if (this.context.await && this.matchContextualKeyword('await')) { - expr = this.parseAwaitExpression(); - } - else { - expr = this.parseUpdateExpression(); - } - return expr; - }; - Parser.prototype.parseExponentiationExpression = function () { - var startToken = this.lookahead; - var expr = this.inheritCoverGrammar(this.parseUnaryExpression); - if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) { - this.nextToken(); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var left = expr; - var right = this.isolateCoverGrammar(this.parseExponentiationExpression); - expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right)); - } - return expr; - }; - // https://tc39.github.io/ecma262/#sec-exp-operator - // https://tc39.github.io/ecma262/#sec-multiplicative-operators - // https://tc39.github.io/ecma262/#sec-additive-operators - // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators - // https://tc39.github.io/ecma262/#sec-relational-operators - // https://tc39.github.io/ecma262/#sec-equality-operators - // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators - // https://tc39.github.io/ecma262/#sec-binary-logical-operators - Parser.prototype.binaryPrecedence = function (token) { - var op = token.value; - var precedence; - if (token.type === 7 /* Punctuator */) { - precedence = this.operatorPrecedence[op] || 0; - } - else if (token.type === 4 /* Keyword */) { - precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0; - } - else { - precedence = 0; - } - return precedence; - }; - Parser.prototype.parseBinaryExpression = function () { - var startToken = this.lookahead; - var expr = this.inheritCoverGrammar(this.parseExponentiationExpression); - var token = this.lookahead; - var prec = this.binaryPrecedence(token); - if (prec > 0) { - this.nextToken(); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var markers = [startToken, this.lookahead]; - var left = expr; - var right = this.isolateCoverGrammar(this.parseExponentiationExpression); - var stack = [left, token.value, right]; - var precedences = [prec]; - while (true) { - prec = this.binaryPrecedence(this.lookahead); - if (prec <= 0) { - break; - } - // Reduce: make a binary expression from the three topmost entries. - while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) { - right = stack.pop(); - var operator = stack.pop(); - precedences.pop(); - left = stack.pop(); - markers.pop(); - var node = this.startNode(markers[markers.length - 1]); - stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right))); - } - // Shift. - stack.push(this.nextToken().value); - precedences.push(prec); - markers.push(this.lookahead); - stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression)); - } - // Final reduce to clean-up the stack. - var i = stack.length - 1; - expr = stack[i]; - var lastMarker = markers.pop(); - while (i > 1) { - var marker = markers.pop(); - var lastLineStart = lastMarker && lastMarker.lineStart; - var node = this.startNode(marker, lastLineStart); - var operator = stack[i - 1]; - expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr)); - i -= 2; - lastMarker = marker; - } - } - return expr; - }; - // https://tc39.github.io/ecma262/#sec-conditional-operator - Parser.prototype.parseConditionalExpression = function () { - var startToken = this.lookahead; - var expr = this.inheritCoverGrammar(this.parseBinaryExpression); - if (this.match('?')) { - this.nextToken(); - var previousAllowIn = this.context.allowIn; - this.context.allowIn = true; - var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression); - this.context.allowIn = previousAllowIn; - this.expect(':'); - var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression); - expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate)); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - return expr; - }; - // https://tc39.github.io/ecma262/#sec-assignment-operators - Parser.prototype.checkPatternParam = function (options, param) { - switch (param.type) { - case syntax_1.Syntax.Identifier: - this.validateParam(options, param, param.name); - break; - case syntax_1.Syntax.RestElement: - this.checkPatternParam(options, param.argument); - break; - case syntax_1.Syntax.AssignmentPattern: - this.checkPatternParam(options, param.left); - break; - case syntax_1.Syntax.ArrayPattern: - for (var i = 0; i < param.elements.length; i++) { - if (param.elements[i] !== null) { - this.checkPatternParam(options, param.elements[i]); - } - } - break; - case syntax_1.Syntax.ObjectPattern: - for (var i = 0; i < param.properties.length; i++) { - this.checkPatternParam(options, param.properties[i].value); - } - break; - default: - break; - } - options.simple = options.simple && (param instanceof Node.Identifier); - }; - Parser.prototype.reinterpretAsCoverFormalsList = function (expr) { - var params = [expr]; - var options; - var asyncArrow = false; - switch (expr.type) { - case syntax_1.Syntax.Identifier: - break; - case ArrowParameterPlaceHolder: - params = expr.params; - asyncArrow = expr.async; - break; - default: - return null; - } - options = { - simple: true, - paramSet: {} - }; - for (var i = 0; i < params.length; ++i) { - var param = params[i]; - if (param.type === syntax_1.Syntax.AssignmentPattern) { - if (param.right.type === syntax_1.Syntax.YieldExpression) { - if (param.right.argument) { - this.throwUnexpectedToken(this.lookahead); - } - param.right.type = syntax_1.Syntax.Identifier; - param.right.name = 'yield'; - delete param.right.argument; - delete param.right.delegate; - } - } - else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') { - this.throwUnexpectedToken(this.lookahead); - } - this.checkPatternParam(options, param); - params[i] = param; - } - if (this.context.strict || !this.context.allowYield) { - for (var i = 0; i < params.length; ++i) { - var param = params[i]; - if (param.type === syntax_1.Syntax.YieldExpression) { - this.throwUnexpectedToken(this.lookahead); - } - } - } - if (options.message === messages_1.Messages.StrictParamDupe) { - var token = this.context.strict ? options.stricted : options.firstRestricted; - this.throwUnexpectedToken(token, options.message); - } - return { - simple: options.simple, - params: params, - stricted: options.stricted, - firstRestricted: options.firstRestricted, - message: options.message - }; - }; - Parser.prototype.parseAssignmentExpression = function () { - var expr; - if (!this.context.allowYield && this.matchKeyword('yield')) { - expr = this.parseYieldExpression(); - } - else { - var startToken = this.lookahead; - var token = startToken; - expr = this.parseConditionalExpression(); - if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') { - if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) { - var arg = this.parsePrimaryExpression(); - this.reinterpretExpressionAsPattern(arg); - expr = { - type: ArrowParameterPlaceHolder, - params: [arg], - async: true - }; - } - } - if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) { - // https://tc39.github.io/ecma262/#sec-arrow-function-definitions - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var isAsync = expr.async; - var list = this.reinterpretAsCoverFormalsList(expr); - if (list) { - if (this.hasLineTerminator) { - this.tolerateUnexpectedToken(this.lookahead); - } - this.context.firstCoverInitializedNameError = null; - var previousStrict = this.context.strict; - var previousAllowStrictDirective = this.context.allowStrictDirective; - this.context.allowStrictDirective = list.simple; - var previousAllowYield = this.context.allowYield; - var previousAwait = this.context.await; - this.context.allowYield = true; - this.context.await = isAsync; - var node = this.startNode(startToken); - this.expect('=>'); - var body = void 0; - if (this.match('{')) { - var previousAllowIn = this.context.allowIn; - this.context.allowIn = true; - body = this.parseFunctionSourceElements(); - this.context.allowIn = previousAllowIn; - } - else { - body = this.isolateCoverGrammar(this.parseAssignmentExpression); - } - var expression = body.type !== syntax_1.Syntax.BlockStatement; - if (this.context.strict && list.firstRestricted) { - this.throwUnexpectedToken(list.firstRestricted, list.message); - } - if (this.context.strict && list.stricted) { - this.tolerateUnexpectedToken(list.stricted, list.message); - } - expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) : - this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression)); - this.context.strict = previousStrict; - this.context.allowStrictDirective = previousAllowStrictDirective; - this.context.allowYield = previousAllowYield; - this.context.await = previousAwait; - } - } - else { - if (this.matchAssign()) { - if (!this.context.isAssignmentTarget) { - this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); - } - if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) { - var id = expr; - if (this.scanner.isRestrictedWord(id.name)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment); - } - if (this.scanner.isStrictModeReservedWord(id.name)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); - } - } - if (!this.match('=')) { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - else { - this.reinterpretExpressionAsPattern(expr); - } - token = this.nextToken(); - var operator = token.value; - var right = this.isolateCoverGrammar(this.parseAssignmentExpression); - expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right)); - this.context.firstCoverInitializedNameError = null; - } - } - } - return expr; - }; - // https://tc39.github.io/ecma262/#sec-comma-operator - Parser.prototype.parseExpression = function () { - var startToken = this.lookahead; - var expr = this.isolateCoverGrammar(this.parseAssignmentExpression); - if (this.match(',')) { - var expressions = []; - expressions.push(expr); - while (this.lookahead.type !== 2 /* EOF */) { - if (!this.match(',')) { - break; - } - this.nextToken(); - expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); - } - expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); - } - return expr; - }; - // https://tc39.github.io/ecma262/#sec-block - Parser.prototype.parseStatementListItem = function () { - var statement; - this.context.isAssignmentTarget = true; - this.context.isBindingElement = true; - if (this.lookahead.type === 4 /* Keyword */) { - switch (this.lookahead.value) { - case 'export': - if (!this.context.isModule) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration); - } - statement = this.parseExportDeclaration(); - break; - case 'import': - if (!this.context.isModule) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration); - } - statement = this.parseImportDeclaration(); - break; - case 'const': - statement = this.parseLexicalDeclaration({ inFor: false }); - break; - case 'function': - statement = this.parseFunctionDeclaration(); - break; - case 'class': - statement = this.parseClassDeclaration(); - break; - case 'let': - statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement(); - break; - default: - statement = this.parseStatement(); - break; - } - } - else { - statement = this.parseStatement(); - } - return statement; - }; - Parser.prototype.parseBlock = function () { - var node = this.createNode(); - this.expect('{'); - var block = []; - while (true) { - if (this.match('}')) { - break; - } - block.push(this.parseStatementListItem()); - } - this.expect('}'); - return this.finalize(node, new Node.BlockStatement(block)); - }; - // https://tc39.github.io/ecma262/#sec-let-and-const-declarations - Parser.prototype.parseLexicalBinding = function (kind, options) { - var node = this.createNode(); - var params = []; - var id = this.parsePattern(params, kind); - if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { - if (this.scanner.isRestrictedWord(id.name)) { - this.tolerateError(messages_1.Messages.StrictVarName); - } - } - var init = null; - if (kind === 'const') { - if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) { - if (this.match('=')) { - this.nextToken(); - init = this.isolateCoverGrammar(this.parseAssignmentExpression); - } - else { - this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const'); - } - } - } - else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) { - this.expect('='); - init = this.isolateCoverGrammar(this.parseAssignmentExpression); - } - return this.finalize(node, new Node.VariableDeclarator(id, init)); - }; - Parser.prototype.parseBindingList = function (kind, options) { - var list = [this.parseLexicalBinding(kind, options)]; - while (this.match(',')) { - this.nextToken(); - list.push(this.parseLexicalBinding(kind, options)); - } - return list; - }; - Parser.prototype.isLexicalDeclaration = function () { - var state = this.scanner.saveState(); - this.scanner.scanComments(); - var next = this.scanner.lex(); - this.scanner.restoreState(state); - return (next.type === 3 /* Identifier */) || - (next.type === 7 /* Punctuator */ && next.value === '[') || - (next.type === 7 /* Punctuator */ && next.value === '{') || - (next.type === 4 /* Keyword */ && next.value === 'let') || - (next.type === 4 /* Keyword */ && next.value === 'yield'); - }; - Parser.prototype.parseLexicalDeclaration = function (options) { - var node = this.createNode(); - var kind = this.nextToken().value; - assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); - var declarations = this.parseBindingList(kind, options); - this.consumeSemicolon(); - return this.finalize(node, new Node.VariableDeclaration(declarations, kind)); - }; - // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns - Parser.prototype.parseBindingRestElement = function (params, kind) { - var node = this.createNode(); - this.expect('...'); - var arg = this.parsePattern(params, kind); - return this.finalize(node, new Node.RestElement(arg)); - }; - Parser.prototype.parseArrayPattern = function (params, kind) { - var node = this.createNode(); - this.expect('['); - var elements = []; - while (!this.match(']')) { - if (this.match(',')) { - this.nextToken(); - elements.push(null); - } - else { - if (this.match('...')) { - elements.push(this.parseBindingRestElement(params, kind)); - break; - } - else { - elements.push(this.parsePatternWithDefault(params, kind)); - } - if (!this.match(']')) { - this.expect(','); - } - } - } - this.expect(']'); - return this.finalize(node, new Node.ArrayPattern(elements)); - }; - Parser.prototype.parsePropertyPattern = function (params, kind) { - var node = this.createNode(); - var computed = false; - var shorthand = false; - var method = false; - var key; - var value; - if (this.lookahead.type === 3 /* Identifier */) { - var keyToken = this.lookahead; - key = this.parseVariableIdentifier(); - var init = this.finalize(node, new Node.Identifier(keyToken.value)); - if (this.match('=')) { - params.push(keyToken); - shorthand = true; - this.nextToken(); - var expr = this.parseAssignmentExpression(); - value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr)); - } - else if (!this.match(':')) { - params.push(keyToken); - shorthand = true; - value = init; - } - else { - this.expect(':'); - value = this.parsePatternWithDefault(params, kind); - } - } - else { - computed = this.match('['); - key = this.parseObjectPropertyKey(); - this.expect(':'); - value = this.parsePatternWithDefault(params, kind); - } - return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand)); - }; - Parser.prototype.parseObjectPattern = function (params, kind) { - var node = this.createNode(); - var properties = []; - this.expect('{'); - while (!this.match('}')) { - properties.push(this.parsePropertyPattern(params, kind)); - if (!this.match('}')) { - this.expect(','); - } - } - this.expect('}'); - return this.finalize(node, new Node.ObjectPattern(properties)); - }; - Parser.prototype.parsePattern = function (params, kind) { - var pattern; - if (this.match('[')) { - pattern = this.parseArrayPattern(params, kind); - } - else if (this.match('{')) { - pattern = this.parseObjectPattern(params, kind); - } - else { - if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding); - } - params.push(this.lookahead); - pattern = this.parseVariableIdentifier(kind); - } - return pattern; - }; - Parser.prototype.parsePatternWithDefault = function (params, kind) { - var startToken = this.lookahead; - var pattern = this.parsePattern(params, kind); - if (this.match('=')) { - this.nextToken(); - var previousAllowYield = this.context.allowYield; - this.context.allowYield = true; - var right = this.isolateCoverGrammar(this.parseAssignmentExpression); - this.context.allowYield = previousAllowYield; - pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right)); - } - return pattern; - }; - // https://tc39.github.io/ecma262/#sec-variable-statement - Parser.prototype.parseVariableIdentifier = function (kind) { - var node = this.createNode(); - var token = this.nextToken(); - if (token.type === 4 /* Keyword */ && token.value === 'yield') { - if (this.context.strict) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); - } - else if (!this.context.allowYield) { - this.throwUnexpectedToken(token); - } - } - else if (token.type !== 3 /* Identifier */) { - if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); - } - else { - if (this.context.strict || token.value !== 'let' || kind !== 'var') { - this.throwUnexpectedToken(token); - } - } - } - else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') { - this.tolerateUnexpectedToken(token); - } - return this.finalize(node, new Node.Identifier(token.value)); - }; - Parser.prototype.parseVariableDeclaration = function (options) { - var node = this.createNode(); - var params = []; - var id = this.parsePattern(params, 'var'); - if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { - if (this.scanner.isRestrictedWord(id.name)) { - this.tolerateError(messages_1.Messages.StrictVarName); - } - } - var init = null; - if (this.match('=')) { - this.nextToken(); - init = this.isolateCoverGrammar(this.parseAssignmentExpression); - } - else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) { - this.expect('='); - } - return this.finalize(node, new Node.VariableDeclarator(id, init)); - }; - Parser.prototype.parseVariableDeclarationList = function (options) { - var opt = { inFor: options.inFor }; - var list = []; - list.push(this.parseVariableDeclaration(opt)); - while (this.match(',')) { - this.nextToken(); - list.push(this.parseVariableDeclaration(opt)); - } - return list; - }; - Parser.prototype.parseVariableStatement = function () { - var node = this.createNode(); - this.expectKeyword('var'); - var declarations = this.parseVariableDeclarationList({ inFor: false }); - this.consumeSemicolon(); - return this.finalize(node, new Node.VariableDeclaration(declarations, 'var')); - }; - // https://tc39.github.io/ecma262/#sec-empty-statement - Parser.prototype.parseEmptyStatement = function () { - var node = this.createNode(); - this.expect(';'); - return this.finalize(node, new Node.EmptyStatement()); - }; - // https://tc39.github.io/ecma262/#sec-expression-statement - Parser.prototype.parseExpressionStatement = function () { - var node = this.createNode(); - var expr = this.parseExpression(); - this.consumeSemicolon(); - return this.finalize(node, new Node.ExpressionStatement(expr)); - }; - // https://tc39.github.io/ecma262/#sec-if-statement - Parser.prototype.parseIfClause = function () { - if (this.context.strict && this.matchKeyword('function')) { - this.tolerateError(messages_1.Messages.StrictFunction); - } - return this.parseStatement(); - }; - Parser.prototype.parseIfStatement = function () { - var node = this.createNode(); - var consequent; - var alternate = null; - this.expectKeyword('if'); - this.expect('('); - var test = this.parseExpression(); - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - consequent = this.finalize(this.createNode(), new Node.EmptyStatement()); - } - else { - this.expect(')'); - consequent = this.parseIfClause(); - if (this.matchKeyword('else')) { - this.nextToken(); - alternate = this.parseIfClause(); - } - } - return this.finalize(node, new Node.IfStatement(test, consequent, alternate)); - }; - // https://tc39.github.io/ecma262/#sec-do-while-statement - Parser.prototype.parseDoWhileStatement = function () { - var node = this.createNode(); - this.expectKeyword('do'); - var previousInIteration = this.context.inIteration; - this.context.inIteration = true; - var body = this.parseStatement(); - this.context.inIteration = previousInIteration; - this.expectKeyword('while'); - this.expect('('); - var test = this.parseExpression(); - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - } - else { - this.expect(')'); - if (this.match(';')) { - this.nextToken(); - } - } - return this.finalize(node, new Node.DoWhileStatement(body, test)); - }; - // https://tc39.github.io/ecma262/#sec-while-statement - Parser.prototype.parseWhileStatement = function () { - var node = this.createNode(); - var body; - this.expectKeyword('while'); - this.expect('('); - var test = this.parseExpression(); - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - body = this.finalize(this.createNode(), new Node.EmptyStatement()); - } - else { - this.expect(')'); - var previousInIteration = this.context.inIteration; - this.context.inIteration = true; - body = this.parseStatement(); - this.context.inIteration = previousInIteration; - } - return this.finalize(node, new Node.WhileStatement(test, body)); - }; - // https://tc39.github.io/ecma262/#sec-for-statement - // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements - Parser.prototype.parseForStatement = function () { - var init = null; - var test = null; - var update = null; - var forIn = true; - var left, right; - var node = this.createNode(); - this.expectKeyword('for'); - this.expect('('); - if (this.match(';')) { - this.nextToken(); - } - else { - if (this.matchKeyword('var')) { - init = this.createNode(); - this.nextToken(); - var previousAllowIn = this.context.allowIn; - this.context.allowIn = false; - var declarations = this.parseVariableDeclarationList({ inFor: true }); - this.context.allowIn = previousAllowIn; - if (declarations.length === 1 && this.matchKeyword('in')) { - var decl = declarations[0]; - if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) { - this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in'); - } - init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); - this.nextToken(); - left = init; - right = this.parseExpression(); - init = null; - } - else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { - init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); - this.nextToken(); - left = init; - right = this.parseAssignmentExpression(); - init = null; - forIn = false; - } - else { - init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); - this.expect(';'); - } - } - else if (this.matchKeyword('const') || this.matchKeyword('let')) { - init = this.createNode(); - var kind = this.nextToken().value; - if (!this.context.strict && this.lookahead.value === 'in') { - init = this.finalize(init, new Node.Identifier(kind)); - this.nextToken(); - left = init; - right = this.parseExpression(); - init = null; - } - else { - var previousAllowIn = this.context.allowIn; - this.context.allowIn = false; - var declarations = this.parseBindingList(kind, { inFor: true }); - this.context.allowIn = previousAllowIn; - if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) { - init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); - this.nextToken(); - left = init; - right = this.parseExpression(); - init = null; - } - else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { - init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); - this.nextToken(); - left = init; - right = this.parseAssignmentExpression(); - init = null; - forIn = false; - } - else { - this.consumeSemicolon(); - init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); - } - } - } - else { - var initStartToken = this.lookahead; - var previousAllowIn = this.context.allowIn; - this.context.allowIn = false; - init = this.inheritCoverGrammar(this.parseAssignmentExpression); - this.context.allowIn = previousAllowIn; - if (this.matchKeyword('in')) { - if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { - this.tolerateError(messages_1.Messages.InvalidLHSInForIn); - } - this.nextToken(); - this.reinterpretExpressionAsPattern(init); - left = init; - right = this.parseExpression(); - init = null; - } - else if (this.matchContextualKeyword('of')) { - if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { - this.tolerateError(messages_1.Messages.InvalidLHSInForLoop); - } - this.nextToken(); - this.reinterpretExpressionAsPattern(init); - left = init; - right = this.parseAssignmentExpression(); - init = null; - forIn = false; - } - else { - if (this.match(',')) { - var initSeq = [init]; - while (this.match(',')) { - this.nextToken(); - initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); - } - init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq)); - } - this.expect(';'); - } - } - } - if (typeof left === 'undefined') { - if (!this.match(';')) { - test = this.parseExpression(); - } - this.expect(';'); - if (!this.match(')')) { - update = this.parseExpression(); - } - } - var body; - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - body = this.finalize(this.createNode(), new Node.EmptyStatement()); - } - else { - this.expect(')'); - var previousInIteration = this.context.inIteration; - this.context.inIteration = true; - body = this.isolateCoverGrammar(this.parseStatement); - this.context.inIteration = previousInIteration; - } - return (typeof left === 'undefined') ? - this.finalize(node, new Node.ForStatement(init, test, update, body)) : - forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) : - this.finalize(node, new Node.ForOfStatement(left, right, body)); - }; - // https://tc39.github.io/ecma262/#sec-continue-statement - Parser.prototype.parseContinueStatement = function () { - var node = this.createNode(); - this.expectKeyword('continue'); - var label = null; - if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { - var id = this.parseVariableIdentifier(); - label = id; - var key = '$' + id.name; - if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { - this.throwError(messages_1.Messages.UnknownLabel, id.name); - } - } - this.consumeSemicolon(); - if (label === null && !this.context.inIteration) { - this.throwError(messages_1.Messages.IllegalContinue); - } - return this.finalize(node, new Node.ContinueStatement(label)); - }; - // https://tc39.github.io/ecma262/#sec-break-statement - Parser.prototype.parseBreakStatement = function () { - var node = this.createNode(); - this.expectKeyword('break'); - var label = null; - if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { - var id = this.parseVariableIdentifier(); - var key = '$' + id.name; - if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { - this.throwError(messages_1.Messages.UnknownLabel, id.name); - } - label = id; - } - this.consumeSemicolon(); - if (label === null && !this.context.inIteration && !this.context.inSwitch) { - this.throwError(messages_1.Messages.IllegalBreak); - } - return this.finalize(node, new Node.BreakStatement(label)); - }; - // https://tc39.github.io/ecma262/#sec-return-statement - Parser.prototype.parseReturnStatement = function () { - if (!this.context.inFunctionBody) { - this.tolerateError(messages_1.Messages.IllegalReturn); - } - var node = this.createNode(); - this.expectKeyword('return'); - var hasArgument = (!this.match(';') && !this.match('}') && - !this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */) || - this.lookahead.type === 8 /* StringLiteral */ || - this.lookahead.type === 10 /* Template */; - var argument = hasArgument ? this.parseExpression() : null; - this.consumeSemicolon(); - return this.finalize(node, new Node.ReturnStatement(argument)); - }; - // https://tc39.github.io/ecma262/#sec-with-statement - Parser.prototype.parseWithStatement = function () { - if (this.context.strict) { - this.tolerateError(messages_1.Messages.StrictModeWith); - } - var node = this.createNode(); - var body; - this.expectKeyword('with'); - this.expect('('); - var object = this.parseExpression(); - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - body = this.finalize(this.createNode(), new Node.EmptyStatement()); - } - else { - this.expect(')'); - body = this.parseStatement(); - } - return this.finalize(node, new Node.WithStatement(object, body)); - }; - // https://tc39.github.io/ecma262/#sec-switch-statement - Parser.prototype.parseSwitchCase = function () { - var node = this.createNode(); - var test; - if (this.matchKeyword('default')) { - this.nextToken(); - test = null; - } - else { - this.expectKeyword('case'); - test = this.parseExpression(); - } - this.expect(':'); - var consequent = []; - while (true) { - if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) { - break; - } - consequent.push(this.parseStatementListItem()); - } - return this.finalize(node, new Node.SwitchCase(test, consequent)); - }; - Parser.prototype.parseSwitchStatement = function () { - var node = this.createNode(); - this.expectKeyword('switch'); - this.expect('('); - var discriminant = this.parseExpression(); - this.expect(')'); - var previousInSwitch = this.context.inSwitch; - this.context.inSwitch = true; - var cases = []; - var defaultFound = false; - this.expect('{'); - while (true) { - if (this.match('}')) { - break; - } - var clause = this.parseSwitchCase(); - if (clause.test === null) { - if (defaultFound) { - this.throwError(messages_1.Messages.MultipleDefaultsInSwitch); - } - defaultFound = true; - } - cases.push(clause); - } - this.expect('}'); - this.context.inSwitch = previousInSwitch; - return this.finalize(node, new Node.SwitchStatement(discriminant, cases)); - }; - // https://tc39.github.io/ecma262/#sec-labelled-statements - Parser.prototype.parseLabelledStatement = function () { - var node = this.createNode(); - var expr = this.parseExpression(); - var statement; - if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) { - this.nextToken(); - var id = expr; - var key = '$' + id.name; - if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { - this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name); - } - this.context.labelSet[key] = true; - var body = void 0; - if (this.matchKeyword('class')) { - this.tolerateUnexpectedToken(this.lookahead); - body = this.parseClassDeclaration(); - } - else if (this.matchKeyword('function')) { - var token = this.lookahead; - var declaration = this.parseFunctionDeclaration(); - if (this.context.strict) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction); - } - else if (declaration.generator) { - this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext); - } - body = declaration; - } - else { - body = this.parseStatement(); - } - delete this.context.labelSet[key]; - statement = new Node.LabeledStatement(id, body); - } - else { - this.consumeSemicolon(); - statement = new Node.ExpressionStatement(expr); - } - return this.finalize(node, statement); - }; - // https://tc39.github.io/ecma262/#sec-throw-statement - Parser.prototype.parseThrowStatement = function () { - var node = this.createNode(); - this.expectKeyword('throw'); - if (this.hasLineTerminator) { - this.throwError(messages_1.Messages.NewlineAfterThrow); - } - var argument = this.parseExpression(); - this.consumeSemicolon(); - return this.finalize(node, new Node.ThrowStatement(argument)); - }; - // https://tc39.github.io/ecma262/#sec-try-statement - Parser.prototype.parseCatchClause = function () { - var node = this.createNode(); - this.expectKeyword('catch'); - this.expect('('); - if (this.match(')')) { - this.throwUnexpectedToken(this.lookahead); - } - var params = []; - var param = this.parsePattern(params); - var paramMap = {}; - for (var i = 0; i < params.length; i++) { - var key = '$' + params[i].value; - if (Object.prototype.hasOwnProperty.call(paramMap, key)) { - this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value); - } - paramMap[key] = true; - } - if (this.context.strict && param.type === syntax_1.Syntax.Identifier) { - if (this.scanner.isRestrictedWord(param.name)) { - this.tolerateError(messages_1.Messages.StrictCatchVariable); - } - } - this.expect(')'); - var body = this.parseBlock(); - return this.finalize(node, new Node.CatchClause(param, body)); - }; - Parser.prototype.parseFinallyClause = function () { - this.expectKeyword('finally'); - return this.parseBlock(); - }; - Parser.prototype.parseTryStatement = function () { - var node = this.createNode(); - this.expectKeyword('try'); - var block = this.parseBlock(); - var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null; - var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null; - if (!handler && !finalizer) { - this.throwError(messages_1.Messages.NoCatchOrFinally); - } - return this.finalize(node, new Node.TryStatement(block, handler, finalizer)); - }; - // https://tc39.github.io/ecma262/#sec-debugger-statement - Parser.prototype.parseDebuggerStatement = function () { - var node = this.createNode(); - this.expectKeyword('debugger'); - this.consumeSemicolon(); - return this.finalize(node, new Node.DebuggerStatement()); - }; - // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations - Parser.prototype.parseStatement = function () { - var statement; - switch (this.lookahead.type) { - case 1 /* BooleanLiteral */: - case 5 /* NullLiteral */: - case 6 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 10 /* Template */: - case 9 /* RegularExpression */: - statement = this.parseExpressionStatement(); - break; - case 7 /* Punctuator */: - var value = this.lookahead.value; - if (value === '{') { - statement = this.parseBlock(); - } - else if (value === '(') { - statement = this.parseExpressionStatement(); - } - else if (value === ';') { - statement = this.parseEmptyStatement(); - } - else { - statement = this.parseExpressionStatement(); - } - break; - case 3 /* Identifier */: - statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement(); - break; - case 4 /* Keyword */: - switch (this.lookahead.value) { - case 'break': - statement = this.parseBreakStatement(); - break; - case 'continue': - statement = this.parseContinueStatement(); - break; - case 'debugger': - statement = this.parseDebuggerStatement(); - break; - case 'do': - statement = this.parseDoWhileStatement(); - break; - case 'for': - statement = this.parseForStatement(); - break; - case 'function': - statement = this.parseFunctionDeclaration(); - break; - case 'if': - statement = this.parseIfStatement(); - break; - case 'return': - statement = this.parseReturnStatement(); - break; - case 'switch': - statement = this.parseSwitchStatement(); - break; - case 'throw': - statement = this.parseThrowStatement(); - break; - case 'try': - statement = this.parseTryStatement(); - break; - case 'var': - statement = this.parseVariableStatement(); - break; - case 'while': - statement = this.parseWhileStatement(); - break; - case 'with': - statement = this.parseWithStatement(); - break; - default: - statement = this.parseExpressionStatement(); - break; - } - break; - default: - statement = this.throwUnexpectedToken(this.lookahead); - } - return statement; - }; - // https://tc39.github.io/ecma262/#sec-function-definitions - Parser.prototype.parseFunctionSourceElements = function () { - var node = this.createNode(); - this.expect('{'); - var body = this.parseDirectivePrologues(); - var previousLabelSet = this.context.labelSet; - var previousInIteration = this.context.inIteration; - var previousInSwitch = this.context.inSwitch; - var previousInFunctionBody = this.context.inFunctionBody; - this.context.labelSet = {}; - this.context.inIteration = false; - this.context.inSwitch = false; - this.context.inFunctionBody = true; - while (this.lookahead.type !== 2 /* EOF */) { - if (this.match('}')) { - break; - } - body.push(this.parseStatementListItem()); - } - this.expect('}'); - this.context.labelSet = previousLabelSet; - this.context.inIteration = previousInIteration; - this.context.inSwitch = previousInSwitch; - this.context.inFunctionBody = previousInFunctionBody; - return this.finalize(node, new Node.BlockStatement(body)); - }; - Parser.prototype.validateParam = function (options, param, name) { - var key = '$' + name; - if (this.context.strict) { - if (this.scanner.isRestrictedWord(name)) { - options.stricted = param; - options.message = messages_1.Messages.StrictParamName; - } - if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { - options.stricted = param; - options.message = messages_1.Messages.StrictParamDupe; - } - } - else if (!options.firstRestricted) { - if (this.scanner.isRestrictedWord(name)) { - options.firstRestricted = param; - options.message = messages_1.Messages.StrictParamName; - } - else if (this.scanner.isStrictModeReservedWord(name)) { - options.firstRestricted = param; - options.message = messages_1.Messages.StrictReservedWord; - } - else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { - options.stricted = param; - options.message = messages_1.Messages.StrictParamDupe; - } - } - /* istanbul ignore next */ - if (typeof Object.defineProperty === 'function') { - Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true }); - } - else { - options.paramSet[key] = true; - } - }; - Parser.prototype.parseRestElement = function (params) { - var node = this.createNode(); - this.expect('...'); - var arg = this.parsePattern(params); - if (this.match('=')) { - this.throwError(messages_1.Messages.DefaultRestParameter); - } - if (!this.match(')')) { - this.throwError(messages_1.Messages.ParameterAfterRestParameter); - } - return this.finalize(node, new Node.RestElement(arg)); - }; - Parser.prototype.parseFormalParameter = function (options) { - var params = []; - var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params); - for (var i = 0; i < params.length; i++) { - this.validateParam(options, params[i], params[i].value); - } - options.simple = options.simple && (param instanceof Node.Identifier); - options.params.push(param); - }; - Parser.prototype.parseFormalParameters = function (firstRestricted) { - var options; - options = { - simple: true, - params: [], - firstRestricted: firstRestricted - }; - this.expect('('); - if (!this.match(')')) { - options.paramSet = {}; - while (this.lookahead.type !== 2 /* EOF */) { - this.parseFormalParameter(options); - if (this.match(')')) { - break; - } - this.expect(','); - if (this.match(')')) { - break; - } - } - } - this.expect(')'); - return { - simple: options.simple, - params: options.params, - stricted: options.stricted, - firstRestricted: options.firstRestricted, - message: options.message - }; - }; - Parser.prototype.matchAsyncFunction = function () { - var match = this.matchContextualKeyword('async'); - if (match) { - var state = this.scanner.saveState(); - this.scanner.scanComments(); - var next = this.scanner.lex(); - this.scanner.restoreState(state); - match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function'); - } - return match; - }; - Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) { - var node = this.createNode(); - var isAsync = this.matchContextualKeyword('async'); - if (isAsync) { - this.nextToken(); - } - this.expectKeyword('function'); - var isGenerator = isAsync ? false : this.match('*'); - if (isGenerator) { - this.nextToken(); - } - var message; - var id = null; - var firstRestricted = null; - if (!identifierIsOptional || !this.match('(')) { - var token = this.lookahead; - id = this.parseVariableIdentifier(); - if (this.context.strict) { - if (this.scanner.isRestrictedWord(token.value)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); - } - } - else { - if (this.scanner.isRestrictedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictFunctionName; - } - else if (this.scanner.isStrictModeReservedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictReservedWord; - } - } - } - var previousAllowAwait = this.context.await; - var previousAllowYield = this.context.allowYield; - this.context.await = isAsync; - this.context.allowYield = !isGenerator; - var formalParameters = this.parseFormalParameters(firstRestricted); - var params = formalParameters.params; - var stricted = formalParameters.stricted; - firstRestricted = formalParameters.firstRestricted; - if (formalParameters.message) { - message = formalParameters.message; - } - var previousStrict = this.context.strict; - var previousAllowStrictDirective = this.context.allowStrictDirective; - this.context.allowStrictDirective = formalParameters.simple; - var body = this.parseFunctionSourceElements(); - if (this.context.strict && firstRestricted) { - this.throwUnexpectedToken(firstRestricted, message); - } - if (this.context.strict && stricted) { - this.tolerateUnexpectedToken(stricted, message); - } - this.context.strict = previousStrict; - this.context.allowStrictDirective = previousAllowStrictDirective; - this.context.await = previousAllowAwait; - this.context.allowYield = previousAllowYield; - return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) : - this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator)); - }; - Parser.prototype.parseFunctionExpression = function () { - var node = this.createNode(); - var isAsync = this.matchContextualKeyword('async'); - if (isAsync) { - this.nextToken(); - } - this.expectKeyword('function'); - var isGenerator = isAsync ? false : this.match('*'); - if (isGenerator) { - this.nextToken(); - } - var message; - var id = null; - var firstRestricted; - var previousAllowAwait = this.context.await; - var previousAllowYield = this.context.allowYield; - this.context.await = isAsync; - this.context.allowYield = !isGenerator; - if (!this.match('(')) { - var token = this.lookahead; - id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier(); - if (this.context.strict) { - if (this.scanner.isRestrictedWord(token.value)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); - } - } - else { - if (this.scanner.isRestrictedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictFunctionName; - } - else if (this.scanner.isStrictModeReservedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictReservedWord; - } - } - } - var formalParameters = this.parseFormalParameters(firstRestricted); - var params = formalParameters.params; - var stricted = formalParameters.stricted; - firstRestricted = formalParameters.firstRestricted; - if (formalParameters.message) { - message = formalParameters.message; - } - var previousStrict = this.context.strict; - var previousAllowStrictDirective = this.context.allowStrictDirective; - this.context.allowStrictDirective = formalParameters.simple; - var body = this.parseFunctionSourceElements(); - if (this.context.strict && firstRestricted) { - this.throwUnexpectedToken(firstRestricted, message); - } - if (this.context.strict && stricted) { - this.tolerateUnexpectedToken(stricted, message); - } - this.context.strict = previousStrict; - this.context.allowStrictDirective = previousAllowStrictDirective; - this.context.await = previousAllowAwait; - this.context.allowYield = previousAllowYield; - return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) : - this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator)); - }; - // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive - Parser.prototype.parseDirective = function () { - var token = this.lookahead; - var node = this.createNode(); - var expr = this.parseExpression(); - var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null; - this.consumeSemicolon(); - return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr)); - }; - Parser.prototype.parseDirectivePrologues = function () { - var firstRestricted = null; - var body = []; - while (true) { - var token = this.lookahead; - if (token.type !== 8 /* StringLiteral */) { - break; - } - var statement = this.parseDirective(); - body.push(statement); - var directive = statement.directive; - if (typeof directive !== 'string') { - break; - } - if (directive === 'use strict') { - this.context.strict = true; - if (firstRestricted) { - this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral); - } - if (!this.context.allowStrictDirective) { - this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective); - } - } - else { - if (!firstRestricted && token.octal) { - firstRestricted = token; - } - } - } - return body; - }; - // https://tc39.github.io/ecma262/#sec-method-definitions - Parser.prototype.qualifiedPropertyName = function (token) { - switch (token.type) { - case 3 /* Identifier */: - case 8 /* StringLiteral */: - case 1 /* BooleanLiteral */: - case 5 /* NullLiteral */: - case 6 /* NumericLiteral */: - case 4 /* Keyword */: - return true; - case 7 /* Punctuator */: - return token.value === '['; - default: - break; - } - return false; - }; - Parser.prototype.parseGetterMethod = function () { - var node = this.createNode(); - var isGenerator = false; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = !isGenerator; - var formalParameters = this.parseFormalParameters(); - if (formalParameters.params.length > 0) { - this.tolerateError(messages_1.Messages.BadGetterArity); - } - var method = this.parsePropertyMethod(formalParameters); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); - }; - Parser.prototype.parseSetterMethod = function () { - var node = this.createNode(); - var isGenerator = false; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = !isGenerator; - var formalParameters = this.parseFormalParameters(); - if (formalParameters.params.length !== 1) { - this.tolerateError(messages_1.Messages.BadSetterArity); - } - else if (formalParameters.params[0] instanceof Node.RestElement) { - this.tolerateError(messages_1.Messages.BadSetterRestParameter); - } - var method = this.parsePropertyMethod(formalParameters); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); - }; - Parser.prototype.parseGeneratorMethod = function () { - var node = this.createNode(); - var isGenerator = true; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = true; - var params = this.parseFormalParameters(); - this.context.allowYield = false; - var method = this.parsePropertyMethod(params); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); - }; - // https://tc39.github.io/ecma262/#sec-generator-function-definitions - Parser.prototype.isStartOfExpression = function () { - var start = true; - var value = this.lookahead.value; - switch (this.lookahead.type) { - case 7 /* Punctuator */: - start = (value === '[') || (value === '(') || (value === '{') || - (value === '+') || (value === '-') || - (value === '!') || (value === '~') || - (value === '++') || (value === '--') || - (value === '/') || (value === '/='); // regular expression literal - break; - case 4 /* Keyword */: - start = (value === 'class') || (value === 'delete') || - (value === 'function') || (value === 'let') || (value === 'new') || - (value === 'super') || (value === 'this') || (value === 'typeof') || - (value === 'void') || (value === 'yield'); - break; - default: - break; - } - return start; - }; - Parser.prototype.parseYieldExpression = function () { - var node = this.createNode(); - this.expectKeyword('yield'); - var argument = null; - var delegate = false; - if (!this.hasLineTerminator) { - var previousAllowYield = this.context.allowYield; - this.context.allowYield = false; - delegate = this.match('*'); - if (delegate) { - this.nextToken(); - argument = this.parseAssignmentExpression(); - } - else if (this.isStartOfExpression()) { - argument = this.parseAssignmentExpression(); - } - this.context.allowYield = previousAllowYield; - } - return this.finalize(node, new Node.YieldExpression(argument, delegate)); - }; - // https://tc39.github.io/ecma262/#sec-class-definitions - Parser.prototype.parseClassElement = function (hasConstructor) { - var token = this.lookahead; - var node = this.createNode(); - var kind = ''; - var key = null; - var value = null; - var computed = false; - var method = false; - var isStatic = false; - var isAsync = false; - if (this.match('*')) { - this.nextToken(); - } - else { - computed = this.match('['); - key = this.parseObjectPropertyKey(); - var id = key; - if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) { - token = this.lookahead; - isStatic = true; - computed = this.match('['); - if (this.match('*')) { - this.nextToken(); - } - else { - key = this.parseObjectPropertyKey(); - } - } - if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) { - var punctuator = this.lookahead.value; - if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') { - isAsync = true; - token = this.lookahead; - key = this.parseObjectPropertyKey(); - if (token.type === 3 /* Identifier */ && token.value === 'constructor') { - this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync); - } - } - } - } - var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); - if (token.type === 3 /* Identifier */) { - if (token.value === 'get' && lookaheadPropertyKey) { - kind = 'get'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - this.context.allowYield = false; - value = this.parseGetterMethod(); - } - else if (token.value === 'set' && lookaheadPropertyKey) { - kind = 'set'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseSetterMethod(); - } - } - else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { - kind = 'init'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseGeneratorMethod(); - method = true; - } - if (!kind && key && this.match('(')) { - kind = 'init'; - value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); - method = true; - } - if (!kind) { - this.throwUnexpectedToken(this.lookahead); - } - if (kind === 'init') { - kind = 'method'; - } - if (!computed) { - if (isStatic && this.isPropertyKey(key, 'prototype')) { - this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype); - } - if (!isStatic && this.isPropertyKey(key, 'constructor')) { - if (kind !== 'method' || !method || (value && value.generator)) { - this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod); - } - if (hasConstructor.value) { - this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor); - } - else { - hasConstructor.value = true; - } - kind = 'constructor'; - } - } - return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic)); - }; - Parser.prototype.parseClassElementList = function () { - var body = []; - var hasConstructor = { value: false }; - this.expect('{'); - while (!this.match('}')) { - if (this.match(';')) { - this.nextToken(); - } - else { - body.push(this.parseClassElement(hasConstructor)); - } - } - this.expect('}'); - return body; - }; - Parser.prototype.parseClassBody = function () { - var node = this.createNode(); - var elementList = this.parseClassElementList(); - return this.finalize(node, new Node.ClassBody(elementList)); - }; - Parser.prototype.parseClassDeclaration = function (identifierIsOptional) { - var node = this.createNode(); - var previousStrict = this.context.strict; - this.context.strict = true; - this.expectKeyword('class'); - var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier(); - var superClass = null; - if (this.matchKeyword('extends')) { - this.nextToken(); - superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); - } - var classBody = this.parseClassBody(); - this.context.strict = previousStrict; - return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody)); - }; - Parser.prototype.parseClassExpression = function () { - var node = this.createNode(); - var previousStrict = this.context.strict; - this.context.strict = true; - this.expectKeyword('class'); - var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null; - var superClass = null; - if (this.matchKeyword('extends')) { - this.nextToken(); - superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); - } - var classBody = this.parseClassBody(); - this.context.strict = previousStrict; - return this.finalize(node, new Node.ClassExpression(id, superClass, classBody)); - }; - // https://tc39.github.io/ecma262/#sec-scripts - // https://tc39.github.io/ecma262/#sec-modules - Parser.prototype.parseModule = function () { - this.context.strict = true; - this.context.isModule = true; - this.scanner.isModule = true; - var node = this.createNode(); - var body = this.parseDirectivePrologues(); - while (this.lookahead.type !== 2 /* EOF */) { - body.push(this.parseStatementListItem()); - } - return this.finalize(node, new Node.Module(body)); - }; - Parser.prototype.parseScript = function () { - var node = this.createNode(); - var body = this.parseDirectivePrologues(); - while (this.lookahead.type !== 2 /* EOF */) { - body.push(this.parseStatementListItem()); - } - return this.finalize(node, new Node.Script(body)); - }; - // https://tc39.github.io/ecma262/#sec-imports - Parser.prototype.parseModuleSpecifier = function () { - var node = this.createNode(); - if (this.lookahead.type !== 8 /* StringLiteral */) { - this.throwError(messages_1.Messages.InvalidModuleSpecifier); - } - var token = this.nextToken(); - var raw = this.getTokenRaw(token); - return this.finalize(node, new Node.Literal(token.value, raw)); - }; - // import {} ...; - Parser.prototype.parseImportSpecifier = function () { - var node = this.createNode(); - var imported; - var local; - if (this.lookahead.type === 3 /* Identifier */) { - imported = this.parseVariableIdentifier(); - local = imported; - if (this.matchContextualKeyword('as')) { - this.nextToken(); - local = this.parseVariableIdentifier(); - } - } - else { - imported = this.parseIdentifierName(); - local = imported; - if (this.matchContextualKeyword('as')) { - this.nextToken(); - local = this.parseVariableIdentifier(); - } - else { - this.throwUnexpectedToken(this.nextToken()); - } - } - return this.finalize(node, new Node.ImportSpecifier(local, imported)); - }; - // {foo, bar as bas} - Parser.prototype.parseNamedImports = function () { - this.expect('{'); - var specifiers = []; - while (!this.match('}')) { - specifiers.push(this.parseImportSpecifier()); - if (!this.match('}')) { - this.expect(','); - } - } - this.expect('}'); - return specifiers; - }; - // import ...; - Parser.prototype.parseImportDefaultSpecifier = function () { - var node = this.createNode(); - var local = this.parseIdentifierName(); - return this.finalize(node, new Node.ImportDefaultSpecifier(local)); - }; - // import <* as foo> ...; - Parser.prototype.parseImportNamespaceSpecifier = function () { - var node = this.createNode(); - this.expect('*'); - if (!this.matchContextualKeyword('as')) { - this.throwError(messages_1.Messages.NoAsAfterImportNamespace); - } - this.nextToken(); - var local = this.parseIdentifierName(); - return this.finalize(node, new Node.ImportNamespaceSpecifier(local)); - }; - Parser.prototype.parseImportDeclaration = function () { - if (this.context.inFunctionBody) { - this.throwError(messages_1.Messages.IllegalImportDeclaration); - } - var node = this.createNode(); - this.expectKeyword('import'); - var src; - var specifiers = []; - if (this.lookahead.type === 8 /* StringLiteral */) { - // import 'foo'; - src = this.parseModuleSpecifier(); - } - else { - if (this.match('{')) { - // import {bar} - specifiers = specifiers.concat(this.parseNamedImports()); - } - else if (this.match('*')) { - // import * as foo - specifiers.push(this.parseImportNamespaceSpecifier()); - } - else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) { - // import foo - specifiers.push(this.parseImportDefaultSpecifier()); - if (this.match(',')) { - this.nextToken(); - if (this.match('*')) { - // import foo, * as foo - specifiers.push(this.parseImportNamespaceSpecifier()); - } - else if (this.match('{')) { - // import foo, {bar} - specifiers = specifiers.concat(this.parseNamedImports()); - } - else { - this.throwUnexpectedToken(this.lookahead); - } - } - } - else { - this.throwUnexpectedToken(this.nextToken()); - } - if (!this.matchContextualKeyword('from')) { - var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; - this.throwError(message, this.lookahead.value); - } - this.nextToken(); - src = this.parseModuleSpecifier(); - } - this.consumeSemicolon(); - return this.finalize(node, new Node.ImportDeclaration(specifiers, src)); - }; - // https://tc39.github.io/ecma262/#sec-exports - Parser.prototype.parseExportSpecifier = function () { - var node = this.createNode(); - var local = this.parseIdentifierName(); - var exported = local; - if (this.matchContextualKeyword('as')) { - this.nextToken(); - exported = this.parseIdentifierName(); - } - return this.finalize(node, new Node.ExportSpecifier(local, exported)); - }; - Parser.prototype.parseExportDeclaration = function () { - if (this.context.inFunctionBody) { - this.throwError(messages_1.Messages.IllegalExportDeclaration); - } - var node = this.createNode(); - this.expectKeyword('export'); - var exportDeclaration; - if (this.matchKeyword('default')) { - // export default ... - this.nextToken(); - if (this.matchKeyword('function')) { - // export default function foo () {} - // export default function () {} - var declaration = this.parseFunctionDeclaration(true); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } - else if (this.matchKeyword('class')) { - // export default class foo {} - var declaration = this.parseClassDeclaration(true); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } - else if (this.matchContextualKeyword('async')) { - // export default async function f () {} - // export default async function () {} - // export default async x => x - var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression(); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } - else { - if (this.matchContextualKeyword('from')) { - this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value); - } - // export default {}; - // export default []; - // export default (1 + 2); - var declaration = this.match('{') ? this.parseObjectInitializer() : - this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression(); - this.consumeSemicolon(); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } - } - else if (this.match('*')) { - // export * from 'foo'; - this.nextToken(); - if (!this.matchContextualKeyword('from')) { - var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; - this.throwError(message, this.lookahead.value); - } - this.nextToken(); - var src = this.parseModuleSpecifier(); - this.consumeSemicolon(); - exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src)); - } - else if (this.lookahead.type === 4 /* Keyword */) { - // export var f = 1; - var declaration = void 0; - switch (this.lookahead.value) { - case 'let': - case 'const': - declaration = this.parseLexicalDeclaration({ inFor: false }); - break; - case 'var': - case 'class': - case 'function': - declaration = this.parseStatementListItem(); - break; - default: - this.throwUnexpectedToken(this.lookahead); - } - exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); - } - else if (this.matchAsyncFunction()) { - var declaration = this.parseFunctionDeclaration(); - exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); - } - else { - var specifiers = []; - var source = null; - var isExportFromIdentifier = false; - this.expect('{'); - while (!this.match('}')) { - isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default'); - specifiers.push(this.parseExportSpecifier()); - if (!this.match('}')) { - this.expect(','); - } - } - this.expect('}'); - if (this.matchContextualKeyword('from')) { - // export {default} from 'foo'; - // export {foo} from 'foo'; - this.nextToken(); - source = this.parseModuleSpecifier(); - this.consumeSemicolon(); - } - else if (isExportFromIdentifier) { - // export {default}; // missing fromClause - var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; - this.throwError(message, this.lookahead.value); - } - else { - // export {foo}; - this.consumeSemicolon(); - } - exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source)); - } - return exportDeclaration; - }; - return Parser; - }()); - exports.Parser = Parser; - - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - "use strict"; - // Ensure the condition is true, otherwise throw an error. - // This is only to have a better contract semantic, i.e. another safety net - // to catch a logic error. The condition shall be fulfilled in normal case. - // Do NOT use this to enforce a certain condition on any user input. - Object.defineProperty(exports, "__esModule", { value: true }); - function assert(condition, message) { - /* istanbul ignore if */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - exports.assert = assert; - - -/***/ }, -/* 10 */ -/***/ function(module, exports) { - - "use strict"; - /* tslint:disable:max-classes-per-file */ - Object.defineProperty(exports, "__esModule", { value: true }); - var ErrorHandler = (function () { - function ErrorHandler() { - this.errors = []; - this.tolerant = false; - } - ErrorHandler.prototype.recordError = function (error) { - this.errors.push(error); - }; - ErrorHandler.prototype.tolerate = function (error) { - if (this.tolerant) { - this.recordError(error); - } - else { - throw error; - } - }; - ErrorHandler.prototype.constructError = function (msg, column) { - var error = new Error(msg); - try { - throw error; - } - catch (base) { - /* istanbul ignore else */ - if (Object.create && Object.defineProperty) { - error = Object.create(base); - Object.defineProperty(error, 'column', { value: column }); - } - } - /* istanbul ignore next */ - return error; - }; - ErrorHandler.prototype.createError = function (index, line, col, description) { - var msg = 'Line ' + line + ': ' + description; - var error = this.constructError(msg, col); - error.index = index; - error.lineNumber = line; - error.description = description; - return error; - }; - ErrorHandler.prototype.throwError = function (index, line, col, description) { - throw this.createError(index, line, col, description); - }; - ErrorHandler.prototype.tolerateError = function (index, line, col, description) { - var error = this.createError(index, line, col, description); - if (this.tolerant) { - this.recordError(error); - } - else { - throw error; - } - }; - return ErrorHandler; - }()); - exports.ErrorHandler = ErrorHandler; - - -/***/ }, -/* 11 */ -/***/ function(module, exports) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - // Error messages should be identical to V8. - exports.Messages = { - BadGetterArity: 'Getter must not have any formal parameters', - BadSetterArity: 'Setter must have exactly one formal parameter', - BadSetterRestParameter: 'Setter function argument must not be a rest parameter', - ConstructorIsAsync: 'Class constructor may not be an async method', - ConstructorSpecialMethod: 'Class constructor may not be an accessor', - DeclarationMissingInitializer: 'Missing initializer in %0 declaration', - DefaultRestParameter: 'Unexpected token =', - DuplicateBinding: 'Duplicate binding %0', - DuplicateConstructor: 'A class may only have one constructor', - DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', - ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer', - GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts', - IllegalBreak: 'Illegal break statement', - IllegalContinue: 'Illegal continue statement', - IllegalExportDeclaration: 'Unexpected token', - IllegalImportDeclaration: 'Unexpected token', - IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list', - IllegalReturn: 'Illegal return statement', - InvalidEscapedReservedWord: 'Keyword must not contain escaped characters', - InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence', - InvalidLHSInAssignment: 'Invalid left-hand side in assignment', - InvalidLHSInForIn: 'Invalid left-hand side in for-in', - InvalidLHSInForLoop: 'Invalid left-hand side in for-loop', - InvalidModuleSpecifier: 'Unexpected token', - InvalidRegExp: 'Invalid regular expression', - LetInLexicalBinding: 'let is disallowed as a lexically bound name', - MissingFromClause: 'Unexpected token', - MultipleDefaultsInSwitch: 'More than one default clause in switch statement', - NewlineAfterThrow: 'Illegal newline after throw', - NoAsAfterImportNamespace: 'Unexpected token', - NoCatchOrFinally: 'Missing catch or finally after try', - ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', - Redeclaration: '%0 \'%1\' has already been declared', - StaticPrototype: 'Classes may not have static property named prototype', - StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', - StrictDelete: 'Delete of an unqualified identifier in strict mode.', - StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block', - StrictFunctionName: 'Function name may not be eval or arguments in strict mode', - StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', - StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', - StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', - StrictModeWith: 'Strict mode code may not include a with statement', - StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', - StrictParamDupe: 'Strict mode function may not have duplicate parameter names', - StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', - StrictReservedWord: 'Use of future reserved word in strict mode', - StrictVarName: 'Variable name may not be eval or arguments in strict mode', - TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', - UnexpectedEOS: 'Unexpected end of input', - UnexpectedIdentifier: 'Unexpected identifier', - UnexpectedNumber: 'Unexpected number', - UnexpectedReserved: 'Unexpected reserved word', - UnexpectedString: 'Unexpected string', - UnexpectedTemplate: 'Unexpected quasi %0', - UnexpectedToken: 'Unexpected token %0', - UnexpectedTokenIllegal: 'Unexpected token ILLEGAL', - UnknownLabel: 'Undefined label \'%0\'', - UnterminatedRegExp: 'Invalid regular expression: missing /' - }; - - -/***/ }, -/* 12 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var assert_1 = __webpack_require__(9); - var character_1 = __webpack_require__(4); - var messages_1 = __webpack_require__(11); - function hexValue(ch) { - return '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - function octalValue(ch) { - return '01234567'.indexOf(ch); - } - var Scanner = (function () { - function Scanner(code, handler) { - this.source = code; - this.errorHandler = handler; - this.trackComment = false; - this.isModule = false; - this.length = code.length; - this.index = 0; - this.lineNumber = (code.length > 0) ? 1 : 0; - this.lineStart = 0; - this.curlyStack = []; - } - Scanner.prototype.saveState = function () { - return { - index: this.index, - lineNumber: this.lineNumber, - lineStart: this.lineStart - }; - }; - Scanner.prototype.restoreState = function (state) { - this.index = state.index; - this.lineNumber = state.lineNumber; - this.lineStart = state.lineStart; - }; - Scanner.prototype.eof = function () { - return this.index >= this.length; - }; - Scanner.prototype.throwUnexpectedToken = function (message) { - if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } - return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); - }; - Scanner.prototype.tolerateUnexpectedToken = function (message) { - if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } - this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); - }; - // https://tc39.github.io/ecma262/#sec-comments - Scanner.prototype.skipSingleLineComment = function (offset) { - var comments = []; - var start, loc; - if (this.trackComment) { - comments = []; - start = this.index - offset; - loc = { - start: { - line: this.lineNumber, - column: this.index - this.lineStart - offset - }, - end: {} - }; - } - while (!this.eof()) { - var ch = this.source.charCodeAt(this.index); - ++this.index; - if (character_1.Character.isLineTerminator(ch)) { - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - 1 - }; - var entry = { - multiLine: false, - slice: [start + offset, this.index - 1], - range: [start, this.index - 1], - loc: loc - }; - comments.push(entry); - } - if (ch === 13 && this.source.charCodeAt(this.index) === 10) { - ++this.index; - } - ++this.lineNumber; - this.lineStart = this.index; - return comments; - } - } - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - }; - var entry = { - multiLine: false, - slice: [start + offset, this.index], - range: [start, this.index], - loc: loc - }; - comments.push(entry); - } - return comments; - }; - Scanner.prototype.skipMultiLineComment = function () { - var comments = []; - var start, loc; - if (this.trackComment) { - comments = []; - start = this.index - 2; - loc = { - start: { - line: this.lineNumber, - column: this.index - this.lineStart - 2 - }, - end: {} - }; - } - while (!this.eof()) { - var ch = this.source.charCodeAt(this.index); - if (character_1.Character.isLineTerminator(ch)) { - if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) { - ++this.index; - } - ++this.lineNumber; - ++this.index; - this.lineStart = this.index; - } - else if (ch === 0x2A) { - // Block comment ends with '*/'. - if (this.source.charCodeAt(this.index + 1) === 0x2F) { - this.index += 2; - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - }; - var entry = { - multiLine: true, - slice: [start + 2, this.index - 2], - range: [start, this.index], - loc: loc - }; - comments.push(entry); - } - return comments; - } - ++this.index; - } - else { - ++this.index; - } - } - // Ran off the end of the file - the whole thing is a comment - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - }; - var entry = { - multiLine: true, - slice: [start + 2, this.index], - range: [start, this.index], - loc: loc - }; - comments.push(entry); - } - this.tolerateUnexpectedToken(); - return comments; - }; - Scanner.prototype.scanComments = function () { - var comments; - if (this.trackComment) { - comments = []; - } - var start = (this.index === 0); - while (!this.eof()) { - var ch = this.source.charCodeAt(this.index); - if (character_1.Character.isWhiteSpace(ch)) { - ++this.index; - } - else if (character_1.Character.isLineTerminator(ch)) { - ++this.index; - if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) { - ++this.index; - } - ++this.lineNumber; - this.lineStart = this.index; - start = true; - } - else if (ch === 0x2F) { - ch = this.source.charCodeAt(this.index + 1); - if (ch === 0x2F) { - this.index += 2; - var comment = this.skipSingleLineComment(2); - if (this.trackComment) { - comments = comments.concat(comment); - } - start = true; - } - else if (ch === 0x2A) { - this.index += 2; - var comment = this.skipMultiLineComment(); - if (this.trackComment) { - comments = comments.concat(comment); - } - } - else { - break; - } - } - else if (start && ch === 0x2D) { - // U+003E is '>' - if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) { - // '-->' is a single-line comment - this.index += 3; - var comment = this.skipSingleLineComment(3); - if (this.trackComment) { - comments = comments.concat(comment); - } - } - else { - break; - } - } - else if (ch === 0x3C && !this.isModule) { - if (this.source.slice(this.index + 1, this.index + 4) === '!--') { - this.index += 4; // ` - - - -Implementation of function.prototype.bind - -## Example - -I mainly do this for unit tests I run on phantomjs. -PhantomJS does not have Function.prototype.bind :( - -```js -Function.prototype.bind = require("function-bind") -``` - -## Installation - -`npm install function-bind` - -## Contributors - - - Raynos - -## MIT Licenced - - [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg - [travis-url]: https://travis-ci.org/Raynos/function-bind - [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg - [npm-url]: https://npmjs.org/package/function-bind - [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png - [6]: https://coveralls.io/r/Raynos/function-bind - [7]: https://gemnasium.com/Raynos/function-bind.png - [8]: https://gemnasium.com/Raynos/function-bind - [deps-svg]: https://david-dm.org/Raynos/function-bind.svg - [deps-url]: https://david-dm.org/Raynos/function-bind - [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg - [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies - [11]: https://ci.testling.com/Raynos/function-bind.png - [12]: https://ci.testling.com/Raynos/function-bind diff --git a/node_modules/function-bind/implementation.js b/node_modules/function-bind/implementation.js deleted file mode 100644 index cc4daec1b..000000000 --- a/node_modules/function-bind/implementation.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -/* eslint no-invalid-this: 1 */ - -var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; -var slice = Array.prototype.slice; -var toStr = Object.prototype.toString; -var funcType = '[object Function]'; - -module.exports = function bind(that) { - var target = this; - if (typeof target !== 'function' || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slice.call(arguments, 1); - - var bound; - var binder = function () { - if (this instanceof bound) { - var result = target.apply( - this, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return this; - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - } - }; - - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs.push('$' + i); - } - - bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); - - if (target.prototype) { - var Empty = function Empty() {}; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - - return bound; -}; diff --git a/node_modules/function-bind/index.js b/node_modules/function-bind/index.js deleted file mode 100644 index 3bb6b9609..000000000 --- a/node_modules/function-bind/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var implementation = require('./implementation'); - -module.exports = Function.prototype.bind || implementation; diff --git a/node_modules/function-bind/package.json b/node_modules/function-bind/package.json deleted file mode 100644 index 20a1727cb..000000000 --- a/node_modules/function-bind/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "function-bind", - "version": "1.1.1", - "description": "Implementation of Function.prototype.bind", - "keywords": [ - "function", - "bind", - "shim", - "es5" - ], - "author": "Raynos ", - "repository": "git://github.com/Raynos/function-bind.git", - "main": "index", - "homepage": "https://github.com/Raynos/function-bind", - "contributors": [ - { - "name": "Raynos" - }, - { - "name": "Jordan Harband", - "url": "https://github.com/ljharb" - } - ], - "bugs": { - "url": "https://github.com/Raynos/function-bind/issues", - "email": "raynos2@gmail.com" - }, - "dependencies": {}, - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "covert": "^1.1.0", - "eslint": "^4.5.0", - "jscs": "^3.0.7", - "tape": "^4.8.0" - }, - "license": "MIT", - "scripts": { - "pretest": "npm run lint", - "test": "npm run tests-only", - "posttest": "npm run coverage -- --quiet", - "tests-only": "node test", - "coverage": "covert test/*.js", - "lint": "npm run jscs && npm run eslint", - "jscs": "jscs *.js */*.js", - "eslint": "eslint *.js */*.js" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..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" - ] - } -} diff --git a/node_modules/function-bind/test/.eslintrc b/node_modules/function-bind/test/.eslintrc deleted file mode 100644 index 8a56d5b72..000000000 --- a/node_modules/function-bind/test/.eslintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "rules": { - "array-bracket-newline": 0, - "array-element-newline": 0, - "max-statements-per-line": [2, { "max": 2 }], - "no-invalid-this": 0, - "no-magic-numbers": 0, - } -} diff --git a/node_modules/function-bind/test/index.js b/node_modules/function-bind/test/index.js deleted file mode 100644 index 2edecce2f..000000000 --- a/node_modules/function-bind/test/index.js +++ /dev/null @@ -1,252 +0,0 @@ -// jscs:disable requireUseStrict - -var test = require('tape'); - -var functionBind = require('../implementation'); -var getCurrentContext = function () { return this; }; - -test('functionBind is a function', function (t) { - t.equal(typeof functionBind, 'function'); - t.end(); -}); - -test('non-functions', function (t) { - var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g]; - t.plan(nonFunctions.length); - for (var i = 0; i < nonFunctions.length; ++i) { - try { functionBind.call(nonFunctions[i]); } catch (ex) { - t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i])); - } - } - t.end(); -}); - -test('without a context', function (t) { - t.test('binds properly', function (st) { - var args, context; - var namespace = { - func: functionBind.call(function () { - args = Array.prototype.slice.call(arguments); - context = this; - }) - }; - namespace.func(1, 2, 3); - st.deepEqual(args, [1, 2, 3]); - st.equal(context, getCurrentContext.call()); - st.end(); - }); - - t.test('binds properly, and still supplies bound arguments', function (st) { - var args, context; - var namespace = { - func: functionBind.call(function () { - args = Array.prototype.slice.call(arguments); - context = this; - }, undefined, 1, 2, 3) - }; - namespace.func(4, 5, 6); - st.deepEqual(args, [1, 2, 3, 4, 5, 6]); - st.equal(context, getCurrentContext.call()); - st.end(); - }); - - t.test('returns properly', function (st) { - var args; - var namespace = { - func: functionBind.call(function () { - args = Array.prototype.slice.call(arguments); - return this; - }, null) - }; - var context = namespace.func(1, 2, 3); - st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); - st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); - st.end(); - }); - - t.test('returns properly with bound arguments', function (st) { - var args; - var namespace = { - func: functionBind.call(function () { - args = Array.prototype.slice.call(arguments); - return this; - }, null, 1, 2, 3) - }; - var context = namespace.func(4, 5, 6); - st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); - st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); - st.end(); - }); - - t.test('called as a constructor', function (st) { - var thunkify = function (value) { - return function () { return value; }; - }; - st.test('returns object value', function (sst) { - var expectedReturnValue = [1, 2, 3]; - var Constructor = functionBind.call(thunkify(expectedReturnValue), null); - var result = new Constructor(); - sst.equal(result, expectedReturnValue); - sst.end(); - }); - - st.test('does not return primitive value', function (sst) { - var Constructor = functionBind.call(thunkify(42), null); - var result = new Constructor(); - sst.notEqual(result, 42); - sst.end(); - }); - - st.test('object from bound constructor is instance of original and bound constructor', function (sst) { - var A = function (x) { - this.name = x || 'A'; - }; - var B = functionBind.call(A, null, 'B'); - - var result = new B(); - sst.ok(result instanceof B, 'result is instance of bound constructor'); - sst.ok(result instanceof A, 'result is instance of original constructor'); - sst.end(); - }); - - st.end(); - }); - - t.end(); -}); - -test('with a context', function (t) { - t.test('with no bound arguments', function (st) { - var args, context; - var boundContext = {}; - var namespace = { - func: functionBind.call(function () { - args = Array.prototype.slice.call(arguments); - context = this; - }, boundContext) - }; - namespace.func(1, 2, 3); - st.equal(context, boundContext, 'binds a context properly'); - st.deepEqual(args, [1, 2, 3], 'supplies passed arguments'); - st.end(); - }); - - t.test('with bound arguments', function (st) { - var args, context; - var boundContext = {}; - var namespace = { - func: functionBind.call(function () { - args = Array.prototype.slice.call(arguments); - context = this; - }, boundContext, 1, 2, 3) - }; - namespace.func(4, 5, 6); - st.equal(context, boundContext, 'binds a context properly'); - st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments'); - st.end(); - }); - - t.test('returns properly', function (st) { - var boundContext = {}; - var args; - var namespace = { - func: functionBind.call(function () { - args = Array.prototype.slice.call(arguments); - return this; - }, boundContext) - }; - var context = namespace.func(1, 2, 3); - st.equal(context, boundContext, 'returned context is bound context'); - st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); - st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); - st.end(); - }); - - t.test('returns properly with bound arguments', function (st) { - var boundContext = {}; - var args; - var namespace = { - func: functionBind.call(function () { - args = Array.prototype.slice.call(arguments); - return this; - }, boundContext, 1, 2, 3) - }; - var context = namespace.func(4, 5, 6); - st.equal(context, boundContext, 'returned context is bound context'); - st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); - st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); - st.end(); - }); - - t.test('passes the correct arguments when called as a constructor', function (st) { - var expected = { name: 'Correct' }; - var namespace = { - Func: functionBind.call(function (arg) { - return arg; - }, { name: 'Incorrect' }) - }; - var returned = new namespace.Func(expected); - st.equal(returned, expected, 'returns the right arg when called as a constructor'); - st.end(); - }); - - t.test('has the new instance\'s context when called as a constructor', function (st) { - var actualContext; - var expectedContext = { foo: 'bar' }; - var namespace = { - Func: functionBind.call(function () { - actualContext = this; - }, expectedContext) - }; - var result = new namespace.Func(); - st.equal(result instanceof namespace.Func, true); - st.notEqual(actualContext, expectedContext); - st.end(); - }); - - t.end(); -}); - -test('bound function length', function (t) { - t.test('sets a correct length without thisArg', function (st) { - var subject = functionBind.call(function (a, b, c) { return a + b + c; }); - st.equal(subject.length, 3); - st.equal(subject(1, 2, 3), 6); - st.end(); - }); - - t.test('sets a correct length with thisArg', function (st) { - var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}); - st.equal(subject.length, 3); - st.equal(subject(1, 2, 3), 6); - st.end(); - }); - - t.test('sets a correct length without thisArg and first argument', function (st) { - var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1); - st.equal(subject.length, 2); - st.equal(subject(2, 3), 6); - st.end(); - }); - - t.test('sets a correct length with thisArg and first argument', function (st) { - var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1); - st.equal(subject.length, 2); - st.equal(subject(2, 3), 6); - st.end(); - }); - - t.test('sets a correct length without thisArg and too many arguments', function (st) { - var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4); - st.equal(subject.length, 0); - st.equal(subject(), 6); - st.end(); - }); - - t.test('sets a correct length with thisArg and too many arguments', function (st) { - var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4); - st.equal(subject.length, 0); - st.equal(subject(), 6); - st.end(); - }); -}); diff --git a/node_modules/gensync/LICENSE b/node_modules/gensync/LICENSE deleted file mode 100644 index af7f781f5..000000000 --- a/node_modules/gensync/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright 2018 Logan Smyth - -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/gensync/README.md b/node_modules/gensync/README.md deleted file mode 100644 index f68ce1a37..000000000 --- a/node_modules/gensync/README.md +++ /dev/null @@ -1,196 +0,0 @@ -# gensync - -This module allows for developers to write common code that can share -implementation details, hiding whether an underlying request happens -synchronously or asynchronously. This is in contrast with many current Node -APIs which explicitly implement the same API twice, once with calls to -synchronous functions, and once with asynchronous functions. - -Take for example `fs.readFile` and `fs.readFileSync`, if you're writing an API -that loads a file and then performs a synchronous operation on the data, it -can be frustrating to maintain two parallel functions. - - -## Example - -```js -const fs = require("fs"); -const gensync = require("gensync"); - -const readFile = gensync({ - sync: fs.readFileSync, - errback: fs.readFile, -}); - -const myOperation = gensync(function* (filename) { - const code = yield* readFile(filename, "utf8"); - - return "// some custom prefix\n" + code; -}); - -// Load and add the prefix synchronously: -const result = myOperation.sync("./some-file.js"); - -// Load and add the prefix asynchronously with promises: -myOperation.async("./some-file.js").then(result => { - -}); - -// Load and add the prefix asynchronously with promises: -myOperation.errback("./some-file.js", (err, result) => { - -}); -``` - -This could even be exposed as your official API by doing -```js -// Using the common 'Sync' suffix for sync functions, and 'Async' suffix for -// promise-returning versions. -exports.myOperationSync = myOperation.sync; -exports.myOperationAsync = myOperation.async; -exports.myOperation = myOperation.errback; -``` -or potentially expose one of the async versions as the default, with a -`.sync` property on the function to expose the synchronous version. -```js -module.exports = myOperation.errback; -module.exports.sync = myOperation.sync; -```` - - -## API - -### gensync(generatorFnOrOptions) - -Returns a function that can be "await"-ed in another `gensync` generator -function, or executed via - -* `.sync(...args)` - Returns the computed value, or throws. -* `.async(...args)` - Returns a promise for the computed value. -* `.errback(...args, (err, result) => {})` - Calls the callback with the computed value, or error. - - -#### Passed a generator - -Wraps the generator to populate the `.sync`/`.async`/`.errback` helpers above to -allow for evaluation of the generator for the final value. - -##### Example - -```js -const readFile = function* () { - return 42; -}; - -const readFileAndMore = gensync(function* (){ - const val = yield* readFile(); - return 42 + val; -}); - -// In general cases -const code = readFileAndMore.sync("./file.js", "utf8"); -readFileAndMore.async("./file.js", "utf8").then(code => {}) -readFileAndMore.errback("./file.js", "utf8", (err, code) => {}); - -// In a generator being called indirectly with .sync/.async/.errback -const code = yield* readFileAndMore("./file.js", "utf8"); -``` - - -#### Passed an options object - -* `opts.sync` - - Example: `(...args) => 4` - - A function that will be called when `.sync()` is called on the `gensync()` - result, or when the result is passed to `yield*` in another generator that - is being run synchronously. - - Also called for `.async()` calls if no async handlers are provided. - -* `opts.async` - - Example: `async (...args) => 4` - - A function that will be called when `.async()` or `.errback()` is called on - the `gensync()` result, or when the result is passed to `yield*` in another - generator that is being run asynchronously. - -* `opts.errback` - - Example: `(...args, cb) => cb(null, 4)` - - A function that will be called when `.async()` or `.errback()` is called on - the `gensync()` result, or when the result is passed to `yield*` in another - generator that is being run asynchronously. - - This option allows for simpler compatibility with many existing Node APIs, - and also avoids introducing the extra even loop turns that promises introduce - to access the result value. - -* `opts.name` - - Example: `"readFile"` - - A string name to apply to the returned function. If no value is provided, - the name of `errback`/`async`/`sync` functions will be used, with any - `Sync` or `Async` suffix stripped off. If the callback is simply named - with ES6 inference (same name as the options property), the name is ignored. - -* `opts.arity` - - Example: `4` - - A number for the length to set on the returned function. If no value - is provided, the length will be carried over from the `sync` function's - `length` value. - -##### Example - -```js -const readFile = gensync({ - sync: fs.readFileSync, - errback: fs.readFile, -}); - -const code = readFile.sync("./file.js", "utf8"); -readFile.async("./file.js", "utf8").then(code => {}) -readFile.errback("./file.js", "utf8", (err, code) => {}); -``` - - -### gensync.all(iterable) - -`Promise.all`-like combinator that works with an iterable of generator objects -that could be passed to `yield*` within a gensync generator. - -#### Example - -```js -const loadFiles = gensync(function* () { - return yield* gensync.all([ - readFile("./one.js"), - readFile("./two.js"), - readFile("./three.js"), - ]); -}); -``` - - -### gensync.race(iterable) - -`Promise.race`-like combinator that works with an iterable of generator objects -that could be passed to `yield*` within a gensync generator. - -#### Example - -```js -const loadFiles = gensync(function* () { - return yield* gensync.race([ - readFile("./one.js"), - readFile("./two.js"), - readFile("./three.js"), - ]); -}); -``` diff --git a/node_modules/gensync/index.js b/node_modules/gensync/index.js deleted file mode 100644 index ee0ea6165..000000000 --- a/node_modules/gensync/index.js +++ /dev/null @@ -1,373 +0,0 @@ -"use strict"; - -// These use the global symbol registry so that multiple copies of this -// library can work together in case they are not deduped. -const GENSYNC_START = Symbol.for("gensync:v1:start"); -const GENSYNC_SUSPEND = Symbol.for("gensync:v1:suspend"); - -const GENSYNC_EXPECTED_START = "GENSYNC_EXPECTED_START"; -const GENSYNC_EXPECTED_SUSPEND = "GENSYNC_EXPECTED_SUSPEND"; -const GENSYNC_OPTIONS_ERROR = "GENSYNC_OPTIONS_ERROR"; -const GENSYNC_RACE_NONEMPTY = "GENSYNC_RACE_NONEMPTY"; -const GENSYNC_ERRBACK_NO_CALLBACK = "GENSYNC_ERRBACK_NO_CALLBACK"; - -module.exports = Object.assign( - function gensync(optsOrFn) { - let genFn = optsOrFn; - if (typeof optsOrFn !== "function") { - genFn = newGenerator(optsOrFn); - } else { - genFn = wrapGenerator(optsOrFn); - } - - return Object.assign(genFn, makeFunctionAPI(genFn)); - }, - { - all: buildOperation({ - name: "all", - arity: 1, - sync: function(args) { - const items = Array.from(args[0]); - return items.map(item => evaluateSync(item)); - }, - async: function(args, resolve, reject) { - const items = Array.from(args[0]); - - if (items.length === 0) { - Promise.resolve().then(() => resolve([])); - return; - } - - let count = 0; - const results = items.map(() => undefined); - items.forEach((item, i) => { - evaluateAsync( - item, - val => { - results[i] = val; - count += 1; - - if (count === results.length) resolve(results); - }, - reject - ); - }); - }, - }), - race: buildOperation({ - name: "race", - arity: 1, - sync: function(args) { - const items = Array.from(args[0]); - if (items.length === 0) { - throw makeError("Must race at least 1 item", GENSYNC_RACE_NONEMPTY); - } - - return evaluateSync(items[0]); - }, - async: function(args, resolve, reject) { - const items = Array.from(args[0]); - if (items.length === 0) { - throw makeError("Must race at least 1 item", GENSYNC_RACE_NONEMPTY); - } - - for (const item of items) { - evaluateAsync(item, resolve, reject); - } - }, - }), - } -); - -/** - * Given a generator function, return the standard API object that executes - * the generator and calls the callbacks. - */ -function makeFunctionAPI(genFn) { - const fns = { - sync: function(...args) { - return evaluateSync(genFn.apply(this, args)); - }, - async: function(...args) { - return new Promise((resolve, reject) => { - evaluateAsync(genFn.apply(this, args), resolve, reject); - }); - }, - errback: function(...args) { - const cb = args.pop(); - if (typeof cb !== "function") { - throw makeError( - "Asynchronous function called without callback", - GENSYNC_ERRBACK_NO_CALLBACK - ); - } - - let gen; - try { - gen = genFn.apply(this, args); - } catch (err) { - cb(err); - return; - } - - evaluateAsync(gen, val => cb(undefined, val), err => cb(err)); - }, - }; - return fns; -} - -function assertTypeof(type, name, value, allowUndefined) { - if ( - typeof value === type || - (allowUndefined && typeof value === "undefined") - ) { - return; - } - - let msg; - if (allowUndefined) { - msg = `Expected opts.${name} to be either a ${type}, or undefined.`; - } else { - msg = `Expected opts.${name} to be a ${type}.`; - } - - throw makeError(msg, GENSYNC_OPTIONS_ERROR); -} -function makeError(msg, code) { - return Object.assign(new Error(msg), { code }); -} - -/** - * Given an options object, return a new generator that dispatches the - * correct handler based on sync or async execution. - */ -function newGenerator({ name, arity, sync, async, errback }) { - assertTypeof("string", "name", name, true /* allowUndefined */); - assertTypeof("number", "arity", arity, true /* allowUndefined */); - assertTypeof("function", "sync", sync); - assertTypeof("function", "async", async, true /* allowUndefined */); - assertTypeof("function", "errback", errback, true /* allowUndefined */); - if (async && errback) { - throw makeError( - "Expected one of either opts.async or opts.errback, but got _both_.", - GENSYNC_OPTIONS_ERROR - ); - } - - if (typeof name !== "string") { - let fnName; - if (errback && errback.name && errback.name !== "errback") { - fnName = errback.name; - } - if (async && async.name && async.name !== "async") { - fnName = async.name.replace(/Async$/, ""); - } - if (sync && sync.name && sync.name !== "sync") { - fnName = sync.name.replace(/Sync$/, ""); - } - - if (typeof fnName === "string") { - name = fnName; - } - } - - if (typeof arity !== "number") { - arity = sync.length; - } - - return buildOperation({ - name, - arity, - sync: function(args) { - return sync.apply(this, args); - }, - async: function(args, resolve, reject) { - if (async) { - async.apply(this, args).then(resolve, reject); - } else if (errback) { - errback.call(this, ...args, (err, value) => { - if (err == null) resolve(value); - else reject(err); - }); - } else { - resolve(sync.apply(this, args)); - } - }, - }); -} - -function wrapGenerator(genFn) { - return setFunctionMetadata(genFn.name, genFn.length, function(...args) { - return genFn.apply(this, args); - }); -} - -function buildOperation({ name, arity, sync, async }) { - return setFunctionMetadata(name, arity, function*(...args) { - const resume = yield GENSYNC_START; - if (!resume) { - // Break the tail call to avoid a bug in V8 v6.X with --harmony enabled. - const res = sync.call(this, args); - return res; - } - - let result; - try { - async.call( - this, - args, - value => { - if (result) return; - - result = { value }; - resume(); - }, - err => { - if (result) return; - - result = { err }; - resume(); - } - ); - } catch (err) { - result = { err }; - resume(); - } - - // Suspend until the callbacks run. Will resume synchronously if the - // callback was already called. - yield GENSYNC_SUSPEND; - - if (result.hasOwnProperty("err")) { - throw result.err; - } - - return result.value; - }); -} - -function evaluateSync(gen) { - let value; - while (!({ value } = gen.next()).done) { - assertStart(value, gen); - } - return value; -} - -function evaluateAsync(gen, resolve, reject) { - (function step() { - try { - let value; - while (!({ value } = gen.next()).done) { - assertStart(value, gen); - - // If this throws, it is considered to have broken the contract - // established for async handlers. If these handlers are called - // synchronously, it is also considered bad behavior. - let sync = true; - let didSyncResume = false; - const out = gen.next(() => { - if (sync) { - didSyncResume = true; - } else { - step(); - } - }); - sync = false; - - assertSuspend(out, gen); - - if (!didSyncResume) { - // Callback wasn't called synchronously, so break out of the loop - // and let it call 'step' later. - return; - } - } - - return resolve(value); - } catch (err) { - return reject(err); - } - })(); -} - -function assertStart(value, gen) { - if (value === GENSYNC_START) return; - - throwError( - gen, - makeError( - `Got unexpected yielded value in gensync generator: ${JSON.stringify( - value - )}. Did you perhaps mean to use 'yield*' instead of 'yield'?`, - GENSYNC_EXPECTED_START - ) - ); -} -function assertSuspend({ value, done }, gen) { - if (!done && value === GENSYNC_SUSPEND) return; - - throwError( - gen, - makeError( - done - ? "Unexpected generator completion. If you get this, it is probably a gensync bug." - : `Expected GENSYNC_SUSPEND, got ${JSON.stringify( - value - )}. If you get this, it is probably a gensync bug.`, - GENSYNC_EXPECTED_SUSPEND - ) - ); -} - -function throwError(gen, err) { - // Call `.throw` so that users can step in a debugger to easily see which - // 'yield' passed an unexpected value. If the `.throw` call didn't throw - // back to the generator, we explicitly do it to stop the error - // from being swallowed by user code try/catches. - if (gen.throw) gen.throw(err); - throw err; -} - -function isIterable(value) { - return ( - !!value && - (typeof value === "object" || typeof value === "function") && - !value[Symbol.iterator] - ); -} - -function setFunctionMetadata(name, arity, fn) { - if (typeof name === "string") { - // This should always work on the supported Node versions, but for the - // sake of users that are compiling to older versions, we check for - // configurability so we don't throw. - const nameDesc = Object.getOwnPropertyDescriptor(fn, "name"); - if (!nameDesc || nameDesc.configurable) { - Object.defineProperty( - fn, - "name", - Object.assign(nameDesc || {}, { - configurable: true, - value: name, - }) - ); - } - } - - if (typeof arity === "number") { - const lengthDesc = Object.getOwnPropertyDescriptor(fn, "length"); - if (!lengthDesc || lengthDesc.configurable) { - Object.defineProperty( - fn, - "length", - Object.assign(lengthDesc || {}, { - configurable: true, - value: arity, - }) - ); - } - } - - return fn; -} diff --git a/node_modules/gensync/index.js.flow b/node_modules/gensync/index.js.flow deleted file mode 100644 index fa22e0bad..000000000 --- a/node_modules/gensync/index.js.flow +++ /dev/null @@ -1,32 +0,0 @@ -// @flow - -opaque type Next = Function | void; -opaque type Yield = mixed; - -export type Gensync = { - (...args: Args): Handler, - sync(...args: Args): Return, - async(...args: Args): Promise, - // ...args: [...Args, Callback] - errback(...args: any[]): void, -}; - -export type Handler = Generator; -export type Options = { - sync(...args: Args): Return, - arity?: number, - name?: string, -} & ( - | { async?: (...args: Args) => Promise } - // ...args: [...Args, Callback] - | { errback(...args: any[]): void } -); - -declare module.exports: { - ( - Options | ((...args: Args) => Handler) - ): Gensync, - - all(Array>): Handler, - race(Array>): Handler, -}; diff --git a/node_modules/gensync/package.json b/node_modules/gensync/package.json deleted file mode 100644 index 07f87570d..000000000 --- a/node_modules/gensync/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "gensync", - "version": "1.0.0-beta.2", - "license": "MIT", - "description": "Allows users to use generators in order to write common functions that can be both sync or async.", - "main": "index.js", - "author": "Logan Smyth ", - "homepage": "https://github.com/loganfsmyth/gensync", - "repository": { - "type": "git", - "url": "https://github.com/loganfsmyth/gensync.git" - }, - "scripts": { - "test": "jest" - }, - "engines": { - "node": ">=6.9.0" - }, - "keywords": [ - "async", - "sync", - "generators", - "async-await", - "callbacks" - ], - "devDependencies": { - "babel-core": "^6.26.3", - "babel-preset-env": "^1.6.1", - "eslint": "^4.19.1", - "eslint-config-prettier": "^2.9.0", - "eslint-plugin-node": "^6.0.1", - "eslint-plugin-prettier": "^2.6.0", - "flow-bin": "^0.71.0", - "jest": "^22.4.3", - "prettier": "^1.12.1" - } -} diff --git a/node_modules/gensync/test/.babelrc b/node_modules/gensync/test/.babelrc deleted file mode 100644 index cc7f4e98d..000000000 --- a/node_modules/gensync/test/.babelrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - presets: [ - ["env", { targets: { node: "current" }}], - ], -} diff --git a/node_modules/gensync/test/index.test.js b/node_modules/gensync/test/index.test.js deleted file mode 100644 index ca1a2695e..000000000 --- a/node_modules/gensync/test/index.test.js +++ /dev/null @@ -1,489 +0,0 @@ -"use strict"; - -const promisify = require("util.promisify"); -const gensync = require("../"); - -const TEST_ERROR = new Error("TEST_ERROR"); - -const DID_ERROR = new Error("DID_ERROR"); - -const doSuccess = gensync({ - sync: () => 42, - async: () => Promise.resolve(42), -}); - -const doError = gensync({ - sync: () => { - throw DID_ERROR; - }, - async: () => Promise.reject(DID_ERROR), -}); - -function throwTestError() { - throw TEST_ERROR; -} - -async function expectResult( - fn, - arg, - { error, value, expectSync = false, syncErrback = expectSync } -) { - if (!expectSync) { - expect(() => fn.sync(arg)).toThrow(TEST_ERROR); - } else if (error) { - expect(() => fn.sync(arg)).toThrow(error); - } else { - expect(fn.sync(arg)).toBe(value); - } - - if (error) { - await expect(fn.async(arg)).rejects.toBe(error); - } else { - await expect(fn.async(arg)).resolves.toBe(value); - } - - await new Promise((resolve, reject) => { - let sync = true; - fn.errback(arg, (err, val) => { - try { - expect(err).toBe(error); - expect(val).toBe(value); - expect(sync).toBe(syncErrback); - - resolve(); - } catch (e) { - reject(e); - } - }); - sync = false; - }); -} - -describe("gensync({})", () => { - describe("option validation", () => { - test("disallow async and errback handler together", () => { - try { - gensync({ - sync: throwTestError, - async: throwTestError, - errback: throwTestError, - }); - - throwTestError(); - } catch (err) { - expect(err.message).toMatch( - /Expected one of either opts.async or opts.errback, but got _both_\./ - ); - expect(err.code).toBe("GENSYNC_OPTIONS_ERROR"); - } - }); - - test("disallow missing sync handler", () => { - try { - gensync({ - async: throwTestError, - }); - - throwTestError(); - } catch (err) { - expect(err.message).toMatch(/Expected opts.sync to be a function./); - expect(err.code).toBe("GENSYNC_OPTIONS_ERROR"); - } - }); - - test("errback callback required", () => { - const fn = gensync({ - sync: throwTestError, - async: throwTestError, - }); - - try { - fn.errback(); - - throwTestError(); - } catch (err) { - expect(err.message).toMatch(/function called without callback/); - expect(err.code).toBe("GENSYNC_ERRBACK_NO_CALLBACK"); - } - }); - }); - - describe("generator function metadata", () => { - test("automatic naming", () => { - expect( - gensync({ - sync: function readFileSync() {}, - async: () => {}, - }).name - ).toBe("readFile"); - expect( - gensync({ - sync: function readFile() {}, - async: () => {}, - }).name - ).toBe("readFile"); - expect( - gensync({ - sync: function readFileAsync() {}, - async: () => {}, - }).name - ).toBe("readFileAsync"); - - expect( - gensync({ - sync: () => {}, - async: function readFileSync() {}, - }).name - ).toBe("readFileSync"); - expect( - gensync({ - sync: () => {}, - async: function readFile() {}, - }).name - ).toBe("readFile"); - expect( - gensync({ - sync: () => {}, - async: function readFileAsync() {}, - }).name - ).toBe("readFile"); - - expect( - gensync({ - sync: () => {}, - errback: function readFileSync() {}, - }).name - ).toBe("readFileSync"); - expect( - gensync({ - sync: () => {}, - errback: function readFile() {}, - }).name - ).toBe("readFile"); - expect( - gensync({ - sync: () => {}, - errback: function readFileAsync() {}, - }).name - ).toBe("readFileAsync"); - }); - - test("explicit naming", () => { - expect( - gensync({ - name: "readFile", - sync: () => {}, - async: () => {}, - }).name - ).toBe("readFile"); - }); - - test("default arity", () => { - expect( - gensync({ - sync: function(a, b, c, d, e, f, g) { - throwTestError(); - }, - async: throwTestError, - }).length - ).toBe(7); - }); - - test("explicit arity", () => { - expect( - gensync({ - arity: 3, - sync: throwTestError, - async: throwTestError, - }).length - ).toBe(3); - }); - }); - - describe("'sync' handler", async () => { - test("success", async () => { - const fn = gensync({ - sync: (...args) => JSON.stringify(args), - }); - - await expectResult(fn, 42, { value: "[42]", expectSync: true }); - }); - - test("failure", async () => { - const fn = gensync({ - sync: (...args) => { - throw JSON.stringify(args); - }, - }); - - await expectResult(fn, 42, { error: "[42]", expectSync: true }); - }); - }); - - describe("'async' handler", async () => { - test("success", async () => { - const fn = gensync({ - sync: throwTestError, - async: (...args) => Promise.resolve(JSON.stringify(args)), - }); - - await expectResult(fn, 42, { value: "[42]" }); - }); - - test("failure", async () => { - const fn = gensync({ - sync: throwTestError, - async: (...args) => Promise.reject(JSON.stringify(args)), - }); - - await expectResult(fn, 42, { error: "[42]" }); - }); - }); - - describe("'errback' sync handler", async () => { - test("success", async () => { - const fn = gensync({ - sync: throwTestError, - errback: (...args) => args.pop()(null, JSON.stringify(args)), - }); - - await expectResult(fn, 42, { value: "[42]", syncErrback: true }); - }); - - test("failure", async () => { - const fn = gensync({ - sync: throwTestError, - errback: (...args) => args.pop()(JSON.stringify(args)), - }); - - await expectResult(fn, 42, { error: "[42]", syncErrback: true }); - }); - }); - - describe("'errback' async handler", async () => { - test("success", async () => { - const fn = gensync({ - sync: throwTestError, - errback: (...args) => - process.nextTick(() => args.pop()(null, JSON.stringify(args))), - }); - - await expectResult(fn, 42, { value: "[42]" }); - }); - - test("failure", async () => { - const fn = gensync({ - sync: throwTestError, - errback: (...args) => - process.nextTick(() => args.pop()(JSON.stringify(args))), - }); - - await expectResult(fn, 42, { error: "[42]" }); - }); - }); -}); - -describe("gensync(function* () {})", () => { - test("sync throw before body", async () => { - const fn = gensync(function*(arg = throwTestError()) {}); - - await expectResult(fn, undefined, { - error: TEST_ERROR, - syncErrback: true, - }); - }); - - test("sync throw inside body", async () => { - const fn = gensync(function*() { - throwTestError(); - }); - - await expectResult(fn, undefined, { - error: TEST_ERROR, - syncErrback: true, - }); - }); - - test("async throw inside body", async () => { - const fn = gensync(function*() { - const val = yield* doSuccess(); - throwTestError(); - }); - - await expectResult(fn, undefined, { - error: TEST_ERROR, - }); - }); - - test("error inside body", async () => { - const fn = gensync(function*() { - yield* doError(); - }); - - await expectResult(fn, undefined, { - error: DID_ERROR, - expectSync: true, - syncErrback: false, - }); - }); - - test("successful return value", async () => { - const fn = gensync(function*() { - const value = yield* doSuccess(); - - expect(value).toBe(42); - - return 84; - }); - - await expectResult(fn, undefined, { - value: 84, - expectSync: true, - syncErrback: false, - }); - }); - - test("successful final value", async () => { - const fn = gensync(function*() { - return 42; - }); - - await expectResult(fn, undefined, { - value: 42, - expectSync: true, - }); - }); - - test("yield unexpected object", async () => { - const fn = gensync(function*() { - yield {}; - }); - - try { - await fn.async(); - - throwTestError(); - } catch (err) { - expect(err.message).toMatch( - /Got unexpected yielded value in gensync generator/ - ); - expect(err.code).toBe("GENSYNC_EXPECTED_START"); - } - }); - - test("yield suspend yield", async () => { - const fn = gensync(function*() { - yield Symbol.for("gensync:v1:start"); - - // Should be "yield*" for no error. - yield {}; - }); - - try { - await fn.async(); - - throwTestError(); - } catch (err) { - expect(err.message).toMatch(/Expected GENSYNC_SUSPEND, got {}/); - expect(err.code).toBe("GENSYNC_EXPECTED_SUSPEND"); - } - }); - - test("yield suspend return", async () => { - const fn = gensync(function*() { - yield Symbol.for("gensync:v1:start"); - - // Should be "yield*" for no error. - return {}; - }); - - try { - await fn.async(); - - throwTestError(); - } catch (err) { - expect(err.message).toMatch(/Unexpected generator completion/); - expect(err.code).toBe("GENSYNC_EXPECTED_SUSPEND"); - } - }); -}); - -describe("gensync.all()", () => { - test("success", async () => { - const fn = gensync(function*() { - const result = yield* gensync.all([doSuccess(), doSuccess()]); - - expect(result).toEqual([42, 42]); - }); - - await expectResult(fn, undefined, { - value: undefined, - expectSync: true, - syncErrback: false, - }); - }); - - test("error first", async () => { - const fn = gensync(function*() { - yield* gensync.all([doError(), doSuccess()]); - }); - - await expectResult(fn, undefined, { - error: DID_ERROR, - expectSync: true, - syncErrback: false, - }); - }); - - test("error last", async () => { - const fn = gensync(function*() { - yield* gensync.all([doSuccess(), doError()]); - }); - - await expectResult(fn, undefined, { - error: DID_ERROR, - expectSync: true, - syncErrback: false, - }); - }); - - test("empty list", async () => { - const fn = gensync(function*() { - yield* gensync.all([]); - }); - - await expectResult(fn, undefined, { - value: undefined, - expectSync: true, - syncErrback: false, - }); - }); -}); - -describe("gensync.race()", () => { - test("success", async () => { - const fn = gensync(function*() { - const result = yield* gensync.race([doSuccess(), doError()]); - - expect(result).toEqual(42); - }); - - await expectResult(fn, undefined, { - value: undefined, - expectSync: true, - syncErrback: false, - }); - }); - - test("error", async () => { - const fn = gensync(function*() { - yield* gensync.race([doError(), doSuccess()]); - }); - - await expectResult(fn, undefined, { - error: DID_ERROR, - expectSync: true, - syncErrback: false, - }); - }); -}); diff --git a/node_modules/get-caller-file/LICENSE.md b/node_modules/get-caller-file/LICENSE.md deleted file mode 100644 index bf3e1c071..000000000 --- a/node_modules/get-caller-file/LICENSE.md +++ /dev/null @@ -1,6 +0,0 @@ -ISC License (ISC) -Copyright 2018 Stefan Penner - -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/get-caller-file/README.md b/node_modules/get-caller-file/README.md deleted file mode 100644 index a7d8c0797..000000000 --- a/node_modules/get-caller-file/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# get-caller-file - -[![Build Status](https://travis-ci.org/stefanpenner/get-caller-file.svg?branch=master)](https://travis-ci.org/stefanpenner/get-caller-file) -[![Build status](https://ci.appveyor.com/api/projects/status/ol2q94g1932cy14a/branch/master?svg=true)](https://ci.appveyor.com/project/embercli/get-caller-file/branch/master) - -This is a utility, which allows a function to figure out from which file it was invoked. It does so by inspecting v8's stack trace at the time it is invoked. - -Inspired by http://stackoverflow.com/questions/13227489 - -*note: this relies on Node/V8 specific APIs, as such other runtimes may not work* - -## Installation - -```bash -yarn add get-caller-file -``` - -## Usage - -Given: - -```js -// ./foo.js -const getCallerFile = require('get-caller-file'); - -module.exports = function() { - return getCallerFile(); // figures out who called it -}; -``` - -```js -// index.js -const foo = require('./foo'); - -foo() // => /full/path/to/this/file/index.js -``` - - -## Options: - -* `getCallerFile(position = 2)`: where position is stack frame whos fileName we want. diff --git a/node_modules/get-caller-file/index.d.ts b/node_modules/get-caller-file/index.d.ts deleted file mode 100644 index babed696a..000000000 --- a/node_modules/get-caller-file/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: (position?: number) => any; -export = _default; diff --git a/node_modules/get-caller-file/index.js b/node_modules/get-caller-file/index.js deleted file mode 100644 index 57304f803..000000000 --- a/node_modules/get-caller-file/index.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -// Call this function in a another function to find out the file from -// which that function was called from. (Inspects the v8 stack trace) -// -// Inspired by http://stackoverflow.com/questions/13227489 -module.exports = function getCallerFile(position) { - if (position === void 0) { position = 2; } - if (position >= Error.stackTraceLimit) { - throw new TypeError('getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `' + position + '` and Error.stackTraceLimit was: `' + Error.stackTraceLimit + '`'); - } - var oldPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = function (_, stack) { return stack; }; - var stack = new Error().stack; - Error.prepareStackTrace = oldPrepareStackTrace; - if (stack !== null && typeof stack === 'object') { - // stack[0] holds this file - // stack[1] holds where this function was called - // stack[2] holds the file we're interested in - return stack[position] ? stack[position].getFileName() : undefined; - } -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/get-caller-file/index.js.map b/node_modules/get-caller-file/index.js.map deleted file mode 100644 index 89c655c06..000000000 --- a/node_modules/get-caller-file/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,qEAAqE;AACrE,EAAE;AACF,0DAA0D;AAE1D,iBAAS,SAAS,aAAa,CAAC,QAAY;IAAZ,yBAAA,EAAA,YAAY;IAC1C,IAAI,QAAQ,IAAI,KAAK,CAAC,eAAe,EAAE;QACrC,MAAM,IAAI,SAAS,CAAC,kGAAkG,GAAG,QAAQ,GAAG,oCAAoC,GAAG,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,CAAC;KACzM;IAED,IAAM,oBAAoB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD,KAAK,CAAC,iBAAiB,GAAG,UAAC,CAAC,EAAE,KAAK,IAAM,OAAA,KAAK,EAAL,CAAK,CAAC;IAC/C,IAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAChC,KAAK,CAAC,iBAAiB,GAAG,oBAAoB,CAAC;IAG/C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC/C,2BAA2B;QAC3B,gDAAgD;QAChD,8CAA8C;QAC9C,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAE,KAAK,CAAC,QAAQ,CAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;KAC7E;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/get-caller-file/package.json b/node_modules/get-caller-file/package.json deleted file mode 100644 index b0dd57139..000000000 --- a/node_modules/get-caller-file/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "get-caller-file", - "version": "2.0.5", - "description": "", - "main": "index.js", - "directories": { - "test": "tests" - }, - "files": [ - "index.js", - "index.js.map", - "index.d.ts" - ], - "scripts": { - "prepare": "tsc", - "test": "mocha test", - "test:debug": "mocha test" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/stefanpenner/get-caller-file.git" - }, - "author": "Stefan Penner", - "license": "ISC", - "bugs": { - "url": "https://github.com/stefanpenner/get-caller-file/issues" - }, - "homepage": "https://github.com/stefanpenner/get-caller-file#readme", - "devDependencies": { - "@types/chai": "^4.1.7", - "@types/ensure-posix-path": "^1.0.0", - "@types/mocha": "^5.2.6", - "@types/node": "^11.10.5", - "chai": "^4.1.2", - "ensure-posix-path": "^1.0.1", - "mocha": "^5.2.0", - "typescript": "^3.3.3333" - }, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } -} diff --git a/node_modules/get-package-type/CHANGELOG.md b/node_modules/get-package-type/CHANGELOG.md deleted file mode 100644 index 5f2c4cc4f..000000000 --- a/node_modules/get-package-type/CHANGELOG.md +++ /dev/null @@ -1,10 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -## 0.1.0 (2020-05-19) - - -### Features - -* Initial implementation ([52863f4](https://github.com/cfware/get-package-type/commit/52863f4b2b7b287fe1adcd97331231a2911312dc)) diff --git a/node_modules/get-package-type/LICENSE b/node_modules/get-package-type/LICENSE deleted file mode 100644 index 971e3b7c2..000000000 --- a/node_modules/get-package-type/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 CFWare, LLC - -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/get-package-type/README.md b/node_modules/get-package-type/README.md deleted file mode 100644 index 8e1ebf235..000000000 --- a/node_modules/get-package-type/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# get-package-type [![NPM Version][npm-image]][npm-url] - -Determine the `package.json#type` which applies to a location. - -## Usage - -```js -const getPackageType = require('get-package-type'); - -(async () => { - console.log(await getPackageType('file.js')); - console.log(getPackageType.sync('file.js')); -})(); -``` - -This function does not validate the value found in `package.json#type`. Any truthy value -found will be returned. Non-truthy values will be reported as `commonjs`. - -The argument must be a filename. -```js -// This never looks at `dir1/`, first attempts to load `./package.json`. -const type1 = await getPackageType('dir1/'); - -// This attempts to load `dir1/package.json`. -const type2 = await getPackageType('dir1/index.cjs'); -``` - -The extension of the filename does not effect the result. The primary use case for this -module is to determine if `myapp.config.js` should be loaded with `require` or `import`. - -[npm-image]: https://img.shields.io/npm/v/get-package-type.svg -[npm-url]: https://npmjs.org/package/get-package-type diff --git a/node_modules/get-package-type/async.cjs b/node_modules/get-package-type/async.cjs deleted file mode 100644 index fa7fd5cd1..000000000 --- a/node_modules/get-package-type/async.cjs +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -const path = require('path'); -const {promisify} = require('util'); -const readFile = promisify(require('fs').readFile); - -const isNodeModules = require('./is-node-modules.cjs'); -const resultsCache = require('./cache.cjs'); - -const promiseCache = new Map(); - -async function getDirectoryTypeActual(directory) { - if (isNodeModules(directory)) { - return 'commonjs'; - } - - try { - return JSON.parse(await readFile(path.resolve(directory, 'package.json'))).type || 'commonjs'; - } catch (_) { - } - - const parent = path.dirname(directory); - if (parent === directory) { - return 'commonjs'; - } - - return getDirectoryType(parent); -} - -async function getDirectoryType(directory) { - if (resultsCache.has(directory)) { - return resultsCache.get(directory); - } - - if (promiseCache.has(directory)) { - return promiseCache.get(directory); - } - - const promise = getDirectoryTypeActual(directory); - promiseCache.set(directory, promise); - const result = await promise; - resultsCache.set(directory, result); - promiseCache.delete(directory); - - return result; -} - -function getPackageType(filename) { - return getDirectoryType(path.resolve(path.dirname(filename))); -} - -module.exports = getPackageType; diff --git a/node_modules/get-package-type/cache.cjs b/node_modules/get-package-type/cache.cjs deleted file mode 100644 index 4fd928aa7..000000000 --- a/node_modules/get-package-type/cache.cjs +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = new Map(); diff --git a/node_modules/get-package-type/index.cjs b/node_modules/get-package-type/index.cjs deleted file mode 100644 index b5b07348d..000000000 --- a/node_modules/get-package-type/index.cjs +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -const getPackageType = require('./async.cjs'); -const getPackageTypeSync = require('./sync.cjs'); - -module.exports = filename => getPackageType(filename); -module.exports.sync = getPackageTypeSync; diff --git a/node_modules/get-package-type/is-node-modules.cjs b/node_modules/get-package-type/is-node-modules.cjs deleted file mode 100644 index 5a37a7758..000000000 --- a/node_modules/get-package-type/is-node-modules.cjs +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -const path = require('path'); - -function isNodeModules(directory) { - let basename = path.basename(directory); - /* istanbul ignore next: platform specific branch */ - if (path.sep === '\\') { - basename = basename.toLowerCase(); - } - - return basename === 'node_modules'; -} - -module.exports = isNodeModules; diff --git a/node_modules/get-package-type/package.json b/node_modules/get-package-type/package.json deleted file mode 100644 index dcb0ea8e8..000000000 --- a/node_modules/get-package-type/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "get-package-type", - "version": "0.1.0", - "description": "Determine the `package.json#type` which applies to a location", - "type": "module", - "main": "index.cjs", - "exports": "./index.cjs", - "scripts": { - "pretest": "if-ver -ge 10 || exit 0; cfware-lint .", - "tests-only": "nyc -s node test.cjs", - "test": "npm run -s tests-only", - "posttest": "nyc report --check-coverage" - }, - "engines": { - "node": ">=8.0.0" - }, - "author": "Corey Farrell", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/cfware/get-package-type.git" - }, - "bugs": { - "url": "https://github.com/cfware/get-package-type/issues" - }, - "homepage": "https://github.com/cfware/get-package-type#readme", - "dependencies": {}, - "devDependencies": { - "@cfware/lint": "^1.4.3", - "@cfware/nyc": "^0.7.0", - "if-ver": "^1.1.0", - "libtap": "^0.3.0", - "nyc": "^15.0.1" - } -} diff --git a/node_modules/get-package-type/sync.cjs b/node_modules/get-package-type/sync.cjs deleted file mode 100644 index 85090a6ee..000000000 --- a/node_modules/get-package-type/sync.cjs +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -const path = require('path'); -const {readFileSync} = require('fs'); - -const isNodeModules = require('./is-node-modules.cjs'); -const resultsCache = require('./cache.cjs'); - -function getDirectoryTypeActual(directory) { - if (isNodeModules(directory)) { - return 'commonjs'; - } - - try { - return JSON.parse(readFileSync(path.resolve(directory, 'package.json'))).type || 'commonjs'; - } catch (_) { - } - - const parent = path.dirname(directory); - if (parent === directory) { - return 'commonjs'; - } - - return getDirectoryType(parent); -} - -function getDirectoryType(directory) { - if (resultsCache.has(directory)) { - return resultsCache.get(directory); - } - - const result = getDirectoryTypeActual(directory); - resultsCache.set(directory, result); - - return result; -} - -function getPackageTypeSync(filename) { - return getDirectoryType(path.resolve(path.dirname(filename))); -} - -module.exports = getPackageTypeSync; diff --git a/node_modules/get-stream/buffer-stream.js b/node_modules/get-stream/buffer-stream.js deleted file mode 100644 index 2dd75745d..000000000 --- a/node_modules/get-stream/buffer-stream.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; -const {PassThrough: PassThroughStream} = require('stream'); - -module.exports = options => { - options = {...options}; - - const {array} = options; - let {encoding} = options; - const isBuffer = encoding === 'buffer'; - let objectMode = false; - - if (array) { - objectMode = !(encoding || isBuffer); - } else { - encoding = encoding || 'utf8'; - } - - if (isBuffer) { - encoding = null; - } - - const stream = new PassThroughStream({objectMode}); - - if (encoding) { - stream.setEncoding(encoding); - } - - let length = 0; - const chunks = []; - - stream.on('data', chunk => { - chunks.push(chunk); - - if (objectMode) { - length = chunks.length; - } else { - length += chunk.length; - } - }); - - stream.getBufferedValue = () => { - if (array) { - return chunks; - } - - return isBuffer ? Buffer.concat(chunks, length) : chunks.join(''); - }; - - stream.getBufferedLength = () => length; - - return stream; -}; diff --git a/node_modules/get-stream/index.d.ts b/node_modules/get-stream/index.d.ts deleted file mode 100644 index 9485b2b6d..000000000 --- a/node_modules/get-stream/index.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -/// -import {Stream} from 'stream'; - -declare class MaxBufferErrorClass extends Error { - readonly name: 'MaxBufferError'; - constructor(); -} - -declare namespace getStream { - interface Options { - /** - Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `MaxBufferError` error. - - @default Infinity - */ - readonly maxBuffer?: number; - } - - interface OptionsWithEncoding extends Options { - /** - [Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. - - @default 'utf8' - */ - readonly encoding?: EncodingType; - } - - type MaxBufferError = MaxBufferErrorClass; -} - -declare const getStream: { - /** - Get the `stream` as a string. - - @returns A promise that resolves when the end event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. - - @example - ``` - import * as fs from 'fs'; - import getStream = require('get-stream'); - - (async () => { - const stream = fs.createReadStream('unicorn.txt'); - - console.log(await getStream(stream)); - // ,,))))))));, - // __)))))))))))))), - // \|/ -\(((((''''((((((((. - // -*-==//////(('' . `)))))), - // /|\ ))| o ;-. '((((( ,(, - // ( `| / ) ;))))' ,_))^;(~ - // | | | ,))((((_ _____------~~~-. %,;(;(>';'~ - // o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ - // ; ''''```` `: `:::|\,__,%% );`'; ~ - // | _ ) / `:|`----' `-' - // ______/\/~ | / / - // /~;;.____/;;' / ___--,-( `;;;/ - // / // _;______;'------~~~~~ /;;/\ / - // // | | / ; \;;,\ - // (<_ | ; /',/-----' _> - // \_| ||_ //~;~~~~~~~~~ - // `\_| (,~~ - // \~\ - // ~~ - })(); - ``` - */ - (stream: Stream, options?: getStream.OptionsWithEncoding): Promise; - - /** - Get the `stream` as a buffer. - - It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. - */ - buffer( - stream: Stream, - options?: getStream.Options - ): Promise; - - /** - Get the `stream` as an array of values. - - It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: - - - When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). - - When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. - - When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. - */ - array( - stream: Stream, - options?: getStream.Options - ): Promise; - array( - stream: Stream, - options: getStream.OptionsWithEncoding<'buffer'> - ): Promise; - array( - stream: Stream, - options: getStream.OptionsWithEncoding - ): Promise; - - MaxBufferError: typeof MaxBufferErrorClass; -}; - -export = getStream; diff --git a/node_modules/get-stream/index.js b/node_modules/get-stream/index.js deleted file mode 100644 index 1c5d02860..000000000 --- a/node_modules/get-stream/index.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; -const {constants: BufferConstants} = require('buffer'); -const stream = require('stream'); -const {promisify} = require('util'); -const bufferStream = require('./buffer-stream'); - -const streamPipelinePromisified = promisify(stream.pipeline); - -class MaxBufferError extends Error { - constructor() { - super('maxBuffer exceeded'); - this.name = 'MaxBufferError'; - } -} - -async function getStream(inputStream, options) { - if (!inputStream) { - throw new Error('Expected a stream'); - } - - options = { - maxBuffer: Infinity, - ...options - }; - - const {maxBuffer} = options; - const stream = bufferStream(options); - - await new Promise((resolve, reject) => { - const rejectPromise = error => { - // Don't retrieve an oversized buffer. - if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) { - error.bufferedData = stream.getBufferedValue(); - } - - reject(error); - }; - - (async () => { - try { - await streamPipelinePromisified(inputStream, stream); - resolve(); - } catch (error) { - rejectPromise(error); - } - })(); - - stream.on('data', () => { - if (stream.getBufferedLength() > maxBuffer) { - rejectPromise(new MaxBufferError()); - } - }); - }); - - return stream.getBufferedValue(); -} - -module.exports = getStream; -module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'}); -module.exports.array = (stream, options) => getStream(stream, {...options, array: true}); -module.exports.MaxBufferError = MaxBufferError; diff --git a/node_modules/get-stream/license b/node_modules/get-stream/license deleted file mode 100644 index fa7ceba3e..000000000 --- a/node_modules/get-stream/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://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/get-stream/package.json b/node_modules/get-stream/package.json deleted file mode 100644 index bd47a75f9..000000000 --- a/node_modules/get-stream/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "get-stream", - "version": "6.0.1", - "description": "Get a stream as a string, buffer, or array", - "license": "MIT", - "repository": "sindresorhus/get-stream", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts", - "buffer-stream.js" - ], - "keywords": [ - "get", - "stream", - "promise", - "concat", - "string", - "text", - "buffer", - "read", - "data", - "consume", - "readable", - "readablestream", - "array", - "object" - ], - "devDependencies": { - "@types/node": "^14.0.27", - "ava": "^2.4.0", - "into-stream": "^5.0.0", - "tsd": "^0.13.1", - "xo": "^0.24.0" - } -} diff --git a/node_modules/get-stream/readme.md b/node_modules/get-stream/readme.md deleted file mode 100644 index 70b01fd16..000000000 --- a/node_modules/get-stream/readme.md +++ /dev/null @@ -1,124 +0,0 @@ -# get-stream - -> Get a stream as a string, buffer, or array - -## Install - -``` -$ npm install get-stream -``` - -## Usage - -```js -const fs = require('fs'); -const getStream = require('get-stream'); - -(async () => { - const stream = fs.createReadStream('unicorn.txt'); - - console.log(await getStream(stream)); - /* - ,,))))))));, - __)))))))))))))), - \|/ -\(((((''''((((((((. - -*-==//////(('' . `)))))), - /|\ ))| o ;-. '((((( ,(, - ( `| / ) ;))))' ,_))^;(~ - | | | ,))((((_ _____------~~~-. %,;(;(>';'~ - o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ - ; ''''```` `: `:::|\,__,%% );`'; ~ - | _ ) / `:|`----' `-' - ______/\/~ | / / - /~;;.____/;;' / ___--,-( `;;;/ - / // _;______;'------~~~~~ /;;/\ / - // | | / ; \;;,\ - (<_ | ; /',/-----' _> - \_| ||_ //~;~~~~~~~~~ - `\_| (,~~ - \~\ - ~~ - */ -})(); -``` - -## API - -The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. - -### getStream(stream, options?) - -Get the `stream` as a string. - -#### options - -Type: `object` - -##### encoding - -Type: `string`\ -Default: `'utf8'` - -[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. - -##### maxBuffer - -Type: `number`\ -Default: `Infinity` - -Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `getStream.MaxBufferError` error. - -### getStream.buffer(stream, options?) - -Get the `stream` as a buffer. - -It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. - -### getStream.array(stream, options?) - -Get the `stream` as an array of values. - -It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: - -- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). - -- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. - -- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. - -## Errors - -If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error. - -```js -(async () => { - try { - await getStream(streamThatErrorsAtTheEnd('unicorn')); - } catch (error) { - console.log(error.bufferedData); - //=> 'unicorn' - } -})() -``` - -## FAQ - -### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)? - -This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package. - -## Related - -- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/glob-parent/LICENSE b/node_modules/glob-parent/LICENSE deleted file mode 100644 index d701b0832..000000000 --- a/node_modules/glob-parent/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2015, 2019 Elan Shanker, 2021 Blaine Bublitz , Eric Schoffstall and other 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/glob-parent/README.md b/node_modules/glob-parent/README.md deleted file mode 100644 index 6ae18a1a0..000000000 --- a/node_modules/glob-parent/README.md +++ /dev/null @@ -1,134 +0,0 @@ -

- - - -

- -# glob-parent - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Extract the non-magic parent path from a glob string. - -## Usage - -```js -var globParent = require('glob-parent'); - -globParent('path/to/*.js'); // 'path/to' -globParent('/root/path/to/*.js'); // '/root/path/to' -globParent('/*.js'); // '/' -globParent('*.js'); // '.' -globParent('**/*.js'); // '.' -globParent('path/{to,from}'); // 'path' -globParent('path/!(to|from)'); // 'path' -globParent('path/?(to|from)'); // 'path' -globParent('path/+(to|from)'); // 'path' -globParent('path/*(to|from)'); // 'path' -globParent('path/@(to|from)'); // 'path' -globParent('path/**/*'); // 'path' - -// if provided a non-glob path, returns the nearest dir -globParent('path/foo/bar.js'); // 'path/foo' -globParent('path/foo/'); // 'path/foo' -globParent('path/foo'); // 'path' (see issue #3 for details) -``` - -## API - -### `globParent(maybeGlobString, [options])` - -Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below. - -#### options - -```js -{ - // Disables the automatic conversion of slashes for Windows - flipBackslashes: true; -} -``` - -## Escaping - -The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: - -- `?` (question mark) unless used as a path segment alone -- `*` (asterisk) -- `|` (pipe) -- `(` (opening parenthesis) -- `)` (closing parenthesis) -- `{` (opening curly brace) -- `}` (closing curly brace) -- `[` (opening bracket) -- `]` (closing bracket) - -**Example** - -```js -globParent('foo/[bar]/'); // 'foo' -globParent('foo/\\[bar]/'); // 'foo/[bar]' -``` - -## Limitations - -### Braces & Brackets - -This library attempts a quick and imperfect method of determining which path -parts have glob magic without fully parsing/lexing the pattern. There are some -advanced use cases that can trip it up, such as nested braces where the outer -pair is escaped and the inner one contains a path separator. If you find -yourself in the unlikely circumstance of being affected by this or need to -ensure higher-fidelity glob handling in your library, it is recommended that you -pre-process your input with [expand-braces] and/or [expand-brackets]. - -### Windows - -Backslashes are not valid path separators for globs. If a path with backslashes -is provided anyway, for simple cases, glob-parent will replace the path -separator for you and return the non-glob parent path (now with -forward-slashes, which are still valid as Windows path separators). - -This cannot be used in conjunction with escape characters. - -```js -// BAD -globParent('C:\\Program Files \\(x86\\)\\*.ext'); // 'C:/Program Files /(x86/)' - -// GOOD -globParent('C:/Program Files\\(x86\\)/*.ext'); // 'C:/Program Files (x86)' -``` - -If you are using escape characters for a pattern without path parts (i.e. -relative to `cwd`), prefix with `./` to avoid confusing glob-parent. - -```js -// BAD -globParent('foo \\[bar]'); // 'foo ' -globParent('foo \\[bar]*'); // 'foo ' - -// GOOD -globParent('./foo \\[bar]'); // 'foo [bar]' -globParent('./foo \\[bar]*'); // '.' -``` - -## License - -ISC - - -[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/glob-parent -[npm-image]: https://img.shields.io/npm/v/glob-parent.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/glob-parent/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/glob-parent/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg?style=flat-square - - - -[expand-braces]: https://github.com/jonschlinkert/expand-braces -[expand-brackets]: https://github.com/jonschlinkert/expand-brackets - diff --git a/node_modules/glob-parent/index.js b/node_modules/glob-parent/index.js deleted file mode 100644 index 09dde64ba..000000000 --- a/node_modules/glob-parent/index.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; - -var isGlob = require('is-glob'); -var pathPosixDirname = require('path').posix.dirname; -var isWin32 = require('os').platform() === 'win32'; - -var slash = '/'; -var backslash = /\\/g; -var escaped = /\\([!*?|[\](){}])/g; - -/** - * @param {string} str - * @param {Object} opts - * @param {boolean} [opts.flipBackslashes=true] - */ -module.exports = function globParent(str, opts) { - var options = Object.assign({ flipBackslashes: true }, opts); - - // flip windows path separators - if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { - str = str.replace(backslash, slash); - } - - // special case for strings ending in enclosure containing path separator - if (isEnclosure(str)) { - str += slash; - } - - // preserves full path in case of trailing path separator - str += 'a'; - - // remove path parts that are globby - do { - str = pathPosixDirname(str); - } while (isGlobby(str)); - - // remove escape chars and return result - return str.replace(escaped, '$1'); -}; - -function isEnclosure(str) { - var lastChar = str.slice(-1); - - var enclosureStart; - switch (lastChar) { - case '}': - enclosureStart = '{'; - break; - case ']': - enclosureStart = '['; - break; - default: - return false; - } - - var foundIndex = str.indexOf(enclosureStart); - if (foundIndex < 0) { - return false; - } - - return str.slice(foundIndex + 1, -1).includes(slash); -} - -function isGlobby(str) { - if (/\([^()]+$/.test(str)) { - return true; - } - if (str[0] === '{' || str[0] === '[') { - return true; - } - if (/[^\\][{[]/.test(str)) { - return true; - } - return isGlob(str); -} diff --git a/node_modules/glob-parent/package.json b/node_modules/glob-parent/package.json deleted file mode 100644 index baeab4217..000000000 --- a/node_modules/glob-parent/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "glob-parent", - "version": "6.0.2", - "description": "Extract the non-magic parent path from a glob string.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Elan Shanker (https://github.com/es128)", - "Blaine Bublitz " - ], - "repository": "gulpjs/glob-parent", - "license": "ISC", - "engines": { - "node": ">=10.13.0" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": { - "is-glob": "^4.0.3" - }, - "devDependencies": { - "eslint": "^7.0.0", - "eslint-config-gulp": "^5.0.0", - "expect": "^26.0.1", - "mocha": "^7.1.2", - "nyc": "^15.0.1" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "glob", - "parent", - "strip", - "path", - "dirname", - "directory", - "base", - "wildcard" - ] -} diff --git a/node_modules/glob/LICENSE b/node_modules/glob/LICENSE deleted file mode 100644 index 42ca266df..000000000 --- a/node_modules/glob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 83f0c83a0..000000000 --- a/node_modules/glob/README.md +++ /dev/null @@ -1,378 +0,0 @@ -# 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. - -![a fun cartoon logo made of glob characters](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. -* `fs` File-system object with Node's `fs` API. By default, the built-in - `fs` module will be used. Set to a volume provided by a library like - `memfs` to avoid using the "real" file-system. - -## 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/common.js b/node_modules/glob/common.js deleted file mode 100644 index 424c46e1d..000000000 --- a/node_modules/glob/common.js +++ /dev/null @@ -1,238 +0,0 @@ -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 fs = require("fs") -var path = require("path") -var minimatch = require("minimatch") -var isAbsolute = require("path-is-absolute") -var Minimatch = minimatch.Minimatch - -function alphasort (a, b) { - return a.localeCompare(b, 'en') -} - -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.fs = options.fs || fs - - 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 - // always treat \ in patterns as escapes, not path separators - options.allowWindowsEscape = false - - 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(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 deleted file mode 100644 index 37a4d7e60..000000000 --- a/node_modules/glob/glob.js +++ /dev/null @@ -1,790 +0,0 @@ -// 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 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 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.map(function (p) { - return typeof p === 'string' ? p : '[*]' - }).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) - self.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 - self.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) - self.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 self.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 deleted file mode 100644 index 5940b649b..000000000 --- a/node_modules/glob/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "name": "glob", - "description": "a little globber", - "version": "7.2.3", - "publishConfig": { - "tag": "v7-legacy" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/node-glob.git" - }, - "main": "glob.js", - "files": [ - "glob.js", - "sync.js", - "common.js" - ], - "engines": { - "node": "*" - }, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "devDependencies": { - "memfs": "^3.2.0", - "mkdirp": "0", - "rimraf": "^2.2.8", - "tap": "^15.0.6", - "tick": "0.0.6" - }, - "tap": { - "before": "test/00-setup.js", - "after": "test/zz-cleanup.js", - "jobs": 1 - }, - "scripts": { - "prepublish": "npm run benchclean", - "profclean": "rm -f v8.log profile.txt", - "test": "tap", - "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", - "bench": "bash benchmark.sh", - "prof": "bash prof.sh && cat profile.txt", - "benchclean": "node benchclean.js" - }, - "license": "ISC", - "funding": { - "url": "https://github.com/sponsors/isaacs" - } -} diff --git a/node_modules/glob/sync.js b/node_modules/glob/sync.js deleted file mode 100644 index 2c4f48019..000000000 --- a/node_modules/glob/sync.js +++ /dev/null @@ -1,486 +0,0 @@ -module.exports = globSync -globSync.GlobSync = GlobSync - -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 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.ok(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.ok(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.map(function (p) { - return typeof p === 'string' ? p : '[*]' - }).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 = this.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, this.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 = this.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 = this.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/globals/globals.json b/node_modules/globals/globals.json deleted file mode 100644 index c8460073c..000000000 --- a/node_modules/globals/globals.json +++ /dev/null @@ -1,1814 +0,0 @@ -{ - "builtin": { - "AggregateError": false, - "Array": false, - "ArrayBuffer": false, - "Atomics": false, - "BigInt": false, - "BigInt64Array": false, - "BigUint64Array": false, - "Boolean": false, - "constructor": false, - "DataView": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "FinalizationRegistry": false, - "Float32Array": false, - "Float64Array": false, - "Function": false, - "globalThis": false, - "hasOwnProperty": false, - "Infinity": false, - "Int16Array": false, - "Int32Array": false, - "Int8Array": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Map": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "Promise": false, - "propertyIsEnumerable": false, - "Proxy": false, - "RangeError": false, - "ReferenceError": false, - "Reflect": false, - "RegExp": false, - "Set": false, - "SharedArrayBuffer": false, - "String": false, - "Symbol": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "Uint16Array": false, - "Uint32Array": false, - "Uint8Array": false, - "Uint8ClampedArray": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false, - "WeakMap": false, - "WeakRef": false, - "WeakSet": false - }, - "es5": { - "Array": false, - "Boolean": false, - "constructor": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "Function": false, - "hasOwnProperty": false, - "Infinity": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "propertyIsEnumerable": false, - "RangeError": false, - "ReferenceError": false, - "RegExp": false, - "String": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false - }, - "es2015": { - "Array": false, - "ArrayBuffer": false, - "Boolean": false, - "constructor": false, - "DataView": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "Float32Array": false, - "Float64Array": false, - "Function": false, - "hasOwnProperty": false, - "Infinity": false, - "Int16Array": false, - "Int32Array": false, - "Int8Array": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Map": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "Promise": false, - "propertyIsEnumerable": false, - "Proxy": false, - "RangeError": false, - "ReferenceError": false, - "Reflect": false, - "RegExp": false, - "Set": false, - "String": false, - "Symbol": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "Uint16Array": false, - "Uint32Array": false, - "Uint8Array": false, - "Uint8ClampedArray": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false, - "WeakMap": false, - "WeakSet": false - }, - "es2017": { - "Array": false, - "ArrayBuffer": false, - "Atomics": false, - "Boolean": false, - "constructor": false, - "DataView": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "Float32Array": false, - "Float64Array": false, - "Function": false, - "hasOwnProperty": false, - "Infinity": false, - "Int16Array": false, - "Int32Array": false, - "Int8Array": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Map": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "Promise": false, - "propertyIsEnumerable": false, - "Proxy": false, - "RangeError": false, - "ReferenceError": false, - "Reflect": false, - "RegExp": false, - "Set": false, - "SharedArrayBuffer": false, - "String": false, - "Symbol": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "Uint16Array": false, - "Uint32Array": false, - "Uint8Array": false, - "Uint8ClampedArray": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false, - "WeakMap": false, - "WeakSet": false - }, - "es2020": { - "Array": false, - "ArrayBuffer": false, - "Atomics": false, - "BigInt": false, - "BigInt64Array": false, - "BigUint64Array": false, - "Boolean": false, - "constructor": false, - "DataView": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "Float32Array": false, - "Float64Array": false, - "Function": false, - "globalThis": false, - "hasOwnProperty": false, - "Infinity": false, - "Int16Array": false, - "Int32Array": false, - "Int8Array": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Map": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "Promise": false, - "propertyIsEnumerable": false, - "Proxy": false, - "RangeError": false, - "ReferenceError": false, - "Reflect": false, - "RegExp": false, - "Set": false, - "SharedArrayBuffer": false, - "String": false, - "Symbol": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "Uint16Array": false, - "Uint32Array": false, - "Uint8Array": false, - "Uint8ClampedArray": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false, - "WeakMap": false, - "WeakSet": false - }, - "es2021": { - "AggregateError": false, - "Array": false, - "ArrayBuffer": false, - "Atomics": false, - "BigInt": false, - "BigInt64Array": false, - "BigUint64Array": false, - "Boolean": false, - "constructor": false, - "DataView": false, - "Date": false, - "decodeURI": false, - "decodeURIComponent": false, - "encodeURI": false, - "encodeURIComponent": false, - "Error": false, - "escape": false, - "eval": false, - "EvalError": false, - "FinalizationRegistry": false, - "Float32Array": false, - "Float64Array": false, - "Function": false, - "globalThis": false, - "hasOwnProperty": false, - "Infinity": false, - "Int16Array": false, - "Int32Array": false, - "Int8Array": false, - "isFinite": false, - "isNaN": false, - "isPrototypeOf": false, - "JSON": false, - "Map": false, - "Math": false, - "NaN": false, - "Number": false, - "Object": false, - "parseFloat": false, - "parseInt": false, - "Promise": false, - "propertyIsEnumerable": false, - "Proxy": false, - "RangeError": false, - "ReferenceError": false, - "Reflect": false, - "RegExp": false, - "Set": false, - "SharedArrayBuffer": false, - "String": false, - "Symbol": false, - "SyntaxError": false, - "toLocaleString": false, - "toString": false, - "TypeError": false, - "Uint16Array": false, - "Uint32Array": false, - "Uint8Array": false, - "Uint8ClampedArray": false, - "undefined": false, - "unescape": false, - "URIError": false, - "valueOf": false, - "WeakMap": false, - "WeakRef": false, - "WeakSet": false - }, - "browser": { - "AbortController": false, - "AbortSignal": false, - "addEventListener": false, - "alert": false, - "AnalyserNode": false, - "Animation": false, - "AnimationEffectReadOnly": false, - "AnimationEffectTiming": false, - "AnimationEffectTimingReadOnly": false, - "AnimationEvent": false, - "AnimationPlaybackEvent": false, - "AnimationTimeline": false, - "applicationCache": false, - "ApplicationCache": false, - "ApplicationCacheErrorEvent": false, - "atob": false, - "Attr": false, - "Audio": false, - "AudioBuffer": false, - "AudioBufferSourceNode": false, - "AudioContext": false, - "AudioDestinationNode": false, - "AudioListener": false, - "AudioNode": false, - "AudioParam": false, - "AudioProcessingEvent": false, - "AudioScheduledSourceNode": false, - "AudioWorkletGlobalScope": false, - "AudioWorkletNode": false, - "AudioWorkletProcessor": false, - "BarProp": false, - "BaseAudioContext": false, - "BatteryManager": false, - "BeforeUnloadEvent": false, - "BiquadFilterNode": false, - "Blob": false, - "BlobEvent": false, - "blur": false, - "BroadcastChannel": false, - "btoa": false, - "BudgetService": false, - "ByteLengthQueuingStrategy": false, - "Cache": false, - "caches": false, - "CacheStorage": false, - "cancelAnimationFrame": false, - "cancelIdleCallback": false, - "CanvasCaptureMediaStreamTrack": false, - "CanvasGradient": false, - "CanvasPattern": false, - "CanvasRenderingContext2D": false, - "ChannelMergerNode": false, - "ChannelSplitterNode": false, - "CharacterData": false, - "clearInterval": false, - "clearTimeout": false, - "clientInformation": false, - "ClipboardEvent": false, - "ClipboardItem": false, - "close": false, - "closed": false, - "CloseEvent": false, - "Comment": false, - "CompositionEvent": false, - "confirm": false, - "console": false, - "ConstantSourceNode": false, - "ConvolverNode": false, - "CountQueuingStrategy": false, - "createImageBitmap": false, - "Credential": false, - "CredentialsContainer": false, - "crypto": false, - "Crypto": false, - "CryptoKey": false, - "CSS": false, - "CSSConditionRule": false, - "CSSFontFaceRule": false, - "CSSGroupingRule": false, - "CSSImportRule": false, - "CSSKeyframeRule": false, - "CSSKeyframesRule": false, - "CSSMatrixComponent": false, - "CSSMediaRule": false, - "CSSNamespaceRule": false, - "CSSPageRule": false, - "CSSPerspective": false, - "CSSRotate": false, - "CSSRule": false, - "CSSRuleList": false, - "CSSScale": false, - "CSSSkew": false, - "CSSSkewX": false, - "CSSSkewY": false, - "CSSStyleDeclaration": false, - "CSSStyleRule": false, - "CSSStyleSheet": false, - "CSSSupportsRule": false, - "CSSTransformValue": false, - "CSSTranslate": false, - "CustomElementRegistry": false, - "customElements": false, - "CustomEvent": false, - "DataTransfer": false, - "DataTransferItem": false, - "DataTransferItemList": false, - "defaultstatus": false, - "defaultStatus": false, - "DelayNode": false, - "DeviceMotionEvent": false, - "DeviceOrientationEvent": false, - "devicePixelRatio": false, - "dispatchEvent": false, - "document": false, - "Document": false, - "DocumentFragment": false, - "DocumentType": false, - "DOMError": false, - "DOMException": false, - "DOMImplementation": false, - "DOMMatrix": false, - "DOMMatrixReadOnly": false, - "DOMParser": false, - "DOMPoint": false, - "DOMPointReadOnly": false, - "DOMQuad": false, - "DOMRect": false, - "DOMRectList": false, - "DOMRectReadOnly": false, - "DOMStringList": false, - "DOMStringMap": false, - "DOMTokenList": false, - "DragEvent": false, - "DynamicsCompressorNode": false, - "Element": false, - "ErrorEvent": false, - "event": false, - "Event": false, - "EventSource": false, - "EventTarget": false, - "external": false, - "fetch": false, - "File": false, - "FileList": false, - "FileReader": false, - "find": false, - "focus": false, - "FocusEvent": false, - "FontFace": false, - "FontFaceSetLoadEvent": false, - "FormData": false, - "FormDataEvent": false, - "frameElement": false, - "frames": false, - "GainNode": false, - "Gamepad": false, - "GamepadButton": false, - "GamepadEvent": false, - "getComputedStyle": false, - "getSelection": false, - "HashChangeEvent": false, - "Headers": false, - "history": false, - "History": false, - "HTMLAllCollection": false, - "HTMLAnchorElement": false, - "HTMLAreaElement": false, - "HTMLAudioElement": false, - "HTMLBaseElement": false, - "HTMLBodyElement": false, - "HTMLBRElement": false, - "HTMLButtonElement": false, - "HTMLCanvasElement": false, - "HTMLCollection": false, - "HTMLContentElement": false, - "HTMLDataElement": false, - "HTMLDataListElement": false, - "HTMLDetailsElement": false, - "HTMLDialogElement": false, - "HTMLDirectoryElement": false, - "HTMLDivElement": false, - "HTMLDListElement": false, - "HTMLDocument": false, - "HTMLElement": false, - "HTMLEmbedElement": false, - "HTMLFieldSetElement": false, - "HTMLFontElement": false, - "HTMLFormControlsCollection": false, - "HTMLFormElement": false, - "HTMLFrameElement": false, - "HTMLFrameSetElement": false, - "HTMLHeadElement": false, - "HTMLHeadingElement": false, - "HTMLHRElement": false, - "HTMLHtmlElement": false, - "HTMLIFrameElement": false, - "HTMLImageElement": false, - "HTMLInputElement": false, - "HTMLLabelElement": false, - "HTMLLegendElement": false, - "HTMLLIElement": false, - "HTMLLinkElement": false, - "HTMLMapElement": false, - "HTMLMarqueeElement": false, - "HTMLMediaElement": false, - "HTMLMenuElement": false, - "HTMLMetaElement": false, - "HTMLMeterElement": false, - "HTMLModElement": false, - "HTMLObjectElement": false, - "HTMLOListElement": false, - "HTMLOptGroupElement": false, - "HTMLOptionElement": false, - "HTMLOptionsCollection": false, - "HTMLOutputElement": false, - "HTMLParagraphElement": false, - "HTMLParamElement": false, - "HTMLPictureElement": false, - "HTMLPreElement": false, - "HTMLProgressElement": false, - "HTMLQuoteElement": false, - "HTMLScriptElement": false, - "HTMLSelectElement": false, - "HTMLShadowElement": false, - "HTMLSlotElement": false, - "HTMLSourceElement": false, - "HTMLSpanElement": false, - "HTMLStyleElement": false, - "HTMLTableCaptionElement": false, - "HTMLTableCellElement": false, - "HTMLTableColElement": false, - "HTMLTableElement": false, - "HTMLTableRowElement": false, - "HTMLTableSectionElement": false, - "HTMLTemplateElement": false, - "HTMLTextAreaElement": false, - "HTMLTimeElement": false, - "HTMLTitleElement": false, - "HTMLTrackElement": false, - "HTMLUListElement": false, - "HTMLUnknownElement": false, - "HTMLVideoElement": false, - "IDBCursor": false, - "IDBCursorWithValue": false, - "IDBDatabase": false, - "IDBFactory": false, - "IDBIndex": false, - "IDBKeyRange": false, - "IDBObjectStore": false, - "IDBOpenDBRequest": false, - "IDBRequest": false, - "IDBTransaction": false, - "IDBVersionChangeEvent": false, - "IdleDeadline": false, - "IIRFilterNode": false, - "Image": false, - "ImageBitmap": false, - "ImageBitmapRenderingContext": false, - "ImageCapture": false, - "ImageData": false, - "indexedDB": false, - "innerHeight": false, - "innerWidth": false, - "InputEvent": false, - "IntersectionObserver": false, - "IntersectionObserverEntry": false, - "Intl": false, - "isSecureContext": false, - "KeyboardEvent": false, - "KeyframeEffect": false, - "KeyframeEffectReadOnly": false, - "length": false, - "localStorage": false, - "location": true, - "Location": false, - "locationbar": false, - "matchMedia": false, - "MediaDeviceInfo": false, - "MediaDevices": false, - "MediaElementAudioSourceNode": false, - "MediaEncryptedEvent": false, - "MediaError": false, - "MediaKeyMessageEvent": false, - "MediaKeySession": false, - "MediaKeyStatusMap": false, - "MediaKeySystemAccess": false, - "MediaList": false, - "MediaMetadata": false, - "MediaQueryList": false, - "MediaQueryListEvent": false, - "MediaRecorder": false, - "MediaSettingsRange": false, - "MediaSource": false, - "MediaStream": false, - "MediaStreamAudioDestinationNode": false, - "MediaStreamAudioSourceNode": false, - "MediaStreamEvent": false, - "MediaStreamTrack": false, - "MediaStreamTrackEvent": false, - "menubar": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "MIDIAccess": false, - "MIDIConnectionEvent": false, - "MIDIInput": false, - "MIDIInputMap": false, - "MIDIMessageEvent": false, - "MIDIOutput": false, - "MIDIOutputMap": false, - "MIDIPort": false, - "MimeType": false, - "MimeTypeArray": false, - "MouseEvent": false, - "moveBy": false, - "moveTo": false, - "MutationEvent": false, - "MutationObserver": false, - "MutationRecord": false, - "name": false, - "NamedNodeMap": false, - "NavigationPreloadManager": false, - "navigator": false, - "Navigator": false, - "NavigatorUAData": false, - "NetworkInformation": false, - "Node": false, - "NodeFilter": false, - "NodeIterator": false, - "NodeList": false, - "Notification": false, - "OfflineAudioCompletionEvent": false, - "OfflineAudioContext": false, - "offscreenBuffering": false, - "OffscreenCanvas": true, - "OffscreenCanvasRenderingContext2D": false, - "onabort": true, - "onafterprint": true, - "onanimationend": true, - "onanimationiteration": true, - "onanimationstart": true, - "onappinstalled": true, - "onauxclick": true, - "onbeforeinstallprompt": true, - "onbeforeprint": true, - "onbeforeunload": true, - "onblur": true, - "oncancel": true, - "oncanplay": true, - "oncanplaythrough": true, - "onchange": true, - "onclick": true, - "onclose": true, - "oncontextmenu": true, - "oncuechange": true, - "ondblclick": true, - "ondevicemotion": true, - "ondeviceorientation": true, - "ondeviceorientationabsolute": true, - "ondrag": true, - "ondragend": true, - "ondragenter": true, - "ondragleave": true, - "ondragover": true, - "ondragstart": true, - "ondrop": true, - "ondurationchange": true, - "onemptied": true, - "onended": true, - "onerror": true, - "onfocus": true, - "ongotpointercapture": true, - "onhashchange": true, - "oninput": true, - "oninvalid": true, - "onkeydown": true, - "onkeypress": true, - "onkeyup": true, - "onlanguagechange": true, - "onload": true, - "onloadeddata": true, - "onloadedmetadata": true, - "onloadstart": true, - "onlostpointercapture": true, - "onmessage": true, - "onmessageerror": true, - "onmousedown": true, - "onmouseenter": true, - "onmouseleave": true, - "onmousemove": true, - "onmouseout": true, - "onmouseover": true, - "onmouseup": true, - "onmousewheel": true, - "onoffline": true, - "ononline": true, - "onpagehide": true, - "onpageshow": true, - "onpause": true, - "onplay": true, - "onplaying": true, - "onpointercancel": true, - "onpointerdown": true, - "onpointerenter": true, - "onpointerleave": true, - "onpointermove": true, - "onpointerout": true, - "onpointerover": true, - "onpointerup": true, - "onpopstate": true, - "onprogress": true, - "onratechange": true, - "onrejectionhandled": true, - "onreset": true, - "onresize": true, - "onscroll": true, - "onsearch": true, - "onseeked": true, - "onseeking": true, - "onselect": true, - "onstalled": true, - "onstorage": true, - "onsubmit": true, - "onsuspend": true, - "ontimeupdate": true, - "ontoggle": true, - "ontransitionend": true, - "onunhandledrejection": true, - "onunload": true, - "onvolumechange": true, - "onwaiting": true, - "onwheel": true, - "open": false, - "openDatabase": false, - "opener": false, - "Option": false, - "origin": false, - "OscillatorNode": false, - "outerHeight": false, - "outerWidth": false, - "OverconstrainedError": false, - "PageTransitionEvent": false, - "pageXOffset": false, - "pageYOffset": false, - "PannerNode": false, - "parent": false, - "Path2D": false, - "PaymentAddress": false, - "PaymentRequest": false, - "PaymentRequestUpdateEvent": false, - "PaymentResponse": false, - "performance": false, - "Performance": false, - "PerformanceEntry": false, - "PerformanceLongTaskTiming": false, - "PerformanceMark": false, - "PerformanceMeasure": false, - "PerformanceNavigation": false, - "PerformanceNavigationTiming": false, - "PerformanceObserver": false, - "PerformanceObserverEntryList": false, - "PerformancePaintTiming": false, - "PerformanceResourceTiming": false, - "PerformanceTiming": false, - "PeriodicWave": false, - "Permissions": false, - "PermissionStatus": false, - "personalbar": false, - "PhotoCapabilities": false, - "Plugin": false, - "PluginArray": false, - "PointerEvent": false, - "PopStateEvent": false, - "postMessage": false, - "Presentation": false, - "PresentationAvailability": false, - "PresentationConnection": false, - "PresentationConnectionAvailableEvent": false, - "PresentationConnectionCloseEvent": false, - "PresentationConnectionList": false, - "PresentationReceiver": false, - "PresentationRequest": false, - "print": false, - "ProcessingInstruction": false, - "ProgressEvent": false, - "PromiseRejectionEvent": false, - "prompt": false, - "PushManager": false, - "PushSubscription": false, - "PushSubscriptionOptions": false, - "queueMicrotask": false, - "RadioNodeList": false, - "Range": false, - "ReadableStream": false, - "registerProcessor": false, - "RemotePlayback": false, - "removeEventListener": false, - "reportError": false, - "Request": false, - "requestAnimationFrame": false, - "requestIdleCallback": false, - "resizeBy": false, - "ResizeObserver": false, - "ResizeObserverEntry": false, - "resizeTo": false, - "Response": false, - "RTCCertificate": false, - "RTCDataChannel": false, - "RTCDataChannelEvent": false, - "RTCDtlsTransport": false, - "RTCIceCandidate": false, - "RTCIceGatherer": false, - "RTCIceTransport": false, - "RTCPeerConnection": false, - "RTCPeerConnectionIceEvent": false, - "RTCRtpContributingSource": false, - "RTCRtpReceiver": false, - "RTCRtpSender": false, - "RTCSctpTransport": false, - "RTCSessionDescription": false, - "RTCStatsReport": false, - "RTCTrackEvent": false, - "screen": false, - "Screen": false, - "screenLeft": false, - "ScreenOrientation": false, - "screenTop": false, - "screenX": false, - "screenY": false, - "ScriptProcessorNode": false, - "scroll": false, - "scrollbars": false, - "scrollBy": false, - "scrollTo": false, - "scrollX": false, - "scrollY": false, - "SecurityPolicyViolationEvent": false, - "Selection": false, - "self": false, - "ServiceWorker": false, - "ServiceWorkerContainer": false, - "ServiceWorkerRegistration": false, - "sessionStorage": false, - "setInterval": false, - "setTimeout": false, - "ShadowRoot": false, - "SharedWorker": false, - "SourceBuffer": false, - "SourceBufferList": false, - "speechSynthesis": false, - "SpeechSynthesisEvent": false, - "SpeechSynthesisUtterance": false, - "StaticRange": false, - "status": false, - "statusbar": false, - "StereoPannerNode": false, - "stop": false, - "Storage": false, - "StorageEvent": false, - "StorageManager": false, - "structuredClone": false, - "styleMedia": false, - "StyleSheet": false, - "StyleSheetList": false, - "SubmitEvent": false, - "SubtleCrypto": false, - "SVGAElement": false, - "SVGAngle": false, - "SVGAnimatedAngle": false, - "SVGAnimatedBoolean": false, - "SVGAnimatedEnumeration": false, - "SVGAnimatedInteger": false, - "SVGAnimatedLength": false, - "SVGAnimatedLengthList": false, - "SVGAnimatedNumber": false, - "SVGAnimatedNumberList": false, - "SVGAnimatedPreserveAspectRatio": false, - "SVGAnimatedRect": false, - "SVGAnimatedString": false, - "SVGAnimatedTransformList": false, - "SVGAnimateElement": false, - "SVGAnimateMotionElement": false, - "SVGAnimateTransformElement": false, - "SVGAnimationElement": false, - "SVGCircleElement": false, - "SVGClipPathElement": false, - "SVGComponentTransferFunctionElement": false, - "SVGDefsElement": false, - "SVGDescElement": false, - "SVGDiscardElement": false, - "SVGElement": false, - "SVGEllipseElement": false, - "SVGFEBlendElement": false, - "SVGFEColorMatrixElement": false, - "SVGFEComponentTransferElement": false, - "SVGFECompositeElement": false, - "SVGFEConvolveMatrixElement": false, - "SVGFEDiffuseLightingElement": false, - "SVGFEDisplacementMapElement": false, - "SVGFEDistantLightElement": false, - "SVGFEDropShadowElement": false, - "SVGFEFloodElement": false, - "SVGFEFuncAElement": false, - "SVGFEFuncBElement": false, - "SVGFEFuncGElement": false, - "SVGFEFuncRElement": false, - "SVGFEGaussianBlurElement": false, - "SVGFEImageElement": false, - "SVGFEMergeElement": false, - "SVGFEMergeNodeElement": false, - "SVGFEMorphologyElement": false, - "SVGFEOffsetElement": false, - "SVGFEPointLightElement": false, - "SVGFESpecularLightingElement": false, - "SVGFESpotLightElement": false, - "SVGFETileElement": false, - "SVGFETurbulenceElement": false, - "SVGFilterElement": false, - "SVGForeignObjectElement": false, - "SVGGElement": false, - "SVGGeometryElement": false, - "SVGGradientElement": false, - "SVGGraphicsElement": false, - "SVGImageElement": false, - "SVGLength": false, - "SVGLengthList": false, - "SVGLinearGradientElement": false, - "SVGLineElement": false, - "SVGMarkerElement": false, - "SVGMaskElement": false, - "SVGMatrix": false, - "SVGMetadataElement": false, - "SVGMPathElement": false, - "SVGNumber": false, - "SVGNumberList": false, - "SVGPathElement": false, - "SVGPatternElement": false, - "SVGPoint": false, - "SVGPointList": false, - "SVGPolygonElement": false, - "SVGPolylineElement": false, - "SVGPreserveAspectRatio": false, - "SVGRadialGradientElement": false, - "SVGRect": false, - "SVGRectElement": false, - "SVGScriptElement": false, - "SVGSetElement": false, - "SVGStopElement": false, - "SVGStringList": false, - "SVGStyleElement": false, - "SVGSVGElement": false, - "SVGSwitchElement": false, - "SVGSymbolElement": false, - "SVGTextContentElement": false, - "SVGTextElement": false, - "SVGTextPathElement": false, - "SVGTextPositioningElement": false, - "SVGTitleElement": false, - "SVGTransform": false, - "SVGTransformList": false, - "SVGTSpanElement": false, - "SVGUnitTypes": false, - "SVGUseElement": false, - "SVGViewElement": false, - "TaskAttributionTiming": false, - "Text": false, - "TextDecoder": false, - "TextEncoder": false, - "TextEvent": false, - "TextMetrics": false, - "TextTrack": false, - "TextTrackCue": false, - "TextTrackCueList": false, - "TextTrackList": false, - "TimeRanges": false, - "toolbar": false, - "top": false, - "Touch": false, - "TouchEvent": false, - "TouchList": false, - "TrackEvent": false, - "TransformStream": false, - "TransitionEvent": false, - "TreeWalker": false, - "UIEvent": false, - "URL": false, - "URLSearchParams": false, - "ValidityState": false, - "visualViewport": false, - "VisualViewport": false, - "VTTCue": false, - "WaveShaperNode": false, - "WebAssembly": false, - "WebGL2RenderingContext": false, - "WebGLActiveInfo": false, - "WebGLBuffer": false, - "WebGLContextEvent": false, - "WebGLFramebuffer": false, - "WebGLProgram": false, - "WebGLQuery": false, - "WebGLRenderbuffer": false, - "WebGLRenderingContext": false, - "WebGLSampler": false, - "WebGLShader": false, - "WebGLShaderPrecisionFormat": false, - "WebGLSync": false, - "WebGLTexture": false, - "WebGLTransformFeedback": false, - "WebGLUniformLocation": false, - "WebGLVertexArrayObject": false, - "WebSocket": false, - "WheelEvent": false, - "window": false, - "Window": false, - "Worker": false, - "WritableStream": false, - "XMLDocument": false, - "XMLHttpRequest": false, - "XMLHttpRequestEventTarget": false, - "XMLHttpRequestUpload": false, - "XMLSerializer": false, - "XPathEvaluator": false, - "XPathExpression": false, - "XPathResult": false, - "XSLTProcessor": false - }, - "worker": { - "addEventListener": false, - "applicationCache": false, - "atob": false, - "Blob": false, - "BroadcastChannel": false, - "btoa": false, - "Cache": false, - "caches": false, - "clearInterval": false, - "clearTimeout": false, - "close": true, - "console": false, - "CustomEvent": false, - "ErrorEvent": false, - "Event": false, - "fetch": false, - "FileReaderSync": false, - "FormData": false, - "Headers": false, - "IDBCursor": false, - "IDBCursorWithValue": false, - "IDBDatabase": false, - "IDBFactory": false, - "IDBIndex": false, - "IDBKeyRange": false, - "IDBObjectStore": false, - "IDBOpenDBRequest": false, - "IDBRequest": false, - "IDBTransaction": false, - "IDBVersionChangeEvent": false, - "ImageData": false, - "importScripts": true, - "indexedDB": false, - "location": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "name": false, - "navigator": false, - "Notification": false, - "onclose": true, - "onconnect": true, - "onerror": true, - "onlanguagechange": true, - "onmessage": true, - "onoffline": true, - "ononline": true, - "onrejectionhandled": true, - "onunhandledrejection": true, - "performance": false, - "Performance": false, - "PerformanceEntry": false, - "PerformanceMark": false, - "PerformanceMeasure": false, - "PerformanceNavigation": false, - "PerformanceResourceTiming": false, - "PerformanceTiming": false, - "postMessage": true, - "Promise": false, - "queueMicrotask": false, - "removeEventListener": false, - "reportError": false, - "Request": false, - "Response": false, - "self": true, - "ServiceWorkerRegistration": false, - "setInterval": false, - "setTimeout": false, - "TextDecoder": false, - "TextEncoder": false, - "URL": false, - "URLSearchParams": false, - "WebSocket": false, - "Worker": false, - "WorkerGlobalScope": false, - "XMLHttpRequest": false - }, - "node": { - "__dirname": false, - "__filename": false, - "AbortController": false, - "AbortSignal": false, - "atob": false, - "btoa": false, - "Buffer": false, - "clearImmediate": false, - "clearInterval": false, - "clearTimeout": false, - "console": false, - "DOMException": false, - "Event": false, - "EventTarget": false, - "exports": true, - "fetch": false, - "FormData": false, - "global": false, - "Headers": false, - "Intl": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "module": false, - "performance": false, - "process": false, - "queueMicrotask": false, - "Request": false, - "require": false, - "Response": false, - "setImmediate": false, - "setInterval": false, - "setTimeout": false, - "structuredClone": false, - "TextDecoder": false, - "TextEncoder": false, - "URL": false, - "URLSearchParams": false - }, - "nodeBuiltin": { - "AbortController": false, - "AbortSignal": false, - "atob": false, - "btoa": false, - "Buffer": false, - "clearImmediate": false, - "clearInterval": false, - "clearTimeout": false, - "console": false, - "DOMException": false, - "Event": false, - "EventTarget": false, - "fetch": false, - "FormData": false, - "global": false, - "Headers": false, - "Intl": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "performance": false, - "process": false, - "queueMicrotask": false, - "Request": false, - "Response": false, - "setImmediate": false, - "setInterval": false, - "setTimeout": false, - "structuredClone": false, - "TextDecoder": false, - "TextEncoder": false, - "URL": false, - "URLSearchParams": false - }, - "commonjs": { - "exports": true, - "global": false, - "module": false, - "require": false - }, - "amd": { - "define": false, - "require": false - }, - "mocha": { - "after": false, - "afterEach": false, - "before": false, - "beforeEach": false, - "context": false, - "describe": false, - "it": false, - "mocha": false, - "run": false, - "setup": false, - "specify": false, - "suite": false, - "suiteSetup": false, - "suiteTeardown": false, - "teardown": false, - "test": false, - "xcontext": false, - "xdescribe": false, - "xit": false, - "xspecify": false - }, - "jasmine": { - "afterAll": false, - "afterEach": false, - "beforeAll": false, - "beforeEach": false, - "describe": false, - "expect": false, - "expectAsync": false, - "fail": false, - "fdescribe": false, - "fit": false, - "it": false, - "jasmine": false, - "pending": false, - "runs": false, - "spyOn": false, - "spyOnAllFunctions": false, - "spyOnProperty": false, - "waits": false, - "waitsFor": false, - "xdescribe": false, - "xit": false - }, - "jest": { - "afterAll": false, - "afterEach": false, - "beforeAll": false, - "beforeEach": false, - "describe": false, - "expect": false, - "fdescribe": false, - "fit": false, - "it": false, - "jest": false, - "pit": false, - "require": false, - "test": false, - "xdescribe": false, - "xit": false, - "xtest": false - }, - "qunit": { - "asyncTest": false, - "deepEqual": false, - "equal": false, - "expect": false, - "module": false, - "notDeepEqual": false, - "notEqual": false, - "notOk": false, - "notPropEqual": false, - "notStrictEqual": false, - "ok": false, - "propEqual": false, - "QUnit": false, - "raises": false, - "start": false, - "stop": false, - "strictEqual": false, - "test": false, - "throws": false - }, - "phantomjs": { - "console": true, - "exports": true, - "phantom": true, - "require": true, - "WebPage": true - }, - "couch": { - "emit": false, - "exports": false, - "getRow": false, - "log": false, - "module": false, - "provides": false, - "require": false, - "respond": false, - "send": false, - "start": false, - "sum": false - }, - "rhino": { - "defineClass": false, - "deserialize": false, - "gc": false, - "help": false, - "importClass": false, - "importPackage": false, - "java": false, - "load": false, - "loadClass": false, - "Packages": false, - "print": false, - "quit": false, - "readFile": false, - "readUrl": false, - "runCommand": false, - "seal": false, - "serialize": false, - "spawn": false, - "sync": false, - "toint32": false, - "version": false - }, - "nashorn": { - "__DIR__": false, - "__FILE__": false, - "__LINE__": false, - "com": false, - "edu": false, - "exit": false, - "java": false, - "Java": false, - "javafx": false, - "JavaImporter": false, - "javax": false, - "JSAdapter": false, - "load": false, - "loadWithNewGlobal": false, - "org": false, - "Packages": false, - "print": false, - "quit": false - }, - "wsh": { - "ActiveXObject": false, - "CollectGarbage": false, - "Debug": false, - "Enumerator": false, - "GetObject": false, - "RuntimeObject": false, - "ScriptEngine": false, - "ScriptEngineBuildVersion": false, - "ScriptEngineMajorVersion": false, - "ScriptEngineMinorVersion": false, - "VBArray": false, - "WScript": false, - "WSH": false - }, - "jquery": { - "$": false, - "jQuery": false - }, - "yui": { - "YAHOO": false, - "YAHOO_config": false, - "YUI": false, - "YUI_config": false - }, - "shelljs": { - "cat": false, - "cd": false, - "chmod": false, - "config": false, - "cp": false, - "dirs": false, - "echo": false, - "env": false, - "error": false, - "exec": false, - "exit": false, - "find": false, - "grep": false, - "ln": false, - "ls": false, - "mkdir": false, - "mv": false, - "popd": false, - "pushd": false, - "pwd": false, - "rm": false, - "sed": false, - "set": false, - "target": false, - "tempdir": false, - "test": false, - "touch": false, - "which": false - }, - "prototypejs": { - "$": false, - "$$": false, - "$A": false, - "$break": false, - "$continue": false, - "$F": false, - "$H": false, - "$R": false, - "$w": false, - "Abstract": false, - "Ajax": false, - "Autocompleter": false, - "Builder": false, - "Class": false, - "Control": false, - "Draggable": false, - "Draggables": false, - "Droppables": false, - "Effect": false, - "Element": false, - "Enumerable": false, - "Event": false, - "Field": false, - "Form": false, - "Hash": false, - "Insertion": false, - "ObjectRange": false, - "PeriodicalExecuter": false, - "Position": false, - "Prototype": false, - "Scriptaculous": false, - "Selector": false, - "Sortable": false, - "SortableObserver": false, - "Sound": false, - "Template": false, - "Toggle": false, - "Try": false - }, - "meteor": { - "$": false, - "Accounts": false, - "AccountsClient": false, - "AccountsCommon": false, - "AccountsServer": false, - "App": false, - "Assets": false, - "Blaze": false, - "check": false, - "Cordova": false, - "DDP": false, - "DDPRateLimiter": false, - "DDPServer": false, - "Deps": false, - "EJSON": false, - "Email": false, - "HTTP": false, - "Log": false, - "Match": false, - "Meteor": false, - "Mongo": false, - "MongoInternals": false, - "Npm": false, - "Package": false, - "Plugin": false, - "process": false, - "Random": false, - "ReactiveDict": false, - "ReactiveVar": false, - "Router": false, - "ServiceConfiguration": false, - "Session": false, - "share": false, - "Spacebars": false, - "Template": false, - "Tinytest": false, - "Tracker": false, - "UI": false, - "Utils": false, - "WebApp": false, - "WebAppInternals": false - }, - "mongo": { - "_isWindows": false, - "_rand": false, - "BulkWriteResult": false, - "cat": false, - "cd": false, - "connect": false, - "db": false, - "getHostName": false, - "getMemInfo": false, - "hostname": false, - "ISODate": false, - "listFiles": false, - "load": false, - "ls": false, - "md5sumFile": false, - "mkdir": false, - "Mongo": false, - "NumberInt": false, - "NumberLong": false, - "ObjectId": false, - "PlanCache": false, - "print": false, - "printjson": false, - "pwd": false, - "quit": false, - "removeFile": false, - "rs": false, - "sh": false, - "UUID": false, - "version": false, - "WriteResult": false - }, - "applescript": { - "$": false, - "Application": false, - "Automation": false, - "console": false, - "delay": false, - "Library": false, - "ObjC": false, - "ObjectSpecifier": false, - "Path": false, - "Progress": false, - "Ref": false - }, - "serviceworker": { - "addEventListener": false, - "applicationCache": false, - "atob": false, - "Blob": false, - "BroadcastChannel": false, - "btoa": false, - "Cache": false, - "caches": false, - "CacheStorage": false, - "clearInterval": false, - "clearTimeout": false, - "Client": false, - "clients": false, - "Clients": false, - "close": true, - "console": false, - "CustomEvent": false, - "ErrorEvent": false, - "Event": false, - "ExtendableEvent": false, - "ExtendableMessageEvent": false, - "fetch": false, - "FetchEvent": false, - "FileReaderSync": false, - "FormData": false, - "Headers": false, - "IDBCursor": false, - "IDBCursorWithValue": false, - "IDBDatabase": false, - "IDBFactory": false, - "IDBIndex": false, - "IDBKeyRange": false, - "IDBObjectStore": false, - "IDBOpenDBRequest": false, - "IDBRequest": false, - "IDBTransaction": false, - "IDBVersionChangeEvent": false, - "ImageData": false, - "importScripts": false, - "indexedDB": false, - "location": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "name": false, - "navigator": false, - "Notification": false, - "onclose": true, - "onconnect": true, - "onerror": true, - "onfetch": true, - "oninstall": true, - "onlanguagechange": true, - "onmessage": true, - "onmessageerror": true, - "onnotificationclick": true, - "onnotificationclose": true, - "onoffline": true, - "ononline": true, - "onpush": true, - "onpushsubscriptionchange": true, - "onrejectionhandled": true, - "onsync": true, - "onunhandledrejection": true, - "performance": false, - "Performance": false, - "PerformanceEntry": false, - "PerformanceMark": false, - "PerformanceMeasure": false, - "PerformanceNavigation": false, - "PerformanceResourceTiming": false, - "PerformanceTiming": false, - "postMessage": true, - "Promise": false, - "queueMicrotask": false, - "registration": false, - "removeEventListener": false, - "Request": false, - "Response": false, - "self": false, - "ServiceWorker": false, - "ServiceWorkerContainer": false, - "ServiceWorkerGlobalScope": false, - "ServiceWorkerMessageEvent": false, - "ServiceWorkerRegistration": false, - "setInterval": false, - "setTimeout": false, - "skipWaiting": false, - "TextDecoder": false, - "TextEncoder": false, - "URL": false, - "URLSearchParams": false, - "WebSocket": false, - "WindowClient": false, - "Worker": false, - "WorkerGlobalScope": false, - "XMLHttpRequest": false - }, - "atomtest": { - "advanceClock": false, - "atom": false, - "fakeClearInterval": false, - "fakeClearTimeout": false, - "fakeSetInterval": false, - "fakeSetTimeout": false, - "resetTimeouts": false, - "waitsForPromise": false - }, - "embertest": { - "andThen": false, - "click": false, - "currentPath": false, - "currentRouteName": false, - "currentURL": false, - "fillIn": false, - "find": false, - "findAll": false, - "findWithAssert": false, - "keyEvent": false, - "pauseTest": false, - "resumeTest": false, - "triggerEvent": false, - "visit": false, - "wait": false - }, - "protractor": { - "$": false, - "$$": false, - "browser": false, - "by": false, - "By": false, - "DartObject": false, - "element": false, - "protractor": false - }, - "shared-node-browser": { - "AbortController": false, - "AbortSignal": false, - "atob": false, - "btoa": false, - "clearInterval": false, - "clearTimeout": false, - "console": false, - "DOMException": false, - "Event": false, - "EventTarget": false, - "fetch": false, - "FormData": false, - "Headers": false, - "Intl": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "performance": false, - "queueMicrotask": false, - "Request": false, - "Response": false, - "setInterval": false, - "setTimeout": false, - "structuredClone": false, - "TextDecoder": false, - "TextEncoder": false, - "URL": false, - "URLSearchParams": false - }, - "webextensions": { - "browser": false, - "chrome": false, - "opr": false - }, - "greasemonkey": { - "cloneInto": false, - "createObjectIn": false, - "exportFunction": false, - "GM": false, - "GM_addElement": false, - "GM_addStyle": false, - "GM_addValueChangeListener": false, - "GM_deleteValue": false, - "GM_download": false, - "GM_getResourceText": false, - "GM_getResourceURL": false, - "GM_getTab": false, - "GM_getTabs": false, - "GM_getValue": false, - "GM_info": false, - "GM_listValues": false, - "GM_log": false, - "GM_notification": false, - "GM_openInTab": false, - "GM_registerMenuCommand": false, - "GM_removeValueChangeListener": false, - "GM_saveTab": false, - "GM_setClipboard": false, - "GM_setValue": false, - "GM_unregisterMenuCommand": false, - "GM_xmlhttpRequest": false, - "unsafeWindow": false - }, - "devtools": { - "$": false, - "$_": false, - "$$": false, - "$0": false, - "$1": false, - "$2": false, - "$3": false, - "$4": false, - "$x": false, - "chrome": false, - "clear": false, - "copy": false, - "debug": false, - "dir": false, - "dirxml": false, - "getEventListeners": false, - "inspect": false, - "keys": false, - "monitor": false, - "monitorEvents": false, - "profile": false, - "profileEnd": false, - "queryObjects": false, - "table": false, - "undebug": false, - "unmonitor": false, - "unmonitorEvents": false, - "values": false - } -} diff --git a/node_modules/globals/index.d.ts b/node_modules/globals/index.d.ts deleted file mode 100644 index a842e4c88..000000000 --- a/node_modules/globals/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import {ReadonlyDeep} from 'type-fest'; -import globalsJson = require('./globals.json'); - -declare const globals: ReadonlyDeep; - -export = globals; diff --git a/node_modules/globals/index.js b/node_modules/globals/index.js deleted file mode 100644 index a951582e4..000000000 --- a/node_modules/globals/index.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -module.exports = require('./globals.json'); diff --git a/node_modules/globals/license b/node_modules/globals/license deleted file mode 100644 index fa7ceba3e..000000000 --- a/node_modules/globals/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://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/globals/package.json b/node_modules/globals/package.json deleted file mode 100644 index 17cc85afb..000000000 --- a/node_modules/globals/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "globals", - "version": "13.20.0", - "description": "Global identifiers from different JavaScript environments", - "license": "MIT", - "repository": "sindresorhus/globals", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js", - "index.d.ts", - "globals.json" - ], - "keywords": [ - "globals", - "global", - "identifiers", - "variables", - "vars", - "jshint", - "eslint", - "environments" - ], - "dependencies": { - "type-fest": "^0.20.2" - }, - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.14.0", - "xo": "^0.36.1" - }, - "xo": { - "ignores": [ - "get-browser-globals.js" - ], - "rules": { - "node/no-unsupported-features/es-syntax": "off" - } - }, - "tsd": { - "compilerOptions": { - "resolveJsonModule": true - } - } -} diff --git a/node_modules/globals/readme.md b/node_modules/globals/readme.md deleted file mode 100644 index 0ef22c304..000000000 --- a/node_modules/globals/readme.md +++ /dev/null @@ -1,56 +0,0 @@ -# globals - -> Global identifiers from different JavaScript environments - -It's just a [JSON file](globals.json), so use it in any environment. - -This package is used by ESLint. - -**This package [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).** - -## Install - -``` -$ npm install globals -``` - -## Usage - -```js -const globals = require('globals'); - -console.log(globals.browser); -/* -{ - addEventListener: false, - applicationCache: false, - ArrayBuffer: false, - atob: false, - … -} -*/ -``` - -Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise. - -For Node.js this package provides two sets of globals: - -- `globals.nodeBuiltin`: Globals available to all code running in Node.js. - These will usually be available as properties on the `global` object and include `process`, `Buffer`, but not CommonJS arguments like `require`. - See: https://nodejs.org/api/globals.html -- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope"). - See: https://nodejs.org/api/modules.html#modules_the_module_scope - -When analyzing code that is known to run outside of a CommonJS wrapper, for example, JavaScript modules, `nodeBuiltin` can find accidental CommonJS references. - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/graceful-fs/LICENSE b/node_modules/graceful-fs/LICENSE deleted file mode 100644 index e906a25ac..000000000 --- a/node_modules/graceful-fs/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, 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/graceful-fs/README.md b/node_modules/graceful-fs/README.md deleted file mode 100644 index 82d6e4daf..000000000 --- a/node_modules/graceful-fs/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# graceful-fs - -graceful-fs functions as a drop-in replacement for the fs module, -making various improvements. - -The improvements are meant to normalize behavior across different -platforms and environments, and to make filesystem access more -resilient to errors. - -## Improvements over [fs module](https://nodejs.org/api/fs.html) - -* Queues up `open` and `readdir` calls, and retries them once - something closes if there is an EMFILE error from too many file - descriptors. -* fixes `lchmod` for Node versions prior to 0.6.2. -* implements `fs.lutimes` if possible. Otherwise it becomes a noop. -* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or - `lchown` if the user isn't root. -* makes `lchmod` and `lchown` become noops, if not available. -* retries reading a file if `read` results in EAGAIN error. - -On Windows, it retries renaming a file for up to one second if `EACCESS` -or `EPERM` error occurs, likely because antivirus software has locked -the directory. - -## USAGE - -```javascript -// use just like fs -var fs = require('graceful-fs') - -// now go and do stuff with it... -fs.readFile('some-file-or-whatever', (err, data) => { - // Do stuff here. -}) -``` - -## Sync methods - -This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync -methods. If you use sync methods which open file descriptors then you are -responsible for dealing with any errors. - -This is a known limitation, not a bug. - -## Global Patching - -If you want to patch the global fs module (or any other fs-like -module) you can do this: - -```javascript -// Make sure to read the caveat below. -var realFs = require('fs') -var gracefulFs = require('graceful-fs') -gracefulFs.gracefulify(realFs) -``` - -This should only ever be done at the top-level application layer, in -order to delay on EMFILE errors from any fs-using dependencies. You -should **not** do this in a library, because it can cause unexpected -delays in other parts of the program. - -## Changes - -This module is fairly stable at this point, and used by a lot of -things. That being said, because it implements a subtle behavior -change in a core part of the node API, even modest changes can be -extremely breaking, and the versioning is thus biased towards -bumping the major when in doubt. - -The main change between major versions has been switching between -providing a fully-patched `fs` module vs monkey-patching the node core -builtin, and the approach by which a non-monkey-patched `fs` was -created. - -The goal is to trade `EMFILE` errors for slower fs operations. So, if -you try to open a zillion files, rather than crashing, `open` -operations will be queued up and wait for something else to `close`. - -There are advantages to each approach. Monkey-patching the fs means -that no `EMFILE` errors can possibly occur anywhere in your -application, because everything is using the same core `fs` module, -which is patched. However, it can also obviously cause undesirable -side-effects, especially if the module is loaded multiple times. - -Implementing a separate-but-identical patched `fs` module is more -surgical (and doesn't run the risk of patching multiple times), but -also imposes the challenge of keeping in sync with the core module. - -The current approach loads the `fs` module, and then creates a -lookalike object that has all the same methods, except a few that are -patched. It is safe to use in all versions of Node from 0.8 through -7.0. - -### v4 - -* Do not monkey-patch the fs module. This module may now be used as a - drop-in dep, and users can opt into monkey-patching the fs builtin - if their app requires it. - -### v3 - -* Monkey-patch fs, because the eval approach no longer works on recent - node. -* fixed possible type-error throw if rename fails on windows -* verify that we *never* get EMFILE errors -* Ignore ENOSYS from chmod/chown -* clarify that graceful-fs must be used as a drop-in - -### v2.1.0 - -* Use eval rather than monkey-patching fs. -* readdir: Always sort the results -* win32: requeue a file if error has an OK status - -### v2.0 - -* A return to monkey patching -* wrap process.cwd - -### v1.1 - -* wrap readFile -* Wrap fs.writeFile. -* readdir protection -* Don't clobber the fs builtin -* Handle fs.read EAGAIN errors by trying again -* Expose the curOpen counter -* No-op lchown/lchmod if not implemented -* fs.rename patch only for win32 -* Patch fs.rename to handle AV software on Windows -* Close #4 Chown should not fail on einval or eperm if non-root -* Fix isaacs/fstream#1 Only wrap fs one time -* Fix #3 Start at 1024 max files, then back off on EMFILE -* lutimes that doens't blow up on Linux -* A full on-rewrite using a queue instead of just swallowing the EMFILE error -* Wrap Read/Write streams as well - -### 1.0 - -* Update engines for node 0.6 -* Be lstat-graceful on Windows -* first diff --git a/node_modules/graceful-fs/clone.js b/node_modules/graceful-fs/clone.js deleted file mode 100644 index dff3cc8c5..000000000 --- a/node_modules/graceful-fs/clone.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -module.exports = clone - -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ -} - -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj - - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) - - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) - - return copy -} diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js deleted file mode 100644 index 8d5b89e4f..000000000 --- a/node_modules/graceful-fs/graceful-fs.js +++ /dev/null @@ -1,448 +0,0 @@ -var fs = require('fs') -var polyfills = require('./polyfills.js') -var legacy = require('./legacy-streams.js') -var clone = require('./clone.js') - -var util = require('util') - -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol - -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' -} - -function noop () {} - -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue - } - }) -} - -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } - -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) - - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - resetQueue() - } - - if (typeof cb === 'function') - cb.apply(this, arguments) - }) - } - - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) - - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - resetQueue() - } - - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) - - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - require('assert').equal(fs[gracefulQueue].length, 0) - }) - } -} - -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); -} - -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} - -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch - - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$readFile(path, options, cb) - - function go$readFile (path, options, cb, startTime) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$writeFile(path, data, options, cb) - - function go$writeFile (path, data, options, cb, startTime) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - return go$appendFile(path, data, options, cb) - - function go$appendFile (path, data, options, cb, startTime) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 - } - return go$copyFile(src, dest, flags, cb) - - function go$copyFile (src, dest, flags, cb, startTime) { - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - var fs$readdir = fs.readdir - fs.readdir = readdir - var noReaddirOptionVersions = /^v[0-5]\./ - function readdir (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - - var go$readdir = noReaddirOptionVersions.test(process.version) - ? function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, fs$readdirCallback( - path, options, cb, startTime - )) - } - : function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, fs$readdirCallback( - path, options, cb, startTime - )) - } - - return go$readdir(path, options, cb) - - function fs$readdirCallback (path, options, cb, startTime) { - return function (err, files) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([ - go$readdir, - [path, options, cb], - err, - startTime || Date.now(), - Date.now() - ]) - else { - if (files && files.sort) - files.sort() - - if (typeof cb === 'function') - cb.call(this, err, files) - } - } - } - } - - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } - - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } - - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } - - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) - - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) - - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } - - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() - - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } - - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } - - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } - - function createReadStream (path, options) { - return new fs.ReadStream(path, options) - } - - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) - } - - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null - - return go$open(path, flags, mode, cb) - - function go$open (path, flags, mode, cb, startTime) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } - - return fs -} - -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) - retry() -} - -// keep track of the timeout between retry() calls -var retryTimer - -// reset the startTime and lastTime to now -// this resets the start of the 60 second overall timeout as well as the -// delay between attempts so that we'll retry these jobs sooner -function resetQueue () { - var now = Date.now() - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - // entries that are only a length of 2 are from an older version, don't - // bother modifying those since they'll be retried anyway. - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now // startTime - fs[gracefulQueue][i][4] = now // lastTime - } - } - // call retry to make sure we're actively processing the queue - retry() -} - -function retry () { - // clear the timer and remove it to help prevent unintended concurrency - clearTimeout(retryTimer) - retryTimer = undefined - - if (fs[gracefulQueue].length === 0) - return - - var elem = fs[gracefulQueue].shift() - var fn = elem[0] - var args = elem[1] - // these items may be unset if they were added by an older graceful-fs - var err = elem[2] - var startTime = elem[3] - var lastTime = elem[4] - - // if we don't have a startTime we have no way of knowing if we've waited - // long enough, so go ahead and retry this item now - if (startTime === undefined) { - debug('RETRY', fn.name, args) - fn.apply(null, args) - } else if (Date.now() - startTime >= 60000) { - // it's been more than 60 seconds total, bail now - debug('TIMEOUT', fn.name, args) - var cb = args.pop() - if (typeof cb === 'function') - cb.call(null, err) - } else { - // the amount of time between the last attempt and right now - var sinceAttempt = Date.now() - lastTime - // the amount of time between when we first tried, and when we last tried - // rounded up to at least 1 - var sinceStart = Math.max(lastTime - startTime, 1) - // backoff. wait longer than the total time we've been retrying, but only - // up to a maximum of 100ms - var desiredDelay = Math.min(sinceStart * 1.2, 100) - // it's been long enough since the last retry, do it again - if (sinceAttempt >= desiredDelay) { - debug('RETRY', fn.name, args) - fn.apply(null, args.concat([startTime])) - } else { - // if we can't do this job yet, push it to the end of the queue - // and let the next iteration check again - fs[gracefulQueue].push(elem) - } - } - - // schedule our next run if one isn't already scheduled - if (retryTimer === undefined) { - retryTimer = setTimeout(retry, 0) - } -} diff --git a/node_modules/graceful-fs/legacy-streams.js b/node_modules/graceful-fs/legacy-streams.js deleted file mode 100644 index d617b50fc..000000000 --- a/node_modules/graceful-fs/legacy-streams.js +++ /dev/null @@ -1,118 +0,0 @@ -var Stream = require('stream').Stream - -module.exports = legacy - -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } - - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); - - Stream.call(this); - - var self = this; - - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; - - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.encoding) this.setEncoding(this.encoding); - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } - - if (this.start > this.end) { - throw new Error('start must be <= end'); - } - - this.pos = this.start; - } - - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } - - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } - - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); - - this.path = path; - this.fd = null; - this.writable = true; - - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; - - options = options || {}; - - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } - - this.pos = this.start; - } - - this.busy = false; - this._queue = []; - - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } -} diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json deleted file mode 100644 index 87babf024..000000000 --- a/node_modules/graceful-fs/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "graceful-fs", - "description": "A drop-in replacement for fs, making various improvements.", - "version": "4.2.11", - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-graceful-fs" - }, - "main": "graceful-fs.js", - "directories": { - "test": "test" - }, - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "test": "nyc --silent node test.js | tap -c -", - "posttest": "nyc report" - }, - "keywords": [ - "fs", - "module", - "reading", - "retry", - "retries", - "queue", - "error", - "errors", - "handling", - "EMFILE", - "EAGAIN", - "EINVAL", - "EPERM", - "EACCESS" - ], - "license": "ISC", - "devDependencies": { - "import-fresh": "^2.0.0", - "mkdirp": "^0.5.0", - "rimraf": "^2.2.8", - "tap": "^16.3.4" - }, - "files": [ - "fs.js", - "graceful-fs.js", - "legacy-streams.js", - "polyfills.js", - "clone.js" - ], - "tap": { - "reporter": "classic" - } -} diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js deleted file mode 100644 index 453f1a9e7..000000000 --- a/node_modules/graceful-fs/polyfills.js +++ /dev/null @@ -1,355 +0,0 @@ -var constants = require('constants') - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} - -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) -} - -module.exports = patch - -function patch (fs) { - // (re-)implement some things that are known busted or missing. - - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } - - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } - - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. - - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) - - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) - - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) - - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) - - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) - - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) - - // if lchmod/lchown do not exist, then make them no-ops - if (fs.chmod && !fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (fs.chown && !fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } - - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. - - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = typeof fs.rename !== 'function' ? fs.rename - : (function (fs$rename) { - function rename (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) - return rename - })(fs.rename) - } - - // if read() returns EAGAIN, then just try it again. - fs.read = typeof fs.read !== 'function' ? fs.read - : (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) - - fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync - : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) - - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } - - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } - - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } - - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - - } else if (fs.futimes) { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } - - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } - - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - return stats; - } - } - - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - - if (er.code === "ENOSYS") - return true - - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } - - return false - } -} diff --git a/node_modules/graphemer/CHANGELOG.md b/node_modules/graphemer/CHANGELOG.md deleted file mode 100644 index dc1dd4232..000000000 --- a/node_modules/graphemer/CHANGELOG.md +++ /dev/null @@ -1,30 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [1.3.0] - 2021-12-13 - -### Added - -- Updated to include support for Unicode 14 - -## [1.2.0] - 2021-01-29 - -### Updated - -- Refactored to increase speed - -## [1.1.0] - 2020-09-14 - -### Added - -- Updated to include support for Unicode 13 - -## [1.0.0] - 2020-09-13 - -- Forked from work by @JLHwung on original `Grapheme-Splitter` library: https://github.com/JLHwung/grapheme-splitter/tree/next -- Converted to Typescript -- Added development and build tooling diff --git a/node_modules/graphemer/LICENSE b/node_modules/graphemer/LICENSE deleted file mode 100644 index 51f383108..000000000 --- a/node_modules/graphemer/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright 2020 Filament (Anomalous Technologies Limited) - -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/graphemer/README.md b/node_modules/graphemer/README.md deleted file mode 100644 index 0ac98ad36..000000000 --- a/node_modules/graphemer/README.md +++ /dev/null @@ -1,132 +0,0 @@ -# Graphemer: Unicode Character Splitter 🪓 - -## Introduction - -This library continues the work of [Grapheme Splitter](https://github.com/orling/grapheme-splitter) and supports the following unicode versions: - -- Unicode 15 and below `[v1.4.0]` -- Unicode 14 and below `[v1.3.0]` -- Unicode 13 and below `[v1.1.0]` -- Unicode 11 and below `[v1.0.0]` (Unicode 10 supported by `grapheme-splitter`) - -In JavaScript there is not always a one-to-one relationship between string characters and what a user would call a separate visual "letter". Some symbols are represented by several characters. This can cause issues when splitting strings and inadvertently cutting a multi-char letter in half, or when you need the actual number of letters in a string. - -For example, emoji characters like "🌷","🎁","💩","😜" and "👍" are represented by two JavaScript characters each (high surrogate and low surrogate). That is, - -```javascript -'🌷'.length == 2; -``` - -The combined emoji are even longer: - -```javascript -'🏳️‍🌈'.length == 6; -``` - -What's more, some languages often include combining marks - characters that are used to modify the letters before them. Common examples are the German letter ü and the Spanish letter ñ. Sometimes they can be represented alternatively both as a single character and as a letter + combining mark, with both forms equally valid: - -```javascript -var two = 'ñ'; // unnormalized two-char n+◌̃, i.e. "\u006E\u0303"; -var one = 'ñ'; // normalized single-char, i.e. "\u00F1" - -console.log(one != two); // prints 'true' -``` - -Unicode normalization, as performed by the popular punycode.js library or ECMAScript 6's String.normalize, can **sometimes** fix those differences and turn two-char sequences into single characters. But it is **not** enough in all cases. Some languages like Hindi make extensive use of combining marks on their letters, that have no dedicated single-codepoint Unicode sequences, due to the sheer number of possible combinations. -For example, the Hindi word "अनुच्छेद" is comprised of 5 letters and 3 combining marks: - -अ + न + ु + च + ् + छ + े + द - -which is in fact just 5 user-perceived letters: - -अ + नु + च् + छे + द - -and which Unicode normalization would not combine properly. -There are also the unusual letter+combining mark combinations which have no dedicated Unicode codepoint. The string Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ͫ͗͢L̠ͨͧͩ͘G̴̻͈͍͔̹̑͗̎̅͛́Ǫ̵̹̻̝̳͂̌̌͘ obviously has 5 separate letters, but is in fact comprised of 58 JavaScript characters, most of which are combining marks. - -Enter the `graphemer` library. It can be used to properly split JavaScript strings into what a human user would call separate letters (or "extended grapheme clusters" in Unicode terminology), no matter what their internal representation is. It is an implementation on the [Default Grapheme Cluster Boundary](http://unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table) of [UAX #29](http://www.unicode.org/reports/tr29/). - -## Installation - -Install `graphemer` using the NPM command below: - -``` -$ npm i graphemer -``` - -## Usage - -If you're using [Typescript](https://www.typescriptlang.org/) or a compiler like [Babel](https://babeljs.io/) (or something like Create React App) things are pretty simple; just import, initialize and use! - -```javascript -import Graphemer from 'graphemer'; - -const splitter = new Graphemer(); - -// split the string to an array of grapheme clusters (one string each) -const graphemes = splitter.splitGraphemes(string); - -// iterate the string to an iterable iterator of grapheme clusters (one string each) -const graphemeIterator = splitter.iterateGraphemes(string); - -// or do this if you just need their number -const graphemeCount = splitter.countGraphemes(string); -``` - -If you're using vanilla Node you can use the `require()` method. - -```javascript -const Graphemer = require('graphemer').default; - -const splitter = new Graphemer(); - -const graphemes = splitter.splitGraphemes(string); -``` - -## Examples - -```javascript -import Graphemer from 'graphemer'; - -const splitter = new Graphemer(); - -// plain latin alphabet - nothing spectacular -splitter.splitGraphemes('abcd'); // returns ["a", "b", "c", "d"] - -// two-char emojis and six-char combined emoji -splitter.splitGraphemes('🌷🎁💩😜👍🏳️‍🌈'); // returns ["🌷","🎁","💩","😜","👍","🏳️‍🌈"] - -// diacritics as combining marks, 10 JavaScript chars -splitter.splitGraphemes('Ĺo͂řȩm̅'); // returns ["Ĺ","o͂","ř","ȩ","m̅"] - -// individual Korean characters (Jamo), 4 JavaScript chars -splitter.splitGraphemes('뎌쉐'); // returns ["뎌","쉐"] - -// Hindi text with combining marks, 8 JavaScript chars -splitter.splitGraphemes('अनुच्छेद'); // returns ["अ","नु","च्","छे","द"] - -// demonic multiple combining marks, 75 JavaScript chars -splitter.splitGraphemes('Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ͫ͗͢L̠ͨͧͩ͘G̴̻͈͍͔̹̑͗̎̅͛́Ǫ̵̹̻̝̳͂̌̌͘!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞'); // returns ["Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍","A̴̵̜̰͔ͫ͗͢","L̠ͨͧͩ͘","G̴̻͈͍͔̹̑͗̎̅͛́","Ǫ̵̹̻̝̳͂̌̌͘","!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞"] -``` - -## TypeScript - -Graphemer is built with TypeScript and, of course, includes type declarations. - -```javascript -import Graphemer from 'graphemer'; - -const splitter = new Graphemer(); - -const split: string[] = splitter.splitGraphemes('Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ͫ͗͢L̠ͨͧͩ͘G̴̻͈͍͔̹̑͗̎̅͛́Ǫ̵̹̻̝̳͂̌̌͘!͖̬̰̙̗̿̋ͥͥ̂ͣ̐́́͜͞'); -``` - -## Contributing - -See [Contribution Guide](./CONTRIBUTING.md). - -## Acknowledgements - -This library is a fork of the incredible work done by Orlin Georgiev and Huáng Jùnliàng at https://github.com/orling/grapheme-splitter. - -The original library was heavily influenced by Devon Govett's excellent [grapheme-breaker](https://github.com/devongovett/grapheme-breaker) CoffeeScript library. diff --git a/node_modules/graphemer/lib/Graphemer.d.ts b/node_modules/graphemer/lib/Graphemer.d.ts deleted file mode 100644 index a89b8cbcc..000000000 --- a/node_modules/graphemer/lib/Graphemer.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import GraphemerIterator from './GraphemerIterator'; -export default class Graphemer { - /** - * Returns the next grapheme break in the string after the given index - * @param string {string} - * @param index {number} - * @returns {number} - */ - static nextBreak(string: string, index: number): number; - /** - * Breaks the given string into an array of grapheme clusters - * @param str {string} - * @returns {string[]} - */ - splitGraphemes(str: string): string[]; - /** - * Returns an iterator of grapheme clusters in the given string - * @param str {string} - * @returns {GraphemerIterator} - */ - iterateGraphemes(str: string): GraphemerIterator; - /** - * Returns the number of grapheme clusters in the given string - * @param str {string} - * @returns {number} - */ - countGraphemes(str: string): number; - /** - * Given a Unicode code point, determines this symbol's grapheme break property - * @param code {number} Unicode code point - * @returns {number} - */ - static getGraphemeBreakProperty(code: number): number; - /** - * Given a Unicode code point, returns if symbol is an extended pictographic or some other break - * @param code {number} Unicode code point - * @returns {number} - */ - static getEmojiProperty(code: number): number; -} -//# sourceMappingURL=Graphemer.d.ts.map \ No newline at end of file diff --git a/node_modules/graphemer/lib/Graphemer.d.ts.map b/node_modules/graphemer/lib/Graphemer.d.ts.map deleted file mode 100644 index 692b76236..000000000 --- a/node_modules/graphemer/lib/Graphemer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Graphemer.d.ts","sourceRoot":"","sources":["../src/Graphemer.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IA2CvD;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAcrC;;;;OAIG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB;IAIhD;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAcnC;;;;OAIG;IACH,MAAM,CAAC,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAoySrD;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CA47B9C"} \ No newline at end of file diff --git a/node_modules/graphemer/lib/Graphemer.js b/node_modules/graphemer/lib/Graphemer.js deleted file mode 100644 index 8ed00ca56..000000000 --- a/node_modules/graphemer/lib/Graphemer.js +++ /dev/null @@ -1,11959 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const boundaries_1 = require("./boundaries"); -const GraphemerHelper_1 = __importDefault(require("./GraphemerHelper")); -const GraphemerIterator_1 = __importDefault(require("./GraphemerIterator")); -class Graphemer { - /** - * Returns the next grapheme break in the string after the given index - * @param string {string} - * @param index {number} - * @returns {number} - */ - static nextBreak(string, index) { - if (index === undefined) { - index = 0; - } - if (index < 0) { - return 0; - } - if (index >= string.length - 1) { - return string.length; - } - const prevCP = GraphemerHelper_1.default.codePointAt(string, index); - const prev = Graphemer.getGraphemeBreakProperty(prevCP); - const prevEmoji = Graphemer.getEmojiProperty(prevCP); - const mid = []; - const midEmoji = []; - for (let i = index + 1; i < string.length; i++) { - // check for already processed low surrogates - if (GraphemerHelper_1.default.isSurrogate(string, i - 1)) { - continue; - } - const nextCP = GraphemerHelper_1.default.codePointAt(string, i); - const next = Graphemer.getGraphemeBreakProperty(nextCP); - const nextEmoji = Graphemer.getEmojiProperty(nextCP); - if (GraphemerHelper_1.default.shouldBreak(prev, mid, next, prevEmoji, midEmoji, nextEmoji)) { - return i; - } - mid.push(next); - midEmoji.push(nextEmoji); - } - return string.length; - } - /** - * Breaks the given string into an array of grapheme clusters - * @param str {string} - * @returns {string[]} - */ - splitGraphemes(str) { - const res = []; - let index = 0; - let brk; - while ((brk = Graphemer.nextBreak(str, index)) < str.length) { - res.push(str.slice(index, brk)); - index = brk; - } - if (index < str.length) { - res.push(str.slice(index)); - } - return res; - } - /** - * Returns an iterator of grapheme clusters in the given string - * @param str {string} - * @returns {GraphemerIterator} - */ - iterateGraphemes(str) { - return new GraphemerIterator_1.default(str, Graphemer.nextBreak); - } - /** - * Returns the number of grapheme clusters in the given string - * @param str {string} - * @returns {number} - */ - countGraphemes(str) { - let count = 0; - let index = 0; - let brk; - while ((brk = Graphemer.nextBreak(str, index)) < str.length) { - index = brk; - count++; - } - if (index < str.length) { - count++; - } - return count; - } - /** - * Given a Unicode code point, determines this symbol's grapheme break property - * @param code {number} Unicode code point - * @returns {number} - */ - static getGraphemeBreakProperty(code) { - // Grapheme break property taken from: - // https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt - // and generated by - // node ./scripts/generate-grapheme-break.js - if (code < 0xbf09) { - if (code < 0xac54) { - if (code < 0x102d) { - if (code < 0xb02) { - if (code < 0x93b) { - if (code < 0x6df) { - if (code < 0x5bf) { - if (code < 0x7f) { - if (code < 0xb) { - if (code < 0xa) { - // Cc [10] .. - if (0x0 <= code && code <= 0x9) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - // Cc - if (0xa === code) { - return boundaries_1.CLUSTER_BREAK.LF; - } - } - } - else { - if (code < 0xd) { - // Cc [2] .. - if (0xb <= code && code <= 0xc) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - if (code < 0xe) { - // Cc - if (0xd === code) { - return boundaries_1.CLUSTER_BREAK.CR; - } - } - else { - // Cc [18] .. - if (0xe <= code && code <= 0x1f) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - } - } - } - else { - if (code < 0x300) { - if (code < 0xad) { - // Cc [33] .. - if (0x7f <= code && code <= 0x9f) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - // Cf SOFT HYPHEN - if (0xad === code) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - } - else { - if (code < 0x483) { - // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X - if (0x300 <= code && code <= 0x36f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x591) { - // Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE - // Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN - if (0x483 <= code && code <= 0x489) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [45] HEBREW ACCENT ETNAHTA..HEBREW POINT METEG - if (0x591 <= code && code <= 0x5bd) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x610) { - if (code < 0x5c4) { - if (code < 0x5c1) { - // Mn HEBREW POINT RAFE - if (0x5bf === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT - if (0x5c1 <= code && code <= 0x5c2) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x5c7) { - // Mn [2] HEBREW MARK UPPER DOT..HEBREW MARK LOWER DOT - if (0x5c4 <= code && code <= 0x5c5) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x600) { - // Mn HEBREW POINT QAMATS QATAN - if (0x5c7 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE - if (0x600 <= code && code <= 0x605) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - } - } - } - else { - if (code < 0x670) { - if (code < 0x61c) { - // Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA - if (0x610 <= code && code <= 0x61a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x64b) { - // Cf ARABIC LETTER MARK - if (0x61c === code) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - // Mn [21] ARABIC FATHATAN..ARABIC WAVY HAMZA BELOW - if (0x64b <= code && code <= 0x65f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x6d6) { - // Mn ARABIC LETTER SUPERSCRIPT ALEF - if (0x670 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x6dd) { - // Mn [7] ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA..ARABIC SMALL HIGH SEEN - if (0x6d6 <= code && code <= 0x6dc) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Cf ARABIC END OF AYAH - if (0x6dd === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - } - } - } - } - } - else { - if (code < 0x81b) { - if (code < 0x730) { - if (code < 0x6ea) { - if (code < 0x6e7) { - // Mn [6] ARABIC SMALL HIGH ROUNDED ZERO..ARABIC SMALL HIGH MADDA - if (0x6df <= code && code <= 0x6e4) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] ARABIC SMALL HIGH YEH..ARABIC SMALL HIGH NOON - if (0x6e7 <= code && code <= 0x6e8) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x70f) { - // Mn [4] ARABIC EMPTY CENTRE LOW STOP..ARABIC SMALL LOW MEEM - if (0x6ea <= code && code <= 0x6ed) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Cf SYRIAC ABBREVIATION MARK - if (0x70f === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - // Mn SYRIAC LETTER SUPERSCRIPT ALAPH - if (0x711 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x7eb) { - if (code < 0x7a6) { - // Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH - if (0x730 <= code && code <= 0x74a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [11] THAANA ABAFILI..THAANA SUKUN - if (0x7a6 <= code && code <= 0x7b0) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x7fd) { - // Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE - if (0x7eb <= code && code <= 0x7f3) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x816) { - // Mn NKO DANTAYALAN - if (0x7fd === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [4] SAMARITAN MARK IN..SAMARITAN MARK DAGESH - if (0x816 <= code && code <= 0x819) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x898) { - if (code < 0x829) { - if (code < 0x825) { - // Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A - if (0x81b <= code && code <= 0x823) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U - if (0x825 <= code && code <= 0x827) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x859) { - // Mn [5] SAMARITAN VOWEL SIGN LONG I..SAMARITAN MARK NEQUDAA - if (0x829 <= code && code <= 0x82d) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x890) { - // Mn [3] MANDAIC AFFRICATION MARK..MANDAIC GEMINATION MARK - if (0x859 <= code && code <= 0x85b) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Cf [2] ARABIC POUND MARK ABOVE..ARABIC PIASTRE MARK ABOVE - if (0x890 <= code && code <= 0x891) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - } - } - } - else { - if (code < 0x8e3) { - if (code < 0x8ca) { - // Mn [8] ARABIC SMALL HIGH WORD AL-JUZ..ARABIC HALF MADDA OVER MADDA - if (0x898 <= code && code <= 0x89f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x8e2) { - // Mn [24] ARABIC SMALL HIGH FARSI YEH..ARABIC SMALL HIGH SIGN SAFHA - if (0x8ca <= code && code <= 0x8e1) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Cf ARABIC DISPUTED END OF AYAH - if (0x8e2 === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - } - } - else { - if (code < 0x903) { - // Mn [32] ARABIC TURNED DAMMA BELOW..DEVANAGARI SIGN ANUSVARA - if (0x8e3 <= code && code <= 0x902) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc DEVANAGARI SIGN VISARGA - if (0x903 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn DEVANAGARI VOWEL SIGN OE - if (0x93a === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - else { - if (code < 0xa01) { - if (code < 0x982) { - if (code < 0x94d) { - if (code < 0x93e) { - // Mc DEVANAGARI VOWEL SIGN OOE - if (0x93b === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn DEVANAGARI SIGN NUKTA - if (0x93c === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x941) { - // Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II - if (0x93e <= code && code <= 0x940) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x949) { - // Mn [8] DEVANAGARI VOWEL SIGN U..DEVANAGARI VOWEL SIGN AI - if (0x941 <= code && code <= 0x948) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU - if (0x949 <= code && code <= 0x94c) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0x951) { - if (code < 0x94e) { - // Mn DEVANAGARI SIGN VIRAMA - if (0x94d === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] DEVANAGARI VOWEL SIGN PRISHTHAMATRA E..DEVANAGARI VOWEL SIGN AW - if (0x94e <= code && code <= 0x94f) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x962) { - // Mn [7] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI VOWEL SIGN UUE - if (0x951 <= code && code <= 0x957) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x981) { - // Mn [2] DEVANAGARI VOWEL SIGN VOCALIC L..DEVANAGARI VOWEL SIGN VOCALIC LL - if (0x962 <= code && code <= 0x963) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn BENGALI SIGN CANDRABINDU - if (0x981 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x9c7) { - if (code < 0x9be) { - if (code < 0x9bc) { - // Mc [2] BENGALI SIGN ANUSVARA..BENGALI SIGN VISARGA - if (0x982 <= code && code <= 0x983) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn BENGALI SIGN NUKTA - if (0x9bc === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x9bf) { - // Mc BENGALI VOWEL SIGN AA - if (0x9be === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x9c1) { - // Mc [2] BENGALI VOWEL SIGN I..BENGALI VOWEL SIGN II - if (0x9bf <= code && code <= 0x9c0) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [4] BENGALI VOWEL SIGN U..BENGALI VOWEL SIGN VOCALIC RR - if (0x9c1 <= code && code <= 0x9c4) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x9d7) { - if (code < 0x9cb) { - // Mc [2] BENGALI VOWEL SIGN E..BENGALI VOWEL SIGN AI - if (0x9c7 <= code && code <= 0x9c8) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x9cd) { - // Mc [2] BENGALI VOWEL SIGN O..BENGALI VOWEL SIGN AU - if (0x9cb <= code && code <= 0x9cc) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn BENGALI SIGN VIRAMA - if (0x9cd === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x9e2) { - // Mc BENGALI AU LENGTH MARK - if (0x9d7 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x9fe) { - // Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENGALI VOWEL SIGN VOCALIC LL - if (0x9e2 <= code && code <= 0x9e3) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn BENGALI SANDHI MARK - if (0x9fe === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - else { - if (code < 0xa83) { - if (code < 0xa47) { - if (code < 0xa3c) { - if (code < 0xa03) { - // Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI SIGN BINDI - if (0xa01 <= code && code <= 0xa02) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc GURMUKHI SIGN VISARGA - if (0xa03 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0xa3e) { - // Mn GURMUKHI SIGN NUKTA - if (0xa3c === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xa41) { - // Mc [3] GURMUKHI VOWEL SIGN AA..GURMUKHI VOWEL SIGN II - if (0xa3e <= code && code <= 0xa40) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VOWEL SIGN UU - if (0xa41 <= code && code <= 0xa42) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0xa70) { - if (code < 0xa4b) { - // Mn [2] GURMUKHI VOWEL SIGN EE..GURMUKHI VOWEL SIGN AI - if (0xa47 <= code && code <= 0xa48) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xa51) { - // Mn [3] GURMUKHI VOWEL SIGN OO..GURMUKHI SIGN VIRAMA - if (0xa4b <= code && code <= 0xa4d) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn GURMUKHI SIGN UDAAT - if (0xa51 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xa75) { - // Mn [2] GURMUKHI TIPPI..GURMUKHI ADDAK - if (0xa70 <= code && code <= 0xa71) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xa81) { - // Mn GURMUKHI SIGN YAKASH - if (0xa75 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] GUJARATI SIGN CANDRABINDU..GUJARATI SIGN ANUSVARA - if (0xa81 <= code && code <= 0xa82) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0xac9) { - if (code < 0xabe) { - // Mc GUJARATI SIGN VISARGA - if (0xa83 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn GUJARATI SIGN NUKTA - if (0xabc === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xac1) { - // Mc [3] GUJARATI VOWEL SIGN AA..GUJARATI VOWEL SIGN II - if (0xabe <= code && code <= 0xac0) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xac7) { - // Mn [5] GUJARATI VOWEL SIGN U..GUJARATI VOWEL SIGN CANDRA E - if (0xac1 <= code && code <= 0xac5) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VOWEL SIGN AI - if (0xac7 <= code && code <= 0xac8) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0xae2) { - if (code < 0xacb) { - // Mc GUJARATI VOWEL SIGN CANDRA O - if (0xac9 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xacd) { - // Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU - if (0xacb <= code && code <= 0xacc) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn GUJARATI SIGN VIRAMA - if (0xacd === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xafa) { - // Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL - if (0xae2 <= code && code <= 0xae3) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xb01) { - // Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE - if (0xafa <= code && code <= 0xaff) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn ORIYA SIGN CANDRABINDU - if (0xb01 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - } - } - else { - if (code < 0xcf3) { - if (code < 0xc04) { - if (code < 0xb82) { - if (code < 0xb47) { - if (code < 0xb3e) { - if (code < 0xb3c) { - // Mc [2] ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA - if (0xb02 <= code && code <= 0xb03) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn ORIYA SIGN NUKTA - if (0xb3c === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0xb40) { - // Mc ORIYA VOWEL SIGN AA - // Mn ORIYA VOWEL SIGN I - if (0xb3e <= code && code <= 0xb3f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xb41) { - // Mc ORIYA VOWEL SIGN II - if (0xb40 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [4] ORIYA VOWEL SIGN U..ORIYA VOWEL SIGN VOCALIC RR - if (0xb41 <= code && code <= 0xb44) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0xb4d) { - if (code < 0xb4b) { - // Mc [2] ORIYA VOWEL SIGN E..ORIYA VOWEL SIGN AI - if (0xb47 <= code && code <= 0xb48) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mc [2] ORIYA VOWEL SIGN O..ORIYA VOWEL SIGN AU - if (0xb4b <= code && code <= 0xb4c) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0xb55) { - // Mn ORIYA SIGN VIRAMA - if (0xb4d === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xb62) { - // Mn [2] ORIYA SIGN OVERLINE..ORIYA AI LENGTH MARK - // Mc ORIYA AU LENGTH MARK - if (0xb55 <= code && code <= 0xb57) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] ORIYA VOWEL SIGN VOCALIC L..ORIYA VOWEL SIGN VOCALIC LL - if (0xb62 <= code && code <= 0xb63) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0xbc6) { - if (code < 0xbbf) { - // Mn TAMIL SIGN ANUSVARA - if (0xb82 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mc TAMIL VOWEL SIGN AA - if (0xbbe === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xbc0) { - // Mc TAMIL VOWEL SIGN I - if (0xbbf === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xbc1) { - // Mn TAMIL VOWEL SIGN II - if (0xbc0 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] TAMIL VOWEL SIGN U..TAMIL VOWEL SIGN UU - if (0xbc1 <= code && code <= 0xbc2) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0xbd7) { - if (code < 0xbca) { - // Mc [3] TAMIL VOWEL SIGN E..TAMIL VOWEL SIGN AI - if (0xbc6 <= code && code <= 0xbc8) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xbcd) { - // Mc [3] TAMIL VOWEL SIGN O..TAMIL VOWEL SIGN AU - if (0xbca <= code && code <= 0xbcc) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn TAMIL SIGN VIRAMA - if (0xbcd === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xc00) { - // Mc TAMIL AU LENGTH MARK - if (0xbd7 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xc01) { - // Mn TELUGU SIGN COMBINING CANDRABINDU ABOVE - if (0xc00 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [3] TELUGU SIGN CANDRABINDU..TELUGU SIGN VISARGA - if (0xc01 <= code && code <= 0xc03) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - } - else { - if (code < 0xcbe) { - if (code < 0xc4a) { - if (code < 0xc3e) { - // Mn TELUGU SIGN COMBINING ANUSVARA ABOVE - if (0xc04 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mn TELUGU SIGN NUKTA - if (0xc3c === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xc41) { - // Mn [3] TELUGU VOWEL SIGN AA..TELUGU VOWEL SIGN II - if (0xc3e <= code && code <= 0xc40) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xc46) { - // Mc [4] TELUGU VOWEL SIGN U..TELUGU VOWEL SIGN VOCALIC RR - if (0xc41 <= code && code <= 0xc44) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL SIGN AI - if (0xc46 <= code && code <= 0xc48) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0xc81) { - if (code < 0xc55) { - // Mn [4] TELUGU VOWEL SIGN O..TELUGU SIGN VIRAMA - if (0xc4a <= code && code <= 0xc4d) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xc62) { - // Mn [2] TELUGU LENGTH MARK..TELUGU AI LENGTH MARK - if (0xc55 <= code && code <= 0xc56) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] TELUGU VOWEL SIGN VOCALIC L..TELUGU VOWEL SIGN VOCALIC LL - if (0xc62 <= code && code <= 0xc63) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xc82) { - // Mn KANNADA SIGN CANDRABINDU - if (0xc81 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xcbc) { - // Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA - if (0xc82 <= code && code <= 0xc83) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn KANNADA SIGN NUKTA - if (0xcbc === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0xcc6) { - if (code < 0xcc0) { - // Mc KANNADA VOWEL SIGN AA - if (0xcbe === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn KANNADA VOWEL SIGN I - if (0xcbf === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xcc2) { - // Mc [2] KANNADA VOWEL SIGN II..KANNADA VOWEL SIGN U - if (0xcc0 <= code && code <= 0xcc1) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xcc3) { - // Mc KANNADA VOWEL SIGN UU - if (0xcc2 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] KANNADA VOWEL SIGN VOCALIC R..KANNADA VOWEL SIGN VOCALIC RR - if (0xcc3 <= code && code <= 0xcc4) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0xccc) { - if (code < 0xcc7) { - // Mn KANNADA VOWEL SIGN E - if (0xcc6 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xcca) { - // Mc [2] KANNADA VOWEL SIGN EE..KANNADA VOWEL SIGN AI - if (0xcc7 <= code && code <= 0xcc8) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mc [2] KANNADA VOWEL SIGN O..KANNADA VOWEL SIGN OO - if (0xcca <= code && code <= 0xccb) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0xcd5) { - // Mn [2] KANNADA VOWEL SIGN AU..KANNADA SIGN VIRAMA - if (0xccc <= code && code <= 0xccd) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xce2) { - // Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK - if (0xcd5 <= code && code <= 0xcd6) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANNADA VOWEL SIGN VOCALIC LL - if (0xce2 <= code && code <= 0xce3) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - } - else { - if (code < 0xddf) { - if (code < 0xd4e) { - if (code < 0xd3f) { - if (code < 0xd02) { - if (code < 0xd00) { - // Mc KANNADA SIGN COMBINING ANUSVARA ABOVE RIGHT - if (0xcf3 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU - if (0xd00 <= code && code <= 0xd01) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0xd3b) { - // Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA - if (0xd02 <= code && code <= 0xd03) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xd3e) { - // Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA - if (0xd3b <= code && code <= 0xd3c) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc MALAYALAM VOWEL SIGN AA - if (0xd3e === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0xd46) { - if (code < 0xd41) { - // Mc [2] MALAYALAM VOWEL SIGN I..MALAYALAM VOWEL SIGN II - if (0xd3f <= code && code <= 0xd40) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR - if (0xd41 <= code && code <= 0xd44) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0xd4a) { - // Mc [3] MALAYALAM VOWEL SIGN E..MALAYALAM VOWEL SIGN AI - if (0xd46 <= code && code <= 0xd48) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xd4d) { - // Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU - if (0xd4a <= code && code <= 0xd4c) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn MALAYALAM SIGN VIRAMA - if (0xd4d === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0xdca) { - if (code < 0xd62) { - // Lo MALAYALAM LETTER DOT REPH - if (0xd4e === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - // Mc MALAYALAM AU LENGTH MARK - if (0xd57 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xd81) { - // Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL - if (0xd62 <= code && code <= 0xd63) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xd82) { - // Mn SINHALA SIGN CANDRABINDU - if (0xd81 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] SINHALA SIGN ANUSVARAYA..SINHALA SIGN VISARGAYA - if (0xd82 <= code && code <= 0xd83) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0xdd2) { - if (code < 0xdcf) { - // Mn SINHALA SIGN AL-LAKUNA - if (0xdca === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xdd0) { - // Mc SINHALA VOWEL SIGN AELA-PILLA - if (0xdcf === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] SINHALA VOWEL SIGN KETTI AEDA-PILLA..SINHALA VOWEL SIGN DIGA AEDA-PILLA - if (0xdd0 <= code && code <= 0xdd1) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0xdd6) { - // Mn [3] SINHALA VOWEL SIGN KETTI IS-PILLA..SINHALA VOWEL SIGN KETTI PAA-PILLA - if (0xdd2 <= code && code <= 0xdd4) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xdd8) { - // Mn SINHALA VOWEL SIGN DIGA PAA-PILLA - if (0xdd6 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [7] SINHALA VOWEL SIGN GAETTA-PILLA..SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA - if (0xdd8 <= code && code <= 0xdde) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - } - else { - if (code < 0xf35) { - if (code < 0xe47) { - if (code < 0xe31) { - if (code < 0xdf2) { - // Mc SINHALA VOWEL SIGN GAYANUKITTA - if (0xddf === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] SINHALA VOWEL SIGN DIGA GAETTA-PILLA..SINHALA VOWEL SIGN DIGA GAYANUKITTA - if (0xdf2 <= code && code <= 0xdf3) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0xe33) { - // Mn THAI CHARACTER MAI HAN-AKAT - if (0xe31 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xe34) { - // Lo THAI CHARACTER SARA AM - if (0xe33 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [7] THAI CHARACTER SARA I..THAI CHARACTER PHINTHU - if (0xe34 <= code && code <= 0xe3a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0xeb4) { - if (code < 0xeb1) { - // Mn [8] THAI CHARACTER MAITAIKHU..THAI CHARACTER YAMAKKAN - if (0xe47 <= code && code <= 0xe4e) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn LAO VOWEL SIGN MAI KAN - if (0xeb1 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Lo LAO VOWEL SIGN AM - if (0xeb3 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0xec8) { - // Mn [9] LAO VOWEL SIGN I..LAO SEMIVOWEL SIGN LO - if (0xeb4 <= code && code <= 0xebc) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xf18) { - // Mn [7] LAO TONE MAI EK..LAO YAMAKKAN - if (0xec8 <= code && code <= 0xece) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] TIBETAN ASTROLOGICAL SIGN -KHYUD PA..TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS - if (0xf18 <= code && code <= 0xf19) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0xf7f) { - if (code < 0xf39) { - // Mn TIBETAN MARK NGAS BZUNG NYI ZLA - if (0xf35 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mn TIBETAN MARK NGAS BZUNG SGOR RTAGS - if (0xf37 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xf3e) { - // Mn TIBETAN MARK TSA -PHRU - if (0xf39 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xf71) { - // Mc [2] TIBETAN SIGN YAR TSHES..TIBETAN SIGN MAR TSHES - if (0xf3e <= code && code <= 0xf3f) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [14] TIBETAN VOWEL SIGN AA..TIBETAN SIGN RJES SU NGA RO - if (0xf71 <= code && code <= 0xf7e) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0xf8d) { - if (code < 0xf80) { - // Mc TIBETAN SIGN RNAM BCAD - if (0xf7f === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xf86) { - // Mn [5] TIBETAN VOWEL SIGN REVERSED I..TIBETAN MARK HALANTA - if (0xf80 <= code && code <= 0xf84) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] TIBETAN SIGN LCI RTAGS..TIBETAN SIGN YANG RTAGS - if (0xf86 <= code && code <= 0xf87) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xf99) { - // Mn [11] TIBETAN SUBJOINED SIGN LCE TSA CAN..TIBETAN SUBJOINED LETTER JA - if (0xf8d <= code && code <= 0xf97) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xfc6) { - // Mn [36] TIBETAN SUBJOINED LETTER NYA..TIBETAN SUBJOINED LETTER FIXED-FORM RA - if (0xf99 <= code && code <= 0xfbc) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn TIBETAN SYMBOL PADMA GDAN - if (0xfc6 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - } - } - } - else { - if (code < 0x1c24) { - if (code < 0x1930) { - if (code < 0x1732) { - if (code < 0x1082) { - if (code < 0x103d) { - if (code < 0x1032) { - if (code < 0x1031) { - // Mn [4] MYANMAR VOWEL SIGN I..MYANMAR VOWEL SIGN UU - if (0x102d <= code && code <= 0x1030) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc MYANMAR VOWEL SIGN E - if (0x1031 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x1039) { - // Mn [6] MYANMAR VOWEL SIGN AI..MYANMAR SIGN DOT BELOW - if (0x1032 <= code && code <= 0x1037) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x103b) { - // Mn [2] MYANMAR SIGN VIRAMA..MYANMAR SIGN ASAT - if (0x1039 <= code && code <= 0x103a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] MYANMAR CONSONANT SIGN MEDIAL YA..MYANMAR CONSONANT SIGN MEDIAL RA - if (0x103b <= code && code <= 0x103c) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0x1058) { - if (code < 0x1056) { - // Mn [2] MYANMAR CONSONANT SIGN MEDIAL WA..MYANMAR CONSONANT SIGN MEDIAL HA - if (0x103d <= code && code <= 0x103e) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] MYANMAR VOWEL SIGN VOCALIC R..MYANMAR VOWEL SIGN VOCALIC RR - if (0x1056 <= code && code <= 0x1057) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x105e) { - // Mn [2] MYANMAR VOWEL SIGN VOCALIC L..MYANMAR VOWEL SIGN VOCALIC LL - if (0x1058 <= code && code <= 0x1059) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1071) { - // Mn [3] MYANMAR CONSONANT SIGN MON MEDIAL NA..MYANMAR CONSONANT SIGN MON MEDIAL LA - if (0x105e <= code && code <= 0x1060) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [4] MYANMAR VOWEL SIGN GEBA KAREN I..MYANMAR VOWEL SIGN KAYAH EE - if (0x1071 <= code && code <= 0x1074) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x1100) { - if (code < 0x1085) { - // Mn MYANMAR CONSONANT SIGN SHAN MEDIAL WA - if (0x1082 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mc MYANMAR VOWEL SIGN SHAN E - if (0x1084 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x108d) { - // Mn [2] MYANMAR VOWEL SIGN SHAN E ABOVE..MYANMAR VOWEL SIGN SHAN FINAL Y - if (0x1085 <= code && code <= 0x1086) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn MYANMAR SIGN SHAN COUNCIL EMPHATIC TONE - if (0x108d === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mn MYANMAR VOWEL SIGN AITON AI - if (0x109d === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x135d) { - if (code < 0x1160) { - // Lo [96] HANGUL CHOSEONG KIYEOK..HANGUL CHOSEONG FILLER - if (0x1100 <= code && code <= 0x115f) { - return boundaries_1.CLUSTER_BREAK.L; - } - } - else { - if (code < 0x11a8) { - // Lo [72] HANGUL JUNGSEONG FILLER..HANGUL JUNGSEONG O-YAE - if (0x1160 <= code && code <= 0x11a7) { - return boundaries_1.CLUSTER_BREAK.V; - } - } - else { - // Lo [88] HANGUL JONGSEONG KIYEOK..HANGUL JONGSEONG SSANGNIEUN - if (0x11a8 <= code && code <= 0x11ff) { - return boundaries_1.CLUSTER_BREAK.T; - } - } - } - } - else { - if (code < 0x1712) { - // Mn [3] ETHIOPIC COMBINING GEMINATION AND VOWEL LENGTH MARK..ETHIOPIC COMBINING GEMINATION MARK - if (0x135d <= code && code <= 0x135f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1715) { - // Mn [3] TAGALOG VOWEL SIGN I..TAGALOG SIGN VIRAMA - if (0x1712 <= code && code <= 0x1714) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc TAGALOG SIGN PAMUDPOD - if (0x1715 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - } - else { - if (code < 0x17c9) { - if (code < 0x17b6) { - if (code < 0x1752) { - if (code < 0x1734) { - // Mn [2] HANUNOO VOWEL SIGN I..HANUNOO VOWEL SIGN U - if (0x1732 <= code && code <= 0x1733) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc HANUNOO SIGN PAMUDPOD - if (0x1734 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x1772) { - // Mn [2] BUHID VOWEL SIGN I..BUHID VOWEL SIGN U - if (0x1752 <= code && code <= 0x1753) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x17b4) { - // Mn [2] TAGBANWA VOWEL SIGN I..TAGBANWA VOWEL SIGN U - if (0x1772 <= code && code <= 0x1773) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] KHMER VOWEL INHERENT AQ..KHMER VOWEL INHERENT AA - if (0x17b4 <= code && code <= 0x17b5) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x17be) { - if (code < 0x17b7) { - // Mc KHMER VOWEL SIGN AA - if (0x17b6 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [7] KHMER VOWEL SIGN I..KHMER VOWEL SIGN UA - if (0x17b7 <= code && code <= 0x17bd) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x17c6) { - // Mc [8] KHMER VOWEL SIGN OE..KHMER VOWEL SIGN AU - if (0x17be <= code && code <= 0x17c5) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x17c7) { - // Mn KHMER SIGN NIKAHIT - if (0x17c6 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] KHMER SIGN REAHMUK..KHMER SIGN YUUKALEAPINTU - if (0x17c7 <= code && code <= 0x17c8) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - else { - if (code < 0x1885) { - if (code < 0x180b) { - if (code < 0x17dd) { - // Mn [11] KHMER SIGN MUUSIKATOAN..KHMER SIGN BATHAMASAT - if (0x17c9 <= code && code <= 0x17d3) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn KHMER SIGN ATTHACAN - if (0x17dd === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x180e) { - // Mn [3] MONGOLIAN FREE VARIATION SELECTOR ONE..MONGOLIAN FREE VARIATION SELECTOR THREE - if (0x180b <= code && code <= 0x180d) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Cf MONGOLIAN VOWEL SEPARATOR - if (0x180e === code) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - // Mn MONGOLIAN FREE VARIATION SELECTOR FOUR - if (0x180f === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x1923) { - if (code < 0x18a9) { - // Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA - if (0x1885 <= code && code <= 0x1886) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1920) { - // Mn MONGOLIAN LETTER ALI GALI DAGALGA - if (0x18a9 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [3] LIMBU VOWEL SIGN A..LIMBU VOWEL SIGN U - if (0x1920 <= code && code <= 0x1922) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x1927) { - // Mc [4] LIMBU VOWEL SIGN EE..LIMBU VOWEL SIGN AU - if (0x1923 <= code && code <= 0x1926) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x1929) { - // Mn [2] LIMBU VOWEL SIGN E..LIMBU VOWEL SIGN O - if (0x1927 <= code && code <= 0x1928) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [3] LIMBU SUBJOINED LETTER YA..LIMBU SUBJOINED LETTER WA - if (0x1929 <= code && code <= 0x192b) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - } - } - else { - if (code < 0x1b3b) { - if (code < 0x1a58) { - if (code < 0x1a19) { - if (code < 0x1933) { - if (code < 0x1932) { - // Mc [2] LIMBU SMALL LETTER KA..LIMBU SMALL LETTER NGA - if (0x1930 <= code && code <= 0x1931) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn LIMBU SMALL LETTER ANUSVARA - if (0x1932 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x1939) { - // Mc [6] LIMBU SMALL LETTER TA..LIMBU SMALL LETTER LA - if (0x1933 <= code && code <= 0x1938) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x1a17) { - // Mn [3] LIMBU SIGN MUKPHRENG..LIMBU SIGN SA-I - if (0x1939 <= code && code <= 0x193b) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] BUGINESE VOWEL SIGN I..BUGINESE VOWEL SIGN U - if (0x1a17 <= code && code <= 0x1a18) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x1a55) { - if (code < 0x1a1b) { - // Mc [2] BUGINESE VOWEL SIGN E..BUGINESE VOWEL SIGN O - if (0x1a19 <= code && code <= 0x1a1a) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn BUGINESE VOWEL SIGN AE - if (0x1a1b === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x1a56) { - // Mc TAI THAM CONSONANT SIGN MEDIAL RA - if (0x1a55 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn TAI THAM CONSONANT SIGN MEDIAL LA - if (0x1a56 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mc TAI THAM CONSONANT SIGN LA TANG LAI - if (0x1a57 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0x1a73) { - if (code < 0x1a62) { - if (code < 0x1a60) { - // Mn [7] TAI THAM SIGN MAI KANG LAI..TAI THAM CONSONANT SIGN SA - if (0x1a58 <= code && code <= 0x1a5e) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn TAI THAM SIGN SAKOT - if (0x1a60 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x1a65) { - // Mn TAI THAM VOWEL SIGN MAI SAT - if (0x1a62 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1a6d) { - // Mn [8] TAI THAM VOWEL SIGN I..TAI THAM VOWEL SIGN OA BELOW - if (0x1a65 <= code && code <= 0x1a6c) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [6] TAI THAM VOWEL SIGN OY..TAI THAM VOWEL SIGN THAM AI - if (0x1a6d <= code && code <= 0x1a72) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0x1b00) { - if (code < 0x1a7f) { - // Mn [10] TAI THAM VOWEL SIGN OA ABOVE..TAI THAM SIGN KHUEN-LUE KARAN - if (0x1a73 <= code && code <= 0x1a7c) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1ab0) { - // Mn TAI THAM COMBINING CRYPTOGRAMMIC DOT - if (0x1a7f === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [14] COMBINING DOUBLED CIRCUMFLEX ACCENT..COMBINING PARENTHESES BELOW - // Me COMBINING PARENTHESES OVERLAY - // Mn [16] COMBINING LATIN SMALL LETTER W BELOW..COMBINING LATIN SMALL LETTER INSULAR T - if (0x1ab0 <= code && code <= 0x1ace) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x1b04) { - // Mn [4] BALINESE SIGN ULU RICEM..BALINESE SIGN SURANG - if (0x1b00 <= code && code <= 0x1b03) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1b34) { - // Mc BALINESE SIGN BISAH - if (0x1b04 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn BALINESE SIGN REREKAN - // Mc BALINESE VOWEL SIGN TEDUNG - // Mn [5] BALINESE VOWEL SIGN ULU..BALINESE VOWEL SIGN RA REPA - if (0x1b34 <= code && code <= 0x1b3a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - else { - if (code < 0x1ba8) { - if (code < 0x1b6b) { - if (code < 0x1b3d) { - // Mc BALINESE VOWEL SIGN RA REPA TEDUNG - if (0x1b3b === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn BALINESE VOWEL SIGN LA LENGA - if (0x1b3c === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1b42) { - // Mc [5] BALINESE VOWEL SIGN LA LENGA TEDUNG..BALINESE VOWEL SIGN TALING REPA TEDUNG - if (0x1b3d <= code && code <= 0x1b41) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x1b43) { - // Mn BALINESE VOWEL SIGN PEPET - if (0x1b42 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] BALINESE VOWEL SIGN PEPET TEDUNG..BALINESE ADEG ADEG - if (0x1b43 <= code && code <= 0x1b44) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0x1ba1) { - if (code < 0x1b80) { - // Mn [9] BALINESE MUSICAL SYMBOL COMBINING TEGEH..BALINESE MUSICAL SYMBOL COMBINING GONG - if (0x1b6b <= code && code <= 0x1b73) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1b82) { - // Mn [2] SUNDANESE SIGN PANYECEK..SUNDANESE SIGN PANGLAYAR - if (0x1b80 <= code && code <= 0x1b81) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc SUNDANESE SIGN PANGWISAD - if (0x1b82 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0x1ba2) { - // Mc SUNDANESE CONSONANT SIGN PAMINGKAL - if (0x1ba1 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x1ba6) { - // Mn [4] SUNDANESE CONSONANT SIGN PANYAKRA..SUNDANESE VOWEL SIGN PANYUKU - if (0x1ba2 <= code && code <= 0x1ba5) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] SUNDANESE VOWEL SIGN PANAELAENG..SUNDANESE VOWEL SIGN PANOLONG - if (0x1ba6 <= code && code <= 0x1ba7) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - else { - if (code < 0x1be8) { - if (code < 0x1bab) { - if (code < 0x1baa) { - // Mn [2] SUNDANESE VOWEL SIGN PAMEPET..SUNDANESE VOWEL SIGN PANEULEUNG - if (0x1ba8 <= code && code <= 0x1ba9) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc SUNDANESE SIGN PAMAAEH - if (0x1baa === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x1be6) { - // Mn [3] SUNDANESE SIGN VIRAMA..SUNDANESE CONSONANT SIGN PASANGAN WA - if (0x1bab <= code && code <= 0x1bad) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn BATAK SIGN TOMPI - if (0x1be6 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mc BATAK VOWEL SIGN E - if (0x1be7 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0x1bee) { - if (code < 0x1bea) { - // Mn [2] BATAK VOWEL SIGN PAKPAK E..BATAK VOWEL SIGN EE - if (0x1be8 <= code && code <= 0x1be9) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1bed) { - // Mc [3] BATAK VOWEL SIGN I..BATAK VOWEL SIGN O - if (0x1bea <= code && code <= 0x1bec) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn BATAK VOWEL SIGN KARO O - if (0x1bed === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x1bef) { - // Mc BATAK VOWEL SIGN U - if (0x1bee === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x1bf2) { - // Mn [3] BATAK VOWEL SIGN U FOR SIMALUNGUN SA..BATAK CONSONANT SIGN H - if (0x1bef <= code && code <= 0x1bf1) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] BATAK PANGOLAT..BATAK PANONGONAN - if (0x1bf2 <= code && code <= 0x1bf3) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - } - } - } - else { - if (code < 0xa952) { - if (code < 0x2d7f) { - if (code < 0x1cf7) { - if (code < 0x1cd4) { - if (code < 0x1c34) { - if (code < 0x1c2c) { - // Mc [8] LEPCHA SUBJOINED LETTER YA..LEPCHA VOWEL SIGN UU - if (0x1c24 <= code && code <= 0x1c2b) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [8] LEPCHA VOWEL SIGN E..LEPCHA CONSONANT SIGN T - if (0x1c2c <= code && code <= 0x1c33) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x1c36) { - // Mc [2] LEPCHA CONSONANT SIGN NYIN-DO..LEPCHA CONSONANT SIGN KANG - if (0x1c34 <= code && code <= 0x1c35) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x1cd0) { - // Mn [2] LEPCHA SIGN RAN..LEPCHA SIGN NUKTA - if (0x1c36 <= code && code <= 0x1c37) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [3] VEDIC TONE KARSHANA..VEDIC TONE PRENKHA - if (0x1cd0 <= code && code <= 0x1cd2) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x1ce2) { - if (code < 0x1ce1) { - // Mn [13] VEDIC SIGN YAJURVEDIC MIDLINE SVARITA..VEDIC TONE RIGVEDIC KASHMIRI INDEPENDENT SVARITA - if (0x1cd4 <= code && code <= 0x1ce0) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc VEDIC TONE ATHARVAVEDIC INDEPENDENT SVARITA - if (0x1ce1 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x1ced) { - // Mn [7] VEDIC SIGN VISARGA SVARITA..VEDIC SIGN VISARGA ANUDATTA WITH TAIL - if (0x1ce2 <= code && code <= 0x1ce8) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn VEDIC SIGN TIRYAK - if (0x1ced === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mn VEDIC TONE CANDRA ABOVE - if (0x1cf4 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x200d) { - if (code < 0x1dc0) { - if (code < 0x1cf8) { - // Mc VEDIC SIGN ATIKRAMA - if (0x1cf7 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE - if (0x1cf8 <= code && code <= 0x1cf9) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x200b) { - // Mn [64] COMBINING DOTTED GRAVE ACCENT..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW - if (0x1dc0 <= code && code <= 0x1dff) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Cf ZERO WIDTH SPACE - if (0x200b === code) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - // Cf ZERO WIDTH NON-JOINER - if (0x200c === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x2060) { - if (code < 0x200e) { - // Cf ZERO WIDTH JOINER - if (0x200d === code) { - return boundaries_1.CLUSTER_BREAK.ZWJ; - } - } - else { - if (code < 0x2028) { - // Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK - if (0x200e <= code && code <= 0x200f) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - // Zl LINE SEPARATOR - // Zp PARAGRAPH SEPARATOR - // Cf [5] LEFT-TO-RIGHT EMBEDDING..RIGHT-TO-LEFT OVERRIDE - if (0x2028 <= code && code <= 0x202e) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - } - } - else { - if (code < 0x20d0) { - // Cf [5] WORD JOINER..INVISIBLE PLUS - // Cn - // Cf [10] LEFT-TO-RIGHT ISOLATE..NOMINAL DIGIT SHAPES - if (0x2060 <= code && code <= 0x206f) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - if (code < 0x2cef) { - // Mn [13] COMBINING LEFT HARPOON ABOVE..COMBINING FOUR DOTS ABOVE - // Me [4] COMBINING ENCLOSING CIRCLE..COMBINING ENCLOSING CIRCLE BACKSLASH - // Mn COMBINING LEFT RIGHT ARROW ABOVE - // Me [3] COMBINING ENCLOSING SCREEN..COMBINING ENCLOSING UPWARD POINTING TRIANGLE - // Mn [12] COMBINING REVERSE SOLIDUS OVERLAY..COMBINING ASTERISK ABOVE - if (0x20d0 <= code && code <= 0x20f0) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [3] COPTIC COMBINING NI ABOVE..COPTIC COMBINING SPIRITUS LENIS - if (0x2cef <= code && code <= 0x2cf1) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - else { - if (code < 0xa823) { - if (code < 0xa674) { - if (code < 0x302a) { - if (code < 0x2de0) { - // Mn TIFINAGH CONSONANT JOINER - if (0x2d7f === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [32] COMBINING CYRILLIC LETTER BE..COMBINING CYRILLIC LETTER IOTIFIED BIG YUS - if (0x2de0 <= code && code <= 0x2dff) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x3099) { - // Mn [4] IDEOGRAPHIC LEVEL TONE MARK..IDEOGRAPHIC ENTERING TONE MARK - // Mc [2] HANGUL SINGLE DOT TONE MARK..HANGUL DOUBLE DOT TONE MARK - if (0x302a <= code && code <= 0x302f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xa66f) { - // Mn [2] COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK..COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK - if (0x3099 <= code && code <= 0x309a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn COMBINING CYRILLIC VZMET - // Me [3] COMBINING CYRILLIC TEN MILLIONS SIGN..COMBINING CYRILLIC THOUSAND MILLIONS SIGN - if (0xa66f <= code && code <= 0xa672) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0xa802) { - if (code < 0xa69e) { - // Mn [10] COMBINING CYRILLIC LETTER UKRAINIAN IE..COMBINING CYRILLIC PAYEROK - if (0xa674 <= code && code <= 0xa67d) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xa6f0) { - // Mn [2] COMBINING CYRILLIC LETTER EF..COMBINING CYRILLIC LETTER IOTIFIED E - if (0xa69e <= code && code <= 0xa69f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] BAMUM COMBINING MARK KOQNDON..BAMUM COMBINING MARK TUKWENTIS - if (0xa6f0 <= code && code <= 0xa6f1) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xa806) { - // Mn SYLOTI NAGRI SIGN DVISVARA - if (0xa802 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn SYLOTI NAGRI SIGN HASANTA - if (0xa806 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mn SYLOTI NAGRI SIGN ANUSVARA - if (0xa80b === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0xa8b4) { - if (code < 0xa827) { - if (code < 0xa825) { - // Mc [2] SYLOTI NAGRI VOWEL SIGN A..SYLOTI NAGRI VOWEL SIGN I - if (0xa823 <= code && code <= 0xa824) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] SYLOTI NAGRI VOWEL SIGN U..SYLOTI NAGRI VOWEL SIGN E - if (0xa825 <= code && code <= 0xa826) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0xa82c) { - // Mc SYLOTI NAGRI VOWEL SIGN OO - if (0xa827 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xa880) { - // Mn SYLOTI NAGRI SIGN ALTERNATE HASANTA - if (0xa82c === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHTRA SIGN VISARGA - if (0xa880 <= code && code <= 0xa881) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0xa8ff) { - if (code < 0xa8c4) { - // Mc [16] SAURASHTRA CONSONANT SIGN HAARU..SAURASHTRA VOWEL SIGN AU - if (0xa8b4 <= code && code <= 0xa8c3) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xa8e0) { - // Mn [2] SAURASHTRA SIGN VIRAMA..SAURASHTRA SIGN CANDRABINDU - if (0xa8c4 <= code && code <= 0xa8c5) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [18] COMBINING DEVANAGARI DIGIT ZERO..COMBINING DEVANAGARI SIGN AVAGRAHA - if (0xa8e0 <= code && code <= 0xa8f1) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xa926) { - // Mn DEVANAGARI VOWEL SIGN AY - if (0xa8ff === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xa947) { - // Mn [8] KAYAH LI VOWEL UE..KAYAH LI TONE CALYA PLOPHU - if (0xa926 <= code && code <= 0xa92d) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [11] REJANG VOWEL SIGN I..REJANG CONSONANT SIGN R - if (0xa947 <= code && code <= 0xa951) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - } - else { - if (code < 0xaab2) { - if (code < 0xa9e5) { - if (code < 0xa9b4) { - if (code < 0xa980) { - if (code < 0xa960) { - // Mc [2] REJANG CONSONANT SIGN H..REJANG VIRAMA - if (0xa952 <= code && code <= 0xa953) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Lo [29] HANGUL CHOSEONG TIKEUT-MIEUM..HANGUL CHOSEONG SSANGYEORINHIEUH - if (0xa960 <= code && code <= 0xa97c) { - return boundaries_1.CLUSTER_BREAK.L; - } - } - } - else { - if (code < 0xa983) { - // Mn [3] JAVANESE SIGN PANYANGGA..JAVANESE SIGN LAYAR - if (0xa980 <= code && code <= 0xa982) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc JAVANESE SIGN WIGNYAN - if (0xa983 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn JAVANESE SIGN CECAK TELU - if (0xa9b3 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xa9ba) { - if (code < 0xa9b6) { - // Mc [2] JAVANESE VOWEL SIGN TARUNG..JAVANESE VOWEL SIGN TOLONG - if (0xa9b4 <= code && code <= 0xa9b5) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [4] JAVANESE VOWEL SIGN WULU..JAVANESE VOWEL SIGN SUKU MENDUT - if (0xa9b6 <= code && code <= 0xa9b9) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0xa9bc) { - // Mc [2] JAVANESE VOWEL SIGN TALING..JAVANESE VOWEL SIGN DIRGA MURE - if (0xa9ba <= code && code <= 0xa9bb) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xa9be) { - // Mn [2] JAVANESE VOWEL SIGN PEPET..JAVANESE CONSONANT SIGN KERET - if (0xa9bc <= code && code <= 0xa9bd) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [3] JAVANESE CONSONANT SIGN PENGKAL..JAVANESE PANGKON - if (0xa9be <= code && code <= 0xa9c0) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - else { - if (code < 0xaa35) { - if (code < 0xaa2f) { - if (code < 0xaa29) { - // Mn MYANMAR SIGN SHAN SAW - if (0xa9e5 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [6] CHAM VOWEL SIGN AA..CHAM VOWEL SIGN OE - if (0xaa29 <= code && code <= 0xaa2e) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0xaa31) { - // Mc [2] CHAM VOWEL SIGN O..CHAM VOWEL SIGN AI - if (0xaa2f <= code && code <= 0xaa30) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0xaa33) { - // Mn [2] CHAM VOWEL SIGN AU..CHAM VOWEL SIGN UE - if (0xaa31 <= code && code <= 0xaa32) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] CHAM CONSONANT SIGN YA..CHAM CONSONANT SIGN RA - if (0xaa33 <= code && code <= 0xaa34) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0xaa4d) { - if (code < 0xaa43) { - // Mn [2] CHAM CONSONANT SIGN LA..CHAM CONSONANT SIGN WA - if (0xaa35 <= code && code <= 0xaa36) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn CHAM CONSONANT SIGN FINAL NG - if (0xaa43 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mn CHAM CONSONANT SIGN FINAL M - if (0xaa4c === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0xaa7c) { - // Mc CHAM CONSONANT SIGN FINAL H - if (0xaa4d === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn MYANMAR SIGN TAI LAING TONE-2 - if (0xaa7c === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mn TAI VIET MAI KANG - if (0xaab0 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0xabe6) { - if (code < 0xaaec) { - if (code < 0xaabe) { - if (code < 0xaab7) { - // Mn [3] TAI VIET VOWEL I..TAI VIET VOWEL U - if (0xaab2 <= code && code <= 0xaab4) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] TAI VIET MAI KHIT..TAI VIET VOWEL IA - if (0xaab7 <= code && code <= 0xaab8) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0xaac1) { - // Mn [2] TAI VIET VOWEL AM..TAI VIET TONE MAI EK - if (0xaabe <= code && code <= 0xaabf) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn TAI VIET TONE MAI THO - if (0xaac1 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mc MEETEI MAYEK VOWEL SIGN II - if (0xaaeb === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0xaaf6) { - if (code < 0xaaee) { - // Mn [2] MEETEI MAYEK VOWEL SIGN UU..MEETEI MAYEK VOWEL SIGN AAI - if (0xaaec <= code && code <= 0xaaed) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xaaf5) { - // Mc [2] MEETEI MAYEK VOWEL SIGN AU..MEETEI MAYEK VOWEL SIGN AAU - if (0xaaee <= code && code <= 0xaaef) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mc MEETEI MAYEK VOWEL SIGN VISARGA - if (0xaaf5 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0xabe3) { - // Mn MEETEI MAYEK VIRAMA - if (0xaaf6 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xabe5) { - // Mc [2] MEETEI MAYEK VOWEL SIGN ONAP..MEETEI MAYEK VOWEL SIGN INAP - if (0xabe3 <= code && code <= 0xabe4) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn MEETEI MAYEK VOWEL SIGN ANAP - if (0xabe5 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0xac00) { - if (code < 0xabe9) { - if (code < 0xabe8) { - // Mc [2] MEETEI MAYEK VOWEL SIGN YENAP..MEETEI MAYEK VOWEL SIGN SOUNAP - if (0xabe6 <= code && code <= 0xabe7) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn MEETEI MAYEK VOWEL SIGN UNAP - if (0xabe8 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0xabec) { - // Mc [2] MEETEI MAYEK VOWEL SIGN CHEINAP..MEETEI MAYEK VOWEL SIGN NUNG - if (0xabe9 <= code && code <= 0xabea) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mc MEETEI MAYEK LUM IYEK - if (0xabec === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn MEETEI MAYEK APUN IYEK - if (0xabed === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xac1d) { - if (code < 0xac01) { - // Lo HANGUL SYLLABLE GA - if (0xac00 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xac1c) { - // Lo [27] HANGUL SYLLABLE GAG..HANGUL SYLLABLE GAH - if (0xac01 <= code && code <= 0xac1b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GAE - if (0xac1c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xac38) { - // Lo [27] HANGUL SYLLABLE GAEG..HANGUL SYLLABLE GAEH - if (0xac1d <= code && code <= 0xac37) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xac39) { - // Lo HANGUL SYLLABLE GYA - if (0xac38 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GYAG..HANGUL SYLLABLE GYAH - if (0xac39 <= code && code <= 0xac53) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - } - } - } - else { - if (code < 0xb5a1) { - if (code < 0xb0ed) { - if (code < 0xaea0) { - if (code < 0xad6d) { - if (code < 0xace0) { - if (code < 0xac8d) { - if (code < 0xac70) { - if (code < 0xac55) { - // Lo HANGUL SYLLABLE GYAE - if (0xac54 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GYAEG..HANGUL SYLLABLE GYAEH - if (0xac55 <= code && code <= 0xac6f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xac71) { - // Lo HANGUL SYLLABLE GEO - if (0xac70 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xac8c) { - // Lo [27] HANGUL SYLLABLE GEOG..HANGUL SYLLABLE GEOH - if (0xac71 <= code && code <= 0xac8b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GE - if (0xac8c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xaca9) { - if (code < 0xaca8) { - // Lo [27] HANGUL SYLLABLE GEG..HANGUL SYLLABLE GEH - if (0xac8d <= code && code <= 0xaca7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GYEO - if (0xaca8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xacc4) { - // Lo [27] HANGUL SYLLABLE GYEOG..HANGUL SYLLABLE GYEOH - if (0xaca9 <= code && code <= 0xacc3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xacc5) { - // Lo HANGUL SYLLABLE GYE - if (0xacc4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GYEG..HANGUL SYLLABLE GYEH - if (0xacc5 <= code && code <= 0xacdf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xad19) { - if (code < 0xacfc) { - if (code < 0xace1) { - // Lo HANGUL SYLLABLE GO - if (0xace0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GOG..HANGUL SYLLABLE GOH - if (0xace1 <= code && code <= 0xacfb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xacfd) { - // Lo HANGUL SYLLABLE GWA - if (0xacfc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xad18) { - // Lo [27] HANGUL SYLLABLE GWAG..HANGUL SYLLABLE GWAH - if (0xacfd <= code && code <= 0xad17) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GWAE - if (0xad18 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xad50) { - if (code < 0xad34) { - // Lo [27] HANGUL SYLLABLE GWAEG..HANGUL SYLLABLE GWAEH - if (0xad19 <= code && code <= 0xad33) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xad35) { - // Lo HANGUL SYLLABLE GOE - if (0xad34 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GOEG..HANGUL SYLLABLE GOEH - if (0xad35 <= code && code <= 0xad4f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xad51) { - // Lo HANGUL SYLLABLE GYO - if (0xad50 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xad6c) { - // Lo [27] HANGUL SYLLABLE GYOG..HANGUL SYLLABLE GYOH - if (0xad51 <= code && code <= 0xad6b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GU - if (0xad6c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xadf9) { - if (code < 0xadc0) { - if (code < 0xad89) { - if (code < 0xad88) { - // Lo [27] HANGUL SYLLABLE GUG..HANGUL SYLLABLE GUH - if (0xad6d <= code && code <= 0xad87) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GWEO - if (0xad88 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xada4) { - // Lo [27] HANGUL SYLLABLE GWEOG..HANGUL SYLLABLE GWEOH - if (0xad89 <= code && code <= 0xada3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xada5) { - // Lo HANGUL SYLLABLE GWE - if (0xada4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GWEG..HANGUL SYLLABLE GWEH - if (0xada5 <= code && code <= 0xadbf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xaddc) { - if (code < 0xadc1) { - // Lo HANGUL SYLLABLE GWI - if (0xadc0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GWIG..HANGUL SYLLABLE GWIH - if (0xadc1 <= code && code <= 0xaddb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xaddd) { - // Lo HANGUL SYLLABLE GYU - if (0xaddc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xadf8) { - // Lo [27] HANGUL SYLLABLE GYUG..HANGUL SYLLABLE GYUH - if (0xaddd <= code && code <= 0xadf7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GEU - if (0xadf8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xae4c) { - if (code < 0xae15) { - if (code < 0xae14) { - // Lo [27] HANGUL SYLLABLE GEUG..HANGUL SYLLABLE GEUH - if (0xadf9 <= code && code <= 0xae13) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GYI - if (0xae14 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xae30) { - // Lo [27] HANGUL SYLLABLE GYIG..HANGUL SYLLABLE GYIH - if (0xae15 <= code && code <= 0xae2f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xae31) { - // Lo HANGUL SYLLABLE GI - if (0xae30 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GIG..HANGUL SYLLABLE GIH - if (0xae31 <= code && code <= 0xae4b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xae69) { - if (code < 0xae4d) { - // Lo HANGUL SYLLABLE GGA - if (0xae4c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xae68) { - // Lo [27] HANGUL SYLLABLE GGAG..HANGUL SYLLABLE GGAH - if (0xae4d <= code && code <= 0xae67) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GGAE - if (0xae68 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xae84) { - // Lo [27] HANGUL SYLLABLE GGAEG..HANGUL SYLLABLE GGAEH - if (0xae69 <= code && code <= 0xae83) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xae85) { - // Lo HANGUL SYLLABLE GGYA - if (0xae84 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GGYAG..HANGUL SYLLABLE GGYAH - if (0xae85 <= code && code <= 0xae9f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - else { - if (code < 0xafb9) { - if (code < 0xaf2c) { - if (code < 0xaed9) { - if (code < 0xaebc) { - if (code < 0xaea1) { - // Lo HANGUL SYLLABLE GGYAE - if (0xaea0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GGYAEG..HANGUL SYLLABLE GGYAEH - if (0xaea1 <= code && code <= 0xaebb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xaebd) { - // Lo HANGUL SYLLABLE GGEO - if (0xaebc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xaed8) { - // Lo [27] HANGUL SYLLABLE GGEOG..HANGUL SYLLABLE GGEOH - if (0xaebd <= code && code <= 0xaed7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GGE - if (0xaed8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xaef5) { - if (code < 0xaef4) { - // Lo [27] HANGUL SYLLABLE GGEG..HANGUL SYLLABLE GGEH - if (0xaed9 <= code && code <= 0xaef3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GGYEO - if (0xaef4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xaf10) { - // Lo [27] HANGUL SYLLABLE GGYEOG..HANGUL SYLLABLE GGYEOH - if (0xaef5 <= code && code <= 0xaf0f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xaf11) { - // Lo HANGUL SYLLABLE GGYE - if (0xaf10 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GGYEG..HANGUL SYLLABLE GGYEH - if (0xaf11 <= code && code <= 0xaf2b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xaf65) { - if (code < 0xaf48) { - if (code < 0xaf2d) { - // Lo HANGUL SYLLABLE GGO - if (0xaf2c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GGOG..HANGUL SYLLABLE GGOH - if (0xaf2d <= code && code <= 0xaf47) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xaf49) { - // Lo HANGUL SYLLABLE GGWA - if (0xaf48 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xaf64) { - // Lo [27] HANGUL SYLLABLE GGWAG..HANGUL SYLLABLE GGWAH - if (0xaf49 <= code && code <= 0xaf63) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GGWAE - if (0xaf64 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xaf9c) { - if (code < 0xaf80) { - // Lo [27] HANGUL SYLLABLE GGWAEG..HANGUL SYLLABLE GGWAEH - if (0xaf65 <= code && code <= 0xaf7f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xaf81) { - // Lo HANGUL SYLLABLE GGOE - if (0xaf80 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GGOEG..HANGUL SYLLABLE GGOEH - if (0xaf81 <= code && code <= 0xaf9b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xaf9d) { - // Lo HANGUL SYLLABLE GGYO - if (0xaf9c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xafb8) { - // Lo [27] HANGUL SYLLABLE GGYOG..HANGUL SYLLABLE GGYOH - if (0xaf9d <= code && code <= 0xafb7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GGU - if (0xafb8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xb060) { - if (code < 0xb00c) { - if (code < 0xafd5) { - if (code < 0xafd4) { - // Lo [27] HANGUL SYLLABLE GGUG..HANGUL SYLLABLE GGUH - if (0xafb9 <= code && code <= 0xafd3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GGWEO - if (0xafd4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xaff0) { - // Lo [27] HANGUL SYLLABLE GGWEOG..HANGUL SYLLABLE GGWEOH - if (0xafd5 <= code && code <= 0xafef) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xaff1) { - // Lo HANGUL SYLLABLE GGWE - if (0xaff0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GGWEG..HANGUL SYLLABLE GGWEH - if (0xaff1 <= code && code <= 0xb00b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xb029) { - if (code < 0xb00d) { - // Lo HANGUL SYLLABLE GGWI - if (0xb00c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb028) { - // Lo [27] HANGUL SYLLABLE GGWIG..HANGUL SYLLABLE GGWIH - if (0xb00d <= code && code <= 0xb027) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE GGYU - if (0xb028 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xb044) { - // Lo [27] HANGUL SYLLABLE GGYUG..HANGUL SYLLABLE GGYUH - if (0xb029 <= code && code <= 0xb043) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb045) { - // Lo HANGUL SYLLABLE GGEU - if (0xb044 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GGEUG..HANGUL SYLLABLE GGEUH - if (0xb045 <= code && code <= 0xb05f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xb099) { - if (code < 0xb07c) { - if (code < 0xb061) { - // Lo HANGUL SYLLABLE GGYI - if (0xb060 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE GGYIG..HANGUL SYLLABLE GGYIH - if (0xb061 <= code && code <= 0xb07b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb07d) { - // Lo HANGUL SYLLABLE GGI - if (0xb07c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb098) { - // Lo [27] HANGUL SYLLABLE GGIG..HANGUL SYLLABLE GGIH - if (0xb07d <= code && code <= 0xb097) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE NA - if (0xb098 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xb0d0) { - if (code < 0xb0b4) { - // Lo [27] HANGUL SYLLABLE NAG..HANGUL SYLLABLE NAH - if (0xb099 <= code && code <= 0xb0b3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb0b5) { - // Lo HANGUL SYLLABLE NAE - if (0xb0b4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE NAEG..HANGUL SYLLABLE NAEH - if (0xb0b5 <= code && code <= 0xb0cf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xb0d1) { - // Lo HANGUL SYLLABLE NYA - if (0xb0d0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb0ec) { - // Lo [27] HANGUL SYLLABLE NYAG..HANGUL SYLLABLE NYAH - if (0xb0d1 <= code && code <= 0xb0eb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE NYAE - if (0xb0ec === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - } - } - else { - if (code < 0xb354) { - if (code < 0xb220) { - if (code < 0xb179) { - if (code < 0xb140) { - if (code < 0xb109) { - if (code < 0xb108) { - // Lo [27] HANGUL SYLLABLE NYAEG..HANGUL SYLLABLE NYAEH - if (0xb0ed <= code && code <= 0xb107) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE NEO - if (0xb108 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb124) { - // Lo [27] HANGUL SYLLABLE NEOG..HANGUL SYLLABLE NEOH - if (0xb109 <= code && code <= 0xb123) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb125) { - // Lo HANGUL SYLLABLE NE - if (0xb124 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE NEG..HANGUL SYLLABLE NEH - if (0xb125 <= code && code <= 0xb13f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xb15c) { - if (code < 0xb141) { - // Lo HANGUL SYLLABLE NYEO - if (0xb140 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE NYEOG..HANGUL SYLLABLE NYEOH - if (0xb141 <= code && code <= 0xb15b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb15d) { - // Lo HANGUL SYLLABLE NYE - if (0xb15c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb178) { - // Lo [27] HANGUL SYLLABLE NYEG..HANGUL SYLLABLE NYEH - if (0xb15d <= code && code <= 0xb177) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE NO - if (0xb178 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xb1cc) { - if (code < 0xb195) { - if (code < 0xb194) { - // Lo [27] HANGUL SYLLABLE NOG..HANGUL SYLLABLE NOH - if (0xb179 <= code && code <= 0xb193) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE NWA - if (0xb194 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb1b0) { - // Lo [27] HANGUL SYLLABLE NWAG..HANGUL SYLLABLE NWAH - if (0xb195 <= code && code <= 0xb1af) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb1b1) { - // Lo HANGUL SYLLABLE NWAE - if (0xb1b0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE NWAEG..HANGUL SYLLABLE NWAEH - if (0xb1b1 <= code && code <= 0xb1cb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xb1e9) { - if (code < 0xb1cd) { - // Lo HANGUL SYLLABLE NOE - if (0xb1cc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb1e8) { - // Lo [27] HANGUL SYLLABLE NOEG..HANGUL SYLLABLE NOEH - if (0xb1cd <= code && code <= 0xb1e7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE NYO - if (0xb1e8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xb204) { - // Lo [27] HANGUL SYLLABLE NYOG..HANGUL SYLLABLE NYOH - if (0xb1e9 <= code && code <= 0xb203) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb205) { - // Lo HANGUL SYLLABLE NU - if (0xb204 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE NUG..HANGUL SYLLABLE NUH - if (0xb205 <= code && code <= 0xb21f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - else { - if (code < 0xb2ad) { - if (code < 0xb259) { - if (code < 0xb23c) { - if (code < 0xb221) { - // Lo HANGUL SYLLABLE NWEO - if (0xb220 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE NWEOG..HANGUL SYLLABLE NWEOH - if (0xb221 <= code && code <= 0xb23b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb23d) { - // Lo HANGUL SYLLABLE NWE - if (0xb23c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb258) { - // Lo [27] HANGUL SYLLABLE NWEG..HANGUL SYLLABLE NWEH - if (0xb23d <= code && code <= 0xb257) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE NWI - if (0xb258 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xb290) { - if (code < 0xb274) { - // Lo [27] HANGUL SYLLABLE NWIG..HANGUL SYLLABLE NWIH - if (0xb259 <= code && code <= 0xb273) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb275) { - // Lo HANGUL SYLLABLE NYU - if (0xb274 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE NYUG..HANGUL SYLLABLE NYUH - if (0xb275 <= code && code <= 0xb28f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xb291) { - // Lo HANGUL SYLLABLE NEU - if (0xb290 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb2ac) { - // Lo [27] HANGUL SYLLABLE NEUG..HANGUL SYLLABLE NEUH - if (0xb291 <= code && code <= 0xb2ab) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE NYI - if (0xb2ac === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xb300) { - if (code < 0xb2c9) { - if (code < 0xb2c8) { - // Lo [27] HANGUL SYLLABLE NYIG..HANGUL SYLLABLE NYIH - if (0xb2ad <= code && code <= 0xb2c7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE NI - if (0xb2c8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb2e4) { - // Lo [27] HANGUL SYLLABLE NIG..HANGUL SYLLABLE NIH - if (0xb2c9 <= code && code <= 0xb2e3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb2e5) { - // Lo HANGUL SYLLABLE DA - if (0xb2e4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DAG..HANGUL SYLLABLE DAH - if (0xb2e5 <= code && code <= 0xb2ff) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xb31d) { - if (code < 0xb301) { - // Lo HANGUL SYLLABLE DAE - if (0xb300 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb31c) { - // Lo [27] HANGUL SYLLABLE DAEG..HANGUL SYLLABLE DAEH - if (0xb301 <= code && code <= 0xb31b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DYA - if (0xb31c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xb338) { - // Lo [27] HANGUL SYLLABLE DYAG..HANGUL SYLLABLE DYAH - if (0xb31d <= code && code <= 0xb337) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb339) { - // Lo HANGUL SYLLABLE DYAE - if (0xb338 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DYAEG..HANGUL SYLLABLE DYAEH - if (0xb339 <= code && code <= 0xb353) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - else { - if (code < 0xb46d) { - if (code < 0xb3e0) { - if (code < 0xb38d) { - if (code < 0xb370) { - if (code < 0xb355) { - // Lo HANGUL SYLLABLE DEO - if (0xb354 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DEOG..HANGUL SYLLABLE DEOH - if (0xb355 <= code && code <= 0xb36f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb371) { - // Lo HANGUL SYLLABLE DE - if (0xb370 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb38c) { - // Lo [27] HANGUL SYLLABLE DEG..HANGUL SYLLABLE DEH - if (0xb371 <= code && code <= 0xb38b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DYEO - if (0xb38c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xb3a9) { - if (code < 0xb3a8) { - // Lo [27] HANGUL SYLLABLE DYEOG..HANGUL SYLLABLE DYEOH - if (0xb38d <= code && code <= 0xb3a7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DYE - if (0xb3a8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb3c4) { - // Lo [27] HANGUL SYLLABLE DYEG..HANGUL SYLLABLE DYEH - if (0xb3a9 <= code && code <= 0xb3c3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb3c5) { - // Lo HANGUL SYLLABLE DO - if (0xb3c4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DOG..HANGUL SYLLABLE DOH - if (0xb3c5 <= code && code <= 0xb3df) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xb419) { - if (code < 0xb3fc) { - if (code < 0xb3e1) { - // Lo HANGUL SYLLABLE DWA - if (0xb3e0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DWAG..HANGUL SYLLABLE DWAH - if (0xb3e1 <= code && code <= 0xb3fb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb3fd) { - // Lo HANGUL SYLLABLE DWAE - if (0xb3fc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb418) { - // Lo [27] HANGUL SYLLABLE DWAEG..HANGUL SYLLABLE DWAEH - if (0xb3fd <= code && code <= 0xb417) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DOE - if (0xb418 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xb450) { - if (code < 0xb434) { - // Lo [27] HANGUL SYLLABLE DOEG..HANGUL SYLLABLE DOEH - if (0xb419 <= code && code <= 0xb433) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb435) { - // Lo HANGUL SYLLABLE DYO - if (0xb434 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DYOG..HANGUL SYLLABLE DYOH - if (0xb435 <= code && code <= 0xb44f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xb451) { - // Lo HANGUL SYLLABLE DU - if (0xb450 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb46c) { - // Lo [27] HANGUL SYLLABLE DUG..HANGUL SYLLABLE DUH - if (0xb451 <= code && code <= 0xb46b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DWEO - if (0xb46c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xb514) { - if (code < 0xb4c0) { - if (code < 0xb489) { - if (code < 0xb488) { - // Lo [27] HANGUL SYLLABLE DWEOG..HANGUL SYLLABLE DWEOH - if (0xb46d <= code && code <= 0xb487) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DWE - if (0xb488 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb4a4) { - // Lo [27] HANGUL SYLLABLE DWEG..HANGUL SYLLABLE DWEH - if (0xb489 <= code && code <= 0xb4a3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb4a5) { - // Lo HANGUL SYLLABLE DWI - if (0xb4a4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DWIG..HANGUL SYLLABLE DWIH - if (0xb4a5 <= code && code <= 0xb4bf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xb4dd) { - if (code < 0xb4c1) { - // Lo HANGUL SYLLABLE DYU - if (0xb4c0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb4dc) { - // Lo [27] HANGUL SYLLABLE DYUG..HANGUL SYLLABLE DYUH - if (0xb4c1 <= code && code <= 0xb4db) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DEU - if (0xb4dc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xb4f8) { - // Lo [27] HANGUL SYLLABLE DEUG..HANGUL SYLLABLE DEUH - if (0xb4dd <= code && code <= 0xb4f7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb4f9) { - // Lo HANGUL SYLLABLE DYI - if (0xb4f8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DYIG..HANGUL SYLLABLE DYIH - if (0xb4f9 <= code && code <= 0xb513) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xb54d) { - if (code < 0xb530) { - if (code < 0xb515) { - // Lo HANGUL SYLLABLE DI - if (0xb514 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DIG..HANGUL SYLLABLE DIH - if (0xb515 <= code && code <= 0xb52f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb531) { - // Lo HANGUL SYLLABLE DDA - if (0xb530 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb54c) { - // Lo [27] HANGUL SYLLABLE DDAG..HANGUL SYLLABLE DDAH - if (0xb531 <= code && code <= 0xb54b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DDAE - if (0xb54c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xb584) { - if (code < 0xb568) { - // Lo [27] HANGUL SYLLABLE DDAEG..HANGUL SYLLABLE DDAEH - if (0xb54d <= code && code <= 0xb567) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb569) { - // Lo HANGUL SYLLABLE DDYA - if (0xb568 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DDYAG..HANGUL SYLLABLE DDYAH - if (0xb569 <= code && code <= 0xb583) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xb585) { - // Lo HANGUL SYLLABLE DDYAE - if (0xb584 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb5a0) { - // Lo [27] HANGUL SYLLABLE DDYAEG..HANGUL SYLLABLE DDYAEH - if (0xb585 <= code && code <= 0xb59f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DDEO - if (0xb5a0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - } - } - } - else { - if (code < 0xba55) { - if (code < 0xb808) { - if (code < 0xb6d4) { - if (code < 0xb62d) { - if (code < 0xb5f4) { - if (code < 0xb5bd) { - if (code < 0xb5bc) { - // Lo [27] HANGUL SYLLABLE DDEOG..HANGUL SYLLABLE DDEOH - if (0xb5a1 <= code && code <= 0xb5bb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DDE - if (0xb5bc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb5d8) { - // Lo [27] HANGUL SYLLABLE DDEG..HANGUL SYLLABLE DDEH - if (0xb5bd <= code && code <= 0xb5d7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb5d9) { - // Lo HANGUL SYLLABLE DDYEO - if (0xb5d8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DDYEOG..HANGUL SYLLABLE DDYEOH - if (0xb5d9 <= code && code <= 0xb5f3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xb610) { - if (code < 0xb5f5) { - // Lo HANGUL SYLLABLE DDYE - if (0xb5f4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DDYEG..HANGUL SYLLABLE DDYEH - if (0xb5f5 <= code && code <= 0xb60f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb611) { - // Lo HANGUL SYLLABLE DDO - if (0xb610 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb62c) { - // Lo [27] HANGUL SYLLABLE DDOG..HANGUL SYLLABLE DDOH - if (0xb611 <= code && code <= 0xb62b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DDWA - if (0xb62c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xb680) { - if (code < 0xb649) { - if (code < 0xb648) { - // Lo [27] HANGUL SYLLABLE DDWAG..HANGUL SYLLABLE DDWAH - if (0xb62d <= code && code <= 0xb647) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DDWAE - if (0xb648 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb664) { - // Lo [27] HANGUL SYLLABLE DDWAEG..HANGUL SYLLABLE DDWAEH - if (0xb649 <= code && code <= 0xb663) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb665) { - // Lo HANGUL SYLLABLE DDOE - if (0xb664 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DDOEG..HANGUL SYLLABLE DDOEH - if (0xb665 <= code && code <= 0xb67f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xb69d) { - if (code < 0xb681) { - // Lo HANGUL SYLLABLE DDYO - if (0xb680 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb69c) { - // Lo [27] HANGUL SYLLABLE DDYOG..HANGUL SYLLABLE DDYOH - if (0xb681 <= code && code <= 0xb69b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DDU - if (0xb69c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xb6b8) { - // Lo [27] HANGUL SYLLABLE DDUG..HANGUL SYLLABLE DDUH - if (0xb69d <= code && code <= 0xb6b7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb6b9) { - // Lo HANGUL SYLLABLE DDWEO - if (0xb6b8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DDWEOG..HANGUL SYLLABLE DDWEOH - if (0xb6b9 <= code && code <= 0xb6d3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - else { - if (code < 0xb761) { - if (code < 0xb70d) { - if (code < 0xb6f0) { - if (code < 0xb6d5) { - // Lo HANGUL SYLLABLE DDWE - if (0xb6d4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DDWEG..HANGUL SYLLABLE DDWEH - if (0xb6d5 <= code && code <= 0xb6ef) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb6f1) { - // Lo HANGUL SYLLABLE DDWI - if (0xb6f0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb70c) { - // Lo [27] HANGUL SYLLABLE DDWIG..HANGUL SYLLABLE DDWIH - if (0xb6f1 <= code && code <= 0xb70b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DDYU - if (0xb70c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xb744) { - if (code < 0xb728) { - // Lo [27] HANGUL SYLLABLE DDYUG..HANGUL SYLLABLE DDYUH - if (0xb70d <= code && code <= 0xb727) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb729) { - // Lo HANGUL SYLLABLE DDEU - if (0xb728 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE DDEUG..HANGUL SYLLABLE DDEUH - if (0xb729 <= code && code <= 0xb743) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xb745) { - // Lo HANGUL SYLLABLE DDYI - if (0xb744 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb760) { - // Lo [27] HANGUL SYLLABLE DDYIG..HANGUL SYLLABLE DDYIH - if (0xb745 <= code && code <= 0xb75f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE DDI - if (0xb760 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xb7b4) { - if (code < 0xb77d) { - if (code < 0xb77c) { - // Lo [27] HANGUL SYLLABLE DDIG..HANGUL SYLLABLE DDIH - if (0xb761 <= code && code <= 0xb77b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE RA - if (0xb77c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb798) { - // Lo [27] HANGUL SYLLABLE RAG..HANGUL SYLLABLE RAH - if (0xb77d <= code && code <= 0xb797) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb799) { - // Lo HANGUL SYLLABLE RAE - if (0xb798 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE RAEG..HANGUL SYLLABLE RAEH - if (0xb799 <= code && code <= 0xb7b3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xb7d1) { - if (code < 0xb7b5) { - // Lo HANGUL SYLLABLE RYA - if (0xb7b4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb7d0) { - // Lo [27] HANGUL SYLLABLE RYAG..HANGUL SYLLABLE RYAH - if (0xb7b5 <= code && code <= 0xb7cf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE RYAE - if (0xb7d0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xb7ec) { - // Lo [27] HANGUL SYLLABLE RYAEG..HANGUL SYLLABLE RYAEH - if (0xb7d1 <= code && code <= 0xb7eb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb7ed) { - // Lo HANGUL SYLLABLE REO - if (0xb7ec === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE REOG..HANGUL SYLLABLE REOH - if (0xb7ed <= code && code <= 0xb807) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - else { - if (code < 0xb921) { - if (code < 0xb894) { - if (code < 0xb841) { - if (code < 0xb824) { - if (code < 0xb809) { - // Lo HANGUL SYLLABLE RE - if (0xb808 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE REG..HANGUL SYLLABLE REH - if (0xb809 <= code && code <= 0xb823) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb825) { - // Lo HANGUL SYLLABLE RYEO - if (0xb824 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb840) { - // Lo [27] HANGUL SYLLABLE RYEOG..HANGUL SYLLABLE RYEOH - if (0xb825 <= code && code <= 0xb83f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE RYE - if (0xb840 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xb85d) { - if (code < 0xb85c) { - // Lo [27] HANGUL SYLLABLE RYEG..HANGUL SYLLABLE RYEH - if (0xb841 <= code && code <= 0xb85b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE RO - if (0xb85c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb878) { - // Lo [27] HANGUL SYLLABLE ROG..HANGUL SYLLABLE ROH - if (0xb85d <= code && code <= 0xb877) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb879) { - // Lo HANGUL SYLLABLE RWA - if (0xb878 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE RWAG..HANGUL SYLLABLE RWAH - if (0xb879 <= code && code <= 0xb893) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xb8cd) { - if (code < 0xb8b0) { - if (code < 0xb895) { - // Lo HANGUL SYLLABLE RWAE - if (0xb894 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE RWAEG..HANGUL SYLLABLE RWAEH - if (0xb895 <= code && code <= 0xb8af) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb8b1) { - // Lo HANGUL SYLLABLE ROE - if (0xb8b0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb8cc) { - // Lo [27] HANGUL SYLLABLE ROEG..HANGUL SYLLABLE ROEH - if (0xb8b1 <= code && code <= 0xb8cb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE RYO - if (0xb8cc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xb904) { - if (code < 0xb8e8) { - // Lo [27] HANGUL SYLLABLE RYOG..HANGUL SYLLABLE RYOH - if (0xb8cd <= code && code <= 0xb8e7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb8e9) { - // Lo HANGUL SYLLABLE RU - if (0xb8e8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE RUG..HANGUL SYLLABLE RUH - if (0xb8e9 <= code && code <= 0xb903) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xb905) { - // Lo HANGUL SYLLABLE RWEO - if (0xb904 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb920) { - // Lo [27] HANGUL SYLLABLE RWEOG..HANGUL SYLLABLE RWEOH - if (0xb905 <= code && code <= 0xb91f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE RWE - if (0xb920 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xb9c8) { - if (code < 0xb974) { - if (code < 0xb93d) { - if (code < 0xb93c) { - // Lo [27] HANGUL SYLLABLE RWEG..HANGUL SYLLABLE RWEH - if (0xb921 <= code && code <= 0xb93b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE RWI - if (0xb93c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xb958) { - // Lo [27] HANGUL SYLLABLE RWIG..HANGUL SYLLABLE RWIH - if (0xb93d <= code && code <= 0xb957) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb959) { - // Lo HANGUL SYLLABLE RYU - if (0xb958 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE RYUG..HANGUL SYLLABLE RYUH - if (0xb959 <= code && code <= 0xb973) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xb991) { - if (code < 0xb975) { - // Lo HANGUL SYLLABLE REU - if (0xb974 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xb990) { - // Lo [27] HANGUL SYLLABLE REUG..HANGUL SYLLABLE REUH - if (0xb975 <= code && code <= 0xb98f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE RYI - if (0xb990 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xb9ac) { - // Lo [27] HANGUL SYLLABLE RYIG..HANGUL SYLLABLE RYIH - if (0xb991 <= code && code <= 0xb9ab) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xb9ad) { - // Lo HANGUL SYLLABLE RI - if (0xb9ac === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE RIG..HANGUL SYLLABLE RIH - if (0xb9ad <= code && code <= 0xb9c7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xba01) { - if (code < 0xb9e4) { - if (code < 0xb9c9) { - // Lo HANGUL SYLLABLE MA - if (0xb9c8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE MAG..HANGUL SYLLABLE MAH - if (0xb9c9 <= code && code <= 0xb9e3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xb9e5) { - // Lo HANGUL SYLLABLE MAE - if (0xb9e4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xba00) { - // Lo [27] HANGUL SYLLABLE MAEG..HANGUL SYLLABLE MAEH - if (0xb9e5 <= code && code <= 0xb9ff) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE MYA - if (0xba00 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xba38) { - if (code < 0xba1c) { - // Lo [27] HANGUL SYLLABLE MYAG..HANGUL SYLLABLE MYAH - if (0xba01 <= code && code <= 0xba1b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xba1d) { - // Lo HANGUL SYLLABLE MYAE - if (0xba1c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE MYAEG..HANGUL SYLLABLE MYAEH - if (0xba1d <= code && code <= 0xba37) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xba39) { - // Lo HANGUL SYLLABLE MEO - if (0xba38 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xba54) { - // Lo [27] HANGUL SYLLABLE MEOG..HANGUL SYLLABLE MEOH - if (0xba39 <= code && code <= 0xba53) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE ME - if (0xba54 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - } - } - else { - if (code < 0xbcbc) { - if (code < 0xbb88) { - if (code < 0xbae1) { - if (code < 0xbaa8) { - if (code < 0xba71) { - if (code < 0xba70) { - // Lo [27] HANGUL SYLLABLE MEG..HANGUL SYLLABLE MEH - if (0xba55 <= code && code <= 0xba6f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE MYEO - if (0xba70 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xba8c) { - // Lo [27] HANGUL SYLLABLE MYEOG..HANGUL SYLLABLE MYEOH - if (0xba71 <= code && code <= 0xba8b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xba8d) { - // Lo HANGUL SYLLABLE MYE - if (0xba8c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE MYEG..HANGUL SYLLABLE MYEH - if (0xba8d <= code && code <= 0xbaa7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xbac4) { - if (code < 0xbaa9) { - // Lo HANGUL SYLLABLE MO - if (0xbaa8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE MOG..HANGUL SYLLABLE MOH - if (0xbaa9 <= code && code <= 0xbac3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xbac5) { - // Lo HANGUL SYLLABLE MWA - if (0xbac4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbae0) { - // Lo [27] HANGUL SYLLABLE MWAG..HANGUL SYLLABLE MWAH - if (0xbac5 <= code && code <= 0xbadf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE MWAE - if (0xbae0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xbb34) { - if (code < 0xbafd) { - if (code < 0xbafc) { - // Lo [27] HANGUL SYLLABLE MWAEG..HANGUL SYLLABLE MWAEH - if (0xbae1 <= code && code <= 0xbafb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE MOE - if (0xbafc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xbb18) { - // Lo [27] HANGUL SYLLABLE MOEG..HANGUL SYLLABLE MOEH - if (0xbafd <= code && code <= 0xbb17) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbb19) { - // Lo HANGUL SYLLABLE MYO - if (0xbb18 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE MYOG..HANGUL SYLLABLE MYOH - if (0xbb19 <= code && code <= 0xbb33) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xbb51) { - if (code < 0xbb35) { - // Lo HANGUL SYLLABLE MU - if (0xbb34 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbb50) { - // Lo [27] HANGUL SYLLABLE MUG..HANGUL SYLLABLE MUH - if (0xbb35 <= code && code <= 0xbb4f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE MWEO - if (0xbb50 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xbb6c) { - // Lo [27] HANGUL SYLLABLE MWEOG..HANGUL SYLLABLE MWEOH - if (0xbb51 <= code && code <= 0xbb6b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbb6d) { - // Lo HANGUL SYLLABLE MWE - if (0xbb6c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE MWEG..HANGUL SYLLABLE MWEH - if (0xbb6d <= code && code <= 0xbb87) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - else { - if (code < 0xbc15) { - if (code < 0xbbc1) { - if (code < 0xbba4) { - if (code < 0xbb89) { - // Lo HANGUL SYLLABLE MWI - if (0xbb88 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE MWIG..HANGUL SYLLABLE MWIH - if (0xbb89 <= code && code <= 0xbba3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xbba5) { - // Lo HANGUL SYLLABLE MYU - if (0xbba4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbbc0) { - // Lo [27] HANGUL SYLLABLE MYUG..HANGUL SYLLABLE MYUH - if (0xbba5 <= code && code <= 0xbbbf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE MEU - if (0xbbc0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xbbf8) { - if (code < 0xbbdc) { - // Lo [27] HANGUL SYLLABLE MEUG..HANGUL SYLLABLE MEUH - if (0xbbc1 <= code && code <= 0xbbdb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbbdd) { - // Lo HANGUL SYLLABLE MYI - if (0xbbdc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE MYIG..HANGUL SYLLABLE MYIH - if (0xbbdd <= code && code <= 0xbbf7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xbbf9) { - // Lo HANGUL SYLLABLE MI - if (0xbbf8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbc14) { - // Lo [27] HANGUL SYLLABLE MIG..HANGUL SYLLABLE MIH - if (0xbbf9 <= code && code <= 0xbc13) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BA - if (0xbc14 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xbc68) { - if (code < 0xbc31) { - if (code < 0xbc30) { - // Lo [27] HANGUL SYLLABLE BAG..HANGUL SYLLABLE BAH - if (0xbc15 <= code && code <= 0xbc2f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BAE - if (0xbc30 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xbc4c) { - // Lo [27] HANGUL SYLLABLE BAEG..HANGUL SYLLABLE BAEH - if (0xbc31 <= code && code <= 0xbc4b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbc4d) { - // Lo HANGUL SYLLABLE BYA - if (0xbc4c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BYAG..HANGUL SYLLABLE BYAH - if (0xbc4d <= code && code <= 0xbc67) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xbc85) { - if (code < 0xbc69) { - // Lo HANGUL SYLLABLE BYAE - if (0xbc68 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbc84) { - // Lo [27] HANGUL SYLLABLE BYAEG..HANGUL SYLLABLE BYAEH - if (0xbc69 <= code && code <= 0xbc83) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BEO - if (0xbc84 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xbca0) { - // Lo [27] HANGUL SYLLABLE BEOG..HANGUL SYLLABLE BEOH - if (0xbc85 <= code && code <= 0xbc9f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbca1) { - // Lo HANGUL SYLLABLE BE - if (0xbca0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BEG..HANGUL SYLLABLE BEH - if (0xbca1 <= code && code <= 0xbcbb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - else { - if (code < 0xbdd5) { - if (code < 0xbd48) { - if (code < 0xbcf5) { - if (code < 0xbcd8) { - if (code < 0xbcbd) { - // Lo HANGUL SYLLABLE BYEO - if (0xbcbc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BYEOG..HANGUL SYLLABLE BYEOH - if (0xbcbd <= code && code <= 0xbcd7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xbcd9) { - // Lo HANGUL SYLLABLE BYE - if (0xbcd8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbcf4) { - // Lo [27] HANGUL SYLLABLE BYEG..HANGUL SYLLABLE BYEH - if (0xbcd9 <= code && code <= 0xbcf3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BO - if (0xbcf4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xbd11) { - if (code < 0xbd10) { - // Lo [27] HANGUL SYLLABLE BOG..HANGUL SYLLABLE BOH - if (0xbcf5 <= code && code <= 0xbd0f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BWA - if (0xbd10 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xbd2c) { - // Lo [27] HANGUL SYLLABLE BWAG..HANGUL SYLLABLE BWAH - if (0xbd11 <= code && code <= 0xbd2b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbd2d) { - // Lo HANGUL SYLLABLE BWAE - if (0xbd2c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BWAEG..HANGUL SYLLABLE BWAEH - if (0xbd2d <= code && code <= 0xbd47) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xbd81) { - if (code < 0xbd64) { - if (code < 0xbd49) { - // Lo HANGUL SYLLABLE BOE - if (0xbd48 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BOEG..HANGUL SYLLABLE BOEH - if (0xbd49 <= code && code <= 0xbd63) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xbd65) { - // Lo HANGUL SYLLABLE BYO - if (0xbd64 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbd80) { - // Lo [27] HANGUL SYLLABLE BYOG..HANGUL SYLLABLE BYOH - if (0xbd65 <= code && code <= 0xbd7f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BU - if (0xbd80 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xbdb8) { - if (code < 0xbd9c) { - // Lo [27] HANGUL SYLLABLE BUG..HANGUL SYLLABLE BUH - if (0xbd81 <= code && code <= 0xbd9b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbd9d) { - // Lo HANGUL SYLLABLE BWEO - if (0xbd9c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BWEOG..HANGUL SYLLABLE BWEOH - if (0xbd9d <= code && code <= 0xbdb7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xbdb9) { - // Lo HANGUL SYLLABLE BWE - if (0xbdb8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbdd4) { - // Lo [27] HANGUL SYLLABLE BWEG..HANGUL SYLLABLE BWEH - if (0xbdb9 <= code && code <= 0xbdd3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BWI - if (0xbdd4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xbe7c) { - if (code < 0xbe28) { - if (code < 0xbdf1) { - if (code < 0xbdf0) { - // Lo [27] HANGUL SYLLABLE BWIG..HANGUL SYLLABLE BWIH - if (0xbdd5 <= code && code <= 0xbdef) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BYU - if (0xbdf0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xbe0c) { - // Lo [27] HANGUL SYLLABLE BYUG..HANGUL SYLLABLE BYUH - if (0xbdf1 <= code && code <= 0xbe0b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbe0d) { - // Lo HANGUL SYLLABLE BEU - if (0xbe0c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BEUG..HANGUL SYLLABLE BEUH - if (0xbe0d <= code && code <= 0xbe27) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xbe45) { - if (code < 0xbe29) { - // Lo HANGUL SYLLABLE BYI - if (0xbe28 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbe44) { - // Lo [27] HANGUL SYLLABLE BYIG..HANGUL SYLLABLE BYIH - if (0xbe29 <= code && code <= 0xbe43) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BI - if (0xbe44 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xbe60) { - // Lo [27] HANGUL SYLLABLE BIG..HANGUL SYLLABLE BIH - if (0xbe45 <= code && code <= 0xbe5f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbe61) { - // Lo HANGUL SYLLABLE BBA - if (0xbe60 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BBAG..HANGUL SYLLABLE BBAH - if (0xbe61 <= code && code <= 0xbe7b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xbeb5) { - if (code < 0xbe98) { - if (code < 0xbe7d) { - // Lo HANGUL SYLLABLE BBAE - if (0xbe7c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BBAEG..HANGUL SYLLABLE BBAEH - if (0xbe7d <= code && code <= 0xbe97) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xbe99) { - // Lo HANGUL SYLLABLE BBYA - if (0xbe98 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbeb4) { - // Lo [27] HANGUL SYLLABLE BBYAG..HANGUL SYLLABLE BBYAH - if (0xbe99 <= code && code <= 0xbeb3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BBYAE - if (0xbeb4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xbeec) { - if (code < 0xbed0) { - // Lo [27] HANGUL SYLLABLE BBYAEG..HANGUL SYLLABLE BBYAEH - if (0xbeb5 <= code && code <= 0xbecf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbed1) { - // Lo HANGUL SYLLABLE BBEO - if (0xbed0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BBEOG..HANGUL SYLLABLE BBEOH - if (0xbed1 <= code && code <= 0xbeeb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xbeed) { - // Lo HANGUL SYLLABLE BBE - if (0xbeec === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbf08) { - // Lo [27] HANGUL SYLLABLE BBEG..HANGUL SYLLABLE BBEH - if (0xbeed <= code && code <= 0xbf07) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BBYEO - if (0xbf08 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - } - } - } - } - } - else { - if (code < 0xd1d8) { - if (code < 0xc870) { - if (code < 0xc3bc) { - if (code < 0xc155) { - if (code < 0xc03c) { - if (code < 0xbf95) { - if (code < 0xbf5c) { - if (code < 0xbf25) { - if (code < 0xbf24) { - // Lo [27] HANGUL SYLLABLE BBYEOG..HANGUL SYLLABLE BBYEOH - if (0xbf09 <= code && code <= 0xbf23) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BBYE - if (0xbf24 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xbf40) { - // Lo [27] HANGUL SYLLABLE BBYEG..HANGUL SYLLABLE BBYEH - if (0xbf25 <= code && code <= 0xbf3f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbf41) { - // Lo HANGUL SYLLABLE BBO - if (0xbf40 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BBOG..HANGUL SYLLABLE BBOH - if (0xbf41 <= code && code <= 0xbf5b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xbf78) { - if (code < 0xbf5d) { - // Lo HANGUL SYLLABLE BBWA - if (0xbf5c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BBWAG..HANGUL SYLLABLE BBWAH - if (0xbf5d <= code && code <= 0xbf77) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xbf79) { - // Lo HANGUL SYLLABLE BBWAE - if (0xbf78 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xbf94) { - // Lo [27] HANGUL SYLLABLE BBWAEG..HANGUL SYLLABLE BBWAEH - if (0xbf79 <= code && code <= 0xbf93) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BBOE - if (0xbf94 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xbfe8) { - if (code < 0xbfb1) { - if (code < 0xbfb0) { - // Lo [27] HANGUL SYLLABLE BBOEG..HANGUL SYLLABLE BBOEH - if (0xbf95 <= code && code <= 0xbfaf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BBYO - if (0xbfb0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xbfcc) { - // Lo [27] HANGUL SYLLABLE BBYOG..HANGUL SYLLABLE BBYOH - if (0xbfb1 <= code && code <= 0xbfcb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xbfcd) { - // Lo HANGUL SYLLABLE BBU - if (0xbfcc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BBUG..HANGUL SYLLABLE BBUH - if (0xbfcd <= code && code <= 0xbfe7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xc005) { - if (code < 0xbfe9) { - // Lo HANGUL SYLLABLE BBWEO - if (0xbfe8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc004) { - // Lo [27] HANGUL SYLLABLE BBWEOG..HANGUL SYLLABLE BBWEOH - if (0xbfe9 <= code && code <= 0xc003) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BBWE - if (0xc004 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xc020) { - // Lo [27] HANGUL SYLLABLE BBWEG..HANGUL SYLLABLE BBWEH - if (0xc005 <= code && code <= 0xc01f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc021) { - // Lo HANGUL SYLLABLE BBWI - if (0xc020 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BBWIG..HANGUL SYLLABLE BBWIH - if (0xc021 <= code && code <= 0xc03b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - else { - if (code < 0xc0c8) { - if (code < 0xc075) { - if (code < 0xc058) { - if (code < 0xc03d) { - // Lo HANGUL SYLLABLE BBYU - if (0xc03c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE BBYUG..HANGUL SYLLABLE BBYUH - if (0xc03d <= code && code <= 0xc057) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc059) { - // Lo HANGUL SYLLABLE BBEU - if (0xc058 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc074) { - // Lo [27] HANGUL SYLLABLE BBEUG..HANGUL SYLLABLE BBEUH - if (0xc059 <= code && code <= 0xc073) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BBYI - if (0xc074 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xc091) { - if (code < 0xc090) { - // Lo [27] HANGUL SYLLABLE BBYIG..HANGUL SYLLABLE BBYIH - if (0xc075 <= code && code <= 0xc08f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE BBI - if (0xc090 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc0ac) { - // Lo [27] HANGUL SYLLABLE BBIG..HANGUL SYLLABLE BBIH - if (0xc091 <= code && code <= 0xc0ab) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc0ad) { - // Lo HANGUL SYLLABLE SA - if (0xc0ac === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SAG..HANGUL SYLLABLE SAH - if (0xc0ad <= code && code <= 0xc0c7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xc101) { - if (code < 0xc0e4) { - if (code < 0xc0c9) { - // Lo HANGUL SYLLABLE SAE - if (0xc0c8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SAEG..HANGUL SYLLABLE SAEH - if (0xc0c9 <= code && code <= 0xc0e3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc0e5) { - // Lo HANGUL SYLLABLE SYA - if (0xc0e4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc100) { - // Lo [27] HANGUL SYLLABLE SYAG..HANGUL SYLLABLE SYAH - if (0xc0e5 <= code && code <= 0xc0ff) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SYAE - if (0xc100 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xc138) { - if (code < 0xc11c) { - // Lo [27] HANGUL SYLLABLE SYAEG..HANGUL SYLLABLE SYAEH - if (0xc101 <= code && code <= 0xc11b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc11d) { - // Lo HANGUL SYLLABLE SEO - if (0xc11c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SEOG..HANGUL SYLLABLE SEOH - if (0xc11d <= code && code <= 0xc137) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xc139) { - // Lo HANGUL SYLLABLE SE - if (0xc138 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc154) { - // Lo [27] HANGUL SYLLABLE SEG..HANGUL SYLLABLE SEH - if (0xc139 <= code && code <= 0xc153) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SYEO - if (0xc154 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - } - else { - if (code < 0xc288) { - if (code < 0xc1e1) { - if (code < 0xc1a8) { - if (code < 0xc171) { - if (code < 0xc170) { - // Lo [27] HANGUL SYLLABLE SYEOG..HANGUL SYLLABLE SYEOH - if (0xc155 <= code && code <= 0xc16f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SYE - if (0xc170 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc18c) { - // Lo [27] HANGUL SYLLABLE SYEG..HANGUL SYLLABLE SYEH - if (0xc171 <= code && code <= 0xc18b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc18d) { - // Lo HANGUL SYLLABLE SO - if (0xc18c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SOG..HANGUL SYLLABLE SOH - if (0xc18d <= code && code <= 0xc1a7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xc1c4) { - if (code < 0xc1a9) { - // Lo HANGUL SYLLABLE SWA - if (0xc1a8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SWAG..HANGUL SYLLABLE SWAH - if (0xc1a9 <= code && code <= 0xc1c3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc1c5) { - // Lo HANGUL SYLLABLE SWAE - if (0xc1c4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc1e0) { - // Lo [27] HANGUL SYLLABLE SWAEG..HANGUL SYLLABLE SWAEH - if (0xc1c5 <= code && code <= 0xc1df) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SOE - if (0xc1e0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xc234) { - if (code < 0xc1fd) { - if (code < 0xc1fc) { - // Lo [27] HANGUL SYLLABLE SOEG..HANGUL SYLLABLE SOEH - if (0xc1e1 <= code && code <= 0xc1fb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SYO - if (0xc1fc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc218) { - // Lo [27] HANGUL SYLLABLE SYOG..HANGUL SYLLABLE SYOH - if (0xc1fd <= code && code <= 0xc217) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc219) { - // Lo HANGUL SYLLABLE SU - if (0xc218 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SUG..HANGUL SYLLABLE SUH - if (0xc219 <= code && code <= 0xc233) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xc251) { - if (code < 0xc235) { - // Lo HANGUL SYLLABLE SWEO - if (0xc234 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc250) { - // Lo [27] HANGUL SYLLABLE SWEOG..HANGUL SYLLABLE SWEOH - if (0xc235 <= code && code <= 0xc24f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SWE - if (0xc250 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xc26c) { - // Lo [27] HANGUL SYLLABLE SWEG..HANGUL SYLLABLE SWEH - if (0xc251 <= code && code <= 0xc26b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc26d) { - // Lo HANGUL SYLLABLE SWI - if (0xc26c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SWIG..HANGUL SYLLABLE SWIH - if (0xc26d <= code && code <= 0xc287) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - else { - if (code < 0xc315) { - if (code < 0xc2c1) { - if (code < 0xc2a4) { - if (code < 0xc289) { - // Lo HANGUL SYLLABLE SYU - if (0xc288 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SYUG..HANGUL SYLLABLE SYUH - if (0xc289 <= code && code <= 0xc2a3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc2a5) { - // Lo HANGUL SYLLABLE SEU - if (0xc2a4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc2c0) { - // Lo [27] HANGUL SYLLABLE SEUG..HANGUL SYLLABLE SEUH - if (0xc2a5 <= code && code <= 0xc2bf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SYI - if (0xc2c0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xc2f8) { - if (code < 0xc2dc) { - // Lo [27] HANGUL SYLLABLE SYIG..HANGUL SYLLABLE SYIH - if (0xc2c1 <= code && code <= 0xc2db) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc2dd) { - // Lo HANGUL SYLLABLE SI - if (0xc2dc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SIG..HANGUL SYLLABLE SIH - if (0xc2dd <= code && code <= 0xc2f7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xc2f9) { - // Lo HANGUL SYLLABLE SSA - if (0xc2f8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc314) { - // Lo [27] HANGUL SYLLABLE SSAG..HANGUL SYLLABLE SSAH - if (0xc2f9 <= code && code <= 0xc313) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SSAE - if (0xc314 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xc368) { - if (code < 0xc331) { - if (code < 0xc330) { - // Lo [27] HANGUL SYLLABLE SSAEG..HANGUL SYLLABLE SSAEH - if (0xc315 <= code && code <= 0xc32f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SSYA - if (0xc330 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc34c) { - // Lo [27] HANGUL SYLLABLE SSYAG..HANGUL SYLLABLE SSYAH - if (0xc331 <= code && code <= 0xc34b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc34d) { - // Lo HANGUL SYLLABLE SSYAE - if (0xc34c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SSYAEG..HANGUL SYLLABLE SSYAEH - if (0xc34d <= code && code <= 0xc367) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xc385) { - if (code < 0xc369) { - // Lo HANGUL SYLLABLE SSEO - if (0xc368 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc384) { - // Lo [27] HANGUL SYLLABLE SSEOG..HANGUL SYLLABLE SSEOH - if (0xc369 <= code && code <= 0xc383) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SSE - if (0xc384 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xc3a0) { - // Lo [27] HANGUL SYLLABLE SSEG..HANGUL SYLLABLE SSEH - if (0xc385 <= code && code <= 0xc39f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc3a1) { - // Lo HANGUL SYLLABLE SSYEO - if (0xc3a0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SSYEOG..HANGUL SYLLABLE SSYEOH - if (0xc3a1 <= code && code <= 0xc3bb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - } - else { - if (code < 0xc609) { - if (code < 0xc4d5) { - if (code < 0xc448) { - if (code < 0xc3f5) { - if (code < 0xc3d8) { - if (code < 0xc3bd) { - // Lo HANGUL SYLLABLE SSYE - if (0xc3bc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SSYEG..HANGUL SYLLABLE SSYEH - if (0xc3bd <= code && code <= 0xc3d7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc3d9) { - // Lo HANGUL SYLLABLE SSO - if (0xc3d8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc3f4) { - // Lo [27] HANGUL SYLLABLE SSOG..HANGUL SYLLABLE SSOH - if (0xc3d9 <= code && code <= 0xc3f3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SSWA - if (0xc3f4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xc411) { - if (code < 0xc410) { - // Lo [27] HANGUL SYLLABLE SSWAG..HANGUL SYLLABLE SSWAH - if (0xc3f5 <= code && code <= 0xc40f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SSWAE - if (0xc410 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc42c) { - // Lo [27] HANGUL SYLLABLE SSWAEG..HANGUL SYLLABLE SSWAEH - if (0xc411 <= code && code <= 0xc42b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc42d) { - // Lo HANGUL SYLLABLE SSOE - if (0xc42c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SSOEG..HANGUL SYLLABLE SSOEH - if (0xc42d <= code && code <= 0xc447) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xc481) { - if (code < 0xc464) { - if (code < 0xc449) { - // Lo HANGUL SYLLABLE SSYO - if (0xc448 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SSYOG..HANGUL SYLLABLE SSYOH - if (0xc449 <= code && code <= 0xc463) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc465) { - // Lo HANGUL SYLLABLE SSU - if (0xc464 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc480) { - // Lo [27] HANGUL SYLLABLE SSUG..HANGUL SYLLABLE SSUH - if (0xc465 <= code && code <= 0xc47f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SSWEO - if (0xc480 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xc4b8) { - if (code < 0xc49c) { - // Lo [27] HANGUL SYLLABLE SSWEOG..HANGUL SYLLABLE SSWEOH - if (0xc481 <= code && code <= 0xc49b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc49d) { - // Lo HANGUL SYLLABLE SSWE - if (0xc49c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SSWEG..HANGUL SYLLABLE SSWEH - if (0xc49d <= code && code <= 0xc4b7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xc4b9) { - // Lo HANGUL SYLLABLE SSWI - if (0xc4b8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc4d4) { - // Lo [27] HANGUL SYLLABLE SSWIG..HANGUL SYLLABLE SSWIH - if (0xc4b9 <= code && code <= 0xc4d3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SSYU - if (0xc4d4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xc57c) { - if (code < 0xc528) { - if (code < 0xc4f1) { - if (code < 0xc4f0) { - // Lo [27] HANGUL SYLLABLE SSYUG..HANGUL SYLLABLE SSYUH - if (0xc4d5 <= code && code <= 0xc4ef) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE SSEU - if (0xc4f0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc50c) { - // Lo [27] HANGUL SYLLABLE SSEUG..HANGUL SYLLABLE SSEUH - if (0xc4f1 <= code && code <= 0xc50b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc50d) { - // Lo HANGUL SYLLABLE SSYI - if (0xc50c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE SSYIG..HANGUL SYLLABLE SSYIH - if (0xc50d <= code && code <= 0xc527) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xc545) { - if (code < 0xc529) { - // Lo HANGUL SYLLABLE SSI - if (0xc528 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc544) { - // Lo [27] HANGUL SYLLABLE SSIG..HANGUL SYLLABLE SSIH - if (0xc529 <= code && code <= 0xc543) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE A - if (0xc544 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xc560) { - // Lo [27] HANGUL SYLLABLE AG..HANGUL SYLLABLE AH - if (0xc545 <= code && code <= 0xc55f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc561) { - // Lo HANGUL SYLLABLE AE - if (0xc560 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE AEG..HANGUL SYLLABLE AEH - if (0xc561 <= code && code <= 0xc57b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xc5b5) { - if (code < 0xc598) { - if (code < 0xc57d) { - // Lo HANGUL SYLLABLE YA - if (0xc57c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE YAG..HANGUL SYLLABLE YAH - if (0xc57d <= code && code <= 0xc597) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc599) { - // Lo HANGUL SYLLABLE YAE - if (0xc598 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc5b4) { - // Lo [27] HANGUL SYLLABLE YAEG..HANGUL SYLLABLE YAEH - if (0xc599 <= code && code <= 0xc5b3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE EO - if (0xc5b4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xc5ec) { - if (code < 0xc5d0) { - // Lo [27] HANGUL SYLLABLE EOG..HANGUL SYLLABLE EOH - if (0xc5b5 <= code && code <= 0xc5cf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc5d1) { - // Lo HANGUL SYLLABLE E - if (0xc5d0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE EG..HANGUL SYLLABLE EH - if (0xc5d1 <= code && code <= 0xc5eb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xc5ed) { - // Lo HANGUL SYLLABLE YEO - if (0xc5ec === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc608) { - // Lo [27] HANGUL SYLLABLE YEOG..HANGUL SYLLABLE YEOH - if (0xc5ed <= code && code <= 0xc607) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE YE - if (0xc608 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - } - else { - if (code < 0xc73c) { - if (code < 0xc695) { - if (code < 0xc65c) { - if (code < 0xc625) { - if (code < 0xc624) { - // Lo [27] HANGUL SYLLABLE YEG..HANGUL SYLLABLE YEH - if (0xc609 <= code && code <= 0xc623) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE O - if (0xc624 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc640) { - // Lo [27] HANGUL SYLLABLE OG..HANGUL SYLLABLE OH - if (0xc625 <= code && code <= 0xc63f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc641) { - // Lo HANGUL SYLLABLE WA - if (0xc640 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE WAG..HANGUL SYLLABLE WAH - if (0xc641 <= code && code <= 0xc65b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xc678) { - if (code < 0xc65d) { - // Lo HANGUL SYLLABLE WAE - if (0xc65c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE WAEG..HANGUL SYLLABLE WAEH - if (0xc65d <= code && code <= 0xc677) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc679) { - // Lo HANGUL SYLLABLE OE - if (0xc678 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc694) { - // Lo [27] HANGUL SYLLABLE OEG..HANGUL SYLLABLE OEH - if (0xc679 <= code && code <= 0xc693) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE YO - if (0xc694 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xc6e8) { - if (code < 0xc6b1) { - if (code < 0xc6b0) { - // Lo [27] HANGUL SYLLABLE YOG..HANGUL SYLLABLE YOH - if (0xc695 <= code && code <= 0xc6af) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE U - if (0xc6b0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc6cc) { - // Lo [27] HANGUL SYLLABLE UG..HANGUL SYLLABLE UH - if (0xc6b1 <= code && code <= 0xc6cb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc6cd) { - // Lo HANGUL SYLLABLE WEO - if (0xc6cc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE WEOG..HANGUL SYLLABLE WEOH - if (0xc6cd <= code && code <= 0xc6e7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xc705) { - if (code < 0xc6e9) { - // Lo HANGUL SYLLABLE WE - if (0xc6e8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc704) { - // Lo [27] HANGUL SYLLABLE WEG..HANGUL SYLLABLE WEH - if (0xc6e9 <= code && code <= 0xc703) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE WI - if (0xc704 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xc720) { - // Lo [27] HANGUL SYLLABLE WIG..HANGUL SYLLABLE WIH - if (0xc705 <= code && code <= 0xc71f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc721) { - // Lo HANGUL SYLLABLE YU - if (0xc720 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE YUG..HANGUL SYLLABLE YUH - if (0xc721 <= code && code <= 0xc73b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - else { - if (code < 0xc7c9) { - if (code < 0xc775) { - if (code < 0xc758) { - if (code < 0xc73d) { - // Lo HANGUL SYLLABLE EU - if (0xc73c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE EUG..HANGUL SYLLABLE EUH - if (0xc73d <= code && code <= 0xc757) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc759) { - // Lo HANGUL SYLLABLE YI - if (0xc758 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc774) { - // Lo [27] HANGUL SYLLABLE YIG..HANGUL SYLLABLE YIH - if (0xc759 <= code && code <= 0xc773) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE I - if (0xc774 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xc7ac) { - if (code < 0xc790) { - // Lo [27] HANGUL SYLLABLE IG..HANGUL SYLLABLE IH - if (0xc775 <= code && code <= 0xc78f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc791) { - // Lo HANGUL SYLLABLE JA - if (0xc790 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JAG..HANGUL SYLLABLE JAH - if (0xc791 <= code && code <= 0xc7ab) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xc7ad) { - // Lo HANGUL SYLLABLE JAE - if (0xc7ac === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc7c8) { - // Lo [27] HANGUL SYLLABLE JAEG..HANGUL SYLLABLE JAEH - if (0xc7ad <= code && code <= 0xc7c7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JYA - if (0xc7c8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xc81c) { - if (code < 0xc7e5) { - if (code < 0xc7e4) { - // Lo [27] HANGUL SYLLABLE JYAG..HANGUL SYLLABLE JYAH - if (0xc7c9 <= code && code <= 0xc7e3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JYAE - if (0xc7e4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc800) { - // Lo [27] HANGUL SYLLABLE JYAEG..HANGUL SYLLABLE JYAEH - if (0xc7e5 <= code && code <= 0xc7ff) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc801) { - // Lo HANGUL SYLLABLE JEO - if (0xc800 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JEOG..HANGUL SYLLABLE JEOH - if (0xc801 <= code && code <= 0xc81b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xc839) { - if (code < 0xc81d) { - // Lo HANGUL SYLLABLE JE - if (0xc81c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc838) { - // Lo [27] HANGUL SYLLABLE JEG..HANGUL SYLLABLE JEH - if (0xc81d <= code && code <= 0xc837) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JYEO - if (0xc838 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xc854) { - // Lo [27] HANGUL SYLLABLE JYEOG..HANGUL SYLLABLE JYEOH - if (0xc839 <= code && code <= 0xc853) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc855) { - // Lo HANGUL SYLLABLE JYE - if (0xc854 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JYEG..HANGUL SYLLABLE JYEH - if (0xc855 <= code && code <= 0xc86f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - } - } - else { - if (code < 0xcd24) { - if (code < 0xcabd) { - if (code < 0xc989) { - if (code < 0xc8fc) { - if (code < 0xc8a9) { - if (code < 0xc88c) { - if (code < 0xc871) { - // Lo HANGUL SYLLABLE JO - if (0xc870 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JOG..HANGUL SYLLABLE JOH - if (0xc871 <= code && code <= 0xc88b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc88d) { - // Lo HANGUL SYLLABLE JWA - if (0xc88c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc8a8) { - // Lo [27] HANGUL SYLLABLE JWAG..HANGUL SYLLABLE JWAH - if (0xc88d <= code && code <= 0xc8a7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JWAE - if (0xc8a8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xc8c5) { - if (code < 0xc8c4) { - // Lo [27] HANGUL SYLLABLE JWAEG..HANGUL SYLLABLE JWAEH - if (0xc8a9 <= code && code <= 0xc8c3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JOE - if (0xc8c4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc8e0) { - // Lo [27] HANGUL SYLLABLE JOEG..HANGUL SYLLABLE JOEH - if (0xc8c5 <= code && code <= 0xc8df) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc8e1) { - // Lo HANGUL SYLLABLE JYO - if (0xc8e0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JYOG..HANGUL SYLLABLE JYOH - if (0xc8e1 <= code && code <= 0xc8fb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xc935) { - if (code < 0xc918) { - if (code < 0xc8fd) { - // Lo HANGUL SYLLABLE JU - if (0xc8fc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JUG..HANGUL SYLLABLE JUH - if (0xc8fd <= code && code <= 0xc917) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xc919) { - // Lo HANGUL SYLLABLE JWEO - if (0xc918 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc934) { - // Lo [27] HANGUL SYLLABLE JWEOG..HANGUL SYLLABLE JWEOH - if (0xc919 <= code && code <= 0xc933) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JWE - if (0xc934 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xc96c) { - if (code < 0xc950) { - // Lo [27] HANGUL SYLLABLE JWEG..HANGUL SYLLABLE JWEH - if (0xc935 <= code && code <= 0xc94f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc951) { - // Lo HANGUL SYLLABLE JWI - if (0xc950 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JWIG..HANGUL SYLLABLE JWIH - if (0xc951 <= code && code <= 0xc96b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xc96d) { - // Lo HANGUL SYLLABLE JYU - if (0xc96c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc988) { - // Lo [27] HANGUL SYLLABLE JYUG..HANGUL SYLLABLE JYUH - if (0xc96d <= code && code <= 0xc987) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JEU - if (0xc988 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xca30) { - if (code < 0xc9dc) { - if (code < 0xc9a5) { - if (code < 0xc9a4) { - // Lo [27] HANGUL SYLLABLE JEUG..HANGUL SYLLABLE JEUH - if (0xc989 <= code && code <= 0xc9a3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JYI - if (0xc9a4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xc9c0) { - // Lo [27] HANGUL SYLLABLE JYIG..HANGUL SYLLABLE JYIH - if (0xc9a5 <= code && code <= 0xc9bf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xc9c1) { - // Lo HANGUL SYLLABLE JI - if (0xc9c0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JIG..HANGUL SYLLABLE JIH - if (0xc9c1 <= code && code <= 0xc9db) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xc9f9) { - if (code < 0xc9dd) { - // Lo HANGUL SYLLABLE JJA - if (0xc9dc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xc9f8) { - // Lo [27] HANGUL SYLLABLE JJAG..HANGUL SYLLABLE JJAH - if (0xc9dd <= code && code <= 0xc9f7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JJAE - if (0xc9f8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xca14) { - // Lo [27] HANGUL SYLLABLE JJAEG..HANGUL SYLLABLE JJAEH - if (0xc9f9 <= code && code <= 0xca13) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xca15) { - // Lo HANGUL SYLLABLE JJYA - if (0xca14 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JJYAG..HANGUL SYLLABLE JJYAH - if (0xca15 <= code && code <= 0xca2f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xca69) { - if (code < 0xca4c) { - if (code < 0xca31) { - // Lo HANGUL SYLLABLE JJYAE - if (0xca30 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JJYAEG..HANGUL SYLLABLE JJYAEH - if (0xca31 <= code && code <= 0xca4b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xca4d) { - // Lo HANGUL SYLLABLE JJEO - if (0xca4c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xca68) { - // Lo [27] HANGUL SYLLABLE JJEOG..HANGUL SYLLABLE JJEOH - if (0xca4d <= code && code <= 0xca67) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JJE - if (0xca68 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xcaa0) { - if (code < 0xca84) { - // Lo [27] HANGUL SYLLABLE JJEG..HANGUL SYLLABLE JJEH - if (0xca69 <= code && code <= 0xca83) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xca85) { - // Lo HANGUL SYLLABLE JJYEO - if (0xca84 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JJYEOG..HANGUL SYLLABLE JJYEOH - if (0xca85 <= code && code <= 0xca9f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xcaa1) { - // Lo HANGUL SYLLABLE JJYE - if (0xcaa0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcabc) { - // Lo [27] HANGUL SYLLABLE JJYEG..HANGUL SYLLABLE JJYEH - if (0xcaa1 <= code && code <= 0xcabb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JJO - if (0xcabc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - } - else { - if (code < 0xcbf0) { - if (code < 0xcb49) { - if (code < 0xcb10) { - if (code < 0xcad9) { - if (code < 0xcad8) { - // Lo [27] HANGUL SYLLABLE JJOG..HANGUL SYLLABLE JJOH - if (0xcabd <= code && code <= 0xcad7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JJWA - if (0xcad8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xcaf4) { - // Lo [27] HANGUL SYLLABLE JJWAG..HANGUL SYLLABLE JJWAH - if (0xcad9 <= code && code <= 0xcaf3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xcaf5) { - // Lo HANGUL SYLLABLE JJWAE - if (0xcaf4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JJWAEG..HANGUL SYLLABLE JJWAEH - if (0xcaf5 <= code && code <= 0xcb0f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xcb2c) { - if (code < 0xcb11) { - // Lo HANGUL SYLLABLE JJOE - if (0xcb10 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JJOEG..HANGUL SYLLABLE JJOEH - if (0xcb11 <= code && code <= 0xcb2b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xcb2d) { - // Lo HANGUL SYLLABLE JJYO - if (0xcb2c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcb48) { - // Lo [27] HANGUL SYLLABLE JJYOG..HANGUL SYLLABLE JJYOH - if (0xcb2d <= code && code <= 0xcb47) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JJU - if (0xcb48 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xcb9c) { - if (code < 0xcb65) { - if (code < 0xcb64) { - // Lo [27] HANGUL SYLLABLE JJUG..HANGUL SYLLABLE JJUH - if (0xcb49 <= code && code <= 0xcb63) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JJWEO - if (0xcb64 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xcb80) { - // Lo [27] HANGUL SYLLABLE JJWEOG..HANGUL SYLLABLE JJWEOH - if (0xcb65 <= code && code <= 0xcb7f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xcb81) { - // Lo HANGUL SYLLABLE JJWE - if (0xcb80 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JJWEG..HANGUL SYLLABLE JJWEH - if (0xcb81 <= code && code <= 0xcb9b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xcbb9) { - if (code < 0xcb9d) { - // Lo HANGUL SYLLABLE JJWI - if (0xcb9c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcbb8) { - // Lo [27] HANGUL SYLLABLE JJWIG..HANGUL SYLLABLE JJWIH - if (0xcb9d <= code && code <= 0xcbb7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE JJYU - if (0xcbb8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xcbd4) { - // Lo [27] HANGUL SYLLABLE JJYUG..HANGUL SYLLABLE JJYUH - if (0xcbb9 <= code && code <= 0xcbd3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xcbd5) { - // Lo HANGUL SYLLABLE JJEU - if (0xcbd4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JJEUG..HANGUL SYLLABLE JJEUH - if (0xcbd5 <= code && code <= 0xcbef) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - else { - if (code < 0xcc7d) { - if (code < 0xcc29) { - if (code < 0xcc0c) { - if (code < 0xcbf1) { - // Lo HANGUL SYLLABLE JJYI - if (0xcbf0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE JJYIG..HANGUL SYLLABLE JJYIH - if (0xcbf1 <= code && code <= 0xcc0b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xcc0d) { - // Lo HANGUL SYLLABLE JJI - if (0xcc0c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcc28) { - // Lo [27] HANGUL SYLLABLE JJIG..HANGUL SYLLABLE JJIH - if (0xcc0d <= code && code <= 0xcc27) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE CA - if (0xcc28 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xcc60) { - if (code < 0xcc44) { - // Lo [27] HANGUL SYLLABLE CAG..HANGUL SYLLABLE CAH - if (0xcc29 <= code && code <= 0xcc43) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xcc45) { - // Lo HANGUL SYLLABLE CAE - if (0xcc44 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE CAEG..HANGUL SYLLABLE CAEH - if (0xcc45 <= code && code <= 0xcc5f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xcc61) { - // Lo HANGUL SYLLABLE CYA - if (0xcc60 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcc7c) { - // Lo [27] HANGUL SYLLABLE CYAG..HANGUL SYLLABLE CYAH - if (0xcc61 <= code && code <= 0xcc7b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE CYAE - if (0xcc7c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xccd0) { - if (code < 0xcc99) { - if (code < 0xcc98) { - // Lo [27] HANGUL SYLLABLE CYAEG..HANGUL SYLLABLE CYAEH - if (0xcc7d <= code && code <= 0xcc97) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE CEO - if (0xcc98 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xccb4) { - // Lo [27] HANGUL SYLLABLE CEOG..HANGUL SYLLABLE CEOH - if (0xcc99 <= code && code <= 0xccb3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xccb5) { - // Lo HANGUL SYLLABLE CE - if (0xccb4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE CEG..HANGUL SYLLABLE CEH - if (0xccb5 <= code && code <= 0xcccf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xcced) { - if (code < 0xccd1) { - // Lo HANGUL SYLLABLE CYEO - if (0xccd0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xccec) { - // Lo [27] HANGUL SYLLABLE CYEOG..HANGUL SYLLABLE CYEOH - if (0xccd1 <= code && code <= 0xcceb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE CYE - if (0xccec === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xcd08) { - // Lo [27] HANGUL SYLLABLE CYEG..HANGUL SYLLABLE CYEH - if (0xcced <= code && code <= 0xcd07) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xcd09) { - // Lo HANGUL SYLLABLE CO - if (0xcd08 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE COG..HANGUL SYLLABLE COH - if (0xcd09 <= code && code <= 0xcd23) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - } - else { - if (code < 0xcf71) { - if (code < 0xce3d) { - if (code < 0xcdb0) { - if (code < 0xcd5d) { - if (code < 0xcd40) { - if (code < 0xcd25) { - // Lo HANGUL SYLLABLE CWA - if (0xcd24 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE CWAG..HANGUL SYLLABLE CWAH - if (0xcd25 <= code && code <= 0xcd3f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xcd41) { - // Lo HANGUL SYLLABLE CWAE - if (0xcd40 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcd5c) { - // Lo [27] HANGUL SYLLABLE CWAEG..HANGUL SYLLABLE CWAEH - if (0xcd41 <= code && code <= 0xcd5b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE COE - if (0xcd5c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xcd79) { - if (code < 0xcd78) { - // Lo [27] HANGUL SYLLABLE COEG..HANGUL SYLLABLE COEH - if (0xcd5d <= code && code <= 0xcd77) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE CYO - if (0xcd78 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xcd94) { - // Lo [27] HANGUL SYLLABLE CYOG..HANGUL SYLLABLE CYOH - if (0xcd79 <= code && code <= 0xcd93) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xcd95) { - // Lo HANGUL SYLLABLE CU - if (0xcd94 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE CUG..HANGUL SYLLABLE CUH - if (0xcd95 <= code && code <= 0xcdaf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xcde9) { - if (code < 0xcdcc) { - if (code < 0xcdb1) { - // Lo HANGUL SYLLABLE CWEO - if (0xcdb0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE CWEOG..HANGUL SYLLABLE CWEOH - if (0xcdb1 <= code && code <= 0xcdcb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xcdcd) { - // Lo HANGUL SYLLABLE CWE - if (0xcdcc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcde8) { - // Lo [27] HANGUL SYLLABLE CWEG..HANGUL SYLLABLE CWEH - if (0xcdcd <= code && code <= 0xcde7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE CWI - if (0xcde8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xce20) { - if (code < 0xce04) { - // Lo [27] HANGUL SYLLABLE CWIG..HANGUL SYLLABLE CWIH - if (0xcde9 <= code && code <= 0xce03) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xce05) { - // Lo HANGUL SYLLABLE CYU - if (0xce04 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE CYUG..HANGUL SYLLABLE CYUH - if (0xce05 <= code && code <= 0xce1f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xce21) { - // Lo HANGUL SYLLABLE CEU - if (0xce20 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xce3c) { - // Lo [27] HANGUL SYLLABLE CEUG..HANGUL SYLLABLE CEUH - if (0xce21 <= code && code <= 0xce3b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE CYI - if (0xce3c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xcee4) { - if (code < 0xce90) { - if (code < 0xce59) { - if (code < 0xce58) { - // Lo [27] HANGUL SYLLABLE CYIG..HANGUL SYLLABLE CYIH - if (0xce3d <= code && code <= 0xce57) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE CI - if (0xce58 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xce74) { - // Lo [27] HANGUL SYLLABLE CIG..HANGUL SYLLABLE CIH - if (0xce59 <= code && code <= 0xce73) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xce75) { - // Lo HANGUL SYLLABLE KA - if (0xce74 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE KAG..HANGUL SYLLABLE KAH - if (0xce75 <= code && code <= 0xce8f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xcead) { - if (code < 0xce91) { - // Lo HANGUL SYLLABLE KAE - if (0xce90 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xceac) { - // Lo [27] HANGUL SYLLABLE KAEG..HANGUL SYLLABLE KAEH - if (0xce91 <= code && code <= 0xceab) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE KYA - if (0xceac === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xcec8) { - // Lo [27] HANGUL SYLLABLE KYAG..HANGUL SYLLABLE KYAH - if (0xcead <= code && code <= 0xcec7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xcec9) { - // Lo HANGUL SYLLABLE KYAE - if (0xcec8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE KYAEG..HANGUL SYLLABLE KYAEH - if (0xcec9 <= code && code <= 0xcee3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xcf1d) { - if (code < 0xcf00) { - if (code < 0xcee5) { - // Lo HANGUL SYLLABLE KEO - if (0xcee4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE KEOG..HANGUL SYLLABLE KEOH - if (0xcee5 <= code && code <= 0xceff) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xcf01) { - // Lo HANGUL SYLLABLE KE - if (0xcf00 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcf1c) { - // Lo [27] HANGUL SYLLABLE KEG..HANGUL SYLLABLE KEH - if (0xcf01 <= code && code <= 0xcf1b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE KYEO - if (0xcf1c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xcf54) { - if (code < 0xcf38) { - // Lo [27] HANGUL SYLLABLE KYEOG..HANGUL SYLLABLE KYEOH - if (0xcf1d <= code && code <= 0xcf37) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xcf39) { - // Lo HANGUL SYLLABLE KYE - if (0xcf38 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE KYEG..HANGUL SYLLABLE KYEH - if (0xcf39 <= code && code <= 0xcf53) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xcf55) { - // Lo HANGUL SYLLABLE KO - if (0xcf54 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcf70) { - // Lo [27] HANGUL SYLLABLE KOG..HANGUL SYLLABLE KOH - if (0xcf55 <= code && code <= 0xcf6f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE KWA - if (0xcf70 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - } - else { - if (code < 0xd0a4) { - if (code < 0xcffd) { - if (code < 0xcfc4) { - if (code < 0xcf8d) { - if (code < 0xcf8c) { - // Lo [27] HANGUL SYLLABLE KWAG..HANGUL SYLLABLE KWAH - if (0xcf71 <= code && code <= 0xcf8b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE KWAE - if (0xcf8c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xcfa8) { - // Lo [27] HANGUL SYLLABLE KWAEG..HANGUL SYLLABLE KWAEH - if (0xcf8d <= code && code <= 0xcfa7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xcfa9) { - // Lo HANGUL SYLLABLE KOE - if (0xcfa8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE KOEG..HANGUL SYLLABLE KOEH - if (0xcfa9 <= code && code <= 0xcfc3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xcfe0) { - if (code < 0xcfc5) { - // Lo HANGUL SYLLABLE KYO - if (0xcfc4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE KYOG..HANGUL SYLLABLE KYOH - if (0xcfc5 <= code && code <= 0xcfdf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xcfe1) { - // Lo HANGUL SYLLABLE KU - if (0xcfe0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xcffc) { - // Lo [27] HANGUL SYLLABLE KUG..HANGUL SYLLABLE KUH - if (0xcfe1 <= code && code <= 0xcffb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE KWEO - if (0xcffc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xd050) { - if (code < 0xd019) { - if (code < 0xd018) { - // Lo [27] HANGUL SYLLABLE KWEOG..HANGUL SYLLABLE KWEOH - if (0xcffd <= code && code <= 0xd017) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE KWE - if (0xd018 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xd034) { - // Lo [27] HANGUL SYLLABLE KWEG..HANGUL SYLLABLE KWEH - if (0xd019 <= code && code <= 0xd033) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd035) { - // Lo HANGUL SYLLABLE KWI - if (0xd034 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE KWIG..HANGUL SYLLABLE KWIH - if (0xd035 <= code && code <= 0xd04f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xd06d) { - if (code < 0xd051) { - // Lo HANGUL SYLLABLE KYU - if (0xd050 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd06c) { - // Lo [27] HANGUL SYLLABLE KYUG..HANGUL SYLLABLE KYUH - if (0xd051 <= code && code <= 0xd06b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE KEU - if (0xd06c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xd088) { - // Lo [27] HANGUL SYLLABLE KEUG..HANGUL SYLLABLE KEUH - if (0xd06d <= code && code <= 0xd087) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd089) { - // Lo HANGUL SYLLABLE KYI - if (0xd088 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE KYIG..HANGUL SYLLABLE KYIH - if (0xd089 <= code && code <= 0xd0a3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - else { - if (code < 0xd131) { - if (code < 0xd0dd) { - if (code < 0xd0c0) { - if (code < 0xd0a5) { - // Lo HANGUL SYLLABLE KI - if (0xd0a4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE KIG..HANGUL SYLLABLE KIH - if (0xd0a5 <= code && code <= 0xd0bf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xd0c1) { - // Lo HANGUL SYLLABLE TA - if (0xd0c0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd0dc) { - // Lo [27] HANGUL SYLLABLE TAG..HANGUL SYLLABLE TAH - if (0xd0c1 <= code && code <= 0xd0db) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE TAE - if (0xd0dc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xd114) { - if (code < 0xd0f8) { - // Lo [27] HANGUL SYLLABLE TAEG..HANGUL SYLLABLE TAEH - if (0xd0dd <= code && code <= 0xd0f7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd0f9) { - // Lo HANGUL SYLLABLE TYA - if (0xd0f8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE TYAG..HANGUL SYLLABLE TYAH - if (0xd0f9 <= code && code <= 0xd113) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xd115) { - // Lo HANGUL SYLLABLE TYAE - if (0xd114 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd130) { - // Lo [27] HANGUL SYLLABLE TYAEG..HANGUL SYLLABLE TYAEH - if (0xd115 <= code && code <= 0xd12f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE TEO - if (0xd130 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xd184) { - if (code < 0xd14d) { - if (code < 0xd14c) { - // Lo [27] HANGUL SYLLABLE TEOG..HANGUL SYLLABLE TEOH - if (0xd131 <= code && code <= 0xd14b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE TE - if (0xd14c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xd168) { - // Lo [27] HANGUL SYLLABLE TEG..HANGUL SYLLABLE TEH - if (0xd14d <= code && code <= 0xd167) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd169) { - // Lo HANGUL SYLLABLE TYEO - if (0xd168 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE TYEOG..HANGUL SYLLABLE TYEOH - if (0xd169 <= code && code <= 0xd183) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xd1a1) { - if (code < 0xd185) { - // Lo HANGUL SYLLABLE TYE - if (0xd184 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd1a0) { - // Lo [27] HANGUL SYLLABLE TYEG..HANGUL SYLLABLE TYEH - if (0xd185 <= code && code <= 0xd19f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE TO - if (0xd1a0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xd1bc) { - // Lo [27] HANGUL SYLLABLE TOG..HANGUL SYLLABLE TOH - if (0xd1a1 <= code && code <= 0xd1bb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd1bd) { - // Lo HANGUL SYLLABLE TWA - if (0xd1bc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE TWAG..HANGUL SYLLABLE TWAH - if (0xd1bd <= code && code <= 0xd1d7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - } - } - } - else { - if (code < 0x1133b) { - if (code < 0xd671) { - if (code < 0xd424) { - if (code < 0xd2f1) { - if (code < 0xd264) { - if (code < 0xd211) { - if (code < 0xd1f4) { - if (code < 0xd1d9) { - // Lo HANGUL SYLLABLE TWAE - if (0xd1d8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE TWAEG..HANGUL SYLLABLE TWAEH - if (0xd1d9 <= code && code <= 0xd1f3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xd1f5) { - // Lo HANGUL SYLLABLE TOE - if (0xd1f4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd210) { - // Lo [27] HANGUL SYLLABLE TOEG..HANGUL SYLLABLE TOEH - if (0xd1f5 <= code && code <= 0xd20f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE TYO - if (0xd210 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xd22d) { - if (code < 0xd22c) { - // Lo [27] HANGUL SYLLABLE TYOG..HANGUL SYLLABLE TYOH - if (0xd211 <= code && code <= 0xd22b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE TU - if (0xd22c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xd248) { - // Lo [27] HANGUL SYLLABLE TUG..HANGUL SYLLABLE TUH - if (0xd22d <= code && code <= 0xd247) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd249) { - // Lo HANGUL SYLLABLE TWEO - if (0xd248 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE TWEOG..HANGUL SYLLABLE TWEOH - if (0xd249 <= code && code <= 0xd263) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xd29d) { - if (code < 0xd280) { - if (code < 0xd265) { - // Lo HANGUL SYLLABLE TWE - if (0xd264 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE TWEG..HANGUL SYLLABLE TWEH - if (0xd265 <= code && code <= 0xd27f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xd281) { - // Lo HANGUL SYLLABLE TWI - if (0xd280 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd29c) { - // Lo [27] HANGUL SYLLABLE TWIG..HANGUL SYLLABLE TWIH - if (0xd281 <= code && code <= 0xd29b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE TYU - if (0xd29c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xd2d4) { - if (code < 0xd2b8) { - // Lo [27] HANGUL SYLLABLE TYUG..HANGUL SYLLABLE TYUH - if (0xd29d <= code && code <= 0xd2b7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd2b9) { - // Lo HANGUL SYLLABLE TEU - if (0xd2b8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE TEUG..HANGUL SYLLABLE TEUH - if (0xd2b9 <= code && code <= 0xd2d3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xd2d5) { - // Lo HANGUL SYLLABLE TYI - if (0xd2d4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd2f0) { - // Lo [27] HANGUL SYLLABLE TYIG..HANGUL SYLLABLE TYIH - if (0xd2d5 <= code && code <= 0xd2ef) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE TI - if (0xd2f0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xd37d) { - if (code < 0xd344) { - if (code < 0xd30d) { - if (code < 0xd30c) { - // Lo [27] HANGUL SYLLABLE TIG..HANGUL SYLLABLE TIH - if (0xd2f1 <= code && code <= 0xd30b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE PA - if (0xd30c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xd328) { - // Lo [27] HANGUL SYLLABLE PAG..HANGUL SYLLABLE PAH - if (0xd30d <= code && code <= 0xd327) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd329) { - // Lo HANGUL SYLLABLE PAE - if (0xd328 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE PAEG..HANGUL SYLLABLE PAEH - if (0xd329 <= code && code <= 0xd343) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xd360) { - if (code < 0xd345) { - // Lo HANGUL SYLLABLE PYA - if (0xd344 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE PYAG..HANGUL SYLLABLE PYAH - if (0xd345 <= code && code <= 0xd35f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xd361) { - // Lo HANGUL SYLLABLE PYAE - if (0xd360 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd37c) { - // Lo [27] HANGUL SYLLABLE PYAEG..HANGUL SYLLABLE PYAEH - if (0xd361 <= code && code <= 0xd37b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE PEO - if (0xd37c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xd3d0) { - if (code < 0xd399) { - if (code < 0xd398) { - // Lo [27] HANGUL SYLLABLE PEOG..HANGUL SYLLABLE PEOH - if (0xd37d <= code && code <= 0xd397) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE PE - if (0xd398 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xd3b4) { - // Lo [27] HANGUL SYLLABLE PEG..HANGUL SYLLABLE PEH - if (0xd399 <= code && code <= 0xd3b3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd3b5) { - // Lo HANGUL SYLLABLE PYEO - if (0xd3b4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE PYEOG..HANGUL SYLLABLE PYEOH - if (0xd3b5 <= code && code <= 0xd3cf) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xd3ed) { - if (code < 0xd3d1) { - // Lo HANGUL SYLLABLE PYE - if (0xd3d0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd3ec) { - // Lo [27] HANGUL SYLLABLE PYEG..HANGUL SYLLABLE PYEH - if (0xd3d1 <= code && code <= 0xd3eb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE PO - if (0xd3ec === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xd408) { - // Lo [27] HANGUL SYLLABLE POG..HANGUL SYLLABLE POH - if (0xd3ed <= code && code <= 0xd407) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd409) { - // Lo HANGUL SYLLABLE PWA - if (0xd408 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE PWAG..HANGUL SYLLABLE PWAH - if (0xd409 <= code && code <= 0xd423) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - } - else { - if (code < 0xd53d) { - if (code < 0xd4b0) { - if (code < 0xd45d) { - if (code < 0xd440) { - if (code < 0xd425) { - // Lo HANGUL SYLLABLE PWAE - if (0xd424 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE PWAEG..HANGUL SYLLABLE PWAEH - if (0xd425 <= code && code <= 0xd43f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xd441) { - // Lo HANGUL SYLLABLE POE - if (0xd440 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd45c) { - // Lo [27] HANGUL SYLLABLE POEG..HANGUL SYLLABLE POEH - if (0xd441 <= code && code <= 0xd45b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE PYO - if (0xd45c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xd479) { - if (code < 0xd478) { - // Lo [27] HANGUL SYLLABLE PYOG..HANGUL SYLLABLE PYOH - if (0xd45d <= code && code <= 0xd477) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE PU - if (0xd478 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xd494) { - // Lo [27] HANGUL SYLLABLE PUG..HANGUL SYLLABLE PUH - if (0xd479 <= code && code <= 0xd493) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd495) { - // Lo HANGUL SYLLABLE PWEO - if (0xd494 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE PWEOG..HANGUL SYLLABLE PWEOH - if (0xd495 <= code && code <= 0xd4af) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xd4e9) { - if (code < 0xd4cc) { - if (code < 0xd4b1) { - // Lo HANGUL SYLLABLE PWE - if (0xd4b0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE PWEG..HANGUL SYLLABLE PWEH - if (0xd4b1 <= code && code <= 0xd4cb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xd4cd) { - // Lo HANGUL SYLLABLE PWI - if (0xd4cc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd4e8) { - // Lo [27] HANGUL SYLLABLE PWIG..HANGUL SYLLABLE PWIH - if (0xd4cd <= code && code <= 0xd4e7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE PYU - if (0xd4e8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xd520) { - if (code < 0xd504) { - // Lo [27] HANGUL SYLLABLE PYUG..HANGUL SYLLABLE PYUH - if (0xd4e9 <= code && code <= 0xd503) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd505) { - // Lo HANGUL SYLLABLE PEU - if (0xd504 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE PEUG..HANGUL SYLLABLE PEUH - if (0xd505 <= code && code <= 0xd51f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xd521) { - // Lo HANGUL SYLLABLE PYI - if (0xd520 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd53c) { - // Lo [27] HANGUL SYLLABLE PYIG..HANGUL SYLLABLE PYIH - if (0xd521 <= code && code <= 0xd53b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE PI - if (0xd53c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - else { - if (code < 0xd5e4) { - if (code < 0xd590) { - if (code < 0xd559) { - if (code < 0xd558) { - // Lo [27] HANGUL SYLLABLE PIG..HANGUL SYLLABLE PIH - if (0xd53d <= code && code <= 0xd557) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE HA - if (0xd558 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xd574) { - // Lo [27] HANGUL SYLLABLE HAG..HANGUL SYLLABLE HAH - if (0xd559 <= code && code <= 0xd573) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd575) { - // Lo HANGUL SYLLABLE HAE - if (0xd574 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE HAEG..HANGUL SYLLABLE HAEH - if (0xd575 <= code && code <= 0xd58f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xd5ad) { - if (code < 0xd591) { - // Lo HANGUL SYLLABLE HYA - if (0xd590 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd5ac) { - // Lo [27] HANGUL SYLLABLE HYAG..HANGUL SYLLABLE HYAH - if (0xd591 <= code && code <= 0xd5ab) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE HYAE - if (0xd5ac === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xd5c8) { - // Lo [27] HANGUL SYLLABLE HYAEG..HANGUL SYLLABLE HYAEH - if (0xd5ad <= code && code <= 0xd5c7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd5c9) { - // Lo HANGUL SYLLABLE HEO - if (0xd5c8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE HEOG..HANGUL SYLLABLE HEOH - if (0xd5c9 <= code && code <= 0xd5e3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - else { - if (code < 0xd61d) { - if (code < 0xd600) { - if (code < 0xd5e5) { - // Lo HANGUL SYLLABLE HE - if (0xd5e4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE HEG..HANGUL SYLLABLE HEH - if (0xd5e5 <= code && code <= 0xd5ff) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xd601) { - // Lo HANGUL SYLLABLE HYEO - if (0xd600 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd61c) { - // Lo [27] HANGUL SYLLABLE HYEOG..HANGUL SYLLABLE HYEOH - if (0xd601 <= code && code <= 0xd61b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE HYE - if (0xd61c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - else { - if (code < 0xd654) { - if (code < 0xd638) { - // Lo [27] HANGUL SYLLABLE HYEG..HANGUL SYLLABLE HYEH - if (0xd61d <= code && code <= 0xd637) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd639) { - // Lo HANGUL SYLLABLE HO - if (0xd638 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE HOG..HANGUL SYLLABLE HOH - if (0xd639 <= code && code <= 0xd653) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - else { - if (code < 0xd655) { - // Lo HANGUL SYLLABLE HWA - if (0xd654 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd670) { - // Lo [27] HANGUL SYLLABLE HWAG..HANGUL SYLLABLE HWAH - if (0xd655 <= code && code <= 0xd66f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE HWAE - if (0xd670 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - } - } - } - else { - if (code < 0x11000) { - if (code < 0xd7b0) { - if (code < 0xd6fd) { - if (code < 0xd6c4) { - if (code < 0xd68d) { - if (code < 0xd68c) { - // Lo [27] HANGUL SYLLABLE HWAEG..HANGUL SYLLABLE HWAEH - if (0xd671 <= code && code <= 0xd68b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE HOE - if (0xd68c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xd6a8) { - // Lo [27] HANGUL SYLLABLE HOEG..HANGUL SYLLABLE HOEH - if (0xd68d <= code && code <= 0xd6a7) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd6a9) { - // Lo HANGUL SYLLABLE HYO - if (0xd6a8 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE HYOG..HANGUL SYLLABLE HYOH - if (0xd6a9 <= code && code <= 0xd6c3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xd6e0) { - if (code < 0xd6c5) { - // Lo HANGUL SYLLABLE HU - if (0xd6c4 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE HUG..HANGUL SYLLABLE HUH - if (0xd6c5 <= code && code <= 0xd6df) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - else { - if (code < 0xd6e1) { - // Lo HANGUL SYLLABLE HWEO - if (0xd6e0 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd6fc) { - // Lo [27] HANGUL SYLLABLE HWEOG..HANGUL SYLLABLE HWEOH - if (0xd6e1 <= code && code <= 0xd6fb) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE HWE - if (0xd6fc === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - } - } - else { - if (code < 0xd750) { - if (code < 0xd719) { - if (code < 0xd718) { - // Lo [27] HANGUL SYLLABLE HWEG..HANGUL SYLLABLE HWEH - if (0xd6fd <= code && code <= 0xd717) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE HWI - if (0xd718 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - else { - if (code < 0xd734) { - // Lo [27] HANGUL SYLLABLE HWIG..HANGUL SYLLABLE HWIH - if (0xd719 <= code && code <= 0xd733) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd735) { - // Lo HANGUL SYLLABLE HYU - if (0xd734 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE HYUG..HANGUL SYLLABLE HYUH - if (0xd735 <= code && code <= 0xd74f) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - else { - if (code < 0xd76d) { - if (code < 0xd751) { - // Lo HANGUL SYLLABLE HEU - if (0xd750 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - if (code < 0xd76c) { - // Lo [27] HANGUL SYLLABLE HEUG..HANGUL SYLLABLE HEUH - if (0xd751 <= code && code <= 0xd76b) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - // Lo HANGUL SYLLABLE HYI - if (0xd76c === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - } - } - else { - if (code < 0xd788) { - // Lo [27] HANGUL SYLLABLE HYIG..HANGUL SYLLABLE HYIH - if (0xd76d <= code && code <= 0xd787) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - else { - if (code < 0xd789) { - // Lo HANGUL SYLLABLE HI - if (0xd788 === code) { - return boundaries_1.CLUSTER_BREAK.LV; - } - } - else { - // Lo [27] HANGUL SYLLABLE HIG..HANGUL SYLLABLE HIH - if (0xd789 <= code && code <= 0xd7a3) { - return boundaries_1.CLUSTER_BREAK.LVT; - } - } - } - } - } - } - } - else { - if (code < 0x10a01) { - if (code < 0xfeff) { - if (code < 0xfb1e) { - if (code < 0xd7cb) { - // Lo [23] HANGUL JUNGSEONG O-YEO..HANGUL JUNGSEONG ARAEA-E - if (0xd7b0 <= code && code <= 0xd7c6) { - return boundaries_1.CLUSTER_BREAK.V; - } - } - else { - // Lo [49] HANGUL JONGSEONG NIEUN-RIEUL..HANGUL JONGSEONG PHIEUPH-THIEUTH - if (0xd7cb <= code && code <= 0xd7fb) { - return boundaries_1.CLUSTER_BREAK.T; - } - } - } - else { - if (code < 0xfe00) { - // Mn HEBREW POINT JUDEO-SPANISH VARIKA - if (0xfb1e === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xfe20) { - // Mn [16] VARIATION SELECTOR-1..VARIATION SELECTOR-16 - if (0xfe00 <= code && code <= 0xfe0f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [16] COMBINING LIGATURE LEFT HALF..COMBINING CYRILLIC TITLO RIGHT HALF - if (0xfe20 <= code && code <= 0xfe2f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x101fd) { - if (code < 0xff9e) { - // Cf ZERO WIDTH NO-BREAK SPACE - if (0xfeff === code) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - if (code < 0xfff0) { - // Lm [2] HALFWIDTH KATAKANA VOICED SOUND MARK..HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK - if (0xff9e <= code && code <= 0xff9f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Cn [9] .. - // Cf [3] INTERLINEAR ANNOTATION ANCHOR..INTERLINEAR ANNOTATION TERMINATOR - if (0xfff0 <= code && code <= 0xfffb) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - } - } - else { - if (code < 0x102e0) { - // Mn PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE - if (0x101fd === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x10376) { - // Mn COPTIC EPACT THOUSANDS MARK - if (0x102e0 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [5] COMBINING OLD PERMIC LETTER AN..COMBINING OLD PERMIC LETTER SII - if (0x10376 <= code && code <= 0x1037a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x10ae5) { - if (code < 0x10a0c) { - if (code < 0x10a05) { - // Mn [3] KHAROSHTHI VOWEL SIGN I..KHAROSHTHI VOWEL SIGN VOCALIC R - if (0x10a01 <= code && code <= 0x10a03) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] KHAROSHTHI VOWEL SIGN E..KHAROSHTHI VOWEL SIGN O - if (0x10a05 <= code && code <= 0x10a06) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x10a38) { - // Mn [4] KHAROSHTHI VOWEL LENGTH MARK..KHAROSHTHI SIGN VISARGA - if (0x10a0c <= code && code <= 0x10a0f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x10a3f) { - // Mn [3] KHAROSHTHI SIGN BAR ABOVE..KHAROSHTHI SIGN DOT BELOW - if (0x10a38 <= code && code <= 0x10a3a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn KHAROSHTHI VIRAMA - if (0x10a3f === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x10efd) { - if (code < 0x10d24) { - // Mn [2] MANICHAEAN ABBREVIATION MARK ABOVE..MANICHAEAN ABBREVIATION MARK BELOW - if (0x10ae5 <= code && code <= 0x10ae6) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x10eab) { - // Mn [4] HANIFI ROHINGYA SIGN HARBAHAY..HANIFI ROHINGYA SIGN TASSI - if (0x10d24 <= code && code <= 0x10d27) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] YEZIDI COMBINING HAMZA MARK..YEZIDI COMBINING MADDA MARK - if (0x10eab <= code && code <= 0x10eac) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x10f46) { - // Mn [3] ARABIC SMALL LOW WORD SAKTA..ARABIC SMALL LOW WORD MADDA - if (0x10efd <= code && code <= 0x10eff) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x10f82) { - // Mn [11] SOGDIAN COMBINING DOT BELOW..SOGDIAN COMBINING STROKE BELOW - if (0x10f46 <= code && code <= 0x10f50) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [4] OLD UYGHUR COMBINING DOT ABOVE..OLD UYGHUR COMBINING TWO DOTS BELOW - if (0x10f82 <= code && code <= 0x10f85) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - } - else { - if (code < 0x11180) { - if (code < 0x110b7) { - if (code < 0x11073) { - if (code < 0x11002) { - // Mc BRAHMI SIGN CANDRABINDU - if (0x11000 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn BRAHMI SIGN ANUSVARA - if (0x11001 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11038) { - // Mc BRAHMI SIGN VISARGA - if (0x11002 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x11070) { - // Mn [15] BRAHMI VOWEL SIGN AA..BRAHMI VIRAMA - if (0x11038 <= code && code <= 0x11046) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn BRAHMI SIGN OLD TAMIL VIRAMA - if (0x11070 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x11082) { - if (code < 0x1107f) { - // Mn [2] BRAHMI VOWEL SIGN OLD TAMIL SHORT E..BRAHMI VOWEL SIGN OLD TAMIL SHORT O - if (0x11073 <= code && code <= 0x11074) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [3] BRAHMI NUMBER JOINER..KAITHI SIGN ANUSVARA - if (0x1107f <= code && code <= 0x11081) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x110b0) { - // Mc KAITHI SIGN VISARGA - if (0x11082 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x110b3) { - // Mc [3] KAITHI VOWEL SIGN AA..KAITHI VOWEL SIGN II - if (0x110b0 <= code && code <= 0x110b2) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [4] KAITHI VOWEL SIGN U..KAITHI VOWEL SIGN AI - if (0x110b3 <= code && code <= 0x110b6) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x11100) { - if (code < 0x110bd) { - if (code < 0x110b9) { - // Mc [2] KAITHI VOWEL SIGN O..KAITHI VOWEL SIGN AU - if (0x110b7 <= code && code <= 0x110b8) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] KAITHI SIGN VIRAMA..KAITHI SIGN NUKTA - if (0x110b9 <= code && code <= 0x110ba) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x110c2) { - // Cf KAITHI NUMBER SIGN - if (0x110bd === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - else { - // Mn KAITHI VOWEL SIGN VOCALIC R - if (0x110c2 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Cf KAITHI NUMBER SIGN ABOVE - if (0x110cd === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - } - } - else { - if (code < 0x1112d) { - if (code < 0x11127) { - // Mn [3] CHAKMA SIGN CANDRABINDU..CHAKMA SIGN VISARGA - if (0x11100 <= code && code <= 0x11102) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1112c) { - // Mn [5] CHAKMA VOWEL SIGN A..CHAKMA VOWEL SIGN UU - if (0x11127 <= code && code <= 0x1112b) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc CHAKMA VOWEL SIGN E - if (0x1112c === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0x11145) { - // Mn [8] CHAKMA VOWEL SIGN AI..CHAKMA MAAYYAA - if (0x1112d <= code && code <= 0x11134) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11173) { - // Mc [2] CHAKMA VOWEL SIGN AA..CHAKMA VOWEL SIGN EI - if (0x11145 <= code && code <= 0x11146) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn MAHAJANI SIGN NUKTA - if (0x11173 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - else { - if (code < 0x11232) { - if (code < 0x111c2) { - if (code < 0x111b3) { - if (code < 0x11182) { - // Mn [2] SHARADA SIGN CANDRABINDU..SHARADA SIGN ANUSVARA - if (0x11180 <= code && code <= 0x11181) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc SHARADA SIGN VISARGA - if (0x11182 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x111b6) { - // Mc [3] SHARADA VOWEL SIGN AA..SHARADA VOWEL SIGN II - if (0x111b3 <= code && code <= 0x111b5) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x111bf) { - // Mn [9] SHARADA VOWEL SIGN U..SHARADA VOWEL SIGN O - if (0x111b6 <= code && code <= 0x111be) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] SHARADA VOWEL SIGN AU..SHARADA SIGN VIRAMA - if (0x111bf <= code && code <= 0x111c0) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0x111cf) { - if (code < 0x111c9) { - // Lo [2] SHARADA SIGN JIHVAMULIYA..SHARADA SIGN UPADHMANIYA - if (0x111c2 <= code && code <= 0x111c3) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - else { - if (code < 0x111ce) { - // Mn [4] SHARADA SANDHI MARK..SHARADA EXTRA SHORT VOWEL MARK - if (0x111c9 <= code && code <= 0x111cc) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc SHARADA VOWEL SIGN PRISHTHAMATRA E - if (0x111ce === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0x1122c) { - // Mn SHARADA SIGN INVERTED CANDRABINDU - if (0x111cf === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1122f) { - // Mc [3] KHOJKI VOWEL SIGN AA..KHOJKI VOWEL SIGN II - if (0x1122c <= code && code <= 0x1122e) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [3] KHOJKI VOWEL SIGN U..KHOJKI VOWEL SIGN AI - if (0x1122f <= code && code <= 0x11231) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x11241) { - if (code < 0x11235) { - if (code < 0x11234) { - // Mc [2] KHOJKI VOWEL SIGN O..KHOJKI VOWEL SIGN AU - if (0x11232 <= code && code <= 0x11233) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn KHOJKI SIGN ANUSVARA - if (0x11234 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x11236) { - // Mc KHOJKI SIGN VIRAMA - if (0x11235 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x1123e) { - // Mn [2] KHOJKI SIGN NUKTA..KHOJKI SIGN SHADDA - if (0x11236 <= code && code <= 0x11237) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn KHOJKI SIGN SUKUN - if (0x1123e === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x112e3) { - if (code < 0x112df) { - // Mn KHOJKI VOWEL SIGN VOCALIC R - if (0x11241 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x112e0) { - // Mn KHUDAWADI SIGN ANUSVARA - if (0x112df === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [3] KHUDAWADI VOWEL SIGN AA..KHUDAWADI VOWEL SIGN II - if (0x112e0 <= code && code <= 0x112e2) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0x11300) { - // Mn [8] KHUDAWADI VOWEL SIGN U..KHUDAWADI SIGN VIRAMA - if (0x112e3 <= code && code <= 0x112ea) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11302) { - // Mn [2] GRANTHA SIGN COMBINING ANUSVARA ABOVE..GRANTHA SIGN CANDRABINDU - if (0x11300 <= code && code <= 0x11301) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] GRANTHA SIGN ANUSVARA..GRANTHA SIGN VISARGA - if (0x11302 <= code && code <= 0x11303) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - } - } - } - } - else { - if (code < 0x11a97) { - if (code < 0x116ab) { - if (code < 0x114b9) { - if (code < 0x11370) { - if (code < 0x11347) { - if (code < 0x1133f) { - if (code < 0x1133e) { - // Mn [2] COMBINING BINDU BELOW..GRANTHA SIGN NUKTA - if (0x1133b <= code && code <= 0x1133c) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc GRANTHA VOWEL SIGN AA - if (0x1133e === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x11340) { - // Mc GRANTHA VOWEL SIGN I - if (0x1133f === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x11341) { - // Mn GRANTHA VOWEL SIGN II - if (0x11340 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [4] GRANTHA VOWEL SIGN U..GRANTHA VOWEL SIGN VOCALIC RR - if (0x11341 <= code && code <= 0x11344) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0x11357) { - if (code < 0x1134b) { - // Mc [2] GRANTHA VOWEL SIGN EE..GRANTHA VOWEL SIGN AI - if (0x11347 <= code && code <= 0x11348) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mc [3] GRANTHA VOWEL SIGN OO..GRANTHA SIGN VIRAMA - if (0x1134b <= code && code <= 0x1134d) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x11362) { - // Mc GRANTHA AU LENGTH MARK - if (0x11357 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11366) { - // Mc [2] GRANTHA VOWEL SIGN VOCALIC L..GRANTHA VOWEL SIGN VOCALIC LL - if (0x11362 <= code && code <= 0x11363) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [7] COMBINING GRANTHA DIGIT ZERO..COMBINING GRANTHA DIGIT SIX - if (0x11366 <= code && code <= 0x1136c) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x11445) { - if (code < 0x11438) { - if (code < 0x11435) { - // Mn [5] COMBINING GRANTHA LETTER A..COMBINING GRANTHA LETTER PA - if (0x11370 <= code && code <= 0x11374) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [3] NEWA VOWEL SIGN AA..NEWA VOWEL SIGN II - if (0x11435 <= code && code <= 0x11437) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x11440) { - // Mn [8] NEWA VOWEL SIGN U..NEWA VOWEL SIGN AI - if (0x11438 <= code && code <= 0x1143f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11442) { - // Mc [2] NEWA VOWEL SIGN O..NEWA VOWEL SIGN AU - if (0x11440 <= code && code <= 0x11441) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [3] NEWA SIGN VIRAMA..NEWA SIGN ANUSVARA - if (0x11442 <= code && code <= 0x11444) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x114b0) { - if (code < 0x11446) { - // Mc NEWA SIGN VISARGA - if (0x11445 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn NEWA SIGN NUKTA - if (0x11446 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mn NEWA SANDHI MARK - if (0x1145e === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x114b1) { - // Mc TIRHUTA VOWEL SIGN AA - if (0x114b0 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x114b3) { - // Mc [2] TIRHUTA VOWEL SIGN I..TIRHUTA VOWEL SIGN II - if (0x114b1 <= code && code <= 0x114b2) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [6] TIRHUTA VOWEL SIGN U..TIRHUTA VOWEL SIGN VOCALIC LL - if (0x114b3 <= code && code <= 0x114b8) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - else { - if (code < 0x115b8) { - if (code < 0x114bf) { - if (code < 0x114bb) { - // Mc TIRHUTA VOWEL SIGN E - if (0x114b9 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn TIRHUTA VOWEL SIGN SHORT E - if (0x114ba === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x114bd) { - // Mc [2] TIRHUTA VOWEL SIGN AI..TIRHUTA VOWEL SIGN O - if (0x114bb <= code && code <= 0x114bc) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mc TIRHUTA VOWEL SIGN SHORT O - if (0x114bd === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mc TIRHUTA VOWEL SIGN AU - if (0x114be === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0x115af) { - if (code < 0x114c1) { - // Mn [2] TIRHUTA SIGN CANDRABINDU..TIRHUTA SIGN ANUSVARA - if (0x114bf <= code && code <= 0x114c0) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x114c2) { - // Mc TIRHUTA SIGN VISARGA - if (0x114c1 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] TIRHUTA SIGN VIRAMA..TIRHUTA SIGN NUKTA - if (0x114c2 <= code && code <= 0x114c3) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x115b0) { - // Mc SIDDHAM VOWEL SIGN AA - if (0x115af === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x115b2) { - // Mc [2] SIDDHAM VOWEL SIGN I..SIDDHAM VOWEL SIGN II - if (0x115b0 <= code && code <= 0x115b1) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [4] SIDDHAM VOWEL SIGN U..SIDDHAM VOWEL SIGN VOCALIC RR - if (0x115b2 <= code && code <= 0x115b5) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x11630) { - if (code < 0x115be) { - if (code < 0x115bc) { - // Mc [4] SIDDHAM VOWEL SIGN E..SIDDHAM VOWEL SIGN AU - if (0x115b8 <= code && code <= 0x115bb) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] SIDDHAM SIGN CANDRABINDU..SIDDHAM SIGN ANUSVARA - if (0x115bc <= code && code <= 0x115bd) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x115bf) { - // Mc SIDDHAM SIGN VISARGA - if (0x115be === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x115dc) { - // Mn [2] SIDDHAM SIGN VIRAMA..SIDDHAM SIGN NUKTA - if (0x115bf <= code && code <= 0x115c0) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] SIDDHAM VOWEL SIGN ALTERNATE U..SIDDHAM VOWEL SIGN ALTERNATE UU - if (0x115dc <= code && code <= 0x115dd) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x1163d) { - if (code < 0x11633) { - // Mc [3] MODI VOWEL SIGN AA..MODI VOWEL SIGN II - if (0x11630 <= code && code <= 0x11632) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x1163b) { - // Mn [8] MODI VOWEL SIGN U..MODI VOWEL SIGN AI - if (0x11633 <= code && code <= 0x1163a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] MODI VOWEL SIGN O..MODI VOWEL SIGN AU - if (0x1163b <= code && code <= 0x1163c) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0x1163e) { - // Mn MODI SIGN ANUSVARA - if (0x1163d === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1163f) { - // Mc MODI SIGN VISARGA - if (0x1163e === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] MODI SIGN VIRAMA..MODI SIGN ARDHACANDRA - if (0x1163f <= code && code <= 0x11640) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - } - else { - if (code < 0x1193f) { - if (code < 0x11727) { - if (code < 0x116b6) { - if (code < 0x116ad) { - // Mn TAKRI SIGN ANUSVARA - if (0x116ab === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mc TAKRI SIGN VISARGA - if (0x116ac === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x116ae) { - // Mn TAKRI VOWEL SIGN AA - if (0x116ad === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x116b0) { - // Mc [2] TAKRI VOWEL SIGN I..TAKRI VOWEL SIGN II - if (0x116ae <= code && code <= 0x116af) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [6] TAKRI VOWEL SIGN U..TAKRI VOWEL SIGN AU - if (0x116b0 <= code && code <= 0x116b5) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x1171d) { - // Mc TAKRI SIGN VIRAMA - if (0x116b6 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn TAKRI SIGN NUKTA - if (0x116b7 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11722) { - // Mn [3] AHOM CONSONANT SIGN MEDIAL LA..AHOM CONSONANT SIGN MEDIAL LIGATING RA - if (0x1171d <= code && code <= 0x1171f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11726) { - // Mn [4] AHOM VOWEL SIGN I..AHOM VOWEL SIGN UU - if (0x11722 <= code && code <= 0x11725) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc AHOM VOWEL SIGN E - if (0x11726 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - else { - if (code < 0x11930) { - if (code < 0x1182f) { - if (code < 0x1182c) { - // Mn [5] AHOM VOWEL SIGN AW..AHOM SIGN KILLER - if (0x11727 <= code && code <= 0x1172b) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [3] DOGRA VOWEL SIGN AA..DOGRA VOWEL SIGN II - if (0x1182c <= code && code <= 0x1182e) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x11838) { - // Mn [9] DOGRA VOWEL SIGN U..DOGRA SIGN ANUSVARA - if (0x1182f <= code && code <= 0x11837) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11839) { - // Mc DOGRA SIGN VISARGA - if (0x11838 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] DOGRA SIGN VIRAMA..DOGRA SIGN NUKTA - if (0x11839 <= code && code <= 0x1183a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x1193b) { - if (code < 0x11931) { - // Mc DIVES AKURU VOWEL SIGN AA - if (0x11930 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11937) { - // Mc [5] DIVES AKURU VOWEL SIGN I..DIVES AKURU VOWEL SIGN E - if (0x11931 <= code && code <= 0x11935) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mc [2] DIVES AKURU VOWEL SIGN AI..DIVES AKURU VOWEL SIGN O - if (0x11937 <= code && code <= 0x11938) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0x1193d) { - // Mn [2] DIVES AKURU SIGN ANUSVARA..DIVES AKURU SIGN CANDRABINDU - if (0x1193b <= code && code <= 0x1193c) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc DIVES AKURU SIGN HALANTA - if (0x1193d === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn DIVES AKURU VIRAMA - if (0x1193e === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x11a01) { - if (code < 0x119d1) { - if (code < 0x11941) { - // Lo DIVES AKURU PREFIXED NASAL SIGN - if (0x1193f === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - // Mc DIVES AKURU MEDIAL YA - if (0x11940 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x11942) { - // Lo DIVES AKURU INITIAL RA - if (0x11941 === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - else { - // Mc DIVES AKURU MEDIAL RA - if (0x11942 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn DIVES AKURU SIGN NUKTA - if (0x11943 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x119dc) { - if (code < 0x119d4) { - // Mc [3] NANDINAGARI VOWEL SIGN AA..NANDINAGARI VOWEL SIGN II - if (0x119d1 <= code && code <= 0x119d3) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x119da) { - // Mn [4] NANDINAGARI VOWEL SIGN U..NANDINAGARI VOWEL SIGN VOCALIC RR - if (0x119d4 <= code && code <= 0x119d7) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [2] NANDINAGARI VOWEL SIGN E..NANDINAGARI VOWEL SIGN AI - if (0x119da <= code && code <= 0x119db) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x119e0) { - // Mc [4] NANDINAGARI VOWEL SIGN O..NANDINAGARI SIGN VISARGA - if (0x119dc <= code && code <= 0x119df) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn NANDINAGARI SIGN VIRAMA - if (0x119e0 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mc NANDINAGARI VOWEL SIGN PRISHTHAMATRA E - if (0x119e4 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0x11a47) { - if (code < 0x11a39) { - if (code < 0x11a33) { - // Mn [10] ZANABAZAR SQUARE VOWEL SIGN I..ZANABAZAR SQUARE VOWEL LENGTH MARK - if (0x11a01 <= code && code <= 0x11a0a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [6] ZANABAZAR SQUARE FINAL CONSONANT MARK..ZANABAZAR SQUARE SIGN ANUSVARA - if (0x11a33 <= code && code <= 0x11a38) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x11a3a) { - // Mc ZANABAZAR SQUARE SIGN VISARGA - if (0x11a39 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x11a3b) { - // Lo ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA - if (0x11a3a === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - else { - // Mn [4] ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA..ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA - if (0x11a3b <= code && code <= 0x11a3e) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x11a59) { - if (code < 0x11a51) { - // Mn ZANABAZAR SQUARE SUBJOINER - if (0x11a47 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11a57) { - // Mn [6] SOYOMBO VOWEL SIGN I..SOYOMBO VOWEL SIGN OE - if (0x11a51 <= code && code <= 0x11a56) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] SOYOMBO VOWEL SIGN AI..SOYOMBO VOWEL SIGN AU - if (0x11a57 <= code && code <= 0x11a58) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - else { - if (code < 0x11a84) { - // Mn [3] SOYOMBO VOWEL SIGN VOCALIC R..SOYOMBO VOWEL LENGTH MARK - if (0x11a59 <= code && code <= 0x11a5b) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11a8a) { - // Lo [6] SOYOMBO SIGN JIHVAMULIYA..SOYOMBO CLUSTER-INITIAL LETTER SA - if (0x11a84 <= code && code <= 0x11a89) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - else { - // Mn [13] SOYOMBO FINAL CONSONANT SIGN G..SOYOMBO SIGN ANUSVARA - if (0x11a8a <= code && code <= 0x11a96) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - } - } - else { - if (code < 0x16f51) { - if (code < 0x11d90) { - if (code < 0x11cb1) { - if (code < 0x11c3e) { - if (code < 0x11c2f) { - if (code < 0x11a98) { - // Mc SOYOMBO SIGN VISARGA - if (0x11a97 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] SOYOMBO GEMINATION MARK..SOYOMBO SUBJOINER - if (0x11a98 <= code && code <= 0x11a99) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x11c30) { - // Mc BHAIKSUKI VOWEL SIGN AA - if (0x11c2f === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x11c38) { - // Mn [7] BHAIKSUKI VOWEL SIGN I..BHAIKSUKI VOWEL SIGN VOCALIC L - if (0x11c30 <= code && code <= 0x11c36) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [6] BHAIKSUKI VOWEL SIGN E..BHAIKSUKI SIGN ANUSVARA - if (0x11c38 <= code && code <= 0x11c3d) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x11c92) { - // Mc BHAIKSUKI SIGN VISARGA - if (0x11c3e === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn BHAIKSUKI SIGN VIRAMA - if (0x11c3f === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11ca9) { - // Mn [22] MARCHEN SUBJOINED LETTER KA..MARCHEN SUBJOINED LETTER ZA - if (0x11c92 <= code && code <= 0x11ca7) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11caa) { - // Mc MARCHEN SUBJOINED LETTER YA - if (0x11ca9 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [7] MARCHEN SUBJOINED LETTER RA..MARCHEN VOWEL SIGN AA - if (0x11caa <= code && code <= 0x11cb0) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x11d3a) { - if (code < 0x11cb4) { - if (code < 0x11cb2) { - // Mc MARCHEN VOWEL SIGN I - if (0x11cb1 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] MARCHEN VOWEL SIGN U..MARCHEN VOWEL SIGN E - if (0x11cb2 <= code && code <= 0x11cb3) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x11cb5) { - // Mc MARCHEN VOWEL SIGN O - if (0x11cb4 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - if (code < 0x11d31) { - // Mn [2] MARCHEN SIGN ANUSVARA..MARCHEN SIGN CANDRABINDU - if (0x11cb5 <= code && code <= 0x11cb6) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [6] MASARAM GONDI VOWEL SIGN AA..MASARAM GONDI VOWEL SIGN VOCALIC R - if (0x11d31 <= code && code <= 0x11d36) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x11d46) { - if (code < 0x11d3c) { - // Mn MASARAM GONDI VOWEL SIGN E - if (0x11d3a === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11d3f) { - // Mn [2] MASARAM GONDI VOWEL SIGN AI..MASARAM GONDI VOWEL SIGN O - if (0x11d3c <= code && code <= 0x11d3d) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [7] MASARAM GONDI VOWEL SIGN AU..MASARAM GONDI VIRAMA - if (0x11d3f <= code && code <= 0x11d45) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x11d47) { - // Lo MASARAM GONDI REPHA - if (0x11d46 === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - else { - if (code < 0x11d8a) { - // Mn MASARAM GONDI RA-KARA - if (0x11d47 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [5] GUNJALA GONDI VOWEL SIGN AA..GUNJALA GONDI VOWEL SIGN UU - if (0x11d8a <= code && code <= 0x11d8e) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - } - else { - if (code < 0x11f36) { - if (code < 0x11ef3) { - if (code < 0x11d95) { - if (code < 0x11d93) { - // Mn [2] GUNJALA GONDI VOWEL SIGN EE..GUNJALA GONDI VOWEL SIGN AI - if (0x11d90 <= code && code <= 0x11d91) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] GUNJALA GONDI VOWEL SIGN OO..GUNJALA GONDI VOWEL SIGN AU - if (0x11d93 <= code && code <= 0x11d94) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x11d96) { - // Mn GUNJALA GONDI SIGN ANUSVARA - if (0x11d95 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc GUNJALA GONDI SIGN VISARGA - if (0x11d96 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn GUNJALA GONDI VIRAMA - if (0x11d97 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x11f02) { - if (code < 0x11ef5) { - // Mn [2] MAKASAR VOWEL SIGN I..MAKASAR VOWEL SIGN U - if (0x11ef3 <= code && code <= 0x11ef4) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x11f00) { - // Mc [2] MAKASAR VOWEL SIGN E..MAKASAR VOWEL SIGN O - if (0x11ef5 <= code && code <= 0x11ef6) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] KAWI SIGN CANDRABINDU..KAWI SIGN ANUSVARA - if (0x11f00 <= code && code <= 0x11f01) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x11f03) { - // Lo KAWI SIGN REPHA - if (0x11f02 === code) { - return boundaries_1.CLUSTER_BREAK.PREPEND; - } - } - else { - if (code < 0x11f34) { - // Mc KAWI SIGN VISARGA - if (0x11f03 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mc [2] KAWI VOWEL SIGN AA..KAWI VOWEL SIGN ALTERNATE AA - if (0x11f34 <= code && code <= 0x11f35) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - } - else { - if (code < 0x13430) { - if (code < 0x11f40) { - if (code < 0x11f3e) { - // Mn [5] KAWI VOWEL SIGN I..KAWI VOWEL SIGN VOCALIC R - if (0x11f36 <= code && code <= 0x11f3a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc [2] KAWI VOWEL SIGN E..KAWI VOWEL SIGN AI - if (0x11f3e <= code && code <= 0x11f3f) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x11f41) { - // Mn KAWI VOWEL SIGN EU - if (0x11f40 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc KAWI SIGN KILLER - if (0x11f41 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - // Mn KAWI CONJOINER - if (0x11f42 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x16af0) { - if (code < 0x13440) { - // Cf [16] EGYPTIAN HIEROGLYPH VERTICAL JOINER..EGYPTIAN HIEROGLYPH END WALLED ENCLOSURE - if (0x13430 <= code && code <= 0x1343f) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - if (code < 0x13447) { - // Mn EGYPTIAN HIEROGLYPH MIRROR HORIZONTALLY - if (0x13440 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [15] EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT TOP START..EGYPTIAN HIEROGLYPH MODIFIER DAMAGED - if (0x13447 <= code && code <= 0x13455) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x16b30) { - // Mn [5] BASSA VAH COMBINING HIGH TONE..BASSA VAH COMBINING HIGH-LOW TONE - if (0x16af0 <= code && code <= 0x16af4) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x16f4f) { - // Mn [7] PAHAWH HMONG MARK CIM TUB..PAHAWH HMONG MARK CIM TAUM - if (0x16b30 <= code && code <= 0x16b36) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn MIAO SIGN CONSONANT MODIFIER BAR - if (0x16f4f === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - } - else { - if (code < 0x1da84) { - if (code < 0x1d167) { - if (code < 0x1bca0) { - if (code < 0x16fe4) { - if (code < 0x16f8f) { - // Mc [55] MIAO SIGN ASPIRATION..MIAO VOWEL SIGN UI - if (0x16f51 <= code && code <= 0x16f87) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [4] MIAO TONE RIGHT..MIAO TONE BELOW - if (0x16f8f <= code && code <= 0x16f92) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x16ff0) { - // Mn KHITAN SMALL SCRIPT FILLER - if (0x16fe4 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1bc9d) { - // Mc [2] VIETNAMESE ALTERNATE READING MARK CA..VIETNAMESE ALTERNATE READING MARK NHAY - if (0x16ff0 <= code && code <= 0x16ff1) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - else { - // Mn [2] DUPLOYAN THICK LETTER SELECTOR..DUPLOYAN DOUBLE MARK - if (0x1bc9d <= code && code <= 0x1bc9e) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x1cf30) { - if (code < 0x1cf00) { - // Cf [4] SHORTHAND FORMAT LETTER OVERLAP..SHORTHAND FORMAT UP STEP - if (0x1bca0 <= code && code <= 0x1bca3) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - // Mn [46] ZNAMENNY COMBINING MARK GORAZDO NIZKO S KRYZHEM ON LEFT..ZNAMENNY COMBINING MARK KRYZH ON LEFT - if (0x1cf00 <= code && code <= 0x1cf2d) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x1d165) { - // Mn [23] ZNAMENNY COMBINING TONAL RANGE MARK MRACHNO..ZNAMENNY PRIZNAK MODIFIER ROG - if (0x1cf30 <= code && code <= 0x1cf46) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc MUSICAL SYMBOL COMBINING STEM - if (0x1d165 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - // Mc MUSICAL SYMBOL COMBINING SPRECHGESANG STEM - if (0x1d166 === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - } - } - else { - if (code < 0x1d185) { - if (code < 0x1d16e) { - if (code < 0x1d16d) { - // Mn [3] MUSICAL SYMBOL COMBINING TREMOLO-1..MUSICAL SYMBOL COMBINING TREMOLO-3 - if (0x1d167 <= code && code <= 0x1d169) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mc MUSICAL SYMBOL COMBINING AUGMENTATION DOT - if (0x1d16d === code) { - return boundaries_1.CLUSTER_BREAK.SPACINGMARK; - } - } - } - else { - if (code < 0x1d173) { - // Mc [5] MUSICAL SYMBOL COMBINING FLAG-1..MUSICAL SYMBOL COMBINING FLAG-5 - if (0x1d16e <= code && code <= 0x1d172) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1d17b) { - // Cf [8] MUSICAL SYMBOL BEGIN BEAM..MUSICAL SYMBOL END PHRASE - if (0x1d173 <= code && code <= 0x1d17a) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - // Mn [8] MUSICAL SYMBOL COMBINING ACCENT..MUSICAL SYMBOL COMBINING LOURE - if (0x1d17b <= code && code <= 0x1d182) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x1da00) { - if (code < 0x1d1aa) { - // Mn [7] MUSICAL SYMBOL COMBINING DOIT..MUSICAL SYMBOL COMBINING TRIPLE TONGUE - if (0x1d185 <= code && code <= 0x1d18b) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1d242) { - // Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO - if (0x1d1aa <= code && code <= 0x1d1ad) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [3] COMBINING GREEK MUSICAL TRISEME..COMBINING GREEK MUSICAL PENTASEME - if (0x1d242 <= code && code <= 0x1d244) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x1da3b) { - // Mn [55] SIGNWRITING HEAD RIM..SIGNWRITING AIR SUCKING IN - if (0x1da00 <= code && code <= 0x1da36) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1da75) { - // Mn [50] SIGNWRITING MOUTH CLOSED NEUTRAL..SIGNWRITING EXCITEMENT - if (0x1da3b <= code && code <= 0x1da6c) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn SIGNWRITING UPPER BODY TILTING FROM HIP JOINTS - if (0x1da75 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - } - else { - if (code < 0x1e2ec) { - if (code < 0x1e01b) { - if (code < 0x1daa1) { - if (code < 0x1da9b) { - // Mn SIGNWRITING LOCATION HEAD NECK - if (0x1da84 === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [5] SIGNWRITING FILL MODIFIER-2..SIGNWRITING FILL MODIFIER-6 - if (0x1da9b <= code && code <= 0x1da9f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x1e000) { - // Mn [15] SIGNWRITING ROTATION MODIFIER-2..SIGNWRITING ROTATION MODIFIER-16 - if (0x1daa1 <= code && code <= 0x1daaf) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1e008) { - // Mn [7] COMBINING GLAGOLITIC LETTER AZU..COMBINING GLAGOLITIC LETTER ZHIVETE - if (0x1e000 <= code && code <= 0x1e006) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [17] COMBINING GLAGOLITIC LETTER ZEMLJA..COMBINING GLAGOLITIC LETTER HERU - if (0x1e008 <= code && code <= 0x1e018) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - else { - if (code < 0x1e08f) { - if (code < 0x1e023) { - // Mn [7] COMBINING GLAGOLITIC LETTER SHTA..COMBINING GLAGOLITIC LETTER YATI - if (0x1e01b <= code && code <= 0x1e021) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1e026) { - // Mn [2] COMBINING GLAGOLITIC LETTER YU..COMBINING GLAGOLITIC LETTER SMALL YUS - if (0x1e023 <= code && code <= 0x1e024) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [5] COMBINING GLAGOLITIC LETTER YO..COMBINING GLAGOLITIC LETTER FITA - if (0x1e026 <= code && code <= 0x1e02a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0x1e130) { - // Mn COMBINING CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - if (0x1e08f === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1e2ae) { - // Mn [7] NYIAKENG PUACHUE HMONG TONE-B..NYIAKENG PUACHUE HMONG TONE-D - if (0x1e130 <= code && code <= 0x1e136) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn TOTO SIGN RISING TONE - if (0x1e2ae === code) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - } - } - else { - if (code < 0x1f3fb) { - if (code < 0x1e8d0) { - if (code < 0x1e4ec) { - // Mn [4] WANCHO TONE TUP..WANCHO TONE KOINI - if (0x1e2ec <= code && code <= 0x1e2ef) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Mn [4] NAG MUNDARI SIGN MUHOR..NAG MUNDARI SIGN SUTUH - if (0x1e4ec <= code && code <= 0x1e4ef) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - else { - if (code < 0x1e944) { - // Mn [7] MENDE KIKAKUI COMBINING NUMBER TEENS..MENDE KIKAKUI COMBINING NUMBER MILLIONS - if (0x1e8d0 <= code && code <= 0x1e8d6) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0x1f1e6) { - // Mn [7] ADLAM ALIF LENGTHENER..ADLAM NUKTA - if (0x1e944 <= code && code <= 0x1e94a) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // So [26] REGIONAL INDICATOR SYMBOL LETTER A..REGIONAL INDICATOR SYMBOL LETTER Z - if (0x1f1e6 <= code && code <= 0x1f1ff) { - return boundaries_1.CLUSTER_BREAK.REGIONAL_INDICATOR; - } - } - } - } - } - else { - if (code < 0xe0080) { - if (code < 0xe0000) { - // Sk [5] EMOJI MODIFIER FITZPATRICK TYPE-1-2..EMOJI MODIFIER FITZPATRICK TYPE-6 - if (0x1f3fb <= code && code <= 0x1f3ff) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - if (code < 0xe0020) { - // Cn - // Cf LANGUAGE TAG - // Cn [30] .. - if (0xe0000 <= code && code <= 0xe001f) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - // Cf [96] TAG SPACE..CANCEL TAG - if (0xe0020 <= code && code <= 0xe007f) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - } - } - else { - if (code < 0xe0100) { - // Cn [128] .. - if (0xe0080 <= code && code <= 0xe00ff) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - else { - if (code < 0xe01f0) { - // Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256 - if (0xe0100 <= code && code <= 0xe01ef) { - return boundaries_1.CLUSTER_BREAK.EXTEND; - } - } - else { - // Cn [3600] .. - if (0xe01f0 <= code && code <= 0xe0fff) { - return boundaries_1.CLUSTER_BREAK.CONTROL; - } - } - } - } - } - } - } - } - } - } - } - } - // unlisted code points are treated as a break property of "Other" - return boundaries_1.CLUSTER_BREAK.OTHER; - } - /** - * Given a Unicode code point, returns if symbol is an extended pictographic or some other break - * @param code {number} Unicode code point - * @returns {number} - */ - static getEmojiProperty(code) { - // emoji property taken from: - // https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt - // and generated by - // node ./scripts/generate-emoji-extended-pictographic.js - if (code < 0x27b0) { - if (code < 0x2600) { - if (code < 0x2328) { - if (code < 0x2122) { - if (code < 0x203c) { - // E0.6 [1] (©️) copyright - if (0xa9 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E0.6 [1] (®️) registered - if (0xae === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [1] (‼️) double exclamation mark - if (0x203c === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E0.6 [1] (⁉️) exclamation question mark - if (0x2049 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x2194) { - // E0.6 [1] (™️) trade mark - if (0x2122 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E0.6 [1] (ℹ️) information - if (0x2139 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x21a9) { - // E0.6 [6] (↔️..↙️) left-right arrow..down-left arrow - if (0x2194 <= code && code <= 0x2199) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x231a) { - // E0.6 [2] (↩️..↪️) right arrow curving left..left arrow curving right - if (0x21a9 <= code && code <= 0x21aa) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [2] (⌚..⌛) watch..hourglass done - if (0x231a <= code && code <= 0x231b) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - } - else { - if (code < 0x24c2) { - if (code < 0x23cf) { - // E1.0 [1] (⌨️) keyboard - if (0x2328 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E0.0 [1] (⎈) HELM SYMBOL - if (0x2388 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x23e9) { - // E1.0 [1] (⏏️) eject button - if (0x23cf === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x23f8) { - // E0.6 [4] (⏩..⏬) fast-forward button..fast down button - // E0.7 [2] (⏭️..⏮️) next track button..last track button - // E1.0 [1] (⏯️) play or pause button - // E0.6 [1] (⏰) alarm clock - // E1.0 [2] (⏱️..⏲️) stopwatch..timer clock - // E0.6 [1] (⏳) hourglass not done - if (0x23e9 <= code && code <= 0x23f3) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.7 [3] (⏸️..⏺️) pause button..record button - if (0x23f8 <= code && code <= 0x23fa) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - else { - if (code < 0x25b6) { - if (code < 0x25aa) { - // E0.6 [1] (Ⓜ️) circled M - if (0x24c2 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [2] (▪️..▫️) black small square..white small square - if (0x25aa <= code && code <= 0x25ab) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x25c0) { - // E0.6 [1] (▶️) play button - if (0x25b6 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x25fb) { - // E0.6 [1] (◀️) reverse button - if (0x25c0 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [4] (◻️..◾) white medium square..black medium-small square - if (0x25fb <= code && code <= 0x25fe) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - } - } - else { - if (code < 0x2733) { - if (code < 0x2714) { - if (code < 0x2614) { - if (code < 0x2607) { - // E0.6 [2] (☀️..☁️) sun..cloud - // E0.7 [2] (☂️..☃️) umbrella..snowman - // E1.0 [1] (☄️) comet - // E0.0 [1] (★) BLACK STAR - if (0x2600 <= code && code <= 0x2605) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.0 [7] (☇..☍) LIGHTNING..OPPOSITION - // E0.6 [1] (☎️) telephone - // E0.0 [2] (☏..☐) WHITE TELEPHONE..BALLOT BOX - // E0.6 [1] (☑️) check box with check - // E0.0 [1] (☒) BALLOT BOX WITH X - if (0x2607 <= code && code <= 0x2612) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x2690) { - // E0.6 [2] (☔..☕) umbrella with rain drops..hot beverage - // E0.0 [2] (☖..☗) WHITE SHOGI PIECE..BLACK SHOGI PIECE - // E1.0 [1] (☘️) shamrock - // E0.0 [4] (☙..☜) REVERSED ROTATED FLORAL HEART BULLET..WHITE LEFT POINTING INDEX - // E0.6 [1] (☝️) index pointing up - // E0.0 [2] (☞..☟) WHITE RIGHT POINTING INDEX..WHITE DOWN POINTING INDEX - // E1.0 [1] (☠️) skull and crossbones - // E0.0 [1] (☡) CAUTION SIGN - // E1.0 [2] (☢️..☣️) radioactive..biohazard - // E0.0 [2] (☤..☥) CADUCEUS..ANKH - // E1.0 [1] (☦️) orthodox cross - // E0.0 [3] (☧..☩) CHI RHO..CROSS OF JERUSALEM - // E0.7 [1] (☪️) star and crescent - // E0.0 [3] (☫..☭) FARSI SYMBOL..HAMMER AND SICKLE - // E1.0 [1] (☮️) peace symbol - // E0.7 [1] (☯️) yin yang - // E0.0 [8] (☰..☷) TRIGRAM FOR HEAVEN..TRIGRAM FOR EARTH - // E0.7 [2] (☸️..☹️) wheel of dharma..frowning face - // E0.6 [1] (☺️) smiling face - // E0.0 [5] (☻..☿) BLACK SMILING FACE..MERCURY - // E4.0 [1] (♀️) female sign - // E0.0 [1] (♁) EARTH - // E4.0 [1] (♂️) male sign - // E0.0 [5] (♃..♇) JUPITER..PLUTO - // E0.6 [12] (♈..♓) Aries..Pisces - // E0.0 [11] (♔..♞) WHITE CHESS KING..BLACK CHESS KNIGHT - // E11.0 [1] (♟️) chess pawn - // E0.6 [1] (♠️) spade suit - // E0.0 [2] (♡..♢) WHITE HEART SUIT..WHITE DIAMOND SUIT - // E0.6 [1] (♣️) club suit - // E0.0 [1] (♤) WHITE SPADE SUIT - // E0.6 [2] (♥️..♦️) heart suit..diamond suit - // E0.0 [1] (♧) WHITE CLUB SUIT - // E0.6 [1] (♨️) hot springs - // E0.0 [18] (♩..♺) QUARTER NOTE..RECYCLING SYMBOL FOR GENERIC MATERIALS - // E0.6 [1] (♻️) recycling symbol - // E0.0 [2] (♼..♽) RECYCLED PAPER SYMBOL..PARTIALLY-RECYCLED PAPER SYMBOL - // E11.0 [1] (♾️) infinity - // E0.6 [1] (♿) wheelchair symbol - // E0.0 [6] (⚀..⚅) DIE FACE-1..DIE FACE-6 - if (0x2614 <= code && code <= 0x2685) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x2708) { - // E0.0 [2] (⚐..⚑) WHITE FLAG..BLACK FLAG - // E1.0 [1] (⚒️) hammer and pick - // E0.6 [1] (⚓) anchor - // E1.0 [1] (⚔️) crossed swords - // E4.0 [1] (⚕️) medical symbol - // E1.0 [2] (⚖️..⚗️) balance scale..alembic - // E0.0 [1] (⚘) FLOWER - // E1.0 [1] (⚙️) gear - // E0.0 [1] (⚚) STAFF OF HERMES - // E1.0 [2] (⚛️..⚜️) atom symbol..fleur-de-lis - // E0.0 [3] (⚝..⚟) OUTLINED WHITE STAR..THREE LINES CONVERGING LEFT - // E0.6 [2] (⚠️..⚡) warning..high voltage - // E0.0 [5] (⚢..⚦) DOUBLED FEMALE SIGN..MALE WITH STROKE SIGN - // E13.0 [1] (⚧️) transgender symbol - // E0.0 [2] (⚨..⚩) VERTICAL MALE WITH STROKE SIGN..HORIZONTAL MALE WITH STROKE SIGN - // E0.6 [2] (⚪..⚫) white circle..black circle - // E0.0 [4] (⚬..⚯) MEDIUM SMALL WHITE CIRCLE..UNMARRIED PARTNERSHIP SYMBOL - // E1.0 [2] (⚰️..⚱️) coffin..funeral urn - // E0.0 [11] (⚲..⚼) NEUTER..SESQUIQUADRATE - // E0.6 [2] (⚽..⚾) soccer ball..baseball - // E0.0 [5] (⚿..⛃) SQUARED KEY..BLACK DRAUGHTS KING - // E0.6 [2] (⛄..⛅) snowman without snow..sun behind cloud - // E0.0 [2] (⛆..⛇) RAIN..BLACK SNOWMAN - // E0.7 [1] (⛈️) cloud with lightning and rain - // E0.0 [5] (⛉..⛍) TURNED WHITE SHOGI PIECE..DISABLED CAR - // E0.6 [1] (⛎) Ophiuchus - // E0.7 [1] (⛏️) pick - // E0.0 [1] (⛐) CAR SLIDING - // E0.7 [1] (⛑️) rescue worker’s helmet - // E0.0 [1] (⛒) CIRCLED CROSSING LANES - // E0.7 [1] (⛓️) chains - // E0.6 [1] (⛔) no entry - // E0.0 [20] (⛕..⛨) ALTERNATE ONE-WAY LEFT WAY TRAFFIC..BLACK CROSS ON SHIELD - // E0.7 [1] (⛩️) shinto shrine - // E0.6 [1] (⛪) church - // E0.0 [5] (⛫..⛯) CASTLE..MAP SYMBOL FOR LIGHTHOUSE - // E0.7 [2] (⛰️..⛱️) mountain..umbrella on ground - // E0.6 [2] (⛲..⛳) fountain..flag in hole - // E0.7 [1] (⛴️) ferry - // E0.6 [1] (⛵) sailboat - // E0.0 [1] (⛶) SQUARE FOUR CORNERS - // E0.7 [3] (⛷️..⛹️) skier..person bouncing ball - // E0.6 [1] (⛺) tent - // E0.0 [2] (⛻..⛼) JAPANESE BANK SYMBOL..HEADSTONE GRAVEYARD SYMBOL - // E0.6 [1] (⛽) fuel pump - // E0.0 [4] (⛾..✁) CUP ON BLACK SQUARE..UPPER BLADE SCISSORS - // E0.6 [1] (✂️) scissors - // E0.0 [2] (✃..✄) LOWER BLADE SCISSORS..WHITE SCISSORS - // E0.6 [1] (✅) check mark button - if (0x2690 <= code && code <= 0x2705) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [5] (✈️..✌️) airplane..victory hand - // E0.7 [1] (✍️) writing hand - // E0.0 [1] (✎) LOWER RIGHT PENCIL - // E0.6 [1] (✏️) pencil - // E0.0 [2] (✐..✑) UPPER RIGHT PENCIL..WHITE NIB - // E0.6 [1] (✒️) black nib - if (0x2708 <= code && code <= 0x2712) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - else { - if (code < 0x271d) { - // E0.6 [1] (✔️) check mark - if (0x2714 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E0.6 [1] (✖️) multiply - if (0x2716 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x2721) { - // E0.7 [1] (✝️) latin cross - if (0x271d === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.7 [1] (✡️) star of David - if (0x2721 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E0.6 [1] (✨) sparkles - if (0x2728 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - else { - if (code < 0x2753) { - if (code < 0x2747) { - if (code < 0x2744) { - // E0.6 [2] (✳️..✴️) eight-spoked asterisk..eight-pointed star - if (0x2733 <= code && code <= 0x2734) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [1] (❄️) snowflake - if (0x2744 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x274c) { - // E0.6 [1] (❇️) sparkle - if (0x2747 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [1] (❌) cross mark - if (0x274c === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E0.6 [1] (❎) cross mark button - if (0x274e === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - else { - if (code < 0x2763) { - if (code < 0x2757) { - // E0.6 [3] (❓..❕) red question mark..white exclamation mark - if (0x2753 <= code && code <= 0x2755) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [1] (❗) red exclamation mark - if (0x2757 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x2795) { - // E1.0 [1] (❣️) heart exclamation - // E0.6 [1] (❤️) red heart - // E0.0 [3] (❥..❧) ROTATED HEAVY BLACK HEART BULLET..ROTATED FLORAL HEART BULLET - if (0x2763 <= code && code <= 0x2767) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x27a1) { - // E0.6 [3] (➕..➗) plus..divide - if (0x2795 <= code && code <= 0x2797) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [1] (➡️) right arrow - if (0x27a1 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - } - } - } - else { - if (code < 0x1f201) { - if (code < 0x3297) { - if (code < 0x2b1b) { - if (code < 0x2934) { - // E0.6 [1] (➰) curly loop - if (0x27b0 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E1.0 [1] (➿) double curly loop - if (0x27bf === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x2b05) { - // E0.6 [2] (⤴️..⤵️) right arrow curving up..right arrow curving down - if (0x2934 <= code && code <= 0x2935) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [3] (⬅️..⬇️) left arrow..down arrow - if (0x2b05 <= code && code <= 0x2b07) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - else { - if (code < 0x2b55) { - if (code < 0x2b50) { - // E0.6 [2] (⬛..⬜) black large square..white large square - if (0x2b1b <= code && code <= 0x2b1c) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [1] (⭐) star - if (0x2b50 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x3030) { - // E0.6 [1] (⭕) hollow red circle - if (0x2b55 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [1] (〰️) wavy dash - if (0x3030 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E0.6 [1] (〽️) part alternation mark - if (0x303d === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - else { - if (code < 0x1f16c) { - if (code < 0x1f000) { - // E0.6 [1] (㊗️) Japanese “congratulations” button - if (0x3297 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - // E0.6 [1] (㊙️) Japanese “secret” button - if (0x3299 === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x1f10d) { - // E0.0 [4] (🀀..🀃) MAHJONG TILE EAST WIND..MAHJONG TILE NORTH WIND - // E0.6 [1] (🀄) mahjong red dragon - // E0.0 [202] (🀅..🃎) MAHJONG TILE GREEN DRAGON..PLAYING CARD KING OF DIAMONDS - // E0.6 [1] (🃏) joker - // E0.0 [48] (🃐..🃿) .. - if (0x1f000 <= code && code <= 0x1f0ff) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x1f12f) { - // E0.0 [3] (🄍..🄏) CIRCLED ZERO WITH SLASH..CIRCLED DOLLAR SIGN WITH OVERLAID BACKSLASH - if (0x1f10d <= code && code <= 0x1f10f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.0 [1] (🄯) COPYLEFT SYMBOL - if (0x1f12f === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - else { - if (code < 0x1f18e) { - if (code < 0x1f17e) { - // E0.0 [4] (🅬..🅯) RAISED MR SIGN..CIRCLED HUMAN FIGURE - // E0.6 [2] (🅰️..🅱️) A button (blood type)..B button (blood type) - if (0x1f16c <= code && code <= 0x1f171) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [2] (🅾️..🅿️) O button (blood type)..P button - if (0x1f17e <= code && code <= 0x1f17f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x1f191) { - // E0.6 [1] (🆎) AB button (blood type) - if (0x1f18e === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x1f1ad) { - // E0.6 [10] (🆑..🆚) CL button..VS button - if (0x1f191 <= code && code <= 0x1f19a) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.0 [57] (🆭..🇥) MASK WORK SYMBOL.. - if (0x1f1ad <= code && code <= 0x1f1e5) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - } - } - else { - if (code < 0x1f7d5) { - if (code < 0x1f249) { - if (code < 0x1f22f) { - if (code < 0x1f21a) { - // E0.6 [2] (🈁..🈂️) Japanese “here” button..Japanese “service charge” button - // E0.0 [13] (🈃..🈏) .. - if (0x1f201 <= code && code <= 0x1f20f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.6 [1] (🈚) Japanese “free of charge” button - if (0x1f21a === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x1f232) { - // E0.6 [1] (🈯) Japanese “reserved” button - if (0x1f22f === code) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x1f23c) { - // E0.6 [9] (🈲..🈺) Japanese “prohibited” button..Japanese “open for business” button - if (0x1f232 <= code && code <= 0x1f23a) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.0 [4] (🈼..🈿) .. - if (0x1f23c <= code && code <= 0x1f23f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - else { - if (code < 0x1f546) { - if (code < 0x1f400) { - // E0.0 [7] (🉉..🉏) .. - // E0.6 [2] (🉐..🉑) Japanese “bargain” button..Japanese “acceptable” button - // E0.0 [174] (🉒..🋿) .. - // E0.6 [13] (🌀..🌌) cyclone..milky way - // E0.7 [2] (🌍..🌎) globe showing Europe-Africa..globe showing Americas - // E0.6 [1] (🌏) globe showing Asia-Australia - // E1.0 [1] (🌐) globe with meridians - // E0.6 [1] (🌑) new moon - // E1.0 [1] (🌒) waxing crescent moon - // E0.6 [3] (🌓..🌕) first quarter moon..full moon - // E1.0 [3] (🌖..🌘) waning gibbous moon..waning crescent moon - // E0.6 [1] (🌙) crescent moon - // E1.0 [1] (🌚) new moon face - // E0.6 [1] (🌛) first quarter moon face - // E0.7 [1] (🌜) last quarter moon face - // E1.0 [2] (🌝..🌞) full moon face..sun with face - // E0.6 [2] (🌟..🌠) glowing star..shooting star - // E0.7 [1] (🌡️) thermometer - // E0.0 [2] (🌢..🌣) BLACK DROPLET..WHITE SUN - // E0.7 [9] (🌤️..🌬️) sun behind small cloud..wind face - // E1.0 [3] (🌭..🌯) hot dog..burrito - // E0.6 [2] (🌰..🌱) chestnut..seedling - // E1.0 [2] (🌲..🌳) evergreen tree..deciduous tree - // E0.6 [2] (🌴..🌵) palm tree..cactus - // E0.7 [1] (🌶️) hot pepper - // E0.6 [20] (🌷..🍊) tulip..tangerine - // E1.0 [1] (🍋) lemon - // E0.6 [4] (🍌..🍏) banana..green apple - // E1.0 [1] (🍐) pear - // E0.6 [43] (🍑..🍻) peach..clinking beer mugs - // E1.0 [1] (🍼) baby bottle - // E0.7 [1] (🍽️) fork and knife with plate - // E1.0 [2] (🍾..🍿) bottle with popping cork..popcorn - // E0.6 [20] (🎀..🎓) ribbon..graduation cap - // E0.0 [2] (🎔..🎕) HEART WITH TIP ON THE LEFT..BOUQUET OF FLOWERS - // E0.7 [2] (🎖️..🎗️) military medal..reminder ribbon - // E0.0 [1] (🎘) MUSICAL KEYBOARD WITH JACKS - // E0.7 [3] (🎙️..🎛️) studio microphone..control knobs - // E0.0 [2] (🎜..🎝) BEAMED ASCENDING MUSICAL NOTES..BEAMED DESCENDING MUSICAL NOTES - // E0.7 [2] (🎞️..🎟️) film frames..admission tickets - // E0.6 [37] (🎠..🏄) carousel horse..person surfing - // E1.0 [1] (🏅) sports medal - // E0.6 [1] (🏆) trophy - // E1.0 [1] (🏇) horse racing - // E0.6 [1] (🏈) american football - // E1.0 [1] (🏉) rugby football - // E0.6 [1] (🏊) person swimming - // E0.7 [4] (🏋️..🏎️) person lifting weights..racing car - // E1.0 [5] (🏏..🏓) cricket game..ping pong - // E0.7 [12] (🏔️..🏟️) snow-capped mountain..stadium - // E0.6 [4] (🏠..🏣) house..Japanese post office - // E1.0 [1] (🏤) post office - // E0.6 [12] (🏥..🏰) hospital..castle - // E0.0 [2] (🏱..🏲) WHITE PENNANT..BLACK PENNANT - // E0.7 [1] (🏳️) white flag - // E1.0 [1] (🏴) black flag - // E0.7 [1] (🏵️) rosette - // E0.0 [1] (🏶) BLACK ROSETTE - // E0.7 [1] (🏷️) label - // E1.0 [3] (🏸..🏺) badminton..amphora - if (0x1f249 <= code && code <= 0x1f3fa) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E1.0 [8] (🐀..🐇) rat..rabbit - // E0.7 [1] (🐈) cat - // E1.0 [3] (🐉..🐋) dragon..whale - // E0.6 [3] (🐌..🐎) snail..horse - // E1.0 [2] (🐏..🐐) ram..goat - // E0.6 [2] (🐑..🐒) ewe..monkey - // E1.0 [1] (🐓) rooster - // E0.6 [1] (🐔) chicken - // E0.7 [1] (🐕) dog - // E1.0 [1] (🐖) pig - // E0.6 [19] (🐗..🐩) boar..poodle - // E1.0 [1] (🐪) camel - // E0.6 [20] (🐫..🐾) two-hump camel..paw prints - // E0.7 [1] (🐿️) chipmunk - // E0.6 [1] (👀) eyes - // E0.7 [1] (👁️) eye - // E0.6 [35] (👂..👤) ear..bust in silhouette - // E1.0 [1] (👥) busts in silhouette - // E0.6 [6] (👦..👫) boy..woman and man holding hands - // E1.0 [2] (👬..👭) men holding hands..women holding hands - // E0.6 [63] (👮..💬) police officer..speech balloon - // E1.0 [1] (💭) thought balloon - // E0.6 [8] (💮..💵) white flower..dollar banknote - // E1.0 [2] (💶..💷) euro banknote..pound banknote - // E0.6 [52] (💸..📫) money with wings..closed mailbox with raised flag - // E0.7 [2] (📬..📭) open mailbox with raised flag..open mailbox with lowered flag - // E0.6 [1] (📮) postbox - // E1.0 [1] (📯) postal horn - // E0.6 [5] (📰..📴) newspaper..mobile phone off - // E1.0 [1] (📵) no mobile phones - // E0.6 [2] (📶..📷) antenna bars..camera - // E1.0 [1] (📸) camera with flash - // E0.6 [4] (📹..📼) video camera..videocassette - // E0.7 [1] (📽️) film projector - // E0.0 [1] (📾) PORTABLE STEREO - // E1.0 [4] (📿..🔂) prayer beads..repeat single button - // E0.6 [1] (🔃) clockwise vertical arrows - // E1.0 [4] (🔄..🔇) counterclockwise arrows button..muted speaker - // E0.7 [1] (🔈) speaker low volume - // E1.0 [1] (🔉) speaker medium volume - // E0.6 [11] (🔊..🔔) speaker high volume..bell - // E1.0 [1] (🔕) bell with slash - // E0.6 [22] (🔖..🔫) bookmark..water pistol - // E1.0 [2] (🔬..🔭) microscope..telescope - // E0.6 [16] (🔮..🔽) crystal ball..downwards button - if (0x1f400 <= code && code <= 0x1f53d) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x1f680) { - // E0.0 [3] (🕆..🕈) WHITE LATIN CROSS..CELTIC CROSS - // E0.7 [2] (🕉️..🕊️) om..dove - // E1.0 [4] (🕋..🕎) kaaba..menorah - // E0.0 [1] (🕏) BOWL OF HYGIEIA - // E0.6 [12] (🕐..🕛) one o’clock..twelve o’clock - // E0.7 [12] (🕜..🕧) one-thirty..twelve-thirty - // E0.0 [7] (🕨..🕮) RIGHT SPEAKER..BOOK - // E0.7 [2] (🕯️..🕰️) candle..mantelpiece clock - // E0.0 [2] (🕱..🕲) BLACK SKULL AND CROSSBONES..NO PIRACY - // E0.7 [7] (🕳️..🕹️) hole..joystick - // E3.0 [1] (🕺) man dancing - // E0.0 [12] (🕻..🖆) LEFT HAND TELEPHONE RECEIVER..PEN OVER STAMPED ENVELOPE - // E0.7 [1] (🖇️) linked paperclips - // E0.0 [2] (🖈..🖉) BLACK PUSHPIN..LOWER LEFT PENCIL - // E0.7 [4] (🖊️..🖍️) pen..crayon - // E0.0 [2] (🖎..🖏) LEFT WRITING HAND..TURNED OK HAND SIGN - // E0.7 [1] (🖐️) hand with fingers splayed - // E0.0 [4] (🖑..🖔) REVERSED RAISED HAND WITH FINGERS SPLAYED..REVERSED VICTORY HAND - // E1.0 [2] (🖕..🖖) middle finger..vulcan salute - // E0.0 [13] (🖗..🖣) WHITE DOWN POINTING LEFT HAND INDEX..BLACK DOWN POINTING BACKHAND INDEX - // E3.0 [1] (🖤) black heart - // E0.7 [1] (🖥️) desktop computer - // E0.0 [2] (🖦..🖧) KEYBOARD AND MOUSE..THREE NETWORKED COMPUTERS - // E0.7 [1] (🖨️) printer - // E0.0 [8] (🖩..🖰) POCKET CALCULATOR..TWO BUTTON MOUSE - // E0.7 [2] (🖱️..🖲️) computer mouse..trackball - // E0.0 [9] (🖳..🖻) OLD PERSONAL COMPUTER..DOCUMENT WITH PICTURE - // E0.7 [1] (🖼️) framed picture - // E0.0 [5] (🖽..🗁) FRAME WITH TILES..OPEN FOLDER - // E0.7 [3] (🗂️..🗄️) card index dividers..file cabinet - // E0.0 [12] (🗅..🗐) EMPTY NOTE..PAGES - // E0.7 [3] (🗑️..🗓️) wastebasket..spiral calendar - // E0.0 [8] (🗔..🗛) DESKTOP WINDOW..DECREASE FONT SIZE SYMBOL - // E0.7 [3] (🗜️..🗞️) clamp..rolled-up newspaper - // E0.0 [2] (🗟..🗠) PAGE WITH CIRCLED TEXT..STOCK CHART - // E0.7 [1] (🗡️) dagger - // E0.0 [1] (🗢) LIPS - // E0.7 [1] (🗣️) speaking head - // E0.0 [4] (🗤..🗧) THREE RAYS ABOVE..THREE RAYS RIGHT - // E2.0 [1] (🗨️) left speech bubble - // E0.0 [6] (🗩..🗮) RIGHT SPEECH BUBBLE..LEFT ANGER BUBBLE - // E0.7 [1] (🗯️) right anger bubble - // E0.0 [3] (🗰..🗲) MOOD BUBBLE..LIGHTNING MOOD - // E0.7 [1] (🗳️) ballot box with ballot - // E0.0 [6] (🗴..🗹) BALLOT SCRIPT X..BALLOT BOX WITH BOLD CHECK - // E0.7 [1] (🗺️) world map - // E0.6 [5] (🗻..🗿) mount fuji..moai - // E1.0 [1] (😀) grinning face - // E0.6 [6] (😁..😆) beaming face with smiling eyes..grinning squinting face - // E1.0 [2] (😇..😈) smiling face with halo..smiling face with horns - // E0.6 [5] (😉..😍) winking face..smiling face with heart-eyes - // E1.0 [1] (😎) smiling face with sunglasses - // E0.6 [1] (😏) smirking face - // E0.7 [1] (😐) neutral face - // E1.0 [1] (😑) expressionless face - // E0.6 [3] (😒..😔) unamused face..pensive face - // E1.0 [1] (😕) confused face - // E0.6 [1] (😖) confounded face - // E1.0 [1] (😗) kissing face - // E0.6 [1] (😘) face blowing a kiss - // E1.0 [1] (😙) kissing face with smiling eyes - // E0.6 [1] (😚) kissing face with closed eyes - // E1.0 [1] (😛) face with tongue - // E0.6 [3] (😜..😞) winking face with tongue..disappointed face - // E1.0 [1] (😟) worried face - // E0.6 [6] (😠..😥) angry face..sad but relieved face - // E1.0 [2] (😦..😧) frowning face with open mouth..anguished face - // E0.6 [4] (😨..😫) fearful face..tired face - // E1.0 [1] (😬) grimacing face - // E0.6 [1] (😭) loudly crying face - // E1.0 [2] (😮..😯) face with open mouth..hushed face - // E0.6 [4] (😰..😳) anxious face with sweat..flushed face - // E1.0 [1] (😴) sleeping face - // E0.6 [1] (😵) face with crossed-out eyes - // E1.0 [1] (😶) face without mouth - // E0.6 [10] (😷..🙀) face with medical mask..weary cat - // E1.0 [4] (🙁..🙄) slightly frowning face..face with rolling eyes - // E0.6 [11] (🙅..🙏) person gesturing NO..folded hands - if (0x1f546 <= code && code <= 0x1f64f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x1f774) { - // E0.6 [1] (🚀) rocket - // E1.0 [2] (🚁..🚂) helicopter..locomotive - // E0.6 [3] (🚃..🚅) railway car..bullet train - // E1.0 [1] (🚆) train - // E0.6 [1] (🚇) metro - // E1.0 [1] (🚈) light rail - // E0.6 [1] (🚉) station - // E1.0 [2] (🚊..🚋) tram..tram car - // E0.6 [1] (🚌) bus - // E0.7 [1] (🚍) oncoming bus - // E1.0 [1] (🚎) trolleybus - // E0.6 [1] (🚏) bus stop - // E1.0 [1] (🚐) minibus - // E0.6 [3] (🚑..🚓) ambulance..police car - // E0.7 [1] (🚔) oncoming police car - // E0.6 [1] (🚕) taxi - // E1.0 [1] (🚖) oncoming taxi - // E0.6 [1] (🚗) automobile - // E0.7 [1] (🚘) oncoming automobile - // E0.6 [2] (🚙..🚚) sport utility vehicle..delivery truck - // E1.0 [7] (🚛..🚡) articulated lorry..aerial tramway - // E0.6 [1] (🚢) ship - // E1.0 [1] (🚣) person rowing boat - // E0.6 [2] (🚤..🚥) speedboat..horizontal traffic light - // E1.0 [1] (🚦) vertical traffic light - // E0.6 [7] (🚧..🚭) construction..no smoking - // E1.0 [4] (🚮..🚱) litter in bin sign..non-potable water - // E0.6 [1] (🚲) bicycle - // E1.0 [3] (🚳..🚵) no bicycles..person mountain biking - // E0.6 [1] (🚶) person walking - // E1.0 [2] (🚷..🚸) no pedestrians..children crossing - // E0.6 [6] (🚹..🚾) men’s room..water closet - // E1.0 [1] (🚿) shower - // E0.6 [1] (🛀) person taking bath - // E1.0 [5] (🛁..🛅) bathtub..left luggage - // E0.0 [5] (🛆..🛊) TRIANGLE WITH ROUNDED CORNERS..GIRLS SYMBOL - // E0.7 [1] (🛋️) couch and lamp - // E1.0 [1] (🛌) person in bed - // E0.7 [3] (🛍️..🛏️) shopping bags..bed - // E1.0 [1] (🛐) place of worship - // E3.0 [2] (🛑..🛒) stop sign..shopping cart - // E0.0 [2] (🛓..🛔) STUPA..PAGODA - // E12.0 [1] (🛕) hindu temple - // E13.0 [2] (🛖..🛗) hut..elevator - // E0.0 [4] (🛘..🛛) .. - // E15.0 [1] (🛜) wireless - // E14.0 [3] (🛝..🛟) playground slide..ring buoy - // E0.7 [6] (🛠️..🛥️) hammer and wrench..motor boat - // E0.0 [3] (🛦..🛨) UP-POINTING MILITARY AIRPLANE..UP-POINTING SMALL AIRPLANE - // E0.7 [1] (🛩️) small airplane - // E0.0 [1] (🛪) NORTHEAST-POINTING AIRPLANE - // E1.0 [2] (🛫..🛬) airplane departure..airplane arrival - // E0.0 [3] (🛭..🛯) .. - // E0.7 [1] (🛰️) satellite - // E0.0 [2] (🛱..🛲) ONCOMING FIRE ENGINE..DIESEL LOCOMOTIVE - // E0.7 [1] (🛳️) passenger ship - // E3.0 [3] (🛴..🛶) kick scooter..canoe - // E5.0 [2] (🛷..🛸) sled..flying saucer - // E11.0 [1] (🛹) skateboard - // E12.0 [1] (🛺) auto rickshaw - // E13.0 [2] (🛻..🛼) pickup truck..roller skate - // E0.0 [3] (🛽..🛿) .. - if (0x1f680 <= code && code <= 0x1f6ff) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.0 [12] (🝴..🝿) LOT OF FORTUNE..ORCUS - if (0x1f774 <= code && code <= 0x1f77f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - } - else { - if (code < 0x1f8ae) { - if (code < 0x1f848) { - if (code < 0x1f80c) { - // E0.0 [11] (🟕..🟟) CIRCLED TRIANGLE.. - // E12.0 [12] (🟠..🟫) orange circle..brown square - // E0.0 [4] (🟬..🟯) .. - // E14.0 [1] (🟰) heavy equals sign - // E0.0 [15] (🟱..🟿) .. - if (0x1f7d5 <= code && code <= 0x1f7ff) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.0 [4] (🠌..🠏) .. - if (0x1f80c <= code && code <= 0x1f80f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x1f85a) { - // E0.0 [8] (🡈..🡏) .. - if (0x1f848 <= code && code <= 0x1f84f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x1f888) { - // E0.0 [6] (🡚..🡟) .. - if (0x1f85a <= code && code <= 0x1f85f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.0 [8] (🢈..🢏) .. - if (0x1f888 <= code && code <= 0x1f88f) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - else { - if (code < 0x1f93c) { - if (code < 0x1f90c) { - // E0.0 [82] (🢮..🣿) .. - if (0x1f8ae <= code && code <= 0x1f8ff) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E13.0 [1] (🤌) pinched fingers - // E12.0 [3] (🤍..🤏) white heart..pinching hand - // E1.0 [9] (🤐..🤘) zipper-mouth face..sign of the horns - // E3.0 [6] (🤙..🤞) call me hand..crossed fingers - // E5.0 [1] (🤟) love-you gesture - // E3.0 [8] (🤠..🤧) cowboy hat face..sneezing face - // E5.0 [8] (🤨..🤯) face with raised eyebrow..exploding head - // E3.0 [1] (🤰) pregnant woman - // E5.0 [2] (🤱..🤲) breast-feeding..palms up together - // E3.0 [8] (🤳..🤺) selfie..person fencing - if (0x1f90c <= code && code <= 0x1f93a) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - else { - if (code < 0x1f947) { - // E3.0 [3] (🤼..🤾) people wrestling..person playing handball - // E12.0 [1] (🤿) diving mask - // E3.0 [6] (🥀..🥅) wilted flower..goal net - if (0x1f93c <= code && code <= 0x1f945) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - if (code < 0x1fc00) { - // E3.0 [5] (🥇..🥋) 1st place medal..martial arts uniform - // E5.0 [1] (🥌) curling stone - // E11.0 [3] (🥍..🥏) lacrosse..flying disc - // E3.0 [15] (🥐..🥞) croissant..pancakes - // E5.0 [13] (🥟..🥫) dumpling..canned food - // E11.0 [5] (🥬..🥰) leafy green..smiling face with hearts - // E12.0 [1] (🥱) yawning face - // E13.0 [1] (🥲) smiling face with tear - // E11.0 [4] (🥳..🥶) partying face..cold face - // E13.0 [2] (🥷..🥸) ninja..disguised face - // E14.0 [1] (🥹) face holding back tears - // E11.0 [1] (🥺) pleading face - // E12.0 [1] (🥻) sari - // E11.0 [4] (🥼..🥿) lab coat..flat shoe - // E1.0 [5] (🦀..🦄) crab..unicorn - // E3.0 [13] (🦅..🦑) eagle..squid - // E5.0 [6] (🦒..🦗) giraffe..cricket - // E11.0 [11] (🦘..🦢) kangaroo..swan - // E13.0 [2] (🦣..🦤) mammoth..dodo - // E12.0 [6] (🦥..🦪) sloth..oyster - // E13.0 [3] (🦫..🦭) beaver..seal - // E12.0 [2] (🦮..🦯) guide dog..white cane - // E11.0 [10] (🦰..🦹) red hair..supervillain - // E12.0 [6] (🦺..🦿) safety vest..mechanical leg - // E1.0 [1] (🧀) cheese wedge - // E11.0 [2] (🧁..🧂) cupcake..salt - // E12.0 [8] (🧃..🧊) beverage box..ice - // E13.0 [1] (🧋) bubble tea - // E14.0 [1] (🧌) troll - // E12.0 [3] (🧍..🧏) person standing..deaf person - // E5.0 [23] (🧐..🧦) face with monocle..socks - // E11.0 [25] (🧧..🧿) red envelope..nazar amulet - // E0.0 [112] (🨀..🩯) NEUTRAL CHESS KING.. - // E12.0 [4] (🩰..🩳) ballet shoes..shorts - // E13.0 [1] (🩴) thong sandal - // E15.0 [3] (🩵..🩷) light blue heart..pink heart - // E12.0 [3] (🩸..🩺) drop of blood..stethoscope - // E14.0 [2] (🩻..🩼) x-ray..crutch - // E0.0 [3] (🩽..🩿) .. - // E12.0 [3] (🪀..🪂) yo-yo..parachute - // E13.0 [4] (🪃..🪆) boomerang..nesting dolls - // E15.0 [2] (🪇..🪈) maracas..flute - // E0.0 [7] (🪉..🪏) .. - // E12.0 [6] (🪐..🪕) ringed planet..banjo - // E13.0 [19] (🪖..🪨) military helmet..rock - // E14.0 [4] (🪩..🪬) mirror ball..hamsa - // E15.0 [3] (🪭..🪯) folding hand fan..khanda - // E13.0 [7] (🪰..🪶) fly..feather - // E14.0 [4] (🪷..🪺) lotus..nest with eggs - // E15.0 [3] (🪻..🪽) hyacinth..wing - // E0.0 [1] (🪾) - // E15.0 [1] (🪿) goose - // E13.0 [3] (🫀..🫂) anatomical heart..people hugging - // E14.0 [3] (🫃..🫅) pregnant man..person with crown - // E0.0 [8] (🫆..🫍) .. - // E15.0 [2] (🫎..🫏) moose..donkey - // E13.0 [7] (🫐..🫖) blueberries..teapot - // E14.0 [3] (🫗..🫙) pouring liquid..jar - // E15.0 [2] (🫚..🫛) ginger root..pea pod - // E0.0 [4] (🫜..🫟) .. - // E14.0 [8] (🫠..🫧) melting face..bubbles - // E15.0 [1] (🫨) shaking face - // E0.0 [7] (🫩..🫯) .. - // E14.0 [7] (🫰..🫶) hand with index finger and thumb crossed..heart hands - // E15.0 [2] (🫷..🫸) leftwards pushing hand..rightwards pushing hand - // E0.0 [7] (🫹..🫿) .. - if (0x1f947 <= code && code <= 0x1faff) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - else { - // E0.0[1022] (🰀..🿽) .. - if (0x1fc00 <= code && code <= 0x1fffd) { - return boundaries_1.EXTENDED_PICTOGRAPHIC; - } - } - } - } - } - } - } - } - // unlisted code points are treated as a break property of "Other" - return boundaries_1.CLUSTER_BREAK.OTHER; - } -} -exports.default = Graphemer; diff --git a/node_modules/graphemer/lib/GraphemerHelper.d.ts b/node_modules/graphemer/lib/GraphemerHelper.d.ts deleted file mode 100644 index 64f6c35cb..000000000 --- a/node_modules/graphemer/lib/GraphemerHelper.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -declare class GraphemerHelper { - /** - * Check if the the character at the position {pos} of the string is surrogate - * @param str {string} - * @param pos {number} - * @returns {boolean} - */ - static isSurrogate(str: string, pos: number): boolean; - /** - * The String.prototype.codePointAt polyfill - * Private function, gets a Unicode code point from a JavaScript UTF-16 string - * handling surrogate pairs appropriately - * @param str {string} - * @param idx {number} - * @returns {number} - */ - static codePointAt(str: string, idx: number): number; - /** - * Private function, returns whether a break is allowed between the two given grapheme breaking classes - * Implemented the UAX #29 3.1.1 Grapheme Cluster Boundary Rules on extended grapheme clusters - * @param start {number} - * @param mid {Array} - * @param end {number} - * @param startEmoji {number} - * @param midEmoji {Array} - * @param endEmoji {number} - * @returns {number} - */ - static shouldBreak(start: number, mid: number[], end: number, startEmoji: number, midEmoji: number[], endEmoji: number): number; -} -export default GraphemerHelper; -//# sourceMappingURL=GraphemerHelper.d.ts.map \ No newline at end of file diff --git a/node_modules/graphemer/lib/GraphemerHelper.d.ts.map b/node_modules/graphemer/lib/GraphemerHelper.d.ts.map deleted file mode 100644 index 369421a1f..000000000 --- a/node_modules/graphemer/lib/GraphemerHelper.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphemerHelper.d.ts","sourceRoot":"","sources":["../src/GraphemerHelper.ts"],"names":[],"mappings":"AAUA,cAAM,eAAe;IACnB;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IASrD;;;;;;;OAOG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAgCpD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,WAAW,CAChB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EAAE,EACb,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM;CAyHV;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/node_modules/graphemer/lib/GraphemerHelper.js b/node_modules/graphemer/lib/GraphemerHelper.js deleted file mode 100644 index 9bc71ebd9..000000000 --- a/node_modules/graphemer/lib/GraphemerHelper.js +++ /dev/null @@ -1,169 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const boundaries_1 = require("./boundaries"); -// BreakTypes -// @type {BreakType} -const NotBreak = 0; -const BreakStart = 1; -const Break = 2; -const BreakLastRegional = 3; -const BreakPenultimateRegional = 4; -class GraphemerHelper { - /** - * Check if the the character at the position {pos} of the string is surrogate - * @param str {string} - * @param pos {number} - * @returns {boolean} - */ - static isSurrogate(str, pos) { - return (0xd800 <= str.charCodeAt(pos) && - str.charCodeAt(pos) <= 0xdbff && - 0xdc00 <= str.charCodeAt(pos + 1) && - str.charCodeAt(pos + 1) <= 0xdfff); - } - /** - * The String.prototype.codePointAt polyfill - * Private function, gets a Unicode code point from a JavaScript UTF-16 string - * handling surrogate pairs appropriately - * @param str {string} - * @param idx {number} - * @returns {number} - */ - static codePointAt(str, idx) { - if (idx === undefined) { - idx = 0; - } - const code = str.charCodeAt(idx); - // if a high surrogate - if (0xd800 <= code && code <= 0xdbff && idx < str.length - 1) { - const hi = code; - const low = str.charCodeAt(idx + 1); - if (0xdc00 <= low && low <= 0xdfff) { - return (hi - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000; - } - return hi; - } - // if a low surrogate - if (0xdc00 <= code && code <= 0xdfff && idx >= 1) { - const hi = str.charCodeAt(idx - 1); - const low = code; - if (0xd800 <= hi && hi <= 0xdbff) { - return (hi - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000; - } - return low; - } - // just return the char if an unmatched surrogate half or a - // single-char codepoint - return code; - } - // - /** - * Private function, returns whether a break is allowed between the two given grapheme breaking classes - * Implemented the UAX #29 3.1.1 Grapheme Cluster Boundary Rules on extended grapheme clusters - * @param start {number} - * @param mid {Array} - * @param end {number} - * @param startEmoji {number} - * @param midEmoji {Array} - * @param endEmoji {number} - * @returns {number} - */ - static shouldBreak(start, mid, end, startEmoji, midEmoji, endEmoji) { - const all = [start].concat(mid).concat([end]); - const allEmoji = [startEmoji].concat(midEmoji).concat([endEmoji]); - const previous = all[all.length - 2]; - const next = end; - const nextEmoji = endEmoji; - // Lookahead terminator for: - // GB12. ^ (RI RI)* RI ? RI - // GB13. [^RI] (RI RI)* RI ? RI - const rIIndex = all.lastIndexOf(boundaries_1.CLUSTER_BREAK.REGIONAL_INDICATOR); - if (rIIndex > 0 && - all.slice(1, rIIndex).every(function (c) { - return c === boundaries_1.CLUSTER_BREAK.REGIONAL_INDICATOR; - }) && - [boundaries_1.CLUSTER_BREAK.PREPEND, boundaries_1.CLUSTER_BREAK.REGIONAL_INDICATOR].indexOf(previous) === -1) { - if (all.filter(function (c) { - return c === boundaries_1.CLUSTER_BREAK.REGIONAL_INDICATOR; - }).length % - 2 === - 1) { - return BreakLastRegional; - } - else { - return BreakPenultimateRegional; - } - } - // GB3. CR × LF - if (previous === boundaries_1.CLUSTER_BREAK.CR && next === boundaries_1.CLUSTER_BREAK.LF) { - return NotBreak; - } - // GB4. (Control|CR|LF) ÷ - else if (previous === boundaries_1.CLUSTER_BREAK.CONTROL || - previous === boundaries_1.CLUSTER_BREAK.CR || - previous === boundaries_1.CLUSTER_BREAK.LF) { - return BreakStart; - } - // GB5. ÷ (Control|CR|LF) - else if (next === boundaries_1.CLUSTER_BREAK.CONTROL || - next === boundaries_1.CLUSTER_BREAK.CR || - next === boundaries_1.CLUSTER_BREAK.LF) { - return BreakStart; - } - // GB6. L × (L|V|LV|LVT) - else if (previous === boundaries_1.CLUSTER_BREAK.L && - (next === boundaries_1.CLUSTER_BREAK.L || - next === boundaries_1.CLUSTER_BREAK.V || - next === boundaries_1.CLUSTER_BREAK.LV || - next === boundaries_1.CLUSTER_BREAK.LVT)) { - return NotBreak; - } - // GB7. (LV|V) × (V|T) - else if ((previous === boundaries_1.CLUSTER_BREAK.LV || previous === boundaries_1.CLUSTER_BREAK.V) && - (next === boundaries_1.CLUSTER_BREAK.V || next === boundaries_1.CLUSTER_BREAK.T)) { - return NotBreak; - } - // GB8. (LVT|T) × (T) - else if ((previous === boundaries_1.CLUSTER_BREAK.LVT || previous === boundaries_1.CLUSTER_BREAK.T) && - next === boundaries_1.CLUSTER_BREAK.T) { - return NotBreak; - } - // GB9. × (Extend|ZWJ) - else if (next === boundaries_1.CLUSTER_BREAK.EXTEND || next === boundaries_1.CLUSTER_BREAK.ZWJ) { - return NotBreak; - } - // GB9a. × SpacingMark - else if (next === boundaries_1.CLUSTER_BREAK.SPACINGMARK) { - return NotBreak; - } - // GB9b. Prepend × - else if (previous === boundaries_1.CLUSTER_BREAK.PREPEND) { - return NotBreak; - } - // GB11. \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic} - const previousNonExtendIndex = allEmoji - .slice(0, -1) - .lastIndexOf(boundaries_1.EXTENDED_PICTOGRAPHIC); - if (previousNonExtendIndex !== -1 && - allEmoji[previousNonExtendIndex] === boundaries_1.EXTENDED_PICTOGRAPHIC && - all.slice(previousNonExtendIndex + 1, -2).every(function (c) { - return c === boundaries_1.CLUSTER_BREAK.EXTEND; - }) && - previous === boundaries_1.CLUSTER_BREAK.ZWJ && - nextEmoji === boundaries_1.EXTENDED_PICTOGRAPHIC) { - return NotBreak; - } - // GB12. ^ (RI RI)* RI × RI - // GB13. [^RI] (RI RI)* RI × RI - if (mid.indexOf(boundaries_1.CLUSTER_BREAK.REGIONAL_INDICATOR) !== -1) { - return Break; - } - if (previous === boundaries_1.CLUSTER_BREAK.REGIONAL_INDICATOR && - next === boundaries_1.CLUSTER_BREAK.REGIONAL_INDICATOR) { - return NotBreak; - } - // GB999. Any ? Any - return BreakStart; - } -} -exports.default = GraphemerHelper; diff --git a/node_modules/graphemer/lib/GraphemerIterator.d.ts b/node_modules/graphemer/lib/GraphemerIterator.d.ts deleted file mode 100644 index 4c52d91f0..000000000 --- a/node_modules/graphemer/lib/GraphemerIterator.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * GraphemerIterator - * - * Takes a string and a "BreakHandler" method during initialisation - * and creates an iterable object that returns individual graphemes. - * - * @param str {string} - * @return GraphemerIterator - */ -declare class GraphemerIterator implements Iterator { - private _index; - private _str; - private _nextBreak; - constructor(str: string, nextBreak: (str: string, index: number) => number); - [Symbol.iterator](): this; - next(): { - value: string; - done: boolean; - }; -} -export default GraphemerIterator; -//# sourceMappingURL=GraphemerIterator.d.ts.map \ No newline at end of file diff --git a/node_modules/graphemer/lib/GraphemerIterator.d.ts.map b/node_modules/graphemer/lib/GraphemerIterator.d.ts.map deleted file mode 100644 index c65f0eecb..000000000 --- a/node_modules/graphemer/lib/GraphemerIterator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphemerIterator.d.ts","sourceRoot":"","sources":["../src/GraphemerIterator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAM,iBAAkB,YAAW,QAAQ,CAAC,MAAM,CAAC;IACjD,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,UAAU,CAAyC;gBAE/C,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM;IAK1E,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIjB,IAAI;;;;CAcL;AAED,eAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/node_modules/graphemer/lib/GraphemerIterator.js b/node_modules/graphemer/lib/GraphemerIterator.js deleted file mode 100644 index dd21ce54d..000000000 --- a/node_modules/graphemer/lib/GraphemerIterator.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * GraphemerIterator - * - * Takes a string and a "BreakHandler" method during initialisation - * and creates an iterable object that returns individual graphemes. - * - * @param str {string} - * @return GraphemerIterator - */ -class GraphemerIterator { - constructor(str, nextBreak) { - this._index = 0; - this._str = str; - this._nextBreak = nextBreak; - } - [Symbol.iterator]() { - return this; - } - next() { - let brk; - if ((brk = this._nextBreak(this._str, this._index)) < this._str.length) { - const value = this._str.slice(this._index, brk); - this._index = brk; - return { value: value, done: false }; - } - if (this._index < this._str.length) { - const value = this._str.slice(this._index); - this._index = this._str.length; - return { value: value, done: false }; - } - return { value: undefined, done: true }; - } -} -exports.default = GraphemerIterator; diff --git a/node_modules/graphemer/lib/boundaries.d.ts b/node_modules/graphemer/lib/boundaries.d.ts deleted file mode 100644 index 330aed10c..000000000 --- a/node_modules/graphemer/lib/boundaries.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * The Grapheme_Cluster_Break property value - * @see https://www.unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table - */ -export declare enum CLUSTER_BREAK { - CR = 0, - LF = 1, - CONTROL = 2, - EXTEND = 3, - REGIONAL_INDICATOR = 4, - SPACINGMARK = 5, - L = 6, - V = 7, - T = 8, - LV = 9, - LVT = 10, - OTHER = 11, - PREPEND = 12, - E_BASE = 13, - E_MODIFIER = 14, - ZWJ = 15, - GLUE_AFTER_ZWJ = 16, - E_BASE_GAZ = 17 -} -/** - * The Emoji character property is an extension of UCD but shares the same namespace and structure - * @see http://www.unicode.org/reports/tr51/tr51-14.html#Emoji_Properties_and_Data_Files - * - * Here we model Extended_Pictograhpic only to implement UAX #29 GB11 - * \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic} - * - * The Emoji character property should not be mixed with Grapheme_Cluster_Break since they are not exclusive - */ -export declare const EXTENDED_PICTOGRAPHIC = 101; -//# sourceMappingURL=boundaries.d.ts.map \ No newline at end of file diff --git a/node_modules/graphemer/lib/boundaries.d.ts.map b/node_modules/graphemer/lib/boundaries.d.ts.map deleted file mode 100644 index 5bc59bae2..000000000 --- a/node_modules/graphemer/lib/boundaries.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../src/boundaries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,aAAa;IACvB,EAAE,IAAI;IACN,EAAE,IAAI;IACN,OAAO,IAAI;IACX,MAAM,IAAI;IACV,kBAAkB,IAAI;IACtB,WAAW,IAAI;IACf,CAAC,IAAI;IACL,CAAC,IAAI;IACL,CAAC,IAAI;IACL,EAAE,IAAI;IACN,GAAG,KAAK;IACR,KAAK,KAAK;IACV,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,UAAU,KAAK;IACf,GAAG,KAAK;IACR,cAAc,KAAK;IACnB,UAAU,KAAK;CAChB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/graphemer/lib/boundaries.js b/node_modules/graphemer/lib/boundaries.js deleted file mode 100644 index 2c98c1456..000000000 --- a/node_modules/graphemer/lib/boundaries.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -/** - * The Grapheme_Cluster_Break property value - * @see https://www.unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EXTENDED_PICTOGRAPHIC = exports.CLUSTER_BREAK = void 0; -var CLUSTER_BREAK; -(function (CLUSTER_BREAK) { - CLUSTER_BREAK[CLUSTER_BREAK["CR"] = 0] = "CR"; - CLUSTER_BREAK[CLUSTER_BREAK["LF"] = 1] = "LF"; - CLUSTER_BREAK[CLUSTER_BREAK["CONTROL"] = 2] = "CONTROL"; - CLUSTER_BREAK[CLUSTER_BREAK["EXTEND"] = 3] = "EXTEND"; - CLUSTER_BREAK[CLUSTER_BREAK["REGIONAL_INDICATOR"] = 4] = "REGIONAL_INDICATOR"; - CLUSTER_BREAK[CLUSTER_BREAK["SPACINGMARK"] = 5] = "SPACINGMARK"; - CLUSTER_BREAK[CLUSTER_BREAK["L"] = 6] = "L"; - CLUSTER_BREAK[CLUSTER_BREAK["V"] = 7] = "V"; - CLUSTER_BREAK[CLUSTER_BREAK["T"] = 8] = "T"; - CLUSTER_BREAK[CLUSTER_BREAK["LV"] = 9] = "LV"; - CLUSTER_BREAK[CLUSTER_BREAK["LVT"] = 10] = "LVT"; - CLUSTER_BREAK[CLUSTER_BREAK["OTHER"] = 11] = "OTHER"; - CLUSTER_BREAK[CLUSTER_BREAK["PREPEND"] = 12] = "PREPEND"; - CLUSTER_BREAK[CLUSTER_BREAK["E_BASE"] = 13] = "E_BASE"; - CLUSTER_BREAK[CLUSTER_BREAK["E_MODIFIER"] = 14] = "E_MODIFIER"; - CLUSTER_BREAK[CLUSTER_BREAK["ZWJ"] = 15] = "ZWJ"; - CLUSTER_BREAK[CLUSTER_BREAK["GLUE_AFTER_ZWJ"] = 16] = "GLUE_AFTER_ZWJ"; - CLUSTER_BREAK[CLUSTER_BREAK["E_BASE_GAZ"] = 17] = "E_BASE_GAZ"; -})(CLUSTER_BREAK = exports.CLUSTER_BREAK || (exports.CLUSTER_BREAK = {})); -/** - * The Emoji character property is an extension of UCD but shares the same namespace and structure - * @see http://www.unicode.org/reports/tr51/tr51-14.html#Emoji_Properties_and_Data_Files - * - * Here we model Extended_Pictograhpic only to implement UAX #29 GB11 - * \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic} - * - * The Emoji character property should not be mixed with Grapheme_Cluster_Break since they are not exclusive - */ -exports.EXTENDED_PICTOGRAPHIC = 101; diff --git a/node_modules/graphemer/lib/index.d.ts b/node_modules/graphemer/lib/index.d.ts deleted file mode 100644 index c7c39af11..000000000 --- a/node_modules/graphemer/lib/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Graphemer from './Graphemer'; -export default Graphemer; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/graphemer/lib/index.d.ts.map b/node_modules/graphemer/lib/index.d.ts.map deleted file mode 100644 index a6bacf990..000000000 --- a/node_modules/graphemer/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/graphemer/lib/index.js b/node_modules/graphemer/lib/index.js deleted file mode 100644 index 548bdd017..000000000 --- a/node_modules/graphemer/lib/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const Graphemer_1 = __importDefault(require("./Graphemer")); -exports.default = Graphemer_1.default; diff --git a/node_modules/graphemer/package.json b/node_modules/graphemer/package.json deleted file mode 100644 index cf0315ddc..000000000 --- a/node_modules/graphemer/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "graphemer", - "version": "1.4.0", - "description": "A JavaScript library that breaks strings into their individual user-perceived characters (including emojis!)", - "homepage": "https://github.com/flmnt/graphemer", - "author": "Matt Davies (https://github.com/mattpauldavies)", - "contributors": [ - "Orlin Georgiev (https://github.com/orling)", - "Huáng Jùnliàng (https://github.com/JLHwung)" - ], - "main": "./lib/index.js", - "types": "./lib/index.d.ts", - "files": [ - "lib" - ], - "license": "MIT", - "keywords": [ - "utf-8", - "strings", - "emoji", - "split" - ], - "scripts": { - "prepublishOnly": "npm run build", - "build": "tsc --project tsconfig.json", - "pretest": "npm run build", - "test": "ts-node node_modules/tape/bin/tape tests/**.ts", - "prettier:check": "prettier --check .", - "prettier:fix": "prettier --write ." - }, - "repository": { - "type": "git", - "url": "https://github.com/flmnt/graphemer.git" - }, - "bugs": "https://github.com/flmnt/graphemer/issues", - "devDependencies": { - "@types/tape": "^4.13.0", - "husky": "^4.3.0", - "lint-staged": "^10.3.0", - "prettier": "^2.1.1", - "tape": "^4.6.3", - "ts-node": "^9.0.0", - "typescript": "^4.0.2" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged", - "pre-push": "npm test" - } - }, - "lint-staged": { - "*.{js,ts,md,json}": "prettier --write" - } -} diff --git a/node_modules/has-flag/index.d.ts b/node_modules/has-flag/index.d.ts deleted file mode 100644 index a0a48c891..000000000 --- a/node_modules/has-flag/index.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** -Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag. - -@param flag - CLI flag to look for. The `--` prefix is optional. -@param argv - CLI arguments. Default: `process.argv`. -@returns Whether the flag exists. - -@example -``` -// $ ts-node foo.ts -f --unicorn --foo=bar -- --rainbow - -// foo.ts -import hasFlag = require('has-flag'); - -hasFlag('unicorn'); -//=> true - -hasFlag('--unicorn'); -//=> true - -hasFlag('f'); -//=> true - -hasFlag('-f'); -//=> true - -hasFlag('foo=bar'); -//=> true - -hasFlag('foo'); -//=> false - -hasFlag('rainbow'); -//=> false -``` -*/ -declare function hasFlag(flag: string, argv?: string[]): boolean; - -export = hasFlag; diff --git a/node_modules/has-flag/index.js b/node_modules/has-flag/index.js deleted file mode 100644 index b6f80b1f8..000000000 --- a/node_modules/has-flag/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -module.exports = (flag, argv = process.argv) => { - const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); - const position = argv.indexOf(prefix + flag); - const terminatorPosition = argv.indexOf('--'); - return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); -}; diff --git a/node_modules/has-flag/license b/node_modules/has-flag/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/has-flag/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -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/has-flag/package.json b/node_modules/has-flag/package.json deleted file mode 100644 index a9cba4b85..000000000 --- a/node_modules/has-flag/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "has-flag", - "version": "4.0.0", - "description": "Check if argv has a specific flag", - "license": "MIT", - "repository": "sindresorhus/has-flag", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "has", - "check", - "detect", - "contains", - "find", - "flag", - "cli", - "command-line", - "argv", - "process", - "arg", - "args", - "argument", - "arguments", - "getopt", - "minimist", - "optimist" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/has-flag/readme.md b/node_modules/has-flag/readme.md deleted file mode 100644 index 3f72dff29..000000000 --- a/node_modules/has-flag/readme.md +++ /dev/null @@ -1,89 +0,0 @@ -# has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag) - -> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag - -Correctly stops looking after an `--` argument terminator. - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
- ---- - - -## Install - -``` -$ npm install has-flag -``` - - -## Usage - -```js -// foo.js -const hasFlag = require('has-flag'); - -hasFlag('unicorn'); -//=> true - -hasFlag('--unicorn'); -//=> true - -hasFlag('f'); -//=> true - -hasFlag('-f'); -//=> true - -hasFlag('foo=bar'); -//=> true - -hasFlag('foo'); -//=> false - -hasFlag('rainbow'); -//=> false -``` - -``` -$ node foo.js -f --unicorn --foo=bar -- --rainbow -``` - - -## API - -### hasFlag(flag, [argv]) - -Returns a boolean for whether the flag exists. - -#### flag - -Type: `string` - -CLI flag to look for. The `--` prefix is optional. - -#### argv - -Type: `string[]`
-Default: `process.argv` - -CLI arguments. - - -## Security - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/has/LICENSE-MIT b/node_modules/has/LICENSE-MIT deleted file mode 100644 index ae7014d38..000000000 --- a/node_modules/has/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 Thiago de Arruda - -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/has/README.md b/node_modules/has/README.md deleted file mode 100644 index 635e3a4ba..000000000 --- a/node_modules/has/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# has - -> Object.prototype.hasOwnProperty.call shortcut - -## Installation - -```sh -npm install --save has -``` - -## Usage - -```js -var has = require('has'); - -has({}, 'hasOwnProperty'); // false -has(Object.prototype, 'hasOwnProperty'); // true -``` diff --git a/node_modules/has/package.json b/node_modules/has/package.json deleted file mode 100644 index 7c4592f16..000000000 --- a/node_modules/has/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "has", - "description": "Object.prototype.hasOwnProperty.call shortcut", - "version": "1.0.3", - "homepage": "https://github.com/tarruda/has", - "author": { - "name": "Thiago de Arruda", - "email": "tpadilha84@gmail.com" - }, - "contributors": [ - { - "name": "Jordan Harband", - "email": "ljharb@gmail.com", - "url": "http://ljharb.codes" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/tarruda/has.git" - }, - "bugs": { - "url": "https://github.com/tarruda/has/issues" - }, - "license": "MIT", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" - } - ], - "main": "./src", - "dependencies": { - "function-bind": "^1.1.1" - }, - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "eslint": "^4.19.1", - "tape": "^4.9.0" - }, - "engines": { - "node": ">= 0.4.0" - }, - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "tape test" - } -} diff --git a/node_modules/has/src/index.js b/node_modules/has/src/index.js deleted file mode 100644 index dd92dd909..000000000 --- a/node_modules/has/src/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); - -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); diff --git a/node_modules/has/test/index.js b/node_modules/has/test/index.js deleted file mode 100644 index 43d480b2c..000000000 --- a/node_modules/has/test/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var test = require('tape'); -var has = require('../'); - -test('has', function (t) { - t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"'); - t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"'); - t.end(); -}); diff --git a/node_modules/html-escaper/LICENSE.txt b/node_modules/html-escaper/LICENSE.txt deleted file mode 100644 index dcfa0aebd..000000000 --- a/node_modules/html-escaper/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection - -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/html-escaper/README.md b/node_modules/html-escaper/README.md deleted file mode 100644 index 3dca3412f..000000000 --- a/node_modules/html-escaper/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# html-escaper [![Build Status](https://travis-ci.org/WebReflection/html-escaper.svg?branch=master)](https://travis-ci.org/WebReflection/html-escaper) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/html-escaper/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/html-escaper?branch=master) -A simple module to escape/unescape common problematic entities. - - -### How -This package is available in npm so `npm install html-escaper` is all you need to do, using eventually the global flag too. - -Once the module is present -```js -var html = require('html-escaper'); - -// two basic methods -html.escape('string'); -html.unescape('escaped string'); -``` - - -### Why -there is basically one rule only: do not **ever** replace one char after another if you are transforming a string into another. - -```js -// WARNING: THIS IS WRONG -// if you are that kind of dev that does this -function escape(s) { - return s.replace(/&/g, "&") - .replace(//g, ">") - .replace(/'/g, "'") - .replace(/"/g, """); -} - -// you might be the same dev that does this too -function unescape(s) { - return s.replace(/&/g, "&") - .replace(/</g, "<") - .replace(/>/g, ">") - .replace(/'/g, "'") - .replace(/"/g, '"'); -} - -// guess what we have here ? -unescape('&lt;'); - -// now guess this XSS too ... -unescape('&lt;script&gt;alert("yo")&lt;/script&gt;'); - - -``` - -The last example will produce `` instead of the expected `<script>alert("yo")</script>`. - -Nothing like this could possibly happen if we grab all chars at once and either ways. -It's just a fortunate case that after swapping `&` with `&` no other replace will be affected, but it's not portable and universally a bad practice. - -Grab all chars at once, no excuses! - - - -**more details** -As somebody might think it's an `unescape` issue only, it's not. Being an anti-pattern with side effects works both ways. - -As example, changing the order of the replacement in escaping would produce the unexpected: -```js -function escape(s) { - return s.replace(//g, ">") - .replace(/'/g, "'") - .replace(/"/g, """) - .replace(/&/g, "&"); -} - -escape('<'); // &lt; instead of < -``` -If we do not want to code with the fear that the order wasn't perfect or that our order in either escaping or unescaping is different from the order another method or function used, if we understand the issue and we agree it's potentially a disaster prone approach, if we add the fact in this case creating 4 RegExp objects each time and invoking 4 times `.replace` trough the `String.prototype` is also potentially slower than creating one function only holding one object, or holding the function too, we should agree there is not absolutely any valid reason to keep proposing a char-by-char implementation. - -We have proofs this approach can fail already so ... why should we risk? Just avoid and grab all chars at once or simply use this tiny utility. - -### Backtick -Internt explorer < 9 has [some backtick issue](https://html5sec.org/#102) - -For compatibility sake with common server-side HTML entities encoders and decoders, and in order to have the most reliable I/O, this little utility will NOT fix this IE < 9 problem. - -It is also important to note that if we create valid HTML and we set attributes at runtime through this utility, backticks in strings cannot possibly affect attribute behaviors. - -```js -var img = new Image(); -img.src = html.escape( - 'x` `"` `' -); -// it won't cause problems even in IE < 9 -``` - -**However**, if you use `innerHTML` and you target IE < 9 then [this **might** be a problem](https://github.com/nette/nette/issues/1496). - -Accordingly, if you need more chars and/or backticks to be escaped and unescaped, feel free to use alternatives like [lodash](https://github.com/lodash/lodash) or [he](https://www.npmjs.com/package/he) - -Here a bit more of [my POV](https://github.com/WebReflection/html-escaper/commit/52d554fc6e8583b6ffdd357967cf71962fc07cf6#commitcomment-10625122) and why I haven't implemented same thing alternatives did. Good news: those are alternatives ;-) \ No newline at end of file diff --git a/node_modules/html-escaper/cjs/index.js b/node_modules/html-escaper/cjs/index.js deleted file mode 100644 index 164a34cb6..000000000 --- a/node_modules/html-escaper/cjs/index.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; -/** - * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection - * - * 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 replace = ''.replace; - -var ca = /[&<>'"]/g; -var es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g; - -var esca = { - '&': '&', - '<': '<', - '>': '>', - "'": ''', - '"': '"' -}; -var unes = { - '&': '&', - '&': '&', - '<': '<', - '<': '<', - '>': '>', - '>': '>', - ''': "'", - ''': "'", - '"': '"', - '"': '"' -}; - -function escape(es) { - return replace.call(es, ca, pe); -} -exports.escape = escape; - -function unescape(un) { - return replace.call(un, es, cape); -} -exports.unescape = unescape; - -function pe(m) { - return esca[m]; -} - -function cape(m) { - return unes[m]; -} diff --git a/node_modules/html-escaper/cjs/package.json b/node_modules/html-escaper/cjs/package.json deleted file mode 100644 index 0292b9956..000000000 --- a/node_modules/html-escaper/cjs/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"commonjs"} \ No newline at end of file diff --git a/node_modules/html-escaper/esm/index.js b/node_modules/html-escaper/esm/index.js deleted file mode 100644 index e05b93f6a..000000000 --- a/node_modules/html-escaper/esm/index.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection - * - * 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 replace = ''.replace; - -var ca = /[&<>'"]/g; -var es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g; - -var esca = { - '&': '&', - '<': '<', - '>': '>', - "'": ''', - '"': '"' -}; -var unes = { - '&': '&', - '&': '&', - '<': '<', - '<': '<', - '>': '>', - '>': '>', - ''': "'", - ''': "'", - '"': '"', - '"': '"' -}; - -export function escape(es) { - return replace.call(es, ca, pe); -}; - -export function unescape(un) { - return replace.call(un, es, cape); -}; - -function pe(m) { - return esca[m]; -} - -function cape(m) { - return unes[m]; -} diff --git a/node_modules/html-escaper/index.js b/node_modules/html-escaper/index.js deleted file mode 100644 index 6c3f2ab4d..000000000 --- a/node_modules/html-escaper/index.js +++ /dev/null @@ -1,70 +0,0 @@ -var html = (function (exports) { - 'use strict'; - - /** - * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection - * - * 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 replace = ''.replace; - - var ca = /[&<>'"]/g; - var es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g; - - var esca = { - '&': '&', - '<': '<', - '>': '>', - "'": ''', - '"': '"' - }; - var unes = { - '&': '&', - '&': '&', - '<': '<', - '<': '<', - '>': '>', - '>': '>', - ''': "'", - ''': "'", - '"': '"', - '"': '"' - }; - - function escape(es) { - return replace.call(es, ca, pe); - } - function unescape(un) { - return replace.call(un, es, cape); - } - function pe(m) { - return esca[m]; - } - - function cape(m) { - return unes[m]; - } - - exports.escape = escape; - exports.unescape = unescape; - - return exports; - -}({})); diff --git a/node_modules/html-escaper/min.js b/node_modules/html-escaper/min.js deleted file mode 100644 index 54d0c2356..000000000 --- a/node_modules/html-escaper/min.js +++ /dev/null @@ -1 +0,0 @@ -var html=function(t){"use strict";var n="".replace,u=/[&<>'"]/g,r=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g,a={"&":"&","<":"<",">":">","'":"'",'"':"""},e={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'};function c(t){return a[t]}function o(t){return e[t]}return t.escape=function(t){return n.call(t,u,c)},t.unescape=function(t){return n.call(t,r,o)},t}({}); \ No newline at end of file diff --git a/node_modules/html-escaper/package.json b/node_modules/html-escaper/package.json deleted file mode 100644 index 81d06a97c..000000000 --- a/node_modules/html-escaper/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "html-escaper", - "version": "2.0.2", - "description": "fast and safe way to escape and unescape &<>'\" chars", - "main": "./cjs/index.js", - "unpkg": "min.js", - "scripts": { - "build": "npm run cjs && npm run rollup && npm run minify && npm test && npm run size", - "cjs": "ascjs esm cjs", - "coveralls": "cat ./coverage/lcov.info | coveralls", - "minify": "uglifyjs index.js --comments=/^!/ --compress --mangle -o min.js", - "rollup": "rollup --config rollup.config.js", - "size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c min.js | wc -c", - "test": "istanbul cover ./test/index.js" - }, - "module": "./esm/index.js", - "repository": { - "type": "git", - "url": "https://github.com/WebReflection/html-escaper.git" - }, - "keywords": [ - "html", - "escape", - "encode", - "unescape", - "decode", - "entities" - ], - "author": "Andrea Giammarchi", - "license": "MIT", - "bugs": { - "url": "https://github.com/WebReflection/html-escaper/issues" - }, - "homepage": "https://github.com/WebReflection/html-escaper", - "devDependencies": { - "ascjs": "^3.1.2", - "coveralls": "^3.0.11", - "istanbul": "^0.4.5", - "rollup": "^2.1.0", - "uglify-js": "^3.8.0" - } -} diff --git a/node_modules/html-escaper/test/index.js b/node_modules/html-escaper/test/index.js deleted file mode 100644 index 0eb00dee4..000000000 --- a/node_modules/html-escaper/test/index.js +++ /dev/null @@ -1,23 +0,0 @@ -delete Object.freeze; - -var html = require('../cjs'); - -console.assert( - html.escape('&<>\'"') === '&<>'"', - 'correct escape' -); - -console.assert( - html.escape('<>\'"&') === '<>'"&', - 'correct inverted escape' -); - -console.assert( - '&<>\'"' === html.unescape('&<>'"'), - 'correct unescape' -); - -console.assert( - '<>\'"&' === html.unescape('<>'"&'), - 'correct inverted unescape' -); diff --git a/node_modules/html-escaper/test/package.json b/node_modules/html-escaper/test/package.json deleted file mode 100644 index 0292b9956..000000000 --- a/node_modules/html-escaper/test/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"commonjs"} \ No newline at end of file diff --git a/node_modules/human-signals/CHANGELOG.md b/node_modules/human-signals/CHANGELOG.md deleted file mode 100644 index 70d039293..000000000 --- a/node_modules/human-signals/CHANGELOG.md +++ /dev/null @@ -1,11 +0,0 @@ -# 2.1.0 - -## TypeScript types - -- Add [TypeScript definitions](src/main.d.ts) - -# 2.0.0 - -## Breaking changes - -- Minimal supported Node.js version is now `10.17.0` diff --git a/node_modules/human-signals/LICENSE b/node_modules/human-signals/LICENSE deleted file mode 100644 index 9af949261..000000000 --- a/node_modules/human-signals/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2019 ehmicky - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/human-signals/README.md b/node_modules/human-signals/README.md deleted file mode 100644 index 2af37c370..000000000 --- a/node_modules/human-signals/README.md +++ /dev/null @@ -1,165 +0,0 @@ -[![Codecov](https://img.shields.io/codecov/c/github/ehmicky/human-signals.svg?label=tested&logo=codecov)](https://codecov.io/gh/ehmicky/human-signals) -[![Travis](https://img.shields.io/badge/cross-platform-4cc61e.svg?logo=travis)](https://travis-ci.org/ehmicky/human-signals) -[![Node](https://img.shields.io/node/v/human-signals.svg?logo=node.js)](https://www.npmjs.com/package/human-signals) -[![Gitter](https://img.shields.io/gitter/room/ehmicky/human-signals.svg?logo=gitter)](https://gitter.im/ehmicky/human-signals) -[![Twitter](https://img.shields.io/badge/%E2%80%8B-twitter-4cc61e.svg?logo=twitter)](https://twitter.com/intent/follow?screen_name=ehmicky) -[![Medium](https://img.shields.io/badge/%E2%80%8B-medium-4cc61e.svg?logo=medium)](https://medium.com/@ehmicky) - -Human-friendly process signals. - -This is a map of known process signals with some information about each signal. - -Unlike -[`os.constants.signals`](https://nodejs.org/api/os.html#os_signal_constants) -this includes: - -- human-friendly [descriptions](#description) -- [default actions](#action), including whether they [can be prevented](#forced) -- whether the signal is [supported](#supported) by the current OS - -# Example - -```js -const { signalsByName, signalsByNumber } = require('human-signals') - -console.log(signalsByName.SIGINT) -// { -// name: 'SIGINT', -// number: 2, -// description: 'User interruption with CTRL-C', -// supported: true, -// action: 'terminate', -// forced: false, -// standard: 'ansi' -// } - -console.log(signalsByNumber[8]) -// { -// name: 'SIGFPE', -// number: 8, -// description: 'Floating point arithmetic error', -// supported: true, -// action: 'core', -// forced: false, -// standard: 'ansi' -// } -``` - -# Install - -```bash -npm install human-signals -``` - -# Usage - -## signalsByName - -_Type_: `object` - -Object whose keys are signal [names](#name) and values are -[signal objects](#signal). - -## signalsByNumber - -_Type_: `object` - -Object whose keys are signal [numbers](#number) and values are -[signal objects](#signal). - -## signal - -_Type_: `object` - -Signal object with the following properties. - -### name - -_Type_: `string` - -Standard name of the signal, for example `'SIGINT'`. - -### number - -_Type_: `number` - -Code number of the signal, for example `2`. While most `number` are -cross-platform, some are different between different OS. - -### description - -_Type_: `string` - -Human-friendly description for the signal, for example -`'User interruption with CTRL-C'`. - -### supported - -_Type_: `boolean` - -Whether the current OS can handle this signal in Node.js using -[`process.on(name, handler)`](https://nodejs.org/api/process.html#process_signal_events). - -The list of supported signals -[is OS-specific](https://github.com/ehmicky/cross-platform-node-guide/blob/master/docs/6_networking_ipc/signals.md#cross-platform-signals). - -### action - -_Type_: `string`\ -_Enum_: `'terminate'`, `'core'`, `'ignore'`, `'pause'`, `'unpause'` - -What is the default action for this signal when it is not handled. - -### forced - -_Type_: `boolean` - -Whether the signal's default action cannot be prevented. This is `true` for -`SIGTERM`, `SIGKILL` and `SIGSTOP`. - -### standard - -_Type_: `string`\ -_Enum_: `'ansi'`, `'posix'`, `'bsd'`, `'systemv'`, `'other'` - -Which standard defined that signal. - -# Support - -If you found a bug or would like a new feature, _don't hesitate_ to -[submit an issue on GitHub](../../issues). - -For other questions, feel free to -[chat with us on Gitter](https://gitter.im/ehmicky/human-signals). - -Everyone is welcome regardless of personal background. We enforce a -[Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and -inclusive environment. - -# Contributing - -This project was made with ❤️. The simplest way to give back is by starring and -sharing it online. - -If the documentation is unclear or has a typo, please click on the page's `Edit` -button (pencil icon) and suggest a correction. - -If you would like to help us fix a bug or add a new feature, please check our -[guidelines](CONTRIBUTING.md). Pull requests are welcome! - -Thanks go to our wonderful contributors: - - - - - - - - - -

ehmicky

💻 🎨 🤔 📖

electrovir

💻
- - - - - diff --git a/node_modules/human-signals/build/src/core.js b/node_modules/human-signals/build/src/core.js deleted file mode 100644 index 98e8fced0..000000000 --- a/node_modules/human-signals/build/src/core.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SIGNALS=void 0; - -const SIGNALS=[ -{ -name:"SIGHUP", -number:1, -action:"terminate", -description:"Terminal closed", -standard:"posix"}, - -{ -name:"SIGINT", -number:2, -action:"terminate", -description:"User interruption with CTRL-C", -standard:"ansi"}, - -{ -name:"SIGQUIT", -number:3, -action:"core", -description:"User interruption with CTRL-\\", -standard:"posix"}, - -{ -name:"SIGILL", -number:4, -action:"core", -description:"Invalid machine instruction", -standard:"ansi"}, - -{ -name:"SIGTRAP", -number:5, -action:"core", -description:"Debugger breakpoint", -standard:"posix"}, - -{ -name:"SIGABRT", -number:6, -action:"core", -description:"Aborted", -standard:"ansi"}, - -{ -name:"SIGIOT", -number:6, -action:"core", -description:"Aborted", -standard:"bsd"}, - -{ -name:"SIGBUS", -number:7, -action:"core", -description: -"Bus error due to misaligned, non-existing address or paging error", -standard:"bsd"}, - -{ -name:"SIGEMT", -number:7, -action:"terminate", -description:"Command should be emulated but is not implemented", -standard:"other"}, - -{ -name:"SIGFPE", -number:8, -action:"core", -description:"Floating point arithmetic error", -standard:"ansi"}, - -{ -name:"SIGKILL", -number:9, -action:"terminate", -description:"Forced termination", -standard:"posix", -forced:true}, - -{ -name:"SIGUSR1", -number:10, -action:"terminate", -description:"Application-specific signal", -standard:"posix"}, - -{ -name:"SIGSEGV", -number:11, -action:"core", -description:"Segmentation fault", -standard:"ansi"}, - -{ -name:"SIGUSR2", -number:12, -action:"terminate", -description:"Application-specific signal", -standard:"posix"}, - -{ -name:"SIGPIPE", -number:13, -action:"terminate", -description:"Broken pipe or socket", -standard:"posix"}, - -{ -name:"SIGALRM", -number:14, -action:"terminate", -description:"Timeout or timer", -standard:"posix"}, - -{ -name:"SIGTERM", -number:15, -action:"terminate", -description:"Termination", -standard:"ansi"}, - -{ -name:"SIGSTKFLT", -number:16, -action:"terminate", -description:"Stack is empty or overflowed", -standard:"other"}, - -{ -name:"SIGCHLD", -number:17, -action:"ignore", -description:"Child process terminated, paused or unpaused", -standard:"posix"}, - -{ -name:"SIGCLD", -number:17, -action:"ignore", -description:"Child process terminated, paused or unpaused", -standard:"other"}, - -{ -name:"SIGCONT", -number:18, -action:"unpause", -description:"Unpaused", -standard:"posix", -forced:true}, - -{ -name:"SIGSTOP", -number:19, -action:"pause", -description:"Paused", -standard:"posix", -forced:true}, - -{ -name:"SIGTSTP", -number:20, -action:"pause", -description:"Paused using CTRL-Z or \"suspend\"", -standard:"posix"}, - -{ -name:"SIGTTIN", -number:21, -action:"pause", -description:"Background process cannot read terminal input", -standard:"posix"}, - -{ -name:"SIGBREAK", -number:21, -action:"terminate", -description:"User interruption with CTRL-BREAK", -standard:"other"}, - -{ -name:"SIGTTOU", -number:22, -action:"pause", -description:"Background process cannot write to terminal output", -standard:"posix"}, - -{ -name:"SIGURG", -number:23, -action:"ignore", -description:"Socket received out-of-band data", -standard:"bsd"}, - -{ -name:"SIGXCPU", -number:24, -action:"core", -description:"Process timed out", -standard:"bsd"}, - -{ -name:"SIGXFSZ", -number:25, -action:"core", -description:"File too big", -standard:"bsd"}, - -{ -name:"SIGVTALRM", -number:26, -action:"terminate", -description:"Timeout or timer", -standard:"bsd"}, - -{ -name:"SIGPROF", -number:27, -action:"terminate", -description:"Timeout or timer", -standard:"bsd"}, - -{ -name:"SIGWINCH", -number:28, -action:"ignore", -description:"Terminal window size changed", -standard:"bsd"}, - -{ -name:"SIGIO", -number:29, -action:"terminate", -description:"I/O is available", -standard:"other"}, - -{ -name:"SIGPOLL", -number:29, -action:"terminate", -description:"Watched event", -standard:"other"}, - -{ -name:"SIGINFO", -number:29, -action:"ignore", -description:"Request for process information", -standard:"other"}, - -{ -name:"SIGPWR", -number:30, -action:"terminate", -description:"Device running out of power", -standard:"systemv"}, - -{ -name:"SIGSYS", -number:31, -action:"core", -description:"Invalid system call", -standard:"other"}, - -{ -name:"SIGUNUSED", -number:31, -action:"terminate", -description:"Invalid system call", -standard:"other"}];exports.SIGNALS=SIGNALS; -//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/node_modules/human-signals/build/src/core.js.map b/node_modules/human-signals/build/src/core.js.map deleted file mode 100644 index cbfce26de..000000000 --- a/node_modules/human-signals/build/src/core.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/core.js"],"names":["SIGNALS","name","number","action","description","standard","forced"],"mappings":";;AAEO,KAAMA,CAAAA,OAAO,CAAG;AACrB;AACEC,IAAI,CAAE,QADR;AAEEC,MAAM,CAAE,CAFV;AAGEC,MAAM,CAAE,WAHV;AAIEC,WAAW,CAAE,iBAJf;AAKEC,QAAQ,CAAE,OALZ,CADqB;;AAQrB;AACEJ,IAAI,CAAE,QADR;AAEEC,MAAM,CAAE,CAFV;A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AnPqB;;AA0PrB;AACEJ,IAAI,CAAE,QADR;AAEEC,MAAM,CAAE,EAFV;AAGEC,MAAM,CAAE,WAHV;AAIEC,WAAW,CAAE,6BAJf;AAKEC,QAAQ,CAAE,SALZ,CA1PqB;;AAiQrB;AACEJ,IAAI,CAAE,QADR;AAEEC,MAAM,CAAE,EAFV;AAGEC,MAAM,CAAE,MAHV;AAIEC,WAAW,CAAE,qBAJf;AAKEC,QAAQ,CAAE,OALZ,CAjQqB;;AAwQrB;AACEJ,IAAI,CAAE,WADR;AAEEC,MAAM,CAAE,EAFV;AAGEC,MAAM,CAAE,WAHV;AAIEC,WAAW,CAAE,qBAJf;AAKEC,QAAQ,CAAE,OALZ,CAxQqB,CAAhB,C","sourcesContent":["/* eslint-disable max-lines */\n// List of known process signals with information about them\nexport const SIGNALS = [\n {\n name: 'SIGHUP',\n number: 1,\n action: 'terminate',\n description: 'Terminal closed',\n standard: 'posix',\n },\n {\n name: 'SIGINT',\n number: 2,\n action: 'terminate',\n description: 'User interruption with CTRL-C',\n standard: 'ansi',\n },\n {\n name: 'SIGQUIT',\n number: 3,\n action: 'core',\n description: 'User interruption with CTRL-\\\\',\n standard: 'posix',\n },\n {\n name: 'SIGILL',\n number: 4,\n action: 'core',\n description: 'Invalid machine instruction',\n standard: 'ansi',\n },\n {\n name: 'SIGTRAP',\n number: 5,\n action: 'core',\n description: 'Debugger breakpoint',\n standard: 'posix',\n },\n {\n name: 'SIGABRT',\n number: 6,\n action: 'core',\n description: 'Aborted',\n standard: 'ansi',\n },\n {\n name: 'SIGIOT',\n number: 6,\n action: 'core',\n description: 'Aborted',\n standard: 'bsd',\n },\n {\n name: 'SIGBUS',\n number: 7,\n action: 'core',\n description:\n 'Bus error due to misaligned, non-existing address or paging error',\n standard: 'bsd',\n },\n {\n name: 'SIGEMT',\n number: 7,\n action: 'terminate',\n description: 'Command should be emulated but is not implemented',\n standard: 'other',\n },\n {\n name: 'SIGFPE',\n number: 8,\n action: 'core',\n description: 'Floating point arithmetic error',\n standard: 'ansi',\n },\n {\n name: 'SIGKILL',\n number: 9,\n action: 'terminate',\n description: 'Forced termination',\n standard: 'posix',\n forced: true,\n },\n {\n name: 'SIGUSR1',\n number: 10,\n action: 'terminate',\n description: 'Application-specific signal',\n standard: 'posix',\n },\n {\n name: 'SIGSEGV',\n number: 11,\n action: 'core',\n description: 'Segmentation fault',\n standard: 'ansi',\n },\n {\n name: 'SIGUSR2',\n number: 12,\n action: 'terminate',\n description: 'Application-specific signal',\n standard: 'posix',\n },\n {\n name: 'SIGPIPE',\n number: 13,\n action: 'terminate',\n description: 'Broken pipe or socket',\n standard: 'posix',\n },\n {\n name: 'SIGALRM',\n number: 14,\n action: 'terminate',\n description: 'Timeout or timer',\n standard: 'posix',\n },\n {\n name: 'SIGTERM',\n number: 15,\n action: 'terminate',\n description: 'Termination',\n standard: 'ansi',\n },\n {\n name: 'SIGSTKFLT',\n number: 16,\n action: 'terminate',\n description: 'Stack is empty or overflowed',\n standard: 'other',\n },\n {\n name: 'SIGCHLD',\n number: 17,\n action: 'ignore',\n description: 'Child process terminated, paused or unpaused',\n standard: 'posix',\n },\n {\n name: 'SIGCLD',\n number: 17,\n action: 'ignore',\n description: 'Child process terminated, paused or unpaused',\n standard: 'other',\n },\n {\n name: 'SIGCONT',\n number: 18,\n action: 'unpause',\n description: 'Unpaused',\n standard: 'posix',\n forced: true,\n },\n {\n name: 'SIGSTOP',\n number: 19,\n action: 'pause',\n description: 'Paused',\n standard: 'posix',\n forced: true,\n },\n {\n name: 'SIGTSTP',\n number: 20,\n action: 'pause',\n description: 'Paused using CTRL-Z or \"suspend\"',\n standard: 'posix',\n },\n {\n name: 'SIGTTIN',\n number: 21,\n action: 'pause',\n description: 'Background process cannot read terminal input',\n standard: 'posix',\n },\n {\n name: 'SIGBREAK',\n number: 21,\n action: 'terminate',\n description: 'User interruption with CTRL-BREAK',\n standard: 'other',\n },\n {\n name: 'SIGTTOU',\n number: 22,\n action: 'pause',\n description: 'Background process cannot write to terminal output',\n standard: 'posix',\n },\n {\n name: 'SIGURG',\n number: 23,\n action: 'ignore',\n description: 'Socket received out-of-band data',\n standard: 'bsd',\n },\n {\n name: 'SIGXCPU',\n number: 24,\n action: 'core',\n description: 'Process timed out',\n standard: 'bsd',\n },\n {\n name: 'SIGXFSZ',\n number: 25,\n action: 'core',\n description: 'File too big',\n standard: 'bsd',\n },\n {\n name: 'SIGVTALRM',\n number: 26,\n action: 'terminate',\n description: 'Timeout or timer',\n standard: 'bsd',\n },\n {\n name: 'SIGPROF',\n number: 27,\n action: 'terminate',\n description: 'Timeout or timer',\n standard: 'bsd',\n },\n {\n name: 'SIGWINCH',\n number: 28,\n action: 'ignore',\n description: 'Terminal window size changed',\n standard: 'bsd',\n },\n {\n name: 'SIGIO',\n number: 29,\n action: 'terminate',\n description: 'I/O is available',\n standard: 'other',\n },\n {\n name: 'SIGPOLL',\n number: 29,\n action: 'terminate',\n description: 'Watched event',\n standard: 'other',\n },\n {\n name: 'SIGINFO',\n number: 29,\n action: 'ignore',\n description: 'Request for process information',\n standard: 'other',\n },\n {\n name: 'SIGPWR',\n number: 30,\n action: 'terminate',\n description: 'Device running out of power',\n standard: 'systemv',\n },\n {\n name: 'SIGSYS',\n number: 31,\n action: 'core',\n description: 'Invalid system call',\n standard: 'other',\n },\n {\n name: 'SIGUNUSED',\n number: 31,\n action: 'terminate',\n description: 'Invalid system call',\n standard: 'other',\n },\n]\n/* eslint-enable max-lines */\n"],"file":"src/core.js"} \ No newline at end of file diff --git a/node_modules/human-signals/build/src/main.d.ts b/node_modules/human-signals/build/src/main.d.ts deleted file mode 100644 index 2dc5ea78e..000000000 --- a/node_modules/human-signals/build/src/main.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Object whose keys are signal names and values are signal objects. - */ -export declare const signalsByName: { [signalName: string]: Signal } -/** - * Object whose keys are signal numbers and values are signal objects. - */ -export declare const signalsByNumber: { [signalNumber: string]: Signal } - -export declare type SignalAction = - | 'terminate' - | 'core' - | 'ignore' - | 'pause' - | 'unpause' -export declare type SignalStandard = - | 'ansi' - | 'posix' - | 'bsd' - | 'systemv' - | 'other' - -export declare type Signal = { - /** - * Standard name of the signal, for example 'SIGINT'. - */ - name: string - /** - * Code number of the signal, for example 2. While most number are cross-platform, some are different between different OS. - */ - number: number - /** - * Human-friendly description for the signal, for example 'User interruption with CTRL-C'. - */ - description: string - /** - * Whether the current OS can handle this signal in Node.js using process.on(name, handler). The list of supported signals is OS-specific. - */ - supported: boolean - /** - * What is the default action for this signal when it is not handled. - */ - action: SignalAction - /** - * Whether the signal's default action cannot be prevented. This is true for SIGTERM, SIGKILL and SIGSTOP. - */ - forced: boolean - /** - * Which standard defined that signal. - */ - standard: SignalStandard -} diff --git a/node_modules/human-signals/build/src/main.js b/node_modules/human-signals/build/src/main.js deleted file mode 100644 index 88f5fd29b..000000000 --- a/node_modules/human-signals/build/src/main.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.signalsByNumber=exports.signalsByName=void 0;var _os=require("os"); - -var _signals=require("./signals.js"); -var _realtime=require("./realtime.js"); - - - -const getSignalsByName=function(){ -const signals=(0,_signals.getSignals)(); -return signals.reduce(getSignalByName,{}); -}; - -const getSignalByName=function( -signalByNameMemo, -{name,number,description,supported,action,forced,standard}) -{ -return{ -...signalByNameMemo, -[name]:{name,number,description,supported,action,forced,standard}}; - -}; - -const signalsByName=getSignalsByName();exports.signalsByName=signalsByName; - - - - -const getSignalsByNumber=function(){ -const signals=(0,_signals.getSignals)(); -const length=_realtime.SIGRTMAX+1; -const signalsA=Array.from({length},(value,number)=> -getSignalByNumber(number,signals)); - -return Object.assign({},...signalsA); -}; - -const getSignalByNumber=function(number,signals){ -const signal=findSignalByNumber(number,signals); - -if(signal===undefined){ -return{}; -} - -const{name,description,supported,action,forced,standard}=signal; -return{ -[number]:{ -name, -number, -description, -supported, -action, -forced, -standard}}; - - -}; - - - -const findSignalByNumber=function(number,signals){ -const signal=signals.find(({name})=>_os.constants.signals[name]===number); - -if(signal!==undefined){ -return signal; -} - -return signals.find(signalA=>signalA.number===number); -}; - -const signalsByNumber=getSignalsByNumber();exports.signalsByNumber=signalsByNumber; -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/node_modules/human-signals/build/src/main.js.map b/node_modules/human-signals/build/src/main.js.map deleted file mode 100644 index 3fdcede94..000000000 --- a/node_modules/human-signals/build/src/main.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/main.js"],"names":["getSignalsByName","signals","reduce","getSignalByName","signalByNameMemo","name","number","description","supported","action","forced","standard","signalsByName","getSignalsByNumber","length","SIGRTMAX","signalsA","Array","from","value","getSignalByNumber","Object","assign","signal","findSignalByNumber","undefined","find","constants","signalA","signalsByNumber"],"mappings":"2HAAA;;AAEA;AACA;;;;AAIA,KAAMA,CAAAA,gBAAgB,CAAG,UAAW;AAClC,KAAMC,CAAAA,OAAO,CAAG,yBAAhB;AACA,MAAOA,CAAAA,OAAO,CAACC,MAAR,CAAeC,eAAf,CAAgC,EAAhC,CAAP;AACD,CAHD;;AAKA,KAAMA,CAAAA,eAAe,CAAG;AACtBC,gBADsB;AAEtB,CAAEC,IAAF,CAAQC,MAAR,CAAgBC,WAAhB,CAA6BC,SAA7B,CAAwCC,MAAxC,CAAgDC,MAAhD,CAAwDC,QAAxD,CAFsB;AAGtB;AACA,MAAO;AACL,GAAGP,gBADE;AAEL,CAACC,IAAD,EAAQ,CAAEA,IAAF,CAAQC,MAAR,CAAgBC,WAAhB,CAA6BC,SAA7B,CAAwCC,MAAxC,CAAgDC,MAAhD,CAAwDC,QAAxD,CAFH,CAAP;;AAID,CARD;;AAUO,KAAMC,CAAAA,aAAa,CAAGZ,gBAAgB,EAAtC,C;;;;;AAKP,KAAMa,CAAAA,kBAAkB,CAAG,UAAW;AACpC,KAAMZ,CAAAA,OAAO,CAAG,yBAAhB;AACA,KAAMa,CAAAA,MAAM,CAAGC,mBAAW,C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port { getSignals } from './signals.js'\nimport { SIGRTMAX } from './realtime.js'\n\n// Retrieve `signalsByName`, an object mapping signal name to signal properties.\n// We make sure the object is sorted by `number`.\nconst getSignalsByName = function() {\n const signals = getSignals()\n return signals.reduce(getSignalByName, {})\n}\n\nconst getSignalByName = function(\n signalByNameMemo,\n { name, number, description, supported, action, forced, standard },\n) {\n return {\n ...signalByNameMemo,\n [name]: { name, number, description, supported, action, forced, standard },\n }\n}\n\nexport const signalsByName = getSignalsByName()\n\n// Retrieve `signalsByNumber`, an object mapping signal number to signal\n// properties.\n// We make sure the object is sorted by `number`.\nconst getSignalsByNumber = function() {\n const signals = getSignals()\n const length = SIGRTMAX + 1\n const signalsA = Array.from({ length }, (value, number) =>\n getSignalByNumber(number, signals),\n )\n return Object.assign({}, ...signalsA)\n}\n\nconst getSignalByNumber = function(number, signals) {\n const signal = findSignalByNumber(number, signals)\n\n if (signal === undefined) {\n return {}\n }\n\n const { name, description, supported, action, forced, standard } = signal\n return {\n [number]: {\n name,\n number,\n description,\n supported,\n action,\n forced,\n standard,\n },\n }\n}\n\n// Several signals might end up sharing the same number because of OS-specific\n// numbers, in which case those prevail.\nconst findSignalByNumber = function(number, signals) {\n const signal = signals.find(({ name }) => constants.signals[name] === number)\n\n if (signal !== undefined) {\n return signal\n }\n\n return signals.find(signalA => signalA.number === number)\n}\n\nexport const signalsByNumber = getSignalsByNumber()\n"],"file":"src/main.js"} \ No newline at end of file diff --git a/node_modules/human-signals/build/src/realtime.js b/node_modules/human-signals/build/src/realtime.js deleted file mode 100644 index f665516fd..000000000 --- a/node_modules/human-signals/build/src/realtime.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SIGRTMAX=exports.getRealtimeSignals=void 0; -const getRealtimeSignals=function(){ -const length=SIGRTMAX-SIGRTMIN+1; -return Array.from({length},getRealtimeSignal); -};exports.getRealtimeSignals=getRealtimeSignals; - -const getRealtimeSignal=function(value,index){ -return{ -name:`SIGRT${index+1}`, -number:SIGRTMIN+index, -action:"terminate", -description:"Application-specific signal (realtime)", -standard:"posix"}; - -}; - -const SIGRTMIN=34; -const SIGRTMAX=64;exports.SIGRTMAX=SIGRTMAX; -//# sourceMappingURL=realtime.js.map \ No newline at end of file diff --git a/node_modules/human-signals/build/src/realtime.js.map b/node_modules/human-signals/build/src/realtime.js.map deleted file mode 100644 index 808bbd12f..000000000 --- a/node_modules/human-signals/build/src/realtime.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/realtime.js"],"names":["getRealtimeSignals","length","SIGRTMAX","SIGRTMIN","Array","from","getRealtimeSignal","value","index","name","number","action","description","standard"],"mappings":";AACO,KAAMA,CAAAA,kBAAkB,CAAG,UAAW;AAC3C,KAAMC,CAAAA,MAAM,CAAGC,QAAQ,CAAGC,QAAX,CAAsB,CAArC;AACA,MAAOC,CAAAA,KAAK,CAACC,IAAN,CAAW,CAAEJ,MAAF,CAAX,CAAuBK,iBAAvB,CAAP;AACD,CAHM,C;;AAKP,KAAMA,CAAAA,iBAAiB,CAAG,SAASC,KAAT,CAAgBC,KAAhB,CAAuB;AAC/C,MAAO;AACLC,IAAI,CAAG,QAAOD,KAAK,CAAG,CAAE,EADnB;AAELE,MAAM,CAAEP,QAAQ,CAAGK,KAFd;AAGLG,MAAM,CAAE,WAHH;AAILC,WAAW,CAAE,wCAJR;AAKLC,QAAQ,CAAE,OALL,CAAP;;AAOD,CARD;;AAUA,KAAMV,CAAAA,QAAQ,CAAG,EAAjB;AACO,KAAMD,CAAAA,QAAQ,CAAG,EAAjB,C","sourcesContent":["// List of realtime signals with information about them\nexport const getRealtimeSignals = function() {\n const length = SIGRTMAX - SIGRTMIN + 1\n return Array.from({ length }, getRealtimeSignal)\n}\n\nconst getRealtimeSignal = function(value, index) {\n return {\n name: `SIGRT${index + 1}`,\n number: SIGRTMIN + index,\n action: 'terminate',\n description: 'Application-specific signal (realtime)',\n standard: 'posix',\n }\n}\n\nconst SIGRTMIN = 34\nexport const SIGRTMAX = 64\n"],"file":"src/realtime.js"} \ No newline at end of file diff --git a/node_modules/human-signals/build/src/signals.js b/node_modules/human-signals/build/src/signals.js deleted file mode 100644 index ab3b387d9..000000000 --- a/node_modules/human-signals/build/src/signals.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getSignals=void 0;var _os=require("os"); - -var _core=require("./core.js"); -var _realtime=require("./realtime.js"); - - - -const getSignals=function(){ -const realtimeSignals=(0,_realtime.getRealtimeSignals)(); -const signals=[..._core.SIGNALS,...realtimeSignals].map(normalizeSignal); -return signals; -};exports.getSignals=getSignals; - - - - - - - -const normalizeSignal=function({ -name, -number:defaultNumber, -description, -action, -forced=false, -standard}) -{ -const{ -signals:{[name]:constantSignal}}= -_os.constants; -const supported=constantSignal!==undefined; -const number=supported?constantSignal:defaultNumber; -return{name,number,description,supported,action,forced,standard}; -}; -//# sourceMappingURL=signals.js.map \ No newline at end of file diff --git a/node_modules/human-signals/build/src/signals.js.map b/node_modules/human-signals/build/src/signals.js.map deleted file mode 100644 index 2a6b919ec..000000000 --- a/node_modules/human-signals/build/src/signals.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/signals.js"],"names":["getSignals","realtimeSignals","signals","SIGNALS","map","normalizeSignal","name","number","defaultNumber","description","action","forced","standard","constantSignal","constants","supported","undefined"],"mappings":"gGAAA;;AAEA;AACA;;;;AAIO,KAAMA,CAAAA,UAAU,CAAG,UAAW;AACnC,KAAMC,CAAAA,eAAe,CAAG,kCAAxB;AACA,KAAMC,CAAAA,OAAO,CAAG,CAAC,GAAGC,aAAJ,CAAa,GAAGF,eAAhB,EAAiCG,GAAjC,CAAqCC,eAArC,CAAhB;AACA,MAAOH,CAAAA,OAAP;AACD,CAJM,C;;;;;;;;AAYP,KAAMG,CAAAA,eAAe,CAAG,SAAS;AAC/BC,IAD+B;AAE/BC,MAAM,CAAEC,aAFuB;AAG/BC,WAH+B;AAI/BC,MAJ+B;AAK/BC,MAAM,CAAG,KALsB;AAM/BC,QAN+B,CAAT;AAOrB;AACD,KAAM;AACJV,OAAO,CAAE,CAAE,CAACI,IAAD,EAAQO,cAAV,CADL;AAEFC,aAFJ;AAGA,KAAMC,CAAAA,SAAS,CAAGF,cAAc,GAAKG,SAArC;AACA,KAAMT,CAAAA,MAAM,CAAGQ,SAAS,CAAGF,cAAH,CAAoBL,aAA5C;AACA,MAAO,CAAEF,IAAF,CAAQC,MAAR,CAAgBE,WAAhB,CAA6BM,SAA7B,CAAwCL,MAAxC,CAAgDC,MAAhD,CAAwDC,QAAxD,CAAP;AACD,CAdD","sourcesContent":["import { constants } from 'os'\n\nimport { SIGNALS } from './core.js'\nimport { getRealtimeSignals } from './realtime.js'\n\n// Retrieve list of know signals (including realtime) with information about\n// them\nexport const getSignals = function() {\n const realtimeSignals = getRealtimeSignals()\n const signals = [...SIGNALS, ...realtimeSignals].map(normalizeSignal)\n return signals\n}\n\n// Normalize signal:\n// - `number`: signal numbers are OS-specific. This is taken into account by\n// `os.constants.signals`. However we provide a default `number` since some\n// signals are not defined for some OS.\n// - `forced`: set default to `false`\n// - `supported`: set value\nconst normalizeSignal = function({\n name,\n number: defaultNumber,\n description,\n action,\n forced = false,\n standard,\n}) {\n const {\n signals: { [name]: constantSignal },\n } = constants\n const supported = constantSignal !== undefined\n const number = supported ? constantSignal : defaultNumber\n return { name, number, description, supported, action, forced, standard }\n}\n"],"file":"src/signals.js"} \ No newline at end of file diff --git a/node_modules/human-signals/package.json b/node_modules/human-signals/package.json deleted file mode 100644 index fd1d0274f..000000000 --- a/node_modules/human-signals/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "human-signals", - "version": "2.1.0", - "main": "build/src/main.js", - "files": [ - "build/src", - "!~" - ], - "scripts": { - "test": "gulp test" - }, - "husky": { - "hooks": { - "pre-push": "gulp check --full" - } - }, - "description": "Human-friendly process signals", - "keywords": [ - "signal", - "signals", - "handlers", - "error-handling", - "errors", - "interrupts", - "sigterm", - "sigint", - "irq", - "process", - "exit", - "exit-code", - "status", - "operating-system", - "es6", - "javascript", - "linux", - "macos", - "windows", - "nodejs" - ], - "license": "Apache-2.0", - "homepage": "https://git.io/JeluP", - "repository": "ehmicky/human-signals", - "bugs": { - "url": "https://github.com/ehmicky/human-signals/issues" - }, - "author": "ehmicky (https://github.com/ehmicky)", - "directories": { - "lib": "src", - "test": "test" - }, - "types": "build/src/main.d.ts", - "dependencies": {}, - "devDependencies": { - "@ehmicky/dev-tasks": "^0.31.9", - "ajv": "^6.12.0", - "ava": "^3.5.0", - "gulp": "^4.0.2", - "husky": "^4.2.3", - "test-each": "^2.0.0" - }, - "engines": { - "node": ">=10.17.0" - } -} diff --git a/node_modules/ignore/LICENSE-MIT b/node_modules/ignore/LICENSE-MIT deleted file mode 100644 index 825533e33..000000000 --- a/node_modules/ignore/LICENSE-MIT +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 50d88822a..000000000 --- a/node_modules/ignore/README.md +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - - - - - - - - -
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 2.22.1](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) (which used by `fstream-ignore`) does not follow the gitignore spec. - -To filter filenames according to a .gitignore file, I recommend this npm package, `ignore`. - -To parse an `.npmignore` file, you should use `minimatch`, because an `.npmignore` file is parsed by npm using `minimatch` and it does not work in the .gitignore way. - -### 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. - -## static `ignore.isPathValid(pathname): boolean` since 5.0.0 - -Check whether the `pathname` is an valid `path.relative()`d path according to the [convention](#1-pathname-should-be-a-pathrelatived-pathname). - -This method is **NOT** used to check if an ignore pattern is valid. - -```js -ignore.isPathValid('./foo') // false -``` - -## ignore(options) - -### `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 -``` - -### `options.ignoreCase?: boolean` since 5.2.0 - -Which is alternative to `options.ignoreCase` - -### `options.allowRelativePaths?: boolean` since 5.2.0 - -This option brings backward compatibility with projects which based on `ignore@4.x`. If `options.allowRelativePaths` is `true`, `ignore` will not check whether the given path to be tested is [`path.relative()`d](#pathname-conventions). - -However, passing a relative path, such as `'./foo'` or `'../foo'`, to test if it is ignored or not is not a good practise, which might lead to unexpected behavior - -```js -ignore({ - allowRelativePaths: true -}).ignores('../foo/bar.js') // And it will not throw -``` - -**** - -# Upgrade Guide - -## Upgrade 4.x -> 5.x - -Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, unless `options.allowRelative = true` is passed to the `Ignore` factory. - -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 deleted file mode 100644 index 520eafa77..000000000 --- a/node_modules/ignore/index.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -type Pathname = string - -interface TestResult { - ignored: boolean - unignored: boolean -} - -export interface Ignore { - /** - * Adds one or several rules to the current manager. - * @param {string[]} patterns - * @returns IgnoreBase - */ - add(patterns: string | Ignore | readonly (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: readonly 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 - // For compatibility - ignoreCase?: boolean - allowRelativePaths?: 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 deleted file mode 100644 index a25577f7f..000000000 --- a/node_modules/ignore/index.js +++ /dev/null @@ -1,618 +0,0 @@ -// A simple implementation of make-array -function makeArray (subject) { - return Array.isArray(subject) - ? subject - : [subject] -} - -const EMPTY = '' -const SPACE = ' ' -const ESCAPE = '\\' -const REGEX_TEST_BLANK_LINE = /^\s+$/ -const REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/ -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 = '/' - -// Do not use ternary expression here, since "istanbul ignore next" is buggy -let TMP_KEY_IGNORE = 'node-ignore' -/* istanbul ignore else */ -if (typeof Symbol !== 'undefined') { - TMP_KEY_IGNORE = Symbol.for('node-ignore') -} -const KEY_IGNORE = TMP_KEY_IGNORE - -const define = (object, key, value) => - Object.defineProperty(object, key, {value}) - -const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g - -const RETURN_FALSE = () => false - -// 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. - : EMPTY -) - -// See fixtures #59 -const cleanRangeBackSlash = slashes => { - const {length} = slashes - return slashes.slice(0, length - length % 2) -} - -// > 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 - ? SPACE - : EMPTY - ], - - // replace (\ ) with ' ' - [ - /\\\s/g, - () => SPACE - ], - - // 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}` - ], - - [ - // > 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' - () => '^(?:.*\\/)?' - ], - - // 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 - : '\\/.+' - ], - - // normal intermediate wildcards - [ - // Never replace escaped '*' - // ignore rule '\*' will match the path '*' - - // 'abc.*/' -> go - // 'abc.*' -> skip this rule, - // coz trailing single wildcard will be handed by [trailing wildcard] - /(^|[^\\]+)(\\\*)+(?=.+)/g, - - // '*.js' matches '.js' - // '*.js' doesn't match 'abc' - (_, p1, p2) => { - // 1. - // > An asterisk "*" matches anything except a slash. - // 2. - // > Other consecutive asterisks are considered regular asterisks - // > and will match according to the previous rules. - const unescaped = p2.replace(/\\\*/g, '[^\\/]*') - return p1 + unescaped - } - ], - - [ - // unescape, revert step 3 except for back slash - // For example, if a user escape a '\\*', - // after step 3, the result will be '\\\\\\*' - /\\\\\\(?=[$.|*+(){^])/g, - () => ESCAPE - ], - - [ - // '\\\\' -> '\\' - /\\\\/g, - () => ESCAPE - ], - - [ - // > The range notation, e.g. [a-zA-Z], - // > can be used to match one of the characters in a range. - - // `\` is escaped by step 3 - /(\\)?\[([^\]/]*?)(\\*)($|\])/g, - (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE - // '\\[bar]' -> '\\\\[bar\\]' - ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` - : close === ']' - ? endEscape.length % 2 === 0 - // A normal case, and it is a range notation - // '[bar]' - // '[bar\\\\]' - ? `[${sanitizeRange(range)}${endEscape}]` - // Invalid range notaton - // '[bar\\]' -> '[bar\\\\]' - : '[]' - : '[]' - ], - - // 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}(?=$|\\/$)` - ], - - // trailing wildcard - [ - /(\^|\\\/)?\\\*$/, - (_, p1) => { - const prefix = p1 - // '\^': - // '/*' does not match EMPTY - // '/*' does not match everything - - // '\\\/': - // 'abc/*' does not match 'abc/' - ? `${p1}[^/]+` - - // 'a*' matches 'a' - // 'a*' matches 'aa' - : '[^/]*' - - return `${prefix}(?=$|\\/$)` - } - ], -] - -// A simple cache, because an ignore rule only has only one certain meaning -const regexCache = Object.create(null) - -// @param {pattern} -const makeRegex = (pattern, ignoreCase) => { - let source = regexCache[pattern] - - if (!source) { - source = REPLACERS.reduce( - (prev, current) => prev.replace(current[0], current[1].bind(pattern)), - pattern - ) - regexCache[pattern] = source - } - - return 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) - && !REGEX_INVALID_TRAILING_BACKSLASH.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, 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 EMPTY, 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, - ignoreCase = ignorecase, - allowRelativePaths = false - } = {}) { - define(this, KEY_IGNORE, true) - - this._rules = [] - this._ignoreCase = ignoreCase - this._allowRelativePaths = allowRelativePaths - 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, - this._allowRelativePaths - ? RETURN_FALSE - : 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 isPathValid = path => - checkPath(path && checkPath.convert(path), path, RETURN_FALSE) - -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 deleted file mode 100644 index 8518b7c51..000000000 --- a/node_modules/ignore/legacy.js +++ /dev/null @@ -1,539 +0,0 @@ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -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 EMPTY = ''; -var SPACE = ' '; -var ESCAPE = '\\'; -var REGEX_TEST_BLANK_LINE = /^\s+$/; -var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/; -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 = '/'; - -// Do not use ternary expression here, since "istanbul ignore next" is buggy -var TMP_KEY_IGNORE = 'node-ignore'; -/* istanbul ignore else */ -if (typeof Symbol !== 'undefined') { - TMP_KEY_IGNORE = Symbol["for"]('node-ignore'); -} -var KEY_IGNORE = TMP_KEY_IGNORE; -var define = function define(object, key, value) { - return Object.defineProperty(object, key, { - value: value - }); -}; -var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g; -var RETURN_FALSE = function RETURN_FALSE() { - return false; -}; - -// 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. - : EMPTY; - }); -}; - -// See fixtures #59 -var cleanRangeBackSlash = function cleanRangeBackSlash(slashes) { - var length = slashes.length; - return slashes.slice(0, length - length % 2); -}; - -// > 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 ? SPACE : EMPTY; -}], -// replace (\ ) with ' ' -[/\\\s/g, function () { - return SPACE; -}], -// 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); -}], [ -// > 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 '^(?:.*\\/)?'; -}], -// 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 - : '\\/.+'; -}], -// normal intermediate wildcards -[ -// Never replace escaped '*' -// ignore rule '\*' will match the path '*' - -// 'abc.*/' -> go -// 'abc.*' -> skip this rule, -// coz trailing single wildcard will be handed by [trailing wildcard] -/(^|[^\\]+)(\\\*)+(?=.+)/g, -// '*.js' matches '.js' -// '*.js' doesn't match 'abc' -function (_, p1, p2) { - // 1. - // > An asterisk "*" matches anything except a slash. - // 2. - // > Other consecutive asterisks are considered regular asterisks - // > and will match according to the previous rules. - var unescaped = p2.replace(/\\\*/g, '[^\\/]*'); - return p1 + unescaped; -}], [ -// unescape, revert step 3 except for back slash -// For example, if a user escape a '\\*', -// after step 3, the result will be '\\\\\\*' -/\\\\\\(?=[$.|*+(){^])/g, function () { - return ESCAPE; -}], [ -// '\\\\' -> '\\' -/\\\\/g, function () { - return ESCAPE; -}], [ -// > The range notation, e.g. [a-zA-Z], -// > can be used to match one of the characters in a range. - -// `\` is escaped by step 3 -/(\\)?\[([^\]/]*?)(\\*)($|\])/g, function (match, leadEscape, range, endEscape, close) { - return leadEscape === ESCAPE - // '\\[bar]' -> '\\\\[bar\\]' - ? "\\[".concat(range).concat(cleanRangeBackSlash(endEscape)).concat(close) : close === ']' ? endEscape.length % 2 === 0 - // A normal case, and it is a range notation - // '[bar]' - // '[bar\\\\]' - ? "[".concat(sanitizeRange(range)).concat(endEscape, "]") // Invalid range notaton - // '[bar\\]' -> '[bar\\\\]' - : '[]' : '[]'; -}], -// 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, "(?=$|\\/$)"); -}], -// trailing wildcard -[/(\^|\\\/)?\\\*$/, function (_, p1) { - var prefix = p1 - // '\^': - // '/*' does not match EMPTY - // '/*' does not match everything - - // '\\\/': - // 'abc/*' does not match 'abc/' - ? "".concat(p1, "[^/]+") // 'a*' matches 'a' - // 'a*' matches 'aa' - : '[^/]*'; - return "".concat(prefix, "(?=$|\\/$)"); -}]]; - -// 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, ignoreCase) { - var source = regexCache[pattern]; - if (!source) { - source = REPLACERS.reduce(function (prev, current) { - return prev.replace(current[0], current[1].bind(pattern)); - }, pattern); - regexCache[pattern] = source; - } - return 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) && !REGEX_INVALID_TRAILING_BACKSLASH.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 = /*#__PURE__*/_createClass(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, 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 EMPTY, 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, - _ref$ignoreCase = _ref.ignoreCase, - ignoreCase = _ref$ignoreCase === void 0 ? ignorecase : _ref$ignoreCase, - _ref$allowRelativePat = _ref.allowRelativePaths, - allowRelativePaths = _ref$allowRelativePat === void 0 ? false : _ref$allowRelativePat; - _classCallCheck(this, Ignore); - define(this, KEY_IGNORE, true); - this._rules = []; - this._ignoreCase = ignoreCase; - this._allowRelativePaths = allowRelativePaths; - 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, this._allowRelativePaths ? RETURN_FALSE : 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 isPathValid = function isPathValid(path) { - return checkPath(path && checkPath.convert(path), path, RETURN_FALSE); -}; -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 deleted file mode 100644 index fe5498df0..000000000 --- a/node_modules/ignore/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "ignore", - "version": "5.2.4", - "description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.", - "files": [ - "legacy.js", - "index.js", - "index.d.ts", - "LICENSE-MIT" - ], - "scripts": { - "prepublishOnly": "npm run build", - "build": "babel -o legacy.js index.js", - "test:lint": "eslint .", - "test:tsc": "tsc ./test/ts/simple.ts --lib ES6", - "test:ts": "node ./test/ts/simple.js", - "tap": "tap --reporter classic", - "test:git": "npm run tap test/git-check-ignore.js", - "test:ignore": "npm run tap test/ignore.js", - "test:others": "npm run tap test/others.js", - "test:cases": "npm run tap test/*.js -- --coverage", - "test:no-coverage": "npm run tap test/*.js -- --no-check-coverage", - "test:only": "npm run test:lint && npm run test:tsc && npm run test:ts && npm run test:cases", - "test": "npm run test:only", - "test:win32": "IGNORE_TEST_WIN32=1 npm run test", - "report": "tap --coverage-report=html", - "posttest": "npm run report && codecov" - }, - "repository": { - "type": "git", - "url": "git@github.com:kaelzhang/node-ignore.git" - }, - "keywords": [ - "ignore", - ".gitignore", - "gitignore", - "npmignore", - "rules", - "manager", - "filter", - "regexp", - "regex", - "fnmatch", - "glob", - "asterisks", - "regular-expression" - ], - "author": "kael", - "license": "MIT", - "bugs": { - "url": "https://github.com/kaelzhang/node-ignore/issues" - }, - "devDependencies": { - "@babel/cli": "^7.19.3", - "@babel/core": "^7.20.5", - "@babel/preset-env": "^7.20.2", - "codecov": "^3.8.2", - "debug": "^4.3.4", - "eslint": "^8.30.0", - "eslint-config-ostai": "^3.0.0", - "eslint-plugin-import": "^2.26.0", - "mkdirp": "^1.0.4", - "pre-suf": "^1.1.1", - "rimraf": "^3.0.2", - "spawn-sync": "^2.0.0", - "tap": "^16.3.2", - "tmp": "0.2.1", - "typescript": "^4.9.4" - }, - "engines": { - "node": ">= 4" - } -} diff --git a/node_modules/import-fresh/index.d.ts b/node_modules/import-fresh/index.d.ts deleted file mode 100644 index 36d7e208b..000000000 --- a/node_modules/import-fresh/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** -Import a module while bypassing the cache. - -@example -``` -// foo.js -let i = 0; -module.exports = () => ++i; - -// index.js -import importFresh = require('import-fresh'); - -require('./foo')(); -//=> 1 - -require('./foo')(); -//=> 2 - -importFresh('./foo')(); -//=> 1 - -importFresh('./foo')(); -//=> 1 - -const foo = importFresh('./foo'); -``` -*/ -declare function importFresh(moduleId: string): T; - -export = importFresh; diff --git a/node_modules/import-fresh/index.js b/node_modules/import-fresh/index.js deleted file mode 100644 index 0a4c5d52f..000000000 --- a/node_modules/import-fresh/index.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; -const path = require('path'); -const resolveFrom = require('resolve-from'); -const parentModule = require('parent-module'); - -module.exports = moduleId => { - if (typeof moduleId !== 'string') { - throw new TypeError('Expected a string'); - } - - const parentPath = parentModule(__filename); - - const cwd = parentPath ? path.dirname(parentPath) : __dirname; - const filePath = resolveFrom(cwd, moduleId); - - const oldModule = require.cache[filePath]; - // Delete itself from module parent - if (oldModule && oldModule.parent) { - let i = oldModule.parent.children.length; - - while (i--) { - if (oldModule.parent.children[i].id === filePath) { - oldModule.parent.children.splice(i, 1); - } - } - } - - delete require.cache[filePath]; // Delete module from cache - - const parent = require.cache[parentPath]; // If `filePath` and `parentPath` are the same, cache will already be deleted so we won't get a memory leak in next step - - return parent === undefined ? require(filePath) : parent.require(filePath); // In case cache doesn't have parent, fall back to normal require -}; diff --git a/node_modules/import-fresh/license b/node_modules/import-fresh/license deleted file mode 100644 index fa7ceba3e..000000000 --- a/node_modules/import-fresh/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://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/import-fresh/package.json b/node_modules/import-fresh/package.json deleted file mode 100644 index 0c0936206..000000000 --- a/node_modules/import-fresh/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "import-fresh", - "version": "3.3.0", - "description": "Import a module while bypassing the cache", - "license": "MIT", - "repository": "sindresorhus/import-fresh", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava && tsd", - "heapdump": "node heapdump.js" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "require", - "cache", - "uncache", - "uncached", - "module", - "fresh", - "bypass" - ], - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "devDependencies": { - "ava": "^1.0.1", - "heapdump": "^0.3.12", - "tsd": "^0.7.3", - "xo": "^0.23.0" - } -} diff --git a/node_modules/import-fresh/readme.md b/node_modules/import-fresh/readme.md deleted file mode 100644 index bd14c79c6..000000000 --- a/node_modules/import-fresh/readme.md +++ /dev/null @@ -1,48 +0,0 @@ -# import-fresh - -> Import a module while bypassing the [cache](https://nodejs.org/api/modules.html#modules_caching) - -Useful for testing purposes when you need to freshly import a module. - -## Install - -``` -$ npm install import-fresh -``` - -## Usage - -```js -// foo.js -let i = 0; -module.exports = () => ++i; -``` - -```js -const importFresh = require('import-fresh'); - -require('./foo')(); -//=> 1 - -require('./foo')(); -//=> 2 - -importFresh('./foo')(); -//=> 1 - -importFresh('./foo')(); -//=> 1 -``` - -## import-fresh for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of import-fresh and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-import-fresh?utm_source=npm-import-fresh&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - -## Related - -- [clear-module](https://github.com/sindresorhus/clear-module) - Clear a module from the import cache -- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path -- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory -- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import modules lazily diff --git a/node_modules/import-local/fixtures/cli.js b/node_modules/import-local/fixtures/cli.js deleted file mode 100755 index 46b939f13..000000000 --- a/node_modules/import-local/fixtures/cli.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -'use strict'; -const importLocal = require('..'); - -if (importLocal(__filename)) { - console.log('local'); -} diff --git a/node_modules/import-local/index.js b/node_modules/import-local/index.js deleted file mode 100644 index 28c9c605f..000000000 --- a/node_modules/import-local/index.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; -const path = require('path'); -const {fileURLToPath} = require('url'); -const resolveCwd = require('resolve-cwd'); -const pkgDir = require('pkg-dir'); - -module.exports = filename => { - const normalizedFilename = filename.startsWith('file://') ? fileURLToPath(filename) : filename; - const globalDir = pkgDir.sync(path.dirname(normalizedFilename)); - const relativePath = path.relative(globalDir, normalizedFilename); - const pkg = require(path.join(globalDir, 'package.json')); - const localFile = resolveCwd.silent(path.join(pkg.name, relativePath)); - const localNodeModules = path.join(process.cwd(), 'node_modules'); - - const filenameInLocalNodeModules = !path.relative(localNodeModules, normalizedFilename).startsWith('..') && - // On Windows, if `localNodeModules` and `normalizedFilename` are on different partitions, `path.relative()` returns the value of `normalizedFilename`, resulting in `filenameInLocalNodeModules` incorrectly becoming `true`. - path.parse(localNodeModules).root === path.parse(normalizedFilename).root; - - // Use `path.relative()` to detect local package installation, - // because __filename's case is inconsistent on Windows - // Can use `===` when targeting Node.js 8 - // See https://github.com/nodejs/node/issues/6624 - return !filenameInLocalNodeModules && localFile && path.relative(localFile, normalizedFilename) !== '' && require(localFile); -}; diff --git a/node_modules/import-local/license b/node_modules/import-local/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/import-local/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -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/import-local/package.json b/node_modules/import-local/package.json deleted file mode 100644 index 0de45f066..000000000 --- a/node_modules/import-local/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "import-local", - "version": "3.1.0", - "description": "Let a globally installed package use a locally installed version of itself if available", - "license": "MIT", - "repository": "sindresorhus/import-local", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js", - "fixtures/cli.js" - ], - "keywords": [ - "import", - "local", - "require", - "resolve", - "global", - "version", - "prefer", - "cli" - ], - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "devDependencies": { - "ava": "2.1.0", - "cpy": "^7.0.1", - "del": "^4.1.1", - "execa": "^2.0.1", - "xo": "^0.24.0" - }, - "xo": { - "ignores": [ - "fixtures" - ] - } -} diff --git a/node_modules/import-local/readme.md b/node_modules/import-local/readme.md deleted file mode 100644 index cc5244f8b..000000000 --- a/node_modules/import-local/readme.md +++ /dev/null @@ -1,37 +0,0 @@ -# import-local - -> Let a globally installed package use a locally installed version of itself if available - -Useful for CLI tools that want to defer to the user's locally installed version when available, but still work if it's not installed locally. For example, [AVA](https://avajs.dev) and [XO](https://github.com/xojs/xo) uses this method. - -## Install - -```sh -npm install import-local -``` - -## Usage - -```js -import importLocal from 'import-local'; - -if (importLocal(import.meta.url)) { - console.log('Using local version of this package'); -} else { - // Code for both global and local version here… -} -``` - -You can also pass in `__filename` when used in a CommonJS context. - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/imurmurhash/README.md b/node_modules/imurmurhash/README.md deleted file mode 100644 index f35b20a0e..000000000 --- a/node_modules/imurmurhash/README.md +++ /dev/null @@ -1,122 +0,0 @@ -iMurmurHash.js -============== - -An incremental implementation of the MurmurHash3 (32-bit) hashing algorithm for JavaScript based on [Gary Court's implementation](https://github.com/garycourt/murmurhash-js) with [kazuyukitanimura's modifications](https://github.com/kazuyukitanimura/murmurhash-js). - -This version works significantly faster than the non-incremental version if you need to hash many small strings into a single hash, since string concatenation (to build the single string to pass the non-incremental version) is fairly costly. In one case tested, using the incremental version was about 50% faster than concatenating 5-10 strings and then hashing. - -Installation ------------- - -To use iMurmurHash in the browser, [download the latest version](https://raw.github.com/jensyt/imurmurhash-js/master/imurmurhash.min.js) and include it as a script on your site. - -```html - - -``` - ---- - -To use iMurmurHash in Node.js, install the module using NPM: - -```bash -npm install imurmurhash -``` - -Then simply include it in your scripts: - -```javascript -MurmurHash3 = require('imurmurhash'); -``` - -Quick Example -------------- - -```javascript -// Create the initial hash -var hashState = MurmurHash3('string'); - -// Incrementally add text -hashState.hash('more strings'); -hashState.hash('even more strings'); - -// All calls can be chained if desired -hashState.hash('and').hash('some').hash('more'); - -// Get a result -hashState.result(); -// returns 0xe4ccfe6b -``` - -Functions ---------- - -### MurmurHash3 ([string], [seed]) -Get a hash state object, optionally initialized with the given _string_ and _seed_. _Seed_ must be a positive integer if provided. Calling this function without the `new` keyword will return a cached state object that has been reset. This is safe to use as long as the object is only used from a single thread and no other hashes are created while operating on this one. If this constraint cannot be met, you can use `new` to create a new state object. For example: - -```javascript -// Use the cached object, calling the function again will return the same -// object (but reset, so the current state would be lost) -hashState = MurmurHash3(); -... - -// Create a new object that can be safely used however you wish. Calling the -// function again will simply return a new state object, and no state loss -// will occur, at the cost of creating more objects. -hashState = new MurmurHash3(); -``` - -Both methods can be mixed however you like if you have different use cases. - ---- - -### MurmurHash3.prototype.hash (string) -Incrementally add _string_ to the hash. This can be called as many times as you want for the hash state object, including after a call to `result()`. Returns `this` so calls can be chained. - ---- - -### MurmurHash3.prototype.result () -Get the result of the hash as a 32-bit positive integer. This performs the tail and finalizer portions of the algorithm, but does not store the result in the state object. This means that it is perfectly safe to get results and then continue adding strings via `hash`. - -```javascript -// Do the whole string at once -MurmurHash3('this is a test string').result(); -// 0x70529328 - -// Do part of the string, get a result, then the other part -var m = MurmurHash3('this is a'); -m.result(); -// 0xbfc4f834 -m.hash(' test string').result(); -// 0x70529328 (same as above) -``` - ---- - -### MurmurHash3.prototype.reset ([seed]) -Reset the state object for reuse, optionally using the given _seed_ (defaults to 0 like the constructor). Returns `this` so calls can be chained. - ---- - -License (MIT) -------------- -Copyright (c) 2013 Gary Court, Jens Taylor - -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/imurmurhash/imurmurhash.js b/node_modules/imurmurhash/imurmurhash.js deleted file mode 100644 index e63146a2b..000000000 --- a/node_modules/imurmurhash/imurmurhash.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @preserve - * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) - * - * @author Jens Taylor - * @see http://github.com/homebrewing/brauhaus-diff - * @author Gary Court - * @see http://github.com/garycourt/murmurhash-js - * @author Austin Appleby - * @see http://sites.google.com/site/murmurhash/ - */ -(function(){ - var cache; - - // Call this function without `new` to use the cached object (good for - // single-threaded environments), or with `new` to create a new object. - // - // @param {string} key A UTF-16 or ASCII string - // @param {number} seed An optional positive integer - // @return {object} A MurmurHash3 object for incremental hashing - function MurmurHash3(key, seed) { - var m = this instanceof MurmurHash3 ? this : cache; - m.reset(seed) - if (typeof key === 'string' && key.length > 0) { - m.hash(key); - } - - if (m !== this) { - return m; - } - }; - - // Incrementally add a string to this hash - // - // @param {string} key A UTF-16 or ASCII string - // @return {object} this - MurmurHash3.prototype.hash = function(key) { - var h1, k1, i, top, len; - - len = key.length; - this.len += len; - - k1 = this.k1; - i = 0; - switch (this.rem) { - case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0; - case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0; - case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0; - case 3: - k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0; - k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0; - } - - this.rem = (len + this.rem) & 3; // & 3 is same as % 4 - len -= this.rem; - if (len > 0) { - h1 = this.h1; - while (1) { - k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; - k1 = (k1 << 15) | (k1 >>> 17); - k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; - - h1 ^= k1; - h1 = (h1 << 13) | (h1 >>> 19); - h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff; - - if (i >= len) { - break; - } - - k1 = ((key.charCodeAt(i++) & 0xffff)) ^ - ((key.charCodeAt(i++) & 0xffff) << 8) ^ - ((key.charCodeAt(i++) & 0xffff) << 16); - top = key.charCodeAt(i++); - k1 ^= ((top & 0xff) << 24) ^ - ((top & 0xff00) >> 8); - } - - k1 = 0; - switch (this.rem) { - case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16; - case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8; - case 1: k1 ^= (key.charCodeAt(i) & 0xffff); - } - - this.h1 = h1; - } - - this.k1 = k1; - return this; - }; - - // Get the result of this hash - // - // @return {number} The 32-bit hash - MurmurHash3.prototype.result = function() { - var k1, h1; - - k1 = this.k1; - h1 = this.h1; - - if (k1 > 0) { - k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; - k1 = (k1 << 15) | (k1 >>> 17); - k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; - h1 ^= k1; - } - - h1 ^= this.len; - - h1 ^= h1 >>> 16; - h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff; - h1 ^= h1 >>> 13; - h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff; - h1 ^= h1 >>> 16; - - return h1 >>> 0; - }; - - // Reset the hash object for reuse - // - // @param {number} seed An optional positive integer - MurmurHash3.prototype.reset = function(seed) { - this.h1 = typeof seed === 'number' ? seed : 0; - this.rem = this.k1 = this.len = 0; - return this; - }; - - // A cached object to use. This can be safely used if you're in a single- - // threaded environment, otherwise you need to create new hashes to use. - cache = new MurmurHash3(); - - if (typeof(module) != 'undefined') { - module.exports = MurmurHash3; - } else { - this.MurmurHash3 = MurmurHash3; - } -}()); diff --git a/node_modules/imurmurhash/imurmurhash.min.js b/node_modules/imurmurhash/imurmurhash.min.js deleted file mode 100644 index dc0ee88d6..000000000 --- a/node_modules/imurmurhash/imurmurhash.min.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @preserve - * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) - * - * @author Jens Taylor - * @see http://github.com/homebrewing/brauhaus-diff - * @author Gary Court - * @see http://github.com/garycourt/murmurhash-js - * @author Austin Appleby - * @see http://sites.google.com/site/murmurhash/ - */ -!function(){function t(h,r){var s=this instanceof t?this:e;return s.reset(r),"string"==typeof h&&h.length>0&&s.hash(h),s!==this?s:void 0}var e;t.prototype.hash=function(t){var e,h,r,s,i;switch(i=t.length,this.len+=i,h=this.k1,r=0,this.rem){case 0:h^=i>r?65535&t.charCodeAt(r++):0;case 1:h^=i>r?(65535&t.charCodeAt(r++))<<8:0;case 2:h^=i>r?(65535&t.charCodeAt(r++))<<16:0;case 3:h^=i>r?(255&t.charCodeAt(r))<<24:0,h^=i>r?(65280&t.charCodeAt(r++))>>8:0}if(this.rem=3&i+this.rem,i-=this.rem,i>0){for(e=this.h1;;){if(h=4294967295&11601*h+3432906752*(65535&h),h=h<<15|h>>>17,h=4294967295&13715*h+461832192*(65535&h),e^=h,e=e<<13|e>>>19,e=4294967295&5*e+3864292196,r>=i)break;h=65535&t.charCodeAt(r++)^(65535&t.charCodeAt(r++))<<8^(65535&t.charCodeAt(r++))<<16,s=t.charCodeAt(r++),h^=(255&s)<<24^(65280&s)>>8}switch(h=0,this.rem){case 3:h^=(65535&t.charCodeAt(r+2))<<16;case 2:h^=(65535&t.charCodeAt(r+1))<<8;case 1:h^=65535&t.charCodeAt(r)}this.h1=e}return this.k1=h,this},t.prototype.result=function(){var t,e;return t=this.k1,e=this.h1,t>0&&(t=4294967295&11601*t+3432906752*(65535&t),t=t<<15|t>>>17,t=4294967295&13715*t+461832192*(65535&t),e^=t),e^=this.len,e^=e>>>16,e=4294967295&51819*e+2246770688*(65535&e),e^=e>>>13,e=4294967295&44597*e+3266445312*(65535&e),e^=e>>>16,e>>>0},t.prototype.reset=function(t){return this.h1="number"==typeof t?t:0,this.rem=this.k1=this.len=0,this},e=new t,"undefined"!=typeof module?module.exports=t:this.MurmurHash3=t}(); \ No newline at end of file diff --git a/node_modules/imurmurhash/package.json b/node_modules/imurmurhash/package.json deleted file mode 100644 index 8a93edb55..000000000 --- a/node_modules/imurmurhash/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "imurmurhash", - "version": "0.1.4", - "description": "An incremental implementation of MurmurHash3", - "homepage": "https://github.com/jensyt/imurmurhash-js", - "main": "imurmurhash.js", - "files": [ - "imurmurhash.js", - "imurmurhash.min.js", - "package.json", - "README.md" - ], - "repository": { - "type": "git", - "url": "https://github.com/jensyt/imurmurhash-js" - }, - "bugs": { - "url": "https://github.com/jensyt/imurmurhash-js/issues" - }, - "keywords": [ - "murmur", - "murmurhash", - "murmurhash3", - "hash", - "incremental" - ], - "author": { - "name": "Jens Taylor", - "email": "jensyt@gmail.com", - "url": "https://github.com/homebrewing" - }, - "license": "MIT", - "dependencies": { - }, - "devDependencies": { - }, - "engines": { - "node": ">=0.8.19" - } -} diff --git a/node_modules/inflight/LICENSE b/node_modules/inflight/LICENSE deleted file mode 100644 index 05eeeb88c..000000000 --- a/node_modules/inflight/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 6dc892917..000000000 --- a/node_modules/inflight/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# 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 deleted file mode 100644 index 48202b3ca..000000000 --- a/node_modules/inflight/inflight.js +++ /dev/null @@ -1,54 +0,0 @@ -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 deleted file mode 100644 index 6084d3509..000000000 --- a/node_modules/inflight/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "inflight", - "version": "1.0.6", - "description": "Add callbacks to requests in flight to avoid async duplication", - "main": "inflight.js", - "files": [ - "inflight.js" - ], - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - }, - "devDependencies": { - "tap": "^7.1.2" - }, - "scripts": { - "test": "tap test.js --100" - }, - "repository": { - "type": "git", - "url": "https://github.com/npm/inflight.git" - }, - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "bugs": { - "url": "https://github.com/isaacs/inflight/issues" - }, - "homepage": "https://github.com/isaacs/inflight", - "license": "ISC" -} diff --git a/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE deleted file mode 100644 index dea3013d6..000000000 --- a/node_modules/inherits/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index b1c566585..000000000 --- a/node_modules/inherits/README.md +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index f71f2d932..000000000 --- a/node_modules/inherits/inherits.js +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100644 index 86bbb3dc2..000000000 --- a/node_modules/inherits/inherits_browser.js +++ /dev/null @@ -1,27 +0,0 @@ -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 deleted file mode 100644 index 37b4366b8..000000000 --- a/node_modules/inherits/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "inherits", - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "version": "2.0.4", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "main": "./inherits.js", - "browser": "./inherits_browser.js", - "repository": "git://github.com/isaacs/inherits", - "license": "ISC", - "scripts": { - "test": "tap" - }, - "devDependencies": { - "tap": "^14.2.4" - }, - "files": [ - "inherits.js", - "inherits_browser.js" - ] -} diff --git a/node_modules/is-arrayish/.editorconfig b/node_modules/is-arrayish/.editorconfig deleted file mode 100644 index 4c017f8ad..000000000 --- a/node_modules/is-arrayish/.editorconfig +++ /dev/null @@ -1,18 +0,0 @@ -root = true - -[*] -indent_style = tab -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.coffee] -indent_style = space - -[{package.json,*.yml}] -indent_style = space -indent_size = 2 - -[*.md] -trim_trailing_whitespace = false diff --git a/node_modules/is-arrayish/.istanbul.yml b/node_modules/is-arrayish/.istanbul.yml deleted file mode 100644 index 19fbec32b..000000000 --- a/node_modules/is-arrayish/.istanbul.yml +++ /dev/null @@ -1,4 +0,0 @@ -instrumentation: - excludes: - - test.js - - test/**/* diff --git a/node_modules/is-arrayish/.npmignore b/node_modules/is-arrayish/.npmignore deleted file mode 100644 index 8d5eacb3e..000000000 --- a/node_modules/is-arrayish/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -/coverage/ -/test.js -/test/ -*.sw[a-p] -/node_modules/ diff --git a/node_modules/is-arrayish/.travis.yml b/node_modules/is-arrayish/.travis.yml deleted file mode 100644 index 5a0424350..000000000 --- a/node_modules/is-arrayish/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: node_js - -script: - - node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --compilers coffee:coffee-script/register - - cat coverage/lcov.info | node_modules/.bin/coveralls -node_js: - - "0.10" - - "0.11" - - "0.12" - - "iojs" -os: - - linux - - osx - -notifications: - slack: - secure: oOt8QGzdrPDsTMcyahtIq5Q+0U1iwfgJgFCxBLsomQ0bpIMn+y5m4viJydA2UinHPGc944HS3LMZS9iKQyv+DjTgbhUyNXqeVjtxCwRe37f5rKQlXVvdfmjHk2kln4H8DcK3r5Qd/+2hd9BeMsp2GImTrkRSud1CZQlhhe5IgZOboSoWpGVMMy1iazWT06tAtiB2LRVhmsdUaFZDWAhGZ+UAvCPf+mnBOAylIj+U0GDrofhfTi25RK0gddG2f/p2M1HCu49O6wECGWkt2hVei233DkNJyLLLJVcvmhf+aXkV5TjMyaoxh/HdcV4DrA7KvYuWmWWKsINa9hlwAsdd/FYmJ6PjRkKWas2JoQ1C+qOzDxyQvn3CaUZFKD99pdsq0rBBZujqXQKZZ/hWb/CE74BI6fKmqQkiEPaD/7uADj04FEg6HVBZaMCyauOaK5b3VC97twbALZ1qVxYV6mU+zSEvnUbpnjjvRO0fSl9ZHA+rzkW73kX3GmHY0wAozEZbSy7QLuZlQ2QtHmBLr+APaGMdL1sFF9qFfzqKy0WDbSE0WS6hpAEJpTsjYmeBrnI8UmK3m++iEgyQPvZoH9LhUT+ek7XIfHZMe04BmC6wuO24/RfpmR6bQK9VMarFCYlBiWxg/z30vkP0KTpUi3o/cqFm7/Noxc0i2LVqM3E0Sy4= diff --git a/node_modules/is-arrayish/LICENSE b/node_modules/is-arrayish/LICENSE deleted file mode 100644 index 0a5f461a6..000000000 --- a/node_modules/is-arrayish/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 JD Ballard - -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/is-arrayish/README.md b/node_modules/is-arrayish/README.md deleted file mode 100644 index 7d360724c..000000000 --- a/node_modules/is-arrayish/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# node-is-arrayish [![Travis-CI.org Build Status](https://img.shields.io/travis/Qix-/node-is-arrayish.svg?style=flat-square)](https://travis-ci.org/Qix-/node-is-arrayish) [![Coveralls.io Coverage Rating](https://img.shields.io/coveralls/Qix-/node-is-arrayish.svg?style=flat-square)](https://coveralls.io/r/Qix-/node-is-arrayish) -> Determines if an object can be used like an Array - -## Example -```javascript -var isArrayish = require('is-arrayish'); - -isArrayish([]); // true -isArrayish({__proto__: []}); // true -isArrayish({}); // false -isArrayish({length:10}); // false -``` - -## License -Licensed under the [MIT License](http://opensource.org/licenses/MIT). -You can find a copy of it in [LICENSE](LICENSE). diff --git a/node_modules/is-arrayish/index.js b/node_modules/is-arrayish/index.js deleted file mode 100644 index 5b971868b..000000000 --- a/node_modules/is-arrayish/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = function isArrayish(obj) { - if (!obj) { - return false; - } - - return obj instanceof Array || Array.isArray(obj) || - (obj.length >= 0 && obj.splice instanceof Function); -}; diff --git a/node_modules/is-arrayish/package.json b/node_modules/is-arrayish/package.json deleted file mode 100644 index 8b2d1c308..000000000 --- a/node_modules/is-arrayish/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "is-arrayish", - "description": "Determines if an object can be used as an array", - "version": "0.2.1", - "author": "Qix (http://github.com/qix-)", - "keywords": [ - "is", - "array", - "duck", - "type", - "arrayish", - "similar", - "proto", - "prototype", - "type" - ], - "license": "MIT", - "scripts": { - "pretest": "xo", - "test": "mocha --compilers coffee:coffee-script/register" - }, - "repository": { - "type": "git", - "url": "https://github.com/qix-/node-is-arrayish.git" - }, - "devDependencies": { - "coffee-script": "^1.9.3", - "coveralls": "^2.11.2", - "istanbul": "^0.3.17", - "mocha": "^2.2.5", - "should": "^7.0.1", - "xo": "^0.6.1" - } -} diff --git a/node_modules/is-core-module/.eslintrc b/node_modules/is-core-module/.eslintrc deleted file mode 100644 index f2e072681..000000000 --- a/node_modules/is-core-module/.eslintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "@ljharb", - "root": true, - "rules": { - "func-style": 1, - }, - "overrides": [ - { - "files": "test/**", - "rules": { - "global-require": 0, - "max-depth": 0, - "max-lines-per-function": 0, - "no-negated-condition": 0, - }, - }, - ], -} diff --git a/node_modules/is-core-module/.nycrc b/node_modules/is-core-module/.nycrc deleted file mode 100644 index bdd626ce9..000000000 --- a/node_modules/is-core-module/.nycrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "all": true, - "check-coverage": false, - "reporter": ["text-summary", "text", "html", "json"], - "exclude": [ - "coverage", - "test" - ] -} diff --git a/node_modules/is-core-module/CHANGELOG.md b/node_modules/is-core-module/CHANGELOG.md deleted file mode 100644 index 028384aee..000000000 --- a/node_modules/is-core-module/CHANGELOG.md +++ /dev/null @@ -1,166 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [v2.12.1](https://github.com/inspect-js/is-core-module/compare/v2.12.0...v2.12.1) - 2023-05-16 - -### Commits - -- [Fix] `test/reporters` now requires the `node:` prefix as of v20.2 [`12183d0`](https://github.com/inspect-js/is-core-module/commit/12183d0d8e4edf56b6ce18a1b3be54bfce10175b) - -## [v2.12.0](https://github.com/inspect-js/is-core-module/compare/v2.11.0...v2.12.0) - 2023-04-10 - -### Commits - -- [actions] update rebase action to use reusable workflow [`c0a7251`](https://github.com/inspect-js/is-core-module/commit/c0a7251f734f3c621932c5fcdfd1bf966b42ca32) -- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9ae8b7f`](https://github.com/inspect-js/is-core-module/commit/9ae8b7fac03c369861d0991b4a2ce8d4848e6a7d) -- [New] `test/reporters` added in v19.9, `wasi` added in v20 [`9d5341a`](https://github.com/inspect-js/is-core-module/commit/9d5341ab32053f25b7fa7db3c0e18461db24a79c) -- [Dev Deps] add missing `in-publish` dep [`5980245`](https://github.com/inspect-js/is-core-module/commit/59802456e9ac919fa748f53be9d8fbf304a197df) - -## [v2.11.0](https://github.com/inspect-js/is-core-module/compare/v2.10.0...v2.11.0) - 2022-10-18 - -### Commits - -- [meta] use `npmignore` to autogenerate an npmignore file [`3360011`](https://github.com/inspect-js/is-core-module/commit/33600118857b46177178072fba2affcdeb009d12) -- [Dev Deps] update `aud`, `tape` [`651c6b0`](https://github.com/inspect-js/is-core-module/commit/651c6b0cc2799d4130866cf43ad333dcade3d26c) -- [New] `inspector/promises` and `node:inspector/promises` is now available in node 19 [`22d332f`](https://github.com/inspect-js/is-core-module/commit/22d332fe22ac050305444e0781ff85af819abcb0) - -## [v2.10.0](https://github.com/inspect-js/is-core-module/compare/v2.9.0...v2.10.0) - 2022-08-03 - -### Commits - -- [New] `node:test` is now available in node ^16.17 [`e8fd36e`](https://github.com/inspect-js/is-core-module/commit/e8fd36e9b86c917775a07cc473b62a3294f459f2) -- [Tests] improve skip message [`c014a4c`](https://github.com/inspect-js/is-core-module/commit/c014a4c0cd6eb15fff573ae4709191775e70cab4) - -## [v2.9.0](https://github.com/inspect-js/is-core-module/compare/v2.8.1...v2.9.0) - 2022-04-19 - -### Commits - -- [New] add `node:test`, in node 18+ [`f853eca`](https://github.com/inspect-js/is-core-module/commit/f853eca801d0a7d4e1dbb670f1b6d9837d9533c5) -- [Tests] use `mock-property` [`03b3644`](https://github.com/inspect-js/is-core-module/commit/03b3644dff4417f4ba5a7d0aa0138f5f6b3e5c46) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`7c0e2d0`](https://github.com/inspect-js/is-core-module/commit/7c0e2d06ed2a89acf53abe2ab34d703ed5b03455) -- [meta] simplify "exports" [`d6ed201`](https://github.com/inspect-js/is-core-module/commit/d6ed201eba7fbba0e59814a9050fc49a6e9878c8) - -## [v2.8.1](https://github.com/inspect-js/is-core-module/compare/v2.8.0...v2.8.1) - 2022-01-05 - -### Commits - -- [actions] reuse common workflows [`cd2cf9b`](https://github.com/inspect-js/is-core-module/commit/cd2cf9b3b66c8d328f65610efe41e9325db7716d) -- [Fix] update node 0.4 results [`062195d`](https://github.com/inspect-js/is-core-module/commit/062195d89f0876a88b95d378b43f7fcc1205bc5b) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`0790b62`](https://github.com/inspect-js/is-core-module/commit/0790b6222848c6167132f9f73acc3520fa8d1298) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`7d139a6`](https://github.com/inspect-js/is-core-module/commit/7d139a6d767709eabf0a0251e074ec1fb230c06e) -- [Tests] run `nyc` in `tests-only`, not `test` [`780e8a0`](https://github.com/inspect-js/is-core-module/commit/780e8a049951c71cf78b1707f0871c48a28bde14) - -## [v2.8.0](https://github.com/inspect-js/is-core-module/compare/v2.7.0...v2.8.0) - 2021-10-14 - -### Commits - -- [actions] update codecov uploader [`0cfe94e`](https://github.com/inspect-js/is-core-module/commit/0cfe94e106a7d005ea03e008c0a21dec13a77904) -- [New] add `readline/promises` to node v17+ [`4f78c30`](https://github.com/inspect-js/is-core-module/commit/4f78c3008b1b58b4db6dc91d99610b1bc859da7e) -- [Tests] node ^14.18 supports `node:` prefixes for CJS [`43e2f17`](https://github.com/inspect-js/is-core-module/commit/43e2f177452cea2f0eaf34f61b5407217bbdb6f4) - -## [v2.7.0](https://github.com/inspect-js/is-core-module/compare/v2.6.0...v2.7.0) - 2021-09-27 - -### Commits - -- [New] node `v14.18` added `node:`-prefixed core modules to `require` [`6d943ab`](https://github.com/inspect-js/is-core-module/commit/6d943abe81382b9bbe344384d80fbfebe1cc0526) -- [Tests] add coverage for Object.prototype pollution [`c6baf5f`](https://github.com/inspect-js/is-core-module/commit/c6baf5f942311a1945c1af41167bb80b84df2af7) -- [Dev Deps] update `@ljharb/eslint-config` [`6717f00`](https://github.com/inspect-js/is-core-module/commit/6717f000d063ea57beb772bded36c2f056ac404c) -- [eslint] fix linter warning [`594c10b`](https://github.com/inspect-js/is-core-module/commit/594c10bb7d39d7eb00925c90924199ff596184b2) -- [meta] add `sideEffects` flag [`c32cfa5`](https://github.com/inspect-js/is-core-module/commit/c32cfa5195632944c4dd4284a142b8476e75be13) - -## [v2.6.0](https://github.com/inspect-js/is-core-module/compare/v2.5.0...v2.6.0) - 2021-08-17 - -### Commits - -- [Dev Deps] update `eslint`, `tape` [`6cc928f`](https://github.com/inspect-js/is-core-module/commit/6cc928f8a4bba66aeeccc4f6beeac736d4bd3081) -- [New] add `stream/consumers` to node `>= 16.7` [`a1a423e`](https://github.com/inspect-js/is-core-module/commit/a1a423e467e4cc27df180234fad5bab45943e67d) -- [Refactor] Remove duplicated `&&` operand [`86faea7`](https://github.com/inspect-js/is-core-module/commit/86faea738213a2433c62d1098488dc9314dca832) -- [Tests] include prereleases [`a4da7a6`](https://github.com/inspect-js/is-core-module/commit/a4da7a6abf7568e2aa4fd98e69452179f1850963) - -## [v2.5.0](https://github.com/inspect-js/is-core-module/compare/v2.4.0...v2.5.0) - 2021-07-12 - -### Commits - -- [Dev Deps] update `auto-changelog`, `eslint` [`6334cc9`](https://github.com/inspect-js/is-core-module/commit/6334cc94f3af7469685bd8f236740991baaf2705) -- [New] add `stream/web` to node v16.5+ [`17ac59b`](https://github.com/inspect-js/is-core-module/commit/17ac59b662d63e220a2e5728625f005c24f177b2) - -## [v2.4.0](https://github.com/inspect-js/is-core-module/compare/v2.3.0...v2.4.0) - 2021-05-09 - -### Commits - -- [readme] add actions and codecov badges [`82b7faa`](https://github.com/inspect-js/is-core-module/commit/82b7faa12b56dbe47fbea67e1a5b9e447027ba40) -- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`8096868`](https://github.com/inspect-js/is-core-module/commit/8096868c024a161ccd4d44110b136763e92eace8) -- [Dev Deps] update `eslint` [`6726824`](https://github.com/inspect-js/is-core-module/commit/67268249b88230018c510f6532a8046d7326346f) -- [New] add `diagnostics_channel` to node `^14.17` [`86c6563`](https://github.com/inspect-js/is-core-module/commit/86c65634201b8ff9b3e48a9a782594579c7f5c3c) -- [meta] fix prepublish script [`697a01e`](https://github.com/inspect-js/is-core-module/commit/697a01e3c9c0be074066520954f30fb28532ec57) - -## [v2.3.0](https://github.com/inspect-js/is-core-module/compare/v2.2.0...v2.3.0) - 2021-04-24 - -### Commits - -- [meta] do not publish github action workflow files [`060d4bb`](https://github.com/inspect-js/is-core-module/commit/060d4bb971a29451c19ff336eb56bee27f9fa95a) -- [New] add support for `node:` prefix, in node 16+ [`7341223`](https://github.com/inspect-js/is-core-module/commit/73412230a769f6e81c05eea50b6520cebf54ed2f) -- [actions] use `node/install` instead of `node/run`; use `codecov` action [`016269a`](https://github.com/inspect-js/is-core-module/commit/016269abae9f6657a5254adfbb813f09a05067f9) -- [patch] remove unneeded `.0` in version ranges [`cb466a6`](https://github.com/inspect-js/is-core-module/commit/cb466a6d89e52b8389e5c12715efcd550c41cea3) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`c9f9c39`](https://github.com/inspect-js/is-core-module/commit/c9f9c396ace60ef81906f98059c064e6452473ed) -- [actions] update workflows [`3ee4a89`](https://github.com/inspect-js/is-core-module/commit/3ee4a89fd5a02fccd43882d905448ea6a98e9a3c) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`dee4fed`](https://github.com/inspect-js/is-core-module/commit/dee4fed79690c1d43a22f7fa9426abebdc6d727f) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`7d046ba`](https://github.com/inspect-js/is-core-module/commit/7d046ba07ae8c9292e43652694ca808d7b309de8) -- [meta] use `prepublishOnly` script for npm 7+ [`149e677`](https://github.com/inspect-js/is-core-module/commit/149e6771a5ede6d097e71785b467a9c4b4977cc7) -- [readme] remove travis badge [`903b51d`](https://github.com/inspect-js/is-core-module/commit/903b51d6b69b98abeabfbc3695c345b02646f19c) - -## [v2.2.0](https://github.com/inspect-js/is-core-module/compare/v2.1.0...v2.2.0) - 2020-11-26 - -### Commits - -- [Tests] migrate tests to Github Actions [`c919f57`](https://github.com/inspect-js/is-core-module/commit/c919f573c0a92d10a0acad0b650b5aecb033d426) -- [patch] `core.json`: %s/ /\t/g [`db3f685`](https://github.com/inspect-js/is-core-module/commit/db3f68581f53e73cc09cd675955eb1bdd6a5a39b) -- [Tests] run `nyc` on all tests [`b2f925f`](https://github.com/inspect-js/is-core-module/commit/b2f925f8866f210ef441f39fcc8cc42692ab89b1) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`; add `safe-publish-latest` [`89f02a2`](https://github.com/inspect-js/is-core-module/commit/89f02a2b4162246dea303a6ee31bb9a550b05c72) -- [New] add `path/posix`, `path/win32`, `util/types` [`77f94f1`](https://github.com/inspect-js/is-core-module/commit/77f94f1e90ffd7c0be2a3f1aa8574ebf7fd981b3) - -## [v2.1.0](https://github.com/inspect-js/is-core-module/compare/v2.0.0...v2.1.0) - 2020-11-04 - -### Commits - -- [Dev Deps] update `eslint` [`5e0034e`](https://github.com/inspect-js/is-core-module/commit/5e0034eae57c09c8f1bd769f502486a00f56c6e4) -- [New] Add `diagnostics_channel` [`c2d83d0`](https://github.com/inspect-js/is-core-module/commit/c2d83d0a0225a1a658945d9bab7036ea347d29ec) - -## [v2.0.0](https://github.com/inspect-js/is-core-module/compare/v1.0.2...v2.0.0) - 2020-09-29 - -### Commits - -- v2 implementation [`865aeb5`](https://github.com/inspect-js/is-core-module/commit/865aeb5ca0e90248a3dfff5d7622e4751fdeb9cd) -- Only apps should have lockfiles [`5a5e660`](https://github.com/inspect-js/is-core-module/commit/5a5e660d568e37eb44e17fb1ebb12a105205fc2b) -- Initial commit for v2 [`5a51524`](https://github.com/inspect-js/is-core-module/commit/5a51524e06f92adece5fbb138c69b7b9748a2348) -- Tests [`116eae4`](https://github.com/inspect-js/is-core-module/commit/116eae4fccd01bc72c1fd3cc4b7561c387afc496) -- [meta] add `auto-changelog` [`c24388b`](https://github.com/inspect-js/is-core-module/commit/c24388bee828d223040519d1f5b226ca35beee63) -- [actions] add "Automatic Rebase" and "require allow edits" actions [`34292db`](https://github.com/inspect-js/is-core-module/commit/34292dbcbadae0868aff03c22dbd8b7b8a11558a) -- [Tests] add `npm run lint` [`4f9eeee`](https://github.com/inspect-js/is-core-module/commit/4f9eeee7ddff10698bbf528620f4dc8d4fa3e697) -- [readme] fix travis badges, https all URLs [`e516a73`](https://github.com/inspect-js/is-core-module/commit/e516a73b0dccce20938c432b1ba512eae8eff9e9) -- [meta] create FUNDING.yml [`1aabebc`](https://github.com/inspect-js/is-core-module/commit/1aabebca98d01f8a04e46bc2e2520fa93cf21ac6) -- [Fix] `domain`: domain landed sometime > v0.7.7 and <= v0.7.12 [`2df7d37`](https://github.com/inspect-js/is-core-module/commit/2df7d37595d41b15eeada732b706b926c2771655) -- [Fix] `sys`: worked in 0.6, not 0.7, and 0.8+ [`a75c134`](https://github.com/inspect-js/is-core-module/commit/a75c134229e1e9441801f6b73f6a52489346eb65) - -## [v1.0.2](https://github.com/inspect-js/is-core-module/compare/v1.0.1...v1.0.2) - 2014-09-28 - -### Commits - -- simpler [`66fe90f`](https://github.com/inspect-js/is-core-module/commit/66fe90f9771581b9adc0c3900baa52c21b5baea2) - -## [v1.0.1](https://github.com/inspect-js/is-core-module/compare/v1.0.0...v1.0.1) - 2014-09-28 - -### Commits - -- remove stupid [`f21f906`](https://github.com/inspect-js/is-core-module/commit/f21f906f882c2bd656a5fc5ed6fbe48ddaffb2ac) -- update readme [`1eff0ec`](https://github.com/inspect-js/is-core-module/commit/1eff0ec69798d1ec65771552d1562911e90a8027) - -## v1.0.0 - 2014-09-28 - -### Commits - -- init [`48e5e76`](https://github.com/inspect-js/is-core-module/commit/48e5e76cac378fddb8c1f7d4055b8dfc943d6b96) diff --git a/node_modules/is-core-module/LICENSE b/node_modules/is-core-module/LICENSE deleted file mode 100644 index 2e502872a..000000000 --- a/node_modules/is-core-module/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Dave Justice - -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/is-core-module/README.md b/node_modules/is-core-module/README.md deleted file mode 100644 index 062d9068e..000000000 --- a/node_modules/is-core-module/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# is-core-module [![Version Badge][2]][1] - -[![github actions][actions-image]][actions-url] -[![coverage][codecov-image]][codecov-url] -[![dependency status][5]][6] -[![dev dependency status][7]][8] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][11]][1] - -Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version. - -## Example - -```js -var isCore = require('is-core-module'); -var assert = require('assert'); -assert(isCore('fs')); -assert(!isCore('butts')); -``` - -## Tests -Clone the repo, `npm install`, and run `npm test` - -[1]: https://npmjs.org/package/is-core-module -[2]: https://versionbadg.es/inspect-js/is-core-module.svg -[5]: https://david-dm.org/inspect-js/is-core-module.svg -[6]: https://david-dm.org/inspect-js/is-core-module -[7]: https://david-dm.org/inspect-js/is-core-module/dev-status.svg -[8]: https://david-dm.org/inspect-js/is-core-module#info=devDependencies -[11]: https://nodei.co/npm/is-core-module.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/is-core-module.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/is-core-module.svg -[downloads-url]: https://npm-stat.com/charts.html?package=is-core-module -[codecov-image]: https://codecov.io/gh/inspect-js/is-core-module/branch/main/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/inspect-js/is-core-module/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-core-module -[actions-url]: https://github.com/inspect-js/is-core-module/actions diff --git a/node_modules/is-core-module/core.json b/node_modules/is-core-module/core.json deleted file mode 100644 index af29f0b73..000000000 --- a/node_modules/is-core-module/core.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "assert": true, - "node:assert": [">= 14.18 && < 15", ">= 16"], - "assert/strict": ">= 15", - "node:assert/strict": ">= 16", - "async_hooks": ">= 8", - "node:async_hooks": [">= 14.18 && < 15", ">= 16"], - "buffer_ieee754": ">= 0.5 && < 0.9.7", - "buffer": true, - "node:buffer": [">= 14.18 && < 15", ">= 16"], - "child_process": true, - "node:child_process": [">= 14.18 && < 15", ">= 16"], - "cluster": ">= 0.5", - "node:cluster": [">= 14.18 && < 15", ">= 16"], - "console": true, - "node:console": [">= 14.18 && < 15", ">= 16"], - "constants": true, - "node:constants": [">= 14.18 && < 15", ">= 16"], - "crypto": true, - "node:crypto": [">= 14.18 && < 15", ">= 16"], - "_debug_agent": ">= 1 && < 8", - "_debugger": "< 8", - "dgram": true, - "node:dgram": [">= 14.18 && < 15", ">= 16"], - "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], - "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"], - "dns": true, - "node:dns": [">= 14.18 && < 15", ">= 16"], - "dns/promises": ">= 15", - "node:dns/promises": ">= 16", - "domain": ">= 0.7.12", - "node:domain": [">= 14.18 && < 15", ">= 16"], - "events": true, - "node:events": [">= 14.18 && < 15", ">= 16"], - "freelist": "< 6", - "fs": true, - "node:fs": [">= 14.18 && < 15", ">= 16"], - "fs/promises": [">= 10 && < 10.1", ">= 14"], - "node:fs/promises": [">= 14.18 && < 15", ">= 16"], - "_http_agent": ">= 0.11.1", - "node:_http_agent": [">= 14.18 && < 15", ">= 16"], - "_http_client": ">= 0.11.1", - "node:_http_client": [">= 14.18 && < 15", ">= 16"], - "_http_common": ">= 0.11.1", - "node:_http_common": [">= 14.18 && < 15", ">= 16"], - "_http_incoming": ">= 0.11.1", - "node:_http_incoming": [">= 14.18 && < 15", ">= 16"], - "_http_outgoing": ">= 0.11.1", - "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"], - "_http_server": ">= 0.11.1", - "node:_http_server": [">= 14.18 && < 15", ">= 16"], - "http": true, - "node:http": [">= 14.18 && < 15", ">= 16"], - "http2": ">= 8.8", - "node:http2": [">= 14.18 && < 15", ">= 16"], - "https": true, - "node:https": [">= 14.18 && < 15", ">= 16"], - "inspector": ">= 8", - "node:inspector": [">= 14.18 && < 15", ">= 16"], - "inspector/promises": [">= 19"], - "node:inspector/promises": [">= 19"], - "_linklist": "< 8", - "module": true, - "node:module": [">= 14.18 && < 15", ">= 16"], - "net": true, - "node:net": [">= 14.18 && < 15", ">= 16"], - "node-inspect/lib/_inspect": ">= 7.6 && < 12", - "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", - "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", - "os": true, - "node:os": [">= 14.18 && < 15", ">= 16"], - "path": true, - "node:path": [">= 14.18 && < 15", ">= 16"], - "path/posix": ">= 15.3", - "node:path/posix": ">= 16", - "path/win32": ">= 15.3", - "node:path/win32": ">= 16", - "perf_hooks": ">= 8.5", - "node:perf_hooks": [">= 14.18 && < 15", ">= 16"], - "process": ">= 1", - "node:process": [">= 14.18 && < 15", ">= 16"], - "punycode": ">= 0.5", - "node:punycode": [">= 14.18 && < 15", ">= 16"], - "querystring": true, - "node:querystring": [">= 14.18 && < 15", ">= 16"], - "readline": true, - "node:readline": [">= 14.18 && < 15", ">= 16"], - "readline/promises": ">= 17", - "node:readline/promises": ">= 17", - "repl": true, - "node:repl": [">= 14.18 && < 15", ">= 16"], - "smalloc": ">= 0.11.5 && < 3", - "_stream_duplex": ">= 0.9.4", - "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"], - "_stream_transform": ">= 0.9.4", - "node:_stream_transform": [">= 14.18 && < 15", ">= 16"], - "_stream_wrap": ">= 1.4.1", - "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"], - "_stream_passthrough": ">= 0.9.4", - "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"], - "_stream_readable": ">= 0.9.4", - "node:_stream_readable": [">= 14.18 && < 15", ">= 16"], - "_stream_writable": ">= 0.9.4", - "node:_stream_writable": [">= 14.18 && < 15", ">= 16"], - "stream": true, - "node:stream": [">= 14.18 && < 15", ">= 16"], - "stream/consumers": ">= 16.7", - "node:stream/consumers": ">= 16.7", - "stream/promises": ">= 15", - "node:stream/promises": ">= 16", - "stream/web": ">= 16.5", - "node:stream/web": ">= 16.5", - "string_decoder": true, - "node:string_decoder": [">= 14.18 && < 15", ">= 16"], - "sys": [">= 0.4 && < 0.7", ">= 0.8"], - "node:sys": [">= 14.18 && < 15", ">= 16"], - "test/reporters": ">= 19.9 && < 20.2", - "node:test/reporters": [">= 19.9", ">= 20"], - "node:test": [">= 16.17 && < 17", ">= 18"], - "timers": true, - "node:timers": [">= 14.18 && < 15", ">= 16"], - "timers/promises": ">= 15", - "node:timers/promises": ">= 16", - "_tls_common": ">= 0.11.13", - "node:_tls_common": [">= 14.18 && < 15", ">= 16"], - "_tls_legacy": ">= 0.11.3 && < 10", - "_tls_wrap": ">= 0.11.3", - "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"], - "tls": true, - "node:tls": [">= 14.18 && < 15", ">= 16"], - "trace_events": ">= 10", - "node:trace_events": [">= 14.18 && < 15", ">= 16"], - "tty": true, - "node:tty": [">= 14.18 && < 15", ">= 16"], - "url": true, - "node:url": [">= 14.18 && < 15", ">= 16"], - "util": true, - "node:util": [">= 14.18 && < 15", ">= 16"], - "util/types": ">= 15.3", - "node:util/types": ">= 16", - "v8/tools/arguments": ">= 10 && < 12", - "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], - "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], - "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], - "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], - "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], - "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], - "v8": ">= 1", - "node:v8": [">= 14.18 && < 15", ">= 16"], - "vm": true, - "node:vm": [">= 14.18 && < 15", ">= 16"], - "wasi": [">= 13.4 && < 13.5", ">= 20"], - "node:wasi": ">= 20", - "worker_threads": ">= 11.7", - "node:worker_threads": [">= 14.18 && < 15", ">= 16"], - "zlib": ">= 0.5", - "node:zlib": [">= 14.18 && < 15", ">= 16"] -} diff --git a/node_modules/is-core-module/index.js b/node_modules/is-core-module/index.js deleted file mode 100644 index f9637e0e7..000000000 --- a/node_modules/is-core-module/index.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -var has = require('has'); - -function specifierIncluded(current, specifier) { - var nodeParts = current.split('.'); - var parts = specifier.split(' '); - var op = parts.length > 1 ? parts[0] : '='; - var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); - - for (var i = 0; i < 3; ++i) { - var cur = parseInt(nodeParts[i] || 0, 10); - var ver = parseInt(versionParts[i] || 0, 10); - if (cur === ver) { - continue; // eslint-disable-line no-restricted-syntax, no-continue - } - if (op === '<') { - return cur < ver; - } - if (op === '>=') { - return cur >= ver; - } - return false; - } - return op === '>='; -} - -function matchesRange(current, range) { - var specifiers = range.split(/ ?&& ?/); - if (specifiers.length === 0) { - return false; - } - for (var i = 0; i < specifiers.length; ++i) { - if (!specifierIncluded(current, specifiers[i])) { - return false; - } - } - return true; -} - -function versionIncluded(nodeVersion, specifierValue) { - if (typeof specifierValue === 'boolean') { - return specifierValue; - } - - var current = typeof nodeVersion === 'undefined' - ? process.versions && process.versions.node - : nodeVersion; - - if (typeof current !== 'string') { - throw new TypeError(typeof nodeVersion === 'undefined' ? 'Unable to determine current node version' : 'If provided, a valid node version is required'); - } - - if (specifierValue && typeof specifierValue === 'object') { - for (var i = 0; i < specifierValue.length; ++i) { - if (matchesRange(current, specifierValue[i])) { - return true; - } - } - return false; - } - return matchesRange(current, specifierValue); -} - -var data = require('./core.json'); - -module.exports = function isCore(x, nodeVersion) { - return has(data, x) && versionIncluded(nodeVersion, data[x]); -}; diff --git a/node_modules/is-core-module/package.json b/node_modules/is-core-module/package.json deleted file mode 100644 index 62bb065e8..000000000 --- a/node_modules/is-core-module/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "is-core-module", - "version": "2.12.1", - "description": "Is this specifier a node.js core module?", - "main": "index.js", - "sideEffects": false, - "exports": { - ".": "./index.js", - "./package.json": "./package.json" - }, - "scripts": { - "prepack": "npmignore --auto --commentLines=autogenerated", - "prepublish": "not-in-publish || npm run prepublishOnly", - "prepublishOnly": "safe-publish-latest", - "lint": "eslint .", - "pretest": "npm run lint", - "tests-only": "nyc tape 'test/**/*.js'", - "test": "npm run tests-only", - "posttest": "aud --production", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/inspect-js/is-core-module.git" - }, - "keywords": [ - "core", - "modules", - "module", - "npm", - "node", - "dependencies" - ], - "author": "Jordan Harband ", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/inspect-js/is-core-module/issues" - }, - "homepage": "https://github.com/inspect-js/is-core-module", - "dependencies": { - "has": "^1.0.3" - }, - "devDependencies": { - "@ljharb/eslint-config": "^21.0.1", - "aud": "^2.0.2", - "auto-changelog": "^2.4.0", - "eslint": "=8.8.0", - "in-publish": "^2.0.1", - "mock-property": "^1.0.0", - "npmignore": "^0.3.0", - "nyc": "^10.3.2", - "safe-publish-latest": "^2.0.0", - "semver": "^6.3.0", - "tape": "^5.6.3" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "publishConfig": { - "ignore": [ - ".github" - ] - } -} diff --git a/node_modules/is-core-module/test/index.js b/node_modules/is-core-module/test/index.js deleted file mode 100644 index 912808b9d..000000000 --- a/node_modules/is-core-module/test/index.js +++ /dev/null @@ -1,133 +0,0 @@ -'use strict'; - -var test = require('tape'); -var keys = require('object-keys'); -var semver = require('semver'); -var mockProperty = require('mock-property'); - -var isCore = require('../'); -var data = require('../core.json'); - -var supportsNodePrefix = semver.satisfies(process.versions.node, '^14.18 || >= 16', { includePrerelease: true }); - -test('core modules', function (t) { - t.test('isCore()', function (st) { - st.ok(isCore('fs')); - st.ok(isCore('net')); - st.ok(isCore('http')); - - st.ok(!isCore('seq')); - st.ok(!isCore('../')); - - st.ok(!isCore('toString')); - - st.end(); - }); - - t.test('core list', function (st) { - var cores = keys(data); - st.plan(cores.length); - - for (var i = 0; i < cores.length; ++i) { - var mod = cores[i]; - var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func - if (isCore(mod)) { - st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); - } else { - st['throws'](requireFunc, mod + ' not supported; requiring throws'); - } - } - - st.end(); - }); - - t.test('core via repl module', { skip: !data.repl }, function (st) { - var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle - if (!libs) { - st.skip('repl._builtinLibs does not exist'); - } else { - for (var i = 0; i < libs.length; ++i) { - var mod = libs[i]; - st.ok(data[mod], mod + ' is a core module'); - st.doesNotThrow( - function () { require(mod); }, // eslint-disable-line no-loop-func - 'requiring ' + mod + ' does not throw' - ); - if (mod.slice(0, 5) !== 'node:') { - if (supportsNodePrefix) { - st.doesNotThrow( - function () { require('node:' + mod); }, // eslint-disable-line no-loop-func - 'requiring node:' + mod + ' does not throw' - ); - } else { - st['throws']( - function () { require('node:' + mod); }, // eslint-disable-line no-loop-func - 'requiring node:' + mod + ' throws' - ); - } - } - } - } - st.end(); - }); - - t.test('core via builtinModules list', { skip: !data.module }, function (st) { - var libs = require('module').builtinModules; - if (!libs) { - st.skip('module.builtinModules does not exist'); - } else { - var excludeList = [ - '_debug_agent', - 'v8/tools/tickprocessor-driver', - 'v8/tools/SourceMap', - 'v8/tools/tickprocessor', - 'v8/tools/profile' - ]; - // see https://github.com/nodejs/node/issues/42785 - if (semver.satisfies(process.version, '>= 18')) { - libs = libs.concat('node:test'); - } - for (var i = 0; i < libs.length; ++i) { - var mod = libs[i]; - if (excludeList.indexOf(mod) === -1) { - st.ok(data[mod], mod + ' is a core module'); - st.doesNotThrow( - function () { require(mod); }, // eslint-disable-line no-loop-func - 'requiring ' + mod + ' does not throw' - ); - if (mod.slice(0, 5) !== 'node:') { - if (supportsNodePrefix) { - st.doesNotThrow( - function () { require('node:' + mod); }, // eslint-disable-line no-loop-func - 'requiring node:' + mod + ' does not throw' - ); - } else { - st['throws']( - function () { require('node:' + mod); }, // eslint-disable-line no-loop-func - 'requiring node:' + mod + ' throws' - ); - } - } - } - } - } - st.end(); - }); - - t.test('Object.prototype pollution', function (st) { - var nonKey = 'not a core module'; - st.teardown(mockProperty(Object.prototype, 'fs', { value: false })); - st.teardown(mockProperty(Object.prototype, 'path', { value: '>= 999999999' })); - st.teardown(mockProperty(Object.prototype, 'http', { value: data.http })); - st.teardown(mockProperty(Object.prototype, nonKey, { value: true })); - - st.equal(isCore('fs'), true, 'fs is a core module even if Object.prototype lies'); - st.equal(isCore('path'), true, 'path is a core module even if Object.prototype lies'); - st.equal(isCore('http'), true, 'path is a core module even if Object.prototype matches data'); - st.equal(isCore(nonKey), false, '"' + nonKey + '" is not a core module even if Object.prototype lies'); - - st.end(); - }); - - t.end(); -}); diff --git a/node_modules/is-extglob/LICENSE b/node_modules/is-extglob/LICENSE deleted file mode 100644 index 842218cf0..000000000 --- a/node_modules/is-extglob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2016, Jon Schlinkert - -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/is-extglob/README.md b/node_modules/is-extglob/README.md deleted file mode 100644 index 0416af5c3..000000000 --- a/node_modules/is-extglob/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# is-extglob [![NPM version](https://img.shields.io/npm/v/is-extglob.svg?style=flat)](https://www.npmjs.com/package/is-extglob) [![NPM downloads](https://img.shields.io/npm/dm/is-extglob.svg?style=flat)](https://npmjs.org/package/is-extglob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-extglob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-extglob) - -> Returns true if a string has an extglob. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save is-extglob -``` - -## Usage - -```js -var isExtglob = require('is-extglob'); -``` - -**True** - -```js -isExtglob('?(abc)'); -isExtglob('@(abc)'); -isExtglob('!(abc)'); -isExtglob('*(abc)'); -isExtglob('+(abc)'); -``` - -**False** - -Escaped extglobs: - -```js -isExtglob('\\?(abc)'); -isExtglob('\\@(abc)'); -isExtglob('\\!(abc)'); -isExtglob('\\*(abc)'); -isExtglob('\\+(abc)'); -``` - -Everything else... - -```js -isExtglob('foo.js'); -isExtglob('!foo.js'); -isExtglob('*.js'); -isExtglob('**/abc.js'); -isExtglob('abc/*.js'); -isExtglob('abc/(aaa|bbb).js'); -isExtglob('abc/[a-z].js'); -isExtglob('abc/{a,b}.js'); -isExtglob('abc/?.js'); -isExtglob('abc.js'); -isExtglob('abc/def/ghi.js'); -``` - -## History - -**v2.0** - -Adds support for escaping. Escaped exglobs no longer return true. - -## About - -### Related projects - -* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.") -* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") -* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### Building docs - -_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ - -To generate the readme and API documentation with [verb](https://github.com/verbose/verb): - -```sh -$ npm install -g verb verb-generate-readme && verb -``` - -### Running tests - -Install dev dependencies: - -```sh -$ npm install -d && npm test -``` - -### Author - -**Jon Schlinkert** - -* [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -### License - -Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._ \ No newline at end of file diff --git a/node_modules/is-extglob/index.js b/node_modules/is-extglob/index.js deleted file mode 100644 index c1d986fc5..000000000 --- a/node_modules/is-extglob/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * is-extglob - * - * Copyright (c) 2014-2016, Jon Schlinkert. - * Licensed under the MIT License. - */ - -module.exports = function isExtglob(str) { - if (typeof str !== 'string' || str === '') { - return false; - } - - var match; - while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { - if (match[2]) return true; - str = str.slice(match.index + match[0].length); - } - - return false; -}; diff --git a/node_modules/is-extglob/package.json b/node_modules/is-extglob/package.json deleted file mode 100644 index 7a908369d..000000000 --- a/node_modules/is-extglob/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "is-extglob", - "description": "Returns true if a string has an extglob.", - "version": "2.1.1", - "homepage": "https://github.com/jonschlinkert/is-extglob", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/is-extglob", - "bugs": { - "url": "https://github.com/jonschlinkert/is-extglob/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "gulp-format-md": "^0.1.10", - "mocha": "^3.0.2" - }, - "keywords": [ - "bash", - "braces", - "check", - "exec", - "expression", - "extglob", - "glob", - "globbing", - "globstar", - "is", - "match", - "matches", - "pattern", - "regex", - "regular", - "string", - "test" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "has-glob", - "is-glob", - "micromatch" - ] - }, - "reflinks": [ - "verb", - "verb-generate-readme" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/is-fullwidth-code-point/index.d.ts b/node_modules/is-fullwidth-code-point/index.d.ts deleted file mode 100644 index 729d20205..000000000 --- a/node_modules/is-fullwidth-code-point/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms). - -@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - -@example -``` -import isFullwidthCodePoint from 'is-fullwidth-code-point'; - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` -*/ -export default function isFullwidthCodePoint(codePoint: number): boolean; diff --git a/node_modules/is-fullwidth-code-point/index.js b/node_modules/is-fullwidth-code-point/index.js deleted file mode 100644 index 671f97f76..000000000 --- a/node_modules/is-fullwidth-code-point/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable yoda */ -'use strict'; - -const isFullwidthCodePoint = codePoint => { - if (Number.isNaN(codePoint)) { - return false; - } - - // Code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - codePoint >= 0x1100 && ( - codePoint <= 0x115F || // Hangul Jamo - codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET - codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= codePoint && codePoint <= 0x4DBF) || - // CJK Unified Ideographs .. Yi Radicals - (0x4E00 <= codePoint && codePoint <= 0xA4C6) || - // Hangul Jamo Extended-A - (0xA960 <= codePoint && codePoint <= 0xA97C) || - // Hangul Syllables - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - // CJK Compatibility Ideographs - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - // Vertical Forms - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - // CJK Compatibility Forms .. Small Form Variants - (0xFE30 <= codePoint && codePoint <= 0xFE6B) || - // Halfwidth and Fullwidth Forms - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || - // Kana Supplement - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - // Enclosed Ideographic Supplement - (0x1F200 <= codePoint && codePoint <= 0x1F251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= codePoint && codePoint <= 0x3FFFD) - ) - ) { - return true; - } - - return false; -}; - -module.exports = isFullwidthCodePoint; -module.exports.default = isFullwidthCodePoint; diff --git a/node_modules/is-fullwidth-code-point/license b/node_modules/is-fullwidth-code-point/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/is-fullwidth-code-point/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -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/is-fullwidth-code-point/package.json b/node_modules/is-fullwidth-code-point/package.json deleted file mode 100644 index 2137e888f..000000000 --- a/node_modules/is-fullwidth-code-point/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "is-fullwidth-code-point", - "version": "3.0.0", - "description": "Check if the character represented by a given Unicode code point is fullwidth", - "license": "MIT", - "repository": "sindresorhus/is-fullwidth-code-point", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd-check" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", - "string", - "codepoint", - "code", - "point", - "is", - "detect", - "check" - ], - "devDependencies": { - "ava": "^1.3.1", - "tsd-check": "^0.5.0", - "xo": "^0.24.0" - } -} diff --git a/node_modules/is-fullwidth-code-point/readme.md b/node_modules/is-fullwidth-code-point/readme.md deleted file mode 100644 index 4236bba98..000000000 --- a/node_modules/is-fullwidth-code-point/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) - -> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) - - -## Install - -``` -$ npm install is-fullwidth-code-point -``` - - -## Usage - -```js -const isFullwidthCodePoint = require('is-fullwidth-code-point'); - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` - - -## API - -### isFullwidthCodePoint(codePoint) - -#### codePoint - -Type: `number` - -The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/is-generator-fn/index.d.ts b/node_modules/is-generator-fn/index.d.ts deleted file mode 100644 index 7eabf6238..000000000 --- a/node_modules/is-generator-fn/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare const isGeneratorFn: { - /** - Check if something is a generator function. - - @example - ``` - import isGeneratorFn = require('is-generator-fn'); - - isGeneratorFn(function * () {}); - //=> true - - isGeneratorFn(function () {}); - //=> false - ``` - */ - (value: unknown): value is GeneratorFunction; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function isGeneratorFn(value: unknown): value is GeneratorFunction; - // export = isGeneratorFn; - default: typeof isGeneratorFn; -}; - -export = isGeneratorFn; diff --git a/node_modules/is-generator-fn/index.js b/node_modules/is-generator-fn/index.js deleted file mode 100644 index d50f6cfa8..000000000 --- a/node_modules/is-generator-fn/index.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; -const {toString} = Object.prototype; - -module.exports = value => { - if (typeof value !== 'function') { - return false; - } - - return (value.constructor && value.constructor.name === 'GeneratorFunction') || - toString.call(value) === '[object GeneratorFunction]'; -}; - -// TODO: Remove this for the next major release -module.exports.default = module.exports; diff --git a/node_modules/is-generator-fn/license b/node_modules/is-generator-fn/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/is-generator-fn/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -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/is-generator-fn/package.json b/node_modules/is-generator-fn/package.json deleted file mode 100644 index 65e319edc..000000000 --- a/node_modules/is-generator-fn/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "is-generator-fn", - "version": "2.1.0", - "description": "Check if something is a generator function", - "license": "MIT", - "repository": "sindresorhus/is-generator-fn", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "generator", - "function", - "func", - "fn", - "is", - "check", - "detect", - "yield", - "type" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/is-generator-fn/readme.md b/node_modules/is-generator-fn/readme.md deleted file mode 100644 index 654c2afd0..000000000 --- a/node_modules/is-generator-fn/readme.md +++ /dev/null @@ -1,33 +0,0 @@ -# is-generator-fn [![Build Status](https://travis-ci.org/sindresorhus/is-generator-fn.svg?branch=master)](https://travis-ci.org/sindresorhus/is-generator-fn) - -> Check if something is a [generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) - - -## Install - -``` -$ npm install is-generator-fn -``` - - -## Usage - -```js -const isGeneratorFn = require('is-generator-fn'); - -isGeneratorFn(function * () {}); -//=> true - -isGeneratorFn(function () {}); -//=> false -``` - - -## Related - -- [is](https://github.com/sindresorhus/is) - Type check values - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/is-glob/LICENSE b/node_modules/is-glob/LICENSE deleted file mode 100644 index 3f2eca18f..000000000 --- a/node_modules/is-glob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2017, Jon Schlinkert. - -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/is-glob/README.md b/node_modules/is-glob/README.md deleted file mode 100644 index 740724b27..000000000 --- a/node_modules/is-glob/README.md +++ /dev/null @@ -1,206 +0,0 @@ -# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![NPM total downloads](https://img.shields.io/npm/dt/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Build Status](https://img.shields.io/github/workflow/status/micromatch/is-glob/dev)](https://github.com/micromatch/is-glob/actions) - -> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience. - -Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save is-glob -``` - -You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob). - -## Usage - -```js -var isGlob = require('is-glob'); -``` - -### Default behavior - -**True** - -Patterns that have glob characters or regex patterns will return `true`: - -```js -isGlob('!foo.js'); -isGlob('*.js'); -isGlob('**/abc.js'); -isGlob('abc/*.js'); -isGlob('abc/(aaa|bbb).js'); -isGlob('abc/[a-z].js'); -isGlob('abc/{a,b}.js'); -//=> true -``` - -Extglobs - -```js -isGlob('abc/@(a).js'); -isGlob('abc/!(a).js'); -isGlob('abc/+(a).js'); -isGlob('abc/*(a).js'); -isGlob('abc/?(a).js'); -//=> true -``` - -**False** - -Escaped globs or extglobs return `false`: - -```js -isGlob('abc/\\@(a).js'); -isGlob('abc/\\!(a).js'); -isGlob('abc/\\+(a).js'); -isGlob('abc/\\*(a).js'); -isGlob('abc/\\?(a).js'); -isGlob('\\!foo.js'); -isGlob('\\*.js'); -isGlob('\\*\\*/abc.js'); -isGlob('abc/\\*.js'); -isGlob('abc/\\(aaa|bbb).js'); -isGlob('abc/\\[a-z].js'); -isGlob('abc/\\{a,b}.js'); -//=> false -``` - -Patterns that do not have glob patterns return `false`: - -```js -isGlob('abc.js'); -isGlob('abc/def/ghi.js'); -isGlob('foo.js'); -isGlob('abc/@.js'); -isGlob('abc/+.js'); -isGlob('abc/?.js'); -isGlob(); -isGlob(null); -//=> false -``` - -Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)): - -```js -isGlob(['**/*.js']); -isGlob(['foo.js']); -//=> false -``` - -### Option strict - -When `options.strict === false` the behavior is less strict in determining if a pattern is a glob. Meaning that -some patterns that would return `false` may return `true`. This is done so that matching libraries like [micromatch](https://github.com/micromatch/micromatch) have a chance at determining if the pattern is a glob or not. - -**True** - -Patterns that have glob characters or regex patterns will return `true`: - -```js -isGlob('!foo.js', {strict: false}); -isGlob('*.js', {strict: false}); -isGlob('**/abc.js', {strict: false}); -isGlob('abc/*.js', {strict: false}); -isGlob('abc/(aaa|bbb).js', {strict: false}); -isGlob('abc/[a-z].js', {strict: false}); -isGlob('abc/{a,b}.js', {strict: false}); -//=> true -``` - -Extglobs - -```js -isGlob('abc/@(a).js', {strict: false}); -isGlob('abc/!(a).js', {strict: false}); -isGlob('abc/+(a).js', {strict: false}); -isGlob('abc/*(a).js', {strict: false}); -isGlob('abc/?(a).js', {strict: false}); -//=> true -``` - -**False** - -Escaped globs or extglobs return `false`: - -```js -isGlob('\\!foo.js', {strict: false}); -isGlob('\\*.js', {strict: false}); -isGlob('\\*\\*/abc.js', {strict: false}); -isGlob('abc/\\*.js', {strict: false}); -isGlob('abc/\\(aaa|bbb).js', {strict: false}); -isGlob('abc/\\[a-z].js', {strict: false}); -isGlob('abc/\\{a,b}.js', {strict: false}); -//=> false -``` - -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Related projects - -You might also be interested in these projects: - -* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit") -* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base "Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks") -* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.") -* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 47 | [jonschlinkert](https://github.com/jonschlinkert) | -| 5 | [doowb](https://github.com/doowb) | -| 1 | [phated](https://github.com/phated) | -| 1 | [danhper](https://github.com/danhper) | -| 1 | [paulmillr](https://github.com/paulmillr) | - -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on March 27, 2019._ \ No newline at end of file diff --git a/node_modules/is-glob/index.js b/node_modules/is-glob/index.js deleted file mode 100644 index 620f563ec..000000000 --- a/node_modules/is-glob/index.js +++ /dev/null @@ -1,150 +0,0 @@ -/*! - * is-glob - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ - -var isExtglob = require('is-extglob'); -var chars = { '{': '}', '(': ')', '[': ']'}; -var strictCheck = function(str) { - if (str[0] === '!') { - return true; - } - var index = 0; - var pipeIndex = -2; - var closeSquareIndex = -2; - var closeCurlyIndex = -2; - var closeParenIndex = -2; - var backSlashIndex = -2; - while (index < str.length) { - if (str[index] === '*') { - return true; - } - - if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) { - return true; - } - - if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') { - if (closeSquareIndex < index) { - closeSquareIndex = str.indexOf(']', index); - } - if (closeSquareIndex > index) { - if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { - return true; - } - backSlashIndex = str.indexOf('\\', index); - if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { - return true; - } - } - } - - if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { - closeCurlyIndex = str.indexOf('}', index); - if (closeCurlyIndex > index) { - backSlashIndex = str.indexOf('\\', index); - if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { - return true; - } - } - } - - if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { - closeParenIndex = str.indexOf(')', index); - if (closeParenIndex > index) { - backSlashIndex = str.indexOf('\\', index); - if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { - return true; - } - } - } - - if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { - if (pipeIndex < index) { - pipeIndex = str.indexOf('|', index); - } - if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { - closeParenIndex = str.indexOf(')', pipeIndex); - if (closeParenIndex > pipeIndex) { - backSlashIndex = str.indexOf('\\', pipeIndex); - if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { - return true; - } - } - } - } - - if (str[index] === '\\') { - var open = str[index + 1]; - index += 2; - var close = chars[open]; - - if (close) { - var n = str.indexOf(close, index); - if (n !== -1) { - index = n + 1; - } - } - - if (str[index] === '!') { - return true; - } - } else { - index++; - } - } - return false; -}; - -var relaxedCheck = function(str) { - if (str[0] === '!') { - return true; - } - var index = 0; - while (index < str.length) { - if (/[*?{}()[\]]/.test(str[index])) { - return true; - } - - if (str[index] === '\\') { - var open = str[index + 1]; - index += 2; - var close = chars[open]; - - if (close) { - var n = str.indexOf(close, index); - if (n !== -1) { - index = n + 1; - } - } - - if (str[index] === '!') { - return true; - } - } else { - index++; - } - } - return false; -}; - -module.exports = function isGlob(str, options) { - if (typeof str !== 'string' || str === '') { - return false; - } - - if (isExtglob(str)) { - return true; - } - - var check = strictCheck; - - // optionally relax check - if (options && options.strict === false) { - check = relaxedCheck; - } - - return check(str); -}; diff --git a/node_modules/is-glob/package.json b/node_modules/is-glob/package.json deleted file mode 100644 index 858af0378..000000000 --- a/node_modules/is-glob/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "is-glob", - "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.", - "version": "4.0.3", - "homepage": "https://github.com/micromatch/is-glob", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Brian Woodward (https://twitter.com/doowb)", - "Daniel Perez (https://tuvistavie.com)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)" - ], - "repository": "micromatch/is-glob", - "bugs": { - "url": "https://github.com/micromatch/is-glob/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha && node benchmark.js" - }, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "devDependencies": { - "gulp-format-md": "^0.1.10", - "mocha": "^3.0.2" - }, - "keywords": [ - "bash", - "braces", - "check", - "exec", - "expression", - "extglob", - "glob", - "globbing", - "globstar", - "is", - "match", - "matches", - "pattern", - "regex", - "regular", - "string", - "test" - ], - "verb": { - "layout": "default", - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "assemble", - "base", - "update", - "verb" - ] - }, - "reflinks": [ - "assemble", - "bach", - "base", - "composer", - "gulp", - "has-glob", - "is-valid-glob", - "micromatch", - "npm", - "scaffold", - "verb", - "vinyl" - ] - } -} diff --git a/node_modules/is-number/LICENSE b/node_modules/is-number/LICENSE deleted file mode 100644 index 9af4a67d2..000000000 --- a/node_modules/is-number/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-present, Jon Schlinkert. - -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/is-number/README.md b/node_modules/is-number/README.md deleted file mode 100644 index eb8149e8c..000000000 --- a/node_modules/is-number/README.md +++ /dev/null @@ -1,187 +0,0 @@ -# is-number [![NPM version](https://img.shields.io/npm/v/is-number.svg?style=flat)](https://www.npmjs.com/package/is-number) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![NPM total downloads](https://img.shields.io/npm/dt/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-number.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-number) - -> Returns true if the value is a finite number. - -Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save is-number -``` - -## Why is this needed? - -In JavaScript, it's not always as straightforward as it should be to reliably check if a value is a number. It's common for devs to use `+`, `-`, or `Number()` to cast a string value to a number (for example, when values are returned from user input, regex matches, parsers, etc). But there are many non-intuitive edge cases that yield unexpected results: - -```js -console.log(+[]); //=> 0 -console.log(+''); //=> 0 -console.log(+' '); //=> 0 -console.log(typeof NaN); //=> 'number' -``` - -This library offers a performant way to smooth out edge cases like these. - -## Usage - -```js -const isNumber = require('is-number'); -``` - -See the [tests](./test.js) for more examples. - -### true - -```js -isNumber(5e3); // true -isNumber(0xff); // true -isNumber(-1.1); // true -isNumber(0); // true -isNumber(1); // true -isNumber(1.1); // true -isNumber(10); // true -isNumber(10.10); // true -isNumber(100); // true -isNumber('-1.1'); // true -isNumber('0'); // true -isNumber('012'); // true -isNumber('0xff'); // true -isNumber('1'); // true -isNumber('1.1'); // true -isNumber('10'); // true -isNumber('10.10'); // true -isNumber('100'); // true -isNumber('5e3'); // true -isNumber(parseInt('012')); // true -isNumber(parseFloat('012')); // true -``` - -### False - -Everything else is false, as you would expect: - -```js -isNumber(Infinity); // false -isNumber(NaN); // false -isNumber(null); // false -isNumber(undefined); // false -isNumber(''); // false -isNumber(' '); // false -isNumber('foo'); // false -isNumber([1]); // false -isNumber([]); // false -isNumber(function () {}); // false -isNumber({}); // false -``` - -## Release history - -### 7.0.0 - -* Refactor. Now uses `.isFinite` if it exists. -* Performance is about the same as v6.0 when the value is a string or number. But it's now 3x-4x faster when the value is not a string or number. - -### 6.0.0 - -* Optimizations, thanks to @benaadams. - -### 5.0.0 - -**Breaking changes** - -* removed support for `instanceof Number` and `instanceof String` - -## Benchmarks - -As with all benchmarks, take these with a grain of salt. See the [benchmarks](./benchmark/index.js) for more detail. - -``` -# all -v7.0 x 413,222 ops/sec ±2.02% (86 runs sampled) -v6.0 x 111,061 ops/sec ±1.29% (85 runs sampled) -parseFloat x 317,596 ops/sec ±1.36% (86 runs sampled) -fastest is 'v7.0' - -# string -v7.0 x 3,054,496 ops/sec ±1.05% (89 runs sampled) -v6.0 x 2,957,781 ops/sec ±0.98% (88 runs sampled) -parseFloat x 3,071,060 ops/sec ±1.13% (88 runs sampled) -fastest is 'parseFloat,v7.0' - -# number -v7.0 x 3,146,895 ops/sec ±0.89% (89 runs sampled) -v6.0 x 3,214,038 ops/sec ±1.07% (89 runs sampled) -parseFloat x 3,077,588 ops/sec ±1.07% (87 runs sampled) -fastest is 'v6.0' -``` - -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Related projects - -You might also be interested in these projects: - -* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.") -* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") -* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.") -* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 49 | [jonschlinkert](https://github.com/jonschlinkert) | -| 5 | [charlike-old](https://github.com/charlike-old) | -| 1 | [benaadams](https://github.com/benaadams) | -| 1 | [realityking](https://github.com/realityking) | - -### Author - -**Jon Schlinkert** - -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) - -### License - -Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 15, 2018._ \ No newline at end of file diff --git a/node_modules/is-number/index.js b/node_modules/is-number/index.js deleted file mode 100644 index 27f19b757..000000000 --- a/node_modules/is-number/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * is-number - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -module.exports = function(num) { - if (typeof num === 'number') { - return num - num === 0; - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); - } - return false; -}; diff --git a/node_modules/is-number/package.json b/node_modules/is-number/package.json deleted file mode 100644 index 371507260..000000000 --- a/node_modules/is-number/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "is-number", - "description": "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.", - "version": "7.0.0", - "homepage": "https://github.com/jonschlinkert/is-number", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Olsten Larck (https://i.am.charlike.online)", - "Rouven Weßling (www.rouvenwessling.de)" - ], - "repository": "jonschlinkert/is-number", - "bugs": { - "url": "https://github.com/jonschlinkert/is-number/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.12.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "ansi": "^0.3.1", - "benchmark": "^2.1.4", - "gulp-format-md": "^1.0.0", - "mocha": "^3.5.3" - }, - "keywords": [ - "cast", - "check", - "coerce", - "coercion", - "finite", - "integer", - "is", - "isnan", - "is-nan", - "is-num", - "is-number", - "isnumber", - "isfinite", - "istype", - "kind", - "math", - "nan", - "num", - "number", - "numeric", - "parseFloat", - "parseInt", - "test", - "type", - "typeof", - "value" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "related": { - "list": [ - "is-plain-object", - "is-primitive", - "isobject", - "kind-of" - ] - }, - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/is-path-inside/index.d.ts b/node_modules/is-path-inside/index.d.ts deleted file mode 100644 index 5cc3d804d..000000000 --- a/node_modules/is-path-inside/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** -Check if a path is inside another path. - -Note that relative paths are resolved against `process.cwd()` to make them absolute. - -_Important:_ This package is meant for use with path manipulation. It does not check if the paths exist nor does it resolve symlinks. You should not use this as a security mechanism to guard against access to certain places on the file system. - -@example -``` -import isPathInside = require('is-path-inside'); - -isPathInside('a/b/c', 'a/b'); -//=> true - -isPathInside('a/b/c', 'x/y'); -//=> false - -isPathInside('a/b/c', 'a/b/c'); -//=> false - -isPathInside('/Users/sindresorhus/dev/unicorn', '/Users/sindresorhus'); -//=> true -``` -*/ -declare function isPathInside(childPath: string, parentPath: string): boolean; - -export = isPathInside; diff --git a/node_modules/is-path-inside/index.js b/node_modules/is-path-inside/index.js deleted file mode 100644 index 28ed79c0f..000000000 --- a/node_modules/is-path-inside/index.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; -const path = require('path'); - -module.exports = (childPath, parentPath) => { - const relation = path.relative(parentPath, childPath); - return Boolean( - relation && - relation !== '..' && - !relation.startsWith(`..${path.sep}`) && - relation !== path.resolve(childPath) - ); -}; diff --git a/node_modules/is-path-inside/license b/node_modules/is-path-inside/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/is-path-inside/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -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/is-path-inside/package.json b/node_modules/is-path-inside/package.json deleted file mode 100644 index 88c154ae7..000000000 --- a/node_modules/is-path-inside/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "is-path-inside", - "version": "3.0.3", - "description": "Check if a path is inside another path", - "license": "MIT", - "repository": "sindresorhus/is-path-inside", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "path", - "inside", - "folder", - "directory", - "dir", - "file", - "resolve" - ], - "devDependencies": { - "ava": "^2.1.0", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/is-path-inside/readme.md b/node_modules/is-path-inside/readme.md deleted file mode 100644 index e8c4f928e..000000000 --- a/node_modules/is-path-inside/readme.md +++ /dev/null @@ -1,63 +0,0 @@ -# is-path-inside - -> Check if a path is inside another path - - -## Install - -``` -$ npm install is-path-inside -``` - - -## Usage - -```js -const isPathInside = require('is-path-inside'); - -isPathInside('a/b/c', 'a/b'); -//=> true - -isPathInside('a/b/c', 'x/y'); -//=> false - -isPathInside('a/b/c', 'a/b/c'); -//=> false - -isPathInside('/Users/sindresorhus/dev/unicorn', '/Users/sindresorhus'); -//=> true -``` - - -## API - -### isPathInside(childPath, parentPath) - -Note that relative paths are resolved against `process.cwd()` to make them absolute. - -**Important:** This package is meant for use with path manipulation. It does not check if the paths exist nor does it resolve symlinks. You should not use this as a security mechanism to guard against access to certain places on the file system. - -#### childPath - -Type: `string` - -The path that should be inside `parentPath`. - -#### parentPath - -Type: `string` - -The path that should contain `childPath`. - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/is-stream/index.d.ts b/node_modules/is-stream/index.d.ts deleted file mode 100644 index eee2e83e8..000000000 --- a/node_modules/is-stream/index.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -import * as stream from 'stream'; - -declare const isStream: { - /** - @returns Whether `stream` is a [`Stream`](https://nodejs.org/api/stream.html#stream_stream). - - @example - ``` - import * as fs from 'fs'; - import isStream = require('is-stream'); - - isStream(fs.createReadStream('unicorn.png')); - //=> true - - isStream({}); - //=> false - ``` - */ - (stream: unknown): stream is stream.Stream; - - /** - @returns Whether `stream` is a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable). - - @example - ``` - import * as fs from 'fs'; - import isStream = require('is-stream'); - - isStream.writable(fs.createWriteStrem('unicorn.txt')); - //=> true - ``` - */ - writable(stream: unknown): stream is stream.Writable; - - /** - @returns Whether `stream` is a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable). - - @example - ``` - import * as fs from 'fs'; - import isStream = require('is-stream'); - - isStream.readable(fs.createReadStream('unicorn.png')); - //=> true - ``` - */ - readable(stream: unknown): stream is stream.Readable; - - /** - @returns Whether `stream` is a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex). - - @example - ``` - import {Duplex} from 'stream'; - import isStream = require('is-stream'); - - isStream.duplex(new Duplex()); - //=> true - ``` - */ - duplex(stream: unknown): stream is stream.Duplex; - - /** - @returns Whether `stream` is a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform). - - @example - ``` - import * as fs from 'fs'; - import Stringify = require('streaming-json-stringify'); - import isStream = require('is-stream'); - - isStream.transform(Stringify()); - //=> true - ``` - */ - transform(input: unknown): input is stream.Transform; -}; - -export = isStream; diff --git a/node_modules/is-stream/index.js b/node_modules/is-stream/index.js deleted file mode 100644 index 2e43434da..000000000 --- a/node_modules/is-stream/index.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -const isStream = stream => - stream !== null && - typeof stream === 'object' && - typeof stream.pipe === 'function'; - -isStream.writable = stream => - isStream(stream) && - stream.writable !== false && - typeof stream._write === 'function' && - typeof stream._writableState === 'object'; - -isStream.readable = stream => - isStream(stream) && - stream.readable !== false && - typeof stream._read === 'function' && - typeof stream._readableState === 'object'; - -isStream.duplex = stream => - isStream.writable(stream) && - isStream.readable(stream); - -isStream.transform = stream => - isStream.duplex(stream) && - typeof stream._transform === 'function'; - -module.exports = isStream; diff --git a/node_modules/is-stream/license b/node_modules/is-stream/license deleted file mode 100644 index fa7ceba3e..000000000 --- a/node_modules/is-stream/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://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/is-stream/package.json b/node_modules/is-stream/package.json deleted file mode 100644 index c3b567392..000000000 --- a/node_modules/is-stream/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "is-stream", - "version": "2.0.1", - "description": "Check if something is a Node.js stream", - "license": "MIT", - "repository": "sindresorhus/is-stream", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "stream", - "type", - "streams", - "writable", - "readable", - "duplex", - "transform", - "check", - "detect", - "is" - ], - "devDependencies": { - "@types/node": "^11.13.6", - "ava": "^1.4.1", - "tempy": "^0.3.0", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/is-stream/readme.md b/node_modules/is-stream/readme.md deleted file mode 100644 index 19308e733..000000000 --- a/node_modules/is-stream/readme.md +++ /dev/null @@ -1,60 +0,0 @@ -# is-stream - -> Check if something is a [Node.js stream](https://nodejs.org/api/stream.html) - -## Install - -``` -$ npm install is-stream -``` - -## Usage - -```js -const fs = require('fs'); -const isStream = require('is-stream'); - -isStream(fs.createReadStream('unicorn.png')); -//=> true - -isStream({}); -//=> false -``` - -## API - -### isStream(stream) - -Returns a `boolean` for whether it's a [`Stream`](https://nodejs.org/api/stream.html#stream_stream). - -#### isStream.writable(stream) - -Returns a `boolean` for whether it's a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable). - -#### isStream.readable(stream) - -Returns a `boolean` for whether it's a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable). - -#### isStream.duplex(stream) - -Returns a `boolean` for whether it's a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex). - -#### isStream.transform(stream) - -Returns a `boolean` for whether it's a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform). - -## Related - -- [is-file-stream](https://github.com/jamestalmage/is-file-stream) - Detect if a stream is a file stream - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/isexe/.npmignore b/node_modules/isexe/.npmignore deleted file mode 100644 index c1cb757ac..000000000 --- a/node_modules/isexe/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -.nyc_output/ -coverage/ diff --git a/node_modules/isexe/LICENSE b/node_modules/isexe/LICENSE deleted file mode 100644 index 19129e315..000000000 --- a/node_modules/isexe/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -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/isexe/README.md b/node_modules/isexe/README.md deleted file mode 100644 index 35769e844..000000000 --- a/node_modules/isexe/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# isexe - -Minimal module to check if a file is executable, and a normal file. - -Uses `fs.stat` and tests against the `PATHEXT` environment variable on -Windows. - -## USAGE - -```javascript -var isexe = require('isexe') -isexe('some-file-name', function (err, isExe) { - if (err) { - console.error('probably file does not exist or something', err) - } else if (isExe) { - console.error('this thing can be run') - } else { - console.error('cannot be run') - } -}) - -// same thing but synchronous, throws errors -var isExe = isexe.sync('some-file-name') - -// treat errors as just "not executable" -isexe('maybe-missing-file', { ignoreErrors: true }, callback) -var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true }) -``` - -## API - -### `isexe(path, [options], [callback])` - -Check if the path is executable. If no callback provided, and a -global `Promise` object is available, then a Promise will be returned. - -Will raise whatever errors may be raised by `fs.stat`, unless -`options.ignoreErrors` is set to true. - -### `isexe.sync(path, [options])` - -Same as `isexe` but returns the value and throws any errors raised. - -### Options - -* `ignoreErrors` Treat all errors as "no, this is not executable", but - don't raise them. -* `uid` Number to use as the user id -* `gid` Number to use as the group id -* `pathExt` List of path extensions to use instead of `PATHEXT` - environment variable on Windows. diff --git a/node_modules/isexe/index.js b/node_modules/isexe/index.js deleted file mode 100644 index 553fb32b1..000000000 --- a/node_modules/isexe/index.js +++ /dev/null @@ -1,57 +0,0 @@ -var fs = require('fs') -var core -if (process.platform === 'win32' || global.TESTING_WINDOWS) { - core = require('./windows.js') -} else { - core = require('./mode.js') -} - -module.exports = isexe -isexe.sync = sync - -function isexe (path, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } - - if (!cb) { - if (typeof Promise !== 'function') { - throw new TypeError('callback not provided') - } - - return new Promise(function (resolve, reject) { - isexe(path, options || {}, function (er, is) { - if (er) { - reject(er) - } else { - resolve(is) - } - }) - }) - } - - core(path, options || {}, function (er, is) { - // ignore EACCES because that just means we aren't allowed to run it - if (er) { - if (er.code === 'EACCES' || options && options.ignoreErrors) { - er = null - is = false - } - } - cb(er, is) - }) -} - -function sync (path, options) { - // my kingdom for a filtered catch - try { - return core.sync(path, options || {}) - } catch (er) { - if (options && options.ignoreErrors || er.code === 'EACCES') { - return false - } else { - throw er - } - } -} diff --git a/node_modules/isexe/mode.js b/node_modules/isexe/mode.js deleted file mode 100644 index 1995ea4a0..000000000 --- a/node_modules/isexe/mode.js +++ /dev/null @@ -1,41 +0,0 @@ -module.exports = isexe -isexe.sync = sync - -var fs = require('fs') - -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, options)) - }) -} - -function sync (path, options) { - return checkStat(fs.statSync(path), options) -} - -function checkStat (stat, options) { - return stat.isFile() && checkMode(stat, options) -} - -function checkMode (stat, options) { - var mod = stat.mode - var uid = stat.uid - var gid = stat.gid - - var myUid = options.uid !== undefined ? - options.uid : process.getuid && process.getuid() - var myGid = options.gid !== undefined ? - options.gid : process.getgid && process.getgid() - - var u = parseInt('100', 8) - var g = parseInt('010', 8) - var o = parseInt('001', 8) - var ug = u | g - - var ret = (mod & o) || - (mod & g) && gid === myGid || - (mod & u) && uid === myUid || - (mod & ug) && myUid === 0 - - return ret -} diff --git a/node_modules/isexe/package.json b/node_modules/isexe/package.json deleted file mode 100644 index e45268944..000000000 --- a/node_modules/isexe/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "isexe", - "version": "2.0.0", - "description": "Minimal module to check if a file is executable.", - "main": "index.js", - "directories": { - "test": "test" - }, - "devDependencies": { - "mkdirp": "^0.5.1", - "rimraf": "^2.5.0", - "tap": "^10.3.0" - }, - "scripts": { - "test": "tap test/*.js --100", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --all; git push origin --tags" - }, - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/isexe.git" - }, - "keywords": [], - "bugs": { - "url": "https://github.com/isaacs/isexe/issues" - }, - "homepage": "https://github.com/isaacs/isexe#readme" -} diff --git a/node_modules/isexe/test/basic.js b/node_modules/isexe/test/basic.js deleted file mode 100644 index d926df64b..000000000 --- a/node_modules/isexe/test/basic.js +++ /dev/null @@ -1,221 +0,0 @@ -var t = require('tap') -var fs = require('fs') -var path = require('path') -var fixture = path.resolve(__dirname, 'fixtures') -var meow = fixture + '/meow.cat' -var mine = fixture + '/mine.cat' -var ours = fixture + '/ours.cat' -var fail = fixture + '/fail.false' -var noent = fixture + '/enoent.exe' -var mkdirp = require('mkdirp') -var rimraf = require('rimraf') - -var isWindows = process.platform === 'win32' -var hasAccess = typeof fs.access === 'function' -var winSkip = isWindows && 'windows' -var accessSkip = !hasAccess && 'no fs.access function' -var hasPromise = typeof Promise === 'function' -var promiseSkip = !hasPromise && 'no global Promise' - -function reset () { - delete require.cache[require.resolve('../')] - return require('../') -} - -t.test('setup fixtures', function (t) { - rimraf.sync(fixture) - mkdirp.sync(fixture) - fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n') - fs.chmodSync(meow, parseInt('0755', 8)) - fs.writeFileSync(fail, '#!/usr/bin/env false\n') - fs.chmodSync(fail, parseInt('0644', 8)) - fs.writeFileSync(mine, '#!/usr/bin/env cat\nmine\n') - fs.chmodSync(mine, parseInt('0744', 8)) - fs.writeFileSync(ours, '#!/usr/bin/env cat\nours\n') - fs.chmodSync(ours, parseInt('0754', 8)) - t.end() -}) - -t.test('promise', { skip: promiseSkip }, function (t) { - var isexe = reset() - t.test('meow async', function (t) { - isexe(meow).then(function (is) { - t.ok(is) - t.end() - }) - }) - t.test('fail async', function (t) { - isexe(fail).then(function (is) { - t.notOk(is) - t.end() - }) - }) - t.test('noent async', function (t) { - isexe(noent).catch(function (er) { - t.ok(er) - t.end() - }) - }) - t.test('noent ignore async', function (t) { - isexe(noent, { ignoreErrors: true }).then(function (is) { - t.notOk(is) - t.end() - }) - }) - t.end() -}) - -t.test('no promise', function (t) { - global.Promise = null - var isexe = reset() - t.throws('try to meow a promise', function () { - isexe(meow) - }) - t.end() -}) - -t.test('access', { skip: accessSkip || winSkip }, function (t) { - runTest(t) -}) - -t.test('mode', { skip: winSkip }, function (t) { - delete fs.access - delete fs.accessSync - var isexe = reset() - t.ok(isexe.sync(ours, { uid: 0, gid: 0 })) - t.ok(isexe.sync(mine, { uid: 0, gid: 0 })) - runTest(t) -}) - -t.test('windows', function (t) { - global.TESTING_WINDOWS = true - var pathExt = '.EXE;.CAT;.CMD;.COM' - t.test('pathExt option', function (t) { - runTest(t, { pathExt: '.EXE;.CAT;.CMD;.COM' }) - }) - t.test('pathExt env', function (t) { - process.env.PATHEXT = pathExt - runTest(t) - }) - t.test('no pathExt', function (t) { - // with a pathExt of '', any filename is fine. - // so the "fail" one would still pass. - runTest(t, { pathExt: '', skipFail: true }) - }) - t.test('pathext with empty entry', function (t) { - // with a pathExt of '', any filename is fine. - // so the "fail" one would still pass. - runTest(t, { pathExt: ';' + pathExt, skipFail: true }) - }) - t.end() -}) - -t.test('cleanup', function (t) { - rimraf.sync(fixture) - t.end() -}) - -function runTest (t, options) { - var isexe = reset() - - var optionsIgnore = Object.create(options || {}) - optionsIgnore.ignoreErrors = true - - if (!options || !options.skipFail) { - t.notOk(isexe.sync(fail, options)) - } - t.notOk(isexe.sync(noent, optionsIgnore)) - if (!options) { - t.ok(isexe.sync(meow)) - } else { - t.ok(isexe.sync(meow, options)) - } - - t.ok(isexe.sync(mine, options)) - t.ok(isexe.sync(ours, options)) - t.throws(function () { - isexe.sync(noent, options) - }) - - t.test('meow async', function (t) { - if (!options) { - isexe(meow, function (er, is) { - if (er) { - throw er - } - t.ok(is) - t.end() - }) - } else { - isexe(meow, options, function (er, is) { - if (er) { - throw er - } - t.ok(is) - t.end() - }) - } - }) - - t.test('mine async', function (t) { - isexe(mine, options, function (er, is) { - if (er) { - throw er - } - t.ok(is) - t.end() - }) - }) - - t.test('ours async', function (t) { - isexe(ours, options, function (er, is) { - if (er) { - throw er - } - t.ok(is) - t.end() - }) - }) - - if (!options || !options.skipFail) { - t.test('fail async', function (t) { - isexe(fail, options, function (er, is) { - if (er) { - throw er - } - t.notOk(is) - t.end() - }) - }) - } - - t.test('noent async', function (t) { - isexe(noent, options, function (er, is) { - t.ok(er) - t.notOk(is) - t.end() - }) - }) - - t.test('noent ignore async', function (t) { - isexe(noent, optionsIgnore, function (er, is) { - if (er) { - throw er - } - t.notOk(is) - t.end() - }) - }) - - t.test('directory is not executable', function (t) { - isexe(__dirname, options, function (er, is) { - if (er) { - throw er - } - t.notOk(is) - t.end() - }) - }) - - t.end() -} diff --git a/node_modules/isexe/windows.js b/node_modules/isexe/windows.js deleted file mode 100644 index 34996734d..000000000 --- a/node_modules/isexe/windows.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = isexe -isexe.sync = sync - -var fs = require('fs') - -function checkPathExt (path, options) { - var pathext = options.pathExt !== undefined ? - options.pathExt : process.env.PATHEXT - - if (!pathext) { - return true - } - - pathext = pathext.split(';') - if (pathext.indexOf('') !== -1) { - return true - } - for (var i = 0; i < pathext.length; i++) { - var p = pathext[i].toLowerCase() - if (p && path.substr(-p.length).toLowerCase() === p) { - return true - } - } - return false -} - -function checkStat (stat, path, options) { - if (!stat.isSymbolicLink() && !stat.isFile()) { - return false - } - return checkPathExt(path, options) -} - -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, path, options)) - }) -} - -function sync (path, options) { - return checkStat(fs.statSync(path), path, options) -} diff --git a/node_modules/istanbul-lib-coverage/CHANGELOG.md b/node_modules/istanbul-lib-coverage/CHANGELOG.md deleted file mode 100644 index 172546b20..000000000 --- a/node_modules/istanbul-lib-coverage/CHANGELOG.md +++ /dev/null @@ -1,193 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.2...istanbul-lib-coverage@3.0.0) (2019-12-20) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - -# [3.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.1...istanbul-lib-coverage@3.0.0-alpha.2) (2019-12-07) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - -# [3.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.0...istanbul-lib-coverage@3.0.0-alpha.1) (2019-10-06) - - -### Bug Fixes - -* Drop unneeded coverage data from `nyc --all` ([#456](https://github.com/istanbuljs/istanbuljs/issues/456)) ([f6bb0b4](https://github.com/istanbuljs/istanbuljs/commit/f6bb0b4)), closes [#123](https://github.com/istanbuljs/istanbuljs/issues/123) [#224](https://github.com/istanbuljs/istanbuljs/issues/224) [#260](https://github.com/istanbuljs/istanbuljs/issues/260) [#322](https://github.com/istanbuljs/istanbuljs/issues/322) [#413](https://github.com/istanbuljs/istanbuljs/issues/413) - - - - - -# [3.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.5...istanbul-lib-coverage@3.0.0-alpha.0) (2019-06-19) - - -### Features - -* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539)) - - -### BREAKING CHANGES - -* Node.js 8 is now required - - - - - -## [3.2.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.1.0...istanbul-lib-coverage-v3.2.0) (2021-10-17) - - -### Features - -* allow FileCoverage to be initialized with logical tracking ([#644](https://www.github.com/istanbuljs/istanbuljs/issues/644)) ([4cb5af1](https://www.github.com/istanbuljs/istanbuljs/commit/4cb5af1daaf33c3e9a5f3ee44f6bb7f958e5ba04)) - -## [3.1.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.2...istanbul-lib-coverage-v3.1.0) (2021-10-17) - - -### Features - -* support tracking Logic Truthiness as additional metric in coverage API ([#639](https://www.github.com/istanbuljs/istanbuljs/issues/639)) ([0967c80](https://www.github.com/istanbuljs/istanbuljs/commit/0967c80b905c3c17675ff2185b2325784e8dc0a2)) - -### [3.0.2](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.1...istanbul-lib-coverage-v3.0.2) (2021-10-11) - - -### Bug Fixes - -* handle merging '0' indexed coverage with '1' indexed coverage ([5dac2bc](https://www.github.com/istanbuljs/istanbuljs/commit/5dac2bcf28d6f27dbb720be72c2b692153418ab5)), closes [#632](https://www.github.com/istanbuljs/istanbuljs/issues/632) - -### [3.0.1](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.0...istanbul-lib-coverage-v3.0.1) (2021-09-23) - - -### Bug Fixes - -* merge branch/statement/functionMap's together when merging two coverage reports ([#617](https://www.github.com/istanbuljs/istanbuljs/issues/617)) ([ff1b5e9](https://www.github.com/istanbuljs/istanbuljs/commit/ff1b5e915201e4ff8f737010509bab98d8238118)) - -## [2.0.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.4...istanbul-lib-coverage@2.0.5) (2019-04-24) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - -## [2.0.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.3...istanbul-lib-coverage@2.0.4) (2019-03-12) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - -## [2.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.2...istanbul-lib-coverage@2.0.3) (2019-01-26) - -**Note:** Version bump only for package istanbul-lib-coverage - - - - - - -## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.1...istanbul-lib-coverage@2.0.2) (2018-12-25) - - - - -**Note:** Version bump only for package istanbul-lib-coverage - - -## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.0...istanbul-lib-coverage@2.0.1) (2018-07-07) - - - - -**Note:** Version bump only for package istanbul-lib-coverage - - -# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.2.0...istanbul-lib-coverage@2.0.0) (2018-06-06) - - -### Bug Fixes - -* use null prototype for map objects ([#177](https://github.com/istanbuljs/istanbuljs/issues/177)) ([9a5a30c](https://github.com/istanbuljs/istanbuljs/commit/9a5a30c)) - - -### BREAKING CHANGES - -* a null prototype is now used in several places rather than the default `{}` assignment. - - - - - -# [1.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.2...istanbul-lib-coverage@1.2.0) (2018-03-04) - - -### Features - -* add skip-empty option for html & text reports ([#140](https://github.com/istanbuljs/istanbuljs/issues/140)) ([d2a4262](https://github.com/istanbuljs/istanbuljs/commit/d2a4262)) - - - - - -## [1.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.1...istanbul-lib-coverage@1.1.2) (2018-02-13) - - - - -**Note:** Version bump only for package istanbul-lib-coverage - - -## [1.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.0...istanbul-lib-coverage@1.1.1) (2017-05-27) - - - - - -# [1.1.0](https://github.com/istanbuljs/istanbul-lib-coverage/compare/istanbul-lib-coverage@1.0.2...istanbul-lib-coverage@1.1.0) (2017-04-29) - - -### Bug Fixes - -* getBranchCoverageByLine() was looking for line coverage using wrong object structure ([bf36658](https://github.com/istanbuljs/istanbul-lib-coverage/commit/bf36658)) - - -### Features - -* add possibility to filter coverage maps when running reports post-hoc ([#24](https://github.com/istanbuljs/istanbuljs/issues/24)) ([e1c99d6](https://github.com/istanbuljs/istanbul-lib-coverage/commit/e1c99d6)) - - - - - -## [1.0.2](https://github.com/istanbuljs/istanbul-lib-coverage/compare/istanbul-lib-coverage@1.0.1...istanbul-lib-coverage@1.0.2) (2017-03-27) - - -## [1.0.1](https://github.com/istanbuljs/istanbul-lib-coverage/compare/v1.0.0...v1.0.1) (2017-01-18) - - -### Bug Fixes - -* handle edge-case surrounding merging two file coverage reports ([22e154c](https://github.com/istanbuljs/istanbul-lib-coverage/commit/22e154c)) - - - - -# [1.0.0](https://github.com/istanbuljs/istanbul-lib-coverage/compare/v1.0.0-alpha.3...v1.0.0) (2016-08-12) - - -### Bug Fixes - -* guard against missing statement ([76aad99](https://github.com/istanbuljs/istanbul-lib-coverage/commit/76aad99)) diff --git a/node_modules/istanbul-lib-coverage/LICENSE b/node_modules/istanbul-lib-coverage/LICENSE deleted file mode 100644 index d55d2916e..000000000 --- a/node_modules/istanbul-lib-coverage/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright 2012-2015 Yahoo! Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Yahoo! Inc. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/istanbul-lib-coverage/README.md b/node_modules/istanbul-lib-coverage/README.md deleted file mode 100644 index 2c24a56c9..000000000 --- a/node_modules/istanbul-lib-coverage/README.md +++ /dev/null @@ -1,29 +0,0 @@ -## istanbul-lib-coverage - -[![Greenkeeper badge](https://badges.greenkeeper.io/istanbuljs/istanbul-lib-coverage.svg)](https://greenkeeper.io/) -[![Build Status](https://travis-ci.org/istanbuljs/istanbul-lib-coverage.svg?branch=master)](https://travis-ci.org/istanbuljs/istanbul-lib-coverage) - -An API that provides a read-only view of coverage information with the ability -to merge and summarize coverage info. - -Supersedes `object-utils` and `collector` from the v0 istanbul API. - -See the docs for the full API. - -```js -var libCoverage = require('istanbul-lib-coverage'); -var map = libCoverage.createCoverageMap(globalCoverageVar); -var summary = libCoverage.createCoverageSummary(); - -// merge another coverage map into the one we created -map.merge(otherCoverageMap); - -// inspect and summarize all file coverage objects in the map -map.files().forEach(function(f) { - var fc = map.fileCoverageFor(f), - s = fc.toSummary(); - summary.merge(s); -}); - -console.log('Global summary', summary); -``` diff --git a/node_modules/istanbul-lib-coverage/index.js b/node_modules/istanbul-lib-coverage/index.js deleted file mode 100644 index bdc5a1820..000000000 --- a/node_modules/istanbul-lib-coverage/index.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -/** - * istanbul-lib-coverage exports an API that allows you to create and manipulate - * file coverage, coverage maps (a set of file coverage objects) and summary - * coverage objects. File coverage for the same file can be merged as can - * entire coverage maps. - * - * @module Exports - */ -const { FileCoverage } = require('./lib/file-coverage'); -const { CoverageMap } = require('./lib/coverage-map'); -const { CoverageSummary } = require('./lib/coverage-summary'); - -module.exports = { - /** - * creates a coverage summary object - * @param {Object} obj an argument with the same semantics - * as the one passed to the `CoverageSummary` constructor - * @returns {CoverageSummary} - */ - createCoverageSummary(obj) { - if (obj && obj instanceof CoverageSummary) { - return obj; - } - return new CoverageSummary(obj); - }, - /** - * creates a CoverageMap object - * @param {Object} obj optional - an argument with the same semantics - * as the one passed to the CoverageMap constructor. - * @returns {CoverageMap} - */ - createCoverageMap(obj) { - if (obj && obj instanceof CoverageMap) { - return obj; - } - return new CoverageMap(obj); - }, - /** - * creates a FileCoverage object - * @param {Object} obj optional - an argument with the same semantics - * as the one passed to the FileCoverage constructor. - * @returns {FileCoverage} - */ - createFileCoverage(obj) { - if (obj && obj instanceof FileCoverage) { - return obj; - } - return new FileCoverage(obj); - } -}; - -/** classes exported for reuse */ -module.exports.classes = { - /** - * the file coverage constructor - */ - FileCoverage -}; diff --git a/node_modules/istanbul-lib-coverage/lib/coverage-map.js b/node_modules/istanbul-lib-coverage/lib/coverage-map.js deleted file mode 100644 index 0a1ebd0a9..000000000 --- a/node_modules/istanbul-lib-coverage/lib/coverage-map.js +++ /dev/null @@ -1,134 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const { FileCoverage } = require('./file-coverage'); -const { CoverageSummary } = require('./coverage-summary'); - -function maybeConstruct(obj, klass) { - if (obj instanceof klass) { - return obj; - } - - return new klass(obj); -} - -function loadMap(source) { - const data = Object.create(null); - if (!source) { - return data; - } - - Object.entries(source).forEach(([k, cov]) => { - data[k] = maybeConstruct(cov, FileCoverage); - }); - - return data; -} - -/** CoverageMap is a map of `FileCoverage` objects keyed by file paths. */ -class CoverageMap { - /** - * @constructor - * @param {Object} [obj=undefined] obj A coverage map from which to initialize this - * map's contents. This can be the raw global coverage object. - */ - constructor(obj) { - if (obj instanceof CoverageMap) { - this.data = obj.data; - } else { - this.data = loadMap(obj); - } - } - - /** - * merges a second coverage map into this one - * @param {CoverageMap} obj - a CoverageMap or its raw data. Coverage is merged - * correctly for the same files and additional file coverage keys are created - * as needed. - */ - merge(obj) { - const other = maybeConstruct(obj, CoverageMap); - Object.values(other.data).forEach(fc => { - this.addFileCoverage(fc); - }); - } - - /** - * filter the coveragemap based on the callback provided - * @param {Function (filename)} callback - Returns true if the path - * should be included in the coveragemap. False if it should be - * removed. - */ - filter(callback) { - Object.keys(this.data).forEach(k => { - if (!callback(k)) { - delete this.data[k]; - } - }); - } - - /** - * returns a JSON-serializable POJO for this coverage map - * @returns {Object} - */ - toJSON() { - return this.data; - } - - /** - * returns an array for file paths for which this map has coverage - * @returns {Array{string}} - array of files - */ - files() { - return Object.keys(this.data); - } - - /** - * returns the file coverage for the specified file. - * @param {String} file - * @returns {FileCoverage} - */ - fileCoverageFor(file) { - const fc = this.data[file]; - if (!fc) { - throw new Error(`No file coverage available for: ${file}`); - } - return fc; - } - - /** - * adds a file coverage object to this map. If the path for the object, - * already exists in the map, it is merged with the existing coverage - * otherwise a new key is added to the map. - * @param {FileCoverage} fc the file coverage to add - */ - addFileCoverage(fc) { - const cov = new FileCoverage(fc); - const { path } = cov; - if (this.data[path]) { - this.data[path].merge(cov); - } else { - this.data[path] = cov; - } - } - - /** - * returns the coverage summary for all the file coverage objects in this map. - * @returns {CoverageSummary} - */ - getCoverageSummary() { - const ret = new CoverageSummary(); - Object.values(this.data).forEach(fc => { - ret.merge(fc.toSummary()); - }); - - return ret; - } -} - -module.exports = { - CoverageMap -}; diff --git a/node_modules/istanbul-lib-coverage/lib/coverage-summary.js b/node_modules/istanbul-lib-coverage/lib/coverage-summary.js deleted file mode 100644 index 9b769c66a..000000000 --- a/node_modules/istanbul-lib-coverage/lib/coverage-summary.js +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const percent = require('./percent'); -const dataProperties = require('./data-properties'); - -function blankSummary() { - const empty = () => ({ - total: 0, - covered: 0, - skipped: 0, - pct: 'Unknown' - }); - - return { - lines: empty(), - statements: empty(), - functions: empty(), - branches: empty(), - branchesTrue: empty() - }; -} - -// asserts that a data object "looks like" a summary coverage object -function assertValidSummary(obj) { - const valid = - obj && obj.lines && obj.statements && obj.functions && obj.branches; - if (!valid) { - throw new Error( - 'Invalid summary coverage object, missing keys, found:' + - Object.keys(obj).join(',') - ); - } -} - -/** - * CoverageSummary provides a summary of code coverage . It exposes 4 properties, - * `lines`, `statements`, `branches`, and `functions`. Each of these properties - * is an object that has 4 keys `total`, `covered`, `skipped` and `pct`. - * `pct` is a percentage number (0-100). - */ -class CoverageSummary { - /** - * @constructor - * @param {Object|CoverageSummary} [obj=undefined] an optional data object or - * another coverage summary to initialize this object with. - */ - constructor(obj) { - if (!obj) { - this.data = blankSummary(); - } else if (obj instanceof CoverageSummary) { - this.data = obj.data; - } else { - this.data = obj; - } - assertValidSummary(this.data); - } - - /** - * merges a second summary coverage object into this one - * @param {CoverageSummary} obj - another coverage summary object - */ - merge(obj) { - const keys = [ - 'lines', - 'statements', - 'branches', - 'functions', - 'branchesTrue' - ]; - keys.forEach(key => { - if (obj[key]) { - this[key].total += obj[key].total; - this[key].covered += obj[key].covered; - this[key].skipped += obj[key].skipped; - this[key].pct = percent(this[key].covered, this[key].total); - } - }); - - return this; - } - - /** - * returns a POJO that is JSON serializable. May be used to get the raw - * summary object. - */ - toJSON() { - return this.data; - } - - /** - * return true if summary has no lines of code - */ - isEmpty() { - return this.lines.total === 0; - } -} - -dataProperties(CoverageSummary, [ - 'lines', - 'statements', - 'functions', - 'branches', - 'branchesTrue' -]); - -module.exports = { - CoverageSummary -}; diff --git a/node_modules/istanbul-lib-coverage/lib/data-properties.js b/node_modules/istanbul-lib-coverage/lib/data-properties.js deleted file mode 100644 index 3a12d40e9..000000000 --- a/node_modules/istanbul-lib-coverage/lib/data-properties.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -module.exports = function dataProperties(klass, properties) { - properties.forEach(p => { - Object.defineProperty(klass.prototype, p, { - enumerable: true, - get() { - return this.data[p]; - } - }); - }); -}; diff --git a/node_modules/istanbul-lib-coverage/lib/file-coverage.js b/node_modules/istanbul-lib-coverage/lib/file-coverage.js deleted file mode 100644 index 80a36ab55..000000000 --- a/node_modules/istanbul-lib-coverage/lib/file-coverage.js +++ /dev/null @@ -1,345 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const percent = require('./percent'); -const dataProperties = require('./data-properties'); -const { CoverageSummary } = require('./coverage-summary'); - -// returns a data object that represents empty coverage -function emptyCoverage(filePath, reportLogic) { - const cov = { - path: filePath, - statementMap: {}, - fnMap: {}, - branchMap: {}, - s: {}, - f: {}, - b: {} - }; - if (reportLogic) cov.bT = {}; - return cov; -} - -// asserts that a data object "looks like" a coverage object -function assertValidObject(obj) { - const valid = - obj && - obj.path && - obj.statementMap && - obj.fnMap && - obj.branchMap && - obj.s && - obj.f && - obj.b; - if (!valid) { - throw new Error( - 'Invalid file coverage object, missing keys, found:' + - Object.keys(obj).join(',') - ); - } -} - -const keyFromLoc = ({ start, end }) => - `${start.line}|${start.column}|${end.line}|${end.column}`; - -const mergeProp = (aHits, aMap, bHits, bMap, itemKey = keyFromLoc) => { - const aItems = {}; - for (const [key, itemHits] of Object.entries(aHits)) { - const item = aMap[key]; - aItems[itemKey(item)] = [itemHits, item]; - } - for (const [key, bItemHits] of Object.entries(bHits)) { - const bItem = bMap[key]; - const k = itemKey(bItem); - - if (aItems[k]) { - const aPair = aItems[k]; - if (bItemHits.forEach) { - // should this throw an exception if aPair[0] is not an array? - bItemHits.forEach((hits, h) => { - if (aPair[0][h] !== undefined) aPair[0][h] += hits; - else aPair[0][h] = hits; - }); - } else { - aPair[0] += bItemHits; - } - } else { - aItems[k] = [bItemHits, bItem]; - } - } - const hits = {}; - const map = {}; - - Object.values(aItems).forEach(([itemHits, item], i) => { - hits[i] = itemHits; - map[i] = item; - }); - - return [hits, map]; -}; - -/** - * provides a read-only view of coverage for a single file. - * The deep structure of this object is documented elsewhere. It has the following - * properties: - * - * * `path` - the file path for which coverage is being tracked - * * `statementMap` - map of statement locations keyed by statement index - * * `fnMap` - map of function metadata keyed by function index - * * `branchMap` - map of branch metadata keyed by branch index - * * `s` - hit counts for statements - * * `f` - hit count for functions - * * `b` - hit count for branches - */ -class FileCoverage { - /** - * @constructor - * @param {Object|FileCoverage|String} pathOrObj is a string that initializes - * and empty coverage object with the specified file path or a data object that - * has all the required properties for a file coverage object. - */ - constructor(pathOrObj, reportLogic = false) { - if (!pathOrObj) { - throw new Error( - 'Coverage must be initialized with a path or an object' - ); - } - if (typeof pathOrObj === 'string') { - this.data = emptyCoverage(pathOrObj, reportLogic); - } else if (pathOrObj instanceof FileCoverage) { - this.data = pathOrObj.data; - } else if (typeof pathOrObj === 'object') { - this.data = pathOrObj; - } else { - throw new Error('Invalid argument to coverage constructor'); - } - assertValidObject(this.data); - } - - /** - * returns computed line coverage from statement coverage. - * This is a map of hits keyed by line number in the source. - */ - getLineCoverage() { - const statementMap = this.data.statementMap; - const statements = this.data.s; - const lineMap = Object.create(null); - - Object.entries(statements).forEach(([st, count]) => { - /* istanbul ignore if: is this even possible? */ - if (!statementMap[st]) { - return; - } - const { line } = statementMap[st].start; - const prevVal = lineMap[line]; - if (prevVal === undefined || prevVal < count) { - lineMap[line] = count; - } - }); - return lineMap; - } - - /** - * returns an array of uncovered line numbers. - * @returns {Array} an array of line numbers for which no hits have been - * collected. - */ - getUncoveredLines() { - const lc = this.getLineCoverage(); - const ret = []; - Object.entries(lc).forEach(([l, hits]) => { - if (hits === 0) { - ret.push(l); - } - }); - return ret; - } - - /** - * returns a map of branch coverage by source line number. - * @returns {Object} an object keyed by line number. Each object - * has a `covered`, `total` and `coverage` (percentage) property. - */ - getBranchCoverageByLine() { - const branchMap = this.branchMap; - const branches = this.b; - const ret = {}; - Object.entries(branchMap).forEach(([k, map]) => { - const line = map.line || map.loc.start.line; - const branchData = branches[k]; - ret[line] = ret[line] || []; - ret[line].push(...branchData); - }); - Object.entries(ret).forEach(([k, dataArray]) => { - const covered = dataArray.filter(item => item > 0); - const coverage = (covered.length / dataArray.length) * 100; - ret[k] = { - covered: covered.length, - total: dataArray.length, - coverage - }; - }); - return ret; - } - - /** - * return a JSON-serializable POJO for this file coverage object - */ - toJSON() { - return this.data; - } - - /** - * merges a second coverage object into this one, updating hit counts - * @param {FileCoverage} other - the coverage object to be merged into this one. - * Note that the other object should have the same structure as this one (same file). - */ - merge(other) { - if (other.all === true) { - return; - } - - if (this.all === true) { - this.data = other.data; - return; - } - - let [hits, map] = mergeProp( - this.s, - this.statementMap, - other.s, - other.statementMap - ); - this.data.s = hits; - this.data.statementMap = map; - - const keyFromLocProp = x => keyFromLoc(x.loc); - const keyFromLocationsProp = x => keyFromLoc(x.locations[0]); - - [hits, map] = mergeProp( - this.f, - this.fnMap, - other.f, - other.fnMap, - keyFromLocProp - ); - this.data.f = hits; - this.data.fnMap = map; - - [hits, map] = mergeProp( - this.b, - this.branchMap, - other.b, - other.branchMap, - keyFromLocationsProp - ); - this.data.b = hits; - this.data.branchMap = map; - - // Tracking additional information about branch truthiness - // can be optionally enabled: - if (this.bT && other.bT) { - [hits, map] = mergeProp( - this.bT, - this.branchMap, - other.bT, - other.branchMap, - keyFromLocationsProp - ); - this.data.bT = hits; - } - } - - computeSimpleTotals(property) { - let stats = this[property]; - - if (typeof stats === 'function') { - stats = stats.call(this); - } - - const ret = { - total: Object.keys(stats).length, - covered: Object.values(stats).filter(v => !!v).length, - skipped: 0 - }; - ret.pct = percent(ret.covered, ret.total); - return ret; - } - - computeBranchTotals(property) { - const stats = this[property]; - const ret = { total: 0, covered: 0, skipped: 0 }; - - Object.values(stats).forEach(branches => { - ret.covered += branches.filter(hits => hits > 0).length; - ret.total += branches.length; - }); - ret.pct = percent(ret.covered, ret.total); - return ret; - } - - /** - * resets hit counts for all statements, functions and branches - * in this coverage object resulting in zero coverage. - */ - resetHits() { - const statements = this.s; - const functions = this.f; - const branches = this.b; - const branchesTrue = this.bT; - Object.keys(statements).forEach(s => { - statements[s] = 0; - }); - Object.keys(functions).forEach(f => { - functions[f] = 0; - }); - Object.keys(branches).forEach(b => { - branches[b].fill(0); - }); - // Tracking additional information about branch truthiness - // can be optionally enabled: - if (branchesTrue) { - Object.keys(branchesTrue).forEach(bT => { - branchesTrue[bT].fill(0); - }); - } - } - - /** - * returns a CoverageSummary for this file coverage object - * @returns {CoverageSummary} - */ - toSummary() { - const ret = {}; - ret.lines = this.computeSimpleTotals('getLineCoverage'); - ret.functions = this.computeSimpleTotals('f', 'fnMap'); - ret.statements = this.computeSimpleTotals('s', 'statementMap'); - ret.branches = this.computeBranchTotals('b'); - // Tracking additional information about branch truthiness - // can be optionally enabled: - if (this['bt']) { - ret.branchesTrue = this.computeBranchTotals('bT'); - } - return new CoverageSummary(ret); - } -} - -// expose coverage data attributes -dataProperties(FileCoverage, [ - 'path', - 'statementMap', - 'fnMap', - 'branchMap', - 's', - 'f', - 'b', - 'bT', - 'all' -]); - -module.exports = { - FileCoverage -}; diff --git a/node_modules/istanbul-lib-coverage/lib/percent.js b/node_modules/istanbul-lib-coverage/lib/percent.js deleted file mode 100644 index c7b7aafa4..000000000 --- a/node_modules/istanbul-lib-coverage/lib/percent.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -module.exports = function percent(covered, total) { - let tmp; - if (total > 0) { - tmp = (1000 * 100 * covered) / total; - return Math.floor(tmp / 10) / 100; - } else { - return 100.0; - } -}; diff --git a/node_modules/istanbul-lib-coverage/package.json b/node_modules/istanbul-lib-coverage/package.json deleted file mode 100644 index 628584f1a..000000000 --- a/node_modules/istanbul-lib-coverage/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "istanbul-lib-coverage", - "version": "3.2.0", - "description": "Data library for istanbul coverage objects", - "author": "Krishnan Anantheswaran ", - "main": "index.js", - "files": [ - "lib", - "index.js" - ], - "scripts": { - "test": "nyc mocha" - }, - "devDependencies": { - "chai": "^4.2.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0-beta.2" - }, - "karmaDeps": { - "browserify-istanbul": "^0.2.1", - "karma": "^0.13.10", - "karma-browserify": "^4.2.1", - "karma-chrome-launcher": "^0.2.0", - "karma-coverage": "^0.4.2", - "karma-mocha": "^0.2.0", - "karma-phantomjs-launcher": "^0.2.0", - "phantomjs": "^1.9.17" - }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git", - "directory": "packages/istanbul-lib-coverage" - }, - "keywords": [ - "istanbul", - "coverage", - "data" - ], - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/istanbuljs/istanbuljs/issues" - }, - "homepage": "https://istanbul.js.org/", - "engines": { - "node": ">=8" - } -} diff --git a/node_modules/istanbul-lib-instrument/CHANGELOG.md b/node_modules/istanbul-lib-instrument/CHANGELOG.md deleted file mode 100644 index 8b8ac0592..000000000 --- a/node_modules/istanbul-lib-instrument/CHANGELOG.md +++ /dev/null @@ -1,631 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [5.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.2.0...istanbul-lib-instrument-v5.2.1) (2022-10-05) - - -### Bug Fixes - -* handle error when inputSourceMap is not a plain object ([#662](https://github.com/istanbuljs/istanbuljs/issues/662)) ([3e3611f](https://github.com/istanbuljs/istanbuljs/commit/3e3611f0efffefd5f87e6cbccd840e9f33aaf43e)) - -## [5.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.1.0...istanbul-lib-instrument-v5.2.0) (2022-02-21) - - -### Features - -* exclude Empty Object and Arrays in Truthy Detection ([#666](https://github.com/istanbuljs/istanbuljs/issues/666)) ([e279684](https://github.com/istanbuljs/istanbuljs/commit/e279684e735f4b7dbe2b632cde2515f6862099de)) - -## [5.1.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.4...istanbul-lib-instrument-v5.1.0) (2021-10-27) - - -### Features - -* option to evaluate logical truthiness, for applications such as fuzzing ([#629](https://www.github.com/istanbuljs/istanbuljs/issues/629)) ([a743b84](https://www.github.com/istanbuljs/istanbuljs/commit/a743b8442e977f0c77ffa282eed7ac84ca200d1f)) - -### [5.0.4](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.3...istanbul-lib-instrument-v5.0.4) (2021-10-16) - - -### Bug Fixes - -* **magic-value:** make incrementing magic value a manual step ([#641](https://www.github.com/istanbuljs/istanbuljs/issues/641)) ([823010b](https://www.github.com/istanbuljs/istanbuljs/commit/823010b821cf81bd91377d75fc83f0875925db66)) - -### [5.0.3](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.2...istanbul-lib-instrument-v5.0.3) (2021-10-06) - - -### Bug Fixes - -* coverage.branchMap else location. ([#633](https://www.github.com/istanbuljs/istanbuljs/issues/633)) ([eb4b4ec](https://www.github.com/istanbuljs/istanbuljs/commit/eb4b4ec8f4b858655a66b0033fcc662f44ef4cc9)) - -### [5.0.2](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.1...istanbul-lib-instrument-v5.0.2) (2021-09-13) - - -### Bug Fixes - -* **build:** verfiy automated publication ([b232690](https://www.github.com/istanbuljs/istanbuljs/commit/b232690193f4b524332046c96dd1cdc6e881c6c7)) - -### [5.0.1](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v5.0.0...istanbul-lib-instrument-v5.0.1) (2021-09-13) - - -### Bug Fixes - -* **build:** verfiy automated publication ([74c96bd](https://www.github.com/istanbuljs/istanbuljs/commit/74c96bdc4224a06e2e1166ebd9adf8faf28438b1)) - -## [5.0.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument-v4.0.3...istanbul-lib-instrument-v5.0.0) (2021-09-13) - - -### ⚠ BREAKING CHANGES - -* istanbul-lib-instrument no longer uses babel - -### Code Refactoring - -* istanbul-lib-instrument no longer uses babel ([8d3badb](https://www.github.com/istanbuljs/istanbuljs/commit/8d3badb8f6c9a4bed9af8e19c3ac6459ebd7267b)) - -## [4.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.2...istanbul-lib-instrument@4.0.3) (2020-05-09) - - -### Bug Fixes - -* Prevent readInitialCoverage from reading babel config ([#562](https://github.com/istanbuljs/istanbuljs/issues/562)) ([49b4745](https://github.com/istanbuljs/istanbuljs/commit/49b474525c15e703642916011bd86f663aca0c3d)) - - - - - -## [4.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.1...istanbul-lib-instrument@4.0.2) (2020-05-06) - - -### Bug Fixes - -* Add ts-ignore to reassignment of generated function ([#557](https://github.com/istanbuljs/istanbuljs/issues/557)) ([817efb0](https://github.com/istanbuljs/istanbuljs/commit/817efb04fc161efae426b2231a0221606b09f559)) -* Use @babel/core for all babel imports. ([#555](https://github.com/istanbuljs/istanbuljs/issues/555)) ([a99a13e](https://github.com/istanbuljs/istanbuljs/commit/a99a13ee6931fc124a2a723c3f511cdbcb0aa81d)) - - - - - -## [4.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0...istanbul-lib-instrument@4.0.1) (2020-02-03) - - -### Bug Fixes - -* Always call coverage initialization function ([#524](https://github.com/istanbuljs/istanbuljs/issues/524)) ([c6536c1](https://github.com/istanbuljs/istanbuljs/commit/c6536c14bf0663ca7e0493dd40ea132b05352594)) - - - - - -# [4.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.3...istanbul-lib-instrument@4.0.0) (2019-12-20) - -**Note:** Version bump only for package istanbul-lib-instrument - - - - - -# [4.0.0-alpha.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.2...istanbul-lib-instrument@4.0.0-alpha.3) (2019-12-07) - -**Note:** Version bump only for package istanbul-lib-instrument - - - - - -# [4.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.1...istanbul-lib-instrument@4.0.0-alpha.2) (2019-11-01) - - -### Bug Fixes - -* Produce properly merged source-maps when inputSourceMap is provided ([#487](https://github.com/istanbuljs/istanbuljs/issues/487)) ([8f8c88e](https://github.com/istanbuljs/istanbuljs/commit/8f8c88e3a2add4c08729e41e356aa7981dc69d4d)) - - - - - -# [4.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@4.0.0-alpha.0...istanbul-lib-instrument@4.0.0-alpha.1) (2019-10-06) - - -### Bug Fixes - -* Eliminate babel hoisting of the coverage variable ([#481](https://github.com/istanbuljs/istanbuljs/issues/481)) ([8dfbcba](https://github.com/istanbuljs/istanbuljs/commit/8dfbcba)), closes [#92](https://github.com/istanbuljs/istanbuljs/issues/92) -* Honor ignore hints in chained if statements ([#469](https://github.com/istanbuljs/istanbuljs/issues/469)) ([a629770](https://github.com/istanbuljs/istanbuljs/commit/a629770)), closes [#468](https://github.com/istanbuljs/istanbuljs/issues/468) -* Populate lastFileCoverage for already instrumented files ([#470](https://github.com/istanbuljs/istanbuljs/issues/470)) ([ea6d779](https://github.com/istanbuljs/istanbuljs/commit/ea6d779)), closes [istanbuljs/nyc#594](https://github.com/istanbuljs/nyc/issues/594) - - -### Features - -* Use @istanbuljs/schema to pull defaults ([#485](https://github.com/istanbuljs/istanbuljs/issues/485)) ([87e27f3](https://github.com/istanbuljs/istanbuljs/commit/87e27f3)), closes [#460](https://github.com/istanbuljs/istanbuljs/issues/460) - - -### BREAKING CHANGES - -* The defaults for `autoWrap`, `preserveComments`, -`esModules` and `produceSourceMap` are now true. This applies only to -the stand-alone instrumenter, the visitor does not use these options. -* The `flow` and `jsx` parser plugins are no longer -enabled by default. This applies only to the stand-alone instrumenter, -the visitor does not use this option. -* The `plugins` option of the stand-alone instrumenter -has been renamed to `parserPlugins` to match nyc. - - - - - -# [4.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.3.0...istanbul-lib-instrument@4.0.0-alpha.0) (2019-06-19) - - -### Features - -* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539)) - - -### BREAKING CHANGES - -* Node.js 8 is now required - - - - - -# [3.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.2.0...istanbul-lib-instrument@3.3.0) (2019-04-24) - - -### Features - -* Enable classProperties and classPrivateProperties parsers and coverage. ([#379](https://github.com/istanbuljs/istanbuljs/issues/379)) ([c09dc38](https://github.com/istanbuljs/istanbuljs/commit/c09dc38)) - - - - - -# [3.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.2...istanbul-lib-instrument@3.2.0) (2019-04-09) - - -### Features - -* Add bigInt and importMeta to default parser plugins. ([#356](https://github.com/istanbuljs/istanbuljs/issues/356)) ([fb4d6ed](https://github.com/istanbuljs/istanbuljs/commit/fb4d6ed)), closes [#338](https://github.com/istanbuljs/istanbuljs/issues/338) - - - - - -## [3.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.1...istanbul-lib-instrument@3.1.2) (2019-04-03) - - -### Bug Fixes - -* Be more friendly to ts-node. ([#352](https://github.com/istanbuljs/istanbuljs/issues/352)) ([40d15f5](https://github.com/istanbuljs/istanbuljs/commit/40d15f5)), closes [#336](https://github.com/istanbuljs/istanbuljs/issues/336) - - - - - -## [3.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.0...istanbul-lib-instrument@3.1.1) (2019-03-12) - - -### Bug Fixes - -* Honor istanbul ignore next hints placed before export statement. ([#298](https://github.com/istanbuljs/istanbuljs/issues/298)) ([f24795d](https://github.com/istanbuljs/istanbuljs/commit/f24795d)), closes [#297](https://github.com/istanbuljs/istanbuljs/issues/297) - - - - - -# [3.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.0.1...istanbul-lib-instrument@3.1.0) (2019-01-26) - - -### Features - -* dont skip for loop initialization instrumentation ([#188](https://github.com/istanbuljs/istanbuljs/issues/188)) ([2e0258e](https://github.com/istanbuljs/istanbuljs/commit/2e0258e)) -* New options coverageGlobalScope and coverageGlobalScopeFunc. ([#200](https://github.com/istanbuljs/istanbuljs/issues/200)) ([25509c7](https://github.com/istanbuljs/istanbuljs/commit/25509c7)), closes [#199](https://github.com/istanbuljs/istanbuljs/issues/199) - - - - - - -## [3.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.0.0...istanbul-lib-instrument@3.0.1) (2018-12-25) - - - - -**Note:** Version bump only for package istanbul-lib-instrument - - -# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.2...istanbul-lib-instrument@3.0.0) (2018-09-06) - - -### Chores - -* Update test for babel 7. ([#218](https://github.com/istanbuljs/istanbuljs/issues/218)) ([9cf4d43](https://github.com/istanbuljs/istanbuljs/commit/9cf4d43)), closes [#205](https://github.com/istanbuljs/istanbuljs/issues/205) - - -### Features - -* Add option plugins ([#205](https://github.com/istanbuljs/istanbuljs/issues/205)) ([312f81f](https://github.com/istanbuljs/istanbuljs/commit/312f81f)) -* Update babel to 7.0.0. ([#215](https://github.com/istanbuljs/istanbuljs/issues/215)) ([8a96613](https://github.com/istanbuljs/istanbuljs/commit/8a96613)) - - -### BREAKING CHANGES - -* was added which requires an option for the `decorators` -plugin. Add it to get tests working again, commit updated api.md. - - - - - -## [2.3.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.1...istanbul-lib-instrument@2.3.2) (2018-07-24) - - - - -**Note:** Version bump only for package istanbul-lib-instrument - - -## [2.3.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.3.0...istanbul-lib-instrument@2.3.1) (2018-07-07) - - -### Bug Fixes - -* Don't ignore src/visitor.js for self test. ([#194](https://github.com/istanbuljs/istanbuljs/issues/194)) ([71b815d](https://github.com/istanbuljs/istanbuljs/commit/71b815d)) - - - - - -# [2.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.2.1...istanbul-lib-instrument@2.3.0) (2018-06-27) - - -### Features - -* update pinned babel version to latest release. ([#189](https://github.com/istanbuljs/istanbuljs/issues/189)) ([ac8ec07](https://github.com/istanbuljs/istanbuljs/commit/ac8ec07)) - - - - - -## [2.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.2.0...istanbul-lib-instrument@2.2.1) (2018-06-26) - - -### Bug Fixes - -* Instrument ObjectMethod's. ([#182](https://github.com/istanbuljs/istanbuljs/issues/182)) ([126f09d](https://github.com/istanbuljs/istanbuljs/commit/126f09d)) -* update default args test guard to work on supported versions. ([#185](https://github.com/istanbuljs/istanbuljs/issues/185)) ([955511a](https://github.com/istanbuljs/istanbuljs/commit/955511a)) - - - - - -# [2.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.2...istanbul-lib-instrument@2.2.0) (2018-06-06) - - -### Features - -* add support for optional catch binding ([#175](https://github.com/istanbuljs/istanbuljs/issues/175)) ([088dd9f](https://github.com/istanbuljs/istanbuljs/commit/088dd9f)) - - - - - -# [2.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.2...istanbul-lib-instrument@2.1.0) (2018-05-31) - - -### Features - -* add support for optional catch binding ([#175](https://github.com/istanbuljs/istanbuljs/issues/175)) ([088dd9f](https://github.com/istanbuljs/istanbuljs/commit/088dd9f)) - - - - - -## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.1...istanbul-lib-instrument@2.0.2) (2018-05-31) - - - - -**Note:** Version bump only for package istanbul-lib-instrument - - -## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@2.0.0...istanbul-lib-instrument@2.0.1) (2018-05-31) - - -### Bug Fixes - -* should import [@babel](https://github.com/babel)/template ([85a0d1a](https://github.com/istanbuljs/istanbuljs/commit/85a0d1a)) - - - - - -# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.10.1...istanbul-lib-instrument@2.0.0) (2018-05-31) - - -### Bug Fixes - -* parenthesize superClass on non-idetifier case ([#158](https://github.com/istanbuljs/istanbuljs/issues/158)) ([6202c88](https://github.com/istanbuljs/istanbuljs/commit/6202c88)) - - -### Chores - -* upgrade babel in instrumenter ([#174](https://github.com/istanbuljs/istanbuljs/issues/174)) ([ce23e91](https://github.com/istanbuljs/istanbuljs/commit/ce23e91)) - - -### BREAKING CHANGES - -* babel@7 drops Node@4 support - - - - - -## [1.10.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.10.0...istanbul-lib-instrument@1.10.1) (2018-03-09) - - -### Bug Fixes - -* default value for ignorelassMethods ([#151](https://github.com/istanbuljs/istanbuljs/issues/151)) ([5dd88e8](https://github.com/istanbuljs/istanbuljs/commit/5dd88e8)) - - - - - -# [1.10.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.2...istanbul-lib-instrument@1.10.0) (2018-03-04) - - -### Features - -* allows an array of ignored method names to be provided ([#127](https://github.com/istanbuljs/istanbuljs/issues/127)) ([67918e2](https://github.com/istanbuljs/istanbuljs/commit/67918e2)) - - - - - -## [1.9.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.1...istanbul-lib-instrument@1.9.2) (2018-02-13) - - -### Bug Fixes - -* compatibility with babel 7 ([#135](https://github.com/istanbuljs/istanbuljs/issues/135)) ([6cac849](https://github.com/istanbuljs/istanbuljs/commit/6cac849)) -* handle instrumentation when a function is called Function ([#131](https://github.com/istanbuljs/istanbuljs/issues/131)) ([b12a07e](https://github.com/istanbuljs/istanbuljs/commit/b12a07e)) -* proper passing of the preserveComments option to babel ([#122](https://github.com/istanbuljs/istanbuljs/issues/122)) ([470bb0e](https://github.com/istanbuljs/istanbuljs/commit/470bb0e)) -* update instrument, account for lack of arrow expression ([#119](https://github.com/istanbuljs/istanbuljs/issues/119)) ([#125](https://github.com/istanbuljs/istanbuljs/issues/125)) ([0968206](https://github.com/istanbuljs/istanbuljs/commit/0968206)) - - - - - -## [1.9.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.9.0...istanbul-lib-instrument@1.9.1) (2017-10-22) - - -### Bug Fixes - -* address issue with class instrumentation ([#111](https://github.com/istanbuljs/istanbuljs/issues/111)) ([cbd1c14](https://github.com/istanbuljs/istanbuljs/commit/cbd1c14)) - - - - - -# [1.9.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.8.0...istanbul-lib-instrument@1.9.0) (2017-10-21) - - -### Bug Fixes - -* support conditional expression for superClass ([#106](https://github.com/istanbuljs/istanbuljs/issues/106)) ([aae256f](https://github.com/istanbuljs/istanbuljs/commit/aae256f)) - - -### Features - -* add support for ignoring entire files ([#108](https://github.com/istanbuljs/istanbuljs/issues/108)) ([f12da65](https://github.com/istanbuljs/istanbuljs/commit/f12da65)) - - - - - -# [1.8.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.5...istanbul-lib-instrument@1.8.0) (2017-09-05) - - -### Features - -* add support for object-spread syntax ([#82](https://github.com/istanbuljs/istanbuljs/issues/82)) ([28d5566](https://github.com/istanbuljs/istanbuljs/commit/28d5566)) - - - - - -## [1.7.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.4...istanbul-lib-instrument@1.7.5) (2017-08-23) - - -### Bug Fixes - -* name of function is now preserved or named exports ([#79](https://github.com/istanbuljs/istanbuljs/issues/79)) ([2ce8974](https://github.com/istanbuljs/istanbuljs/commit/2ce8974)) - - - - - -## [1.7.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.3...istanbul-lib-instrument@1.7.4) (2017-07-16) - - -### Bug Fixes - -* update increment operator to appropriate expression type ([#74](https://github.com/istanbuljs/istanbuljs/issues/74)) ([dc69e66](https://github.com/istanbuljs/istanbuljs/commit/dc69e66)) - - - - - -## [1.7.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.2...istanbul-lib-instrument@1.7.3) (2017-06-25) - - - - - -## [1.7.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@1.7.1...istanbul-lib-instrument@1.7.2) (2017-05-27) - - -### Bug Fixes - -* hoist statement counter for class variables, so that name is preserved ([#60](https://github.com/istanbuljs/istanbuljs/issues/60)) ([120d221](https://github.com/istanbuljs/istanbuljs/commit/120d221)) - - - - - -## [1.7.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.7.0...istanbul-lib-instrument@1.7.1) (2017-04-29) - - -### Bug Fixes - -* don't instrument a file if it has already been instrumented ([#38](https://github.com/istanbuljs/istanbuljs/issues/38)) ([9c38e4e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/9c38e4e)) - - - - - -# [1.7.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.2...istanbul-lib-instrument@1.7.0) (2017-03-27) - - -### Features - -* use extended babylon support; adding features such as jsx ([#22](https://github.com/istanbuljs/istanbuljs/issues/22)) ([11c2438](https://github.com/istanbuljs/istanbul-lib-instrument/commit/11c2438)) - - -## [1.6.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.1...istanbul-lib-instrument@1.6.2) (2017-03-22) - - -### Bug Fixes - -* loc is sometimes not defined, so loc.start fails see [#99](https://github.com/istanbuljs/istanbuljs/issues/99) ([#18](https://github.com/istanbuljs/istanbuljs/issues/18)) ([df85ba6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/df85ba6)) - - -## [1.6.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.0...istanbul-lib-instrument@1.6.1) (2017-03-21) - - -# [1.6.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.4.2...istanbul-lib-instrument@1.6.0) (2017-03-21) - - -### Features - -* adds line number property back to coverage.json ([b03b927](https://github.com/istanbuljs/istanbul-lib-instrument/commit/b03b927)) - - -## [1.4.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.4.1...v1.4.2) (2017-01-04) - - -### Bug Fixes - -* only hoist counter for a smaller subset of function declarations ([9f8931e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/9f8931e)) - - - - -## [1.4.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.4.0...v1.4.1) (2017-01-04) - - -### Bug Fixes - -* address regression discussed in https://github.com/istanbuljs/babel-plugin-istanbul/issues/78 ([#40](https://github.com/istanbuljs/istanbul-lib-instrument/issues/40)) ([7f458a3](https://github.com/istanbuljs/istanbul-lib-instrument/commit/7f458a3)) - - - - -# [1.4.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.3.1...v1.4.0) (2017-01-02) - - -### Features - -* preserve inferred function names ([#38](https://github.com/istanbuljs/istanbul-lib-instrument/issues/38)) ([312666e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/312666e)) - - - - -## [1.3.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.3.0...v1.3.1) (2016-12-27) - - -### Bug Fixes - -* function declaration assignment now retains function name ([#33](https://github.com/istanbuljs/istanbul-lib-instrument/issues/33)) ([2d781da](https://github.com/istanbuljs/istanbul-lib-instrument/commit/2d781da)) - - - - -# [1.3.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.2.0...v1.3.0) (2016-11-10) - - -### Features - -* allow an input source-map to be passed to instrumentSync() ([#23](https://github.com/istanbuljs/istanbul-lib-instrument/issues/23)) ([b08e4f5](https://github.com/istanbuljs/istanbul-lib-instrument/commit/b08e4f5)) - - - - -# [1.2.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.4...v1.2.0) (2016-10-25) - - -### Features - -* implement function to extract empty coverage data from an instrumented file ([#28](https://github.com/istanbuljs/istanbul-lib-instrument/issues/28)) ([06d0ef6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/06d0ef6)) - - - - -## [1.1.4](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.3...v1.1.4) (2016-10-17) - - -### Bug Fixes - -* hoist coverage variable to very top of file ([#26](https://github.com/istanbuljs/istanbul-lib-instrument/issues/26)) ([0225e8c](https://github.com/istanbuljs/istanbul-lib-instrument/commit/0225e8c)) - - - - -## [1.1.3](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.2...v1.1.3) (2016-09-13) - - -### Performance Improvements - -* simplify coverage variable naming https://github.com/istanbuljs/istanbul-lib-instrument/pull/24 ([7252aae](https://github.com/istanbuljs/istanbul-lib-instrument/commit/7252aae)) - - - - -## [1.1.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.1...v1.1.2) (2016-09-08) - - -### Performance Improvements - -* use zero-based numeric indices for much faster instrumented code ([#22](https://github.com/istanbuljs/istanbul-lib-instrument/issues/22)) ([5b401f5](https://github.com/istanbuljs/istanbul-lib-instrument/commit/5b401f5)) - - - - -## [1.1.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.0...v1.1.1) (2016-08-30) - - -### Bug Fixes - -* upgrade istanbul-lib-coverage ([eb9b1f6](https://github.com/istanbuljs/istanbul-lib-instrument/commit/eb9b1f6)) - - - - -# [1.1.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.0-alpha.4...v1.1.0) (2016-08-11) - - -### Bug Fixes - -* guard against invalid loc ([#16](https://github.com/istanbuljs/istanbul-lib-instrument/issues/16)) ([23ebfc3](https://github.com/istanbuljs/istanbul-lib-instrument/commit/23ebfc3)) - - - - -# [1.1.0-alpha.4](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.0.0-alpha.5...v1.1.0-alpha.4) (2016-07-20) - - -### Bug Fixes - -* require more performant babel-generator ([#15](https://github.com/istanbuljs/istanbul-lib-instrument/issues/15)) ([21b2563](https://github.com/istanbuljs/istanbul-lib-instrument/commit/21b2563)) diff --git a/node_modules/istanbul-lib-instrument/LICENSE b/node_modules/istanbul-lib-instrument/LICENSE deleted file mode 100644 index d55d2916e..000000000 --- a/node_modules/istanbul-lib-instrument/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright 2012-2015 Yahoo! Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Yahoo! Inc. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/istanbul-lib-instrument/README.md b/node_modules/istanbul-lib-instrument/README.md deleted file mode 100644 index 902831cfb..000000000 --- a/node_modules/istanbul-lib-instrument/README.md +++ /dev/null @@ -1,22 +0,0 @@ -## istanbul-lib-instrument - -[![Build Status](https://travis-ci.org/istanbuljs/istanbul-lib-instrument.svg?branch=master)](https://travis-ci.org/istanbuljs/istanbul-lib-instrument) - -Istanbul instrumenter library. - -Version 1.1.x now implements instrumentation using `Babel`. The implementation is inspired -by prior art by @dtinth as demonstrated in the `__coverage__` babel plugin. - -It provides 2 "modes" of instrumentation. - -- The old API that is mostly unchanged (except for incompatibilities noted) and - performs the instrumentation using babel as a library. - -- A `programVisitor` function for the Babel AST that can be used by a Babel plugin - to emit instrumentation for ES6 code directly without any source map - processing. This is the preferred path for babel users. The Babel plugin is - called `babel-plugin-istanbul`. - -Incompatibilities and changes to instrumentation behavior can be found in -[v0-changes.md](v0-changes.md). - diff --git a/node_modules/istanbul-lib-instrument/package.json b/node_modules/istanbul-lib-instrument/package.json deleted file mode 100644 index bcf03e2e6..000000000 --- a/node_modules/istanbul-lib-instrument/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "istanbul-lib-instrument", - "version": "5.2.1", - "description": "Core istanbul API for JS code coverage", - "author": "Krishnan Anantheswaran ", - "main": "src/index.js", - "files": [ - "src" - ], - "scripts": { - "test": "nyc mocha" - }, - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "devDependencies": { - "@babel/cli": "^7.7.5", - "chai": "^4.2.0", - "clone": "^2.1.2", - "debug": "^4.1.1", - "documentation": "^12.1.4", - "js-yaml": "^3.13.1", - "mocha": "^6.2.3", - "nopt": "^4.0.1", - "nyc": "^15.1.0" - }, - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/istanbuljs/istanbuljs/issues" - }, - "homepage": "https://istanbul.js.org/", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git", - "directory": "packages/istanbul-lib-instrument" - }, - "keywords": [ - "coverage", - "istanbul", - "js", - "instrumentation" - ], - "engines": { - "node": ">=8" - } -} diff --git a/node_modules/istanbul-lib-instrument/src/constants.js b/node_modules/istanbul-lib-instrument/src/constants.js deleted file mode 100644 index 2cd402bc0..000000000 --- a/node_modules/istanbul-lib-instrument/src/constants.js +++ /dev/null @@ -1,14 +0,0 @@ -const { createHash } = require('crypto'); -const { name } = require('../package.json'); -// TODO: increment this version if there are schema changes -// that are not backwards compatible: -const VERSION = '4'; - -const SHA = 'sha1'; -module.exports = { - SHA, - MAGIC_KEY: '_coverageSchema', - MAGIC_VALUE: createHash(SHA) - .update(name + '@' + VERSION) - .digest('hex') -}; diff --git a/node_modules/istanbul-lib-instrument/src/index.js b/node_modules/istanbul-lib-instrument/src/index.js deleted file mode 100644 index 33d2a4c1a..000000000 --- a/node_modules/istanbul-lib-instrument/src/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const { defaults } = require('@istanbuljs/schema'); -const Instrumenter = require('./instrumenter'); -const programVisitor = require('./visitor'); -const readInitialCoverage = require('./read-coverage'); - -/** - * createInstrumenter creates a new instrumenter with the - * supplied options. - * @param {Object} opts - instrumenter options. See the documentation - * for the Instrumenter class. - */ -function createInstrumenter(opts) { - return new Instrumenter(opts); -} - -module.exports = { - createInstrumenter, - programVisitor, - readInitialCoverage, - defaultOpts: defaults.instrumenter -}; diff --git a/node_modules/istanbul-lib-instrument/src/instrumenter.js b/node_modules/istanbul-lib-instrument/src/instrumenter.js deleted file mode 100644 index 3322e6eb2..000000000 --- a/node_modules/istanbul-lib-instrument/src/instrumenter.js +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -const { transformSync } = require('@babel/core'); -const { defaults } = require('@istanbuljs/schema'); -const programVisitor = require('./visitor'); -const readInitialCoverage = require('./read-coverage'); - -/** - * Instrumenter is the public API for the instrument library. - * It is typically used for ES5 code. For ES6 code that you - * are already running under `babel` use the coverage plugin - * instead. - * @param {Object} opts optional. - * @param {string} [opts.coverageVariable=__coverage__] name of global coverage variable. - * @param {boolean} [opts.reportLogic=false] report boolean value of logical expressions. - * @param {boolean} [opts.preserveComments=false] preserve comments in output. - * @param {boolean} [opts.compact=true] generate compact code. - * @param {boolean} [opts.esModules=false] set to true to instrument ES6 modules. - * @param {boolean} [opts.autoWrap=false] set to true to allow `return` statements outside of functions. - * @param {boolean} [opts.produceSourceMap=false] set to true to produce a source map for the instrumented code. - * @param {Array} [opts.ignoreClassMethods=[]] set to array of class method names to ignore for coverage. - * @param {Function} [opts.sourceMapUrlCallback=null] a callback function that is called when a source map URL - * is found in the original code. This function is called with the source file name and the source map URL. - * @param {boolean} [opts.debug=false] - turn debugging on. - * @param {array} [opts.parserPlugins] - set babel parser plugins, see @istanbuljs/schema for defaults. - * @param {string} [opts.coverageGlobalScope=this] the global coverage variable scope. - * @param {boolean} [opts.coverageGlobalScopeFunc=true] use an evaluated function to find coverageGlobalScope. - */ -class Instrumenter { - constructor(opts = {}) { - this.opts = { - ...defaults.instrumenter, - ...opts - }; - this.fileCoverage = null; - this.sourceMap = null; - } - /** - * instrument the supplied code and track coverage against the supplied - * filename. It throws if invalid code is passed to it. ES5 and ES6 syntax - * is supported. To instrument ES6 modules, make sure that you set the - * `esModules` property to `true` when creating the instrumenter. - * - * @param {string} code - the code to instrument - * @param {string} filename - the filename against which to track coverage. - * @param {object} [inputSourceMap] - the source map that maps the not instrumented code back to it's original form. - * Is assigned to the coverage object and therefore, is available in the json output and can be used to remap the - * coverage to the untranspiled source. - * @returns {string} the instrumented code. - */ - instrumentSync(code, filename, inputSourceMap) { - if (typeof code !== 'string') { - throw new Error('Code must be a string'); - } - filename = filename || String(new Date().getTime()) + '.js'; - const { opts } = this; - let output = {}; - const babelOpts = { - configFile: false, - babelrc: false, - ast: true, - filename: filename || String(new Date().getTime()) + '.js', - inputSourceMap, - sourceMaps: opts.produceSourceMap, - compact: opts.compact, - comments: opts.preserveComments, - parserOpts: { - allowReturnOutsideFunction: opts.autoWrap, - sourceType: opts.esModules ? 'module' : 'script', - plugins: opts.parserPlugins - }, - plugins: [ - [ - ({ types }) => { - const ee = programVisitor(types, filename, { - coverageVariable: opts.coverageVariable, - reportLogic: opts.reportLogic, - coverageGlobalScope: opts.coverageGlobalScope, - coverageGlobalScopeFunc: - opts.coverageGlobalScopeFunc, - ignoreClassMethods: opts.ignoreClassMethods, - inputSourceMap - }); - - return { - visitor: { - Program: { - enter: ee.enter, - exit(path) { - output = ee.exit(path); - } - } - } - }; - } - ] - ] - }; - - const codeMap = transformSync(code, babelOpts); - - if (!output || !output.fileCoverage) { - const initialCoverage = - readInitialCoverage(codeMap.ast) || - /* istanbul ignore next: paranoid check */ {}; - this.fileCoverage = initialCoverage.coverageData; - this.sourceMap = inputSourceMap; - return code; - } - - this.fileCoverage = output.fileCoverage; - this.sourceMap = codeMap.map; - const cb = this.opts.sourceMapUrlCallback; - if (cb && output.sourceMappingURL) { - cb(filename, output.sourceMappingURL); - } - - return codeMap.code; - } - /** - * callback-style instrument method that calls back with an error - * as opposed to throwing one. Note that in the current implementation, - * the callback will be called in the same process tick and is not asynchronous. - * - * @param {string} code - the code to instrument - * @param {string} filename - the filename against which to track coverage. - * @param {Function} callback - the callback - * @param {Object} inputSourceMap - the source map that maps the not instrumented code back to it's original form. - * Is assigned to the coverage object and therefore, is available in the json output and can be used to remap the - * coverage to the untranspiled source. - */ - instrument(code, filename, callback, inputSourceMap) { - if (!callback && typeof filename === 'function') { - callback = filename; - filename = null; - } - try { - const out = this.instrumentSync(code, filename, inputSourceMap); - callback(null, out); - } catch (ex) { - callback(ex); - } - } - /** - * returns the file coverage object for the last file instrumented. - * @returns {Object} the file coverage object. - */ - lastFileCoverage() { - return this.fileCoverage; - } - /** - * returns the source map produced for the last file instrumented. - * @returns {null|Object} the source map object. - */ - lastSourceMap() { - return this.sourceMap; - } -} - -module.exports = Instrumenter; diff --git a/node_modules/istanbul-lib-instrument/src/read-coverage.js b/node_modules/istanbul-lib-instrument/src/read-coverage.js deleted file mode 100644 index 5b76dbb1d..000000000 --- a/node_modules/istanbul-lib-instrument/src/read-coverage.js +++ /dev/null @@ -1,77 +0,0 @@ -const { parseSync, traverse } = require('@babel/core'); -const { defaults } = require('@istanbuljs/schema'); -const { MAGIC_KEY, MAGIC_VALUE } = require('./constants'); - -function getAst(code) { - if (typeof code === 'object' && typeof code.type === 'string') { - // Assume code is already a babel ast. - return code; - } - - if (typeof code !== 'string') { - throw new Error('Code must be a string'); - } - - // Parse as leniently as possible - return parseSync(code, { - babelrc: false, - configFile: false, - parserOpts: { - allowAwaitOutsideFunction: true, - allowImportExportEverywhere: true, - allowReturnOutsideFunction: true, - allowSuperOutsideMethod: true, - sourceType: 'script', - plugins: defaults.instrumenter.parserPlugins - } - }); -} - -module.exports = function readInitialCoverage(code) { - const ast = getAst(code); - - let covScope; - traverse(ast, { - ObjectProperty(path) { - const { node } = path; - if ( - !node.computed && - path.get('key').isIdentifier() && - node.key.name === MAGIC_KEY - ) { - const magicValue = path.get('value').evaluate(); - if (!magicValue.confident || magicValue.value !== MAGIC_VALUE) { - return; - } - covScope = - path.scope.getFunctionParent() || - path.scope.getProgramParent(); - path.stop(); - } - } - }); - - if (!covScope) { - return null; - } - - const result = {}; - - for (const key of ['path', 'hash', 'gcv', 'coverageData']) { - const binding = covScope.getOwnBinding(key); - if (!binding) { - return null; - } - const valuePath = binding.path.get('init'); - const value = valuePath.evaluate(); - if (!value.confident) { - return null; - } - result[key] = value.value; - } - - delete result.coverageData[MAGIC_KEY]; - delete result.coverageData.hash; - - return result; -}; diff --git a/node_modules/istanbul-lib-instrument/src/source-coverage.js b/node_modules/istanbul-lib-instrument/src/source-coverage.js deleted file mode 100644 index ec3f234d5..000000000 --- a/node_modules/istanbul-lib-instrument/src/source-coverage.js +++ /dev/null @@ -1,135 +0,0 @@ -const { classes } = require('istanbul-lib-coverage'); - -function cloneLocation(loc) { - return { - start: { - line: loc && loc.start.line, - column: loc && loc.start.column - }, - end: { - line: loc && loc.end.line, - column: loc && loc.end.column - } - }; -} -/** - * SourceCoverage provides mutation methods to manipulate the structure of - * a file coverage object. Used by the instrumenter to create a full coverage - * object for a file incrementally. - * - * @private - * @param pathOrObj {String|Object} - see the argument for {@link FileCoverage} - * @extends FileCoverage - * @constructor - */ -class SourceCoverage extends classes.FileCoverage { - constructor(pathOrObj) { - super(pathOrObj); - this.meta = { - last: { - s: 0, - f: 0, - b: 0 - } - }; - } - - newStatement(loc) { - const s = this.meta.last.s; - this.data.statementMap[s] = cloneLocation(loc); - this.data.s[s] = 0; - this.meta.last.s += 1; - return s; - } - - newFunction(name, decl, loc) { - const f = this.meta.last.f; - name = name || '(anonymous_' + f + ')'; - this.data.fnMap[f] = { - name, - decl: cloneLocation(decl), - loc: cloneLocation(loc), - // DEPRECATED: some legacy reports require this info. - line: loc && loc.start.line - }; - this.data.f[f] = 0; - this.meta.last.f += 1; - return f; - } - - newBranch(type, loc, isReportLogic = false) { - const b = this.meta.last.b; - this.data.b[b] = []; - this.data.branchMap[b] = { - loc: cloneLocation(loc), - type, - locations: [], - // DEPRECATED: some legacy reports require this info. - line: loc && loc.start.line - }; - this.meta.last.b += 1; - this.maybeNewBranchTrue(type, b, isReportLogic); - return b; - } - - maybeNewBranchTrue(type, name, isReportLogic) { - if (!isReportLogic) { - return; - } - if (type !== 'binary-expr') { - return; - } - this.data.bT = this.data.bT || {}; - this.data.bT[name] = []; - } - - addBranchPath(name, location) { - const bMeta = this.data.branchMap[name]; - const counts = this.data.b[name]; - - /* istanbul ignore if: paranoid check */ - if (!bMeta) { - throw new Error('Invalid branch ' + name); - } - bMeta.locations.push(cloneLocation(location)); - counts.push(0); - this.maybeAddBranchTrue(name); - return counts.length - 1; - } - - maybeAddBranchTrue(name) { - if (!this.data.bT) { - return; - } - const countsTrue = this.data.bT[name]; - if (!countsTrue) { - return; - } - countsTrue.push(0); - } - - /** - * Assigns an input source map to the coverage that can be used - * to remap the coverage output to the original source - * @param sourceMap {object} the source map - */ - inputSourceMap(sourceMap) { - this.data.inputSourceMap = sourceMap; - } - - freeze() { - // prune empty branches - const map = this.data.branchMap; - const branches = this.data.b; - const branchesT = this.data.bT || {}; - Object.keys(map).forEach(b => { - if (map[b].locations.length === 0) { - delete map[b]; - delete branches[b]; - delete branchesT[b]; - } - }); - } -} - -module.exports = { SourceCoverage }; diff --git a/node_modules/istanbul-lib-instrument/src/visitor.js b/node_modules/istanbul-lib-instrument/src/visitor.js deleted file mode 100644 index 46c71290d..000000000 --- a/node_modules/istanbul-lib-instrument/src/visitor.js +++ /dev/null @@ -1,843 +0,0 @@ -const { createHash } = require('crypto'); -const { template } = require('@babel/core'); -const { defaults } = require('@istanbuljs/schema'); -const { SourceCoverage } = require('./source-coverage'); -const { SHA, MAGIC_KEY, MAGIC_VALUE } = require('./constants'); - -// pattern for istanbul to ignore a section -const COMMENT_RE = /^\s*istanbul\s+ignore\s+(if|else|next)(?=\W|$)/; -// pattern for istanbul to ignore the whole file -const COMMENT_FILE_RE = /^\s*istanbul\s+ignore\s+(file)(?=\W|$)/; -// source map URL pattern -const SOURCE_MAP_RE = /[#@]\s*sourceMappingURL=(.*)\s*$/m; - -// generate a variable name from hashing the supplied file path -function genVar(filename) { - const hash = createHash(SHA); - hash.update(filename); - return 'cov_' + parseInt(hash.digest('hex').substr(0, 12), 16).toString(36); -} - -// VisitState holds the state of the visitor, provides helper functions -// and is the `this` for the individual coverage visitors. -class VisitState { - constructor( - types, - sourceFilePath, - inputSourceMap, - ignoreClassMethods = [], - reportLogic = false - ) { - this.varName = genVar(sourceFilePath); - this.attrs = {}; - this.nextIgnore = null; - this.cov = new SourceCoverage(sourceFilePath); - - if (typeof inputSourceMap !== 'undefined') { - this.cov.inputSourceMap(inputSourceMap); - } - this.ignoreClassMethods = ignoreClassMethods; - this.types = types; - this.sourceMappingURL = null; - this.reportLogic = reportLogic; - } - - // should we ignore the node? Yes, if specifically ignoring - // or if the node is generated. - shouldIgnore(path) { - return this.nextIgnore || !path.node.loc; - } - - // extract the ignore comment hint (next|if|else) or null - hintFor(node) { - let hint = null; - if (node.leadingComments) { - node.leadingComments.forEach(c => { - const v = ( - c.value || /* istanbul ignore next: paranoid check */ '' - ).trim(); - const groups = v.match(COMMENT_RE); - if (groups) { - hint = groups[1]; - } - }); - } - return hint; - } - - // extract a source map URL from comments and keep track of it - maybeAssignSourceMapURL(node) { - const extractURL = comments => { - if (!comments) { - return; - } - comments.forEach(c => { - const v = ( - c.value || /* istanbul ignore next: paranoid check */ '' - ).trim(); - const groups = v.match(SOURCE_MAP_RE); - if (groups) { - this.sourceMappingURL = groups[1]; - } - }); - }; - extractURL(node.leadingComments); - extractURL(node.trailingComments); - } - - // for these expressions the statement counter needs to be hoisted, so - // function name inference can be preserved - counterNeedsHoisting(path) { - return ( - path.isFunctionExpression() || - path.isArrowFunctionExpression() || - path.isClassExpression() - ); - } - - // all the generic stuff that needs to be done on enter for every node - onEnter(path) { - const n = path.node; - - this.maybeAssignSourceMapURL(n); - - // if already ignoring, nothing more to do - if (this.nextIgnore !== null) { - return; - } - // check hint to see if ignore should be turned on - const hint = this.hintFor(n); - if (hint === 'next') { - this.nextIgnore = n; - return; - } - // else check custom node attribute set by a prior visitor - if (this.getAttr(path.node, 'skip-all') !== null) { - this.nextIgnore = n; - } - - // else check for ignored class methods - if ( - path.isFunctionExpression() && - this.ignoreClassMethods.some( - name => path.node.id && name === path.node.id.name - ) - ) { - this.nextIgnore = n; - return; - } - if ( - path.isClassMethod() && - this.ignoreClassMethods.some(name => name === path.node.key.name) - ) { - this.nextIgnore = n; - return; - } - } - - // all the generic stuff on exit of a node, - // including reseting ignores and custom node attrs - onExit(path) { - // restore ignore status, if needed - if (path.node === this.nextIgnore) { - this.nextIgnore = null; - } - // nuke all attributes for the node - delete path.node.__cov__; - } - - // set a node attribute for the supplied node - setAttr(node, name, value) { - node.__cov__ = node.__cov__ || {}; - node.__cov__[name] = value; - } - - // retrieve a node attribute for the supplied node or null - getAttr(node, name) { - const c = node.__cov__; - if (!c) { - return null; - } - return c[name]; - } - - // - increase(type, id, index) { - const T = this.types; - const wrap = - index !== null - ? // If `index` present, turn `x` into `x[index]`. - x => T.memberExpression(x, T.numericLiteral(index), true) - : x => x; - return T.updateExpression( - '++', - wrap( - T.memberExpression( - T.memberExpression( - T.callExpression(T.identifier(this.varName), []), - T.identifier(type) - ), - T.numericLiteral(id), - true - ) - ) - ); - } - - // Reads the logic expression conditions and conditionally increments truthy counter. - increaseTrue(type, id, index, node) { - const T = this.types; - const tempName = `${this.varName}_temp`; - - return T.sequenceExpression([ - T.assignmentExpression( - '=', - T.memberExpression( - T.callExpression(T.identifier(this.varName), []), - T.identifier(tempName) - ), - node // Only evaluates once. - ), - T.parenthesizedExpression( - T.conditionalExpression( - this.validateTrueNonTrivial(T, tempName), - this.increase(type, id, index), - T.nullLiteral() - ) - ), - T.memberExpression( - T.callExpression(T.identifier(this.varName), []), - T.identifier(tempName) - ) - ]); - } - - validateTrueNonTrivial(T, tempName) { - return T.logicalExpression( - '&&', - T.memberExpression( - T.callExpression(T.identifier(this.varName), []), - T.identifier(tempName) - ), - T.logicalExpression( - '&&', - T.parenthesizedExpression( - T.logicalExpression( - '||', - T.unaryExpression( - '!', - T.callExpression( - T.memberExpression( - T.identifier('Array'), - T.identifier('isArray') - ), - [ - T.memberExpression( - T.callExpression( - T.identifier(this.varName), - [] - ), - T.identifier(tempName) - ) - ] - ) - ), - T.memberExpression( - T.memberExpression( - T.callExpression( - T.identifier(this.varName), - [] - ), - T.identifier(tempName) - ), - T.identifier('length') - ) - ) - ), - T.parenthesizedExpression( - T.logicalExpression( - '||', - T.binaryExpression( - '!==', - T.callExpression( - T.memberExpression( - T.identifier('Object'), - T.identifier('getPrototypeOf') - ), - [ - T.memberExpression( - T.callExpression( - T.identifier(this.varName), - [] - ), - T.identifier(tempName) - ) - ] - ), - T.memberExpression( - T.identifier('Object'), - T.identifier('prototype') - ) - ), - T.memberExpression( - T.callExpression( - T.memberExpression( - T.identifier('Object'), - T.identifier('values') - ), - [ - T.memberExpression( - T.callExpression( - T.identifier(this.varName), - [] - ), - T.identifier(tempName) - ) - ] - ), - T.identifier('length') - ) - ) - ) - ) - ); - } - - insertCounter(path, increment) { - const T = this.types; - if (path.isBlockStatement()) { - path.node.body.unshift(T.expressionStatement(increment)); - } else if (path.isStatement()) { - path.insertBefore(T.expressionStatement(increment)); - } else if ( - this.counterNeedsHoisting(path) && - T.isVariableDeclarator(path.parentPath) - ) { - // make an attempt to hoist the statement counter, so that - // function names are maintained. - const parent = path.parentPath.parentPath; - if (parent && T.isExportNamedDeclaration(parent.parentPath)) { - parent.parentPath.insertBefore( - T.expressionStatement(increment) - ); - } else if ( - parent && - (T.isProgram(parent.parentPath) || - T.isBlockStatement(parent.parentPath)) - ) { - parent.insertBefore(T.expressionStatement(increment)); - } else { - path.replaceWith(T.sequenceExpression([increment, path.node])); - } - } /* istanbul ignore else: not expected */ else if ( - path.isExpression() - ) { - path.replaceWith(T.sequenceExpression([increment, path.node])); - } else { - console.error( - 'Unable to insert counter for node type:', - path.node.type - ); - } - } - - insertStatementCounter(path) { - /* istanbul ignore if: paranoid check */ - if (!(path.node && path.node.loc)) { - return; - } - const index = this.cov.newStatement(path.node.loc); - const increment = this.increase('s', index, null); - this.insertCounter(path, increment); - } - - insertFunctionCounter(path) { - const T = this.types; - /* istanbul ignore if: paranoid check */ - if (!(path.node && path.node.loc)) { - return; - } - const n = path.node; - - let dloc = null; - // get location for declaration - switch (n.type) { - case 'FunctionDeclaration': - case 'FunctionExpression': - /* istanbul ignore else: paranoid check */ - if (n.id) { - dloc = n.id.loc; - } - break; - } - if (!dloc) { - dloc = { - start: n.loc.start, - end: { line: n.loc.start.line, column: n.loc.start.column + 1 } - }; - } - - const name = path.node.id ? path.node.id.name : path.node.name; - const index = this.cov.newFunction(name, dloc, path.node.body.loc); - const increment = this.increase('f', index, null); - const body = path.get('body'); - /* istanbul ignore else: not expected */ - if (body.isBlockStatement()) { - body.node.body.unshift(T.expressionStatement(increment)); - } else { - console.error( - 'Unable to process function body node type:', - path.node.type - ); - } - } - - getBranchIncrement(branchName, loc) { - const index = this.cov.addBranchPath(branchName, loc); - return this.increase('b', branchName, index); - } - - getBranchLogicIncrement(path, branchName, loc) { - const index = this.cov.addBranchPath(branchName, loc); - return [ - this.increase('b', branchName, index), - this.increaseTrue('bT', branchName, index, path.node) - ]; - } - - insertBranchCounter(path, branchName, loc) { - const increment = this.getBranchIncrement( - branchName, - loc || path.node.loc - ); - this.insertCounter(path, increment); - } - - findLeaves(node, accumulator, parent, property) { - if (!node) { - return; - } - if (node.type === 'LogicalExpression') { - const hint = this.hintFor(node); - if (hint !== 'next') { - this.findLeaves(node.left, accumulator, node, 'left'); - this.findLeaves(node.right, accumulator, node, 'right'); - } - } else { - accumulator.push({ - node, - parent, - property - }); - } - } -} - -// generic function that takes a set of visitor methods and -// returns a visitor object with `enter` and `exit` properties, -// such that: -// -// * standard entry processing is done -// * the supplied visitors are called only when ignore is not in effect -// This relieves them from worrying about ignore states and generated nodes. -// * standard exit processing is done -// -function entries(...enter) { - // the enter function - const wrappedEntry = function(path, node) { - this.onEnter(path); - if (this.shouldIgnore(path)) { - return; - } - enter.forEach(e => { - e.call(this, path, node); - }); - }; - const exit = function(path, node) { - this.onExit(path, node); - }; - return { - enter: wrappedEntry, - exit - }; -} - -function coverStatement(path) { - this.insertStatementCounter(path); -} - -/* istanbul ignore next: no node.js support */ -function coverAssignmentPattern(path) { - const n = path.node; - const b = this.cov.newBranch('default-arg', n.loc); - this.insertBranchCounter(path.get('right'), b); -} - -function coverFunction(path) { - this.insertFunctionCounter(path); -} - -function coverVariableDeclarator(path) { - this.insertStatementCounter(path.get('init')); -} - -function coverClassPropDeclarator(path) { - this.insertStatementCounter(path.get('value')); -} - -function makeBlock(path) { - const T = this.types; - if (!path.node) { - path.replaceWith(T.blockStatement([])); - } - if (!path.isBlockStatement()) { - path.replaceWith(T.blockStatement([path.node])); - path.node.loc = path.node.body[0].loc; - path.node.body[0].leadingComments = path.node.leadingComments; - path.node.leadingComments = undefined; - } -} - -function blockProp(prop) { - return function(path) { - makeBlock.call(this, path.get(prop)); - }; -} - -function makeParenthesizedExpressionForNonIdentifier(path) { - const T = this.types; - if (path.node && !path.isIdentifier()) { - path.replaceWith(T.parenthesizedExpression(path.node)); - } -} - -function parenthesizedExpressionProp(prop) { - return function(path) { - makeParenthesizedExpressionForNonIdentifier.call(this, path.get(prop)); - }; -} - -function convertArrowExpression(path) { - const n = path.node; - const T = this.types; - if (!T.isBlockStatement(n.body)) { - const bloc = n.body.loc; - if (n.expression === true) { - n.expression = false; - } - n.body = T.blockStatement([T.returnStatement(n.body)]); - // restore body location - n.body.loc = bloc; - // set up the location for the return statement so it gets - // instrumented - n.body.body[0].loc = bloc; - } -} - -function coverIfBranches(path) { - const n = path.node; - const hint = this.hintFor(n); - const ignoreIf = hint === 'if'; - const ignoreElse = hint === 'else'; - const branch = this.cov.newBranch('if', n.loc); - - if (ignoreIf) { - this.setAttr(n.consequent, 'skip-all', true); - } else { - this.insertBranchCounter(path.get('consequent'), branch, n.loc); - } - if (ignoreElse) { - this.setAttr(n.alternate, 'skip-all', true); - } else { - this.insertBranchCounter(path.get('alternate'), branch); - } -} - -function createSwitchBranch(path) { - const b = this.cov.newBranch('switch', path.node.loc); - this.setAttr(path.node, 'branchName', b); -} - -function coverSwitchCase(path) { - const T = this.types; - const b = this.getAttr(path.parentPath.node, 'branchName'); - /* istanbul ignore if: paranoid check */ - if (b === null) { - throw new Error('Unable to get switch branch name'); - } - const increment = this.getBranchIncrement(b, path.node.loc); - path.node.consequent.unshift(T.expressionStatement(increment)); -} - -function coverTernary(path) { - const n = path.node; - const branch = this.cov.newBranch('cond-expr', path.node.loc); - const cHint = this.hintFor(n.consequent); - const aHint = this.hintFor(n.alternate); - - if (cHint !== 'next') { - this.insertBranchCounter(path.get('consequent'), branch); - } - if (aHint !== 'next') { - this.insertBranchCounter(path.get('alternate'), branch); - } -} - -function coverLogicalExpression(path) { - const T = this.types; - if (path.parentPath.node.type === 'LogicalExpression') { - return; // already processed - } - const leaves = []; - this.findLeaves(path.node, leaves); - const b = this.cov.newBranch( - 'binary-expr', - path.node.loc, - this.reportLogic - ); - for (let i = 0; i < leaves.length; i += 1) { - const leaf = leaves[i]; - const hint = this.hintFor(leaf.node); - if (hint === 'next') { - continue; - } - - if (this.reportLogic) { - const increment = this.getBranchLogicIncrement( - leaf, - b, - leaf.node.loc - ); - if (!increment[0]) { - continue; - } - leaf.parent[leaf.property] = T.sequenceExpression([ - increment[0], - increment[1] - ]); - continue; - } - - const increment = this.getBranchIncrement(b, leaf.node.loc); - if (!increment) { - continue; - } - leaf.parent[leaf.property] = T.sequenceExpression([ - increment, - leaf.node - ]); - } -} - -const codeVisitor = { - ArrowFunctionExpression: entries(convertArrowExpression, coverFunction), - AssignmentPattern: entries(coverAssignmentPattern), - BlockStatement: entries(), // ignore processing only - ExportDefaultDeclaration: entries(), // ignore processing only - ExportNamedDeclaration: entries(), // ignore processing only - ClassMethod: entries(coverFunction), - ClassDeclaration: entries(parenthesizedExpressionProp('superClass')), - ClassProperty: entries(coverClassPropDeclarator), - ClassPrivateProperty: entries(coverClassPropDeclarator), - ObjectMethod: entries(coverFunction), - ExpressionStatement: entries(coverStatement), - BreakStatement: entries(coverStatement), - ContinueStatement: entries(coverStatement), - DebuggerStatement: entries(coverStatement), - ReturnStatement: entries(coverStatement), - ThrowStatement: entries(coverStatement), - TryStatement: entries(coverStatement), - VariableDeclaration: entries(), // ignore processing only - VariableDeclarator: entries(coverVariableDeclarator), - IfStatement: entries( - blockProp('consequent'), - blockProp('alternate'), - coverStatement, - coverIfBranches - ), - ForStatement: entries(blockProp('body'), coverStatement), - ForInStatement: entries(blockProp('body'), coverStatement), - ForOfStatement: entries(blockProp('body'), coverStatement), - WhileStatement: entries(blockProp('body'), coverStatement), - DoWhileStatement: entries(blockProp('body'), coverStatement), - SwitchStatement: entries(createSwitchBranch, coverStatement), - SwitchCase: entries(coverSwitchCase), - WithStatement: entries(blockProp('body'), coverStatement), - FunctionDeclaration: entries(coverFunction), - FunctionExpression: entries(coverFunction), - LabeledStatement: entries(coverStatement), - ConditionalExpression: entries(coverTernary), - LogicalExpression: entries(coverLogicalExpression) -}; -const globalTemplateAlteredFunction = template(` - var Function = (function(){}).constructor; - var global = (new Function(GLOBAL_COVERAGE_SCOPE))(); -`); -const globalTemplateFunction = template(` - var global = (new Function(GLOBAL_COVERAGE_SCOPE))(); -`); -const globalTemplateVariable = template(` - var global = GLOBAL_COVERAGE_SCOPE; -`); -// the template to insert at the top of the program. -const coverageTemplate = template( - ` - function COVERAGE_FUNCTION () { - var path = PATH; - var hash = HASH; - GLOBAL_COVERAGE_TEMPLATE - var gcv = GLOBAL_COVERAGE_VAR; - var coverageData = INITIAL; - var coverage = global[gcv] || (global[gcv] = {}); - if (!coverage[path] || coverage[path].hash !== hash) { - coverage[path] = coverageData; - } - - var actualCoverage = coverage[path]; - { - // @ts-ignore - COVERAGE_FUNCTION = function () { - return actualCoverage; - } - } - - return actualCoverage; - } -`, - { preserveComments: true } -); -// the rewire plugin (and potentially other babel middleware) -// may cause files to be instrumented twice, see: -// https://github.com/istanbuljs/babel-plugin-istanbul/issues/94 -// we should only instrument code for coverage the first time -// it's run through istanbul-lib-instrument. -function alreadyInstrumented(path, visitState) { - return path.scope.hasBinding(visitState.varName); -} -function shouldIgnoreFile(programNode) { - return ( - programNode.parent && - programNode.parent.comments.some(c => COMMENT_FILE_RE.test(c.value)) - ); -} - -/** - * programVisitor is a `babel` adaptor for instrumentation. - * It returns an object with two methods `enter` and `exit`. - * These should be assigned to or called from `Program` entry and exit functions - * in a babel visitor. - * These functions do not make assumptions about the state set by Babel and thus - * can be used in a context other than a Babel plugin. - * - * The exit function returns an object that currently has the following keys: - * - * `fileCoverage` - the file coverage object created for the source file. - * `sourceMappingURL` - any source mapping URL found when processing the file. - * - * @param {Object} types - an instance of babel-types. - * @param {string} sourceFilePath - the path to source file. - * @param {Object} opts - additional options. - * @param {string} [opts.coverageVariable=__coverage__] the global coverage variable name. - * @param {boolean} [opts.reportLogic=false] report boolean value of logical expressions. - * @param {string} [opts.coverageGlobalScope=this] the global coverage variable scope. - * @param {boolean} [opts.coverageGlobalScopeFunc=true] use an evaluated function to find coverageGlobalScope. - * @param {Array} [opts.ignoreClassMethods=[]] names of methods to ignore by default on classes. - * @param {object} [opts.inputSourceMap=undefined] the input source map, that maps the uninstrumented code back to the - * original code. - */ -function programVisitor(types, sourceFilePath = 'unknown.js', opts = {}) { - const T = types; - opts = { - ...defaults.instrumentVisitor, - ...opts - }; - const visitState = new VisitState( - types, - sourceFilePath, - opts.inputSourceMap, - opts.ignoreClassMethods, - opts.reportLogic - ); - return { - enter(path) { - if (shouldIgnoreFile(path.find(p => p.isProgram()))) { - return; - } - if (alreadyInstrumented(path, visitState)) { - return; - } - path.traverse(codeVisitor, visitState); - }, - exit(path) { - if (alreadyInstrumented(path, visitState)) { - return; - } - visitState.cov.freeze(); - const coverageData = visitState.cov.toJSON(); - if (shouldIgnoreFile(path.find(p => p.isProgram()))) { - return { - fileCoverage: coverageData, - sourceMappingURL: visitState.sourceMappingURL - }; - } - coverageData[MAGIC_KEY] = MAGIC_VALUE; - const hash = createHash(SHA) - .update(JSON.stringify(coverageData)) - .digest('hex'); - coverageData.hash = hash; - if ( - coverageData.inputSourceMap && - Object.getPrototypeOf(coverageData.inputSourceMap) !== - Object.prototype - ) { - coverageData.inputSourceMap = { - ...coverageData.inputSourceMap - }; - } - const coverageNode = T.valueToNode(coverageData); - delete coverageData[MAGIC_KEY]; - delete coverageData.hash; - let gvTemplate; - if (opts.coverageGlobalScopeFunc) { - if (path.scope.getBinding('Function')) { - gvTemplate = globalTemplateAlteredFunction({ - GLOBAL_COVERAGE_SCOPE: T.stringLiteral( - 'return ' + opts.coverageGlobalScope - ) - }); - } else { - gvTemplate = globalTemplateFunction({ - GLOBAL_COVERAGE_SCOPE: T.stringLiteral( - 'return ' + opts.coverageGlobalScope - ) - }); - } - } else { - gvTemplate = globalTemplateVariable({ - GLOBAL_COVERAGE_SCOPE: opts.coverageGlobalScope - }); - } - const cv = coverageTemplate({ - GLOBAL_COVERAGE_VAR: T.stringLiteral(opts.coverageVariable), - GLOBAL_COVERAGE_TEMPLATE: gvTemplate, - COVERAGE_FUNCTION: T.identifier(visitState.varName), - PATH: T.stringLiteral(sourceFilePath), - INITIAL: coverageNode, - HASH: T.stringLiteral(hash) - }); - // explicitly call this.varName to ensure coverage is always initialized - path.node.body.unshift( - T.expressionStatement( - T.callExpression(T.identifier(visitState.varName), []) - ) - ); - path.node.body.unshift(cv); - return { - fileCoverage: coverageData, - sourceMappingURL: visitState.sourceMappingURL - }; - } - }; -} - -module.exports = programVisitor; diff --git a/node_modules/istanbul-lib-report/CHANGELOG.md b/node_modules/istanbul-lib-report/CHANGELOG.md deleted file mode 100644 index 3578bb508..000000000 --- a/node_modules/istanbul-lib-report/CHANGELOG.md +++ /dev/null @@ -1,185 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@3.0.0-alpha.2...istanbul-lib-report@3.0.0) (2019-12-20) - -**Note:** Version bump only for package istanbul-lib-report - - - - - -# [3.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@3.0.0-alpha.1...istanbul-lib-report@3.0.0-alpha.2) (2019-12-07) - -**Note:** Version bump only for package istanbul-lib-report - - - - - -# [3.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@3.0.0-alpha.0...istanbul-lib-report@3.0.0-alpha.1) (2019-10-06) - -**Note:** Version bump only for package istanbul-lib-report - - - - - -# [3.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.8...istanbul-lib-report@3.0.0-alpha.0) (2019-06-19) - - -### Bug Fixes - -* **package:** update supports-color to version 7.0.0 ([#420](https://github.com/istanbuljs/istanbuljs/issues/420)) ([631029d](https://github.com/istanbuljs/istanbuljs/commit/631029d)) -* Properly combine directories in nested summarizer ([#380](https://github.com/istanbuljs/istanbuljs/issues/380)) ([50afdbb](https://github.com/istanbuljs/istanbuljs/commit/50afdbb)) - - -### Features - -* Refactor istanbul-lib-report so report can choose summarizer ([#408](https://github.com/istanbuljs/istanbuljs/issues/408)) ([0f328fd](https://github.com/istanbuljs/istanbuljs/commit/0f328fd)) -* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539)) - - -### BREAKING CHANGES - -* Existing istanbul-lib-report API's have been changed -* Node.js 8 is now required - - - - - -## [2.0.8](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.7...istanbul-lib-report@2.0.8) (2019-04-24) - -**Note:** Version bump only for package istanbul-lib-report - - - - - -## [2.0.7](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.6...istanbul-lib-report@2.0.7) (2019-04-09) - -**Note:** Version bump only for package istanbul-lib-report - - - - - -## [2.0.6](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.5...istanbul-lib-report@2.0.6) (2019-04-03) - - -### Bug Fixes - -* Avoid corrupting HTML report's arrow png during copy ([#343](https://github.com/istanbuljs/istanbuljs/issues/343)) ([ce664c7](https://github.com/istanbuljs/istanbuljs/commit/ce664c7)) - - - - - -## [2.0.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.4...istanbul-lib-report@2.0.5) (2019-03-12) - -**Note:** Version bump only for package istanbul-lib-report - - - - - -## [2.0.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.3...istanbul-lib-report@2.0.4) (2019-01-26) - - -### Bug Fixes - -* nested summarizer error with no files ([#230](https://github.com/istanbuljs/istanbuljs/issues/230)) ([07724bf](https://github.com/istanbuljs/istanbuljs/commit/07724bf)) - - - - - - -## [2.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.2...istanbul-lib-report@2.0.3) (2018-12-25) - - - - -**Note:** Version bump only for package istanbul-lib-report - - -## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.1...istanbul-lib-report@2.0.2) (2018-09-06) - - - - -**Note:** Version bump only for package istanbul-lib-report - - -## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.0...istanbul-lib-report@2.0.1) (2018-07-07) - - - - -**Note:** Version bump only for package istanbul-lib-report - - -# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.4...istanbul-lib-report@2.0.0) (2018-06-06) - - -### Bug Fixes - -* use null prototype for map objects ([#177](https://github.com/istanbuljs/istanbuljs/issues/177)) ([9a5a30c](https://github.com/istanbuljs/istanbuljs/commit/9a5a30c)) - - -### BREAKING CHANGES - -* a null prototype is now used in several places rather than the default `{}` assignment. - - - - - -## [1.1.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.3...istanbul-lib-report@1.1.4) (2018-03-04) - - - - -**Note:** Version bump only for package istanbul-lib-report - - -## [1.1.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.2...istanbul-lib-report@1.1.3) (2018-02-13) - - - - -**Note:** Version bump only for package istanbul-lib-report - - -## [1.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.1...istanbul-lib-report@1.1.2) (2017-10-21) - - -### Bug Fixes - -* remove call to mkdirp.sync() in constructor so when used for ConsoleWriter ([#104](https://github.com/istanbuljs/istanbuljs/issues/104)) ([58eb79d](https://github.com/istanbuljs/istanbuljs/commit/58eb79d)) - - - - - -## [1.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.0...istanbul-lib-report@1.1.1) (2017-05-27) - - - - - -# [1.1.0](https://github.com/istanbuljs/istanbul-lib-report/compare/istanbul-lib-report@1.0.0...istanbul-lib-report@1.1.0) (2017-04-29) - - -### Features - -* once 100% line coverage is achieved, missing branch coverage is now shown in text report ([#45](https://github.com/istanbuljs/istanbuljs/issues/45)) ([8a809f8](https://github.com/istanbuljs/istanbul-lib-report/commit/8a809f8)) - - - - - -# [1.0.0](https://github.com/istanbuljs/istanbul-lib-report/compare/istanbul-lib-report@1.0.0-alpha.3...istanbul-lib-report@1.0.0) (2017-03-27) diff --git a/node_modules/istanbul-lib-report/LICENSE b/node_modules/istanbul-lib-report/LICENSE deleted file mode 100644 index d55d2916e..000000000 --- a/node_modules/istanbul-lib-report/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright 2012-2015 Yahoo! Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Yahoo! Inc. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/istanbul-lib-report/README.md b/node_modules/istanbul-lib-report/README.md deleted file mode 100644 index f7ff56a3c..000000000 --- a/node_modules/istanbul-lib-report/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# istanbul-lib-report - -[![Greenkeeper badge](https://badges.greenkeeper.io/istanbuljs/istanbul-lib-report.svg)](https://greenkeeper.io/) -[![Build Status](https://travis-ci.org/istanbuljs/istanbul-lib-report.svg?branch=master)](https://travis-ci.org/istanbuljs/istanbul-lib-report) - -Core reporting utilities for istanbul. - -## Example usage - -```js -const libReport = require('istanbul-lib-report'); -const reports = require('istanbul-reports'); - -// coverageMap, for instance, obtained from istanbul-lib-coverage -const coverageMap; - -const configWatermarks = { - statements: [50, 80], - functions: [50, 80], - branches: [50, 80], - lines: [50, 80] -}; - -// create a context for report generation -const context = libReport.createContext({ - dir: 'report/output/dir', - // The summarizer to default to (may be overridden by some reports) - // values can be nested/flat/pkg. Defaults to 'pkg' - defaultSummarizer: 'nested', - watermarks: configWatermarks, - coverageMap, -}) - -// create an instance of the relevant report class, passing the -// report name e.g. json/html/html-spa/text -const report = reports.create('json', { - skipEmpty: configSkipEmpty, - skipFull: configSkipFull -}) - -// call execute to synchronously create and write the report to disk -report.execute(context) -``` diff --git a/node_modules/istanbul-lib-report/index.js b/node_modules/istanbul-lib-report/index.js deleted file mode 100644 index af1a1c865..000000000 --- a/node_modules/istanbul-lib-report/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -/** - * @module Exports - */ - -const Context = require('./lib/context'); -const watermarks = require('./lib/watermarks'); -const ReportBase = require('./lib/report-base'); - -module.exports = { - /** - * returns a reporting context for the supplied options - * @param {Object} [opts=null] opts - * @returns {Context} - */ - createContext(opts) { - return new Context(opts); - }, - - /** - * returns the default watermarks that would be used when not - * overridden - * @returns {Object} an object with `statements`, `functions`, `branches`, - * and `line` keys. Each value is a 2 element array that has the low and - * high watermark as percentages. - */ - getDefaultWatermarks() { - return watermarks.getDefault(); - }, - - /** - * Base class for all reports - */ - ReportBase -}; diff --git a/node_modules/istanbul-lib-report/lib/context.js b/node_modules/istanbul-lib-report/lib/context.js deleted file mode 100644 index fbb30bc33..000000000 --- a/node_modules/istanbul-lib-report/lib/context.js +++ /dev/null @@ -1,132 +0,0 @@ -'use strict'; -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -const fs = require('fs'); -const FileWriter = require('./file-writer'); -const XMLWriter = require('./xml-writer'); -const tree = require('./tree'); -const watermarks = require('./watermarks'); -const SummarizerFactory = require('./summarizer-factory'); - -function defaultSourceLookup(path) { - try { - return fs.readFileSync(path, 'utf8'); - } catch (ex) { - throw new Error(`Unable to lookup source: ${path} (${ex.message})`); - } -} - -function normalizeWatermarks(specified = {}) { - Object.entries(watermarks.getDefault()).forEach(([k, value]) => { - const specValue = specified[k]; - if (!Array.isArray(specValue) || specValue.length !== 2) { - specified[k] = value; - } - }); - - return specified; -} - -/** - * A reporting context that is passed to report implementations - * @param {Object} [opts=null] opts options - * @param {String} [opts.dir='coverage'] opts.dir the reporting directory - * @param {Object} [opts.watermarks=null] opts.watermarks watermarks for - * statements, lines, branches and functions - * @param {Function} [opts.sourceFinder=fsLookup] opts.sourceFinder a - * function that returns source code given a file path. Defaults to - * filesystem lookups based on path. - * @constructor - */ -class Context { - constructor(opts) { - this.dir = opts.dir || 'coverage'; - this.watermarks = normalizeWatermarks(opts.watermarks); - this.sourceFinder = opts.sourceFinder || defaultSourceLookup; - this._summarizerFactory = new SummarizerFactory( - opts.coverageMap, - opts.defaultSummarizer - ); - this.data = {}; - } - - /** - * returns a FileWriter implementation for reporting use. Also available - * as the `writer` property on the context. - * @returns {Writer} - */ - getWriter() { - return this.writer; - } - - /** - * returns the source code for the specified file path or throws if - * the source could not be found. - * @param {String} filePath the file path as found in a file coverage object - * @returns {String} the source code - */ - getSource(filePath) { - return this.sourceFinder(filePath); - } - - /** - * returns the coverage class given a coverage - * types and a percentage value. - * @param {String} type - the coverage type, one of `statements`, `functions`, - * `branches`, or `lines` - * @param {Number} value - the percentage value - * @returns {String} one of `high`, `medium` or `low` - */ - classForPercent(type, value) { - const watermarks = this.watermarks[type]; - if (!watermarks) { - return 'unknown'; - } - if (value < watermarks[0]) { - return 'low'; - } - if (value >= watermarks[1]) { - return 'high'; - } - return 'medium'; - } - - /** - * returns an XML writer for the supplied content writer - * @param {ContentWriter} contentWriter the content writer to which the returned XML writer - * writes data - * @returns {XMLWriter} - */ - getXMLWriter(contentWriter) { - return new XMLWriter(contentWriter); - } - - /** - * returns a full visitor given a partial one. - * @param {Object} partialVisitor a partial visitor only having the functions of - * interest to the caller. These functions are called with a scope that is the - * supplied object. - * @returns {Visitor} - */ - getVisitor(partialVisitor) { - return new tree.Visitor(partialVisitor); - } - - getTree(name = 'defaultSummarizer') { - return this._summarizerFactory[name]; - } -} - -Object.defineProperty(Context.prototype, 'writer', { - enumerable: true, - get() { - if (!this.data.writer) { - this.data.writer = new FileWriter(this.dir); - } - return this.data.writer; - } -}); - -module.exports = Context; diff --git a/node_modules/istanbul-lib-report/lib/file-writer.js b/node_modules/istanbul-lib-report/lib/file-writer.js deleted file mode 100644 index de1154b1a..000000000 --- a/node_modules/istanbul-lib-report/lib/file-writer.js +++ /dev/null @@ -1,189 +0,0 @@ -'use strict'; -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -const path = require('path'); -const fs = require('fs'); -const mkdirp = require('make-dir'); -const supportsColor = require('supports-color'); - -/** - * Base class for writing content - * @class ContentWriter - * @constructor - */ -class ContentWriter { - /** - * returns the colorized version of a string. Typically, - * content writers that write to files will return the - * same string and ones writing to a tty will wrap it in - * appropriate escape sequences. - * @param {String} str the string to colorize - * @param {String} clazz one of `high`, `medium` or `low` - * @returns {String} the colorized form of the string - */ - colorize(str /*, clazz*/) { - return str; - } - - /** - * writes a string appended with a newline to the destination - * @param {String} str the string to write - */ - println(str) { - this.write(`${str}\n`); - } - - /** - * closes this content writer. Should be called after all writes are complete. - */ - close() {} -} - -/** - * a content writer that writes to a file - * @param {Number} fd - the file descriptor - * @extends ContentWriter - * @constructor - */ -class FileContentWriter extends ContentWriter { - constructor(fd) { - super(); - - this.fd = fd; - } - - write(str) { - fs.writeSync(this.fd, str); - } - - close() { - fs.closeSync(this.fd); - } -} - -// allow stdout to be captured for tests. -let capture = false; -let output = ''; - -/** - * a content writer that writes to the console - * @extends ContentWriter - * @constructor - */ -class ConsoleWriter extends ContentWriter { - write(str) { - if (capture) { - output += str; - } else { - process.stdout.write(str); - } - } - - colorize(str, clazz) { - const colors = { - low: '31;1', - medium: '33;1', - high: '32;1' - }; - - /* istanbul ignore next: different modes for CI and local */ - if (supportsColor.stdout && colors[clazz]) { - return `\u001b[${colors[clazz]}m${str}\u001b[0m`; - } - return str; - } -} - -/** - * utility for writing files under a specific directory - * @class FileWriter - * @param {String} baseDir the base directory under which files should be written - * @constructor - */ -class FileWriter { - constructor(baseDir) { - if (!baseDir) { - throw new Error('baseDir must be specified'); - } - this.baseDir = baseDir; - } - - /** - * static helpers for capturing stdout report output; - * super useful for tests! - */ - static startCapture() { - capture = true; - } - - static stopCapture() { - capture = false; - } - - static getOutput() { - return output; - } - - static resetOutput() { - output = ''; - } - - /** - * returns a FileWriter that is rooted at the supplied subdirectory - * @param {String} subdir the subdirectory under which to root the - * returned FileWriter - * @returns {FileWriter} - */ - writerForDir(subdir) { - if (path.isAbsolute(subdir)) { - throw new Error( - `Cannot create subdir writer for absolute path: ${subdir}` - ); - } - return new FileWriter(`${this.baseDir}/${subdir}`); - } - - /** - * copies a file from a source directory to a destination name - * @param {String} source path to source file - * @param {String} dest relative path to destination file - * @param {String} [header=undefined] optional text to prepend to destination - * (e.g., an "this file is autogenerated" comment, copyright notice, etc.) - */ - copyFile(source, dest, header) { - if (path.isAbsolute(dest)) { - throw new Error(`Cannot write to absolute path: ${dest}`); - } - dest = path.resolve(this.baseDir, dest); - mkdirp.sync(path.dirname(dest)); - let contents; - if (header) { - contents = header + fs.readFileSync(source, 'utf8'); - } else { - contents = fs.readFileSync(source); - } - fs.writeFileSync(dest, contents); - } - - /** - * returns a content writer for writing content to the supplied file. - * @param {String|null} file the relative path to the file or the special - * values `"-"` or `null` for writing to the console - * @returns {ContentWriter} - */ - writeFile(file) { - if (file === null || file === '-') { - return new ConsoleWriter(); - } - if (path.isAbsolute(file)) { - throw new Error(`Cannot write to absolute path: ${file}`); - } - file = path.resolve(this.baseDir, file); - mkdirp.sync(path.dirname(file)); - return new FileContentWriter(fs.openSync(file, 'w')); - } -} - -module.exports = FileWriter; diff --git a/node_modules/istanbul-lib-report/lib/path.js b/node_modules/istanbul-lib-report/lib/path.js deleted file mode 100644 index c928b1739..000000000 --- a/node_modules/istanbul-lib-report/lib/path.js +++ /dev/null @@ -1,169 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const path = require('path'); -let parsePath = path.parse; -let SEP = path.sep; -const origParser = parsePath; -const origSep = SEP; - -function makeRelativeNormalizedPath(str, sep) { - const parsed = parsePath(str); - let root = parsed.root; - let dir; - let file = parsed.base; - let quoted; - let pos; - - // handle a weird windows case separately - if (sep === '\\') { - pos = root.indexOf(':\\'); - if (pos >= 0) { - root = root.substring(0, pos + 2); - } - } - dir = parsed.dir.substring(root.length); - - if (str === '') { - return []; - } - - if (sep !== '/') { - quoted = new RegExp(sep.replace(/\W/g, '\\$&'), 'g'); - dir = dir.replace(quoted, '/'); - file = file.replace(quoted, '/'); // excessively paranoid? - } - - if (dir !== '') { - dir = `${dir}/${file}`; - } else { - dir = file; - } - if (dir.substring(0, 1) === '/') { - dir = dir.substring(1); - } - dir = dir.split(/\/+/); - return dir; -} - -class Path { - constructor(strOrArray) { - if (Array.isArray(strOrArray)) { - this.v = strOrArray; - } else if (typeof strOrArray === 'string') { - this.v = makeRelativeNormalizedPath(strOrArray, SEP); - } else { - throw new Error( - `Invalid Path argument must be string or array:${strOrArray}` - ); - } - } - - toString() { - return this.v.join('/'); - } - - hasParent() { - return this.v.length > 0; - } - - parent() { - if (!this.hasParent()) { - throw new Error('Unable to get parent for 0 elem path'); - } - const p = this.v.slice(); - p.pop(); - return new Path(p); - } - - elements() { - return this.v.slice(); - } - - name() { - return this.v.slice(-1)[0]; - } - - contains(other) { - let i; - if (other.length > this.length) { - return false; - } - for (i = 0; i < other.length; i += 1) { - if (this.v[i] !== other.v[i]) { - return false; - } - } - return true; - } - - ancestorOf(other) { - return other.contains(this) && other.length !== this.length; - } - - descendantOf(other) { - return this.contains(other) && other.length !== this.length; - } - - commonPrefixPath(other) { - const len = this.length > other.length ? other.length : this.length; - let i; - const ret = []; - - for (i = 0; i < len; i += 1) { - if (this.v[i] === other.v[i]) { - ret.push(this.v[i]); - } else { - break; - } - } - return new Path(ret); - } - - static compare(a, b) { - const al = a.length; - const bl = b.length; - - if (al < bl) { - return -1; - } - - if (al > bl) { - return 1; - } - - const astr = a.toString(); - const bstr = b.toString(); - return astr < bstr ? -1 : astr > bstr ? 1 : 0; - } -} - -['push', 'pop', 'shift', 'unshift', 'splice'].forEach(fn => { - Object.defineProperty(Path.prototype, fn, { - value(...args) { - return this.v[fn](...args); - } - }); -}); - -Object.defineProperty(Path.prototype, 'length', { - enumerable: true, - get() { - return this.v.length; - } -}); - -module.exports = Path; -Path.tester = { - setParserAndSep(p, sep) { - parsePath = p; - SEP = sep; - }, - reset() { - parsePath = origParser; - SEP = origSep; - } -}; diff --git a/node_modules/istanbul-lib-report/lib/report-base.js b/node_modules/istanbul-lib-report/lib/report-base.js deleted file mode 100644 index 96de750d6..000000000 --- a/node_modules/istanbul-lib-report/lib/report-base.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -// TODO: switch to class private field when targetting node.js 12 -const _summarizer = Symbol('ReportBase.#summarizer'); - -class ReportBase { - constructor(opts = {}) { - this[_summarizer] = opts.summarizer; - } - - execute(context) { - context.getTree(this[_summarizer]).visit(this, context); - } -} - -module.exports = ReportBase; diff --git a/node_modules/istanbul-lib-report/lib/summarizer-factory.js b/node_modules/istanbul-lib-report/lib/summarizer-factory.js deleted file mode 100644 index 5e8acd907..000000000 --- a/node_modules/istanbul-lib-report/lib/summarizer-factory.js +++ /dev/null @@ -1,284 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const coverage = require('istanbul-lib-coverage'); -const Path = require('./path'); -const { BaseNode, BaseTree } = require('./tree'); - -class ReportNode extends BaseNode { - constructor(path, fileCoverage) { - super(); - - this.path = path; - this.parent = null; - this.fileCoverage = fileCoverage; - this.children = []; - } - - static createRoot(children) { - const root = new ReportNode(new Path([])); - - children.forEach(child => { - root.addChild(child); - }); - - return root; - } - - addChild(child) { - child.parent = this; - this.children.push(child); - } - - asRelative(p) { - if (p.substring(0, 1) === '/') { - return p.substring(1); - } - return p; - } - - getQualifiedName() { - return this.asRelative(this.path.toString()); - } - - getRelativeName() { - const parent = this.getParent(); - const myPath = this.path; - let relPath; - let i; - const parentPath = parent ? parent.path : new Path([]); - if (parentPath.ancestorOf(myPath)) { - relPath = new Path(myPath.elements()); - for (i = 0; i < parentPath.length; i += 1) { - relPath.shift(); - } - return this.asRelative(relPath.toString()); - } - return this.asRelative(this.path.toString()); - } - - getParent() { - return this.parent; - } - - getChildren() { - return this.children; - } - - isSummary() { - return !this.fileCoverage; - } - - getFileCoverage() { - return this.fileCoverage; - } - - getCoverageSummary(filesOnly) { - const cacheProp = `c_${filesOnly ? 'files' : 'full'}`; - let summary; - - if (Object.prototype.hasOwnProperty.call(this, cacheProp)) { - return this[cacheProp]; - } - - if (!this.isSummary()) { - summary = this.getFileCoverage().toSummary(); - } else { - let count = 0; - summary = coverage.createCoverageSummary(); - this.getChildren().forEach(child => { - if (filesOnly && child.isSummary()) { - return; - } - count += 1; - summary.merge(child.getCoverageSummary(filesOnly)); - }); - if (count === 0 && filesOnly) { - summary = null; - } - } - this[cacheProp] = summary; - return summary; - } -} - -class ReportTree extends BaseTree { - constructor(root, childPrefix) { - super(root); - - const maybePrefix = node => { - if (childPrefix && !node.isRoot()) { - node.path.unshift(childPrefix); - } - }; - this.visit({ - onDetail: maybePrefix, - onSummary(node) { - maybePrefix(node); - node.children.sort((a, b) => { - const astr = a.path.toString(); - const bstr = b.path.toString(); - return astr < bstr - ? -1 - : astr > bstr - ? 1 - : /* istanbul ignore next */ 0; - }); - } - }); - } -} - -function findCommonParent(paths) { - return paths.reduce( - (common, path) => common.commonPrefixPath(path), - paths[0] || new Path([]) - ); -} - -function findOrCreateParent(parentPath, nodeMap, created = () => {}) { - let parent = nodeMap[parentPath.toString()]; - - if (!parent) { - parent = new ReportNode(parentPath); - nodeMap[parentPath.toString()] = parent; - created(parentPath, parent); - } - - return parent; -} - -function toDirParents(list) { - const nodeMap = Object.create(null); - list.forEach(o => { - const parent = findOrCreateParent(o.path.parent(), nodeMap); - parent.addChild(new ReportNode(o.path, o.fileCoverage)); - }); - - return Object.values(nodeMap); -} - -function addAllPaths(topPaths, nodeMap, path, node) { - const parent = findOrCreateParent( - path.parent(), - nodeMap, - (parentPath, parent) => { - if (parentPath.hasParent()) { - addAllPaths(topPaths, nodeMap, parentPath, parent); - } else { - topPaths.push(parent); - } - } - ); - - parent.addChild(node); -} - -function foldIntoOneDir(node, parent) { - const { children } = node; - if (children.length === 1 && !children[0].fileCoverage) { - children[0].parent = parent; - return foldIntoOneDir(children[0], parent); - } - node.children = children.map(child => foldIntoOneDir(child, node)); - return node; -} - -function pkgSummaryPrefix(dirParents, commonParent) { - if (!dirParents.some(dp => dp.path.length === 0)) { - return; - } - - if (commonParent.length === 0) { - return 'root'; - } - - return commonParent.name(); -} - -class SummarizerFactory { - constructor(coverageMap, defaultSummarizer = 'pkg') { - this._coverageMap = coverageMap; - this._defaultSummarizer = defaultSummarizer; - this._initialList = coverageMap.files().map(filePath => ({ - filePath, - path: new Path(filePath), - fileCoverage: coverageMap.fileCoverageFor(filePath) - })); - this._commonParent = findCommonParent( - this._initialList.map(o => o.path.parent()) - ); - if (this._commonParent.length > 0) { - this._initialList.forEach(o => { - o.path.splice(0, this._commonParent.length); - }); - } - } - - get defaultSummarizer() { - return this[this._defaultSummarizer]; - } - - get flat() { - if (!this._flat) { - this._flat = new ReportTree( - ReportNode.createRoot( - this._initialList.map( - node => new ReportNode(node.path, node.fileCoverage) - ) - ) - ); - } - - return this._flat; - } - - _createPkg() { - const dirParents = toDirParents(this._initialList); - if (dirParents.length === 1) { - return new ReportTree(dirParents[0]); - } - - return new ReportTree( - ReportNode.createRoot(dirParents), - pkgSummaryPrefix(dirParents, this._commonParent) - ); - } - - get pkg() { - if (!this._pkg) { - this._pkg = this._createPkg(); - } - - return this._pkg; - } - - _createNested() { - const nodeMap = Object.create(null); - const topPaths = []; - this._initialList.forEach(o => { - const node = new ReportNode(o.path, o.fileCoverage); - addAllPaths(topPaths, nodeMap, o.path, node); - }); - - const topNodes = topPaths.map(node => foldIntoOneDir(node)); - if (topNodes.length === 1) { - return new ReportTree(topNodes[0]); - } - - return new ReportTree(ReportNode.createRoot(topNodes)); - } - - get nested() { - if (!this._nested) { - this._nested = this._createNested(); - } - - return this._nested; - } -} - -module.exports = SummarizerFactory; diff --git a/node_modules/istanbul-lib-report/lib/tree.js b/node_modules/istanbul-lib-report/lib/tree.js deleted file mode 100644 index 7c182046c..000000000 --- a/node_modules/istanbul-lib-report/lib/tree.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -/** - * An object with methods that are called during the traversal of the coverage tree. - * A visitor has the following methods that are called during tree traversal. - * - * * `onStart(root, state)` - called before traversal begins - * * `onSummary(node, state)` - called for every summary node - * * `onDetail(node, state)` - called for every detail node - * * `onSummaryEnd(node, state)` - called after all children have been visited for - * a summary node. - * * `onEnd(root, state)` - called after traversal ends - * - * @param delegate - a partial visitor that only implements the methods of interest - * The visitor object supplies the missing methods as noops. For example, reports - * that only need the final coverage summary need implement `onStart` and nothing - * else. Reports that use only detailed coverage information need implement `onDetail` - * and nothing else. - * @constructor - */ -class Visitor { - constructor(delegate) { - this.delegate = delegate; - } -} - -['Start', 'End', 'Summary', 'SummaryEnd', 'Detail'] - .map(k => `on${k}`) - .forEach(fn => { - Object.defineProperty(Visitor.prototype, fn, { - writable: true, - value(node, state) { - if (typeof this.delegate[fn] === 'function') { - this.delegate[fn](node, state); - } - } - }); - }); - -class CompositeVisitor extends Visitor { - constructor(visitors) { - super(); - - if (!Array.isArray(visitors)) { - visitors = [visitors]; - } - this.visitors = visitors.map(v => { - if (v instanceof Visitor) { - return v; - } - return new Visitor(v); - }); - } -} - -['Start', 'Summary', 'SummaryEnd', 'Detail', 'End'] - .map(k => `on${k}`) - .forEach(fn => { - Object.defineProperty(CompositeVisitor.prototype, fn, { - value(node, state) { - this.visitors.forEach(v => { - v[fn](node, state); - }); - } - }); - }); - -class BaseNode { - isRoot() { - return !this.getParent(); - } - - /** - * visit all nodes depth-first from this node down. Note that `onStart` - * and `onEnd` are never called on the visitor even if the current - * node is the root of the tree. - * @param visitor a full visitor that is called during tree traversal - * @param state optional state that is passed around - */ - visit(visitor, state) { - if (this.isSummary()) { - visitor.onSummary(this, state); - } else { - visitor.onDetail(this, state); - } - - this.getChildren().forEach(child => { - child.visit(visitor, state); - }); - - if (this.isSummary()) { - visitor.onSummaryEnd(this, state); - } - } -} - -/** - * abstract base class for a coverage tree. - * @constructor - */ -class BaseTree { - constructor(root) { - this.root = root; - } - - /** - * returns the root node of the tree - */ - getRoot() { - return this.root; - } - - /** - * visits the tree depth-first with the supplied partial visitor - * @param visitor - a potentially partial visitor - * @param state - the state to be passed around during tree traversal - */ - visit(visitor, state) { - if (!(visitor instanceof Visitor)) { - visitor = new Visitor(visitor); - } - visitor.onStart(this.getRoot(), state); - this.getRoot().visit(visitor, state); - visitor.onEnd(this.getRoot(), state); - } -} - -module.exports = { - BaseTree, - BaseNode, - Visitor, - CompositeVisitor -}; diff --git a/node_modules/istanbul-lib-report/lib/watermarks.js b/node_modules/istanbul-lib-report/lib/watermarks.js deleted file mode 100644 index fb7608220..000000000 --- a/node_modules/istanbul-lib-report/lib/watermarks.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -module.exports = { - getDefault() { - return { - statements: [50, 80], - functions: [50, 80], - branches: [50, 80], - lines: [50, 80] - }; - } -}; diff --git a/node_modules/istanbul-lib-report/lib/xml-writer.js b/node_modules/istanbul-lib-report/lib/xml-writer.js deleted file mode 100644 index a32550e7a..000000000 --- a/node_modules/istanbul-lib-report/lib/xml-writer.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -const INDENT = ' '; - -function attrString(attrs) { - return Object.entries(attrs || {}) - .map(([k, v]) => ` ${k}="${v}"`) - .join(''); -} - -/** - * a utility class to produce well-formed, indented XML - * @param {ContentWriter} contentWriter the content writer that this utility wraps - * @constructor - */ -class XMLWriter { - constructor(contentWriter) { - this.cw = contentWriter; - this.stack = []; - } - - indent(str) { - return this.stack.map(() => INDENT).join('') + str; - } - - /** - * writes the opening XML tag with the supplied attributes - * @param {String} name tag name - * @param {Object} [attrs=null] attrs attributes for the tag - */ - openTag(name, attrs) { - const str = this.indent(`<${name + attrString(attrs)}>`); - this.cw.println(str); - this.stack.push(name); - } - - /** - * closes an open XML tag. - * @param {String} name - tag name to close. This must match the writer's - * notion of the tag that is currently open. - */ - closeTag(name) { - if (this.stack.length === 0) { - throw new Error(`Attempt to close tag ${name} when not opened`); - } - const stashed = this.stack.pop(); - const str = ``; - - if (stashed !== name) { - throw new Error( - `Attempt to close tag ${name} when ${stashed} was the one open` - ); - } - this.cw.println(this.indent(str)); - } - - /** - * writes a tag and its value opening and closing it at the same time - * @param {String} name tag name - * @param {Object} [attrs=null] attrs tag attributes - * @param {String} [content=null] content optional tag content - */ - inlineTag(name, attrs, content) { - let str = '<' + name + attrString(attrs); - if (content) { - str += `>${content}`; - } else { - str += '/>'; - } - str = this.indent(str); - this.cw.println(str); - } - - /** - * closes all open tags and ends the document - */ - closeAll() { - this.stack - .slice() - .reverse() - .forEach(name => { - this.closeTag(name); - }); - } -} - -module.exports = XMLWriter; diff --git a/node_modules/istanbul-lib-report/package.json b/node_modules/istanbul-lib-report/package.json deleted file mode 100644 index 95bab1c2f..000000000 --- a/node_modules/istanbul-lib-report/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "istanbul-lib-report", - "version": "3.0.0", - "description": "Base reporting library for istanbul", - "author": "Krishnan Anantheswaran ", - "main": "index.js", - "files": [ - "lib", - "index.js" - ], - "scripts": { - "test": "nyc --nycrc-path=../../monorepo-per-package-full.js mocha" - }, - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "devDependencies": { - "chai": "^4.2.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0-beta.2", - "rimraf": "^3.0.0" - }, - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/istanbuljs/istanbuljs/issues" - }, - "homepage": "https://istanbul.js.org/", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git", - "directory": "packages/istanbul-lib-report" - }, - "keywords": [ - "istanbul", - "report", - "api", - "lib" - ], - "engines": { - "node": ">=8" - }, - "gitHead": "5319df684b508ff6fb19fe8b9a6147a3c5924e4b" -} diff --git a/node_modules/istanbul-lib-source-maps/CHANGELOG.md b/node_modules/istanbul-lib-source-maps/CHANGELOG.md deleted file mode 100644 index a1c55c24d..000000000 --- a/node_modules/istanbul-lib-source-maps/CHANGELOG.md +++ /dev/null @@ -1,295 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [4.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@4.0.0-alpha.5...istanbul-lib-source-maps@4.0.0) (2019-12-20) - -**Note:** Version bump only for package istanbul-lib-source-maps - - - - - -# [4.0.0-alpha.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@4.0.0-alpha.4...istanbul-lib-source-maps@4.0.0-alpha.5) (2019-12-07) - -**Note:** Version bump only for package istanbul-lib-source-maps - - - - - -# [4.0.0-alpha.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@4.0.0-alpha.3...istanbul-lib-source-maps@4.0.0-alpha.4) (2019-11-16) - - -### Bug Fixes - -* sourceFinder cannot be async. ([#501](https://github.com/istanbuljs/istanbuljs/issues/501)) ([094f1b8](https://github.com/istanbuljs/istanbuljs/commit/094f1b83b4652c5ba492781620cb6358c685a849)) - - - - - -# [4.0.0-alpha.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@4.0.0-alpha.2...istanbul-lib-source-maps@4.0.0-alpha.3) (2019-11-15) - - -### Bug Fixes - -* mappedCoverage.addStatement is not a function ([#500](https://github.com/istanbuljs/istanbuljs/issues/500)) ([d77cc14](https://github.com/istanbuljs/istanbuljs/commit/d77cc147f7d791686af2975f7d906603335d0bfc)), closes [istanbuljs/nyc#940](https://github.com/istanbuljs/nyc/issues/940) - - - - - -# [4.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@4.0.0-alpha.1...istanbul-lib-source-maps@4.0.0-alpha.2) (2019-10-09) - - -### Features - -* Convert to async API ([#489](https://github.com/istanbuljs/istanbuljs/issues/489)) ([f8ebbc9](https://github.com/istanbuljs/istanbuljs/commit/f8ebbc9)) - - -### BREAKING CHANGES - -* MapStore#transformCoverage is now async and returns a -the coverage data only. The `sourceFinder` method is now async and -provided directly on the `MapStore` instance. - - - - - -# [4.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@4.0.0-alpha.0...istanbul-lib-source-maps@4.0.0-alpha.1) (2019-10-06) - - -### Bug Fixes - -* **package:** update rimraf to version 3.0.0 ([b6e7953](https://github.com/istanbuljs/istanbuljs/commit/b6e7953)) - - -### Features - -* Accept SourceStore and sourceStoreOpts options ([#482](https://github.com/istanbuljs/istanbuljs/issues/482)) ([0dc45a6](https://github.com/istanbuljs/istanbuljs/commit/0dc45a6)) -* Add addInputSourceMapsSync and getSourceMapSync methods ([#484](https://github.com/istanbuljs/istanbuljs/issues/484)) ([dd7048e](https://github.com/istanbuljs/istanbuljs/commit/dd7048e)) - - -### BREAKING CHANGES - -* sourceStore and tmpdir options are removed. - - - - - -# [4.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@3.0.6...istanbul-lib-source-maps@4.0.0-alpha.0) (2019-06-19) - - -### Features - -* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539)) - - -### BREAKING CHANGES - -* Node.js 8 is now required - - - - - -### [4.0.1](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps-v4.0.0...istanbul-lib-source-maps-v4.0.1) (2021-10-12) - - -### Bug Fixes - -* source mapping for branch statements ([#518](https://www.github.com/istanbuljs/istanbuljs/issues/518)) ([3833708](https://www.github.com/istanbuljs/istanbuljs/commit/38337081d97baa6295707d569dee9c4abc3f7da7)) - -## [3.0.6](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@3.0.5...istanbul-lib-source-maps@3.0.6) (2019-04-24) - - -### Bug Fixes - -* if LEAST_UPPER_BOUND returns null, try GREATEST_LOWER_BOUND ([#375](https://github.com/istanbuljs/istanbuljs/issues/375)) ([72b0f05](https://github.com/istanbuljs/istanbuljs/commit/72b0f05)) - - - - - -## [3.0.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@3.0.4...istanbul-lib-source-maps@3.0.5) (2019-04-09) - -**Note:** Version bump only for package istanbul-lib-source-maps - - - - - -## [3.0.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@3.0.3...istanbul-lib-source-maps@3.0.4) (2019-04-03) - -**Note:** Version bump only for package istanbul-lib-source-maps - - - - - -## [3.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@3.0.2...istanbul-lib-source-maps@3.0.3) (2019-03-12) - - -### Bug Fixes - -* Map unique files once, regardless of path separator ([#287](https://github.com/istanbuljs/istanbuljs/issues/287)) ([39a1e56](https://github.com/istanbuljs/istanbuljs/commit/39a1e56)) - - - - - -## [3.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@3.0.1...istanbul-lib-source-maps@3.0.2) (2019-01-26) - -**Note:** Version bump only for package istanbul-lib-source-maps - - - - - - -## [3.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@3.0.0...istanbul-lib-source-maps@3.0.1) (2018-12-25) - - -### Bug Fixes - -* correct variable name in source-map transform ([#257](https://github.com/istanbuljs/istanbuljs/issues/257)) ([de9c921](https://github.com/istanbuljs/istanbuljs/commit/de9c921)) - - - - - -# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@2.0.1...istanbul-lib-source-maps@3.0.0) (2018-12-19) - - -### Bug Fixes - -* correctly calculate end position of sourcemap statement ([f97ffc7](https://github.com/istanbuljs/istanbuljs/commit/f97ffc7)) - - -### BREAKING CHANGES - -* coverage output can now contain Infinity, when a range extends past the source in a file. - - - - - -## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@2.0.0...istanbul-lib-source-maps@2.0.1) (2018-07-07) - - - - -**Note:** Version bump only for package istanbul-lib-source-maps - - -# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@1.2.5...istanbul-lib-source-maps@2.0.0) (2018-06-06) - - -### Bug Fixes - -* use null prototype for map objects ([#177](https://github.com/istanbuljs/istanbuljs/issues/177)) ([9a5a30c](https://github.com/istanbuljs/istanbuljs/commit/9a5a30c)) - - -### BREAKING CHANGES - -* a null prototype is now used in several places rather than the default `{}` assignment. - - - - - -## [1.2.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@1.2.4...istanbul-lib-source-maps@1.2.5) (2018-05-31) - - -### Bug Fixes - -* process.cwd is a function not a string ([#163](https://github.com/istanbuljs/istanbuljs/issues/163)). ([#171](https://github.com/istanbuljs/istanbuljs/issues/171)) ([9c7802c](https://github.com/istanbuljs/istanbuljs/commit/9c7802c)) - - - - - -## [1.2.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@1.2.3...istanbul-lib-source-maps@1.2.4) (2018-03-04) - - - - -**Note:** Version bump only for package istanbul-lib-source-maps - - -## [1.2.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@1.2.2...istanbul-lib-source-maps@1.2.3) (2018-02-13) - - - - -**Note:** Version bump only for package istanbul-lib-source-maps - - -## [1.2.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@1.2.1...istanbul-lib-source-maps@1.2.2) (2017-10-21) - - - - -**Note:** Version bump only for package istanbul-lib-source-maps - - -## [1.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-source-maps@1.2.0...istanbul-lib-source-maps@1.2.1) (2017-05-27) - - - - - -# [1.2.0](https://github.com/istanbuljs/istanbul-lib-source-maps/compare/istanbul-lib-source-maps@1.1.1...istanbul-lib-source-maps@1.2.0) (2017-04-29) - - -### Features - -* pull in debug module, to make debug messages optional ([#36](https://github.com/istanbuljs/istanbuljs/issues/36)) ([189519d](https://github.com/istanbuljs/istanbul-lib-source-maps/commit/189519d)) - - - - - -## [1.1.1](https://github.com/istanbuljs/istanbul-lib-source-maps/compare/istanbul-lib-source-maps@1.1.0...istanbul-lib-source-maps@1.1.1) (2017-03-27) - - -# [1.1.0](https://github.com/istanbuljs/istanbul-lib-source-maps/compare/v1.0.2...v1.1.0) (2016-11-10) - - -### Features - -* read and apply any input source maps stored with coverage data ([#4](https://github.com/istanbuljs/istanbul-lib-source-maps/issues/4)) ([aea405b](https://github.com/istanbuljs/istanbul-lib-source-maps/commit/aea405b)) - - - - -## [1.0.2](https://github.com/istanbuljs/istanbul-lib-source-maps/compare/v1.0.1...v1.0.2) (2016-10-03) - - -### Bug Fixes - -* broken mapped coverage report ([#6](https://github.com/istanbuljs/istanbul-lib-source-maps/issues/6)) ([d9dd738](https://github.com/istanbuljs/istanbul-lib-source-maps/commit/d9dd738)) - - - - -## [1.0.1](https://github.com/istanbuljs/istanbul-lib-source-maps/compare/v1.0.0...v1.0.1) (2016-09-13) - - -### Bug Fixes - -* position validation shouldn't throw away locations with 0 ([#5](https://github.com/istanbuljs/istanbul-lib-source-maps/issues/5)) ([ac4b72c](https://github.com/istanbuljs/istanbul-lib-source-maps/commit/ac4b72c)) - - - - -# [1.0.0](https://github.com/istanbuljs/istanbul-lib-source-maps/compare/v1.0.0-alpha.9...v1.0.0) (2016-08-31) - - -### Bug Fixes - -* discard more bad source map positions ([#3](https://github.com/istanbuljs/istanbul-lib-source-maps/issues/3)) ([ed7b27f](https://github.com/istanbuljs/istanbul-lib-source-maps/commit/ed7b27f)) diff --git a/node_modules/istanbul-lib-source-maps/LICENSE b/node_modules/istanbul-lib-source-maps/LICENSE deleted file mode 100644 index c05aaafba..000000000 --- a/node_modules/istanbul-lib-source-maps/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright 2015 Yahoo! Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Yahoo! Inc. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/istanbul-lib-source-maps/README.md b/node_modules/istanbul-lib-source-maps/README.md deleted file mode 100644 index f9a75f801..000000000 --- a/node_modules/istanbul-lib-source-maps/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# istanbul-lib-source-maps - -[![Build Status](https://travis-ci.org/istanbuljs/istanbuljs.svg?branch=master)](https://travis-ci.org/istanbuljs/istanbuljs) - -Source map support for istanbuljs. - -## Debugging - -_istanbul-lib-source-maps_ uses the [debug](https://www.npmjs.com/package/debug) module. -Run your application with the environment variable `DEBUG=istanbuljs`, to receive debug -output. diff --git a/node_modules/istanbul-lib-source-maps/index.js b/node_modules/istanbul-lib-source-maps/index.js deleted file mode 100644 index 1bcb74c84..000000000 --- a/node_modules/istanbul-lib-source-maps/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const { MapStore } = require('./lib/map-store'); -/** - * @module Exports - */ -module.exports = { - createSourceMapStore(opts) { - return new MapStore(opts); - } -}; diff --git a/node_modules/istanbul-lib-source-maps/lib/get-mapping.js b/node_modules/istanbul-lib-source-maps/lib/get-mapping.js deleted file mode 100644 index c24f618a0..000000000 --- a/node_modules/istanbul-lib-source-maps/lib/get-mapping.js +++ /dev/null @@ -1,182 +0,0 @@ -/* - Copyright 2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const pathutils = require('./pathutils'); -const { - GREATEST_LOWER_BOUND, - LEAST_UPPER_BOUND -} = require('source-map').SourceMapConsumer; - -/** - * AST ranges are inclusive for start positions and exclusive for end positions. - * Source maps are also logically ranges over text, though interacting with - * them is generally achieved by working with explicit positions. - * - * When finding the _end_ location of an AST item, the range behavior is - * important because what we're asking for is the _end_ of whatever range - * corresponds to the end location we seek. - * - * This boils down to the following steps, conceptually, though the source-map - * library doesn't expose primitives to do this nicely: - * - * 1. Find the range on the generated file that ends at, or exclusively - * contains the end position of the AST node. - * 2. Find the range on the original file that corresponds to - * that generated range. - * 3. Find the _end_ location of that original range. - */ -function originalEndPositionFor(sourceMap, generatedEnd) { - // Given the generated location, find the original location of the mapping - // that corresponds to a range on the generated file that overlaps the - // generated file end location. Note however that this position on its - // own is not useful because it is the position of the _start_ of the range - // on the original file, and we want the _end_ of the range. - const beforeEndMapping = originalPositionTryBoth( - sourceMap, - generatedEnd.line, - generatedEnd.column - 1 - ); - if (beforeEndMapping.source === null) { - return null; - } - - // Convert that original position back to a generated one, with a bump - // to the right, and a rightward bias. Since 'generatedPositionFor' searches - // for mappings in the original-order sorted list, this will find the - // mapping that corresponds to the one immediately after the - // beforeEndMapping mapping. - const afterEndMapping = sourceMap.generatedPositionFor({ - source: beforeEndMapping.source, - line: beforeEndMapping.line, - column: beforeEndMapping.column + 1, - bias: LEAST_UPPER_BOUND - }); - if ( - // If this is null, it means that we've hit the end of the file, - // so we can use Infinity as the end column. - afterEndMapping.line === null || - // If these don't match, it means that the call to - // 'generatedPositionFor' didn't find any other original mappings on - // the line we gave, so consider the binding to extend to infinity. - sourceMap.originalPositionFor(afterEndMapping).line !== - beforeEndMapping.line - ) { - return { - source: beforeEndMapping.source, - line: beforeEndMapping.line, - column: Infinity - }; - } - - // Convert the end mapping into the real original position. - return sourceMap.originalPositionFor(afterEndMapping); -} - -/** - * Attempts to determine the original source position, first - * returning the closest element to the left (GREATEST_LOWER_BOUND), - * and next returning the closest element to the right (LEAST_UPPER_BOUND). - */ -function originalPositionTryBoth(sourceMap, line, column) { - const mapping = sourceMap.originalPositionFor({ - line, - column, - bias: GREATEST_LOWER_BOUND - }); - if (mapping.source === null) { - return sourceMap.originalPositionFor({ - line, - column, - bias: LEAST_UPPER_BOUND - }); - } else { - return mapping; - } -} - -function isInvalidPosition(pos) { - return ( - !pos || - typeof pos.line !== 'number' || - typeof pos.column !== 'number' || - pos.line < 0 || - pos.column < 0 - ); -} - -/** - * determines the original position for a given location - * @param {SourceMapConsumer} sourceMap the source map - * @param {Object} generatedLocation the original location Object - * @returns {Object} the remapped location Object - */ -function getMapping(sourceMap, generatedLocation, origFile) { - if (!generatedLocation) { - return null; - } - - if ( - isInvalidPosition(generatedLocation.start) || - isInvalidPosition(generatedLocation.end) - ) { - return null; - } - - const start = originalPositionTryBoth( - sourceMap, - generatedLocation.start.line, - generatedLocation.start.column - ); - let end = originalEndPositionFor(sourceMap, generatedLocation.end); - - /* istanbul ignore if: edge case too hard to test for */ - if (!(start && end)) { - return null; - } - - if (!(start.source && end.source)) { - return null; - } - - if (start.source !== end.source) { - return null; - } - - /* istanbul ignore if: edge case too hard to test for */ - if (start.line === null || start.column === null) { - return null; - } - - /* istanbul ignore if: edge case too hard to test for */ - if (end.line === null || end.column === null) { - return null; - } - - if (start.line === end.line && start.column === end.column) { - end = sourceMap.originalPositionFor({ - line: generatedLocation.end.line, - column: generatedLocation.end.column, - bias: LEAST_UPPER_BOUND - }); - end.column -= 1; - } - - return { - source: pathutils.relativeTo(start.source, origFile), - loc: { - start: { - line: start.line, - column: start.column - }, - end: { - line: end.line, - column: end.column - } - } - }; -} - -module.exports = getMapping; diff --git a/node_modules/istanbul-lib-source-maps/lib/map-store.js b/node_modules/istanbul-lib-source-maps/lib/map-store.js deleted file mode 100644 index a99b79ad3..000000000 --- a/node_modules/istanbul-lib-source-maps/lib/map-store.js +++ /dev/null @@ -1,226 +0,0 @@ -/* - Copyright 2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const path = require('path'); -const fs = require('fs'); -const debug = require('debug')('istanbuljs'); -const { SourceMapConsumer } = require('source-map'); -const pathutils = require('./pathutils'); -const { SourceMapTransformer } = require('./transformer'); - -/** - * Tracks source maps for registered files - */ -class MapStore { - /** - * @param {Object} opts [opts=undefined] options. - * @param {Boolean} opts.verbose [opts.verbose=false] verbose mode - * @param {String} opts.baseDir [opts.baseDir=null] alternate base directory - * to resolve sourcemap files - * @param {Class} opts.SourceStore [opts.SourceStore=Map] class to use for - * SourceStore. Must support `get`, `set` and `clear` methods. - * @param {Array} opts.sourceStoreOpts [opts.sourceStoreOpts=[]] arguments - * to use in the SourceStore constructor. - * @constructor - */ - constructor(opts) { - opts = { - baseDir: null, - verbose: false, - SourceStore: Map, - sourceStoreOpts: [], - ...opts - }; - this.baseDir = opts.baseDir; - this.verbose = opts.verbose; - this.sourceStore = new opts.SourceStore(...opts.sourceStoreOpts); - this.data = Object.create(null); - this.sourceFinder = this.sourceFinder.bind(this); - } - - /** - * Registers a source map URL with this store. It makes some input sanity checks - * and silently fails on malformed input. - * @param transformedFilePath - the file path for which the source map is valid. - * This must *exactly* match the path stashed for the coverage object to be - * useful. - * @param sourceMapUrl - the source map URL, **not** a comment - */ - registerURL(transformedFilePath, sourceMapUrl) { - const d = 'data:'; - - if ( - sourceMapUrl.length > d.length && - sourceMapUrl.substring(0, d.length) === d - ) { - const b64 = 'base64,'; - const pos = sourceMapUrl.indexOf(b64); - if (pos > 0) { - this.data[transformedFilePath] = { - type: 'encoded', - data: sourceMapUrl.substring(pos + b64.length) - }; - } else { - debug(`Unable to interpret source map URL: ${sourceMapUrl}`); - } - - return; - } - - const dir = path.dirname(path.resolve(transformedFilePath)); - const file = path.resolve(dir, sourceMapUrl); - this.data[transformedFilePath] = { type: 'file', data: file }; - } - - /** - * Registers a source map object with this store. Makes some basic sanity checks - * and silently fails on malformed input. - * @param transformedFilePath - the file path for which the source map is valid - * @param sourceMap - the source map object - */ - registerMap(transformedFilePath, sourceMap) { - if (sourceMap && sourceMap.version) { - this.data[transformedFilePath] = { - type: 'object', - data: sourceMap - }; - } else { - debug( - 'Invalid source map object: ' + - JSON.stringify(sourceMap, null, 2) - ); - } - } - - /** - * Retrieve a source map object from this store. - * @param filePath - the file path for which the source map is valid - * @returns {Object} a parsed source map object - */ - getSourceMapSync(filePath) { - try { - if (!this.data[filePath]) { - return; - } - - const d = this.data[filePath]; - if (d.type === 'file') { - return JSON.parse(fs.readFileSync(d.data, 'utf8')); - } - - if (d.type === 'encoded') { - return JSON.parse(Buffer.from(d.data, 'base64').toString()); - } - - /* The caller might delete properties */ - return { - ...d.data - }; - } catch (error) { - debug('Error returning source map for ' + filePath); - debug(error.stack); - - return; - } - } - - /** - * Add inputSourceMap property to coverage data - * @param coverageData - the __coverage__ object - * @returns {Object} a parsed source map object - */ - addInputSourceMapsSync(coverageData) { - Object.entries(coverageData).forEach(([filePath, data]) => { - if (data.inputSourceMap) { - return; - } - - const sourceMap = this.getSourceMapSync(filePath); - if (sourceMap) { - data.inputSourceMap = sourceMap; - /* This huge property is not needed. */ - delete data.inputSourceMap.sourcesContent; - } - }); - } - - sourceFinder(filePath) { - const content = this.sourceStore.get(filePath); - if (content !== undefined) { - return content; - } - - if (path.isAbsolute(filePath)) { - return fs.readFileSync(filePath, 'utf8'); - } - - return fs.readFileSync( - pathutils.asAbsolute(filePath, this.baseDir), - 'utf8' - ); - } - - /** - * Transforms the coverage map provided into one that refers to original - * sources when valid mappings have been registered with this store. - * @param {CoverageMap} coverageMap - the coverage map to transform - * @returns {Promise} the transformed coverage map - */ - async transformCoverage(coverageMap) { - const hasInputSourceMaps = coverageMap - .files() - .some( - file => coverageMap.fileCoverageFor(file).data.inputSourceMap - ); - - if (!hasInputSourceMaps && Object.keys(this.data).length === 0) { - return coverageMap; - } - - const transformer = new SourceMapTransformer( - async (filePath, coverage) => { - try { - const obj = - coverage.data.inputSourceMap || - this.getSourceMapSync(filePath); - if (!obj) { - return null; - } - - const smc = new SourceMapConsumer(obj); - smc.sources.forEach(s => { - const content = smc.sourceContentFor(s); - if (content) { - const sourceFilePath = pathutils.relativeTo( - s, - filePath - ); - this.sourceStore.set(sourceFilePath, content); - } - }); - - return smc; - } catch (error) { - debug('Error returning source map for ' + filePath); - debug(error.stack); - - return null; - } - } - ); - - return await transformer.transform(coverageMap); - } - - /** - * Disposes temporary resources allocated by this map store - */ - dispose() { - this.sourceStore.clear(); - } -} - -module.exports = { MapStore }; diff --git a/node_modules/istanbul-lib-source-maps/lib/mapped.js b/node_modules/istanbul-lib-source-maps/lib/mapped.js deleted file mode 100644 index 73f256c7d..000000000 --- a/node_modules/istanbul-lib-source-maps/lib/mapped.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright 2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const { FileCoverage } = require('istanbul-lib-coverage').classes; - -function locString(loc) { - return [ - loc.start.line, - loc.start.column, - loc.end.line, - loc.end.column - ].join(':'); -} - -class MappedCoverage extends FileCoverage { - constructor(pathOrObj) { - super(pathOrObj); - - this.meta = { - last: { - s: 0, - f: 0, - b: 0 - }, - seen: {} - }; - } - - addStatement(loc, hits) { - const key = 's:' + locString(loc); - const { meta } = this; - let index = meta.seen[key]; - - if (index === undefined) { - index = meta.last.s; - meta.last.s += 1; - meta.seen[key] = index; - this.statementMap[index] = this.cloneLocation(loc); - } - - this.s[index] = this.s[index] || 0; - this.s[index] += hits; - return index; - } - - addFunction(name, decl, loc, hits) { - const key = 'f:' + locString(decl); - const { meta } = this; - let index = meta.seen[key]; - - if (index === undefined) { - index = meta.last.f; - meta.last.f += 1; - meta.seen[key] = index; - name = name || `(unknown_${index})`; - this.fnMap[index] = { - name, - decl: this.cloneLocation(decl), - loc: this.cloneLocation(loc) - }; - } - - this.f[index] = this.f[index] || 0; - this.f[index] += hits; - return index; - } - - addBranch(type, loc, branchLocations, hits) { - const key = ['b', ...branchLocations.map(l => locString(l))].join(':'); - const { meta } = this; - let index = meta.seen[key]; - if (index === undefined) { - index = meta.last.b; - meta.last.b += 1; - meta.seen[key] = index; - this.branchMap[index] = { - loc, - type, - locations: branchLocations.map(l => this.cloneLocation(l)) - }; - } - - if (!this.b[index]) { - this.b[index] = branchLocations.map(() => 0); - } - - hits.forEach((hit, i) => { - this.b[index][i] += hit; - }); - return index; - } - - /* Returns a clone of the location object with only the attributes of interest */ - cloneLocation(loc) { - return { - start: { - line: loc.start.line, - column: loc.start.column - }, - end: { - line: loc.end.line, - column: loc.end.column - } - }; - } -} - -module.exports = { - MappedCoverage -}; diff --git a/node_modules/istanbul-lib-source-maps/lib/pathutils.js b/node_modules/istanbul-lib-source-maps/lib/pathutils.js deleted file mode 100644 index 7dca05aa6..000000000 --- a/node_modules/istanbul-lib-source-maps/lib/pathutils.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - Copyright 2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const path = require('path'); - -module.exports = { - isAbsolute: path.isAbsolute, - asAbsolute(file, baseDir) { - return path.isAbsolute(file) - ? file - : path.resolve(baseDir || process.cwd(), file); - }, - relativeTo(file, origFile) { - return path.isAbsolute(file) - ? file - : path.resolve(path.dirname(origFile), file); - } -}; diff --git a/node_modules/istanbul-lib-source-maps/lib/transform-utils.js b/node_modules/istanbul-lib-source-maps/lib/transform-utils.js deleted file mode 100644 index 093309375..000000000 --- a/node_modules/istanbul-lib-source-maps/lib/transform-utils.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - Copyright 2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -function getUniqueKey(pathname) { - return pathname.replace(/[\\/]/g, '_'); -} - -function getOutput(cache) { - return Object.values(cache).reduce( - (output, { file, mappedCoverage }) => ({ - ...output, - [file]: mappedCoverage - }), - {} - ); -} - -module.exports = { getUniqueKey, getOutput }; diff --git a/node_modules/istanbul-lib-source-maps/lib/transformer.js b/node_modules/istanbul-lib-source-maps/lib/transformer.js deleted file mode 100644 index 6f6353837..000000000 --- a/node_modules/istanbul-lib-source-maps/lib/transformer.js +++ /dev/null @@ -1,147 +0,0 @@ -/* - Copyright 2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -'use strict'; - -const debug = require('debug')('istanbuljs'); -const libCoverage = require('istanbul-lib-coverage'); -const { MappedCoverage } = require('./mapped'); -const getMapping = require('./get-mapping'); -const { getUniqueKey, getOutput } = require('./transform-utils'); - -class SourceMapTransformer { - constructor(finder, opts = {}) { - this.finder = finder; - this.baseDir = opts.baseDir || process.cwd(); - this.resolveMapping = opts.getMapping || getMapping; - } - - processFile(fc, sourceMap, coverageMapper) { - let changes = 0; - - Object.entries(fc.statementMap).forEach(([s, loc]) => { - const hits = fc.s[s]; - const mapping = this.resolveMapping(sourceMap, loc, fc.path); - - if (mapping) { - changes += 1; - const mappedCoverage = coverageMapper(mapping.source); - mappedCoverage.addStatement(mapping.loc, hits); - } - }); - - Object.entries(fc.fnMap).forEach(([f, fnMeta]) => { - const hits = fc.f[f]; - const mapping = this.resolveMapping( - sourceMap, - fnMeta.decl, - fc.path - ); - - const spanMapping = this.resolveMapping( - sourceMap, - fnMeta.loc, - fc.path - ); - - if ( - mapping && - spanMapping && - mapping.source === spanMapping.source - ) { - changes += 1; - const mappedCoverage = coverageMapper(mapping.source); - mappedCoverage.addFunction( - fnMeta.name, - mapping.loc, - spanMapping.loc, - hits - ); - } - }); - - Object.entries(fc.branchMap).forEach(([b, branchMeta]) => { - const hits = fc.b[b]; - const locs = []; - const mappedHits = []; - let source; - let skip; - - branchMeta.locations.forEach((loc, i) => { - const mapping = this.resolveMapping(sourceMap, loc, fc.path); - if (mapping) { - if (!source) { - source = mapping.source; - } - - if (mapping.source !== source) { - skip = true; - } - - locs.push(mapping.loc); - mappedHits.push(hits[i]); - } - }); - - const locMapping = branchMeta.loc - ? this.resolveMapping(sourceMap, branchMeta.loc, fc.path) - : null; - - if (!skip && locs.length > 0) { - changes += 1; - const mappedCoverage = coverageMapper(source); - mappedCoverage.addBranch( - branchMeta.type, - locMapping ? locMapping.loc : locs[0], - locs, - mappedHits - ); - } - }); - - return changes > 0; - } - - async transform(coverageMap) { - const uniqueFiles = {}; - const getMappedCoverage = file => { - const key = getUniqueKey(file); - if (!uniqueFiles[key]) { - uniqueFiles[key] = { - file, - mappedCoverage: new MappedCoverage(file) - }; - } - - return uniqueFiles[key].mappedCoverage; - }; - - for (const file of coverageMap.files()) { - const fc = coverageMap.fileCoverageFor(file); - const sourceMap = await this.finder(file, fc); - - if (sourceMap) { - const changed = this.processFile( - fc, - sourceMap, - getMappedCoverage - ); - if (!changed) { - debug(`File [${file}] ignored, nothing could be mapped`); - } - } else { - uniqueFiles[getUniqueKey(file)] = { - file, - mappedCoverage: new MappedCoverage(fc) - }; - } - } - - return libCoverage.createCoverageMap(getOutput(uniqueFiles)); - } -} - -module.exports = { - SourceMapTransformer -}; diff --git a/node_modules/istanbul-lib-source-maps/package.json b/node_modules/istanbul-lib-source-maps/package.json deleted file mode 100644 index 2798300ec..000000000 --- a/node_modules/istanbul-lib-source-maps/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "istanbul-lib-source-maps", - "version": "4.0.1", - "description": "Source maps support for istanbul", - "author": "Krishnan Anantheswaran ", - "main": "index.js", - "files": [ - "lib", - "index.js" - ], - "scripts": { - "test": "nyc mocha" - }, - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "devDependencies": { - "chai": "^4.2.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0-beta.2", - "ts-node": "^8.5.4" - }, - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/istanbuljs/istanbuljs/issues" - }, - "homepage": "https://istanbul.js.org/", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git", - "directory": "packages/istanbul-lib-source-maps" - }, - "keywords": [ - "istanbul", - "sourcemaps", - "sourcemap", - "source", - "maps" - ], - "engines": { - "node": ">=10" - } -} diff --git a/node_modules/istanbul-reports/CHANGELOG.md b/node_modules/istanbul-reports/CHANGELOG.md deleted file mode 100644 index dc569cb1f..000000000 --- a/node_modules/istanbul-reports/CHANGELOG.md +++ /dev/null @@ -1,450 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [3.1.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports-v3.1.4...istanbul-reports-v3.1.5) (2022-07-13) - - -### Bug Fixes - -* `new Date()` such that it works with MockDate library ([#688](https://github.com/istanbuljs/istanbuljs/issues/688)) ([85905f9](https://github.com/istanbuljs/istanbuljs/commit/85905f989c9480e63ad534c6ff8b1a12dae278eb)) -* add placeholder to fix Implicit Else ([#679](https://github.com/istanbuljs/istanbuljs/issues/679)) ([0516f51](https://github.com/istanbuljs/istanbuljs/commit/0516f519575ee28f77ebf1e9556ac294d78904ea)) - -### [3.1.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports-v3.1.3...istanbul-reports-v3.1.4) (2022-01-17) - - -### Bug Fixes - -* "E" is not showing in the HTML reporter for "implicit else" branches after pull 633 ([#663](https://github.com/istanbuljs/istanbuljs/issues/663)) ([7818922](https://github.com/istanbuljs/istanbuljs/commit/7818922fd7229c4eee12b1407b5a13020f5d34de)) - -### [3.1.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports-v3.1.2...istanbul-reports-v3.1.3) (2021-12-29) - - -### Bug Fixes - -* reverse tabnabbing vulnerability in URLs ([#591](https://github.com/istanbuljs/istanbuljs/issues/591)) ([4eceb9e](https://github.com/istanbuljs/istanbuljs/commit/4eceb9eb8b3169b882d74ecc526fb5837ebc6205)) - -### [3.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports-v3.1.1...istanbul-reports-v3.1.2) (2021-12-23) - - -### Bug Fixes - -* remove stray div tag from HTML report ([68d9c74](https://github.com/istanbuljs/istanbuljs/commit/68d9c7469927ddcf15346307eacea8fd7104086c)) - -### [3.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports-v3.1.0...istanbul-reports-v3.1.1) (2021-12-01) - - -### Bug Fixes - -* rel="noopener" to the link in the generated html reports ([f234bb3](https://github.com/istanbuljs/istanbuljs/commit/f234bb321421e7312a83595934a1abf81c7af70c)) - -## [3.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports-v3.0.5...istanbul-reports-v3.1.0) (2021-11-30) - - -### Features - -* add filter to HTML report ([#650](https://github.com/istanbuljs/istanbuljs/issues/650)) ([eab47f7](https://github.com/istanbuljs/istanbuljs/commit/eab47f76be90343f679ef0e5567a21447a4995dc)) - -### [3.0.5](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-reports-v3.0.4...istanbul-reports-v3.0.5) (2021-10-13) - - -### Bug Fixes - -* cobertura reports in root folder ([#571](https://www.github.com/istanbuljs/istanbuljs/issues/571)) ([596f6ff](https://www.github.com/istanbuljs/istanbuljs/commit/596f6ff1342ae4baa6688bf3ee7786c75d4df947)) - -### [3.0.4](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-reports-v3.0.3...istanbul-reports-v3.0.4) (2021-10-12) - - -### Bug Fixes - -* handle reports with "loc" but no "decl" ([#637](https://www.github.com/istanbuljs/istanbuljs/issues/637)) ([cdc28f3](https://www.github.com/istanbuljs/istanbuljs/commit/cdc28f3a1e80e786eaab3b7d3b8b9b558fc2d3c8)), closes [#322](https://www.github.com/istanbuljs/istanbuljs/issues/322) - -### [3.0.3](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-reports-v3.0.2...istanbul-reports-v3.0.3) (2021-10-06) - - -### Bug Fixes - -* lcov reporter crash when missing branches ([#613](https://www.github.com/istanbuljs/istanbuljs/issues/613)) ([d34981c](https://www.github.com/istanbuljs/istanbuljs/commit/d34981c8131e2ecbff6fc02ffd8702fd9808e241)) - -## [3.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.1...istanbul-reports@3.0.2) (2020-04-01) - - -### Bug Fixes - -* Ignore insignificant lines when coalesce ([#525](https://github.com/istanbuljs/istanbuljs/issues/525)) ([d7d7cfa](https://github.com/istanbuljs/istanbuljs/commit/d7d7cfa1301f0dde2ff19078c31235ffd55c01ef)) - - - - - -## [3.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0...istanbul-reports@3.0.1) (2020-03-26) - - -### Bug Fixes - -* cobertura should escape invalid characters ([#534](https://github.com/istanbuljs/istanbuljs/issues/534)) ([4fd5114](https://github.com/istanbuljs/istanbuljs/commit/4fd5114a0926d20e4e1e3055323c44281f0af6cd)) - - - - - -# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.6...istanbul-reports@3.0.0) (2019-12-20) - - -### Features - -* **text:** Coalesce ranges of missing lines ([#511](https://github.com/istanbuljs/istanbuljs/issues/511)) ([54636fc](https://github.com/istanbuljs/istanbuljs/commit/54636fc9acbb53e5724fe9018837d0d205413194)) - - - - - -# [3.0.0-alpha.6](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.5...istanbul-reports@3.0.0-alpha.6) (2019-12-07) - - -### Bug Fixes - -* Add favicon to html report ([#493](https://github.com/istanbuljs/istanbuljs/issues/493)) ([5afe203](https://github.com/istanbuljs/istanbuljs/commit/5afe20347dd3ae954b31707a67f381f87920797f)) - - - - - -# [3.0.0-alpha.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.4...istanbul-reports@3.0.0-alpha.5) (2019-11-22) - - -### Features - -* Add support for projectRoot option ([#492](https://github.com/istanbuljs/istanbuljs/issues/492)) ([177fd45](https://github.com/istanbuljs/istanbuljs/commit/177fd45ebd7e505e79120995d937d40f965bad79)) - - - - - -# [3.0.0-alpha.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.3...istanbul-reports@3.0.0-alpha.4) (2019-11-18) - - -### Bug Fixes - -* Remove handlebars ([#503](https://github.com/istanbuljs/istanbuljs/issues/503)) ([aa8ae7f](https://github.com/istanbuljs/istanbuljs/commit/aa8ae7fe42ef9c8aeaa193309bafb22ad725bc3d)), closes [#476](https://github.com/istanbuljs/istanbuljs/issues/476) - - - - - -# [3.0.0-alpha.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.2...istanbul-reports@3.0.0-alpha.3) (2019-10-19) - - -### Bug Fixes - -* Add missing dependency on istanbul-lib-report ([#490](https://github.com/istanbuljs/istanbuljs/issues/490)) ([95a2b2f](https://github.com/istanbuljs/istanbuljs/commit/95a2b2f)), closes [istanbuljs/nyc#1204](https://github.com/istanbuljs/nyc/issues/1204) - - - - - -# [3.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.1...istanbul-reports@3.0.0-alpha.2) (2019-10-06) - - -### Bug Fixes - -* Use path.posix.relative to generate URL's for html reports ([#472](https://github.com/istanbuljs/istanbuljs/issues/472)) ([05dc22c](https://github.com/istanbuljs/istanbuljs/commit/05dc22c)) -* **html-spa:** Filter only exact paths ([#431](https://github.com/istanbuljs/istanbuljs/issues/431)) ([bbc85f6](https://github.com/istanbuljs/istanbuljs/commit/bbc85f6)), closes [#426](https://github.com/istanbuljs/istanbuljs/issues/426) - - - - - -# [3.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.0...istanbul-reports@3.0.0-alpha.1) (2019-06-20) - - -### Bug Fixes - -* Set `opts.file = '-'` on text-lcov ([#424](https://github.com/istanbuljs/istanbuljs/issues/424)) ([4be56b2](https://github.com/istanbuljs/istanbuljs/commit/4be56b2)) - - - - - -# [3.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.2.5...istanbul-reports@3.0.0-alpha.0) (2019-06-19) - - -### Features - -* Refactor istanbul-lib-report so report can choose summarizer ([#408](https://github.com/istanbuljs/istanbuljs/issues/408)) ([0f328fd](https://github.com/istanbuljs/istanbuljs/commit/0f328fd)) -* **text report:** Optimize output to show more missing lines ([#341](https://github.com/istanbuljs/istanbuljs/issues/341)) ([c4e8b8e](https://github.com/istanbuljs/istanbuljs/commit/c4e8b8e)) -* Modern html report ([#345](https://github.com/istanbuljs/istanbuljs/issues/345)) ([95ebaf1](https://github.com/istanbuljs/istanbuljs/commit/95ebaf1)) -* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539)) - - -### BREAKING CHANGES - -* Existing istanbul-lib-report API's have been changed -* Node.js 8 is now required - - - - - -## [2.2.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.2.4...istanbul-reports@2.2.5) (2019-05-02) - - -### Bug Fixes - -* **istanbul-reports:** Remove isRoot check causing incorrect report formatting ([#66](https://github.com/istanbuljs/istanbuljs/issues/66)). ([#382](https://github.com/istanbuljs/istanbuljs/issues/382)) ([df6e994](https://github.com/istanbuljs/istanbuljs/commit/df6e994)) - - - - - -## [2.2.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.2.3...istanbul-reports@2.2.4) (2019-04-24) - -**Note:** Version bump only for package istanbul-reports - - - - - -## [2.2.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.2.2...istanbul-reports@2.2.3) (2019-04-17) - - -### Bug Fixes - -* Initialize cols for HTML report sorting ([#369](https://github.com/istanbuljs/istanbuljs/issues/369)) ([28f61de](https://github.com/istanbuljs/istanbuljs/commit/28f61de)) - - - - - -## [2.2.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.2.1...istanbul-reports@2.2.2) (2019-04-09) - -**Note:** Version bump only for package istanbul-reports - - - - - -## [2.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.2.0...istanbul-reports@2.2.1) (2019-04-03) - -**Note:** Version bump only for package istanbul-reports - - - - - -# [2.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.1.1...istanbul-reports@2.2.0) (2019-03-12) - - -### Features - -* set medium colour to yellow ([#306](https://github.com/istanbuljs/istanbuljs/issues/306)) ([ed40be7](https://github.com/istanbuljs/istanbuljs/commit/ed40be7)) - - - - - -## [2.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.1.0...istanbul-reports@2.1.1) (2019-02-14) - - -### Bug Fixes - -* update dependendencies due to vulnerabilities ([#294](https://github.com/istanbuljs/istanbuljs/issues/294)) ([4c14fed](https://github.com/istanbuljs/istanbuljs/commit/4c14fed)) - - - - - -# [2.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.0.3...istanbul-reports@2.1.0) (2019-01-26) - - -### Features - -* **istanbul-reports:** Enable keyboard shortcuts on HTML report file listing view ([#265](https://github.com/istanbuljs/istanbuljs/issues/265)) ([f49b355](https://github.com/istanbuljs/istanbuljs/commit/f49b355)) - - - - - - -## [2.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.0.2...istanbul-reports@2.0.3) (2018-12-25) - - -### Bug Fixes - -* functionMap is sometimes missing a key from functions ([#253](https://github.com/istanbuljs/istanbuljs/issues/253)) ([399f215](https://github.com/istanbuljs/istanbuljs/commit/399f215)) - - - - - -## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.0.1...istanbul-reports@2.0.2) (2018-12-19) - - -### Bug Fixes - -* clover report metrics must be an inline xml element ([#226](https://github.com/istanbuljs/istanbuljs/issues/226)) ([e290c95](https://github.com/istanbuljs/istanbuljs/commit/e290c95)), closes [#13](https://github.com/istanbuljs/istanbuljs/issues/13) - - - - - -## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.0.0...istanbul-reports@2.0.1) (2018-09-06) - - - - -**Note:** Version bump only for package istanbul-reports - - -# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.5.0...istanbul-reports@2.0.0) (2018-07-07) - - -### Chores - -* Specify node >= 6 in istanbul-reports. ([#197](https://github.com/istanbuljs/istanbuljs/issues/197)) ([5810c38](https://github.com/istanbuljs/istanbuljs/commit/5810c38)) - - -### BREAKING CHANGES - -* Requires node >= 6. - - - - - -# [1.5.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.4.1...istanbul-reports@1.5.0) (2018-06-06) - - -### Features - -* ability to skip rows with full coverage ([#170](https://github.com/istanbuljs/istanbuljs/issues/170)) ([bbcdc07](https://github.com/istanbuljs/istanbuljs/commit/bbcdc07)) - - - - - -## [1.4.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.4.0...istanbul-reports@1.4.1) (2018-05-31) - - -### Bug Fixes - -* ensure using correct context ([#168](https://github.com/istanbuljs/istanbuljs/issues/168)) ([df102fd](https://github.com/istanbuljs/istanbuljs/commit/df102fd)) - - - - - -# [1.4.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.3.0...istanbul-reports@1.4.0) (2018-04-17) - - -### Features - -* allow custom reporters to be loaded ([#155](https://github.com/istanbuljs/istanbuljs/issues/155)) ([6d89cca](https://github.com/istanbuljs/istanbuljs/commit/6d89cca)) - - - - - -# [1.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.2.0...istanbul-reports@1.3.0) (2018-03-09) - - -### Features - -* added named anchors to code coverage line numbers. ([#149](https://github.com/istanbuljs/istanbuljs/issues/149)) ([98e1c50](https://github.com/istanbuljs/istanbuljs/commit/98e1c50)) - - - - - -# [1.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.1.4...istanbul-reports@1.2.0) (2018-03-04) - - -### Bug Fixes - -* update fixtures to reflect new heading ([36801d3](https://github.com/istanbuljs/istanbuljs/commit/36801d3)) - - -### Features - -* add skip-empty option for html & text reports ([#140](https://github.com/istanbuljs/istanbuljs/issues/140)) ([d2a4262](https://github.com/istanbuljs/istanbuljs/commit/d2a4262)) -* add uncovered block navigation ([#136](https://github.com/istanbuljs/istanbuljs/issues/136)) ([c798930](https://github.com/istanbuljs/istanbuljs/commit/c798930)) - - - - - -## [1.1.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.1.3...istanbul-reports@1.1.4) (2018-02-13) - - -### Bug Fixes - -* changed column header from "Uncovered Lines" to "Uncovered Line #s" ([#138](https://github.com/istanbuljs/istanbuljs/issues/138)) ([7ba7760](https://github.com/istanbuljs/istanbuljs/commit/7ba7760)) - - - - - -## [1.1.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.1.2...istanbul-reports@1.1.3) (2017-10-21) - - - - -**Note:** Version bump only for package istanbul-reports - - -## [1.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.1.1...istanbul-reports@1.1.2) (2017-08-26) - - -### Bug Fixes - -* prevent branch highlighting from extending pass the end of a line ([#80](https://github.com/istanbuljs/istanbuljs/issues/80)) ([f490377](https://github.com/istanbuljs/istanbuljs/commit/f490377)) - - - - - -## [1.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@1.1.0...istanbul-reports@1.1.1) (2017-05-27) - - - - - -# [1.1.0](https://github.com/istanbuljs/istanbul-reports/compare/istanbul-reports@1.0.2...istanbul-reports@1.1.0) (2017-04-29) - - -### Features - -* once 100% line coverage is achieved, missing branch coverage is now shown in text report ([#45](https://github.com/istanbuljs/istanbuljs/issues/45)) ([8a809f8](https://github.com/istanbuljs/istanbul-reports/commit/8a809f8)) - - - - - -## [1.0.2](https://github.com/istanbuljs/istanbul-reports/compare/istanbul-reports@1.0.1...istanbul-reports@1.0.2) (2017-03-27) - - -### Bug Fixes - -* **windows:** preserve escape char of json-summary key path ([4d71d5e](https://github.com/istanbuljs/istanbul-reports/commit/4d71d5e)) - - -## [1.0.1](https://github.com/istanbuljs/istanbul-reports/compare/v1.0.0...v1.0.1) (2017-01-29) - - -### Bug Fixes - -* add files key to package.json ([#17](https://github.com/istanbuljs/istanbul-reports/issues/17)) ([141f801](https://github.com/istanbuljs/istanbul-reports/commit/141f801)) - - - - -# [1.0.0](https://github.com/istanbuljs/istanbul-reports/compare/v1.0.0-alpha.8...v1.0.0) (2016-10-17) - - -### Bug Fixes - -* fail gracefully if structuredText[startLine] is undefined ([#10](https://github.com/istanbuljs/istanbul-reports/issues/10)) ([bed1d13](https://github.com/istanbuljs/istanbul-reports/commit/bed1d13)) -* preserve escape char of json key path on Windows ([#12](https://github.com/istanbuljs/istanbul-reports/issues/12)) ([4e5266e](https://github.com/istanbuljs/istanbul-reports/commit/4e5266e)) -* skip branch if meta does not exist (fixes speedskater/babel-plugin-rewire[#165](https://github.com/istanbuljs/istanbul-reports/issues/165)) ([#11](https://github.com/istanbuljs/istanbul-reports/issues/11)) ([62bae2f](https://github.com/istanbuljs/istanbul-reports/commit/62bae2f)) -* Teamcity reporter modified to send proper coverage values ([#8](https://github.com/istanbuljs/istanbul-reports/issues/8)) ([4147f50](https://github.com/istanbuljs/istanbul-reports/commit/4147f50)) diff --git a/node_modules/istanbul-reports/LICENSE b/node_modules/istanbul-reports/LICENSE deleted file mode 100644 index d55d2916e..000000000 --- a/node_modules/istanbul-reports/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright 2012-2015 Yahoo! Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Yahoo! Inc. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/istanbul-reports/README.md b/node_modules/istanbul-reports/README.md deleted file mode 100644 index 09b64288a..000000000 --- a/node_modules/istanbul-reports/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# istanbul-reports - -[![Greenkeeper badge](https://badges.greenkeeper.io/istanbuljs/istanbul-reports.svg)](https://greenkeeper.io/) -[![Build Status](https://travis-ci.org/istanbuljs/istanbul-reports.svg?branch=master)](https://travis-ci.org/istanbuljs/istanbul-reports) - -- node.getRelativeName - -- context.getSource(filePath) -- context.classForPercent(type, percent) -- context.console.colorize(str, class) -- context.writer -- context.console.write -- context.console.println diff --git a/node_modules/istanbul-reports/index.js b/node_modules/istanbul-reports/index.js deleted file mode 100644 index f0a7aa30f..000000000 --- a/node_modules/istanbul-reports/index.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -const path = require('path'); - -module.exports = { - create(name, cfg) { - cfg = cfg || {}; - let Cons; - try { - Cons = require(path.join(__dirname, 'lib', name)); - } catch (e) { - if (e.code !== 'MODULE_NOT_FOUND') { - throw e; - } - - Cons = require(name); - } - - return new Cons(cfg); - } -}; diff --git a/node_modules/istanbul-reports/lib/clover/index.js b/node_modules/istanbul-reports/lib/clover/index.js deleted file mode 100644 index eeacb6e7a..000000000 --- a/node_modules/istanbul-reports/lib/clover/index.js +++ /dev/null @@ -1,164 +0,0 @@ -'use strict'; -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -const { ReportBase } = require('istanbul-lib-report'); - -class CloverReport extends ReportBase { - constructor(opts) { - super(); - - this.cw = null; - this.xml = null; - this.projectRoot = opts.projectRoot || process.cwd(); - this.file = opts.file || 'clover.xml'; - } - - onStart(root, context) { - this.cw = context.writer.writeFile(this.file); - this.xml = context.getXMLWriter(this.cw); - this.writeRootStats(root, context); - } - - onEnd() { - this.xml.closeAll(); - this.cw.close(); - } - - getTreeStats(node, context) { - const state = { - packages: 0, - files: 0, - classes: 0 - }; - const visitor = { - onSummary(node, state) { - const metrics = node.getCoverageSummary(true); - if (metrics) { - state.packages += 1; - } - }, - onDetail(node, state) { - state.classes += 1; - state.files += 1; - } - }; - node.visit(context.getVisitor(visitor), state); - return state; - } - - writeRootStats(node, context) { - this.cw.println(''); - this.xml.openTag('coverage', { - generated: Date.now().toString(), - clover: '3.2.0' - }); - - this.xml.openTag('project', { - timestamp: Date.now().toString(), - name: 'All files' - }); - - const metrics = node.getCoverageSummary(); - this.xml.inlineTag('metrics', { - statements: metrics.lines.total, - coveredstatements: metrics.lines.covered, - conditionals: metrics.branches.total, - coveredconditionals: metrics.branches.covered, - methods: metrics.functions.total, - coveredmethods: metrics.functions.covered, - elements: - metrics.lines.total + - metrics.branches.total + - metrics.functions.total, - coveredelements: - metrics.lines.covered + - metrics.branches.covered + - metrics.functions.covered, - complexity: 0, - loc: metrics.lines.total, - ncloc: metrics.lines.total, // what? copied as-is from old report - ...this.getTreeStats(node, context) - }); - } - - writeMetrics(metrics) { - this.xml.inlineTag('metrics', { - statements: metrics.lines.total, - coveredstatements: metrics.lines.covered, - conditionals: metrics.branches.total, - coveredconditionals: metrics.branches.covered, - methods: metrics.functions.total, - coveredmethods: metrics.functions.covered - }); - } - - onSummary(node) { - if (node.isRoot()) { - return; - } - const metrics = node.getCoverageSummary(true); - if (!metrics) { - return; - } - - this.xml.openTag('package', { - name: asJavaPackage(node) - }); - this.writeMetrics(metrics); - } - - onSummaryEnd(node) { - if (node.isRoot()) { - return; - } - this.xml.closeTag('package'); - } - - onDetail(node) { - const fileCoverage = node.getFileCoverage(); - const metrics = node.getCoverageSummary(); - const branchByLine = fileCoverage.getBranchCoverageByLine(); - - this.xml.openTag('file', { - name: asClassName(node), - path: fileCoverage.path - }); - - this.writeMetrics(metrics); - - const lines = fileCoverage.getLineCoverage(); - Object.entries(lines).forEach(([k, count]) => { - const attrs = { - num: k, - count, - type: 'stmt' - }; - const branchDetail = branchByLine[k]; - - if (branchDetail) { - attrs.type = 'cond'; - attrs.truecount = branchDetail.covered; - attrs.falsecount = branchDetail.total - branchDetail.covered; - } - this.xml.inlineTag('line', attrs); - }); - - this.xml.closeTag('file'); - } -} - -function asJavaPackage(node) { - return node - .getRelativeName() - .replace(/\//g, '.') - .replace(/\\/g, '.') - .replace(/\.$/, ''); -} - -function asClassName(node) { - return node.getRelativeName().replace(/.*[\\/]/, ''); -} - -module.exports = CloverReport; diff --git a/node_modules/istanbul-reports/lib/cobertura/index.js b/node_modules/istanbul-reports/lib/cobertura/index.js deleted file mode 100644 index e5574faaa..000000000 --- a/node_modules/istanbul-reports/lib/cobertura/index.js +++ /dev/null @@ -1,151 +0,0 @@ -'use strict'; -/* - Copyright 2012-2015, Yahoo Inc. - Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -const path = require('path'); -const { escape } = require('html-escaper'); -const { ReportBase } = require('istanbul-lib-report'); - -class CoberturaReport extends ReportBase { - constructor(opts) { - super(); - - opts = opts || {}; - - this.cw = null; - this.xml = null; - this.timestamp = opts.timestamp || Date.now().toString(); - this.projectRoot = opts.projectRoot || process.cwd(); - this.file = opts.file || 'cobertura-coverage.xml'; - } - - onStart(root, context) { - this.cw = context.writer.writeFile(this.file); - this.xml = context.getXMLWriter(this.cw); - this.writeRootStats(root); - } - - onEnd() { - this.xml.closeAll(); - this.cw.close(); - } - - writeRootStats(node) { - const metrics = node.getCoverageSummary(); - this.cw.println(''); - this.cw.println( - '' - ); - this.xml.openTag('coverage', { - 'lines-valid': metrics.lines.total, - 'lines-covered': metrics.lines.covered, - 'line-rate': metrics.lines.pct / 100.0, - 'branches-valid': metrics.branches.total, - 'branches-covered': metrics.branches.covered, - 'branch-rate': metrics.branches.pct / 100.0, - timestamp: this.timestamp, - complexity: '0', - version: '0.1' - }); - this.xml.openTag('sources'); - this.xml.inlineTag('source', null, this.projectRoot); - this.xml.closeTag('sources'); - this.xml.openTag('packages'); - } - - onSummary(node) { - const metrics = node.getCoverageSummary(true); - if (!metrics) { - return; - } - this.xml.openTag('package', { - name: node.isRoot() ? 'main' : escape(asJavaPackage(node)), - 'line-rate': metrics.lines.pct / 100.0, - 'branch-rate': metrics.branches.pct / 100.0 - }); - this.xml.openTag('classes'); - } - - onSummaryEnd(node) { - const metrics = node.getCoverageSummary(true); - if (!metrics) { - return; - } - this.xml.closeTag('classes'); - this.xml.closeTag('package'); - } - - onDetail(node) { - const fileCoverage = node.getFileCoverage(); - const metrics = node.getCoverageSummary(); - const branchByLine = fileCoverage.getBranchCoverageByLine(); - - this.xml.openTag('class', { - name: escape(asClassName(node)), - filename: path.relative(this.projectRoot, fileCoverage.path), - 'line-rate': metrics.lines.pct / 100.0, - 'branch-rate': metrics.branches.pct / 100.0 - }); - - this.xml.openTag('methods'); - const fnMap = fileCoverage.fnMap; - Object.entries(fnMap).forEach(([k, { name, decl }]) => { - const hits = fileCoverage.f[k]; - this.xml.openTag('method', { - name: escape(name), - hits, - signature: '()V' //fake out a no-args void return - }); - this.xml.openTag('lines'); - //Add the function definition line and hits so that jenkins cobertura plugin records method hits - this.xml.inlineTag('line', { - number: decl.start.line, - hits - }); - this.xml.closeTag('lines'); - this.xml.closeTag('method'); - }); - this.xml.closeTag('methods'); - - this.xml.openTag('lines'); - const lines = fileCoverage.getLineCoverage(); - Object.entries(lines).forEach(([k, hits]) => { - const attrs = { - number: k, - hits, - branch: 'false' - }; - const branchDetail = branchByLine[k]; - - if (branchDetail) { - attrs.branch = true; - attrs['condition-coverage'] = - branchDetail.coverage + - '% (' + - branchDetail.covered + - '/' + - branchDetail.total + - ')'; - } - this.xml.inlineTag('line', attrs); - }); - - this.xml.closeTag('lines'); - this.xml.closeTag('class'); - } -} - -function asJavaPackage(node) { - return node - .getRelativeName() - .replace(/\//g, '.') - .replace(/\\/g, '.') - .replace(/\.$/, ''); -} - -function asClassName(node) { - return node.getRelativeName().replace(/.*[\\/]/, ''); -} - -module.exports = CoberturaReport; diff --git a/node_modules/istanbul-reports/lib/html-spa/.babelrc b/node_modules/istanbul-reports/lib/html-spa/.babelrc deleted file mode 100644 index f995d680d..000000000 --- a/node_modules/istanbul-reports/lib/html-spa/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": [["@babel/preset-env", { "modules": "commonjs" }], "@babel/preset-react"] -} diff --git a/node_modules/istanbul-reports/lib/html-spa/assets/bundle.js b/node_modules/istanbul-reports/lib/html-spa/assets/bundle.js deleted file mode 100644 index 24f8110cb..000000000 --- a/node_modules/istanbul-reports/lib/html-spa/assets/bundle.js +++ /dev/null @@ -1,30 +0,0 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var l=t[r]={i:r,l:!1,exports:{}};return e[r].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(r,l,function(t){return e[t]}.bind(null,l));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";e.exports=n(3)},function(e,t,n){"use strict"; -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/var r=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,o,u=a(e),c=1;ce.length)&&(t=e.length);for(var n=0,r=new Array(t);nO.length&&O.push(e)}function I(e,t,n){return null==e?0:function e(t,n,r,l){var o=typeof t;"undefined"!==o&&"boolean"!==o||(t=null);var u=!1;if(null===t)u=!0;else switch(o){case"string":case"number":u=!0;break;case"object":switch(t.$$typeof){case i:case a:u=!0}}if(u)return r(l,t,""===n?"."+M(t,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(t))for(var c=0;c