diff --git a/README.md b/README.md index b467731..db94ed4 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Automate releases with Conventional Commit Messages. release-please: runs-on: ubuntu-latest steps: - - uses: GoogleCloudPlatform/release-please-action@v2 + - uses: GoogleCloudPlatform/release-please-action@v3 with: release-type: node package-name: release-please-action @@ -37,7 +37,7 @@ Automate releases with Conventional Commit Messages. ```yaml #...(same as above) steps: - - uses: GoogleCloudPlatform/release-please-action@v2 + - uses: GoogleCloudPlatform/release-please-action@v3 with: command: manifest ``` @@ -138,7 +138,7 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: GoogleCloudPlatform/release-please-action@v2 + - uses: GoogleCloudPlatform/release-please-action@v3 with: release-type: node package-name: release-please-action @@ -161,7 +161,7 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: GoogleCloudPlatform/release-please-action@v2 + - uses: GoogleCloudPlatform/release-please-action@v3 with: release-type: node package-name: release-please-action @@ -178,7 +178,7 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: GoogleCloudPlatform/release-please-action@v2 + - uses: GoogleCloudPlatform/release-please-action@v3 with: release-type: node package-name: release-please-action @@ -200,7 +200,7 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: GoogleCloudPlatform/release-please-action@v2 + - uses: GoogleCloudPlatform/release-please-action@v3 id: release with: release-type: node @@ -248,7 +248,7 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: GoogleCloudPlatform/release-please-action@v2 + - uses: GoogleCloudPlatform/release-please-action@v3 id: release with: release-type: node diff --git a/action.yml b/action.yml index 1407cb2..fba42e9 100644 --- a/action.yml +++ b/action.yml @@ -32,18 +32,10 @@ inputs: description: "create a release from a path other than the repository's root" required: false default: '' - monorepo-tags: - description: 'add prefix to tags and branches, allowing multiple libraries to be released from the same repository' - required: false - default: false changelog-path: description: 'specify a CHANGELOG path other than the root CHANGELOG.md' required: false default: '' - changelog-types: - description: 'changlelog commit types' - required: false - default: '' command: description: 'release-please command to run, either "github-release", or "release-pr" (defaults to running both)' required: false @@ -56,10 +48,10 @@ inputs: description: 'branch to open pull release PR against (detected by default)' required: false default: '' - pull-request-title-pattern: - description: 'add title pattern to make release PR, defaults to using "chore${scope}: release${component} ${version}".' + changelog-types: + description: 'changlelog commit types' required: false - default: 'chore${scope}: release${component} ${version}' + default: '' config-file: description: 'where can the config file be found in the project?' required: false @@ -84,6 +76,22 @@ inputs: description: 'configure github repository URL. Default `process.env.GITHUB_REPOSITORY`' required: false default: '' + monorepo-tags: + description: 'add prefix to tags and branches, allowing multiple libraries to be released from the same repository' + required: false + default: false + pull-request-title-pattern: + description: 'add title pattern to make release PR, defaults to using "chore${scope}: release${component} ${version}"' + required: false + default: '' + draft: + description: 'mark release as a draft' + required: false + default: false + draft-pull-request: + description: 'mark pull request as a draft' + required: false + default: false runs: using: 'node12' diff --git a/dist/index.js b/dist/index.js index d0265fa..5a57541 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6,12 +6,12 @@ module.exports = /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const core = __nccwpck_require__(42186) -const { factory } = __nccwpck_require__(24363) +const { GitHub } = __nccwpck_require__(19746) +const { Manifest } = __nccwpck_require__(31999) const CONFIG_FILE = 'release-please-config.json' const MANIFEST_FILE = '.release-please-manifest.json' const MANIFEST_COMMANDS = ['manifest', 'manifest-pr'] -const RELEASE_LABEL = 'autorelease: pending' const GITHUB_RELEASE_COMMAND = 'github-release' const GITHUB_RELEASE_PR_COMMAND = 'release-pr' const GITHUB_API_URL = 'https://api.github.com' @@ -19,18 +19,9 @@ const GITHUB_GRAPHQL_URL = 'https://api.github.com' const signoff = core.getInput('signoff') || undefined -function getBooleanInput (input) { - const trueValue = ['true', 'True', 'TRUE', 'yes', 'Yes', 'YES', 'y', 'Y', 'on', 'On', 'ON'] - const falseValue = ['false', 'False', 'FALSE', 'no', 'No', 'NO', 'n', 'N', 'off', 'Off', 'OFF'] - const stringInput = core.getInput(input) - if (trueValue.indexOf(stringInput) > -1) return true - if (falseValue.indexOf(stringInput) > -1) return false - throw TypeError(`Wrong boolean value of the input '${input}'`) -} - function getGitHubInput () { return { - fork: getBooleanInput('fork'), + fork: core.getBooleanInput('fork'), defaultBranch: core.getInput('default-branch') || undefined, repoUrl: core.getInput('repo-url') || process.env.GITHUB_REPOSITORY, apiUrl: core.getInput('github-api-url') || GITHUB_API_URL, @@ -48,40 +39,25 @@ function getManifestInput () { } async function runManifest (command) { - const githubOpts = getGitHubInput() - const manifestOpts = { ...githubOpts, ...getManifestInput() } - const pr = await factory.runCommand('manifest-pr', manifestOpts) - if (pr) { - core.setOutput('pr', pr) - } - if (command === 'manifest-pr') return - - const releasesCreated = await factory.runCommand('manifest-release', manifestOpts) - const pathsReleased = [] - if (releasesCreated) { - core.setOutput('releases_created', true) - for (const [path, release] of Object.entries(releasesCreated)) { - if (!release) { - continue - } - pathsReleased.push(path) - if (path === '.') { - core.setOutput('release_created', true) - } else { - core.setOutput(`${path}--release_created`, true) - } - for (const [key, val] of Object.entries(release)) { - if (path === '.') { - core.setOutput(key, val) - } else { - core.setOutput(`${path}--${key}`, val) - } - } + // Create the Manifest and GitHub instance from + // argument provided to GitHub action: + const { fork } = getGitHubInput() + const manifestOpts = getManifestInput() + const github = await getGitHubInstance() + const manifest = await Manifest.fromManifest( + github, + github.repository.defaultBranch, + manifestOpts.configFile, + manifestOpts.manifestFile, + { + signoff, + fork } - } - // Paths of all releases that were created, so that they can be passed - // to matrix in next step: - core.setOutput('paths_released', JSON.stringify(pathsReleased)) + ) + // Create or update release PRs: + outputPRs(await manifest.createPullRequests()) + if (command === 'manifest-pr') return + outputReleases(await manifest.createReleases()) } async function main () { @@ -90,11 +66,10 @@ async function main () { return await runManifest(command) } - const { token, fork, defaultBranch, apiUrl, graphqlUrl, repoUrl } = getGitHubInput() - - const bumpMinorPreMajor = getBooleanInput('bump-minor-pre-major') - const bumpPatchForMinorPreMajor = getBooleanInput('bump-patch-for-minor-pre-major') - const monorepoTags = getBooleanInput('monorepo-tags') + const { fork } = getGitHubInput() + const bumpMinorPreMajor = core.getBooleanInput('bump-minor-pre-major') + const bumpPatchForMinorPreMajor = core.getBooleanInput('bump-patch-for-minor-pre-major') + const monorepoTags = core.getBooleanInput('monorepo-tags') const packageName = core.getInput('package-name') const path = core.getInput('path') || undefined const releaseType = core.getInput('release-type', { required: true }) @@ -102,67 +77,104 @@ async function main () { const changelogTypes = core.getInput('changelog-types') || undefined const changelogSections = changelogTypes && JSON.parse(changelogTypes) const versionFile = core.getInput('version-file') || undefined + const github = await getGitHubInstance() const pullRequestTitlePattern = core.getInput('pull-request-title-pattern') || undefined - - // First we check for any merged release PRs (PRs merged with the label - // "autorelease: pending"): - if (!command || command === GITHUB_RELEASE_COMMAND) { - const releaseCreated = await factory.runCommand(GITHUB_RELEASE_COMMAND, { - label: RELEASE_LABEL, - repoUrl, + const draft = core.getBooleanInput('draft') + const draftPullRequest = core.getBooleanInput('draft-pull-request') + const manifest = await Manifest.fromConfig( + github, + github.repository.defaultBranch, + { + bumpMinorPreMajor, + bumpPatchForMinorPreMajor, packageName, - path, - monorepoTags, - token, - changelogPath, releaseType, - defaultBranch, + changelogPath, + changelogSections, + versionFile, + includeComponentInTag: monorepoTags, pullRequestTitlePattern, - apiUrl, - graphqlUrl - }) + draftPullRequest + }, + { + draft, + signoff, + fork + }, + path + ) - if (releaseCreated) { - core.setOutput('release_created', true) - for (const key of Object.keys(releaseCreated)) { - core.setOutput(key, releaseCreated[key]) - } - } + // First we check for any merged release PRs (PRs merged with the label + // "autorelease: pending"): + if (!command || command === GITHUB_RELEASE_COMMAND) { + outputReleases(await manifest.createReleases()) } // Next we check for PRs merged since the last release, and groom the // release PR: if (!command || command === GITHUB_RELEASE_PR_COMMAND) { - const pr = await factory.runCommand(GITHUB_RELEASE_PR_COMMAND, { - releaseType, - monorepoTags, - packageName, - path, - apiUrl, - graphqlUrl, - repoUrl, - fork, - token, - label: RELEASE_LABEL, - bumpMinorPreMajor, - bumpPatchForMinorPreMajor, - changelogPath, - changelogSections, - versionFile, - defaultBranch, - pullRequestTitlePattern, - signoff - }) - - if (pr) { - core.setOutput('pr', pr) - } + outputPRs(await manifest.createPullRequests()) } } const releasePlease = { main, - getBooleanInput +} + +function getGitHubInstance () { + const { token, defaultBranch, apiUrl, graphqlUrl, repoUrl } = getGitHubInput() + const [owner, repo] = repoUrl.split('/') + const githubCreateOpts = { + owner, + repo, + apiUrl, + graphqlUrl, + token + } + if (defaultBranch) githubCreateOpts.defaultBranch = defaultBranch + return GitHub.create(githubCreateOpts) +} + +function outputReleases (releases) { + releases = releases.filter(release => release !== undefined) + const pathsReleased = [] + if (releases.length) { + core.setOutput('releases_created', true) + for (const release of releases) { + const path = release.path || '.' + if (path) { + pathsReleased.push(path) + // If the special root release is set (representing project root) + // and this is explicitly a manifest release, set the release_created boolean. + if (path === '.') { + core.setOutput('release_created', true) + } else { + core.setOutput(`${path}--release_created`, true) + } + } + for (let [key, val] of Object.entries(release)) { + // Historically tagName was output as tag_name, keep this + // consistent to avoid breaking change: + if (key === 'tagName') key = 'tag_name' + if (path === '.') { + core.setOutput(key, val) + } else { + core.setOutput(`${path}--${key}`, val) + } + } + } + } + // Paths of all releases that were created, so that they can be passed + // to matrix in next step: + core.setOutput('paths_released', JSON.stringify(pathsReleased)) +} + +function outputPRs (prs) { + prs = prs.filter(pr => pr !== undefined) + if (prs.length) { + core.setOutput('pr', prs[0]) + core.setOutput('prs', JSON.stringify(prs)) + } } /* c8 ignore next 4 */ @@ -182,14 +194,27 @@ if (require.main === require.cache[eval('__filename')]) { "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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; + 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__(12087)); const utils_1 = __nccwpck_require__(5278); /** @@ -268,6 +293,25 @@ function escapeProperty(s) { "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) { @@ -277,19 +321,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +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__(87351); const file_command_1 = __nccwpck_require__(717); const utils_1 = __nccwpck_require__(5278); const os = __importStar(__nccwpck_require__(12087)); const path = __importStar(__nccwpck_require__(85622)); +const oidc_utils_1 = __nccwpck_require__(98041); /** * The code to exit an action */ @@ -351,7 +390,9 @@ function addPath(inputPath) { } exports.addPath = addPath; /** - * Gets the value of an input. The value is also trimmed. + * 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. @@ -362,9 +403,49 @@ function getInput(name, options) { 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 !== ''); + return inputs; +} +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. * @@ -373,6 +454,7 @@ exports.getInput = getInput; */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function setOutput(name, value) { + process.stdout.write(os.EOL); command_1.issueCommand('set-output', { name }, value); } exports.setOutput = setOutput; @@ -419,19 +501,30 @@ 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) { - command_1.issue('error', message instanceof Error ? message.toString() : message); +function error(message, properties = {}) { + command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } exports.error = error; /** - * Adds an warning issue + * 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) { - command_1.issue('warning', message instanceof Error ? message.toString() : message); +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 @@ -504,6 +597,12 @@ 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; //# sourceMappingURL=core.js.map /***/ }), @@ -514,14 +613,27 @@ exports.getState = getState; "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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; + 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.issueCommand = void 0; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ const fs = __importStar(__nccwpck_require__(35747)); @@ -544,6 +656,90 @@ exports.issueCommand = issueCommand; /***/ }), +/***/ 98041: +/***/ (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__(39925); +const auth_1 = __nccwpck_require__(23702); +const core_1 = __nccwpck_require__(42186); +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 + +/***/ }), + /***/ 5278: /***/ ((__unused_webpack_module, exports) => { @@ -552,6 +748,7 @@ exports.issueCommand = issueCommand; // 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 @@ -566,8 +763,704 @@ function toCommandValue(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 +/***/ }), + +/***/ 23702: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +class BasicCredentialHandler { + constructor(username, password) { + this.username = username; + this.password = password; + } + prepareRequest(options) { + options.headers['Authorization'] = + 'Basic ' + + Buffer.from(this.username + ':' + this.password).toString('base64'); + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } +} +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) { + options.headers['Authorization'] = 'Bearer ' + this.token; + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } +} +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) { + options.headers['Authorization'] = + 'Basic ' + Buffer.from('PAT:' + this.token).toString('base64'); + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } +} +exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; + + +/***/ }), + +/***/ 39925: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const http = __nccwpck_require__(98605); +const https = __nccwpck_require__(57211); +const pm = __nccwpck_require__(16443); +let 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) { + let 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 new Promise(async (resolve, reject) => { + 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) { + let 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 this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); + } + get(requestUrl, additionalHeaders) { + return this.request('GET', requestUrl, null, additionalHeaders || {}); + } + del(requestUrl, additionalHeaders) { + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); + } + post(requestUrl, data, additionalHeaders) { + return this.request('POST', requestUrl, data, additionalHeaders || {}); + } + patch(requestUrl, data, additionalHeaders) { + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); + } + put(requestUrl, data, additionalHeaders) { + return this.request('PUT', requestUrl, data, additionalHeaders || {}); + } + head(requestUrl, additionalHeaders) { + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + 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 + */ + async getJson(requestUrl, additionalHeaders = {}) { + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + let res = await this.get(requestUrl, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async postJson(requestUrl, obj, additionalHeaders = {}) { + let 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); + let res = await this.post(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async putJson(requestUrl, obj, additionalHeaders = {}) { + let 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); + let res = await this.put(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async patchJson(requestUrl, obj, additionalHeaders = {}) { + let 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); + let res = await 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 + */ + async request(verb, requestUrl, data, headers) { + if (this._disposed) { + throw new Error('Client has already been disposed.'); + } + let parsedUrl = new URL(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + // Only perform retries on reads since writes may not be idempotent. + let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 + ? this._maxRetries + 1 + : 1; + let numTries = 0; + let response; + while (numTries < maxTries) { + response = await this.requestRaw(info, data); + // Check if it's an authentication challenge + if (response && + response.message && + response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (let i = 0; i < this.handlers.length; i++) { + if (this.handlers[i].canHandleAuthentication(response)) { + authenticationHandler = this.handlers[i]; + 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 (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && + this._allowRedirects && + redirectsRemaining > 0) { + const redirectUrl = response.message.headers['location']; + if (!redirectUrl) { + // if there's no location to redirect to, we won't + break; + } + let 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. + await response.readBody(); + // strip authorization header if redirected to a different hostname + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { + for (let 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 = await this.requestRaw(info, data); + redirectsRemaining--; + } + if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { + // If not a retry code, return immediately instead of retrying + return response; + } + numTries += 1; + if (numTries < maxTries) { + await response.readBody(); + await this._performExponentialBackoff(numTries); + } + } + 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 new Promise((resolve, reject) => { + let callbackForResult = function (err, res) { + if (err) { + reject(err); + } + resolve(res); + }; + this.requestRawWithCallback(info, data, callbackForResult); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + let socket; + if (typeof data === 'string') { + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); + } + let callbackCalled = false; + let handleResult = (err, res) => { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + }; + let req = info.httpModule.request(info.options, (msg) => { + let res = new HttpClientResponse(msg); + handleResult(null, res); + }); + 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), null); + }); + req.on('error', function (err) { + // err has statusCode property + // res should have headers + handleResult(err, null); + }); + 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) { + let 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) { + this.handlers.forEach(handler => { + handler.prepareRequest(info.options); + }); + } + return info; + } + _mergeHeaders(headers) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); + } + return lowercaseKeys(headers || {}); + } + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); + let clientHeader; + if (this.requestOptions && this.requestOptions.headers) { + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; + } + return additionalHeaders[header] || clientHeader || _default; + } + _getAgent(parsedUrl) { + let agent; + let proxyUrl = pm.getProxyUrl(parsedUrl); + let 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; + } + if (useProxy) { + // If using proxy, need tunnel + if (!tunnel) { + tunnel = __nccwpck_require__(74294); + } + const agentOptions = { + maxSockets: maxSockets, + keepAlive: this._keepAlive, + proxy: { + ...((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: 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) { + retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); + const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); + return new Promise(resolve => setTimeout(() => resolve(), ms)); + } + static dateTimeDeserializer(key, value) { + if (typeof value === 'string') { + let a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + async _processResponse(res, options) { + return new Promise(async (resolve, reject) => { + const statusCode = res.message.statusCode; + const response = { + statusCode: statusCode, + result: null, + headers: {} + }; + // not found leads to null obj returned + if (statusCode == HttpCodes.NotFound) { + resolve(response); + } + let obj; + let contents; + // get the result from the body + try { + contents = await res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, HttpClient.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 + ')'; + } + let err = new HttpClientError(msg, statusCode); + err.result = response.result; + reject(err); + } + else { + resolve(response); + } + }); + } +} +exports.HttpClient = HttpClient; + + +/***/ }), + +/***/ 16443: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +function getProxyUrl(reqUrl) { + let usingSsl = reqUrl.protocol === 'https:'; + let proxyUrl; + if (checkBypass(reqUrl)) { + return proxyUrl; + } + let proxyVar; + if (usingSsl) { + proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY']; + } + else { + proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; + } + if (proxyVar) { + proxyUrl = new URL(proxyVar); + } + return proxyUrl; +} +exports.getProxyUrl = getProxyUrl; +function checkBypass(reqUrl) { + if (!reqUrl.hostname) { + return false; + } + let 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 + let upperReqHosts = [reqUrl.hostname.toUpperCase()]; + if (typeof reqPort === 'number') { + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); + } + // Compare request host against noproxy + for (let upperNoProxyItem of noProxy + .split(',') + .map(x => x.trim().toUpperCase()) + .filter(x => x)) { + if (upperReqHosts.some(x => x === upperNoProxyItem)) { + return true; + } + } + return false; +} +exports.checkBypass = checkBypass; + + /***/ }), /***/ 45211: @@ -582,11 +1475,7 @@ Object.defineProperty(exports, "__esModule", ({ exports.codeFrameColumns = codeFrameColumns; exports.default = _default; -var _highlight = _interopRequireWildcard(__nccwpck_require__(36860)); - -function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; } +var _highlight = __nccwpck_require__(36860); let deprecationWarningShown = false; @@ -681,7 +1570,7 @@ function codeFrameColumns(rawLines, loc, 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).slice(start, end).map((line, index) => { + 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} |`; @@ -756,13 +1645,13 @@ Object.defineProperty(exports, "__esModule", ({ exports.isIdentifierStart = isIdentifierStart; exports.isIdentifierChar = isIdentifierChar; exports.isIdentifierName = isIdentifierName; -let nonASCIIidentifierStartChars = "\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\u0560-\u0588\u05d0-\u05ea\u05ef-\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\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\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\u09fc\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\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\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-\u1878\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\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\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-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\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-\uab69\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"; -let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; +let nonASCIIidentifierStartChars = "\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\u0560-\u0588\u05d0-\u05ea\u05ef-\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\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\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\u09fc\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\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\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-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\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-\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-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\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-\uab69\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"; +let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; -const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; -const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; +const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; +const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; function isInAstralSet(code, set) { let pos = 0x10000; @@ -808,16 +1697,23 @@ function isIdentifierChar(code) { function isIdentifierName(name) { let isFirst = true; - for (let _i = 0, _Array$from = Array.from(name); _i < _Array$from.length; _i++) { - const char = _Array$from[_i]; - const cp = char.codePointAt(0); + for (let i = 0; i < name.length; i++) { + let cp = name.charCodeAt(i); + + if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) { + const trail = name.charCodeAt(++i); + + if ((trail & 0xfc00) === 0xdc00) { + cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff); + } + } if (isFirst) { + isFirst = false; + if (!isIdentifierStart(cp)) { return false; } - - isFirst = false; } else if (!isIdentifierChar(cp)) { return false; } @@ -946,21 +1842,15 @@ function isKeyword(word) { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.shouldHighlight = shouldHighlight; -exports.getChalk = getChalk; exports.default = highlight; +exports.getChalk = getChalk; +exports.shouldHighlight = shouldHighlight; -var jsTokensNs = _interopRequireWildcard(__nccwpck_require__(51531)); +var _jsTokens = __nccwpck_require__(51531); var _helperValidatorIdentifier = __nccwpck_require__(86607); -var _chalk = _interopRequireDefault(__nccwpck_require__(77658)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; } +var _chalk = __nccwpck_require__(77658); const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]); @@ -982,9 +1872,6 @@ const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; const BRACKET = /^[()[\]{}]$/; let tokenize; { - const { - matchToToken - } = jsTokensNs; const JSX_TAG = /^[a-z][\w-]*$/i; const getTokenType = function (token, offset, text) { @@ -1016,8 +1903,9 @@ let tokenize; tokenize = function* (text) { let match; - while (match = jsTokensNs.default.exec(text)) { - const token = matchToToken(match); + while (match = _jsTokens.default.exec(text)) { + const token = _jsTokens.matchToToken(match); + yield { type: getTokenType(token, match.index, text), value: token.value @@ -1046,20 +1934,14 @@ function highlightTokens(defs, text) { } function shouldHighlight(options) { - return _chalk.default.supportsColor || options.forceColor; + return !!_chalk.supportsColor || options.forceColor; } function getChalk(options) { - let chalk = _chalk.default; - - if (options.forceColor) { - chalk = new _chalk.default.constructor({ - enabled: true, - level: 1 - }); - } - - return chalk; + return options.forceColor ? new _chalk.constructor({ + enabled: true, + level: 1 + }) : _chalk; } function highlight(code, options = {}) { @@ -5912,721 +6794,6 @@ exports.parse = __nccwpck_require__(33848) exports.stringify = __nccwpck_require__(66303) -/***/ }), - -/***/ 85434: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -const os = __nccwpck_require__(12087); -const chalk = __nccwpck_require__(78818); -const execa = __nccwpck_require__(55447); -const logTransformer = __nccwpck_require__(92965); - -// bookkeeping for spawned processes -/** @type {Set>} */ -const children = new Set(); - -// when streaming processes are spawned, use this color for prefix -const colorWheel = ["cyan", "magenta", "blue", "yellow", "green", "red"]; -const NUM_COLORS = colorWheel.length; - -// ever-increasing index ensures colors are always sequential -let currentColor = 0; - -/** - * Execute a command asynchronously, piping stdio by default. - * @param {string} command - * @param {string[]} args - * @param {import("execa").Options} [opts] - */ -function exec(command, args, opts) { - const options = Object.assign({ stdio: "pipe" }, opts); - const spawned = spawnProcess(command, args, options); - - return wrapError(spawned); -} - -/** - * Execute a command synchronously. - * @param {string} command - * @param {string[]} args - * @param {import("execa").SyncOptions} [opts] - */ -function execSync(command, args, opts) { - return execa.sync(command, args, opts).stdout; -} - -/** - * Spawn a command asynchronously, _always_ inheriting stdio. - * @param {string} command - * @param {string[]} args - * @param {import("execa").Options} [opts] - */ -function spawn(command, args, opts) { - const options = Object.assign({}, opts, { stdio: "inherit" }); - const spawned = spawnProcess(command, args, options); - - return wrapError(spawned); -} - -/** - * Spawn a command asynchronously, streaming stdio with optional prefix. - * @param {string} command - * @param {string[]} args - * @param {import("execa").Options} [opts] - * @param {string} [prefix] - */ -// istanbul ignore next -function spawnStreaming(command, args, opts, prefix) { - const options = Object.assign({}, opts); - options.stdio = ["ignore", "pipe", "pipe"]; - - const spawned = spawnProcess(command, args, options); - - const stdoutOpts = {}; - const stderrOpts = {}; // mergeMultiline causes escaped newlines :P - - if (prefix) { - const colorName = colorWheel[currentColor % NUM_COLORS]; - const color = chalk[colorName]; - - currentColor += 1; - - stdoutOpts.tag = `${color.bold(prefix)}:`; - stderrOpts.tag = `${color(prefix)}:`; - } - - // Avoid "Possible EventEmitter memory leak detected" warning due to piped stdio - if (children.size > process.stdout.listenerCount("close")) { - process.stdout.setMaxListeners(children.size); - process.stderr.setMaxListeners(children.size); - } - - spawned.stdout.pipe(logTransformer(stdoutOpts)).pipe(process.stdout); - spawned.stderr.pipe(logTransformer(stderrOpts)).pipe(process.stderr); - - return wrapError(spawned); -} - -function getChildProcessCount() { - return children.size; -} - -/** - * @param {import("execa").ExecaError} result - * @returns {number} - */ -function getExitCode(result) { - if (result.exitCode) { - return result.exitCode; - } - - // https://nodejs.org/docs/latest-v6.x/api/child_process.html#child_process_event_close - if (typeof result.code === "number") { - return result.code; - } - - // https://nodejs.org/docs/latest-v6.x/api/errors.html#errors_error_code - if (typeof result.code === "string") { - return os.constants.errno[result.code]; - } - - // we tried - return process.exitCode; -} - -/** - * @param {string} command - * @param {string[]} args - * @param {import("execa").Options} opts - */ -function spawnProcess(command, args, opts) { - const child = execa(command, args, opts); - const drain = (exitCode, signal) => { - children.delete(child); - - // don't run repeatedly if this is the error event - if (signal === undefined) { - child.removeListener("exit", drain); - } - - // propagate exit code, if any - if (exitCode) { - process.exitCode = exitCode; - } - }; - - child.once("exit", drain); - child.once("error", drain); - - if (opts.pkg) { - child.pkg = opts.pkg; - } - - children.add(child); - - return child; -} - -/** - * @param {import("execa").ExecaChildProcess & { pkg?: import("@lerna/package").Package }} spawned - */ -function wrapError(spawned) { - if (spawned.pkg) { - return spawned.catch((err) => { - // ensure exit code is always a number - err.exitCode = getExitCode(err); - - // log non-lerna error cleanly - err.pkg = spawned.pkg; - - throw err; - }); - } - - return spawned; -} - -exports.exec = exec; -exports.execSync = execSync; -exports.spawn = spawn; -exports.spawnStreaming = spawnStreaming; -exports.getChildProcessCount = getChildProcessCount; -exports.getExitCode = getExitCode; - -/** - * @typedef {object} ExecOpts Provided to any execa-based call - * @property {string} cwd - * @property {number} [maxBuffer] - */ - - -/***/ }), - -/***/ 43792: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const log = __nccwpck_require__(64314); -const { describeRefSync } = __nccwpck_require__(73652); - -const { hasTags } = __nccwpck_require__(5485); -const { collectPackages } = __nccwpck_require__(4393); -const { getPackagesForOption } = __nccwpck_require__(23755); -const { makeDiffPredicate } = __nccwpck_require__(96950); - -module.exports.collectUpdates = collectUpdates; -module.exports.collectPackages = collectPackages; -module.exports.getPackagesForOption = getPackagesForOption; - -/** - * @typedef {object} UpdateCollectorOptions - * @property {string} [bump] The semver bump keyword (patch/minor/major) or explicit version used - * @property {boolean} [canary] Whether or not to use a "nightly" range (`ref^..ref`) for commits - * @property {string[]} [ignoreChanges] - * A list of globs that match files/directories whose changes - * should not be considered when identifying changed packages - * @property {boolean} [includeMergedTags] - * Whether or not to include the --first-parent flag when calling `git describe` - * (awkwardly, pass `true` to _omit_ the flag, the default is to include it) - * @property {boolean | string[]} [forcePublish] Which packages, if any, to always include - * Force all packages to be versioned with `true`, or pass a list of globs that match package names - * @property {string} [since] Ref to use when querying git, defaults to most recent annotated tag - * @property {boolean} [conventionalCommits] - * @property {boolean} [conventionalGraduate] - * @property {boolean} [excludeDependents] - */ - -/** - * Create a list of graph nodes representing packages changed since the previous release, tagged or otherwise. - * @param {import("@lerna/package").Package[]} filteredPackages - * @param {import("@lerna/package-graph").PackageGraph} packageGraph - * @param {import("@lerna/child-process").ExecOpts} execOpts - * @param {UpdateCollectorOptions} commandOptions - */ -function collectUpdates(filteredPackages, packageGraph, execOpts, commandOptions) { - const { forcePublish, conventionalCommits, conventionalGraduate, excludeDependents } = commandOptions; - - // If --conventional-commits and --conventional-graduate are both set, ignore --force-publish - const useConventionalGraduate = conventionalCommits && conventionalGraduate; - const forced = getPackagesForOption(useConventionalGraduate ? conventionalGraduate : forcePublish); - - const packages = - filteredPackages.length === packageGraph.size - ? packageGraph - : new Map(filteredPackages.map(({ name }) => [name, packageGraph.get(name)])); - - let committish = commandOptions.since; - - if (hasTags(execOpts)) { - // describe the last annotated tag in the current branch - const { sha, refCount, lastTagName } = describeRefSync(execOpts, commandOptions.includeMergedTags); - // TODO: warn about dirty tree? - - if (refCount === "0" && forced.size === 0 && !committish) { - // no commits since previous release - log.notice("", "Current HEAD is already released, skipping change detection."); - - return []; - } - - if (commandOptions.canary) { - // if it's a merge commit, it will return all the commits that were part of the merge - // ex: If `ab7533e` had 2 commits, ab7533e^..ab7533e would contain 2 commits + the merge commit - committish = `${sha}^..${sha}`; - } else if (!committish) { - // if no tags found, this will be undefined and we'll use the initial commit - committish = lastTagName; - } - } - - if (forced.size) { - // "warn" might seem a bit loud, but it is appropriate for logging anything _forced_ - log.warn( - useConventionalGraduate ? "conventional-graduate" : "force-publish", - forced.has("*") ? "all packages" : Array.from(forced.values()).join("\n") - ); - } - - if (useConventionalGraduate) { - // --conventional-commits --conventional-graduate - if (forced.has("*")) { - log.info("", "Graduating all prereleased packages"); - } else { - log.info("", "Graduating prereleased packages"); - } - } else if (!committish || forced.has("*")) { - // --force-publish or no tag - log.info("", "Assuming all packages changed"); - - return collectPackages(packages, { - onInclude: (name) => log.verbose("updated", name), - excludeDependents, - }); - } - - log.info("", `Looking for changed packages since ${committish}`); - - const hasDiff = makeDiffPredicate(committish, execOpts, commandOptions.ignoreChanges); - const needsBump = - !commandOptions.bump || commandOptions.bump.startsWith("pre") - ? () => false - : /* skip packages that have not been previously prereleased */ - (node) => node.prereleaseId; - const isForced = (node, name) => - (forced.has("*") || forced.has(name)) && (useConventionalGraduate ? node.prereleaseId : true); - - return collectPackages(packages, { - isCandidate: (node, name) => isForced(node, name) || needsBump(node) || hasDiff(node), - onInclude: (name) => log.verbose("updated", name), - excludeDependents, - }); -} - - -/***/ }), - -/***/ 10441: -/***/ ((module) => { - -"use strict"; - - -module.exports.collectDependents = collectDependents; - -/** - * @callback LocalDependentVisitor - * @param {import("@lerna/package-graph").PackageGraphNode} dependentNode - * @param {string} dependentName - * @param {Map} siblingDependents - */ - -/** - * Build a set of nodes that are dependents of the input set. - * @param {Set} nodes - */ -function collectDependents(nodes) { - /** @type {typeof nodes} */ - const collected = new Set(); - - nodes.forEach((currentNode) => { - if (currentNode.localDependents.size === 0) { - // no point diving into a non-existent tree - return; - } - - // breadth-first search - const queue = [currentNode]; - const seen = new Set(); - - /** @type {LocalDependentVisitor} */ - const visit = (dependentNode, dependentName, siblingDependents) => { - if (seen.has(dependentNode)) { - return; - } - - seen.add(dependentNode); - - if (dependentNode === currentNode || siblingDependents.has(currentNode.name)) { - // a direct or transitive cycle, skip it - return; - } - - collected.add(dependentNode); - queue.push(dependentNode); - }; - - while (queue.length) { - const node = queue.shift(); - - node.localDependents.forEach(visit); - } - }); - - return collected; -} - - -/***/ }), - -/***/ 4393: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const { collectDependents } = __nccwpck_require__(10441); - -module.exports.collectPackages = collectPackages; - -/** - * @typedef {object} PackageCollectorOptions - * @property {(node: import("@lerna/package-graph").PackageGraphNode, name: string) => boolean} [isCandidate] By default, all nodes passed in are candidates - * @property {(name: string) => void} [onInclude] - * @property {boolean} [excludeDependents] - */ - -/** - * Build a list of graph nodes, possibly including dependents, using predicate if available. - * @param {Map} packages - * @param {PackageCollectorOptions} options - */ -function collectPackages(packages, { isCandidate = () => true, onInclude, excludeDependents } = {}) { - /** @type {Set} */ - const candidates = new Set(); - - packages.forEach((node, name) => { - if (isCandidate(node, name)) { - candidates.add(node); - } - }); - - if (!excludeDependents) { - collectDependents(candidates).forEach((node) => candidates.add(node)); - } - - // The result should always be in the same order as the input - /** @type {import("@lerna/package-graph").PackageGraphNode[]} */ - const updates = []; - - packages.forEach((node, name) => { - if (candidates.has(node)) { - if (onInclude) { - onInclude(name); - } - updates.push(node); - } - }); - - return updates; -} - - -/***/ }), - -/***/ 23755: -/***/ ((module) => { - -"use strict"; - - -module.exports.getPackagesForOption = getPackagesForOption; - -/** - * @param {boolean|string|string[]} option - * @returns {Set} A set of package names (or wildcard) derived from option value. - */ -function getPackagesForOption(option) { - // new Set(null) is equivalent to new Set([]) - // i.e., an empty Set - let inputs = null; - - if (option === true) { - // option passed without specific packages, eg. --force-publish - inputs = ["*"]; - } else if (typeof option === "string") { - // option passed with one or more comma separated package names, eg.: - // --force-publish=* - // --force-publish=foo - // --force-publish=foo,bar - inputs = option.split(","); - } else if (Array.isArray(option)) { - // option passed multiple times with individual package names - // --force-publish foo --force-publish baz - inputs = [...option]; - } - - return new Set(inputs); -} - - -/***/ }), - -/***/ 5485: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const childProcess = __nccwpck_require__(85434); -const log = __nccwpck_require__(64314); - -module.exports.hasTags = hasTags; - -/** - * Determine if any git tags are reachable. - * @param {import("@lerna/child-process").ExecOpts} opts - */ -function hasTags(opts) { - log.silly("hasTags"); - let result = false; - - try { - result = !!childProcess.execSync("git", ["tag"], opts); - } catch (err) { - log.warn("ENOTAGS", "No git tags were reachable from this branch!"); - log.verbose("hasTags error", err); - } - - log.verbose("hasTags", result); - - return result; -} - - -/***/ }), - -/***/ 96950: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const childProcess = __nccwpck_require__(85434); -const log = __nccwpck_require__(64314); -const minimatch = __nccwpck_require__(83973); -const path = __nccwpck_require__(85622); -const slash = __nccwpck_require__(97543); - -module.exports.makeDiffPredicate = makeDiffPredicate; - -/** - * @param {string} committish - * @param {import("@lerna/child-process").ExecOpts} execOpts - * @param {string[]} ignorePatterns - */ -function makeDiffPredicate(committish, execOpts, ignorePatterns = []) { - const ignoreFilters = new Set( - ignorePatterns.map((p) => - minimatch.filter(`!${p}`, { - matchBase: true, - // dotfiles inside ignored directories should also match - dot: true, - }) - ) - ); - - if (ignoreFilters.size) { - log.info("ignoring diff in paths matching", ignorePatterns); - } - - return function hasDiffSinceThatIsntIgnored( - /** @type {import("@lerna/package-graph").PackageGraphNode} */ node - ) { - const diff = diffSinceIn(committish, node.location, execOpts); - - if (diff === "") { - log.silly("", "no diff found in %s", node.name); - return false; - } - - log.silly("found diff in", diff); - let changedFiles = diff.split("\n"); - - if (ignoreFilters.size) { - for (const ignored of ignoreFilters) { - changedFiles = changedFiles.filter(ignored); - } - } - - if (changedFiles.length) { - log.verbose("filtered diff", changedFiles); - } else { - log.verbose("", "no diff found in %s (after filtering)", node.name); - } - - return changedFiles.length > 0; - }; -} - -/** - * @param {string} committish - * @param {string} location - * @param {import("@lerna/child-process").ExecOpts} opts - */ -function diffSinceIn(committish, location, opts) { - const args = ["diff", "--name-only", committish]; - const formattedLocation = slash(path.relative(opts.cwd, location)); - - if (formattedLocation) { - // avoid same-directory path.relative() === "" - args.push("--", formattedLocation); - } - - log.silly("checking diff", formattedLocation); - return childProcess.execSync("git", args, opts); -} - - -/***/ }), - -/***/ 73652: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const log = __nccwpck_require__(64314); -const childProcess = __nccwpck_require__(85434); - -module.exports.describeRef = describeRef; -module.exports.describeRefSync = describeRefSync; - -/** - * @typedef {object} DescribeRefOptions - * @property {string} [cwd] Defaults to `process.cwd()` - * @property {string} [match] Glob passed to `--match` flag - */ - -/** - * @typedef {object} DescribeRefFallbackResult When annotated release tags are missing - * @property {boolean} isDirty - * @property {string} refCount - * @property {string} sha - */ - -/** - * @typedef {object} DescribeRefDetailedResult When annotated release tags are present - * @property {string} lastTagName - * @property {string} lastVersion - * @property {boolean} isDirty - * @property {string} refCount - * @property {string} sha - */ - -/** - * Build `git describe` args. - * @param {DescribeRefOptions} options - * @param {boolean} [includeMergedTags] - */ -function getArgs(options, includeMergedTags) { - let args = [ - "describe", - // fallback to short sha if no tags located - "--always", - // always return full result, helps identify existing release - "--long", - // annotate if uncommitted changes present - "--dirty", - // prefer tags originating on upstream branch - "--first-parent", - ]; - - if (options.match) { - args.push("--match", options.match); - } - - if (includeMergedTags) { - // we want to consider all tags, also from merged branches - args = args.filter((arg) => arg !== "--first-parent"); - } - - return args; -} - -/** - * @param {DescribeRefOptions} [options] - * @param {boolean} [includeMergedTags] - * @returns {Promise} - */ -function describeRef(options = {}, includeMergedTags) { - const promise = childProcess.exec("git", getArgs(options, includeMergedTags), options); - - return promise.then(({ stdout }) => { - const result = parse(stdout, options.cwd); - - log.verbose("git-describe", "%j => %j", options && options.match, stdout); - log.silly("git-describe", "parsed => %j", result); - - return result; - }); -} - -/** - * @param {DescribeRefOptions} [options] - * @param {boolean} [includeMergedTags] - */ -function describeRefSync(options = {}, includeMergedTags) { - const stdout = childProcess.execSync("git", getArgs(options, includeMergedTags), options); - const result = parse(stdout, options.cwd); - - // only called by collect-updates with no matcher - log.silly("git-describe.sync", "%j => %j", stdout, result); - - return result; -} - -/** - * Parse git output and return relevant metadata. - * @param {string} stdout Result of `git describe` - * @param {string} [cwd] Defaults to `process.cwd()` - * @returns {DescribeRefFallbackResult|DescribeRefDetailedResult} - */ -function parse(stdout, cwd) { - const minimalShaRegex = /^([0-9a-f]{7,40})(-dirty)?$/; - // when git describe fails to locate tags, it returns only the minimal sha - if (minimalShaRegex.test(stdout)) { - // repo might still be dirty - const [, sha, isDirty] = minimalShaRegex.exec(stdout); - - // count number of commits since beginning of time - const refCount = childProcess.execSync("git", ["rev-list", "--count", sha], { cwd }); - - return { refCount, sha, isDirty: Boolean(isDirty) }; - } - - const [, lastTagName, lastVersion, refCount, sha, isDirty] = - /^((?:.*@)?(.*))-(\d+)-g([0-9a-f]+)(-dirty)?$/.exec(stdout) || []; - - return { lastTagName, lastVersion, refCount, sha, isDirty: Boolean(isDirty) }; -} - - /***/ }), /***/ 69522: @@ -7185,7 +7352,7 @@ function reportCycles(paths, rejectCycles) { const npa = __nccwpck_require__(32695); const path = __nccwpck_require__(85622); -const loadJsonFile = __nccwpck_require__(93656); +const loadJsonFile = __nccwpck_require__(75978); const writePkg = __nccwpck_require__(16440); // symbol used to "hide" internal state @@ -7481,56 +7648,6 @@ class Package { module.exports.Package = Package; -/***/ }), - -/***/ 93656: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - -const path = __nccwpck_require__(85622); -const {promisify} = __nccwpck_require__(31669); -const fs = __nccwpck_require__(77758); -const stripBom = __nccwpck_require__(77274); -const parseJson = __nccwpck_require__(86615); - -const parse = (data, filePath, options = {}) => { - data = stripBom(data); - - if (typeof options.beforeParse === 'function') { - data = options.beforeParse(data); - } - - return parseJson(data, options.reviver, path.relative(process.cwd(), filePath)); -}; - -module.exports = async (filePath, options) => parse(await promisify(fs.readFile)(filePath, 'utf8'), filePath, options); -module.exports.sync = (filePath, options) => parse(fs.readFileSync(filePath, 'utf8'), filePath, options); - - -/***/ }), - -/***/ 77274: -/***/ ((module) => { - -"use strict"; - - -module.exports = string => { - if (typeof string !== 'string') { - throw new TypeError(`Expected a string, got ${typeof string}`); - } - - // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string - // conversion translates it to FEFF (UTF-16 BOM) - if (string.charCodeAt(0) === 0xFEFF) { - return string.slice(1); - } - - return string; -}; - - /***/ }), /***/ 24329: @@ -7552,169 +7669,6 @@ function prereleaseIdFromVersion(version) { } -/***/ }), - -/***/ 13129: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const { PackageGraph } = __nccwpck_require__(69522); - -/** - * @typedef {object} QueryGraphConfig - * @property {'allDependencies'|'dependencies'} [graphType] "dependencies" excludes devDependencies from graph - * @property {boolean} [rejectCycles] Whether or not to reject dependency cycles - */ - -/** - * A mutable PackageGraph used to query for next available packages. - */ -class QueryGraph { - /** - * Sort a list of Packages topologically. - * - * @param {import("@lerna/package").Package[]} packages An array of Packages to build the list out of - * @param {QueryGraphConfig} [options] - * - * @returns {import("@lerna/package").Package[]} A list of Package instances in topological order - */ - static toposort(packages, options) { - const graph = new QueryGraph(packages, options); - const result = []; - - let batch = graph.getAvailablePackages(); - - while (batch.length) { - for (const node of batch) { - // no need to take() in synchronous loop - result.push(node.pkg); - graph.markAsDone(node); - } - - batch = graph.getAvailablePackages(); - } - - return result; - } - - /** - * @param {import("@lerna/package").Package[]} packages An array of Packages to build the graph out of - * @param {QueryGraphConfig} [options] - */ - constructor(packages, { graphType = "allDependencies", rejectCycles } = {}) { - // Create dependency graph - this.graph = new PackageGraph(packages, graphType); - - // Evaluate cycles - this.cycles = this.graph.collapseCycles(rejectCycles); - } - - _getNextLeaf() { - return Array.from(this.graph.values()).filter((node) => node.localDependencies.size === 0); - } - - _getNextCycle() { - const cycle = Array.from(this.cycles).find((cycleNode) => cycleNode.localDependencies.size === 0); - - if (!cycle) { - return []; - } - - this.cycles.delete(cycle); - - return cycle.flatten(); - } - - getAvailablePackages() { - // Get the next leaf nodes - const availablePackages = this._getNextLeaf(); - - if (availablePackages.length > 0) { - return availablePackages; - } - - return this._getNextCycle(); - } - - /** - * @param {string} name - */ - markAsTaken(name) { - this.graph.delete(name); - } - - /** - * @param {import("@lerna/package-graph").PackageGraphNode} candidateNode - */ - markAsDone(candidateNode) { - this.graph.remove(candidateNode); - - for (const cycle of this.cycles) { - cycle.unlink(candidateNode); - } - } -} - -module.exports.QueryGraph = QueryGraph; -module.exports.toposort = QueryGraph.toposort; - - -/***/ }), - -/***/ 2130: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const PQueue = __nccwpck_require__(28983)/* .default */ .Z; -const { QueryGraph } = __nccwpck_require__(13129); - -module.exports.runTopologically = runTopologically; - -/** - * @typedef {import("@lerna/query-graph").QueryGraphConfig & { concurrency: number }} TopologicalConfig - */ - -/** - * Run callback in maximally-saturated topological order. - * - * @template T - * @param {import("@lerna/package").Package[]} packages List of `Package` instances - * @param {(pkg: import("@lerna/package").Package) => Promise} runner Callback to map each `Package` with - * @param {TopologicalConfig} [options] - * @returns {Promise} when all executions complete - */ -function runTopologically(packages, runner, { concurrency, graphType, rejectCycles } = {}) { - const queue = new PQueue({ concurrency }); - const graph = new QueryGraph(packages, { graphType, rejectCycles }); - - return new Promise((resolve, reject) => { - const returnValues = []; - - const queueNextAvailablePackages = () => - graph.getAvailablePackages().forEach(({ pkg, name }) => { - graph.markAsTaken(name); - - queue - .add(() => - runner(pkg) - .then((value) => returnValues.push(value)) - .then(() => graph.markAsDone(pkg)) - .then(() => queueNextAvailablePackages()) - ) - .catch(reject); - }); - - queueNextAvailablePackages(); - - return queue.onIdle().then(() => resolve(returnValues)); - }); -} - - /***/ }), /***/ 53961: @@ -10097,6 +10051,18 @@ exports.Octokit = Octokit; //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 65063: +/***/ ((module) => { + +"use strict"; + +module.exports = function () { + return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; +}; + + /***/ }), /***/ 52068: @@ -10690,73 +10656,6 @@ function retry(fn, opts) { module.exports = retry; -/***/ }), - -/***/ 9417: -/***/ ((module) => { - -"use strict"; - -module.exports = balanced; -function balanced(a, b, str) { - if (a instanceof RegExp) a = maybeMatch(a, str); - if (b instanceof RegExp) b = maybeMatch(b, str); - - var r = range(a, b, str); - - return r && { - start: r[0], - end: r[1], - pre: str.slice(0, r[0]), - body: str.slice(r[0] + a.length, r[1]), - post: str.slice(r[1] + b.length) - }; -} - -function maybeMatch(reg, str) { - var m = str.match(reg); - return m ? m[0] : null; -} - -balanced.range = range; -function range(a, b, str) { - var begs, beg, left, right, result; - var ai = str.indexOf(a); - var bi = str.indexOf(b, ai + 1); - var i = ai; - - if (ai >= 0 && bi > 0) { - begs = []; - left = str.length; - - while (i >= 0 && !result) { - if (i == ai) { - begs.push(i); - ai = str.indexOf(a, i + 1); - } else if (begs.length == 1) { - result = [ begs.pop(), bi ]; - } else { - beg = begs.pop(); - if (beg < left) { - left = beg; - right = bi; - } - - bi = str.indexOf(b, i + 1); - } - - i = ai < bi && ai >= 0 ? ai : bi; - } - - if (begs.length) { - result = [ left, right ]; - } - } - - return result; -} - - /***/ }), /***/ 83682: @@ -10936,211 +10835,17 @@ function removeHook(state, name, method) { /***/ }), -/***/ 33717: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -var concatMap = __nccwpck_require__(86891); -var balanced = __nccwpck_require__(9417); - -module.exports = expandTop; - -var escSlash = '\0SLASH'+Math.random()+'\0'; -var escOpen = '\0OPEN'+Math.random()+'\0'; -var escClose = '\0CLOSE'+Math.random()+'\0'; -var escComma = '\0COMMA'+Math.random()+'\0'; -var escPeriod = '\0PERIOD'+Math.random()+'\0'; - -function numeric(str) { - return parseInt(str, 10) == str - ? parseInt(str, 10) - : str.charCodeAt(0); -} - -function escapeBraces(str) { - return str.split('\\\\').join(escSlash) - .split('\\{').join(escOpen) - .split('\\}').join(escClose) - .split('\\,').join(escComma) - .split('\\.').join(escPeriod); -} - -function unescapeBraces(str) { - return str.split(escSlash).join('\\') - .split(escOpen).join('{') - .split(escClose).join('}') - .split(escComma).join(',') - .split(escPeriod).join('.'); -} - - -// Basically just str.split(","), but handling cases -// where we have nested braced sections, which should be -// treated as individual members, like {a,{b,c},d} -function parseCommaParts(str) { - if (!str) - return ['']; - - var parts = []; - var m = balanced('{', '}', str); - - if (!m) - return str.split(','); - - var pre = m.pre; - var body = m.body; - var post = m.post; - var p = pre.split(','); - - p[p.length-1] += '{' + body + '}'; - var postParts = parseCommaParts(post); - if (post.length) { - p[p.length-1] += postParts.shift(); - p.push.apply(p, postParts); - } - - parts.push.apply(parts, p); - - return parts; -} - -function expandTop(str) { - if (!str) - return []; - - // I don't know why Bash 4.3 does this, but it does. - // Anything starting with {} will have the first two bytes preserved - // but *only* at the top level, so {},a}b will not expand to anything, - // but a{},b}c will be expanded to [a}c,abc]. - // One could argue that this is a bug in Bash, but since the goal of - // this module is to match Bash's rules, we escape a leading {} - if (str.substr(0, 2) === '{}') { - str = '\\{\\}' + str.substr(2); - } - - return expand(escapeBraces(str), true).map(unescapeBraces); -} - -function identity(e) { - return e; -} - -function embrace(str) { - return '{' + str + '}'; -} -function isPadded(el) { - return /^-?0\d/.test(el); -} - -function lte(i, y) { - return i <= y; -} -function gte(i, y) { - return i >= y; -} - -function expand(str, isTop) { - var expansions = []; - - var m = balanced('{', '}', str); - if (!m || /\$$/.test(m.pre)) return [str]; - - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(',') >= 0; - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*\}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } - - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length - ? expand(m.post, false) - : ['']; - return post.map(function(p) { - return m.pre + n[0] + p; - }); - } - } - } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. - - // no need to expand pre, since it is guaranteed to be free of brace-sets - var pre = m.pre; - var post = m.post.length - ? expand(m.post, false) - : ['']; - - var N; - - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; - } - var pad = n.some(isPadded); - - N = []; - - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; - } - } - } - N.push(c); - } - } else { - N = concatMap(n, function(el) { return expand(el, false) }); - } - - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); - } - } - - return expansions; -} - +/***/ 44159: +/***/ ((module) => { +module.exports = { + trueFunc: function trueFunc(){ + return true; + }, + falseFunc: function falseFunc(){ + return false; + } +}; /***/ }), @@ -14133,26 +13838,6 @@ function compareFunc(prop) { module.exports = compareFunc; -/***/ }), - -/***/ 86891: -/***/ ((module) => { - -module.exports = function (xs, fn) { - var res = []; - for (var i = 0; i < xs.length; i++) { - var x = fn(xs[i], i); - if (isArray(x)) res.push.apply(res, x); - else res.push(x); - } - return res; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - - /***/ }), /***/ 73645: @@ -16898,359 +16583,1747 @@ function objectToString(o) { /***/ }), -/***/ 72746: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 36863: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const cp = __nccwpck_require__(63129); -const parse = __nccwpck_require__(66855); -const enoent = __nccwpck_require__(44101); - -function spawn(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); - - // Spawn the child process - const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); - - // Hook into child process "exit" event to emit an error if the command - // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - enoent.hookChildProcess(spawned, parsed); - - return spawned; -} - -function spawnSync(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); - - // Spawn the child process - const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); - - // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); - - return result; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.attributeRules = void 0; +var boolbase_1 = __nccwpck_require__(44159); +/** + * All reserved characters in a regex, used for escaping. + * + * Taken from XRegExp, (c) 2007-2020 Steven Levithan under the MIT license + * https://github.com/slevithan/xregexp/blob/95eeebeb8fac8754d54eafe2b4743661ac1cf028/src/xregexp.js#L794 + */ +var reChars = /[-[\]{}()*+?.,\\^$|#\s]/g; +function escapeRegex(value) { + return value.replace(reChars, "\\$&"); } - -module.exports = spawn; -module.exports.spawn = spawn; -module.exports.sync = spawnSync; - -module.exports._parse = parse; -module.exports._enoent = enoent; +/** + * Attribute selectors + */ +exports.attributeRules = { + equals: function (next, data, _a) { + var adapter = _a.adapter; + var name = data.name; + var value = data.value; + if (data.ignoreCase) { + value = value.toLowerCase(); + return function (elem) { + var attr = adapter.getAttributeValue(elem, name); + return (attr != null && + attr.length === value.length && + attr.toLowerCase() === value && + next(elem)); + }; + } + return function (elem) { + return adapter.getAttributeValue(elem, name) === value && next(elem); + }; + }, + hyphen: function (next, data, _a) { + var adapter = _a.adapter; + var name = data.name; + var value = data.value; + var len = value.length; + if (data.ignoreCase) { + value = value.toLowerCase(); + return function hyphenIC(elem) { + var attr = adapter.getAttributeValue(elem, name); + return (attr != null && + (attr.length === len || attr.charAt(len) === "-") && + attr.substr(0, len).toLowerCase() === value && + next(elem)); + }; + } + return function hyphen(elem) { + var attr = adapter.getAttributeValue(elem, name); + return (attr != null && + (attr.length === len || attr.charAt(len) === "-") && + attr.substr(0, len) === value && + next(elem)); + }; + }, + element: function (next, _a, _b) { + var name = _a.name, value = _a.value, ignoreCase = _a.ignoreCase; + var adapter = _b.adapter; + if (/\s/.test(value)) { + return boolbase_1.falseFunc; + } + var regex = new RegExp("(?:^|\\s)" + escapeRegex(value) + "(?:$|\\s)", ignoreCase ? "i" : ""); + return function element(elem) { + var attr = adapter.getAttributeValue(elem, name); + return (attr != null && + attr.length >= value.length && + regex.test(attr) && + next(elem)); + }; + }, + exists: function (next, _a, _b) { + var name = _a.name; + var adapter = _b.adapter; + return function (elem) { return adapter.hasAttrib(elem, name) && next(elem); }; + }, + start: function (next, data, _a) { + var adapter = _a.adapter; + var name = data.name; + var value = data.value; + var len = value.length; + if (len === 0) { + return boolbase_1.falseFunc; + } + if (data.ignoreCase) { + value = value.toLowerCase(); + return function (elem) { + var attr = adapter.getAttributeValue(elem, name); + return (attr != null && + attr.length >= len && + attr.substr(0, len).toLowerCase() === value && + next(elem)); + }; + } + return function (elem) { + var _a; + return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.startsWith(value)) && + next(elem); + }; + }, + end: function (next, data, _a) { + var adapter = _a.adapter; + var name = data.name; + var value = data.value; + var len = -value.length; + if (len === 0) { + return boolbase_1.falseFunc; + } + if (data.ignoreCase) { + value = value.toLowerCase(); + return function (elem) { + var _a; + return ((_a = adapter + .getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.substr(len).toLowerCase()) === value && next(elem); + }; + } + return function (elem) { + var _a; + return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.endsWith(value)) && + next(elem); + }; + }, + any: function (next, data, _a) { + var adapter = _a.adapter; + var name = data.name, value = data.value; + if (value === "") { + return boolbase_1.falseFunc; + } + if (data.ignoreCase) { + var regex_1 = new RegExp(escapeRegex(value), "i"); + return function anyIC(elem) { + var attr = adapter.getAttributeValue(elem, name); + return (attr != null && + attr.length >= value.length && + regex_1.test(attr) && + next(elem)); + }; + } + return function (elem) { + var _a; + return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.includes(value)) && + next(elem); + }; + }, + not: function (next, data, _a) { + var adapter = _a.adapter; + var name = data.name; + var value = data.value; + if (value === "") { + return function (elem) { + return !!adapter.getAttributeValue(elem, name) && next(elem); + }; + } + else if (data.ignoreCase) { + value = value.toLowerCase(); + return function (elem) { + var attr = adapter.getAttributeValue(elem, name); + return ((attr == null || + attr.length !== value.length || + attr.toLowerCase() !== value) && + next(elem)); + }; + } + return function (elem) { + return adapter.getAttributeValue(elem, name) !== value && next(elem); + }; + }, +}; /***/ }), -/***/ 44101: -/***/ ((module) => { +/***/ 35030: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -const isWin = process.platform === 'win32'; - -function notFoundError(original, syscall) { - return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { - code: 'ENOENT', - errno: 'ENOENT', - syscall: `${syscall} ${original.command}`, - path: original.command, - spawnargs: original.args, - }); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.compileToken = exports.compileUnsafe = exports.compile = void 0; +var css_what_1 = __nccwpck_require__(19218); +var boolbase_1 = __nccwpck_require__(44159); +var sort_1 = __importDefault(__nccwpck_require__(57320)); +var procedure_1 = __nccwpck_require__(47396); +var general_1 = __nccwpck_require__(45374); +var subselects_1 = __nccwpck_require__(15813); +/** + * Compiles a selector to an executable function. + * + * @param selector Selector to compile. + * @param options Compilation options. + * @param context Optional context for the selector. + */ +function compile(selector, options, context) { + var next = compileUnsafe(selector, options, context); + return subselects_1.ensureIsTag(next, options.adapter); } - -function hookChildProcess(cp, parsed) { - if (!isWin) { - return; +exports.compile = compile; +function compileUnsafe(selector, options, context) { + var token = typeof selector === "string" ? css_what_1.parse(selector, options) : selector; + return compileToken(token, options, context); +} +exports.compileUnsafe = compileUnsafe; +function includesScopePseudo(t) { + return (t.type === "pseudo" && + (t.name === "scope" || + (Array.isArray(t.data) && + t.data.some(function (data) { return data.some(includesScopePseudo); })))); +} +var DESCENDANT_TOKEN = { type: "descendant" }; +var FLEXIBLE_DESCENDANT_TOKEN = { + type: "_flexibleDescendant", +}; +var SCOPE_TOKEN = { type: "pseudo", name: "scope", data: null }; +/* + * CSS 4 Spec (Draft): 3.3.1. Absolutizing a Scope-relative Selector + * http://www.w3.org/TR/selectors4/#absolutizing + */ +function absolutize(token, _a, context) { + var adapter = _a.adapter; + // TODO Use better check if the context is a document + var hasContext = !!(context === null || context === void 0 ? void 0 : context.every(function (e) { + var parent = adapter.isTag(e) && adapter.getParent(e); + return e === subselects_1.PLACEHOLDER_ELEMENT || (parent && adapter.isTag(parent)); + })); + for (var _i = 0, token_1 = token; _i < token_1.length; _i++) { + var t = token_1[_i]; + if (t.length > 0 && procedure_1.isTraversal(t[0]) && t[0].type !== "descendant") { + // Don't continue in else branch + } + else if (hasContext && !t.some(includesScopePseudo)) { + t.unshift(DESCENDANT_TOKEN); + } + else { + continue; + } + t.unshift(SCOPE_TOKEN); } - - const originalEmit = cp.emit; - - cp.emit = function (name, arg1) { - // If emitting "exit" event and exit code is 1, we need to check if - // the command exists and emit an "error" instead - // See https://github.com/IndigoUnited/node-cross-spawn/issues/16 - if (name === 'exit') { - const err = verifyENOENT(arg1, parsed, 'spawn'); - - if (err) { - return originalEmit.call(cp, 'error', err); +} +function compileToken(token, options, context) { + var _a; + token = token.filter(function (t) { return t.length > 0; }); + token.forEach(sort_1.default); + context = (_a = options.context) !== null && _a !== void 0 ? _a : context; + var isArrayContext = Array.isArray(context); + var finalContext = context && (Array.isArray(context) ? context : [context]); + absolutize(token, options, finalContext); + var shouldTestNextSiblings = false; + var query = token + .map(function (rules) { + if (rules.length >= 2) { + var first = rules[0], second = rules[1]; + if (first.type !== "pseudo" || first.name !== "scope") { + // Ignore + } + else if (isArrayContext && second.type === "descendant") { + rules[1] = FLEXIBLE_DESCENDANT_TOKEN; + } + else if (second.type === "adjacent" || + second.type === "sibling") { + shouldTestNextSiblings = true; } } - - return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params - }; + return compileRules(rules, options, finalContext); + }) + .reduce(reduceRules, boolbase_1.falseFunc); + query.shouldTestNextSiblings = shouldTestNextSiblings; + return query; } - -function verifyENOENT(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawn'); - } - - return null; +exports.compileToken = compileToken; +function compileRules(rules, options, context) { + var _a; + return rules.reduce(function (previous, rule) { + return previous === boolbase_1.falseFunc + ? boolbase_1.falseFunc + : general_1.compileGeneralSelector(previous, rule, options, context, compileToken); + }, (_a = options.rootFunc) !== null && _a !== void 0 ? _a : boolbase_1.trueFunc); } - -function verifyENOENTSync(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawnSync'); +function reduceRules(a, b) { + if (b === boolbase_1.falseFunc || a === boolbase_1.trueFunc) { + return a; } - - return null; + if (a === boolbase_1.falseFunc || b === boolbase_1.trueFunc) { + return b; + } + return function combine(elem) { + return a(elem) || b(elem); + }; } -module.exports = { - hookChildProcess, - verifyENOENT, - verifyENOENTSync, - notFoundError, -}; - /***/ }), -/***/ 66855: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 45374: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.compileGeneralSelector = void 0; +var attributes_1 = __nccwpck_require__(36863); +var pseudo_selectors_1 = __nccwpck_require__(89312); +/* + * All available rules + */ +function compileGeneralSelector(next, selector, options, context, compileToken) { + var adapter = options.adapter, equals = options.equals; + switch (selector.type) { + case "pseudo-element": + throw new Error("Pseudo-elements are not supported by css-select"); + case "attribute": + return attributes_1.attributeRules[selector.action](next, selector, options); + case "pseudo": + return pseudo_selectors_1.compilePseudoSelector(next, selector, options, context, compileToken); + // Tags + case "tag": + return function tag(elem) { + return adapter.getName(elem) === selector.name && next(elem); + }; + // Traversal + case "descendant": + if (options.cacheResults === false || + typeof WeakSet === "undefined") { + return function descendant(elem) { + var current = elem; + while ((current = adapter.getParent(current))) { + if (adapter.isTag(current) && next(current)) { + return true; + } + } + return false; + }; + } + // @ts-expect-error `ElementNode` is not extending object + // eslint-disable-next-line no-case-declarations + var isFalseCache_1 = new WeakSet(); + return function cachedDescendant(elem) { + var current = elem; + while ((current = adapter.getParent(current))) { + if (!isFalseCache_1.has(current)) { + if (adapter.isTag(current) && next(current)) { + return true; + } + isFalseCache_1.add(current); + } + } + return false; + }; + case "_flexibleDescendant": + // Include element itself, only used while querying an array + return function flexibleDescendant(elem) { + var current = elem; + do { + if (adapter.isTag(current) && next(current)) + return true; + } while ((current = adapter.getParent(current))); + return false; + }; + case "parent": + return function parent(elem) { + return adapter + .getChildren(elem) + .some(function (elem) { return adapter.isTag(elem) && next(elem); }); + }; + case "child": + return function child(elem) { + var parent = adapter.getParent(elem); + return parent != null && adapter.isTag(parent) && next(parent); + }; + case "sibling": + return function sibling(elem) { + var siblings = adapter.getSiblings(elem); + for (var i = 0; i < siblings.length; i++) { + var currentSibling = siblings[i]; + if (equals(elem, currentSibling)) + break; + if (adapter.isTag(currentSibling) && next(currentSibling)) { + return true; + } + } + return false; + }; + case "adjacent": + return function adjacent(elem) { + var siblings = adapter.getSiblings(elem); + var lastElement; + for (var i = 0; i < siblings.length; i++) { + var currentSibling = siblings[i]; + if (equals(elem, currentSibling)) + break; + if (adapter.isTag(currentSibling)) { + lastElement = currentSibling; + } + } + return !!lastElement && next(lastElement); + }; + case "universal": + return next; + } +} +exports.compileGeneralSelector = compileGeneralSelector; -const path = __nccwpck_require__(85622); -const resolveCommand = __nccwpck_require__(87274); -const escape = __nccwpck_require__(34274); -const readShebang = __nccwpck_require__(41252); - -const isWin = process.platform === 'win32'; -const isExecutableRegExp = /\.(?:com|exe)$/i; -const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; -function detectShebang(parsed) { - parsed.file = resolveCommand(parsed); +/***/ }), - const shebang = parsed.file && readShebang(parsed.file); +/***/ 4508: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - if (shebang) { - parsed.args.unshift(parsed.file); - parsed.command = shebang; +"use strict"; - return resolveCommand(parsed); +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.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.aliases = exports.pseudos = exports.filters = exports.is = exports.selectOne = exports.selectAll = exports.prepareContext = exports._compileToken = exports._compileUnsafe = exports.compile = void 0; +var DomUtils = __importStar(__nccwpck_require__(11754)); +var boolbase_1 = __nccwpck_require__(44159); +var compile_1 = __nccwpck_require__(35030); +var subselects_1 = __nccwpck_require__(15813); +var defaultEquals = function (a, b) { return a === b; }; +var defaultOptions = { + adapter: DomUtils, + equals: defaultEquals, +}; +function convertOptionFormats(options) { + var _a, _b, _c, _d; + /* + * We force one format of options to the other one. + */ + // @ts-expect-error Default options may have incompatible `Node` / `ElementNode`. + var opts = options !== null && options !== void 0 ? options : defaultOptions; + // @ts-expect-error Same as above. + (_a = opts.adapter) !== null && _a !== void 0 ? _a : (opts.adapter = DomUtils); + // @ts-expect-error `equals` does not exist on `Options` + (_b = opts.equals) !== null && _b !== void 0 ? _b : (opts.equals = (_d = (_c = opts.adapter) === null || _c === void 0 ? void 0 : _c.equals) !== null && _d !== void 0 ? _d : defaultEquals); + return opts; +} +function wrapCompile(func) { + return function addAdapter(selector, options, context) { + var opts = convertOptionFormats(options); + return func(selector, opts, context); + }; +} +/** + * Compiles the query, returns a function. + */ +exports.compile = wrapCompile(compile_1.compile); +exports._compileUnsafe = wrapCompile(compile_1.compileUnsafe); +exports._compileToken = wrapCompile(compile_1.compileToken); +function getSelectorFunc(searchFunc) { + return function select(query, elements, options) { + var opts = convertOptionFormats(options); + if (typeof query !== "function") { + query = compile_1.compileUnsafe(query, opts, elements); + } + var filteredElements = prepareContext(elements, opts.adapter, query.shouldTestNextSiblings); + return searchFunc(query, filteredElements, opts); + }; +} +function prepareContext(elems, adapter, shouldTestNextSiblings) { + if (shouldTestNextSiblings === void 0) { shouldTestNextSiblings = false; } + /* + * Add siblings if the query requires them. + * See https://github.com/fb55/css-select/pull/43#issuecomment-225414692 + */ + if (shouldTestNextSiblings) { + elems = appendNextSiblings(elems, adapter); } - - return parsed.file; + return Array.isArray(elems) + ? adapter.removeSubsets(elems) + : adapter.getChildren(elems); } - -function parseNonShell(parsed) { - if (!isWin) { - return parsed; +exports.prepareContext = prepareContext; +function appendNextSiblings(elem, adapter) { + // Order matters because jQuery seems to check the children before the siblings + var elems = Array.isArray(elem) ? elem.slice(0) : [elem]; + for (var i = 0; i < elems.length; i++) { + var nextSiblings = subselects_1.getNextSiblings(elems[i], adapter); + elems.push.apply(elems, nextSiblings); } + return elems; +} +/** + * @template Node The generic Node type for the DOM adapter being used. + * @template ElementNode The Node type for elements for the DOM adapter being used. + * @param elems Elements to query. If it is an element, its children will be queried.. + * @param query can be either a CSS selector string or a compiled query function. + * @param [options] options for querying the document. + * @see compile for supported selector queries. + * @returns All matching elements. + * + */ +exports.selectAll = getSelectorFunc(function (query, elems, options) { + return query === boolbase_1.falseFunc || !elems || elems.length === 0 + ? [] + : options.adapter.findAll(query, elems); +}); +/** + * @template Node The generic Node type for the DOM adapter being used. + * @template ElementNode The Node type for elements for the DOM adapter being used. + * @param elems Elements to query. If it is an element, its children will be queried.. + * @param query can be either a CSS selector string or a compiled query function. + * @param [options] options for querying the document. + * @see compile for supported selector queries. + * @returns the first match, or null if there was no match. + */ +exports.selectOne = getSelectorFunc(function (query, elems, options) { + return query === boolbase_1.falseFunc || !elems || elems.length === 0 + ? null + : options.adapter.findOne(query, elems); +}); +/** + * Tests whether or not an element is matched by query. + * + * @template Node The generic Node type for the DOM adapter being used. + * @template ElementNode The Node type for elements for the DOM adapter being used. + * @param elem The element to test if it matches the query. + * @param query can be either a CSS selector string or a compiled query function. + * @param [options] options for querying the document. + * @see compile for supported selector queries. + * @returns + */ +function is(elem, query, options) { + var opts = convertOptionFormats(options); + return (typeof query === "function" ? query : compile_1.compile(query, opts))(elem); +} +exports.is = is; +/** + * Alias for selectAll(query, elems, options). + * @see [compile] for supported selector queries. + */ +exports.default = exports.selectAll; +// Export filters, pseudos and aliases to allow users to supply their own. +var pseudo_selectors_1 = __nccwpck_require__(89312); +Object.defineProperty(exports, "filters", ({ enumerable: true, get: function () { return pseudo_selectors_1.filters; } })); +Object.defineProperty(exports, "pseudos", ({ enumerable: true, get: function () { return pseudo_selectors_1.pseudos; } })); +Object.defineProperty(exports, "aliases", ({ enumerable: true, get: function () { return pseudo_selectors_1.aliases; } })); - // Detect & add support for shebangs - const commandFile = detectShebang(parsed); - - // We don't need a shell if the command filename is an executable - const needsShell = !isExecutableRegExp.test(commandFile); - - // If a shell is required, use cmd.exe and take care of escaping everything correctly - // Note that `forceShell` is an hidden option used only in tests - if (parsed.options.forceShell || needsShell) { - // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/` - // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument - // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called, - // we need to double escape them - const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); - - // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar) - // This is necessary otherwise it will always fail with ENOENT in those cases - parsed.command = path.normalize(parsed.command); - // Escape command & arguments - parsed.command = escape.command(parsed.command); - parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); +/***/ }), - const shellCommand = [parsed.command].concat(parsed.args).join(' '); +/***/ 47396: +/***/ ((__unused_webpack_module, exports) => { - parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; - parsed.command = process.env.comspec || 'cmd.exe'; - parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped - } +"use strict"; - return parsed; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isTraversal = exports.procedure = void 0; +exports.procedure = { + universal: 50, + tag: 30, + attribute: 1, + pseudo: 0, + "pseudo-element": 0, + descendant: -1, + child: -1, + parent: -1, + sibling: -1, + adjacent: -1, + _flexibleDescendant: -1, +}; +function isTraversal(t) { + return exports.procedure[t.type] < 0; } +exports.isTraversal = isTraversal; -function parse(command, args, options) { - // Normalize arguments, similar to nodejs - if (args && !Array.isArray(args)) { - options = args; - args = null; - } - args = args ? args.slice(0) : []; // Clone array to avoid changing the original - options = Object.assign({}, options); // Clone object to avoid changing the original +/***/ }), - // Build our parsed object - const parsed = { - command, - args, - options, - file: undefined, - original: { - command, - args, - }, - }; +/***/ 24176: +/***/ ((__unused_webpack_module, exports) => { - // Delegate further parsing to shell or non-shell - return options.shell ? parsed : parseNonShell(parsed); -} +"use strict"; -module.exports = parse; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.aliases = void 0; +/** + * Aliases are pseudos that are expressed as selectors. + */ +exports.aliases = { + // Links + "any-link": ":is(a, area, link)[href]", + link: ":any-link:not(:visited)", + // Forms + // https://html.spec.whatwg.org/multipage/scripting.html#disabled-elements + disabled: ":is(\n :is(button, input, select, textarea, optgroup, option)[disabled],\n optgroup[disabled] > option,\n fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)\n )", + enabled: ":not(:disabled)", + checked: ":is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)", + required: ":is(input, select, textarea)[required]", + optional: ":is(input, select, textarea):not([required])", + // JQuery extensions + // https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-selectedness + selected: "option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)", + checkbox: "[type=checkbox]", + file: "[type=file]", + password: "[type=password]", + radio: "[type=radio]", + reset: "[type=reset]", + image: "[type=image]", + submit: "[type=submit]", + parent: ":not(:empty)", + header: ":is(h1, h2, h3, h4, h5, h6)", + button: ":is(button, input[type=button])", + input: ":is(input, textarea, select, button)", + text: "input:is(:not([type!='']), [type=text])", +}; /***/ }), -/***/ 34274: -/***/ ((module) => { +/***/ 51686: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -// See http://www.robvanderwoude.com/escapechars.php -const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; - -function escapeCommand(arg) { - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); - - return arg; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.filters = void 0; +var nth_check_1 = __importDefault(__nccwpck_require__(51260)); +var boolbase_1 = __nccwpck_require__(44159); +function getChildFunc(next, adapter) { + return function (elem) { + var parent = adapter.getParent(elem); + return parent != null && adapter.isTag(parent) && next(elem); + }; +} +exports.filters = { + contains: function (next, text, _a) { + var adapter = _a.adapter; + return function contains(elem) { + return next(elem) && adapter.getText(elem).includes(text); + }; + }, + icontains: function (next, text, _a) { + var adapter = _a.adapter; + var itext = text.toLowerCase(); + return function icontains(elem) { + return (next(elem) && + adapter.getText(elem).toLowerCase().includes(itext)); + }; + }, + // Location specific methods + "nth-child": function (next, rule, _a) { + var adapter = _a.adapter, equals = _a.equals; + var func = nth_check_1.default(rule); + if (func === boolbase_1.falseFunc) + return boolbase_1.falseFunc; + if (func === boolbase_1.trueFunc) + return getChildFunc(next, adapter); + return function nthChild(elem) { + var siblings = adapter.getSiblings(elem); + var pos = 0; + for (var i = 0; i < siblings.length; i++) { + if (equals(elem, siblings[i])) + break; + if (adapter.isTag(siblings[i])) { + pos++; + } + } + return func(pos) && next(elem); + }; + }, + "nth-last-child": function (next, rule, _a) { + var adapter = _a.adapter, equals = _a.equals; + var func = nth_check_1.default(rule); + if (func === boolbase_1.falseFunc) + return boolbase_1.falseFunc; + if (func === boolbase_1.trueFunc) + return getChildFunc(next, adapter); + return function nthLastChild(elem) { + var siblings = adapter.getSiblings(elem); + var pos = 0; + for (var i = siblings.length - 1; i >= 0; i--) { + if (equals(elem, siblings[i])) + break; + if (adapter.isTag(siblings[i])) { + pos++; + } + } + return func(pos) && next(elem); + }; + }, + "nth-of-type": function (next, rule, _a) { + var adapter = _a.adapter, equals = _a.equals; + var func = nth_check_1.default(rule); + if (func === boolbase_1.falseFunc) + return boolbase_1.falseFunc; + if (func === boolbase_1.trueFunc) + return getChildFunc(next, adapter); + return function nthOfType(elem) { + var siblings = adapter.getSiblings(elem); + var pos = 0; + for (var i = 0; i < siblings.length; i++) { + var currentSibling = siblings[i]; + if (equals(elem, currentSibling)) + break; + if (adapter.isTag(currentSibling) && + adapter.getName(currentSibling) === adapter.getName(elem)) { + pos++; + } + } + return func(pos) && next(elem); + }; + }, + "nth-last-of-type": function (next, rule, _a) { + var adapter = _a.adapter, equals = _a.equals; + var func = nth_check_1.default(rule); + if (func === boolbase_1.falseFunc) + return boolbase_1.falseFunc; + if (func === boolbase_1.trueFunc) + return getChildFunc(next, adapter); + return function nthLastOfType(elem) { + var siblings = adapter.getSiblings(elem); + var pos = 0; + for (var i = siblings.length - 1; i >= 0; i--) { + var currentSibling = siblings[i]; + if (equals(elem, currentSibling)) + break; + if (adapter.isTag(currentSibling) && + adapter.getName(currentSibling) === adapter.getName(elem)) { + pos++; + } + } + return func(pos) && next(elem); + }; + }, + // TODO determine the actual root element + root: function (next, _rule, _a) { + var adapter = _a.adapter; + return function (elem) { + var parent = adapter.getParent(elem); + return (parent == null || !adapter.isTag(parent)) && next(elem); + }; + }, + scope: function (next, rule, options, context) { + var equals = options.equals; + if (!context || context.length === 0) { + // Equivalent to :root + return exports.filters.root(next, rule, options); + } + if (context.length === 1) { + // NOTE: can't be unpacked, as :has uses this for side-effects + return function (elem) { return equals(context[0], elem) && next(elem); }; + } + return function (elem) { return context.includes(elem) && next(elem); }; + }, + hover: dynamicStatePseudo("isHovered"), + visited: dynamicStatePseudo("isVisited"), + active: dynamicStatePseudo("isActive"), +}; +/** + * Dynamic state pseudos. These depend on optional Adapter methods. + * + * @param name The name of the adapter method to call. + * @returns Pseudo for the `filters` object. + */ +function dynamicStatePseudo(name) { + return function dynamicPseudo(next, _rule, _a) { + var adapter = _a.adapter; + var func = adapter[name]; + if (typeof func !== "function") { + return boolbase_1.falseFunc; + } + return function active(elem) { + return func(elem) && next(elem); + }; + }; } -function escapeArgument(arg, doubleEscapeMetaChars) { - // Convert to string - arg = `${arg}`; - - // Algorithm below is based on https://qntm.org/cmd - - // Sequence of backslashes followed by a double quote: - // double up all the backslashes and escape the double quote - arg = arg.replace(/(\\*)"/g, '$1$1\\"'); - - // Sequence of backslashes followed by the end of the string - // (which will become a double quote later): - // double up all the backslashes - arg = arg.replace(/(\\*)$/, '$1$1'); - // All other backslashes occur literally +/***/ }), - // Quote the whole thing: - arg = `"${arg}"`; +/***/ 89312: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); +"use strict"; - // Double escape meta chars if necessary - if (doubleEscapeMetaChars) { - arg = arg.replace(metaCharsRegExp, '^$1'); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.compilePseudoSelector = exports.aliases = exports.pseudos = exports.filters = void 0; +/* + * Pseudo selectors + * + * Pseudo selectors are available in three forms: + * + * 1. Filters are called when the selector is compiled and return a function + * that has to return either false, or the results of `next()`. + * 2. Pseudos are called on execution. They have to return a boolean. + * 3. Subselects work like filters, but have an embedded selector that will be run separately. + * + * Filters are great if you want to do some pre-processing, or change the call order + * of `next()` and your code. + * Pseudos should be used to implement simple checks. + */ +var boolbase_1 = __nccwpck_require__(44159); +var css_what_1 = __nccwpck_require__(19218); +var filters_1 = __nccwpck_require__(51686); +Object.defineProperty(exports, "filters", ({ enumerable: true, get: function () { return filters_1.filters; } })); +var pseudos_1 = __nccwpck_require__(8952); +Object.defineProperty(exports, "pseudos", ({ enumerable: true, get: function () { return pseudos_1.pseudos; } })); +var aliases_1 = __nccwpck_require__(24176); +Object.defineProperty(exports, "aliases", ({ enumerable: true, get: function () { return aliases_1.aliases; } })); +var subselects_1 = __nccwpck_require__(15813); +function compilePseudoSelector(next, selector, options, context, compileToken) { + var name = selector.name, data = selector.data; + if (Array.isArray(data)) { + return subselects_1.subselects[name](next, data, options, context, compileToken); } - - return arg; + if (name in aliases_1.aliases) { + if (data != null) { + throw new Error("Pseudo " + name + " doesn't have any arguments"); + } + // The alias has to be parsed here, to make sure options are respected. + var alias = css_what_1.parse(aliases_1.aliases[name], options); + return subselects_1.subselects.is(next, alias, options, context, compileToken); + } + if (name in filters_1.filters) { + return filters_1.filters[name](next, data, options, context); + } + if (name in pseudos_1.pseudos) { + var pseudo_1 = pseudos_1.pseudos[name]; + pseudos_1.verifyPseudoArgs(pseudo_1, name, data); + return pseudo_1 === boolbase_1.falseFunc + ? boolbase_1.falseFunc + : next === boolbase_1.trueFunc + ? function (elem) { return pseudo_1(elem, options, data); } + : function (elem) { return pseudo_1(elem, options, data) && next(elem); }; + } + throw new Error("unmatched pseudo-class :" + name); } - -module.exports.command = escapeCommand; -module.exports.argument = escapeArgument; +exports.compilePseudoSelector = compilePseudoSelector; /***/ }), -/***/ 41252: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 8952: +/***/ ((__unused_webpack_module, exports) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.verifyPseudoArgs = exports.pseudos = void 0; +// While filters are precompiled, pseudos get called when they are needed +exports.pseudos = { + empty: function (elem, _a) { + var adapter = _a.adapter; + return !adapter.getChildren(elem).some(function (elem) { + // FIXME: `getText` call is potentially expensive. + return adapter.isTag(elem) || adapter.getText(elem) !== ""; + }); + }, + "first-child": function (elem, _a) { + var adapter = _a.adapter, equals = _a.equals; + var firstChild = adapter + .getSiblings(elem) + .find(function (elem) { return adapter.isTag(elem); }); + return firstChild != null && equals(elem, firstChild); + }, + "last-child": function (elem, _a) { + var adapter = _a.adapter, equals = _a.equals; + var siblings = adapter.getSiblings(elem); + for (var i = siblings.length - 1; i >= 0; i--) { + if (equals(elem, siblings[i])) + return true; + if (adapter.isTag(siblings[i])) + break; + } + return false; + }, + "first-of-type": function (elem, _a) { + var adapter = _a.adapter, equals = _a.equals; + var siblings = adapter.getSiblings(elem); + var elemName = adapter.getName(elem); + for (var i = 0; i < siblings.length; i++) { + var currentSibling = siblings[i]; + if (equals(elem, currentSibling)) + return true; + if (adapter.isTag(currentSibling) && + adapter.getName(currentSibling) === elemName) { + break; + } + } + return false; + }, + "last-of-type": function (elem, _a) { + var adapter = _a.adapter, equals = _a.equals; + var siblings = adapter.getSiblings(elem); + var elemName = adapter.getName(elem); + for (var i = siblings.length - 1; i >= 0; i--) { + var currentSibling = siblings[i]; + if (equals(elem, currentSibling)) + return true; + if (adapter.isTag(currentSibling) && + adapter.getName(currentSibling) === elemName) { + break; + } + } + return false; + }, + "only-of-type": function (elem, _a) { + var adapter = _a.adapter, equals = _a.equals; + var elemName = adapter.getName(elem); + return adapter + .getSiblings(elem) + .every(function (sibling) { + return equals(elem, sibling) || + !adapter.isTag(sibling) || + adapter.getName(sibling) !== elemName; + }); + }, + "only-child": function (elem, _a) { + var adapter = _a.adapter, equals = _a.equals; + return adapter + .getSiblings(elem) + .every(function (sibling) { return equals(elem, sibling) || !adapter.isTag(sibling); }); + }, +}; +function verifyPseudoArgs(func, name, subselect) { + if (subselect === null) { + if (func.length > 2) { + throw new Error("pseudo-selector :" + name + " requires an argument"); + } + } + else if (func.length === 2) { + throw new Error("pseudo-selector :" + name + " doesn't have any arguments"); + } +} +exports.verifyPseudoArgs = verifyPseudoArgs; -const fs = __nccwpck_require__(35747); -const shebangCommand = __nccwpck_require__(67032); - -function readShebang(command) { - // Read the first 150 bytes from the file - const size = 150; - const buffer = Buffer.alloc(size); - - let fd; - try { - fd = fs.openSync(command, 'r'); - fs.readSync(fd, buffer, 0, size, 0); - fs.closeSync(fd); - } catch (e) { /* Empty */ } +/***/ }), - // Attempt to extract shebang (null is returned if not a shebang) - return shebangCommand(buffer.toString()); -} +/***/ 15813: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; -module.exports = readShebang; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.subselects = exports.getNextSiblings = exports.ensureIsTag = exports.PLACEHOLDER_ELEMENT = void 0; +var boolbase_1 = __nccwpck_require__(44159); +var procedure_1 = __nccwpck_require__(47396); +/** Used as a placeholder for :has. Will be replaced with the actual element. */ +exports.PLACEHOLDER_ELEMENT = {}; +function ensureIsTag(next, adapter) { + if (next === boolbase_1.falseFunc) + return boolbase_1.falseFunc; + return function (elem) { return adapter.isTag(elem) && next(elem); }; +} +exports.ensureIsTag = ensureIsTag; +function getNextSiblings(elem, adapter) { + var siblings = adapter.getSiblings(elem); + if (siblings.length <= 1) + return []; + var elemIndex = siblings.indexOf(elem); + if (elemIndex < 0 || elemIndex === siblings.length - 1) + return []; + return siblings.slice(elemIndex + 1).filter(adapter.isTag); +} +exports.getNextSiblings = getNextSiblings; +var is = function (next, token, options, context, compileToken) { + var opts = { + xmlMode: !!options.xmlMode, + adapter: options.adapter, + equals: options.equals, + }; + var func = compileToken(token, opts, context); + return function (elem) { return func(elem) && next(elem); }; +}; +/* + * :not, :has, :is and :matches have to compile selectors + * doing this in src/pseudos.ts would lead to circular dependencies, + * so we add them here + */ +exports.subselects = { + is: is, + /** + * `:matches` is an alias for `:is`. + */ + matches: is, + not: function (next, token, options, context, compileToken) { + var opts = { + xmlMode: !!options.xmlMode, + adapter: options.adapter, + equals: options.equals, + }; + var func = compileToken(token, opts, context); + if (func === boolbase_1.falseFunc) + return next; + if (func === boolbase_1.trueFunc) + return boolbase_1.falseFunc; + return function not(elem) { + return !func(elem) && next(elem); + }; + }, + has: function (next, subselect, options, _context, compileToken) { + var adapter = options.adapter; + var opts = { + xmlMode: !!options.xmlMode, + adapter: adapter, + equals: options.equals, + }; + // @ts-expect-error Uses an array as a pointer to the current element (side effects) + var context = subselect.some(function (s) { + return s.some(procedure_1.isTraversal); + }) + ? [exports.PLACEHOLDER_ELEMENT] + : undefined; + var compiled = compileToken(subselect, opts, context); + if (compiled === boolbase_1.falseFunc) + return boolbase_1.falseFunc; + if (compiled === boolbase_1.trueFunc) { + return function (elem) { + return adapter.getChildren(elem).some(adapter.isTag) && next(elem); + }; + } + var hasElement = ensureIsTag(compiled, adapter); + var _a = compiled.shouldTestNextSiblings, shouldTestNextSiblings = _a === void 0 ? false : _a; + /* + * `shouldTestNextSiblings` will only be true if the query starts with + * a traversal (sibling or adjacent). That means we will always have a context. + */ + if (context) { + return function (elem) { + context[0] = elem; + var childs = adapter.getChildren(elem); + var nextElements = shouldTestNextSiblings + ? __spreadArray(__spreadArray([], childs), getNextSiblings(elem, adapter)) : childs; + return (next(elem) && adapter.existsOne(hasElement, nextElements)); + }; + } + return function (elem) { + return next(elem) && + adapter.existsOne(hasElement, adapter.getChildren(elem)); + }; + }, +}; /***/ }), -/***/ 87274: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 57320: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const path = __nccwpck_require__(85622); -const which = __nccwpck_require__(34207); -const getPathKey = __nccwpck_require__(20539); - -function resolveCommandAttempt(parsed, withoutPathExt) { - const env = parsed.options.env || process.env; - const cwd = process.cwd(); - const hasCustomCwd = parsed.options.cwd != null; - // Worker threads do not have process.chdir() - const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled; - - // If a custom `cwd` was specified, we need to change the process cwd - // because `which` will do stat calls but does not support a custom cwd - if (shouldSwitchCwd) { - try { - process.chdir(parsed.options.cwd); - } catch (err) { - /* Empty */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +var procedure_1 = __nccwpck_require__(47396); +var attributes = { + exists: 10, + equals: 8, + not: 7, + start: 6, + end: 6, + any: 5, + hyphen: 4, + element: 4, +}; +/** + * Sort the parts of the passed selector, + * as there is potential for optimization + * (some types of selectors are faster than others) + * + * @param arr Selector to sort + */ +function sortByProcedure(arr) { + var procs = arr.map(getProcedure); + for (var i = 1; i < arr.length; i++) { + var procNew = procs[i]; + if (procNew < 0) + continue; + for (var j = i - 1; j >= 0 && procNew < procs[j]; j--) { + var token = arr[j + 1]; + arr[j + 1] = arr[j]; + arr[j] = token; + procs[j + 1] = procs[j]; + procs[j] = procNew; + } + } +} +exports.default = sortByProcedure; +function getProcedure(token) { + var proc = procedure_1.procedure[token.type]; + if (token.type === "attribute") { + proc = attributes[token.action]; + if (proc === attributes.equals && token.name === "id") { + // Prefer ID selectors (eg. #ID) + proc = 9; + } + if (token.ignoreCase) { + /* + * IgnoreCase adds some overhead, prefer "normal" token + * this is a binary operation, to ensure it's still an int + */ + proc >>= 1; + } + } + else if (token.type === "pseudo") { + if (!token.data) { + proc = 3; + } + else if (token.name === "has" || token.name === "contains") { + proc = 0; // Expensive in any case + } + else if (Array.isArray(token.data)) { + // "matches" and "not" + proc = 0; + for (var i = 0; i < token.data.length; i++) { + // TODO better handling of complex selectors + if (token.data[i].length !== 1) + continue; + var cur = getProcedure(token.data[i][0]); + // Avoid executing :has or :contains + if (cur === 0) { + proc = 0; + break; + } + if (cur > proc) + proc = cur; + } + if (token.data.length > 1 && proc > 0) + proc -= 1; + } + else { + proc = 1; } } + return proc; +} - let resolved; - try { - resolved = which.sync(parsed.command, { - path: env[getPathKey({ env })], - pathExt: withoutPathExt ? path.delimiter : undefined, - }); - } catch (e) { - /* Empty */ - } finally { - if (shouldSwitchCwd) { - process.chdir(cwd); +/***/ }), + +/***/ 19218: +/***/ (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 __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); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringify = exports.parse = void 0; +__exportStar(__nccwpck_require__(97751), exports); +var parse_1 = __nccwpck_require__(97751); +Object.defineProperty(exports, "parse", ({ enumerable: true, get: function () { return __importDefault(parse_1).default; } })); +var stringify_1 = __nccwpck_require__(70586); +Object.defineProperty(exports, "stringify", ({ enumerable: true, get: function () { return __importDefault(stringify_1).default; } })); + + +/***/ }), + +/***/ 97751: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; } } - - // If we successfully resolved, ensure that an absolute path is returned - // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it - if (resolved) { - resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved); + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isTraversal = void 0; +var reName = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/; +var reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi; +var actionTypes = new Map([ + ["~", "element"], + ["^", "start"], + ["$", "end"], + ["*", "any"], + ["!", "not"], + ["|", "hyphen"], +]); +var Traversals = { + ">": "child", + "<": "parent", + "~": "sibling", + "+": "adjacent", +}; +var attribSelectors = { + "#": ["id", "equals"], + ".": ["class", "element"], +}; +// Pseudos, whose data property is parsed as well. +var unpackPseudos = new Set([ + "has", + "not", + "matches", + "is", + "where", + "host", + "host-context", +]); +var traversalNames = new Set(__spreadArray([ + "descendant" +], Object.keys(Traversals).map(function (k) { return Traversals[k]; }), true)); +/** + * Attributes that are case-insensitive in HTML. + * + * @private + * @see https://html.spec.whatwg.org/multipage/semantics-other.html#case-sensitivity-of-selectors + */ +var caseInsensitiveAttributes = new Set([ + "accept", + "accept-charset", + "align", + "alink", + "axis", + "bgcolor", + "charset", + "checked", + "clear", + "codetype", + "color", + "compact", + "declare", + "defer", + "dir", + "direction", + "disabled", + "enctype", + "face", + "frame", + "hreflang", + "http-equiv", + "lang", + "language", + "link", + "media", + "method", + "multiple", + "nohref", + "noresize", + "noshade", + "nowrap", + "readonly", + "rel", + "rev", + "rules", + "scope", + "scrolling", + "selected", + "shape", + "target", + "text", + "type", + "valign", + "valuetype", + "vlink", +]); +/** + * Checks whether a specific selector is a traversal. + * This is useful eg. in swapping the order of elements that + * are not traversals. + * + * @param selector Selector to check. + */ +function isTraversal(selector) { + return traversalNames.has(selector.type); +} +exports.isTraversal = isTraversal; +var stripQuotesFromPseudos = new Set(["contains", "icontains"]); +var quotes = new Set(['"', "'"]); +// Unescape function taken from https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L152 +function funescape(_, escaped, escapedWhitespace) { + var high = parseInt(escaped, 16) - 0x10000; + // NaN means non-codepoint + return high !== high || escapedWhitespace + ? escaped + : high < 0 + ? // BMP codepoint + String.fromCharCode(high + 0x10000) + : // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00); +} +function unescapeCSS(str) { + return str.replace(reEscape, funescape); +} +function isWhitespace(c) { + return c === " " || c === "\n" || c === "\t" || c === "\f" || c === "\r"; +} +/** + * Parses `selector`, optionally with the passed `options`. + * + * @param selector Selector to parse. + * @param options Options for parsing. + * @returns Returns a two-dimensional array. + * The first dimension represents selectors separated by commas (eg. `sub1, sub2`), + * the second contains the relevant tokens for that selector. + */ +function parse(selector, options) { + var subselects = []; + var endIndex = parseSelector(subselects, "" + selector, options, 0); + if (endIndex < selector.length) { + throw new Error("Unmatched selector: " + selector.slice(endIndex)); + } + return subselects; +} +exports.default = parse; +function parseSelector(subselects, selector, options, selectorIndex) { + var _a, _b; + if (options === void 0) { options = {}; } + var tokens = []; + var sawWS = false; + function getName(offset) { + var match = selector.slice(selectorIndex + offset).match(reName); + if (!match) { + throw new Error("Expected name, found " + selector.slice(selectorIndex)); + } + var name = match[0]; + selectorIndex += offset + name.length; + return unescapeCSS(name); + } + function stripWhitespace(offset) { + while (isWhitespace(selector.charAt(selectorIndex + offset))) + offset++; + selectorIndex += offset; + } + function isEscaped(pos) { + var slashCount = 0; + while (selector.charAt(--pos) === "\\") + slashCount++; + return (slashCount & 1) === 1; + } + function ensureNotTraversal() { + if (tokens.length > 0 && isTraversal(tokens[tokens.length - 1])) { + throw new Error("Did not expect successive traversals."); + } + } + stripWhitespace(0); + while (selector !== "") { + var firstChar = selector.charAt(selectorIndex); + if (isWhitespace(firstChar)) { + sawWS = true; + stripWhitespace(1); + } + else if (firstChar in Traversals) { + ensureNotTraversal(); + tokens.push({ type: Traversals[firstChar] }); + sawWS = false; + stripWhitespace(1); + } + else if (firstChar === ",") { + if (tokens.length === 0) { + throw new Error("Empty sub-selector"); + } + subselects.push(tokens); + tokens = []; + sawWS = false; + stripWhitespace(1); + } + else if (selector.startsWith("/*", selectorIndex)) { + var endIndex = selector.indexOf("*/", selectorIndex + 2); + if (endIndex < 0) { + throw new Error("Comment was not terminated"); + } + selectorIndex = endIndex + 2; + } + else { + if (sawWS) { + ensureNotTraversal(); + tokens.push({ type: "descendant" }); + sawWS = false; + } + if (firstChar in attribSelectors) { + var _c = attribSelectors[firstChar], name_1 = _c[0], action = _c[1]; + tokens.push({ + type: "attribute", + name: name_1, + action: action, + value: getName(1), + namespace: null, + // TODO: Add quirksMode option, which makes `ignoreCase` `true` for HTML. + ignoreCase: options.xmlMode ? null : false, + }); + } + else if (firstChar === "[") { + stripWhitespace(1); + // Determine attribute name and namespace + var namespace = null; + if (selector.charAt(selectorIndex) === "|") { + namespace = ""; + selectorIndex += 1; + } + if (selector.startsWith("*|", selectorIndex)) { + namespace = "*"; + selectorIndex += 2; + } + var name_2 = getName(0); + if (namespace === null && + selector.charAt(selectorIndex) === "|" && + selector.charAt(selectorIndex + 1) !== "=") { + namespace = name_2; + name_2 = getName(1); + } + if ((_a = options.lowerCaseAttributeNames) !== null && _a !== void 0 ? _a : !options.xmlMode) { + name_2 = name_2.toLowerCase(); + } + stripWhitespace(0); + // Determine comparison operation + var action = "exists"; + var possibleAction = actionTypes.get(selector.charAt(selectorIndex)); + if (possibleAction) { + action = possibleAction; + if (selector.charAt(selectorIndex + 1) !== "=") { + throw new Error("Expected `=`"); + } + stripWhitespace(2); + } + else if (selector.charAt(selectorIndex) === "=") { + action = "equals"; + stripWhitespace(1); + } + // Determine value + var value = ""; + var ignoreCase = null; + if (action !== "exists") { + if (quotes.has(selector.charAt(selectorIndex))) { + var quote = selector.charAt(selectorIndex); + var sectionEnd = selectorIndex + 1; + while (sectionEnd < selector.length && + (selector.charAt(sectionEnd) !== quote || + isEscaped(sectionEnd))) { + sectionEnd += 1; + } + if (selector.charAt(sectionEnd) !== quote) { + throw new Error("Attribute value didn't end"); + } + value = unescapeCSS(selector.slice(selectorIndex + 1, sectionEnd)); + selectorIndex = sectionEnd + 1; + } + else { + var valueStart = selectorIndex; + while (selectorIndex < selector.length && + ((!isWhitespace(selector.charAt(selectorIndex)) && + selector.charAt(selectorIndex) !== "]") || + isEscaped(selectorIndex))) { + selectorIndex += 1; + } + value = unescapeCSS(selector.slice(valueStart, selectorIndex)); + } + stripWhitespace(0); + // See if we have a force ignore flag + var forceIgnore = selector.charAt(selectorIndex); + // If the forceIgnore flag is set (either `i` or `s`), use that value + if (forceIgnore === "s" || forceIgnore === "S") { + ignoreCase = false; + stripWhitespace(1); + } + else if (forceIgnore === "i" || forceIgnore === "I") { + ignoreCase = true; + stripWhitespace(1); + } + } + // If `xmlMode` is set, there are no rules; otherwise, use the `caseInsensitiveAttributes` list. + if (!options.xmlMode) { + // TODO: Skip this for `exists`, as there is no value to compare to. + ignoreCase !== null && ignoreCase !== void 0 ? ignoreCase : (ignoreCase = caseInsensitiveAttributes.has(name_2)); + } + if (selector.charAt(selectorIndex) !== "]") { + throw new Error("Attribute selector didn't terminate"); + } + selectorIndex += 1; + var attributeSelector = { + type: "attribute", + name: name_2, + action: action, + value: value, + namespace: namespace, + ignoreCase: ignoreCase, + }; + tokens.push(attributeSelector); + } + else if (firstChar === ":") { + if (selector.charAt(selectorIndex + 1) === ":") { + tokens.push({ + type: "pseudo-element", + name: getName(2).toLowerCase(), + }); + continue; + } + var name_3 = getName(1).toLowerCase(); + var data = null; + if (selector.charAt(selectorIndex) === "(") { + if (unpackPseudos.has(name_3)) { + if (quotes.has(selector.charAt(selectorIndex + 1))) { + throw new Error("Pseudo-selector " + name_3 + " cannot be quoted"); + } + data = []; + selectorIndex = parseSelector(data, selector, options, selectorIndex + 1); + if (selector.charAt(selectorIndex) !== ")") { + throw new Error("Missing closing parenthesis in :" + name_3 + " (" + selector + ")"); + } + selectorIndex += 1; + } + else { + selectorIndex += 1; + var start = selectorIndex; + var counter = 1; + for (; counter > 0 && selectorIndex < selector.length; selectorIndex++) { + if (selector.charAt(selectorIndex) === "(" && + !isEscaped(selectorIndex)) { + counter++; + } + else if (selector.charAt(selectorIndex) === ")" && + !isEscaped(selectorIndex)) { + counter--; + } + } + if (counter) { + throw new Error("Parenthesis not matched"); + } + data = selector.slice(start, selectorIndex - 1); + if (stripQuotesFromPseudos.has(name_3)) { + var quot = data.charAt(0); + if (quot === data.slice(-1) && quotes.has(quot)) { + data = data.slice(1, -1); + } + data = unescapeCSS(data); + } + } + } + tokens.push({ type: "pseudo", name: name_3, data: data }); + } + else { + var namespace = null; + var name_4 = void 0; + if (firstChar === "*") { + selectorIndex += 1; + name_4 = "*"; + } + else if (reName.test(selector.slice(selectorIndex))) { + if (selector.charAt(selectorIndex) === "|") { + namespace = ""; + selectorIndex += 1; + } + name_4 = getName(0); + } + else { + /* + * We have finished parsing the selector. + * Remove descendant tokens at the end if they exist, + * and return the last index, so that parsing can be + * picked up from here. + */ + if (tokens.length && + tokens[tokens.length - 1].type === "descendant") { + tokens.pop(); + } + addToken(subselects, tokens); + return selectorIndex; + } + if (selector.charAt(selectorIndex) === "|") { + namespace = name_4; + if (selector.charAt(selectorIndex + 1) === "*") { + name_4 = "*"; + selectorIndex += 2; + } + else { + name_4 = getName(1); + } + } + if (name_4 === "*") { + tokens.push({ type: "universal", namespace: namespace }); + } + else { + if ((_b = options.lowerCaseTags) !== null && _b !== void 0 ? _b : !options.xmlMode) { + name_4 = name_4.toLowerCase(); + } + tokens.push({ type: "tag", name: name_4, namespace: namespace }); + } + } + } } - - return resolved; + addToken(subselects, tokens); + return selectorIndex; } - -function resolveCommand(parsed) { - return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); +function addToken(subselects, tokens) { + if (subselects.length > 0 && tokens.length === 0) { + throw new Error("Empty sub-selector"); + } + subselects.push(tokens); } -module.exports = resolveCommand; + +/***/ }), + +/***/ 70586: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var actionTypes = { + equals: "", + element: "~", + start: "^", + end: "$", + any: "*", + not: "!", + hyphen: "|", +}; +var charsToEscape = new Set(__spreadArray(__spreadArray([], Object.keys(actionTypes) + .map(function (typeKey) { return actionTypes[typeKey]; }) + .filter(Boolean), true), [ + ":", + "[", + "]", + " ", + "\\", + "(", + ")", + "'", +], false)); +/** + * Turns `selector` back into a string. + * + * @param selector Selector to stringify. + */ +function stringify(selector) { + return selector.map(stringifySubselector).join(", "); +} +exports.default = stringify; +function stringifySubselector(token) { + return token.map(stringifyToken).join(""); +} +function stringifyToken(token) { + switch (token.type) { + // Simple types + case "child": + return " > "; + case "parent": + return " < "; + case "sibling": + return " ~ "; + case "adjacent": + return " + "; + case "descendant": + return " "; + case "universal": + return getNamespace(token.namespace) + "*"; + case "tag": + return getNamespacedName(token); + case "pseudo-element": + return "::" + escapeName(token.name); + case "pseudo": + if (token.data === null) + return ":" + escapeName(token.name); + if (typeof token.data === "string") { + return ":" + escapeName(token.name) + "(" + escapeName(token.data) + ")"; + } + return ":" + escapeName(token.name) + "(" + stringify(token.data) + ")"; + case "attribute": { + if (token.name === "id" && + token.action === "equals" && + !token.ignoreCase && + !token.namespace) { + return "#" + escapeName(token.value); + } + if (token.name === "class" && + token.action === "element" && + !token.ignoreCase && + !token.namespace) { + return "." + escapeName(token.value); + } + var name_1 = getNamespacedName(token); + if (token.action === "exists") { + return "[" + name_1 + "]"; + } + return "[" + name_1 + actionTypes[token.action] + "='" + escapeName(token.value) + "'" + (token.ignoreCase ? "i" : token.ignoreCase === false ? "s" : "") + "]"; + } + } +} +function getNamespacedName(token) { + return "" + getNamespace(token.namespace) + escapeName(token.name); +} +function getNamespace(namespace) { + return namespace !== null + ? (namespace === "*" ? "*" : escapeName(namespace)) + "|" + : ""; +} +function escapeName(str) { + return str + .split("") + .map(function (c) { return (charsToEscape.has(c) ? "\\" + c : c); }) + .join(""); +} /***/ }), @@ -20473,1534 +21546,2644 @@ function generateOptions(options, defaults) { /***/ }), -/***/ 82042: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 14802: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -const isObj = __nccwpck_require__(51389); - -const disallowedKeys = [ - '__proto__', - 'prototype', - 'constructor' -]; - -const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.includes(segment)); - -function getPathSegments(path) { - const pathArray = path.split('.'); - const parts = []; - - for (let i = 0; i < pathArray.length; i++) { - let p = pathArray[i]; - - while (p[p.length - 1] === '\\' && pathArray[i + 1] !== undefined) { - p = p.slice(0, -1) + '.'; - p += pathArray[++i]; - } - - parts.push(p); - } - - if (!isValidPath(parts)) { - return []; - } - - return parts; -} - -module.exports = { - get(object, path, value) { - if (!isObj(object) || typeof path !== 'string') { - return value === undefined ? object : value; - } - - const pathArray = getPathSegments(path); - if (pathArray.length === 0) { - return; - } - - for (let i = 0; i < pathArray.length; i++) { - if (!Object.prototype.propertyIsEnumerable.call(object, pathArray[i])) { - return value; - } - - object = object[pathArray[i]]; - - if (object === undefined || object === null) { - // `object` is either `undefined` or `null` so we want to stop the loop, and - // if this is not the last bit of the path, and - // if it did't return `undefined` - // it would return `null` if `object` is `null` - // but we want `get({foo: null}, 'foo.bar')` to equal `undefined`, or the supplied value, not `null` - if (i !== pathArray.length - 1) { - return value; - } - - break; - } - } - - return object; - }, - - set(object, path, value) { - if (!isObj(object) || typeof path !== 'string') { - return object; - } - - const root = object; - const pathArray = getPathSegments(path); - - for (let i = 0; i < pathArray.length; i++) { - const p = pathArray[i]; - - if (!isObj(object[p])) { - object[p] = {}; - } - - if (i === pathArray.length - 1) { - object[p] = value; - } - - object = object[p]; - } - - return root; - }, - - delete(object, path) { - if (!isObj(object) || typeof path !== 'string') { - return false; - } - - const pathArray = getPathSegments(path); - - for (let i = 0; i < pathArray.length; i++) { - const p = pathArray[i]; - - if (i === pathArray.length - 1) { - delete object[p]; - return true; - } - - object = object[p]; - - if (!isObj(object)) { - return false; - } - } - }, - - has(object, path) { - if (!isObj(object) || typeof path !== 'string') { - return false; - } - - const pathArray = getPathSegments(path); - if (pathArray.length === 0) { - return false; - } - - // eslint-disable-next-line unicorn/no-for-loop - for (let i = 0; i < pathArray.length; i++) { - if (isObj(object)) { - if (!(pathArray[i] in object)) { - return false; - } - - object = object[pathArray[i]]; - } else { - return false; - } - } - - return true; - } -}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.attributeNames = exports.elementNames = void 0; +exports.elementNames = new Map([ + ["altglyph", "altGlyph"], + ["altglyphdef", "altGlyphDef"], + ["altglyphitem", "altGlyphItem"], + ["animatecolor", "animateColor"], + ["animatemotion", "animateMotion"], + ["animatetransform", "animateTransform"], + ["clippath", "clipPath"], + ["feblend", "feBlend"], + ["fecolormatrix", "feColorMatrix"], + ["fecomponenttransfer", "feComponentTransfer"], + ["fecomposite", "feComposite"], + ["feconvolvematrix", "feConvolveMatrix"], + ["fediffuselighting", "feDiffuseLighting"], + ["fedisplacementmap", "feDisplacementMap"], + ["fedistantlight", "feDistantLight"], + ["fedropshadow", "feDropShadow"], + ["feflood", "feFlood"], + ["fefunca", "feFuncA"], + ["fefuncb", "feFuncB"], + ["fefuncg", "feFuncG"], + ["fefuncr", "feFuncR"], + ["fegaussianblur", "feGaussianBlur"], + ["feimage", "feImage"], + ["femerge", "feMerge"], + ["femergenode", "feMergeNode"], + ["femorphology", "feMorphology"], + ["feoffset", "feOffset"], + ["fepointlight", "fePointLight"], + ["fespecularlighting", "feSpecularLighting"], + ["fespotlight", "feSpotLight"], + ["fetile", "feTile"], + ["feturbulence", "feTurbulence"], + ["foreignobject", "foreignObject"], + ["glyphref", "glyphRef"], + ["lineargradient", "linearGradient"], + ["radialgradient", "radialGradient"], + ["textpath", "textPath"], +]); +exports.attributeNames = new Map([ + ["definitionurl", "definitionURL"], + ["attributename", "attributeName"], + ["attributetype", "attributeType"], + ["basefrequency", "baseFrequency"], + ["baseprofile", "baseProfile"], + ["calcmode", "calcMode"], + ["clippathunits", "clipPathUnits"], + ["diffuseconstant", "diffuseConstant"], + ["edgemode", "edgeMode"], + ["filterunits", "filterUnits"], + ["glyphref", "glyphRef"], + ["gradienttransform", "gradientTransform"], + ["gradientunits", "gradientUnits"], + ["kernelmatrix", "kernelMatrix"], + ["kernelunitlength", "kernelUnitLength"], + ["keypoints", "keyPoints"], + ["keysplines", "keySplines"], + ["keytimes", "keyTimes"], + ["lengthadjust", "lengthAdjust"], + ["limitingconeangle", "limitingConeAngle"], + ["markerheight", "markerHeight"], + ["markerunits", "markerUnits"], + ["markerwidth", "markerWidth"], + ["maskcontentunits", "maskContentUnits"], + ["maskunits", "maskUnits"], + ["numoctaves", "numOctaves"], + ["pathlength", "pathLength"], + ["patterncontentunits", "patternContentUnits"], + ["patterntransform", "patternTransform"], + ["patternunits", "patternUnits"], + ["pointsatx", "pointsAtX"], + ["pointsaty", "pointsAtY"], + ["pointsatz", "pointsAtZ"], + ["preservealpha", "preserveAlpha"], + ["preserveaspectratio", "preserveAspectRatio"], + ["primitiveunits", "primitiveUnits"], + ["refx", "refX"], + ["refy", "refY"], + ["repeatcount", "repeatCount"], + ["repeatdur", "repeatDur"], + ["requiredextensions", "requiredExtensions"], + ["requiredfeatures", "requiredFeatures"], + ["specularconstant", "specularConstant"], + ["specularexponent", "specularExponent"], + ["spreadmethod", "spreadMethod"], + ["startoffset", "startOffset"], + ["stddeviation", "stdDeviation"], + ["stitchtiles", "stitchTiles"], + ["surfacescale", "surfaceScale"], + ["systemlanguage", "systemLanguage"], + ["tablevalues", "tableValues"], + ["targetx", "targetX"], + ["targety", "targetY"], + ["textlength", "textLength"], + ["viewbox", "viewBox"], + ["viewtarget", "viewTarget"], + ["xchannelselector", "xChannelSelector"], + ["ychannelselector", "yChannelSelector"], + ["zoomandpan", "zoomAndPan"], +]); /***/ }), -/***/ 8698: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -var Stream = __nccwpck_require__(92413) -var writeMethods = ["write", "end", "destroy"] -var readMethods = ["resume", "pause"] -var readEvents = ["data", "close"] -var slice = Array.prototype.slice - -module.exports = duplex - -function forEach (arr, fn) { - if (arr.forEach) { - return arr.forEach(fn) - } - - for (var i = 0; i < arr.length; i++) { - fn(arr[i], i) - } -} - -function duplex(writer, reader) { - var stream = new Stream() - var ended = false - - forEach(writeMethods, proxyWriter) - - forEach(readMethods, proxyReader) - - forEach(readEvents, proxyStream) - - reader.on("end", handleEnd) - - writer.on("drain", function() { - stream.emit("drain") - }) - - writer.on("error", reemit) - reader.on("error", reemit) - - stream.writable = writer.writable - stream.readable = reader.readable - - return stream +/***/ 48621: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - function proxyWriter(methodName) { - stream[methodName] = method +"use strict"; - function method() { - return writer[methodName].apply(writer, arguments) +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; } - } - - function proxyReader(methodName) { - stream[methodName] = method - - function method() { - stream.emit(methodName) - var func = reader[methodName] - if (func) { - return func.apply(reader, arguments) - } - reader.emit(methodName) + return t; + }; + return __assign.apply(this, arguments); +}; +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.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +/* + * Module dependencies + */ +var ElementType = __importStar(__nccwpck_require__(53944)); +var entities_1 = __nccwpck_require__(3000); +/** + * Mixed-case SVG and MathML tags & attributes + * recognized by the HTML parser. + * + * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign + */ +var foreignNames_1 = __nccwpck_require__(14802); +var unencodedElements = new Set([ + "style", + "script", + "xmp", + "iframe", + "noembed", + "noframes", + "plaintext", + "noscript", +]); +/** + * Format attributes + */ +function formatAttributes(attributes, opts) { + if (!attributes) + return; + return Object.keys(attributes) + .map(function (key) { + var _a, _b; + var value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : ""; + if (opts.xmlMode === "foreign") { + /* Fix up mixed-case attribute names */ + key = (_b = foreignNames_1.attributeNames.get(key)) !== null && _b !== void 0 ? _b : key; } - } - - function proxyStream(methodName) { - reader.on(methodName, reemit) - - function reemit() { - var args = slice.call(arguments) - args.unshift(methodName) - stream.emit.apply(stream, args) + if (!opts.emptyAttrs && !opts.xmlMode && value === "") { + return key; } + return key + "=\"" + (opts.decodeEntities !== false + ? entities_1.encodeXML(value) + : value.replace(/"/g, """)) + "\""; + }) + .join(" "); +} +/** + * Self-enclosing tags + */ +var singleTag = new Set([ + "area", + "base", + "basefont", + "br", + "col", + "command", + "embed", + "frame", + "hr", + "img", + "input", + "isindex", + "keygen", + "link", + "meta", + "param", + "source", + "track", + "wbr", +]); +/** + * Renders a DOM node or an array of DOM nodes to a string. + * + * Can be thought of as the equivalent of the `outerHTML` of the passed node(s). + * + * @param node Node to be rendered. + * @param options Changes serialization behavior + */ +function render(node, options) { + if (options === void 0) { options = {}; } + var nodes = "length" in node ? node : [node]; + var output = ""; + for (var i = 0; i < nodes.length; i++) { + output += renderNode(nodes[i], options); } - - function handleEnd() { - if (ended) { - return + return output; +} +exports.default = render; +function renderNode(node, options) { + switch (node.type) { + case ElementType.Root: + return render(node.children, options); + case ElementType.Directive: + case ElementType.Doctype: + return renderDirective(node); + case ElementType.Comment: + return renderComment(node); + case ElementType.CDATA: + return renderCdata(node); + case ElementType.Script: + case ElementType.Style: + case ElementType.Tag: + return renderTag(node, options); + case ElementType.Text: + return renderText(node, options); + } +} +var foreignModeIntegrationPoints = new Set([ + "mi", + "mo", + "mn", + "ms", + "mtext", + "annotation-xml", + "foreignObject", + "desc", + "title", +]); +var foreignElements = new Set(["svg", "math"]); +function renderTag(elem, opts) { + var _a; + // Handle SVG / MathML in HTML + if (opts.xmlMode === "foreign") { + /* Fix up mixed-case element names */ + elem.name = (_a = foreignNames_1.elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name; + /* Exit foreign mode at integration points */ + if (elem.parent && + foreignModeIntegrationPoints.has(elem.parent.name)) { + opts = __assign(__assign({}, opts), { xmlMode: false }); + } + } + if (!opts.xmlMode && foreignElements.has(elem.name)) { + opts = __assign(__assign({}, opts), { xmlMode: "foreign" }); + } + var tag = "<" + elem.name; + var attribs = formatAttributes(elem.attribs, opts); + if (attribs) { + tag += " " + attribs; + } + if (elem.children.length === 0 && + (opts.xmlMode + ? // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags + opts.selfClosingTags !== false + : // User explicitly asked for self-closing tags, even in HTML mode + opts.selfClosingTags && singleTag.has(elem.name))) { + if (!opts.xmlMode) + tag += " "; + tag += "/>"; + } + else { + tag += ">"; + if (elem.children.length > 0) { + tag += render(elem.children, opts); + } + if (opts.xmlMode || !singleTag.has(elem.name)) { + tag += ""; } - ended = true - var args = slice.call(arguments) - args.unshift("end") - stream.emit.apply(stream, args) } - - function reemit(err) { - stream.emit("error", err) + return tag; +} +function renderDirective(elem) { + return "<" + elem.data + ">"; +} +function renderText(elem, opts) { + var data = elem.data || ""; + // If entities weren't decoded, no need to encode them back + if (opts.decodeEntities !== false && + !(!opts.xmlMode && + elem.parent && + unencodedElements.has(elem.parent.name))) { + data = entities_1.encodeXML(data); } + return data; +} +function renderCdata(elem) { + return ""; +} +function renderComment(elem) { + return ""; } /***/ }), -/***/ 23505: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 53944: +/***/ ((__unused_webpack_module, exports) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0; +/** Types of elements found in htmlparser2's DOM */ +var ElementType; +(function (ElementType) { + /** Type for the root element of a document */ + ElementType["Root"] = "root"; + /** Type for Text */ + ElementType["Text"] = "text"; + /** Type for */ + ElementType["Directive"] = "directive"; + /** Type for */ + ElementType["Comment"] = "comment"; + /** Type for