From f3c4c472f0c23a18ce2869ec5812dbcea04c9a69 Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Thu, 14 Dec 2023 09:22:13 +0100 Subject: [PATCH 01/22] chore: update pre-commit hooks --- .pre-commit-config.yaml | 6 +++++- package-lock.json | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9699731..309ec37 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,9 +3,13 @@ repos: - repo: https://github.com/dev-build-deploy/commit-me - rev: v0.13.1 + rev: v1.1.0 hooks: - id: commit-me + args: [ + # Custom configuration file path + '--config', '.github/.commit-me.json' + ] - repo: https://github.com/dev-build-deploy/reuse-me rev: v0.10.0 diff --git a/package-lock.json b/package-lock.json index 2b35c91..0728e05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2319,9 +2319,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001568", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001568.tgz", - "integrity": "sha512-vSUkH84HontZJ88MiNrOau1EBrCqEQYgkC5gIySiDlpsm8sGVrhU7Kx4V6h0tnqaHzIHZv08HlJIwPbL4XL9+A==", + "version": "1.0.30001570", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz", + "integrity": "sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==", "dev": true, "funding": [ { @@ -2616,9 +2616,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.610", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.610.tgz", - "integrity": "sha512-mqi2oL1mfeHYtOdCxbPQYV/PL7YrQlxbvFEZ0Ee8GbDdShimqt2/S6z2RWqysuvlwdOrQdqvE0KZrBTipAeJzg==", + "version": "1.4.612", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.612.tgz", + "integrity": "sha512-dM8BMtXtlH237ecSMnYdYuCkib2QHq0kpWfUnavjdYsyr/6OsAwg5ZGUfnQ9KD1Ga4QgB2sqXlB2NT8zy2GnVg==", "dev": true }, "node_modules/emittery": { From 426e828d3029abf93b9aae7d022abb43abafc9d5 Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Sat, 16 Dec 2023 20:02:14 +0100 Subject: [PATCH 02/22] feat: extend Conventional Commit ruleset (errors and warnings) This commit will introduce the following new rules: - `CC-06` - A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description. - `CC-15` - The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase. - `WA-01` - A `BREAKING CHANGE` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer. --- lib/action/index.js | 743 +++++++++++++++++++++------------- lib/cli/index.js | 713 ++++++++++++++++++++------------ lib/precommit/index.js | 711 ++++++++++++++++++++------------ package-lock.json | 31 +- package.json | 2 +- src/datasources.ts | 25 +- src/entrypoints/action.ts | 54 ++- src/entrypoints/cli.ts | 13 +- src/entrypoints/pre-commit.ts | 9 +- src/validator.ts | 58 +-- test/validator.test.ts | 154 +++---- 11 files changed, 1527 insertions(+), 986 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index ce72c02..bf88738 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -2093,9 +2093,9 @@ function isLoopbackAddress(host) { "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -2120,8 +2120,75 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getCommit = exports.isConventionalCommit = exports.parseCommitMessage = void 0; +exports.parseCommitMessage = exports.getFooterElementsFromParagraph = exports.Commit = void 0; const git = __importStar(__nccwpck_require__(8433)); +const TRAILER_REGEX = /^((BREAKING CHANGE:)|([\w-]+(:| #))|([ \t]+)\w*)/i; +/** + * Git Commit + * @class Commit + * @member author The commit author and date + * @member commiter The commit commiter and date + * @member hash The commit hash + * @member subject The commit subject + * @member body The commit body + * @member footer The commit footer + * @member raw The commit message + */ +class Commit { + _commit; + constructor(commit) { + this._commit = commit; + } + /** + * Retrieves the commit information from git using the provided hash + * @param props The commit hash and root path + * @returns The commit object + */ + static fromHash(props) { + const commit = git.getCommitFromHash(props.hash, props.rootPath ?? process.cwd()); + return new Commit(commit); + } + /** + * Creates a Commit object from the provided string + * @param props The commit hash, author, committer and message + * @returns The commit object + */ + static fromString(props) { + const commit = { + hash: props.hash, + ...parseCommitMessage(props.message), + author: props.author, + committer: props.committer, + raw: props.message, + }; + return new Commit(commit); + } + get author() { + return this._commit.author; + } + get committer() { + return this._commit.committer; + } + get hash() { + return this._commit.hash; + } + get subject() { + return this._commit.subject; + } + get body() { + return this._commit.body; + } + get footer() { + return this._commit.footer; + } + get raw() { + return this._commit.raw; + } + toJSON() { + return this._commit; + } +} +exports.Commit = Commit; /** * Returns a dictionary containing key-value pairs extracted from the footer of the provided commit message. * The key must either be: @@ -2131,13 +2198,15 @@ const git = __importStar(__nccwpck_require__(8433)); * The value is either: * - the remainder of the line * - the remainder of the line + anything that follows on the next lines which is indented by at least one space + * + * @internal */ -function parseCommitFooter(footer) { - const footerLines = footer.split(/[\r\n]+/); - const result = {}; +function getFooterElementsFromParagraph(footer) { + const footerLines = footer.split(/\r?\n/); + const result = []; for (let lineNr = 0; lineNr < footerLines.length; lineNr++) { const line = footerLines[lineNr]; - const match = /^((BREAKING CHANGE:)|([\w-]+(:| #))|([ \t]+)\w)/.exec(line); + const match = TRAILER_REGEX.exec(line); if (match === null) continue; let key = match[1].replace(/:$/, ""); @@ -2146,15 +2215,22 @@ function parseCommitFooter(footer) { key = match[1].substring(0, match[1].length - 2); value = `#${value}`; } + const matchLine = lineNr; // Check if the value continues on the next line - while (lineNr + 1 < footerLines.length && footerLines[lineNr + 1].startsWith(" ")) { + while (lineNr + 1 < footerLines.length && + (/^\s/.test(footerLines[lineNr + 1]) || footerLines[lineNr + 1].length === 0)) { lineNr++; value += "\n" + footerLines[lineNr].trim(); } - result[key] = value; + result.push({ + lineNumber: matchLine + 1, + key, + value, + }); } return Object.keys(result).length > 0 ? result : undefined; } +exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; /** * Parses the provided commit message (full message, not just the subject) into * a Commit object. @@ -2163,11 +2239,11 @@ function parseCommitFooter(footer) { * @internal */ function parseCommitMessage(message) { - const isTrailerOnly = (message) => message.split(/[\r\n]+/).every(line => { - const match = /^((BREAKING CHANGE:)|([\w-]+(:| #))|([ \t]+)\w)/.exec(line); + const isTrailerOnly = (message) => message.split(/\r?\n/).every(line => { + const match = TRAILER_REGEX.exec(line); return match !== null; }); - const paragraphs = message.split(/^[\r\n]+/m); + const paragraphs = message.split(/^\r?\n/m); let footer = undefined; let body = undefined; if (paragraphs.length > 1 && isTrailerOnly(paragraphs[paragraphs.length - 1])) { @@ -2182,69 +2258,26 @@ function parseCommitMessage(message) { return { subject: paragraphs[0].trim(), body: body, - footer: parseCommitFooter(footer !== null && footer !== void 0 ? footer : ""), + footer: getFooterElementsFromParagraph(footer ?? "")?.reduce((acc, cur) => { + acc[cur.key] = cur.value; + return acc; + }, {}), }; } exports.parseCommitMessage = parseCommitMessage; -/** - * Confirms whether the provided commit is a Conventional Commit - * @param commit - * @returns - */ -function isConventionalCommit(commit) { - return "type" in commit; -} -exports.isConventionalCommit = isConventionalCommit; -/** - * Retrieves the commit message (from the indicated source) given the provided SHA hash - * @param hash SHA of the commit - * @param source The data source to retrieve the commit message from (git or github) - * @param options The options to use when retrieving the commit message - * @returns Commit object - */ -function getCommit(options) { - var _a; - let commit; - // String data source - if ("message" in options) { - const stringOptions = options; - commit = { - hash: stringOptions.hash, - ...parseCommitMessage(stringOptions.message), - author: stringOptions.author, - committer: stringOptions.committer, - }; - // GitHub data source - } - else if ("owner" in options) { - const githubOptions = options; - // TODO; implement basic GitHub client - commit = { - hash: githubOptions.hash, - subject: "", - }; - // Git data source - } - else { - const gitOptions = options; - commit = git.getCommitFromHash(gitOptions.hash, (_a = gitOptions.rootPath) !== null && _a !== void 0 ? _a : process.cwd()); - } - return commit; -} -exports.getCommit = getCommit; /***/ }), -/***/ 8436: +/***/ 1124: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -2268,101 +2301,162 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getConventionalCommit = exports.isConventionalCommit = exports.ConventionalCommitError = void 0; -const assert_1 = __importDefault(__nccwpck_require__(9491)); +exports.ConventionalCommit = void 0; +const diagnose_it_1 = __nccwpck_require__(4657); +const commit_1 = __nccwpck_require__(8065); const requirements = __importStar(__nccwpck_require__(4374)); /** - * Conventional Commit error - * @class ConventionalCommitError - * @extends Error + * Conventional Commit + * @class ConventionalCommit + * @member type Conventional Commit type + * @member scope Conventional Commit scope + * @member breaking Commit message has a Conventional Commit breaking change (!) + * @member description Conventional Commit description + * @member hash Commit hash + * @member subject Commit subject + * @member body Commit body + * @member footer Commit footer + * @member author Commit author and date + * @member committer Commit committer and date + * @member isValid Whether the Conventional Commit is valid * @member errors List of error messages + * @member warnings List of warning messages */ -class ConventionalCommitError extends Error { - constructor(errors) { - super("Commit is not compliant with the Conventional Commits specification."); - this.name = "ConventionalCommitError"; - this.errors = errors; +class ConventionalCommit { + _raw; + _errors = []; + _warnings = []; + constructor(raw, options) { + this._raw = raw; + this.validate(options); + } + /** + * Creates a new Conventional Commit object from the provided Commit. + * @param commit Commit to convert to a Conventional Commit + * @param options Options to use when validating the commit message + * @returns Conventional Commit + */ + static fromCommit(commit, options) { + // Convert the Commit message to Raw Conventional Commit data + const rawConvCommit = createRawConventionalCommit(commit); + // Create a new Conventional Commit object + return new ConventionalCommit(rawConvCommit, options); + } + /** + * Creates a new Conventional Commit object from the provided string. + * @param props Hash, message and author/committer information + * @param options Options to use when validating the commit message + * @returns Conventional Commit + */ + static fromString(props, options) { + return ConventionalCommit.fromCommit(commit_1.Commit.fromString(props), options); + } + /** + * Creates a new Conventional Commit object from the provided hash. + * @param props Hash and root path + * @param options Options to use when validating the commit message + * @returns Conventional Commit + */ + static fromHash(props, options) { + return ConventionalCommit.fromCommit(commit_1.Commit.fromHash(props), options); + } + // Contributors + get author() { + return this._raw.commit.author; + } + get committer() { + return this._raw.commit.committer; + } + // Commit + get hash() { + return this._raw.commit.hash; + } + get subject() { + return this._raw.commit.subject; + } + get body() { + return this._raw.commit.body; + } + get footer() { + return this._raw.commit.footer; + } + // Conventional Commit + get type() { + return this._raw.type.value; + } + get scope() { + return this._raw.scope.value; + } + get description() { + return this._raw.description.value; + } + get breaking() { + return (this._raw.breaking.value === "!" || + (this.footer !== undefined && ("BREAKING CHANGE" in this.footer || "BREAKING-CHANGE" in this.footer))); + } + // Raw + get raw() { + return this._raw.commit.raw; + } + // Validation + get isValid() { + return this._errors.length === 0; + } + get warnings() { + return this._warnings; + } + get errors() { + return this._errors; + } + toJSON() { + return { + hash: this.hash, + author: this.author, + committer: this.committer, + subject: this.subject, + body: this.body, + footer: this.footer, + type: this.type, + breaking: this.breaking, + description: this.description, + validation: { + isValid: this.isValid, + errors: this.errors, + warnings: this.warnings, + }, + }; + } + // Private validation function + validate(options) { + let results = []; + requirements.commitRules.forEach(rule => (results = [...results, ...rule.validate(this._raw, options)])); + this._errors = results.filter(r => r.level === diagnose_it_1.DiagnosticsLevelEnum.Error); + this._warnings = results.filter(r => r.level === diagnose_it_1.DiagnosticsLevelEnum.Warning); } } -exports.ConventionalCommitError = ConventionalCommitError; -/** - * Returns whether the provided commit has a breaking change (either "!" in subject, or usage of /BREAKING[- ]CHANGE:/). - * @param commit Commit to check - * @returns Whether the provided commit has a breaking change - */ -function hasBreakingChange(commit) { - return (commit.breaking.value === "!" || - (commit.commit.footer !== undefined && - ("BREAKING CHANGE" in commit.commit.footer || "BREAKING-CHANGE" in commit.commit.footer))); -} -/** - * Validates a commit message against the Conventional Commit specification. - * @param commit Commit message to validate against the Conventional Commit specification - * @returns Conventional Commit mesage - * @throws ExpressiveMessage[] if the commit message is not a valid Conventional Commit - * @see https://www.conventionalcommits.org/en/v1.0.0/ - */ -function validate(commit, options) { - let errors = []; - requirements.commitRules.forEach(rule => (errors = [...errors, ...rule.validate(commit, options)])); - if (errors.length > 0) - throw new ConventionalCommitError(errors); - // Assume that we have a valid Conventional Commit message - (0, assert_1.default)(commit.type.value); - (0, assert_1.default)(commit.description.value); - return { - ...commit.commit, - type: commit.type.value, - scope: commit.scope.value, - breaking: hasBreakingChange(commit), - description: commit.description.value, - }; -} -/** - * Returns whether the provided commit is a Conventional Commit. - * @param commit Commit to check - * @returns Whether the provided commit is a Conventional Commit - */ -function isConventionalCommit(commit) { - return "type" in commit; -} -exports.isConventionalCommit = isConventionalCommit; -/** - * Parses a Commit message into a Conventional Commit. - * @param commit Commit message to parse - * @param options Options to use when parsing the commit message - * @throws ExpressiveMessage[] if the commit message is not a valid Conventional Commit - * @returns Conventional Commit - */ -function getConventionalCommit(commit, options) { - var _a, _b, _c, _d, _e; +exports.ConventionalCommit = ConventionalCommit; +function createRawConventionalCommit(commit) { const ConventionalCommitRegex = new RegExp(/^(?[^(!:]*)(?\([^)]*\)\s*)?(?!\s*)?(?:\s*)?(?.*)?$/); - const match = ConventionalCommitRegex.exec(commit.subject); - let conventionalCommit = { + const match = ConventionalCommitRegex.exec(commit.subject.split(/\r?\n/)[0]); + const conventionalCommit = { commit: commit, - type: { index: 1, value: (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type }, - scope: { index: 1, value: (_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.scope }, - breaking: { index: 1, value: (_c = match === null || match === void 0 ? void 0 : match.groups) === null || _c === void 0 ? void 0 : _c.breaking }, - seperator: { index: 1, value: (_d = match === null || match === void 0 ? void 0 : match.groups) === null || _d === void 0 ? void 0 : _d.separator }, - description: { index: 1, value: (_e = match === null || match === void 0 ? void 0 : match.groups) === null || _e === void 0 ? void 0 : _e.subject }, + type: { index: 1, value: match?.groups?.type }, + scope: { index: 1, value: match?.groups?.scope }, + breaking: { index: 1, value: match?.groups?.breaking }, + seperator: { index: 1, value: match?.groups?.separator }, + description: { index: 1, value: match?.groups?.subject }, body: { index: 1, value: commit.body }, }; function intializeIndices(commit) { - var _a, _b, _c, _d, _e, _f, _g, _h; - commit.scope.index = commit.type.index + ((_b = (_a = commit.type.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); - commit.breaking.index = commit.scope.index + ((_d = (_c = commit.scope.value) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0); - commit.seperator.index = commit.breaking.index + ((_f = (_e = commit.breaking.value) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0); - commit.description.index = commit.seperator.index + ((_h = (_g = commit.seperator.value) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0); + commit.scope.index = commit.type.index + (commit.type.value?.length ?? 0); + commit.breaking.index = commit.scope.index + (commit.scope.value?.length ?? 0); + commit.seperator.index = commit.breaking.index + (commit.breaking.value?.length ?? 0); + commit.description.index = commit.seperator.index + (commit.seperator.value?.length ?? 0); return commit; } - conventionalCommit = intializeIndices(conventionalCommit); - return validate(conventionalCommit, options); + return intializeIndices(conventionalCommit); } -exports.getConventionalCommit = getConventionalCommit; /***/ }), @@ -2373,9 +2467,9 @@ exports.getConventionalCommit = getConventionalCommit; "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -2455,15 +2549,17 @@ function getValueFromKey(commit, key) { function parseCommitMessage(commit, hash) { const author = extractNameAndDate(getValueFromKey(commit, "author")); const committer = extractNameAndDate(getValueFromKey(commit, "committer")); + const raw = commit + .split(/^[\r\n]+/m) + .splice(1) + .join("\n") + .trim(); return { + raw, hash: hash, author: author, committer: committer, - ...ccommit.parseCommitMessage(commit - .split(/^[\r\n]+/m) - .splice(1) - .join("\n") - .trim()), + ...ccommit.parseCommitMessage(raw), }; } /** @@ -2605,17 +2701,15 @@ function readPackFile(path, index) { "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ConventionalCommitError = exports.isConventionalCommit = exports.getConventionalCommit = exports.getCommit = void 0; +exports.ConventionalCommit = exports.Commit = void 0; var commit_1 = __nccwpck_require__(8065); -Object.defineProperty(exports, "getCommit", ({ enumerable: true, get: function () { return commit_1.getCommit; } })); -var conventional_commit_1 = __nccwpck_require__(8436); -Object.defineProperty(exports, "getConventionalCommit", ({ enumerable: true, get: function () { return conventional_commit_1.getConventionalCommit; } })); -Object.defineProperty(exports, "isConventionalCommit", ({ enumerable: true, get: function () { return conventional_commit_1.isConventionalCommit; } })); -Object.defineProperty(exports, "ConventionalCommitError", ({ enumerable: true, get: function () { return conventional_commit_1.ConventionalCommitError; } })); +Object.defineProperty(exports, "Commit", ({ enumerable: true, get: function () { return commit_1.Commit; } })); +var conventionalCommit_1 = __nccwpck_require__(1124); +Object.defineProperty(exports, "ConventionalCommit", ({ enumerable: true, get: function () { return conventionalCommit_1.ConventionalCommit; } })); /***/ }), @@ -2631,13 +2725,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.commitRules = void 0; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong - -SPDX-License-Identifier: MIT -SPDX-License-Identifier: CC-BY-3.0 -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * + * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: CC-BY-3.0 + */ const diagnose_it_1 = __nccwpck_require__(4657); const chalk_1 = __importDefault(__nccwpck_require__(8818)); +const commit_1 = __nccwpck_require__(8065); function isNoun(str) { return !str.trim().includes(" ") && !/[^a-z]/i.test(str.trim()); } @@ -2650,29 +2745,30 @@ function highlightString(str, substring) { substring.forEach(sub => (result = result.replace(sub, `${chalk_1.default.cyan(sub)}`))); return result; } -function createError(commit, description, highlight, type, whitespace = false) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; +function createDiagnosticsMessage(commit, description, highlight, type, whitespace = false, level = diagnose_it_1.DiagnosticsLevelEnum.Error) { const element = commit[type]; let hintIndex = element.index; - let hintLength = (_b = (_a = element.value) === null || _a === void 0 ? void 0 : _a.trimEnd().length) !== null && _b !== void 0 ? _b : 1; + let hintLength = element.value?.trimEnd().length ?? 1; if (whitespace) { let prevElement = undefined; for (const [_key, value] of Object.entries(commit)) { - if (value.index > ((_c = prevElement === null || prevElement === void 0 ? void 0 : prevElement.index) !== null && _c !== void 0 ? _c : 0) && value.index < element.index) { + if (value.index > (prevElement?.index ?? 0) && value.index < element.index) { prevElement = value; } } - hintIndex = prevElement ? prevElement.index + ((_e = (_d = prevElement.value) === null || _d === void 0 ? void 0 : _d.trimEnd().length) !== null && _e !== void 0 ? _e : 1) : 1; - hintLength = ((_g = (_f = prevElement === null || prevElement === void 0 ? void 0 : prevElement.value) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 1) - ((_j = (_h = prevElement === null || prevElement === void 0 ? void 0 : prevElement.value) === null || _h === void 0 ? void 0 : _h.trimEnd().length) !== null && _j !== void 0 ? _j : 1); + hintIndex = prevElement ? prevElement.index + (prevElement.value?.trimEnd().length ?? 1) : 1; + hintLength = (prevElement?.value?.length ?? 1) - (prevElement?.value?.trimEnd().length ?? 1); } - return diagnose_it_1.DiagnosticsMessage.createError(commit.commit.hash, { - text: highlightString(description, highlight), - linenumber: 1, - column: hintIndex, + return new diagnose_it_1.DiagnosticsMessage({ + file: commit.commit.hash, + level, + message: { + text: highlightString(description, highlight), + linenumber: 1, + column: hintIndex, + }, }) - .setContext(1, commit.commit.body !== undefined && commit.commit.body.split("\n").length >= 1 - ? [commit.commit.subject, "", ...commit.commit.body.split("\n")] - : [commit.commit.subject]) + .setContext(1, commit.commit.subject.split(/\r?\n/)[0]) .addFixitHint(diagnose_it_1.FixItHint.create({ index: hintIndex, length: hintLength === 0 ? 1 : hintLength })); } /** @@ -2680,10 +2776,8 @@ function createError(commit, description, highlight, type, whitespace = false) { * followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space. */ class CC01 { - constructor() { - this.id = "CC-01"; - this.description = "Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space."; - } + id = "CC-01"; + description = "Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space."; validate(commit, _options) { const errors = []; // MUST be prefixed with a type @@ -2693,29 +2787,36 @@ class CC01 { else { // Ensure that we have a noun if (!isNoun(commit.type.value)) - errors.push(createError(commit, this.description, "which consists of a noun", "type")); + errors.push(createDiagnosticsMessage(commit, this.description, "which consists of a noun", "type")); // Validate for spacing after the type if (commit.type.value.trim() !== commit.type.value) { - if (commit.scope.value) - errors.push(createError(commit, this.description, "followed by the OPTIONAL scope", "scope", true)); - else if (commit.breaking.value) - errors.push(createError(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); - else - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + if (commit.scope.value) { + errors.push(createDiagnosticsMessage(commit, this.description, "followed by the OPTIONAL scope", "scope", true)); + } + else if (commit.breaking.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); + } + else { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + } } // Validate for spacing after the scope, breaking and seperator if (commit.scope.value && commit.scope.value.trim() !== commit.scope.value) { - if (commit.breaking.value) - errors.push(createError(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); - else - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + if (commit.breaking.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); + } + else { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + } + } + if (commit.breaking.value && commit.breaking.value.trim() !== commit.breaking.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); } - if (commit.breaking.value && commit.breaking.value.trim() !== commit.breaking.value) - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); } // MUST have a terminal colon - if (!commit.seperator.value) - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator")); + if (!commit.seperator.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator")); + } return errors; } } @@ -2724,16 +2825,14 @@ class CC01 { * a section of the codebase surrounded by parenthesis, e.g., fix(parser): */ class CC04 { - constructor() { - this.id = "CC-04"; - this.description = "A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):"; - } + id = "CC-04"; + description = "A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):"; validate(commit, _options) { const errors = []; if (commit.scope.value && (commit.scope.value === "()" || !isNoun(commit.scope.value.trimEnd().substring(1, commit.scope.value.trimEnd().length - 1)))) { - errors.push(createError(commit, this.description, "A scope MUST consist of a noun", "scope")); + errors.push(createDiagnosticsMessage(commit, this.description, "A scope MUST consist of a noun", "scope")); } return errors; } @@ -2744,17 +2843,73 @@ class CC04 { * when multiple spaces were contained in string. */ class CC05 { - constructor() { - this.id = "CC-05"; - this.description = "A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., fix: array parsing issue when multiple spaces were contained in string."; - } + id = "CC-05"; + description = "A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., fix: array parsing issue when multiple spaces were contained in string."; validate(commit, _options) { const errors = []; - if (!commit.seperator.value) + if (!commit.seperator.value) { return errors; + } if (commit.description.value === undefined || - commit.seperator.value.length - commit.seperator.value.trim().length !== 1) - errors.push(createError(commit, this.description, "A description MUST immediately follow the colon and space", "description", true)); + commit.seperator.value.length - commit.seperator.value.trim().length !== 1) { + errors.push(createDiagnosticsMessage(commit, this.description, "A description MUST immediately follow the colon and space", "description", true)); + } + return errors; + } +} +/** + * A longer commit body MAY be provided after the short description, providing + * additional contextual information about the code changes. The body MUST begin one + * blank line after the description. + */ +class CC06 { + id = "CC-06"; + description = "A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description."; + validate(commit, _options) { + const errors = []; + if (!commit.commit.subject) { + return errors; + } + const lines = commit.commit.subject.split(/\r?\n/); + if (lines.length > 1) { + return [ + diagnose_it_1.DiagnosticsMessage.createError(commit.commit.hash, { + text: highlightString(this.description, "The body MUST begin one blank line after the description"), + linenumber: 2, + column: 1, + }) + .setContext(1, lines) + .addFixitHint(diagnose_it_1.FixItHint.createRemoval({ index: 1, length: lines[1].length })), + ]; + } + return errors; + } +} +/** + * The units of information that make up Conventional Commits MUST NOT be treated as case + * sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase. + */ +class CC15 { + id = "CC-15"; + description = "The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase."; + validate(commit, _options) { + const errors = []; + const footerElements = (0, commit_1.getFooterElementsFromParagraph)(commit.commit.raw); + if (footerElements === undefined) + return errors; + for (const element of footerElements) { + if (["BREAKING CHANGE", "BREAKING-CHANGE"].includes(element.key.toUpperCase())) { + if (element.key !== element.key.toUpperCase()) { + errors.push(diagnose_it_1.DiagnosticsMessage.createError(commit.commit.hash, { + text: highlightString(this.description, "BREAKING CHANGE MUST be uppercase"), + linenumber: element.lineNumber, + column: 1, + }) + .setContext(element.lineNumber, commit.commit.raw.split(/\r?\n/)[element.lineNumber - 1]) + .addFixitHint(diagnose_it_1.FixItHint.create({ index: 1, length: element.key.length }))); + } + } + } return errors; } } @@ -2762,20 +2917,19 @@ class CC05 { * A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis */ class EC01 { - constructor() { - this.id = "EC-01"; - this.description = "A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis"; - } + id = "EC-01"; + description = "A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis"; validate(commit, options) { - var _a; - const uniqueScopeList = Array.from(new Set((_a = options === null || options === void 0 ? void 0 : options.scopes) !== null && _a !== void 0 ? _a : [])); - if (uniqueScopeList.length === 0) + const uniqueScopeList = Array.from(new Set(options?.scopes ?? [])); + if (uniqueScopeList.length === 0) { return []; - if (commit.scope.value === undefined || uniqueScopeList.includes(commit.scope.value.replace(/[()]+/g, ""))) + } + if (commit.scope.value === undefined || uniqueScopeList.includes(commit.scope.value.replace(/[()]+/g, ""))) { return []; + } this.description = `A scope MAY be provided after a type. A scope MUST consist of one of the configured values (${uniqueScopeList.join(", ")}) surrounded by parenthesis`; return [ - createError(commit, this.description, ["A scope MUST consist of", `(${uniqueScopeList.join(", ")})`], "scope"), + createDiagnosticsMessage(commit, this.description, ["A scope MUST consist of", `(${uniqueScopeList.join(", ")})`], "scope"), ]; } } @@ -2783,33 +2937,74 @@ class EC01 { * Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...) */ class EC02 { - constructor() { - this.id = "EC-02"; - this.description = "Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...)"; - } + id = "EC-02"; + description = "Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...)"; validate(commit, options) { - var _a; - const uniqueAddedTypes = new Set((_a = options === null || options === void 0 ? void 0 : options.types) !== null && _a !== void 0 ? _a : []); + const uniqueAddedTypes = new Set(options?.types ?? []); if (uniqueAddedTypes.has("feat")) uniqueAddedTypes.delete("feat"); if (uniqueAddedTypes.has("fix")) uniqueAddedTypes.delete("fix"); const expectedTypes = ["feat", "fix", ...Array.from(uniqueAddedTypes)]; - this.description = `Commits MUST be prefixed with a type, which consists of one of the configured values (${expectedTypes.join(", ")}).`; + this.description = `Commits ${uniqueAddedTypes.size > 0 ? "MUST" : "MAY"} be prefixed with a type, which consists of one of the configured values (${expectedTypes.join(", ")}).`; if (commit.type.value === undefined || !isNoun(commit.type.value) || - expectedTypes.includes(commit.type.value.trimEnd())) + expectedTypes.includes(commit.type.value.toLowerCase().trimEnd())) { return []; + } if (commit.type.value.trim().length === 0) { - return [createError(commit, this.description, "prefixed with a type", "type")]; + return [createDiagnosticsMessage(commit, this.description, "prefixed with a type", "type")]; + } + if (uniqueAddedTypes.size > 0) { + return [ + createDiagnosticsMessage(commit, this.description, ["prefixed with a type, which consists of", `(${expectedTypes.join(", ")})`], "type"), + ]; + } + else { + return [ + createDiagnosticsMessage(commit, this.description, ["prefixed with a type, which consists of", `(${expectedTypes.join(", ")})`], "type", false, diagnose_it_1.DiagnosticsLevelEnum.Warning), + ]; } - return [ - createError(commit, this.description, ["prefixed with a type, which consists of", `(${expectedTypes.join(", ")})`], "type"), - ]; + } +} +/** + * A `BREAKING CHANGE` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer. + */ +class WA01 { + id = "WA-01"; + description = "A `BREAKING CHANGE` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer."; + validate(commit, _options) { + const errors = []; + if (commit.commit.body === undefined) + return errors; + const elements = (0, commit_1.getFooterElementsFromParagraph)(commit.commit.body); + if (elements === undefined) + return errors; + for (const element of elements) { + if (element.key === "BREAKING CHANGE" || element.key === "BREAKING-CHANGE") { + errors.push(diagnose_it_1.DiagnosticsMessage.createWarning(commit.commit.hash, { + text: highlightString(`A \`${element.key}\` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer.`, [element.key, "will be ignored as it MUST be included in the footer"]), + linenumber: commit.commit.subject.split(/\r?\n/).length + element.lineNumber, + column: 1, + }) + .setContext(commit.commit.subject.split(/\r?\n/).length + 1, commit.commit.body.split(/\r?\n/)) + .addFixitHint(diagnose_it_1.FixItHint.create({ index: 1, length: element.key.length }))); + } + } + return errors; } } /** @internal */ -exports.commitRules = [new CC01(), new CC04(), new CC05(), new EC01(), new EC02()]; +exports.commitRules = [ + new CC01(), + new CC04(), + new CC05(), + new CC06(), + new CC15(), + new EC01(), + new EC02(), + new WA01(), +]; /***/ }), @@ -41011,7 +41206,7 @@ class FileSource { } } async getCommitMessages() { - return [(0, commit_it_1.getCommit)({ hash: "HEAD", message: fs.readFileSync(this.file, "utf8") })]; + return [commit_it_1.Commit.fromString({ hash: "HEAD", message: fs.readFileSync(this.file, "utf8") })]; } async getConfigurationFile(path) { if (!fs.existsSync(path)) { @@ -41031,7 +41226,7 @@ class GitSource { } async getCommitMessages() { const data = await (0, simple_git_1.simpleGit)().log({ from: this.sourceBranch, to: "@{push}" }); - return data.all.map(commit => (0, commit_it_1.getCommit)({ hash: commit.hash })); + return data.all.map(commit => commit_it_1.Commit.fromHash({ hash: commit.hash })); } async getConfigurationFile(path) { if (!fs.existsSync(path)) { @@ -41050,13 +41245,10 @@ class GitHubSource { const pullRequestNumber = github.context.payload.pull_request?.number; (0, assert_1.default)(pullRequestNumber); const commits = await octokit.rest.pulls.listCommits({ ...github.context.repo, pull_number: pullRequestNumber }); - return commits.data.map(commit => { - return { - hash: commit.sha, - subject: commit.commit.message.split(/\r?\n/)[0], - body: commit.commit.message.split(/\r?\n/).slice(2).join("\n"), - }; - }); + return commits.data.map(commit => commit_it_1.Commit.fromString({ + hash: commit.sha, + message: commit.commit.message, + })); } /** * Retrieves the specified configuration file from the repository using the REST API @@ -41141,14 +41333,13 @@ const validator_1 = __nccwpck_require__(4630); const determineLabel = async (commits) => { let type; for (const commit of commits) { - if (!(0, commit_it_1.isConventionalCommit)(commit.commit)) + if (!commit.isValid) continue; - const convCommit = commit.commit; - if (convCommit.breaking) + if (commit.breaking) return "breaking"; - if (convCommit.type === "feat") + if (commit.type?.toLowerCase() === "feat") type = "feature"; - else if (convCommit.type === "fix" && type !== "feature") + else if (commit.type?.toLowerCase() === "fix" && type !== "feature") type = "fix"; } return type; @@ -41160,12 +41351,15 @@ const determineLabel = async (commits) => { */ const reportErrorMessages = (results) => { let errorCount = 0; + let warningCount = 0; for (const commit of results) { - core.info(`${commit.errors.length === 0 ? "✅" : "❌"} ${commit.commit.hash}: ${commit.commit.subject}`); - commit.errors.forEach(error => core.error(error, { title: "Conventional Commit Compliance" })); + core.info(`${commit.errors.length === 0 ? "✅" : "❌"} ${commit.hash}: ${commit.subject}`); + commit.errors.forEach(error => core.error(error.toString(), { title: "Conventional Commit Compliance" })); errorCount += commit.errors.length; + commit.warnings.forEach(warning => core.warning(warning.toString(), { title: "Conventional Commit Compliance" })); + warningCount += commit.warnings.length; } - return errorCount; + return { errors: errorCount, warnings: warningCount }; }; const setConfiguration = async (dataSource) => { (0, assert_1.default)(github.context.payload.pull_request); @@ -41212,27 +41406,34 @@ async function run() { // Gathering commit message information const resultCommits = (0, validator_1.validateCommits)(commits); let errorCount = 0; + let warningCount = 0; const allResults = [...resultCommits]; if (config.includePullRequest === true) { core.startGroup(`🔎 Scanning Pull Request`); - const resultPullrequest = (0, validator_1.validatePullRequest)({ + const resultPullrequest = (0, validator_1.validatePullRequest)(commit_it_1.Commit.fromString({ hash: `#${github.context.payload.pull_request.number}`, - subject: github.context.payload.pull_request.title, - body: github.context.payload.pull_request.body ?? "", - }, resultCommits.map(commit => commit.commit).filter(commit => commit !== undefined)); + message: [github.context.payload.pull_request.title, "", github.context.payload.pull_request.body].join("\n"), + }), allResults); allResults.push(resultPullrequest); - errorCount += reportErrorMessages([resultPullrequest]); + const counts = reportErrorMessages([resultPullrequest]); + errorCount += counts.errors; + warningCount += counts.warnings; core.endGroup(); } if (config.includeCommits === true) { core.startGroup("🔎 Scanning Commits associated with Pull Request"); - errorCount += reportErrorMessages(resultCommits); + const counts = reportErrorMessages(resultCommits); + errorCount += counts.errors; + warningCount += counts.warnings; core.endGroup(); } if (errorCount > 0) { - core.setFailed(`❌ Found ${errorCount} Conventional Commits compliance issues.`); + core.setFailed(`❌ Found ${errorCount} Conventional Commit compliance issues, and ${warningCount} warnings.`); return; } + else if (warningCount > 0) { + core.warning(`⚠️ Found ${warningCount} Conventional Commit compliance warnings.`); + } // Updating the pull request label if (githubToken === undefined) { core.warning("⚠️ The token input is required to update the pull request label."); @@ -41408,16 +41609,7 @@ const configuration_1 = __nccwpck_require__(5778); * @returns Validation result */ function validateCommit(commit) { - const result = { commit: commit, errors: [] }; - try { - result.commit = (0, commit_it_1.getConventionalCommit)(commit, configuration_1.Configuration.getInstance()); - } - catch (error) { - if (!(error instanceof commit_it_1.ConventionalCommitError)) - throw error; - error.errors.forEach(e => result.errors.push(e.toString())); - } - return result; + return commit_it_1.ConventionalCommit.fromCommit(commit, configuration_1.Configuration.getInstance()); } /** * Validates the pull request against CommitMe requirements. @@ -41427,27 +41619,28 @@ function validateCommit(commit) { */ function validatePullRequest(pullrequest, commits) { const result = validateCommit(pullrequest); - if (result.errors.length > 0) + if (!result.isValid) return result; const orderValue = (commit) => { - if (!commit || !("type" in commit)) - return 0; if (commit.breaking) return 3; - if (commit.type === "feat") + if (commit.type?.toLowerCase() === "feat") return 2; - if (commit.type === "fix") + if (commit.type?.toLowerCase() === "fix") return 1; return 0; }; - const pullRequestValue = orderValue(result.commit); - const commitsValue = orderValue(commits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); + const pullRequestValue = orderValue(result); + const validConventionalCommits = commits.filter(commit => commit.isValid); + const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { - result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.commit.hash, { + result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.hash, { text: `A Pull Request title MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, linenumber: 1, column: 1, - }).toString()); + }) + .setContext(1, result.subject) + .addFixitHint(diagnose_it_1.FixItHint.create({ index: 1, length: result.type?.length ?? 1 }))); } return result; } diff --git a/lib/cli/index.js b/lib/cli/index.js index 65fbe70..ab721cb 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -2094,9 +2094,9 @@ function isLoopbackAddress(host) { "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -2121,8 +2121,75 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getCommit = exports.isConventionalCommit = exports.parseCommitMessage = void 0; +exports.parseCommitMessage = exports.getFooterElementsFromParagraph = exports.Commit = void 0; const git = __importStar(__nccwpck_require__(8433)); +const TRAILER_REGEX = /^((BREAKING CHANGE:)|([\w-]+(:| #))|([ \t]+)\w*)/i; +/** + * Git Commit + * @class Commit + * @member author The commit author and date + * @member commiter The commit commiter and date + * @member hash The commit hash + * @member subject The commit subject + * @member body The commit body + * @member footer The commit footer + * @member raw The commit message + */ +class Commit { + _commit; + constructor(commit) { + this._commit = commit; + } + /** + * Retrieves the commit information from git using the provided hash + * @param props The commit hash and root path + * @returns The commit object + */ + static fromHash(props) { + const commit = git.getCommitFromHash(props.hash, props.rootPath ?? process.cwd()); + return new Commit(commit); + } + /** + * Creates a Commit object from the provided string + * @param props The commit hash, author, committer and message + * @returns The commit object + */ + static fromString(props) { + const commit = { + hash: props.hash, + ...parseCommitMessage(props.message), + author: props.author, + committer: props.committer, + raw: props.message, + }; + return new Commit(commit); + } + get author() { + return this._commit.author; + } + get committer() { + return this._commit.committer; + } + get hash() { + return this._commit.hash; + } + get subject() { + return this._commit.subject; + } + get body() { + return this._commit.body; + } + get footer() { + return this._commit.footer; + } + get raw() { + return this._commit.raw; + } + toJSON() { + return this._commit; + } +} +exports.Commit = Commit; /** * Returns a dictionary containing key-value pairs extracted from the footer of the provided commit message. * The key must either be: @@ -2132,13 +2199,15 @@ const git = __importStar(__nccwpck_require__(8433)); * The value is either: * - the remainder of the line * - the remainder of the line + anything that follows on the next lines which is indented by at least one space + * + * @internal */ -function parseCommitFooter(footer) { - const footerLines = footer.split(/[\r\n]+/); - const result = {}; +function getFooterElementsFromParagraph(footer) { + const footerLines = footer.split(/\r?\n/); + const result = []; for (let lineNr = 0; lineNr < footerLines.length; lineNr++) { const line = footerLines[lineNr]; - const match = /^((BREAKING CHANGE:)|([\w-]+(:| #))|([ \t]+)\w)/.exec(line); + const match = TRAILER_REGEX.exec(line); if (match === null) continue; let key = match[1].replace(/:$/, ""); @@ -2147,15 +2216,22 @@ function parseCommitFooter(footer) { key = match[1].substring(0, match[1].length - 2); value = `#${value}`; } + const matchLine = lineNr; // Check if the value continues on the next line - while (lineNr + 1 < footerLines.length && footerLines[lineNr + 1].startsWith(" ")) { + while (lineNr + 1 < footerLines.length && + (/^\s/.test(footerLines[lineNr + 1]) || footerLines[lineNr + 1].length === 0)) { lineNr++; value += "\n" + footerLines[lineNr].trim(); } - result[key] = value; + result.push({ + lineNumber: matchLine + 1, + key, + value, + }); } return Object.keys(result).length > 0 ? result : undefined; } +exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; /** * Parses the provided commit message (full message, not just the subject) into * a Commit object. @@ -2164,11 +2240,11 @@ function parseCommitFooter(footer) { * @internal */ function parseCommitMessage(message) { - const isTrailerOnly = (message) => message.split(/[\r\n]+/).every(line => { - const match = /^((BREAKING CHANGE:)|([\w-]+(:| #))|([ \t]+)\w)/.exec(line); + const isTrailerOnly = (message) => message.split(/\r?\n/).every(line => { + const match = TRAILER_REGEX.exec(line); return match !== null; }); - const paragraphs = message.split(/^[\r\n]+/m); + const paragraphs = message.split(/^\r?\n/m); let footer = undefined; let body = undefined; if (paragraphs.length > 1 && isTrailerOnly(paragraphs[paragraphs.length - 1])) { @@ -2183,69 +2259,26 @@ function parseCommitMessage(message) { return { subject: paragraphs[0].trim(), body: body, - footer: parseCommitFooter(footer !== null && footer !== void 0 ? footer : ""), + footer: getFooterElementsFromParagraph(footer ?? "")?.reduce((acc, cur) => { + acc[cur.key] = cur.value; + return acc; + }, {}), }; } exports.parseCommitMessage = parseCommitMessage; -/** - * Confirms whether the provided commit is a Conventional Commit - * @param commit - * @returns - */ -function isConventionalCommit(commit) { - return "type" in commit; -} -exports.isConventionalCommit = isConventionalCommit; -/** - * Retrieves the commit message (from the indicated source) given the provided SHA hash - * @param hash SHA of the commit - * @param source The data source to retrieve the commit message from (git or github) - * @param options The options to use when retrieving the commit message - * @returns Commit object - */ -function getCommit(options) { - var _a; - let commit; - // String data source - if ("message" in options) { - const stringOptions = options; - commit = { - hash: stringOptions.hash, - ...parseCommitMessage(stringOptions.message), - author: stringOptions.author, - committer: stringOptions.committer, - }; - // GitHub data source - } - else if ("owner" in options) { - const githubOptions = options; - // TODO; implement basic GitHub client - commit = { - hash: githubOptions.hash, - subject: "", - }; - // Git data source - } - else { - const gitOptions = options; - commit = git.getCommitFromHash(gitOptions.hash, (_a = gitOptions.rootPath) !== null && _a !== void 0 ? _a : process.cwd()); - } - return commit; -} -exports.getCommit = getCommit; /***/ }), -/***/ 8436: +/***/ 1124: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -2269,101 +2302,162 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getConventionalCommit = exports.isConventionalCommit = exports.ConventionalCommitError = void 0; -const assert_1 = __importDefault(__nccwpck_require__(9491)); +exports.ConventionalCommit = void 0; +const diagnose_it_1 = __nccwpck_require__(4657); +const commit_1 = __nccwpck_require__(8065); const requirements = __importStar(__nccwpck_require__(4374)); /** - * Conventional Commit error - * @class ConventionalCommitError - * @extends Error + * Conventional Commit + * @class ConventionalCommit + * @member type Conventional Commit type + * @member scope Conventional Commit scope + * @member breaking Commit message has a Conventional Commit breaking change (!) + * @member description Conventional Commit description + * @member hash Commit hash + * @member subject Commit subject + * @member body Commit body + * @member footer Commit footer + * @member author Commit author and date + * @member committer Commit committer and date + * @member isValid Whether the Conventional Commit is valid * @member errors List of error messages + * @member warnings List of warning messages */ -class ConventionalCommitError extends Error { - constructor(errors) { - super("Commit is not compliant with the Conventional Commits specification."); - this.name = "ConventionalCommitError"; - this.errors = errors; +class ConventionalCommit { + _raw; + _errors = []; + _warnings = []; + constructor(raw, options) { + this._raw = raw; + this.validate(options); + } + /** + * Creates a new Conventional Commit object from the provided Commit. + * @param commit Commit to convert to a Conventional Commit + * @param options Options to use when validating the commit message + * @returns Conventional Commit + */ + static fromCommit(commit, options) { + // Convert the Commit message to Raw Conventional Commit data + const rawConvCommit = createRawConventionalCommit(commit); + // Create a new Conventional Commit object + return new ConventionalCommit(rawConvCommit, options); + } + /** + * Creates a new Conventional Commit object from the provided string. + * @param props Hash, message and author/committer information + * @param options Options to use when validating the commit message + * @returns Conventional Commit + */ + static fromString(props, options) { + return ConventionalCommit.fromCommit(commit_1.Commit.fromString(props), options); + } + /** + * Creates a new Conventional Commit object from the provided hash. + * @param props Hash and root path + * @param options Options to use when validating the commit message + * @returns Conventional Commit + */ + static fromHash(props, options) { + return ConventionalCommit.fromCommit(commit_1.Commit.fromHash(props), options); + } + // Contributors + get author() { + return this._raw.commit.author; + } + get committer() { + return this._raw.commit.committer; + } + // Commit + get hash() { + return this._raw.commit.hash; + } + get subject() { + return this._raw.commit.subject; + } + get body() { + return this._raw.commit.body; + } + get footer() { + return this._raw.commit.footer; + } + // Conventional Commit + get type() { + return this._raw.type.value; + } + get scope() { + return this._raw.scope.value; + } + get description() { + return this._raw.description.value; + } + get breaking() { + return (this._raw.breaking.value === "!" || + (this.footer !== undefined && ("BREAKING CHANGE" in this.footer || "BREAKING-CHANGE" in this.footer))); + } + // Raw + get raw() { + return this._raw.commit.raw; + } + // Validation + get isValid() { + return this._errors.length === 0; + } + get warnings() { + return this._warnings; + } + get errors() { + return this._errors; + } + toJSON() { + return { + hash: this.hash, + author: this.author, + committer: this.committer, + subject: this.subject, + body: this.body, + footer: this.footer, + type: this.type, + breaking: this.breaking, + description: this.description, + validation: { + isValid: this.isValid, + errors: this.errors, + warnings: this.warnings, + }, + }; + } + // Private validation function + validate(options) { + let results = []; + requirements.commitRules.forEach(rule => (results = [...results, ...rule.validate(this._raw, options)])); + this._errors = results.filter(r => r.level === diagnose_it_1.DiagnosticsLevelEnum.Error); + this._warnings = results.filter(r => r.level === diagnose_it_1.DiagnosticsLevelEnum.Warning); } } -exports.ConventionalCommitError = ConventionalCommitError; -/** - * Returns whether the provided commit has a breaking change (either "!" in subject, or usage of /BREAKING[- ]CHANGE:/). - * @param commit Commit to check - * @returns Whether the provided commit has a breaking change - */ -function hasBreakingChange(commit) { - return (commit.breaking.value === "!" || - (commit.commit.footer !== undefined && - ("BREAKING CHANGE" in commit.commit.footer || "BREAKING-CHANGE" in commit.commit.footer))); -} -/** - * Validates a commit message against the Conventional Commit specification. - * @param commit Commit message to validate against the Conventional Commit specification - * @returns Conventional Commit mesage - * @throws ExpressiveMessage[] if the commit message is not a valid Conventional Commit - * @see https://www.conventionalcommits.org/en/v1.0.0/ - */ -function validate(commit, options) { - let errors = []; - requirements.commitRules.forEach(rule => (errors = [...errors, ...rule.validate(commit, options)])); - if (errors.length > 0) - throw new ConventionalCommitError(errors); - // Assume that we have a valid Conventional Commit message - (0, assert_1.default)(commit.type.value); - (0, assert_1.default)(commit.description.value); - return { - ...commit.commit, - type: commit.type.value, - scope: commit.scope.value, - breaking: hasBreakingChange(commit), - description: commit.description.value, - }; -} -/** - * Returns whether the provided commit is a Conventional Commit. - * @param commit Commit to check - * @returns Whether the provided commit is a Conventional Commit - */ -function isConventionalCommit(commit) { - return "type" in commit; -} -exports.isConventionalCommit = isConventionalCommit; -/** - * Parses a Commit message into a Conventional Commit. - * @param commit Commit message to parse - * @param options Options to use when parsing the commit message - * @throws ExpressiveMessage[] if the commit message is not a valid Conventional Commit - * @returns Conventional Commit - */ -function getConventionalCommit(commit, options) { - var _a, _b, _c, _d, _e; +exports.ConventionalCommit = ConventionalCommit; +function createRawConventionalCommit(commit) { const ConventionalCommitRegex = new RegExp(/^(?[^(!:]*)(?\([^)]*\)\s*)?(?!\s*)?(?:\s*)?(?.*)?$/); - const match = ConventionalCommitRegex.exec(commit.subject); - let conventionalCommit = { + const match = ConventionalCommitRegex.exec(commit.subject.split(/\r?\n/)[0]); + const conventionalCommit = { commit: commit, - type: { index: 1, value: (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type }, - scope: { index: 1, value: (_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.scope }, - breaking: { index: 1, value: (_c = match === null || match === void 0 ? void 0 : match.groups) === null || _c === void 0 ? void 0 : _c.breaking }, - seperator: { index: 1, value: (_d = match === null || match === void 0 ? void 0 : match.groups) === null || _d === void 0 ? void 0 : _d.separator }, - description: { index: 1, value: (_e = match === null || match === void 0 ? void 0 : match.groups) === null || _e === void 0 ? void 0 : _e.subject }, + type: { index: 1, value: match?.groups?.type }, + scope: { index: 1, value: match?.groups?.scope }, + breaking: { index: 1, value: match?.groups?.breaking }, + seperator: { index: 1, value: match?.groups?.separator }, + description: { index: 1, value: match?.groups?.subject }, body: { index: 1, value: commit.body }, }; function intializeIndices(commit) { - var _a, _b, _c, _d, _e, _f, _g, _h; - commit.scope.index = commit.type.index + ((_b = (_a = commit.type.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); - commit.breaking.index = commit.scope.index + ((_d = (_c = commit.scope.value) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0); - commit.seperator.index = commit.breaking.index + ((_f = (_e = commit.breaking.value) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0); - commit.description.index = commit.seperator.index + ((_h = (_g = commit.seperator.value) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0); + commit.scope.index = commit.type.index + (commit.type.value?.length ?? 0); + commit.breaking.index = commit.scope.index + (commit.scope.value?.length ?? 0); + commit.seperator.index = commit.breaking.index + (commit.breaking.value?.length ?? 0); + commit.description.index = commit.seperator.index + (commit.seperator.value?.length ?? 0); return commit; } - conventionalCommit = intializeIndices(conventionalCommit); - return validate(conventionalCommit, options); + return intializeIndices(conventionalCommit); } -exports.getConventionalCommit = getConventionalCommit; /***/ }), @@ -2374,9 +2468,9 @@ exports.getConventionalCommit = getConventionalCommit; "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -2456,15 +2550,17 @@ function getValueFromKey(commit, key) { function parseCommitMessage(commit, hash) { const author = extractNameAndDate(getValueFromKey(commit, "author")); const committer = extractNameAndDate(getValueFromKey(commit, "committer")); + const raw = commit + .split(/^[\r\n]+/m) + .splice(1) + .join("\n") + .trim(); return { + raw, hash: hash, author: author, committer: committer, - ...ccommit.parseCommitMessage(commit - .split(/^[\r\n]+/m) - .splice(1) - .join("\n") - .trim()), + ...ccommit.parseCommitMessage(raw), }; } /** @@ -2606,17 +2702,15 @@ function readPackFile(path, index) { "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ConventionalCommitError = exports.isConventionalCommit = exports.getConventionalCommit = exports.getCommit = void 0; +exports.ConventionalCommit = exports.Commit = void 0; var commit_1 = __nccwpck_require__(8065); -Object.defineProperty(exports, "getCommit", ({ enumerable: true, get: function () { return commit_1.getCommit; } })); -var conventional_commit_1 = __nccwpck_require__(8436); -Object.defineProperty(exports, "getConventionalCommit", ({ enumerable: true, get: function () { return conventional_commit_1.getConventionalCommit; } })); -Object.defineProperty(exports, "isConventionalCommit", ({ enumerable: true, get: function () { return conventional_commit_1.isConventionalCommit; } })); -Object.defineProperty(exports, "ConventionalCommitError", ({ enumerable: true, get: function () { return conventional_commit_1.ConventionalCommitError; } })); +Object.defineProperty(exports, "Commit", ({ enumerable: true, get: function () { return commit_1.Commit; } })); +var conventionalCommit_1 = __nccwpck_require__(1124); +Object.defineProperty(exports, "ConventionalCommit", ({ enumerable: true, get: function () { return conventionalCommit_1.ConventionalCommit; } })); /***/ }), @@ -2632,13 +2726,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.commitRules = void 0; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong - -SPDX-License-Identifier: MIT -SPDX-License-Identifier: CC-BY-3.0 -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * + * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: CC-BY-3.0 + */ const diagnose_it_1 = __nccwpck_require__(4657); const chalk_1 = __importDefault(__nccwpck_require__(8818)); +const commit_1 = __nccwpck_require__(8065); function isNoun(str) { return !str.trim().includes(" ") && !/[^a-z]/i.test(str.trim()); } @@ -2651,29 +2746,30 @@ function highlightString(str, substring) { substring.forEach(sub => (result = result.replace(sub, `${chalk_1.default.cyan(sub)}`))); return result; } -function createError(commit, description, highlight, type, whitespace = false) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; +function createDiagnosticsMessage(commit, description, highlight, type, whitespace = false, level = diagnose_it_1.DiagnosticsLevelEnum.Error) { const element = commit[type]; let hintIndex = element.index; - let hintLength = (_b = (_a = element.value) === null || _a === void 0 ? void 0 : _a.trimEnd().length) !== null && _b !== void 0 ? _b : 1; + let hintLength = element.value?.trimEnd().length ?? 1; if (whitespace) { let prevElement = undefined; for (const [_key, value] of Object.entries(commit)) { - if (value.index > ((_c = prevElement === null || prevElement === void 0 ? void 0 : prevElement.index) !== null && _c !== void 0 ? _c : 0) && value.index < element.index) { + if (value.index > (prevElement?.index ?? 0) && value.index < element.index) { prevElement = value; } } - hintIndex = prevElement ? prevElement.index + ((_e = (_d = prevElement.value) === null || _d === void 0 ? void 0 : _d.trimEnd().length) !== null && _e !== void 0 ? _e : 1) : 1; - hintLength = ((_g = (_f = prevElement === null || prevElement === void 0 ? void 0 : prevElement.value) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 1) - ((_j = (_h = prevElement === null || prevElement === void 0 ? void 0 : prevElement.value) === null || _h === void 0 ? void 0 : _h.trimEnd().length) !== null && _j !== void 0 ? _j : 1); + hintIndex = prevElement ? prevElement.index + (prevElement.value?.trimEnd().length ?? 1) : 1; + hintLength = (prevElement?.value?.length ?? 1) - (prevElement?.value?.trimEnd().length ?? 1); } - return diagnose_it_1.DiagnosticsMessage.createError(commit.commit.hash, { - text: highlightString(description, highlight), - linenumber: 1, - column: hintIndex, + return new diagnose_it_1.DiagnosticsMessage({ + file: commit.commit.hash, + level, + message: { + text: highlightString(description, highlight), + linenumber: 1, + column: hintIndex, + }, }) - .setContext(1, commit.commit.body !== undefined && commit.commit.body.split("\n").length >= 1 - ? [commit.commit.subject, "", ...commit.commit.body.split("\n")] - : [commit.commit.subject]) + .setContext(1, commit.commit.subject.split(/\r?\n/)[0]) .addFixitHint(diagnose_it_1.FixItHint.create({ index: hintIndex, length: hintLength === 0 ? 1 : hintLength })); } /** @@ -2681,10 +2777,8 @@ function createError(commit, description, highlight, type, whitespace = false) { * followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space. */ class CC01 { - constructor() { - this.id = "CC-01"; - this.description = "Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space."; - } + id = "CC-01"; + description = "Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space."; validate(commit, _options) { const errors = []; // MUST be prefixed with a type @@ -2694,29 +2788,36 @@ class CC01 { else { // Ensure that we have a noun if (!isNoun(commit.type.value)) - errors.push(createError(commit, this.description, "which consists of a noun", "type")); + errors.push(createDiagnosticsMessage(commit, this.description, "which consists of a noun", "type")); // Validate for spacing after the type if (commit.type.value.trim() !== commit.type.value) { - if (commit.scope.value) - errors.push(createError(commit, this.description, "followed by the OPTIONAL scope", "scope", true)); - else if (commit.breaking.value) - errors.push(createError(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); - else - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + if (commit.scope.value) { + errors.push(createDiagnosticsMessage(commit, this.description, "followed by the OPTIONAL scope", "scope", true)); + } + else if (commit.breaking.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); + } + else { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + } } // Validate for spacing after the scope, breaking and seperator if (commit.scope.value && commit.scope.value.trim() !== commit.scope.value) { - if (commit.breaking.value) - errors.push(createError(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); - else - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + if (commit.breaking.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); + } + else { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + } + } + if (commit.breaking.value && commit.breaking.value.trim() !== commit.breaking.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); } - if (commit.breaking.value && commit.breaking.value.trim() !== commit.breaking.value) - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); } // MUST have a terminal colon - if (!commit.seperator.value) - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator")); + if (!commit.seperator.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator")); + } return errors; } } @@ -2725,16 +2826,14 @@ class CC01 { * a section of the codebase surrounded by parenthesis, e.g., fix(parser): */ class CC04 { - constructor() { - this.id = "CC-04"; - this.description = "A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):"; - } + id = "CC-04"; + description = "A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):"; validate(commit, _options) { const errors = []; if (commit.scope.value && (commit.scope.value === "()" || !isNoun(commit.scope.value.trimEnd().substring(1, commit.scope.value.trimEnd().length - 1)))) { - errors.push(createError(commit, this.description, "A scope MUST consist of a noun", "scope")); + errors.push(createDiagnosticsMessage(commit, this.description, "A scope MUST consist of a noun", "scope")); } return errors; } @@ -2745,17 +2844,73 @@ class CC04 { * when multiple spaces were contained in string. */ class CC05 { - constructor() { - this.id = "CC-05"; - this.description = "A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., fix: array parsing issue when multiple spaces were contained in string."; - } + id = "CC-05"; + description = "A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., fix: array parsing issue when multiple spaces were contained in string."; validate(commit, _options) { const errors = []; - if (!commit.seperator.value) + if (!commit.seperator.value) { return errors; + } if (commit.description.value === undefined || - commit.seperator.value.length - commit.seperator.value.trim().length !== 1) - errors.push(createError(commit, this.description, "A description MUST immediately follow the colon and space", "description", true)); + commit.seperator.value.length - commit.seperator.value.trim().length !== 1) { + errors.push(createDiagnosticsMessage(commit, this.description, "A description MUST immediately follow the colon and space", "description", true)); + } + return errors; + } +} +/** + * A longer commit body MAY be provided after the short description, providing + * additional contextual information about the code changes. The body MUST begin one + * blank line after the description. + */ +class CC06 { + id = "CC-06"; + description = "A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description."; + validate(commit, _options) { + const errors = []; + if (!commit.commit.subject) { + return errors; + } + const lines = commit.commit.subject.split(/\r?\n/); + if (lines.length > 1) { + return [ + diagnose_it_1.DiagnosticsMessage.createError(commit.commit.hash, { + text: highlightString(this.description, "The body MUST begin one blank line after the description"), + linenumber: 2, + column: 1, + }) + .setContext(1, lines) + .addFixitHint(diagnose_it_1.FixItHint.createRemoval({ index: 1, length: lines[1].length })), + ]; + } + return errors; + } +} +/** + * The units of information that make up Conventional Commits MUST NOT be treated as case + * sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase. + */ +class CC15 { + id = "CC-15"; + description = "The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase."; + validate(commit, _options) { + const errors = []; + const footerElements = (0, commit_1.getFooterElementsFromParagraph)(commit.commit.raw); + if (footerElements === undefined) + return errors; + for (const element of footerElements) { + if (["BREAKING CHANGE", "BREAKING-CHANGE"].includes(element.key.toUpperCase())) { + if (element.key !== element.key.toUpperCase()) { + errors.push(diagnose_it_1.DiagnosticsMessage.createError(commit.commit.hash, { + text: highlightString(this.description, "BREAKING CHANGE MUST be uppercase"), + linenumber: element.lineNumber, + column: 1, + }) + .setContext(element.lineNumber, commit.commit.raw.split(/\r?\n/)[element.lineNumber - 1]) + .addFixitHint(diagnose_it_1.FixItHint.create({ index: 1, length: element.key.length }))); + } + } + } return errors; } } @@ -2763,20 +2918,19 @@ class CC05 { * A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis */ class EC01 { - constructor() { - this.id = "EC-01"; - this.description = "A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis"; - } + id = "EC-01"; + description = "A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis"; validate(commit, options) { - var _a; - const uniqueScopeList = Array.from(new Set((_a = options === null || options === void 0 ? void 0 : options.scopes) !== null && _a !== void 0 ? _a : [])); - if (uniqueScopeList.length === 0) + const uniqueScopeList = Array.from(new Set(options?.scopes ?? [])); + if (uniqueScopeList.length === 0) { return []; - if (commit.scope.value === undefined || uniqueScopeList.includes(commit.scope.value.replace(/[()]+/g, ""))) + } + if (commit.scope.value === undefined || uniqueScopeList.includes(commit.scope.value.replace(/[()]+/g, ""))) { return []; + } this.description = `A scope MAY be provided after a type. A scope MUST consist of one of the configured values (${uniqueScopeList.join(", ")}) surrounded by parenthesis`; return [ - createError(commit, this.description, ["A scope MUST consist of", `(${uniqueScopeList.join(", ")})`], "scope"), + createDiagnosticsMessage(commit, this.description, ["A scope MUST consist of", `(${uniqueScopeList.join(", ")})`], "scope"), ]; } } @@ -2784,33 +2938,74 @@ class EC01 { * Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...) */ class EC02 { - constructor() { - this.id = "EC-02"; - this.description = "Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...)"; - } + id = "EC-02"; + description = "Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...)"; validate(commit, options) { - var _a; - const uniqueAddedTypes = new Set((_a = options === null || options === void 0 ? void 0 : options.types) !== null && _a !== void 0 ? _a : []); + const uniqueAddedTypes = new Set(options?.types ?? []); if (uniqueAddedTypes.has("feat")) uniqueAddedTypes.delete("feat"); if (uniqueAddedTypes.has("fix")) uniqueAddedTypes.delete("fix"); const expectedTypes = ["feat", "fix", ...Array.from(uniqueAddedTypes)]; - this.description = `Commits MUST be prefixed with a type, which consists of one of the configured values (${expectedTypes.join(", ")}).`; + this.description = `Commits ${uniqueAddedTypes.size > 0 ? "MUST" : "MAY"} be prefixed with a type, which consists of one of the configured values (${expectedTypes.join(", ")}).`; if (commit.type.value === undefined || !isNoun(commit.type.value) || - expectedTypes.includes(commit.type.value.trimEnd())) + expectedTypes.includes(commit.type.value.toLowerCase().trimEnd())) { return []; + } if (commit.type.value.trim().length === 0) { - return [createError(commit, this.description, "prefixed with a type", "type")]; + return [createDiagnosticsMessage(commit, this.description, "prefixed with a type", "type")]; + } + if (uniqueAddedTypes.size > 0) { + return [ + createDiagnosticsMessage(commit, this.description, ["prefixed with a type, which consists of", `(${expectedTypes.join(", ")})`], "type"), + ]; + } + else { + return [ + createDiagnosticsMessage(commit, this.description, ["prefixed with a type, which consists of", `(${expectedTypes.join(", ")})`], "type", false, diagnose_it_1.DiagnosticsLevelEnum.Warning), + ]; } - return [ - createError(commit, this.description, ["prefixed with a type, which consists of", `(${expectedTypes.join(", ")})`], "type"), - ]; + } +} +/** + * A `BREAKING CHANGE` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer. + */ +class WA01 { + id = "WA-01"; + description = "A `BREAKING CHANGE` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer."; + validate(commit, _options) { + const errors = []; + if (commit.commit.body === undefined) + return errors; + const elements = (0, commit_1.getFooterElementsFromParagraph)(commit.commit.body); + if (elements === undefined) + return errors; + for (const element of elements) { + if (element.key === "BREAKING CHANGE" || element.key === "BREAKING-CHANGE") { + errors.push(diagnose_it_1.DiagnosticsMessage.createWarning(commit.commit.hash, { + text: highlightString(`A \`${element.key}\` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer.`, [element.key, "will be ignored as it MUST be included in the footer"]), + linenumber: commit.commit.subject.split(/\r?\n/).length + element.lineNumber, + column: 1, + }) + .setContext(commit.commit.subject.split(/\r?\n/).length + 1, commit.commit.body.split(/\r?\n/)) + .addFixitHint(diagnose_it_1.FixItHint.create({ index: 1, length: element.key.length }))); + } + } + return errors; } } /** @internal */ -exports.commitRules = [new CC01(), new CC04(), new CC05(), new EC01(), new EC02()]; +exports.commitRules = [ + new CC01(), + new CC04(), + new CC05(), + new CC06(), + new CC15(), + new EC01(), + new EC02(), + new WA01(), +]; /***/ }), @@ -41012,7 +41207,7 @@ class FileSource { } } async getCommitMessages() { - return [(0, commit_it_1.getCommit)({ hash: "HEAD", message: fs.readFileSync(this.file, "utf8") })]; + return [commit_it_1.Commit.fromString({ hash: "HEAD", message: fs.readFileSync(this.file, "utf8") })]; } async getConfigurationFile(path) { if (!fs.existsSync(path)) { @@ -41032,7 +41227,7 @@ class GitSource { } async getCommitMessages() { const data = await (0, simple_git_1.simpleGit)().log({ from: this.sourceBranch, to: "@{push}" }); - return data.all.map(commit => (0, commit_it_1.getCommit)({ hash: commit.hash })); + return data.all.map(commit => commit_it_1.Commit.fromHash({ hash: commit.hash })); } async getConfigurationFile(path) { if (!fs.existsSync(path)) { @@ -41051,13 +41246,10 @@ class GitHubSource { const pullRequestNumber = github.context.payload.pull_request?.number; (0, assert_1.default)(pullRequestNumber); const commits = await octokit.rest.pulls.listCommits({ ...github.context.repo, pull_number: pullRequestNumber }); - return commits.data.map(commit => { - return { - hash: commit.sha, - subject: commit.commit.message.split(/\r?\n/)[0], - body: commit.commit.message.split(/\r?\n/).slice(2).join("\n"), - }; - }); + return commits.data.map(commit => commit_it_1.Commit.fromString({ + hash: commit.sha, + message: commit.commit.message, + })); } /** * Retrieves the specified configuration file from the repository using the REST API @@ -41133,18 +41325,21 @@ program config.addTypes(options.types ?? []); const commits = await datasource.getCommitMessages(); let errorCount = 0; + let warningCount = 0; const results = (0, validator_1.validateCommits)(commits); for (const commit of results) { - console.log(`${commit.errors.length === 0 ? "✅" : "❌"} ${commit.commit.hash}: ${commit.commit.subject.substring(0, 77)}${commit.commit.subject.length > 80 ? "..." : ""}`); - commit.errors.forEach(error => console.log(error, os_1.default.EOL)); + console.log(`${commit.errors.length === 0 ? "✅" : "❌"} ${commit.hash}: ${commit.subject.substring(0, 77)}${commit.subject.length > 80 ? "..." : ""}`); + commit.errors.forEach(err => console.log(err.toString(), os_1.default.EOL)); + commit.warnings.forEach(err => console.log(err.toString(), os_1.default.EOL)); errorCount += commit.errors.length; + warningCount += commit.warnings.length; } console.log("-------------------------------------------------------"); if (errorCount === 0) { console.log(`✅ All your commits are compliant with Conventional Commit.`); } else { - program.error(`❌ Found ${errorCount} Conventional Commit compliance issues.`); + program.error(`❌ Found ${errorCount} Conventional Commit compliance issues, and ${warningCount} warnings.`); } }); program.parse(process.argv); @@ -41172,16 +41367,7 @@ const configuration_1 = __nccwpck_require__(5778); * @returns Validation result */ function validateCommit(commit) { - const result = { commit: commit, errors: [] }; - try { - result.commit = (0, commit_it_1.getConventionalCommit)(commit, configuration_1.Configuration.getInstance()); - } - catch (error) { - if (!(error instanceof commit_it_1.ConventionalCommitError)) - throw error; - error.errors.forEach(e => result.errors.push(e.toString())); - } - return result; + return commit_it_1.ConventionalCommit.fromCommit(commit, configuration_1.Configuration.getInstance()); } /** * Validates the pull request against CommitMe requirements. @@ -41191,27 +41377,28 @@ function validateCommit(commit) { */ function validatePullRequest(pullrequest, commits) { const result = validateCommit(pullrequest); - if (result.errors.length > 0) + if (!result.isValid) return result; const orderValue = (commit) => { - if (!commit || !("type" in commit)) - return 0; if (commit.breaking) return 3; - if (commit.type === "feat") + if (commit.type?.toLowerCase() === "feat") return 2; - if (commit.type === "fix") + if (commit.type?.toLowerCase() === "fix") return 1; return 0; }; - const pullRequestValue = orderValue(result.commit); - const commitsValue = orderValue(commits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); + const pullRequestValue = orderValue(result); + const validConventionalCommits = commits.filter(commit => commit.isValid); + const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { - result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.commit.hash, { + result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.hash, { text: `A Pull Request title MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, linenumber: 1, column: 1, - }).toString()); + }) + .setContext(1, result.subject) + .addFixitHint(diagnose_it_1.FixItHint.create({ index: 1, length: result.type?.length ?? 1 }))); } return result; } diff --git a/lib/precommit/index.js b/lib/precommit/index.js index c0e381d..c37b1eb 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -2094,9 +2094,9 @@ function isLoopbackAddress(host) { "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -2121,8 +2121,75 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getCommit = exports.isConventionalCommit = exports.parseCommitMessage = void 0; +exports.parseCommitMessage = exports.getFooterElementsFromParagraph = exports.Commit = void 0; const git = __importStar(__nccwpck_require__(8433)); +const TRAILER_REGEX = /^((BREAKING CHANGE:)|([\w-]+(:| #))|([ \t]+)\w*)/i; +/** + * Git Commit + * @class Commit + * @member author The commit author and date + * @member commiter The commit commiter and date + * @member hash The commit hash + * @member subject The commit subject + * @member body The commit body + * @member footer The commit footer + * @member raw The commit message + */ +class Commit { + _commit; + constructor(commit) { + this._commit = commit; + } + /** + * Retrieves the commit information from git using the provided hash + * @param props The commit hash and root path + * @returns The commit object + */ + static fromHash(props) { + const commit = git.getCommitFromHash(props.hash, props.rootPath ?? process.cwd()); + return new Commit(commit); + } + /** + * Creates a Commit object from the provided string + * @param props The commit hash, author, committer and message + * @returns The commit object + */ + static fromString(props) { + const commit = { + hash: props.hash, + ...parseCommitMessage(props.message), + author: props.author, + committer: props.committer, + raw: props.message, + }; + return new Commit(commit); + } + get author() { + return this._commit.author; + } + get committer() { + return this._commit.committer; + } + get hash() { + return this._commit.hash; + } + get subject() { + return this._commit.subject; + } + get body() { + return this._commit.body; + } + get footer() { + return this._commit.footer; + } + get raw() { + return this._commit.raw; + } + toJSON() { + return this._commit; + } +} +exports.Commit = Commit; /** * Returns a dictionary containing key-value pairs extracted from the footer of the provided commit message. * The key must either be: @@ -2132,13 +2199,15 @@ const git = __importStar(__nccwpck_require__(8433)); * The value is either: * - the remainder of the line * - the remainder of the line + anything that follows on the next lines which is indented by at least one space + * + * @internal */ -function parseCommitFooter(footer) { - const footerLines = footer.split(/[\r\n]+/); - const result = {}; +function getFooterElementsFromParagraph(footer) { + const footerLines = footer.split(/\r?\n/); + const result = []; for (let lineNr = 0; lineNr < footerLines.length; lineNr++) { const line = footerLines[lineNr]; - const match = /^((BREAKING CHANGE:)|([\w-]+(:| #))|([ \t]+)\w)/.exec(line); + const match = TRAILER_REGEX.exec(line); if (match === null) continue; let key = match[1].replace(/:$/, ""); @@ -2147,15 +2216,22 @@ function parseCommitFooter(footer) { key = match[1].substring(0, match[1].length - 2); value = `#${value}`; } + const matchLine = lineNr; // Check if the value continues on the next line - while (lineNr + 1 < footerLines.length && footerLines[lineNr + 1].startsWith(" ")) { + while (lineNr + 1 < footerLines.length && + (/^\s/.test(footerLines[lineNr + 1]) || footerLines[lineNr + 1].length === 0)) { lineNr++; value += "\n" + footerLines[lineNr].trim(); } - result[key] = value; + result.push({ + lineNumber: matchLine + 1, + key, + value, + }); } return Object.keys(result).length > 0 ? result : undefined; } +exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; /** * Parses the provided commit message (full message, not just the subject) into * a Commit object. @@ -2164,11 +2240,11 @@ function parseCommitFooter(footer) { * @internal */ function parseCommitMessage(message) { - const isTrailerOnly = (message) => message.split(/[\r\n]+/).every(line => { - const match = /^((BREAKING CHANGE:)|([\w-]+(:| #))|([ \t]+)\w)/.exec(line); + const isTrailerOnly = (message) => message.split(/\r?\n/).every(line => { + const match = TRAILER_REGEX.exec(line); return match !== null; }); - const paragraphs = message.split(/^[\r\n]+/m); + const paragraphs = message.split(/^\r?\n/m); let footer = undefined; let body = undefined; if (paragraphs.length > 1 && isTrailerOnly(paragraphs[paragraphs.length - 1])) { @@ -2183,69 +2259,26 @@ function parseCommitMessage(message) { return { subject: paragraphs[0].trim(), body: body, - footer: parseCommitFooter(footer !== null && footer !== void 0 ? footer : ""), + footer: getFooterElementsFromParagraph(footer ?? "")?.reduce((acc, cur) => { + acc[cur.key] = cur.value; + return acc; + }, {}), }; } exports.parseCommitMessage = parseCommitMessage; -/** - * Confirms whether the provided commit is a Conventional Commit - * @param commit - * @returns - */ -function isConventionalCommit(commit) { - return "type" in commit; -} -exports.isConventionalCommit = isConventionalCommit; -/** - * Retrieves the commit message (from the indicated source) given the provided SHA hash - * @param hash SHA of the commit - * @param source The data source to retrieve the commit message from (git or github) - * @param options The options to use when retrieving the commit message - * @returns Commit object - */ -function getCommit(options) { - var _a; - let commit; - // String data source - if ("message" in options) { - const stringOptions = options; - commit = { - hash: stringOptions.hash, - ...parseCommitMessage(stringOptions.message), - author: stringOptions.author, - committer: stringOptions.committer, - }; - // GitHub data source - } - else if ("owner" in options) { - const githubOptions = options; - // TODO; implement basic GitHub client - commit = { - hash: githubOptions.hash, - subject: "", - }; - // Git data source - } - else { - const gitOptions = options; - commit = git.getCommitFromHash(gitOptions.hash, (_a = gitOptions.rootPath) !== null && _a !== void 0 ? _a : process.cwd()); - } - return commit; -} -exports.getCommit = getCommit; /***/ }), -/***/ 8436: +/***/ 1124: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -2269,101 +2302,162 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getConventionalCommit = exports.isConventionalCommit = exports.ConventionalCommitError = void 0; -const assert_1 = __importDefault(__nccwpck_require__(9491)); +exports.ConventionalCommit = void 0; +const diagnose_it_1 = __nccwpck_require__(4657); +const commit_1 = __nccwpck_require__(8065); const requirements = __importStar(__nccwpck_require__(4374)); /** - * Conventional Commit error - * @class ConventionalCommitError - * @extends Error + * Conventional Commit + * @class ConventionalCommit + * @member type Conventional Commit type + * @member scope Conventional Commit scope + * @member breaking Commit message has a Conventional Commit breaking change (!) + * @member description Conventional Commit description + * @member hash Commit hash + * @member subject Commit subject + * @member body Commit body + * @member footer Commit footer + * @member author Commit author and date + * @member committer Commit committer and date + * @member isValid Whether the Conventional Commit is valid * @member errors List of error messages + * @member warnings List of warning messages */ -class ConventionalCommitError extends Error { - constructor(errors) { - super("Commit is not compliant with the Conventional Commits specification."); - this.name = "ConventionalCommitError"; - this.errors = errors; +class ConventionalCommit { + _raw; + _errors = []; + _warnings = []; + constructor(raw, options) { + this._raw = raw; + this.validate(options); + } + /** + * Creates a new Conventional Commit object from the provided Commit. + * @param commit Commit to convert to a Conventional Commit + * @param options Options to use when validating the commit message + * @returns Conventional Commit + */ + static fromCommit(commit, options) { + // Convert the Commit message to Raw Conventional Commit data + const rawConvCommit = createRawConventionalCommit(commit); + // Create a new Conventional Commit object + return new ConventionalCommit(rawConvCommit, options); + } + /** + * Creates a new Conventional Commit object from the provided string. + * @param props Hash, message and author/committer information + * @param options Options to use when validating the commit message + * @returns Conventional Commit + */ + static fromString(props, options) { + return ConventionalCommit.fromCommit(commit_1.Commit.fromString(props), options); + } + /** + * Creates a new Conventional Commit object from the provided hash. + * @param props Hash and root path + * @param options Options to use when validating the commit message + * @returns Conventional Commit + */ + static fromHash(props, options) { + return ConventionalCommit.fromCommit(commit_1.Commit.fromHash(props), options); + } + // Contributors + get author() { + return this._raw.commit.author; + } + get committer() { + return this._raw.commit.committer; + } + // Commit + get hash() { + return this._raw.commit.hash; + } + get subject() { + return this._raw.commit.subject; + } + get body() { + return this._raw.commit.body; + } + get footer() { + return this._raw.commit.footer; + } + // Conventional Commit + get type() { + return this._raw.type.value; + } + get scope() { + return this._raw.scope.value; + } + get description() { + return this._raw.description.value; + } + get breaking() { + return (this._raw.breaking.value === "!" || + (this.footer !== undefined && ("BREAKING CHANGE" in this.footer || "BREAKING-CHANGE" in this.footer))); + } + // Raw + get raw() { + return this._raw.commit.raw; + } + // Validation + get isValid() { + return this._errors.length === 0; + } + get warnings() { + return this._warnings; + } + get errors() { + return this._errors; + } + toJSON() { + return { + hash: this.hash, + author: this.author, + committer: this.committer, + subject: this.subject, + body: this.body, + footer: this.footer, + type: this.type, + breaking: this.breaking, + description: this.description, + validation: { + isValid: this.isValid, + errors: this.errors, + warnings: this.warnings, + }, + }; + } + // Private validation function + validate(options) { + let results = []; + requirements.commitRules.forEach(rule => (results = [...results, ...rule.validate(this._raw, options)])); + this._errors = results.filter(r => r.level === diagnose_it_1.DiagnosticsLevelEnum.Error); + this._warnings = results.filter(r => r.level === diagnose_it_1.DiagnosticsLevelEnum.Warning); } } -exports.ConventionalCommitError = ConventionalCommitError; -/** - * Returns whether the provided commit has a breaking change (either "!" in subject, or usage of /BREAKING[- ]CHANGE:/). - * @param commit Commit to check - * @returns Whether the provided commit has a breaking change - */ -function hasBreakingChange(commit) { - return (commit.breaking.value === "!" || - (commit.commit.footer !== undefined && - ("BREAKING CHANGE" in commit.commit.footer || "BREAKING-CHANGE" in commit.commit.footer))); -} -/** - * Validates a commit message against the Conventional Commit specification. - * @param commit Commit message to validate against the Conventional Commit specification - * @returns Conventional Commit mesage - * @throws ExpressiveMessage[] if the commit message is not a valid Conventional Commit - * @see https://www.conventionalcommits.org/en/v1.0.0/ - */ -function validate(commit, options) { - let errors = []; - requirements.commitRules.forEach(rule => (errors = [...errors, ...rule.validate(commit, options)])); - if (errors.length > 0) - throw new ConventionalCommitError(errors); - // Assume that we have a valid Conventional Commit message - (0, assert_1.default)(commit.type.value); - (0, assert_1.default)(commit.description.value); - return { - ...commit.commit, - type: commit.type.value, - scope: commit.scope.value, - breaking: hasBreakingChange(commit), - description: commit.description.value, - }; -} -/** - * Returns whether the provided commit is a Conventional Commit. - * @param commit Commit to check - * @returns Whether the provided commit is a Conventional Commit - */ -function isConventionalCommit(commit) { - return "type" in commit; -} -exports.isConventionalCommit = isConventionalCommit; -/** - * Parses a Commit message into a Conventional Commit. - * @param commit Commit message to parse - * @param options Options to use when parsing the commit message - * @throws ExpressiveMessage[] if the commit message is not a valid Conventional Commit - * @returns Conventional Commit - */ -function getConventionalCommit(commit, options) { - var _a, _b, _c, _d, _e; +exports.ConventionalCommit = ConventionalCommit; +function createRawConventionalCommit(commit) { const ConventionalCommitRegex = new RegExp(/^(?[^(!:]*)(?\([^)]*\)\s*)?(?!\s*)?(?:\s*)?(?.*)?$/); - const match = ConventionalCommitRegex.exec(commit.subject); - let conventionalCommit = { + const match = ConventionalCommitRegex.exec(commit.subject.split(/\r?\n/)[0]); + const conventionalCommit = { commit: commit, - type: { index: 1, value: (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type }, - scope: { index: 1, value: (_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.scope }, - breaking: { index: 1, value: (_c = match === null || match === void 0 ? void 0 : match.groups) === null || _c === void 0 ? void 0 : _c.breaking }, - seperator: { index: 1, value: (_d = match === null || match === void 0 ? void 0 : match.groups) === null || _d === void 0 ? void 0 : _d.separator }, - description: { index: 1, value: (_e = match === null || match === void 0 ? void 0 : match.groups) === null || _e === void 0 ? void 0 : _e.subject }, + type: { index: 1, value: match?.groups?.type }, + scope: { index: 1, value: match?.groups?.scope }, + breaking: { index: 1, value: match?.groups?.breaking }, + seperator: { index: 1, value: match?.groups?.separator }, + description: { index: 1, value: match?.groups?.subject }, body: { index: 1, value: commit.body }, }; function intializeIndices(commit) { - var _a, _b, _c, _d, _e, _f, _g, _h; - commit.scope.index = commit.type.index + ((_b = (_a = commit.type.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); - commit.breaking.index = commit.scope.index + ((_d = (_c = commit.scope.value) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0); - commit.seperator.index = commit.breaking.index + ((_f = (_e = commit.breaking.value) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0); - commit.description.index = commit.seperator.index + ((_h = (_g = commit.seperator.value) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0); + commit.scope.index = commit.type.index + (commit.type.value?.length ?? 0); + commit.breaking.index = commit.scope.index + (commit.scope.value?.length ?? 0); + commit.seperator.index = commit.breaking.index + (commit.breaking.value?.length ?? 0); + commit.description.index = commit.seperator.index + (commit.seperator.value?.length ?? 0); return commit; } - conventionalCommit = intializeIndices(conventionalCommit); - return validate(conventionalCommit, options); + return intializeIndices(conventionalCommit); } -exports.getConventionalCommit = getConventionalCommit; /***/ }), @@ -2374,9 +2468,9 @@ exports.getConventionalCommit = getConventionalCommit; "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -2456,15 +2550,17 @@ function getValueFromKey(commit, key) { function parseCommitMessage(commit, hash) { const author = extractNameAndDate(getValueFromKey(commit, "author")); const committer = extractNameAndDate(getValueFromKey(commit, "committer")); + const raw = commit + .split(/^[\r\n]+/m) + .splice(1) + .join("\n") + .trim(); return { + raw, hash: hash, author: author, committer: committer, - ...ccommit.parseCommitMessage(commit - .split(/^[\r\n]+/m) - .splice(1) - .join("\n") - .trim()), + ...ccommit.parseCommitMessage(raw), }; } /** @@ -2606,17 +2702,15 @@ function readPackFile(path, index) { "use strict"; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ConventionalCommitError = exports.isConventionalCommit = exports.getConventionalCommit = exports.getCommit = void 0; +exports.ConventionalCommit = exports.Commit = void 0; var commit_1 = __nccwpck_require__(8065); -Object.defineProperty(exports, "getCommit", ({ enumerable: true, get: function () { return commit_1.getCommit; } })); -var conventional_commit_1 = __nccwpck_require__(8436); -Object.defineProperty(exports, "getConventionalCommit", ({ enumerable: true, get: function () { return conventional_commit_1.getConventionalCommit; } })); -Object.defineProperty(exports, "isConventionalCommit", ({ enumerable: true, get: function () { return conventional_commit_1.isConventionalCommit; } })); -Object.defineProperty(exports, "ConventionalCommitError", ({ enumerable: true, get: function () { return conventional_commit_1.ConventionalCommitError; } })); +Object.defineProperty(exports, "Commit", ({ enumerable: true, get: function () { return commit_1.Commit; } })); +var conventionalCommit_1 = __nccwpck_require__(1124); +Object.defineProperty(exports, "ConventionalCommit", ({ enumerable: true, get: function () { return conventionalCommit_1.ConventionalCommit; } })); /***/ }), @@ -2632,13 +2726,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.commitRules = void 0; /* -SPDX-FileCopyrightText: 2023 Kevin de Jong - -SPDX-License-Identifier: MIT -SPDX-License-Identifier: CC-BY-3.0 -*/ + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * + * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: CC-BY-3.0 + */ const diagnose_it_1 = __nccwpck_require__(4657); const chalk_1 = __importDefault(__nccwpck_require__(8818)); +const commit_1 = __nccwpck_require__(8065); function isNoun(str) { return !str.trim().includes(" ") && !/[^a-z]/i.test(str.trim()); } @@ -2651,29 +2746,30 @@ function highlightString(str, substring) { substring.forEach(sub => (result = result.replace(sub, `${chalk_1.default.cyan(sub)}`))); return result; } -function createError(commit, description, highlight, type, whitespace = false) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; +function createDiagnosticsMessage(commit, description, highlight, type, whitespace = false, level = diagnose_it_1.DiagnosticsLevelEnum.Error) { const element = commit[type]; let hintIndex = element.index; - let hintLength = (_b = (_a = element.value) === null || _a === void 0 ? void 0 : _a.trimEnd().length) !== null && _b !== void 0 ? _b : 1; + let hintLength = element.value?.trimEnd().length ?? 1; if (whitespace) { let prevElement = undefined; for (const [_key, value] of Object.entries(commit)) { - if (value.index > ((_c = prevElement === null || prevElement === void 0 ? void 0 : prevElement.index) !== null && _c !== void 0 ? _c : 0) && value.index < element.index) { + if (value.index > (prevElement?.index ?? 0) && value.index < element.index) { prevElement = value; } } - hintIndex = prevElement ? prevElement.index + ((_e = (_d = prevElement.value) === null || _d === void 0 ? void 0 : _d.trimEnd().length) !== null && _e !== void 0 ? _e : 1) : 1; - hintLength = ((_g = (_f = prevElement === null || prevElement === void 0 ? void 0 : prevElement.value) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 1) - ((_j = (_h = prevElement === null || prevElement === void 0 ? void 0 : prevElement.value) === null || _h === void 0 ? void 0 : _h.trimEnd().length) !== null && _j !== void 0 ? _j : 1); + hintIndex = prevElement ? prevElement.index + (prevElement.value?.trimEnd().length ?? 1) : 1; + hintLength = (prevElement?.value?.length ?? 1) - (prevElement?.value?.trimEnd().length ?? 1); } - return diagnose_it_1.DiagnosticsMessage.createError(commit.commit.hash, { - text: highlightString(description, highlight), - linenumber: 1, - column: hintIndex, + return new diagnose_it_1.DiagnosticsMessage({ + file: commit.commit.hash, + level, + message: { + text: highlightString(description, highlight), + linenumber: 1, + column: hintIndex, + }, }) - .setContext(1, commit.commit.body !== undefined && commit.commit.body.split("\n").length >= 1 - ? [commit.commit.subject, "", ...commit.commit.body.split("\n")] - : [commit.commit.subject]) + .setContext(1, commit.commit.subject.split(/\r?\n/)[0]) .addFixitHint(diagnose_it_1.FixItHint.create({ index: hintIndex, length: hintLength === 0 ? 1 : hintLength })); } /** @@ -2681,10 +2777,8 @@ function createError(commit, description, highlight, type, whitespace = false) { * followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space. */ class CC01 { - constructor() { - this.id = "CC-01"; - this.description = "Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space."; - } + id = "CC-01"; + description = "Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space."; validate(commit, _options) { const errors = []; // MUST be prefixed with a type @@ -2694,29 +2788,36 @@ class CC01 { else { // Ensure that we have a noun if (!isNoun(commit.type.value)) - errors.push(createError(commit, this.description, "which consists of a noun", "type")); + errors.push(createDiagnosticsMessage(commit, this.description, "which consists of a noun", "type")); // Validate for spacing after the type if (commit.type.value.trim() !== commit.type.value) { - if (commit.scope.value) - errors.push(createError(commit, this.description, "followed by the OPTIONAL scope", "scope", true)); - else if (commit.breaking.value) - errors.push(createError(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); - else - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + if (commit.scope.value) { + errors.push(createDiagnosticsMessage(commit, this.description, "followed by the OPTIONAL scope", "scope", true)); + } + else if (commit.breaking.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); + } + else { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + } } // Validate for spacing after the scope, breaking and seperator if (commit.scope.value && commit.scope.value.trim() !== commit.scope.value) { - if (commit.breaking.value) - errors.push(createError(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); - else - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + if (commit.breaking.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "OPTIONAL !"], "breaking", true)); + } + else { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); + } + } + if (commit.breaking.value && commit.breaking.value.trim() !== commit.breaking.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); } - if (commit.breaking.value && commit.breaking.value.trim() !== commit.breaking.value) - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator", true)); } // MUST have a terminal colon - if (!commit.seperator.value) - errors.push(createError(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator")); + if (!commit.seperator.value) { + errors.push(createDiagnosticsMessage(commit, this.description, ["followed by the", "REQUIRED terminal colon"], "seperator")); + } return errors; } } @@ -2725,16 +2826,14 @@ class CC01 { * a section of the codebase surrounded by parenthesis, e.g., fix(parser): */ class CC04 { - constructor() { - this.id = "CC-04"; - this.description = "A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):"; - } + id = "CC-04"; + description = "A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):"; validate(commit, _options) { const errors = []; if (commit.scope.value && (commit.scope.value === "()" || !isNoun(commit.scope.value.trimEnd().substring(1, commit.scope.value.trimEnd().length - 1)))) { - errors.push(createError(commit, this.description, "A scope MUST consist of a noun", "scope")); + errors.push(createDiagnosticsMessage(commit, this.description, "A scope MUST consist of a noun", "scope")); } return errors; } @@ -2745,17 +2844,73 @@ class CC04 { * when multiple spaces were contained in string. */ class CC05 { - constructor() { - this.id = "CC-05"; - this.description = "A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., fix: array parsing issue when multiple spaces were contained in string."; - } + id = "CC-05"; + description = "A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., fix: array parsing issue when multiple spaces were contained in string."; validate(commit, _options) { const errors = []; - if (!commit.seperator.value) + if (!commit.seperator.value) { return errors; + } if (commit.description.value === undefined || - commit.seperator.value.length - commit.seperator.value.trim().length !== 1) - errors.push(createError(commit, this.description, "A description MUST immediately follow the colon and space", "description", true)); + commit.seperator.value.length - commit.seperator.value.trim().length !== 1) { + errors.push(createDiagnosticsMessage(commit, this.description, "A description MUST immediately follow the colon and space", "description", true)); + } + return errors; + } +} +/** + * A longer commit body MAY be provided after the short description, providing + * additional contextual information about the code changes. The body MUST begin one + * blank line after the description. + */ +class CC06 { + id = "CC-06"; + description = "A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description."; + validate(commit, _options) { + const errors = []; + if (!commit.commit.subject) { + return errors; + } + const lines = commit.commit.subject.split(/\r?\n/); + if (lines.length > 1) { + return [ + diagnose_it_1.DiagnosticsMessage.createError(commit.commit.hash, { + text: highlightString(this.description, "The body MUST begin one blank line after the description"), + linenumber: 2, + column: 1, + }) + .setContext(1, lines) + .addFixitHint(diagnose_it_1.FixItHint.createRemoval({ index: 1, length: lines[1].length })), + ]; + } + return errors; + } +} +/** + * The units of information that make up Conventional Commits MUST NOT be treated as case + * sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase. + */ +class CC15 { + id = "CC-15"; + description = "The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase."; + validate(commit, _options) { + const errors = []; + const footerElements = (0, commit_1.getFooterElementsFromParagraph)(commit.commit.raw); + if (footerElements === undefined) + return errors; + for (const element of footerElements) { + if (["BREAKING CHANGE", "BREAKING-CHANGE"].includes(element.key.toUpperCase())) { + if (element.key !== element.key.toUpperCase()) { + errors.push(diagnose_it_1.DiagnosticsMessage.createError(commit.commit.hash, { + text: highlightString(this.description, "BREAKING CHANGE MUST be uppercase"), + linenumber: element.lineNumber, + column: 1, + }) + .setContext(element.lineNumber, commit.commit.raw.split(/\r?\n/)[element.lineNumber - 1]) + .addFixitHint(diagnose_it_1.FixItHint.create({ index: 1, length: element.key.length }))); + } + } + } return errors; } } @@ -2763,20 +2918,19 @@ class CC05 { * A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis */ class EC01 { - constructor() { - this.id = "EC-01"; - this.description = "A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis"; - } + id = "EC-01"; + description = "A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis"; validate(commit, options) { - var _a; - const uniqueScopeList = Array.from(new Set((_a = options === null || options === void 0 ? void 0 : options.scopes) !== null && _a !== void 0 ? _a : [])); - if (uniqueScopeList.length === 0) + const uniqueScopeList = Array.from(new Set(options?.scopes ?? [])); + if (uniqueScopeList.length === 0) { return []; - if (commit.scope.value === undefined || uniqueScopeList.includes(commit.scope.value.replace(/[()]+/g, ""))) + } + if (commit.scope.value === undefined || uniqueScopeList.includes(commit.scope.value.replace(/[()]+/g, ""))) { return []; + } this.description = `A scope MAY be provided after a type. A scope MUST consist of one of the configured values (${uniqueScopeList.join(", ")}) surrounded by parenthesis`; return [ - createError(commit, this.description, ["A scope MUST consist of", `(${uniqueScopeList.join(", ")})`], "scope"), + createDiagnosticsMessage(commit, this.description, ["A scope MUST consist of", `(${uniqueScopeList.join(", ")})`], "scope"), ]; } } @@ -2784,33 +2938,74 @@ class EC01 { * Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...) */ class EC02 { - constructor() { - this.id = "EC-02"; - this.description = "Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...)"; - } + id = "EC-02"; + description = "Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...)"; validate(commit, options) { - var _a; - const uniqueAddedTypes = new Set((_a = options === null || options === void 0 ? void 0 : options.types) !== null && _a !== void 0 ? _a : []); + const uniqueAddedTypes = new Set(options?.types ?? []); if (uniqueAddedTypes.has("feat")) uniqueAddedTypes.delete("feat"); if (uniqueAddedTypes.has("fix")) uniqueAddedTypes.delete("fix"); const expectedTypes = ["feat", "fix", ...Array.from(uniqueAddedTypes)]; - this.description = `Commits MUST be prefixed with a type, which consists of one of the configured values (${expectedTypes.join(", ")}).`; + this.description = `Commits ${uniqueAddedTypes.size > 0 ? "MUST" : "MAY"} be prefixed with a type, which consists of one of the configured values (${expectedTypes.join(", ")}).`; if (commit.type.value === undefined || !isNoun(commit.type.value) || - expectedTypes.includes(commit.type.value.trimEnd())) + expectedTypes.includes(commit.type.value.toLowerCase().trimEnd())) { return []; + } if (commit.type.value.trim().length === 0) { - return [createError(commit, this.description, "prefixed with a type", "type")]; + return [createDiagnosticsMessage(commit, this.description, "prefixed with a type", "type")]; + } + if (uniqueAddedTypes.size > 0) { + return [ + createDiagnosticsMessage(commit, this.description, ["prefixed with a type, which consists of", `(${expectedTypes.join(", ")})`], "type"), + ]; + } + else { + return [ + createDiagnosticsMessage(commit, this.description, ["prefixed with a type, which consists of", `(${expectedTypes.join(", ")})`], "type", false, diagnose_it_1.DiagnosticsLevelEnum.Warning), + ]; } - return [ - createError(commit, this.description, ["prefixed with a type, which consists of", `(${expectedTypes.join(", ")})`], "type"), - ]; + } +} +/** + * A `BREAKING CHANGE` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer. + */ +class WA01 { + id = "WA-01"; + description = "A `BREAKING CHANGE` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer."; + validate(commit, _options) { + const errors = []; + if (commit.commit.body === undefined) + return errors; + const elements = (0, commit_1.getFooterElementsFromParagraph)(commit.commit.body); + if (elements === undefined) + return errors; + for (const element of elements) { + if (element.key === "BREAKING CHANGE" || element.key === "BREAKING-CHANGE") { + errors.push(diagnose_it_1.DiagnosticsMessage.createWarning(commit.commit.hash, { + text: highlightString(`A \`${element.key}\` git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer.`, [element.key, "will be ignored as it MUST be included in the footer"]), + linenumber: commit.commit.subject.split(/\r?\n/).length + element.lineNumber, + column: 1, + }) + .setContext(commit.commit.subject.split(/\r?\n/).length + 1, commit.commit.body.split(/\r?\n/)) + .addFixitHint(diagnose_it_1.FixItHint.create({ index: 1, length: element.key.length }))); + } + } + return errors; } } /** @internal */ -exports.commitRules = [new CC01(), new CC04(), new CC05(), new EC01(), new EC02()]; +exports.commitRules = [ + new CC01(), + new CC04(), + new CC05(), + new CC06(), + new CC15(), + new EC01(), + new EC02(), + new WA01(), +]; /***/ }), @@ -41012,7 +41207,7 @@ class FileSource { } } async getCommitMessages() { - return [(0, commit_it_1.getCommit)({ hash: "HEAD", message: fs.readFileSync(this.file, "utf8") })]; + return [commit_it_1.Commit.fromString({ hash: "HEAD", message: fs.readFileSync(this.file, "utf8") })]; } async getConfigurationFile(path) { if (!fs.existsSync(path)) { @@ -41032,7 +41227,7 @@ class GitSource { } async getCommitMessages() { const data = await (0, simple_git_1.simpleGit)().log({ from: this.sourceBranch, to: "@{push}" }); - return data.all.map(commit => (0, commit_it_1.getCommit)({ hash: commit.hash })); + return data.all.map(commit => commit_it_1.Commit.fromHash({ hash: commit.hash })); } async getConfigurationFile(path) { if (!fs.existsSync(path)) { @@ -41051,13 +41246,10 @@ class GitHubSource { const pullRequestNumber = github.context.payload.pull_request?.number; (0, assert_1.default)(pullRequestNumber); const commits = await octokit.rest.pulls.listCommits({ ...github.context.repo, pull_number: pullRequestNumber }); - return commits.data.map(commit => { - return { - hash: commit.sha, - subject: commit.commit.message.split(/\r?\n/)[0], - body: commit.commit.message.split(/\r?\n/).slice(2).join("\n"), - }; - }); + return commits.data.map(commit => commit_it_1.Commit.fromString({ + hash: commit.sha, + message: commit.commit.message, + })); } /** * Retrieves the specified configuration file from the repository using the REST API @@ -41122,12 +41314,15 @@ program await configuration_1.Configuration.getInstance().fromDatasource(datasource, program.opts().config); const commits = await datasource.getCommitMessages(); let errorCount = 0; + let warningCount = 0; (0, validator_1.validateCommits)(commits).forEach(commit => { - commit.errors.forEach(error => console.log(error, os_1.default.EOL)); + commit.errors.forEach(err => console.log(err.toString(), os_1.default.EOL)); + commit.warnings.forEach(err => console.log(err.toString(), os_1.default.EOL)); errorCount += commit.errors.length; + warningCount += commit.warnings.length; }); if (errorCount > 0) { - program.error(`❌ Found ${errorCount} Conventional Commit compliance issues.`); + program.error(`❌ Found ${errorCount} Conventional Commit compliance issues, and ${warningCount} warnings.`); } }); program.parse(process.argv); @@ -41155,16 +41350,7 @@ const configuration_1 = __nccwpck_require__(5778); * @returns Validation result */ function validateCommit(commit) { - const result = { commit: commit, errors: [] }; - try { - result.commit = (0, commit_it_1.getConventionalCommit)(commit, configuration_1.Configuration.getInstance()); - } - catch (error) { - if (!(error instanceof commit_it_1.ConventionalCommitError)) - throw error; - error.errors.forEach(e => result.errors.push(e.toString())); - } - return result; + return commit_it_1.ConventionalCommit.fromCommit(commit, configuration_1.Configuration.getInstance()); } /** * Validates the pull request against CommitMe requirements. @@ -41174,27 +41360,28 @@ function validateCommit(commit) { */ function validatePullRequest(pullrequest, commits) { const result = validateCommit(pullrequest); - if (result.errors.length > 0) + if (!result.isValid) return result; const orderValue = (commit) => { - if (!commit || !("type" in commit)) - return 0; if (commit.breaking) return 3; - if (commit.type === "feat") + if (commit.type?.toLowerCase() === "feat") return 2; - if (commit.type === "fix") + if (commit.type?.toLowerCase() === "fix") return 1; return 0; }; - const pullRequestValue = orderValue(result.commit); - const commitsValue = orderValue(commits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); + const pullRequestValue = orderValue(result); + const validConventionalCommits = commits.filter(commit => commit.isValid); + const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { - result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.commit.hash, { + result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.hash, { text: `A Pull Request title MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, linenumber: 1, column: 1, - }).toString()); + }) + .setContext(1, result.subject) + .addFixitHint(diagnose_it_1.FixItHint.create({ index: 1, length: result.type?.length ?? 1 }))); } return result; } diff --git a/package-lock.json b/package-lock.json index 0728e05..713cece 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@actions/core": "^1", "@actions/github": "^6", - "@dev-build-deploy/commit-it": "^1", + "@dev-build-deploy/commit-it": "^2", "@dev-build-deploy/diagnose-it": "^1", "commander": "^11", "simple-git": "^3" @@ -743,12 +743,15 @@ "dev": true }, "node_modules/@dev-build-deploy/commit-it": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-1.0.4.tgz", - "integrity": "sha512-dT0bfSmDnj2SD4qVedHuwTIozOcKwEOb5RulndCjXUSJ2IazA3U3VJMyqAf0TTY9h7au/HaKjokjMtomNNi+XA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.0.2.tgz", + "integrity": "sha512-gMcFU3ik5ikkx+xnwH9wdkucWhxONy7+5g+F7z/XEjzXPxJSY02WusxnCFu+KalTvc9T3bZbXyqtYClTMy5e8Q==", "dependencies": { "@dev-build-deploy/diagnose-it": "^1", "chalk": "<5" + }, + "engines": { + "node": ">=20" } }, "node_modules/@dev-build-deploy/diagnose-it": { @@ -2616,9 +2619,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.612", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.612.tgz", - "integrity": "sha512-dM8BMtXtlH237ecSMnYdYuCkib2QHq0kpWfUnavjdYsyr/6OsAwg5ZGUfnQ9KD1Ga4QgB2sqXlB2NT8zy2GnVg==", + "version": "1.4.614", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz", + "integrity": "sha512-X4ze/9Sc3QWs6h92yerwqv7aB/uU8vCjZcrMjA8N9R1pjMFRe44dLsck5FzLilOYvcXuDn93B+bpGYyufc70gQ==", "dev": true }, "node_modules/emittery": { @@ -2902,9 +2905,9 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz", - "integrity": "sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==", + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", "dev": true, "dependencies": { "array-includes": "^3.1.7", @@ -2923,7 +2926,7 @@ "object.groupby": "^1.0.1", "object.values": "^1.1.7", "semver": "^6.3.1", - "tsconfig-paths": "^3.14.2" + "tsconfig-paths": "^3.15.0" }, "engines": { "node": ">=4" @@ -6267,9 +6270,9 @@ } }, "node_modules/tsconfig-paths": { - "version": "3.14.2", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", - "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", "dev": true, "dependencies": { "@types/json5": "^0.0.29", diff --git a/package.json b/package.json index e5b7da7..beed04c 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "dependencies": { "@actions/core": "^1", "@actions/github": "^6", - "@dev-build-deploy/commit-it": "^1", + "@dev-build-deploy/commit-it": "^2", "@dev-build-deploy/diagnose-it": "^1", "commander": "^11", "simple-git": "^3" diff --git a/src/datasources.ts b/src/datasources.ts index 689c545..9bc9d65 100644 --- a/src/datasources.ts +++ b/src/datasources.ts @@ -8,7 +8,7 @@ import * as fs from "fs"; import * as core from "@actions/core"; import * as github from "@actions/github"; -import { ICommit, getCommit } from "@dev-build-deploy/commit-it"; +import { Commit } from "@dev-build-deploy/commit-it"; import { simpleGit } from "simple-git"; /** DataSource abstraction interface @@ -16,7 +16,7 @@ import { simpleGit } from "simple-git"; * @member getCommitMessages Returns a list of commits to be validated */ export interface IDataSource { - getCommitMessages(): Promise; + getCommitMessages(): Promise; getConfigurationFile(path: string): Promise; } @@ -34,8 +34,8 @@ export class FileSource implements IDataSource { } } - async getCommitMessages(): Promise { - return [getCommit({ hash: "HEAD", message: fs.readFileSync(this.file, "utf8") })]; + async getCommitMessages(): Promise { + return [Commit.fromString({ hash: "HEAD", message: fs.readFileSync(this.file, "utf8") })]; } async getConfigurationFile(path: string): Promise { @@ -57,9 +57,9 @@ export class GitSource implements IDataSource { this.sourceBranch = baseBranch; } - async getCommitMessages(): Promise { + async getCommitMessages(): Promise { const data = await simpleGit().log({ from: this.sourceBranch, to: "@{push}" }); - return data.all.map(commit => getCommit({ hash: commit.hash })); + return data.all.map(commit => Commit.fromHash({ hash: commit.hash })); } async getConfigurationFile(path: string): Promise { @@ -75,20 +75,19 @@ export class GitSource implements IDataSource { * GitHub data source for determining which commits need to be validated. */ export class GitHubSource implements IDataSource { - async getCommitMessages(): Promise { + async getCommitMessages(): Promise { const octokit = github.getOctokit(core.getInput("token")); const pullRequestNumber = github.context.payload.pull_request?.number; assert(pullRequestNumber); const commits = await octokit.rest.pulls.listCommits({ ...github.context.repo, pull_number: pullRequestNumber }); - return commits.data.map(commit => { - return { + return commits.data.map(commit => + Commit.fromString({ hash: commit.sha, - subject: commit.commit.message.split(/\r?\n/)[0], - body: commit.commit.message.split(/\r?\n/).slice(2).join("\n"), - }; - }); + message: commit.commit.message, + }) + ); } /** diff --git a/src/entrypoints/action.ts b/src/entrypoints/action.ts index d22e256..7034b46 100644 --- a/src/entrypoints/action.ts +++ b/src/entrypoints/action.ts @@ -7,29 +7,28 @@ import assert from "assert"; import * as core from "@actions/core"; import * as github from "@actions/github"; -import { isConventionalCommit, ICommit, IConventionalCommit } from "@dev-build-deploy/commit-it"; +import { Commit, ConventionalCommit } from "@dev-build-deploy/commit-it"; import { Configuration } from "../configuration"; import { GitHubSource, IDataSource } from "../datasources"; import { updatePullRequestLabels } from "../github"; import * as repository from "../repository"; -import { IValidationResult, validateCommits, validatePullRequest } from "../validator"; +import { validateCommits, validatePullRequest } from "../validator"; /** * Determines the label to be applied to the pull request. * @param commits The validated commits to determine the label from * @returns The label to be applied to the pull request ("breaking", "feature", "fix" or undefined) */ -const determineLabel = async (commits: IValidationResult[]): Promise<"breaking" | "feature" | "fix" | undefined> => { +const determineLabel = async (commits: ConventionalCommit[]): Promise<"breaking" | "feature" | "fix" | undefined> => { let type: "breaking" | "feature" | "fix" | undefined; for (const commit of commits) { - if (!isConventionalCommit(commit.commit)) continue; + if (!commit.isValid) continue; - const convCommit = commit.commit as IConventionalCommit; - if (convCommit.breaking) return "breaking"; - if (convCommit.type === "feat") type = "feature"; - else if (convCommit.type === "fix" && type !== "feature") type = "fix"; + if (commit.breaking) return "breaking"; + if (commit.type?.toLowerCase() === "feat") type = "feature"; + else if (commit.type?.toLowerCase() === "fix" && type !== "feature") type = "fix"; } return type; @@ -40,15 +39,20 @@ const determineLabel = async (commits: IValidationResult[]): Promise<"breaking" * @param results The validation results to report * @returns The total number of errors reported */ -const reportErrorMessages = (results: IValidationResult[]): number => { +const reportErrorMessages = (results: ConventionalCommit[]): { errors: number; warnings: number } => { let errorCount = 0; + let warningCount = 0; for (const commit of results) { - core.info(`${commit.errors.length === 0 ? "✅" : "❌"} ${commit.commit.hash}: ${commit.commit.subject}`); - commit.errors.forEach(error => core.error(error, { title: "Conventional Commit Compliance" })); + core.info(`${commit.errors.length === 0 ? "✅" : "❌"} ${commit.hash}: ${commit.subject}`); + commit.errors.forEach(error => core.error(error.toString(), { title: "Conventional Commit Compliance" })); errorCount += commit.errors.length; + + commit.warnings.forEach(warning => core.warning(warning.toString(), { title: "Conventional Commit Compliance" })); + warningCount += commit.warnings.length; } - return errorCount; + + return { errors: errorCount, warnings: warningCount }; }; const setConfiguration = async (dataSource: IDataSource): Promise => { @@ -108,32 +112,40 @@ async function run(): Promise { const resultCommits = validateCommits(commits); let errorCount = 0; - const allResults: IValidationResult[] = [...resultCommits]; + let warningCount = 0; + const allResults: ConventionalCommit[] = [...resultCommits]; if (config.includePullRequest === true) { core.startGroup(`🔎 Scanning Pull Request`); const resultPullrequest = validatePullRequest( - { + Commit.fromString({ hash: `#${github.context.payload.pull_request.number}`, - subject: github.context.payload.pull_request.title, - body: github.context.payload.pull_request.body ?? "", - } as ICommit, - resultCommits.map(commit => commit.commit as IConventionalCommit).filter(commit => commit !== undefined) + message: [github.context.payload.pull_request.title, "", github.context.payload.pull_request.body].join("\n"), + }), + allResults ); allResults.push(resultPullrequest); - errorCount += reportErrorMessages([resultPullrequest]); + const counts = reportErrorMessages([resultPullrequest]); + errorCount += counts.errors; + warningCount += counts.warnings; + core.endGroup(); } if (config.includeCommits === true) { core.startGroup("🔎 Scanning Commits associated with Pull Request"); - errorCount += reportErrorMessages(resultCommits); + const counts = reportErrorMessages(resultCommits); + errorCount += counts.errors; + warningCount += counts.warnings; + core.endGroup(); } if (errorCount > 0) { - core.setFailed(`❌ Found ${errorCount} Conventional Commits compliance issues.`); + core.setFailed(`❌ Found ${errorCount} Conventional Commit compliance issues, and ${warningCount} warnings.`); return; + } else if (warningCount > 0) { + core.warning(`⚠️ Found ${warningCount} Conventional Commit compliance warnings.`); } // Updating the pull request label diff --git a/src/entrypoints/cli.ts b/src/entrypoints/cli.ts index b2f85de..6192b3f 100644 --- a/src/entrypoints/cli.ts +++ b/src/entrypoints/cli.ts @@ -45,23 +45,28 @@ program const commits = await datasource.getCommitMessages(); let errorCount = 0; + let warningCount = 0; const results = validateCommits(commits); for (const commit of results) { console.log( - `${commit.errors.length === 0 ? "✅" : "❌"} ${commit.commit.hash}: ${commit.commit.subject.substring(0, 77)}${ - commit.commit.subject.length > 80 ? "..." : "" + `${commit.errors.length === 0 ? "✅" : "❌"} ${commit.hash}: ${commit.subject.substring(0, 77)}${ + commit.subject.length > 80 ? "..." : "" }` ); - commit.errors.forEach(error => console.log(error, os.EOL)); + + commit.errors.forEach(err => console.log(err.toString(), os.EOL)); + commit.warnings.forEach(err => console.log(err.toString(), os.EOL)); + errorCount += commit.errors.length; + warningCount += commit.warnings.length; } console.log("-------------------------------------------------------"); if (errorCount === 0) { console.log(`✅ All your commits are compliant with Conventional Commit.`); } else { - program.error(`❌ Found ${errorCount} Conventional Commit compliance issues.`); + program.error(`❌ Found ${errorCount} Conventional Commit compliance issues, and ${warningCount} warnings.`); } }); diff --git a/src/entrypoints/pre-commit.ts b/src/entrypoints/pre-commit.ts index 0980ce8..95ba483 100644 --- a/src/entrypoints/pre-commit.ts +++ b/src/entrypoints/pre-commit.ts @@ -31,13 +31,18 @@ program const commits = await datasource.getCommitMessages(); let errorCount = 0; + let warningCount = 0; + validateCommits(commits).forEach(commit => { - commit.errors.forEach(error => console.log(error, os.EOL)); + commit.errors.forEach(err => console.log(err.toString(), os.EOL)); + commit.warnings.forEach(err => console.log(err.toString(), os.EOL)); + errorCount += commit.errors.length; + warningCount += commit.warnings.length; }); if (errorCount > 0) { - program.error(`❌ Found ${errorCount} Conventional Commit compliance issues.`); + program.error(`❌ Found ${errorCount} Conventional Commit compliance issues, and ${warningCount} warnings.`); } }); diff --git a/src/validator.ts b/src/validator.ts index 511957f..4ec64ac 100644 --- a/src/validator.ts +++ b/src/validator.ts @@ -3,44 +3,18 @@ * SPDX-License-Identifier: MIT */ -import { - ICommit, - IConventionalCommit, - getConventionalCommit, - ConventionalCommitError, -} from "@dev-build-deploy/commit-it"; -import { DiagnosticsMessage } from "@dev-build-deploy/diagnose-it"; +import { Commit, ConventionalCommit } from "@dev-build-deploy/commit-it"; +import { DiagnosticsMessage, FixItHint } from "@dev-build-deploy/diagnose-it"; import { Configuration } from "./configuration"; -/** - * Validation result interface - * @interface IValidationResult - * @member commit The commit that was validated - * @member conventionalCommit The associated conventional commit - * @member errors List of error messages - */ -export interface IValidationResult { - commit: ICommit | IConventionalCommit; - errors: string[]; -} - /** * Validates a single commit message against the Conventional Commit specification. * @param commit Commit message to validate against the Conventional Commit specification * @returns Validation result */ -function validateCommit(commit: ICommit): IValidationResult { - const result: IValidationResult = { commit: commit, errors: [] }; - - try { - result.commit = getConventionalCommit(commit, Configuration.getInstance()); - } catch (error) { - if (!(error instanceof ConventionalCommitError)) throw error; - error.errors.forEach(e => result.errors.push(e.toString())); - } - - return result; +function validateCommit(commit: Commit): ConventionalCommit { + return ConventionalCommit.fromCommit(commit, Configuration.getInstance()); } /** @@ -49,29 +23,31 @@ function validateCommit(commit: ICommit): IValidationResult { * @param commits The commits associated with the pull request * @returns Validation result */ -export function validatePullRequest(pullrequest: ICommit, commits: IConventionalCommit[]): IValidationResult { +export function validatePullRequest(pullrequest: Commit, commits: ConventionalCommit[]): ConventionalCommit { const result = validateCommit(pullrequest); - if (result.errors.length > 0) return result; + if (!result.isValid) return result; - const orderValue = (commit?: ICommit | IConventionalCommit): number => { - if (!commit || !("type" in commit)) return 0; + const orderValue = (commit: ConventionalCommit): number => { if (commit.breaking) return 3; - if (commit.type === "feat") return 2; - if (commit.type === "fix") return 1; + if (commit.type?.toLowerCase() === "feat") return 2; + if (commit.type?.toLowerCase() === "fix") return 1; return 0; }; - const pullRequestValue = orderValue(result.commit); - const commitsValue = orderValue(commits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); + const pullRequestValue = orderValue(result); + const validConventionalCommits = commits.filter(commit => commit.isValid); + const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { result.errors.push( - DiagnosticsMessage.createError(result.commit.hash, { + DiagnosticsMessage.createError(result.hash, { text: `A Pull Request title MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, linenumber: 1, column: 1, - }).toString() + }) + .setContext(1, result.subject) + .addFixitHint(FixItHint.create({ index: 1, length: result.type?.length ?? 1 })) ); } @@ -84,6 +60,6 @@ export function validatePullRequest(pullrequest: ICommit, commits: IConventional * @returns A list of validation results * @see https://www.conventionalcommits.org/en/v1.0.0/ */ -export function validateCommits(commits: ICommit[]): IValidationResult[] { +export function validateCommits(commits: Commit[]): ConventionalCommit[] { return commits.filter(commit => !commit.subject.startsWith("fixup!")).map(commit => validateCommit(commit)); } diff --git a/test/validator.test.ts b/test/validator.test.ts index 154e437..133ed1b 100644 --- a/test/validator.test.ts +++ b/test/validator.test.ts @@ -3,20 +3,19 @@ * SPDX-License-Identifier: MIT */ +import { Commit, ConventionalCommit } from "@dev-build-deploy/commit-it"; + import * as validator from "../src/validator"; describe("Validate commit messages", () => { test("Valid commit message", () => { const result = validator.validateCommits([ - { + Commit.fromString({ hash: "0a0b0c0d", - subject: "feat: Add new feature", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat: Add new feature", + }), ]); + let count = 0; result.forEach(item => (count += item.errors.length)); expect(count).toBe(0); @@ -24,15 +23,12 @@ describe("Validate commit messages", () => { test("Invalid commit message", () => { const result = validator.validateCommits([ - { + Commit.fromString({ hash: "0a0b0c0d", - subject: "feat (no noun): Add new feature", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat (no noun): Add new feature", + }), ]); + let count = 0; result.forEach(item => (count += item.errors.length)); @@ -41,27 +37,41 @@ describe("Validate commit messages", () => { expect(count).toBe(2); }); + test("Commit messages with warnings", () => { + const result = validator.validateCommits([ + Commit.fromString({ + hash: "0a0b0c0d", + message: `feat: Add new feature + +BREAKING CHANGE: this will be ignored and raise a warning... + +... as it is followed by a new paragraph`, + }), + ]); + + let errorCount = 0; + let warningCount = 0; + result.forEach(item => (errorCount += item.errors.length)); + result.forEach(item => (warningCount += item.warnings.length)); + expect(errorCount).toBe(0); + expect(warningCount).toBe(1); + }); + test("Valid Pull Request message", () => { const result = validator.validatePullRequest( - { + Commit.fromString({ hash: "0a0b0c0d", - subject: "feat: Add new feature", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat: Add new feature", + }), [ - { + ConventionalCommit.fromString({ + hash: "0a0b0c0d", + message: "feat: Add new feature", + }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", - type: "feat", - description: "Add new feature", - subject: "feat: Add new feature", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "fix: Fixed a bug", + }), ] ); @@ -70,25 +80,15 @@ describe("Validate commit messages", () => { test("Invalid Pull Request message", () => { const result = validator.validatePullRequest( - { + Commit.fromString({ hash: "0a0b0c0d", - subject: "feat (no noun): Add new feature", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat (no noun): Add new feature", + }), [ - { + ConventionalCommit.fromString({ hash: "0a0b0c0d", - type: "feat", - description: "Add new feature", - subject: "feat: Add new feature", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat: Add new feature", + }), ] ); @@ -99,25 +99,15 @@ describe("Validate commit messages", () => { test("Pull Request > Commits", () => { const result = validator.validatePullRequest( - { + Commit.fromString({ hash: "0a0b0c0d", - subject: "feat!: Add new breaking change", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat!: Add new breaking change", + }), [ - { + ConventionalCommit.fromString({ hash: "0a0b0c0d", - type: "feat", - description: "Add new feature", - subject: "feat: Add new feature", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat: Add new feature", + }), ] ); @@ -126,25 +116,15 @@ describe("Validate commit messages", () => { test("Pull Request === Commits", () => { const result = validator.validatePullRequest( - { + Commit.fromString({ hash: "0a0b0c0d", - subject: "feat: Add new breaking change", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat: Add new feature", + }), [ - { + ConventionalCommit.fromString({ hash: "0a0b0c0d", - type: "feat", - description: "Add new feature", - subject: "feat: Add new feature", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat: Add new feature", + }), ] ); @@ -153,21 +133,15 @@ describe("Validate commit messages", () => { test("Pull Request < Commits", () => { const result = validator.validatePullRequest( - { + Commit.fromString({ hash: "0a0b0c0d", - subject: "chore: Add new breaking change", - }, + message: "chore: Add new breaking change", + }), [ - { + ConventionalCommit.fromString({ hash: "0a0b0c0d", - type: "feat", - description: "Add new feature", - subject: "feat: Add new feature", - body: "This is a body", - footer: { - "Acked-by": "Jane Doe", - }, - }, + message: "feat: Add new feature", + }), ] ); From ef114af3d79e2f0a69c64a3b4b7245476bbc0709 Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Sun, 17 Dec 2023 08:09:46 +0100 Subject: [PATCH 03/22] chore: update commit-it to v2.0.3 --- lib/action/index.js | 8 ++++++-- lib/cli/index.js | 8 ++++++-- lib/precommit/index.js | 8 ++++++-- package-lock.json | 26 +++++++++++++------------- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index bf88738..c767a62 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -2383,16 +2383,20 @@ class ConventionalCommit { } // Conventional Commit get type() { - return this._raw.type.value; + return this._raw.type.value?.trimEnd(); } get scope() { + // Removes the parenthesis from the scope + if (this._raw.scope.value !== undefined) { + return this._raw.scope.value.trimEnd().replace(/(\(|\))/g, ""); + } return this._raw.scope.value; } get description() { return this._raw.description.value; } get breaking() { - return (this._raw.breaking.value === "!" || + return (this._raw.breaking.value?.trimEnd() === "!" || (this.footer !== undefined && ("BREAKING CHANGE" in this.footer || "BREAKING-CHANGE" in this.footer))); } // Raw diff --git a/lib/cli/index.js b/lib/cli/index.js index ab721cb..1eb3f34 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -2384,16 +2384,20 @@ class ConventionalCommit { } // Conventional Commit get type() { - return this._raw.type.value; + return this._raw.type.value?.trimEnd(); } get scope() { + // Removes the parenthesis from the scope + if (this._raw.scope.value !== undefined) { + return this._raw.scope.value.trimEnd().replace(/(\(|\))/g, ""); + } return this._raw.scope.value; } get description() { return this._raw.description.value; } get breaking() { - return (this._raw.breaking.value === "!" || + return (this._raw.breaking.value?.trimEnd() === "!" || (this.footer !== undefined && ("BREAKING CHANGE" in this.footer || "BREAKING-CHANGE" in this.footer))); } // Raw diff --git a/lib/precommit/index.js b/lib/precommit/index.js index c37b1eb..9136523 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -2384,16 +2384,20 @@ class ConventionalCommit { } // Conventional Commit get type() { - return this._raw.type.value; + return this._raw.type.value?.trimEnd(); } get scope() { + // Removes the parenthesis from the scope + if (this._raw.scope.value !== undefined) { + return this._raw.scope.value.trimEnd().replace(/(\(|\))/g, ""); + } return this._raw.scope.value; } get description() { return this._raw.description.value; } get breaking() { - return (this._raw.breaking.value === "!" || + return (this._raw.breaking.value?.trimEnd() === "!" || (this.footer !== undefined && ("BREAKING CHANGE" in this.footer || "BREAKING-CHANGE" in this.footer))); } // Raw diff --git a/package-lock.json b/package-lock.json index 713cece..ff78745 100644 --- a/package-lock.json +++ b/package-lock.json @@ -743,9 +743,9 @@ "dev": true }, "node_modules/@dev-build-deploy/commit-it": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.0.2.tgz", - "integrity": "sha512-gMcFU3ik5ikkx+xnwH9wdkucWhxONy7+5g+F7z/XEjzXPxJSY02WusxnCFu+KalTvc9T3bZbXyqtYClTMy5e8Q==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.0.3.tgz", + "integrity": "sha512-snSsstI8kytKXmEY5MXxj0pYM2t1JD0uf2uOTQSgHg6pKfC1A8YeiCUFPqbNFSeALLI580RZ3FafTTvU+Gyjyw==", "dependencies": { "@dev-build-deploy/diagnose-it": "^1", "chalk": "<5" @@ -820,9 +820,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", - "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1513,9 +1513,9 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.7", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.7.tgz", - "integrity": "sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==", + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", "dev": true, "dependencies": { "@babel/types": "^7.0.0" @@ -2779,15 +2779,15 @@ } }, "node_modules/eslint": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", - "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.55.0", + "@eslint/js": "8.56.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", From b458c2fc9ac21d38a5b5654b6864a49cd2c1c591 Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Wed, 17 Jan 2024 13:27:07 +0100 Subject: [PATCH 04/22] feat: extend configuration management This commit reworks the configuration management for the different options of CommitMe (GitHub Action, CLI and PreCommit), incl: - Extending the Configuration file with `githubActions` settings - Ensure that the GitHub Actions inputs take precedence over the configuration file In addition, this resolves several issue related to the configuration as applied during the GHA execution. --- .github/workflows/conventional-commits.yml | 6 - README.md | 18 +- docs/config.md | 47 ++++ docs/github-action.md | 17 +- lib/action/index.js | 163 ++++++++++--- lib/cli/index.js | 198 ++++++++++++++-- lib/precommit/index.js | 198 ++++++++++++++-- src/configuration.ts | 49 +++- src/entrypoints/action.ts | 45 ++-- src/validator.ts | 2 +- test/configuration.test.ts | 258 +++++++++++++++++++++ test/validator.test.ts | 144 +++++++----- 12 files changed, 962 insertions(+), 183 deletions(-) create mode 100644 docs/config.md create mode 100644 test/configuration.test.ts diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml index 6ee40b2..7293b40 100644 --- a/.github/workflows/conventional-commits.yml +++ b/.github/workflows/conventional-commits.yml @@ -34,12 +34,6 @@ jobs: # Pull Request without requiring the `contents:write` # permission config: .github/.commit-me.json # Path to your CommitMe configuration file - types: | # Limit the Conventional Commits type to the following values; - magic - void - scopes: | # Limit the Conventional Commits scopes to the following values; - foo - bar env: # Enable colored output in GitHub Actions FORCE_COLOR: 3 diff --git a/README.md b/README.md index 6abbe66..a67c29c 100644 --- a/README.md +++ b/README.md @@ -20,23 +20,9 @@ Please refer to the document related to your environment for more details on the - [Command Line Interface](./docs/cli.md) - [Pre-commit Hook](./docs/pre-commit.md) -## Configuration file +## Configuration -You can create a global configuration file: - -```json -{ - "types": [ "build", "chore", "ci", "docs", "style", "refactor", "perf", "test" ], - "scopes": [ "server", "client" ] -} -``` - -| Configuration Item | Description | -| -------------------| ------------| -| `types` | Conventional Commit types to allow. By default it always supports `feat` and `fix`. | -| `scopes` | Conventional Commit scopes to allow. No restrictions will be applied when not specified. | - -> :bulb: By default, CommitMe will attempt to load `.commit-me.json` in the root of your repository +Please refer to the [Global Configuration documentation](./docs/config.md) for details on how to configure `CommitMe`. ## Contributing diff --git a/docs/config.md b/docs/config.md new file mode 100644 index 0000000..d331ff6 --- /dev/null +++ b/docs/config.md @@ -0,0 +1,47 @@ + + +# Global configuration file + +You can create a global configuration file, for example: + +```json +{ + "types": [ "build", "chore", "ci", "docs", "style", "refactor", "perf", "test" ], + "scopes": [ "server", "client" ], + "githubAction": { + "includeCommits": true, + "includePullRequest": true, + "updatePullRequestLabels": true, + } +} +``` + +> [!NOTE] +> By default, CommitMe will attempt to load `.commit-me.json` in the root of your repository + +## Generic settings + +The following settings will be taken into account for all `CommitMe` clients ([GitHub Action](./github-action.md), [CLI](./cli.md), and [Pre-Commit](./pre-commit.md)) + +| Configuration Item | Description | +| -------------------| ------------| +| `types` | Conventional Commit types to allow. By default it always supports `feat` and `fix`. | +| `scopes` | Conventional Commit scopes to allow. No restrictions will be applied when not specified. | + +## GitHub Actions settings + +You can also configure the majority of inputs for the [GitHub Action](./github-action.md) using the configuration file: + +| Configuration Item | Description | +| ---------------------------------------| ------------| +| `githubAction.includeCommits` | Include commits associated with the Pull Request during validation; by default we use the repository configuration settings to determine this value (requires `contents:write` permission if **NOT** set). | +| `githubAction.includePullRequest` | Include the Pull Request during validation, defaults to `true`. | +| `githubAction.updatePullRequestLabels` | Allow CommitMe to manage [labels](./github-action.md#pull-request-labels) based on the [Conventional Commits] metadata (requires `pull-requests:write` permission), defaults to `true` | + +> [!WARNING] +> The inputs given to the GitHub Action take precedence over the configuration file + +[Conventional Commits]: https://www.conventionalcommits.org/en/v1.0.0/ diff --git a/docs/github-action.md b/docs/github-action.md index 69f35ea..fba371b 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -12,8 +12,8 @@ You can scan your [pull requests](#pull-request-scanning) for determining compli ## Validation strategies Currently there are two distinct [Conventional Commits] validation strategies implemented; -- Validate the Pull Request title and all associated commits _(default behavior)_. -- **ONLY** validate the Pull Request title. +- Validate the Pull Request and all associated commits _(default behavior)_. +- **ONLY** validate the Pull Request. Selection of the strategy is based on either: - The allowed merge strategies in your repository (the `contents: write` permission needs to be set in order for this detection to work.) @@ -95,7 +95,7 @@ You can limit the Conventional Commit Type and/or Scope using the related input - uses: dev-build-deploy/commit-me@v0 with: # OPTIONAL; Enforce that each commit contains a predefined scope - scope: | + scopes: | backend frontend # OPTIONAL; Limit the Conventional Commits type to `feat`, `fix`, and a custom entries `docs` and `debt` @@ -112,8 +112,8 @@ We recommend using the [`pull_request`](https://docs.github.com/en/actions/using In addition, we recommend the following activity types: | Activity | Description | | --- | --- | -| `opened` | Validates all commits in the source branch of your Pull Request upon opening the PR | -| `edited` | Validates any change to the Pull Requests title | +| `opened` | Validvates all commits in the source branch of your Pull Request upon opening the PR | +| `edited` | Validates any change to the Pull Requests | | `synchronize` | Validate all subsequent commits added to the (open) Pull Request. This is only required in case rebase merges are enabled on the target repository. | > **NOTE**: Although supported, the trigger `pull_request_target` has elevated permissions to access secrets and your repository. Please refer to this [GitHub security blog post](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) for more details @@ -124,9 +124,14 @@ In addition, we recommend the following activity types: | --- | --- | --- | | `token` | *NO* | GitHub token needed to access your commits in your pull request. This is **only** required in case you want to:
  • Validate commits associated with your Pull Request
  • Update labels in your Pull Request
| | `update-labels` | *NO* | Allow CommitMe to manage [labels](#pull-request-labels) based on the [Conventional Commits] metadata (requires `pull-requests:write` permission), defaults to `true` | -| `include-commits` | *NO* | Include commits associated with the Pull Request; by default we use the repository configuration settings to determine this value (requires `contents:write` permission if **NOT** set). | +| `scopes` | *NO* | Conventional Commit scopes to allow. No restrictions will be applied when not specified. | +| `types` | *NO* | Conventional Commit types to allow. By default it always supports `feat` and `fix`. | +| `include-commits` | *NO* | Include commits associated with the Pull Request during validation; by default we use the repository configuration settings to determine this value (requires `contents:write` permission if **NOT** set). | | `config` | *NO* | Path to the configuration file; by default `.pre-commit.json` is used. | +> [!NOTE] +> You can also configure the majority of the inputs using the [Global Configuration file](./config.md#github-actions-settings) + ### Permissions | Name | Value | Comment | diff --git a/lib/action/index.js b/lib/action/index.js index c767a62..f365448 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -2154,9 +2154,15 @@ class Commit { * @returns The commit object */ static fromString(props) { + // Git will trim all comments (lines starting with #), so we do the same + // to ensure the commit message is parsed correctly. + const trimmedMessage = props.message + .split(/\r?\n/) + .filter(line => !line.startsWith("#")) + .join("\n"); const commit = { hash: props.hash, - ...parseCommitMessage(props.message), + ...parseCommitMessage(trimmedMessage), author: props.author, committer: props.committer, raw: props.message, @@ -13965,6 +13971,12 @@ function pick(source, properties) { function delay(duration = 0) { return new Promise((done) => setTimeout(done, duration)); } +function orVoid(input) { + if (input === false) { + return void 0; + } + return input; +} var import_file_exists, NULL, NOOP, objectToString; var init_util = __esm({ "src/lib/utils/util.ts"() { @@ -14231,6 +14243,7 @@ __export(utils_exports, { isUserFunction: () => isUserFunction, last: () => last, objectToString: () => objectToString, + orVoid: () => orVoid, parseStringResponse: () => parseStringResponse, pick: () => pick, prefixedArray: () => prefixedArray, @@ -14665,6 +14678,29 @@ var init_config = __esm({ } }); +// src/lib/tasks/diff-name-status.ts +function isDiffNameStatus(input) { + return diffNameStatus.has(input); +} +var DiffNameStatus, diffNameStatus; +var init_diff_name_status = __esm({ + "src/lib/tasks/diff-name-status.ts"() { + DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => { + DiffNameStatus2["ADDED"] = "A"; + DiffNameStatus2["COPIED"] = "C"; + DiffNameStatus2["DELETED"] = "D"; + DiffNameStatus2["MODIFIED"] = "M"; + DiffNameStatus2["RENAMED"] = "R"; + DiffNameStatus2["CHANGED"] = "T"; + DiffNameStatus2["UNMERGED"] = "U"; + DiffNameStatus2["UNKNOWN"] = "X"; + DiffNameStatus2["BROKEN"] = "B"; + return DiffNameStatus2; + })(DiffNameStatus || {}); + diffNameStatus = new Set(Object.values(DiffNameStatus)); + } +}); + // src/lib/tasks/grep.ts function grepQueryBuilder(...params) { return new GrepQuery().param(...params); @@ -14788,6 +14824,7 @@ var api_exports = {}; __export(api_exports, { CheckRepoActions: () => CheckRepoActions, CleanOptions: () => CleanOptions, + DiffNameStatus: () => DiffNameStatus, GitConfigScope: () => GitConfigScope, GitConstructError: () => GitConstructError, GitError: () => GitError, @@ -14809,6 +14846,7 @@ var init_api = __esm({ init_check_is_repo(); init_clean(); init_config(); + init_diff_name_status(); init_grep(); init_reset(); } @@ -15864,6 +15902,7 @@ var init_parse_diff_summary = __esm({ "src/lib/parsers/parse-diff-summary.ts"() { init_log_format(); init_DiffSummary(); + init_diff_name_status(); init_utils(); statParser = [ new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => { @@ -15929,11 +15968,12 @@ var init_parse_diff_summary = __esm({ }) ]; nameStatusParser = [ - new LineParser(/([ACDMRTUXB])\s*(.+)$/, (result, [_status, file]) => { + new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, _similarity, from, _to, to]) => { result.changed++; result.files.push({ - file, + file: to != null ? to : from, changes: 0, + status: orVoid(isDiffNameStatus(status) && status), insertions: 0, deletions: 0, binary: false @@ -41071,17 +41111,47 @@ function wrappy (fn, cb) { /***/ }), /***/ 5778: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Configuration = void 0; /* * SPDX-FileCopyrightText: 2023 Kevin de Jong * SPDX-License-Identifier: MIT */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Configuration = void 0; +const assert_1 = __importDefault(__nccwpck_require__(9491)); +const core = __importStar(__nccwpck_require__(2186)); +const github = __importStar(__nccwpck_require__(5438)); const datasources_1 = __nccwpck_require__(1751); +const repository = __importStar(__nccwpck_require__(259)); /** * Configuration class * @class Configuration @@ -41094,6 +41164,7 @@ class Configuration { static _instance; includeCommits = false; includePullRequest = false; + updatePullRequestLabels = false; scopes; types; static getInstance() { @@ -41130,23 +41201,48 @@ class Configuration { */ async fromDatasource(datasource, configPath) { const content = await datasource.getConfigurationFile(configPath ?? ".commit-me.json"); - if (!content) - return this; + const config = content ? JSON.parse(content) : {}; if (datasource instanceof datasources_1.GitSource || datasource instanceof datasources_1.FileSource) { this.includeCommits = true; this.includePullRequest = false; + this.updatePullRequestLabels = false; + this.addScopes(config.scopes ?? []); + this.addTypes(config.types ?? []); } else if (datasource instanceof datasources_1.GitHubSource) { - this.includePullRequest = true; + const hasIncludeCommitsInput = core.getInput("include-commits") !== ""; + const hasPullRequestLabelsInput = core.getInput("update-labels") !== ""; + const autoDetectIncludeCommits = !hasIncludeCommitsInput && config.githubAction?.includeCommits === undefined; + if (autoDetectIncludeCommits) { + (0, assert_1.default)(github.context.payload.pull_request); + repository.checkConfiguration(github.context.payload.pull_request.base.repo); + this.includeCommits = github.context.payload.pull_request.base.repo.allow_rebase_merge === true; + } + else { + this.includeCommits = hasIncludeCommitsInput + ? core.getBooleanInput("include-commits") + : config.githubAction?.includeCommits ?? false; + } + this.includePullRequest = config.githubAction?.includePullRequest ?? true; + if (core.getMultilineInput("scopes").length > 0) { + this.addScopes(core.getMultilineInput("scopes")); + } + else { + this.addScopes(config.scopes ?? []); + } + if (core.getMultilineInput("types").length > 0) { + this.addTypes(core.getMultilineInput("types")); + } + else { + this.addTypes(config.types ?? []); + } + this.updatePullRequestLabels = hasPullRequestLabelsInput + ? core.getBooleanInput("update-labels") + : config.githubAction?.updatePullRequestLabels ?? false; } else { throw new Error("Unsupported data source"); } - const config = JSON.parse(content); - this.includeCommits = config.includeCommits ?? this.includeCommits; - this.includePullRequest = config.includePullRequest ?? this.includePullRequest; - this.addScopes(config.scopes ?? []); - this.addTypes(config.types ?? []); return this; } } @@ -41327,7 +41423,6 @@ const commit_it_1 = __nccwpck_require__(9403); const configuration_1 = __nccwpck_require__(5778); const datasources_1 = __nccwpck_require__(1751); const github_1 = __nccwpck_require__(978); -const repository = __importStar(__nccwpck_require__(259)); const validator_1 = __nccwpck_require__(4630); /** * Determines the label to be applied to the pull request. @@ -41365,27 +41460,15 @@ const reportErrorMessages = (results) => { } return { errors: errorCount, warnings: warningCount }; }; -const setConfiguration = async (dataSource) => { - (0, assert_1.default)(github.context.payload.pull_request); - const pullrequestOnly = core.getInput("include-commits") - ? !core.getBooleanInput("include-commits") - : github.context.payload.pull_request.base.repo.allow_rebase_merge === false; - // Set the global configuration - const config = await configuration_1.Configuration.getInstance().fromDatasource(dataSource, core.getInput("config") || undefined); - config.includeCommits = !pullrequestOnly; - config.addScopes(core.getMultilineInput("scopes") ?? []); - config.addTypes(core.getMultilineInput("types") ?? []); -}; /** * Main entry point for the GitHub Action. */ async function run() { try { core.info("📄 CommitMe - Conventional Commit compliance validation"); - const datasource = new datasources_1.GitHubSource(); - await setConfiguration(datasource); core.startGroup("📝 Checking repository configuration"); - const config = configuration_1.Configuration.getInstance(); + const datasource = new datasources_1.GitHubSource(); + const config = await configuration_1.Configuration.getInstance().fromDatasource(datasource, core.getInput("config") || undefined); const githubToken = core.getInput("token") ?? undefined; (0, assert_1.default)(github.context.payload.pull_request); if (!["pull_request", "pull_request_target"].includes(github.context.eventName)) { @@ -41396,13 +41479,21 @@ async function run() { core.setFailed("❌ The `token` input is required for the current configuration of CommitMe."); return; } - if (core.getInput("include-commits") === undefined) { - repository.checkConfiguration(github.context.payload.pull_request.base.repo); + if (config.includeCommits === true) { + if (config.includePullRequest === true) { + core.info("ℹ️ Validating both Pull Request and all associated commits."); + } + else { + core.info("ℹ️ Only validating the commits associated with the Pull Request."); + } } else { - core.info(config.includeCommits === true - ? "ℹ️ Validating both Pull Request title and all associated commits." - : "ℹ️ Only validating the Pull Request title."); + if (config.includePullRequest === true) { + core.info("ℹ️ Only validating the Pull Request."); + } + else { + core.setFailed("❌ The current configuration of CommitMe does not validate either Pull Request or the associated commits."); + } } // Setting up the environment const commits = config.includeCommits ? await datasource.getCommitMessages() : []; @@ -41442,7 +41533,7 @@ async function run() { if (githubToken === undefined) { core.warning("⚠️ The token input is required to update the pull request label."); } - else if (core.getBooleanInput("update-labels") === true) { + else if (config.updatePullRequestLabels === true) { const label = await determineLabel(allResults); if (label !== undefined) await (0, github_1.updatePullRequestLabels)(label); @@ -41639,7 +41730,7 @@ function validatePullRequest(pullrequest, commits) { const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.hash, { - text: `A Pull Request title MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, + text: `A Pull Request MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, linenumber: 1, column: 1, }) diff --git a/lib/cli/index.js b/lib/cli/index.js index 1eb3f34..5feb295 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -2155,9 +2155,15 @@ class Commit { * @returns The commit object */ static fromString(props) { + // Git will trim all comments (lines starting with #), so we do the same + // to ensure the commit message is parsed correctly. + const trimmedMessage = props.message + .split(/\r?\n/) + .filter(line => !line.startsWith("#")) + .join("\n"); const commit = { hash: props.hash, - ...parseCommitMessage(props.message), + ...parseCommitMessage(trimmedMessage), author: props.author, committer: props.committer, raw: props.message, @@ -13966,6 +13972,12 @@ function pick(source, properties) { function delay(duration = 0) { return new Promise((done) => setTimeout(done, duration)); } +function orVoid(input) { + if (input === false) { + return void 0; + } + return input; +} var import_file_exists, NULL, NOOP, objectToString; var init_util = __esm({ "src/lib/utils/util.ts"() { @@ -14232,6 +14244,7 @@ __export(utils_exports, { isUserFunction: () => isUserFunction, last: () => last, objectToString: () => objectToString, + orVoid: () => orVoid, parseStringResponse: () => parseStringResponse, pick: () => pick, prefixedArray: () => prefixedArray, @@ -14666,6 +14679,29 @@ var init_config = __esm({ } }); +// src/lib/tasks/diff-name-status.ts +function isDiffNameStatus(input) { + return diffNameStatus.has(input); +} +var DiffNameStatus, diffNameStatus; +var init_diff_name_status = __esm({ + "src/lib/tasks/diff-name-status.ts"() { + DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => { + DiffNameStatus2["ADDED"] = "A"; + DiffNameStatus2["COPIED"] = "C"; + DiffNameStatus2["DELETED"] = "D"; + DiffNameStatus2["MODIFIED"] = "M"; + DiffNameStatus2["RENAMED"] = "R"; + DiffNameStatus2["CHANGED"] = "T"; + DiffNameStatus2["UNMERGED"] = "U"; + DiffNameStatus2["UNKNOWN"] = "X"; + DiffNameStatus2["BROKEN"] = "B"; + return DiffNameStatus2; + })(DiffNameStatus || {}); + diffNameStatus = new Set(Object.values(DiffNameStatus)); + } +}); + // src/lib/tasks/grep.ts function grepQueryBuilder(...params) { return new GrepQuery().param(...params); @@ -14789,6 +14825,7 @@ var api_exports = {}; __export(api_exports, { CheckRepoActions: () => CheckRepoActions, CleanOptions: () => CleanOptions, + DiffNameStatus: () => DiffNameStatus, GitConfigScope: () => GitConfigScope, GitConstructError: () => GitConstructError, GitError: () => GitError, @@ -14810,6 +14847,7 @@ var init_api = __esm({ init_check_is_repo(); init_clean(); init_config(); + init_diff_name_status(); init_grep(); init_reset(); } @@ -15865,6 +15903,7 @@ var init_parse_diff_summary = __esm({ "src/lib/parsers/parse-diff-summary.ts"() { init_log_format(); init_DiffSummary(); + init_diff_name_status(); init_utils(); statParser = [ new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => { @@ -15930,11 +15969,12 @@ var init_parse_diff_summary = __esm({ }) ]; nameStatusParser = [ - new LineParser(/([ACDMRTUXB])\s*(.+)$/, (result, [_status, file]) => { + new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, _similarity, from, _to, to]) => { result.changed++; result.files.push({ - file, + file: to != null ? to : from, changes: 0, + status: orVoid(isDiffNameStatus(status) && status), insertions: 0, deletions: 0, binary: false @@ -41072,17 +41112,47 @@ function wrappy (fn, cb) { /***/ }), /***/ 5778: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Configuration = void 0; /* * SPDX-FileCopyrightText: 2023 Kevin de Jong * SPDX-License-Identifier: MIT */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Configuration = void 0; +const assert_1 = __importDefault(__nccwpck_require__(9491)); +const core = __importStar(__nccwpck_require__(2186)); +const github = __importStar(__nccwpck_require__(5438)); const datasources_1 = __nccwpck_require__(1751); +const repository = __importStar(__nccwpck_require__(259)); /** * Configuration class * @class Configuration @@ -41095,6 +41165,7 @@ class Configuration { static _instance; includeCommits = false; includePullRequest = false; + updatePullRequestLabels = false; scopes; types; static getInstance() { @@ -41131,23 +41202,48 @@ class Configuration { */ async fromDatasource(datasource, configPath) { const content = await datasource.getConfigurationFile(configPath ?? ".commit-me.json"); - if (!content) - return this; + const config = content ? JSON.parse(content) : {}; if (datasource instanceof datasources_1.GitSource || datasource instanceof datasources_1.FileSource) { this.includeCommits = true; this.includePullRequest = false; + this.updatePullRequestLabels = false; + this.addScopes(config.scopes ?? []); + this.addTypes(config.types ?? []); } else if (datasource instanceof datasources_1.GitHubSource) { - this.includePullRequest = true; + const hasIncludeCommitsInput = core.getInput("include-commits") !== ""; + const hasPullRequestLabelsInput = core.getInput("update-labels") !== ""; + const autoDetectIncludeCommits = !hasIncludeCommitsInput && config.githubAction?.includeCommits === undefined; + if (autoDetectIncludeCommits) { + (0, assert_1.default)(github.context.payload.pull_request); + repository.checkConfiguration(github.context.payload.pull_request.base.repo); + this.includeCommits = github.context.payload.pull_request.base.repo.allow_rebase_merge === true; + } + else { + this.includeCommits = hasIncludeCommitsInput + ? core.getBooleanInput("include-commits") + : config.githubAction?.includeCommits ?? false; + } + this.includePullRequest = config.githubAction?.includePullRequest ?? true; + if (core.getMultilineInput("scopes").length > 0) { + this.addScopes(core.getMultilineInput("scopes")); + } + else { + this.addScopes(config.scopes ?? []); + } + if (core.getMultilineInput("types").length > 0) { + this.addTypes(core.getMultilineInput("types")); + } + else { + this.addTypes(config.types ?? []); + } + this.updatePullRequestLabels = hasPullRequestLabelsInput + ? core.getBooleanInput("update-labels") + : config.githubAction?.updatePullRequestLabels ?? false; } else { throw new Error("Unsupported data source"); } - const config = JSON.parse(content); - this.includeCommits = config.includeCommits ?? this.includeCommits; - this.includePullRequest = config.includePullRequest ?? this.includePullRequest; - this.addScopes(config.scopes ?? []); - this.addTypes(config.types ?? []); return this; } } @@ -41349,6 +41445,78 @@ program program.parse(process.argv); +/***/ }), + +/***/ 259: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.checkConfiguration = void 0; +const core = __importStar(__nccwpck_require__(2186)); +/** + * Checks the repository merge configuration; + * - Whether merge commits are enabled and whether the default subject is based on the Pull Request title + * - Whether squash commits are enabled and whether the default subject is based on the Pull Request title + * - Whether rebase commits are enabled + */ +function checkConfiguration(repository) { + if (repository.allow_merge_commit === undefined || + repository.allow_squash_merge === undefined || + repository.allow_rebase_merge === undefined) { + throw new Error("❌ CommitMe is not configured correctly. Please provide either:\n - The `contents: write` permission, or\n - Use the `include-commits` input parameter."); + } + if (repository.allow_merge_commit) { + core.info(repository.merge_commit_title === "PR_TITLE" + ? "✅ Default merge commit subject will use the Pull Request title." + : "⚠️ Default merge commit subject is not based on your Pull Request title."); + } + else { + core.info("ℹ️ Merge commit strategy is disabled."); + } + if (repository.allow_squash_merge === true) { + core.info(repository.squash_merge_commit_title === "PR_TITLE" + ? "✅ Default squash commit subject will use the Pull Request title." + : "⚠️ Default squash commit subject is based on either your Commit message or Pull Request title."); + } + else { + core.info("ℹ️ Squash commit strategy is disabled."); + } + core.info(repository.allow_rebase_merge === true + ? "ℹ️ Rebase merges are enabled, validating both Pull Request title and all associated commits." + : "ℹ️ Rebase merges are disabled, only validating the Pull Request title."); +} +exports.checkConfiguration = checkConfiguration; + + /***/ }), /***/ 4630: @@ -41397,7 +41565,7 @@ function validatePullRequest(pullrequest, commits) { const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.hash, { - text: `A Pull Request title MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, + text: `A Pull Request MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, linenumber: 1, column: 1, }) diff --git a/lib/precommit/index.js b/lib/precommit/index.js index 9136523..6b74f96 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -2155,9 +2155,15 @@ class Commit { * @returns The commit object */ static fromString(props) { + // Git will trim all comments (lines starting with #), so we do the same + // to ensure the commit message is parsed correctly. + const trimmedMessage = props.message + .split(/\r?\n/) + .filter(line => !line.startsWith("#")) + .join("\n"); const commit = { hash: props.hash, - ...parseCommitMessage(props.message), + ...parseCommitMessage(trimmedMessage), author: props.author, committer: props.committer, raw: props.message, @@ -13966,6 +13972,12 @@ function pick(source, properties) { function delay(duration = 0) { return new Promise((done) => setTimeout(done, duration)); } +function orVoid(input) { + if (input === false) { + return void 0; + } + return input; +} var import_file_exists, NULL, NOOP, objectToString; var init_util = __esm({ "src/lib/utils/util.ts"() { @@ -14232,6 +14244,7 @@ __export(utils_exports, { isUserFunction: () => isUserFunction, last: () => last, objectToString: () => objectToString, + orVoid: () => orVoid, parseStringResponse: () => parseStringResponse, pick: () => pick, prefixedArray: () => prefixedArray, @@ -14666,6 +14679,29 @@ var init_config = __esm({ } }); +// src/lib/tasks/diff-name-status.ts +function isDiffNameStatus(input) { + return diffNameStatus.has(input); +} +var DiffNameStatus, diffNameStatus; +var init_diff_name_status = __esm({ + "src/lib/tasks/diff-name-status.ts"() { + DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => { + DiffNameStatus2["ADDED"] = "A"; + DiffNameStatus2["COPIED"] = "C"; + DiffNameStatus2["DELETED"] = "D"; + DiffNameStatus2["MODIFIED"] = "M"; + DiffNameStatus2["RENAMED"] = "R"; + DiffNameStatus2["CHANGED"] = "T"; + DiffNameStatus2["UNMERGED"] = "U"; + DiffNameStatus2["UNKNOWN"] = "X"; + DiffNameStatus2["BROKEN"] = "B"; + return DiffNameStatus2; + })(DiffNameStatus || {}); + diffNameStatus = new Set(Object.values(DiffNameStatus)); + } +}); + // src/lib/tasks/grep.ts function grepQueryBuilder(...params) { return new GrepQuery().param(...params); @@ -14789,6 +14825,7 @@ var api_exports = {}; __export(api_exports, { CheckRepoActions: () => CheckRepoActions, CleanOptions: () => CleanOptions, + DiffNameStatus: () => DiffNameStatus, GitConfigScope: () => GitConfigScope, GitConstructError: () => GitConstructError, GitError: () => GitError, @@ -14810,6 +14847,7 @@ var init_api = __esm({ init_check_is_repo(); init_clean(); init_config(); + init_diff_name_status(); init_grep(); init_reset(); } @@ -15865,6 +15903,7 @@ var init_parse_diff_summary = __esm({ "src/lib/parsers/parse-diff-summary.ts"() { init_log_format(); init_DiffSummary(); + init_diff_name_status(); init_utils(); statParser = [ new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => { @@ -15930,11 +15969,12 @@ var init_parse_diff_summary = __esm({ }) ]; nameStatusParser = [ - new LineParser(/([ACDMRTUXB])\s*(.+)$/, (result, [_status, file]) => { + new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, _similarity, from, _to, to]) => { result.changed++; result.files.push({ - file, + file: to != null ? to : from, changes: 0, + status: orVoid(isDiffNameStatus(status) && status), insertions: 0, deletions: 0, binary: false @@ -41072,17 +41112,47 @@ function wrappy (fn, cb) { /***/ }), /***/ 5778: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Configuration = void 0; /* * SPDX-FileCopyrightText: 2023 Kevin de Jong * SPDX-License-Identifier: MIT */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Configuration = void 0; +const assert_1 = __importDefault(__nccwpck_require__(9491)); +const core = __importStar(__nccwpck_require__(2186)); +const github = __importStar(__nccwpck_require__(5438)); const datasources_1 = __nccwpck_require__(1751); +const repository = __importStar(__nccwpck_require__(259)); /** * Configuration class * @class Configuration @@ -41095,6 +41165,7 @@ class Configuration { static _instance; includeCommits = false; includePullRequest = false; + updatePullRequestLabels = false; scopes; types; static getInstance() { @@ -41131,23 +41202,48 @@ class Configuration { */ async fromDatasource(datasource, configPath) { const content = await datasource.getConfigurationFile(configPath ?? ".commit-me.json"); - if (!content) - return this; + const config = content ? JSON.parse(content) : {}; if (datasource instanceof datasources_1.GitSource || datasource instanceof datasources_1.FileSource) { this.includeCommits = true; this.includePullRequest = false; + this.updatePullRequestLabels = false; + this.addScopes(config.scopes ?? []); + this.addTypes(config.types ?? []); } else if (datasource instanceof datasources_1.GitHubSource) { - this.includePullRequest = true; + const hasIncludeCommitsInput = core.getInput("include-commits") !== ""; + const hasPullRequestLabelsInput = core.getInput("update-labels") !== ""; + const autoDetectIncludeCommits = !hasIncludeCommitsInput && config.githubAction?.includeCommits === undefined; + if (autoDetectIncludeCommits) { + (0, assert_1.default)(github.context.payload.pull_request); + repository.checkConfiguration(github.context.payload.pull_request.base.repo); + this.includeCommits = github.context.payload.pull_request.base.repo.allow_rebase_merge === true; + } + else { + this.includeCommits = hasIncludeCommitsInput + ? core.getBooleanInput("include-commits") + : config.githubAction?.includeCommits ?? false; + } + this.includePullRequest = config.githubAction?.includePullRequest ?? true; + if (core.getMultilineInput("scopes").length > 0) { + this.addScopes(core.getMultilineInput("scopes")); + } + else { + this.addScopes(config.scopes ?? []); + } + if (core.getMultilineInput("types").length > 0) { + this.addTypes(core.getMultilineInput("types")); + } + else { + this.addTypes(config.types ?? []); + } + this.updatePullRequestLabels = hasPullRequestLabelsInput + ? core.getBooleanInput("update-labels") + : config.githubAction?.updatePullRequestLabels ?? false; } else { throw new Error("Unsupported data source"); } - const config = JSON.parse(content); - this.includeCommits = config.includeCommits ?? this.includeCommits; - this.includePullRequest = config.includePullRequest ?? this.includePullRequest; - this.addScopes(config.scopes ?? []); - this.addTypes(config.types ?? []); return this; } } @@ -41332,6 +41428,78 @@ program program.parse(process.argv); +/***/ }), + +/***/ 259: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * SPDX-FileCopyrightText: 2023 Kevin de Jong + * SPDX-License-Identifier: MIT + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.checkConfiguration = void 0; +const core = __importStar(__nccwpck_require__(2186)); +/** + * Checks the repository merge configuration; + * - Whether merge commits are enabled and whether the default subject is based on the Pull Request title + * - Whether squash commits are enabled and whether the default subject is based on the Pull Request title + * - Whether rebase commits are enabled + */ +function checkConfiguration(repository) { + if (repository.allow_merge_commit === undefined || + repository.allow_squash_merge === undefined || + repository.allow_rebase_merge === undefined) { + throw new Error("❌ CommitMe is not configured correctly. Please provide either:\n - The `contents: write` permission, or\n - Use the `include-commits` input parameter."); + } + if (repository.allow_merge_commit) { + core.info(repository.merge_commit_title === "PR_TITLE" + ? "✅ Default merge commit subject will use the Pull Request title." + : "⚠️ Default merge commit subject is not based on your Pull Request title."); + } + else { + core.info("ℹ️ Merge commit strategy is disabled."); + } + if (repository.allow_squash_merge === true) { + core.info(repository.squash_merge_commit_title === "PR_TITLE" + ? "✅ Default squash commit subject will use the Pull Request title." + : "⚠️ Default squash commit subject is based on either your Commit message or Pull Request title."); + } + else { + core.info("ℹ️ Squash commit strategy is disabled."); + } + core.info(repository.allow_rebase_merge === true + ? "ℹ️ Rebase merges are enabled, validating both Pull Request title and all associated commits." + : "ℹ️ Rebase merges are disabled, only validating the Pull Request title."); +} +exports.checkConfiguration = checkConfiguration; + + /***/ }), /***/ 4630: @@ -41380,7 +41548,7 @@ function validatePullRequest(pullrequest, commits) { const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.hash, { - text: `A Pull Request title MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, + text: `A Pull Request MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, linenumber: 1, column: 1, }) diff --git a/src/configuration.ts b/src/configuration.ts index 483c1f0..65450af 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -2,10 +2,14 @@ * SPDX-FileCopyrightText: 2023 Kevin de Jong * SPDX-License-Identifier: MIT */ +import assert from "assert"; +import * as core from "@actions/core"; +import * as github from "@actions/github"; import { IConventionalCommitOptions } from "@dev-build-deploy/commit-it"; import { FileSource, GitHubSource, GitSource, IDataSource } from "./datasources"; +import * as repository from "./repository"; /** * Configuration class @@ -20,6 +24,7 @@ class Configuration implements IConventionalCommitOptions { includeCommits = false; includePullRequest = false; + updatePullRequestLabels = false; scopes?: string[]; types?: string[]; @@ -59,23 +64,51 @@ class Configuration implements IConventionalCommitOptions { */ async fromDatasource(datasource: IDataSource, configPath?: string): Promise { const content = await datasource.getConfigurationFile(configPath ?? ".commit-me.json"); - if (!content) return this; + const config = content ? JSON.parse(content) : {}; if (datasource instanceof GitSource || datasource instanceof FileSource) { this.includeCommits = true; this.includePullRequest = false; + this.updatePullRequestLabels = false; + + this.addScopes(config.scopes ?? []); + this.addTypes(config.types ?? []); } else if (datasource instanceof GitHubSource) { - this.includePullRequest = true; + const hasIncludeCommitsInput = core.getInput("include-commits") !== ""; + const hasPullRequestLabelsInput = core.getInput("update-labels") !== ""; + + const autoDetectIncludeCommits = !hasIncludeCommitsInput && config.githubAction?.includeCommits === undefined; + + if (autoDetectIncludeCommits) { + assert(github.context.payload.pull_request); + repository.checkConfiguration(github.context.payload.pull_request.base.repo); + this.includeCommits = github.context.payload.pull_request.base.repo.allow_rebase_merge === true; + } else { + this.includeCommits = hasIncludeCommitsInput + ? core.getBooleanInput("include-commits") + : config.githubAction?.includeCommits ?? false; + } + this.includePullRequest = config.githubAction?.includePullRequest ?? true; + + if (core.getMultilineInput("scopes").length > 0) { + this.addScopes(core.getMultilineInput("scopes")); + } else { + this.addScopes(config.scopes ?? []); + } + + if (core.getMultilineInput("types").length > 0) { + this.addTypes(core.getMultilineInput("types")); + } else { + this.addTypes(config.types ?? []); + } + + this.updatePullRequestLabels = hasPullRequestLabelsInput + ? core.getBooleanInput("update-labels") + : config.githubAction?.updatePullRequestLabels ?? false; } else { throw new Error("Unsupported data source"); } - const config = JSON.parse(content); - this.includeCommits = config.includeCommits ?? this.includeCommits; - this.includePullRequest = config.includePullRequest ?? this.includePullRequest; - this.addScopes(config.scopes ?? []); - this.addTypes(config.types ?? []); - return this; } } diff --git a/src/entrypoints/action.ts b/src/entrypoints/action.ts index 7034b46..577cde5 100644 --- a/src/entrypoints/action.ts +++ b/src/entrypoints/action.ts @@ -10,9 +10,8 @@ import * as github from "@actions/github"; import { Commit, ConventionalCommit } from "@dev-build-deploy/commit-it"; import { Configuration } from "../configuration"; -import { GitHubSource, IDataSource } from "../datasources"; +import { GitHubSource } from "../datasources"; import { updatePullRequestLabels } from "../github"; -import * as repository from "../repository"; import { validateCommits, validatePullRequest } from "../validator"; /** @@ -55,31 +54,17 @@ const reportErrorMessages = (results: ConventionalCommit[]): { errors: number; w return { errors: errorCount, warnings: warningCount }; }; -const setConfiguration = async (dataSource: IDataSource): Promise => { - assert(github.context.payload.pull_request); - - const pullrequestOnly = core.getInput("include-commits") - ? !core.getBooleanInput("include-commits") - : github.context.payload.pull_request.base.repo.allow_rebase_merge === false; - - // Set the global configuration - const config = await Configuration.getInstance().fromDatasource(dataSource, core.getInput("config") || undefined); - config.includeCommits = !pullrequestOnly; - config.addScopes(core.getMultilineInput("scopes") ?? []); - config.addTypes(core.getMultilineInput("types") ?? []); -}; - /** * Main entry point for the GitHub Action. */ async function run(): Promise { try { core.info("📄 CommitMe - Conventional Commit compliance validation"); - const datasource = new GitHubSource(); - await setConfiguration(datasource); core.startGroup("📝 Checking repository configuration"); - const config = Configuration.getInstance(); + const datasource = new GitHubSource(); + const config = await Configuration.getInstance().fromDatasource(datasource, core.getInput("config") || undefined); + const githubToken = core.getInput("token") ?? undefined; assert(github.context.payload.pull_request); @@ -94,14 +79,20 @@ async function run(): Promise { return; } - if (core.getInput("include-commits") === undefined) { - repository.checkConfiguration(github.context.payload.pull_request.base.repo); + if (config.includeCommits === true) { + if (config.includePullRequest === true) { + core.info("ℹ️ Validating both Pull Request and all associated commits."); + } else { + core.info("ℹ️ Only validating the commits associated with the Pull Request."); + } } else { - core.info( - config.includeCommits === true - ? "ℹ️ Validating both Pull Request title and all associated commits." - : "ℹ️ Only validating the Pull Request title." - ); + if (config.includePullRequest === true) { + core.info("ℹ️ Only validating the Pull Request."); + } else { + core.setFailed( + "❌ The current configuration of CommitMe does not validate either Pull Request or the associated commits." + ); + } } // Setting up the environment @@ -151,7 +142,7 @@ async function run(): Promise { // Updating the pull request label if (githubToken === undefined) { core.warning("⚠️ The token input is required to update the pull request label."); - } else if (core.getBooleanInput("update-labels") === true) { + } else if (config.updatePullRequestLabels === true) { const label = await determineLabel(allResults); if (label !== undefined) await updatePullRequestLabels(label); } diff --git a/src/validator.ts b/src/validator.ts index 4ec64ac..e1cf8ec 100644 --- a/src/validator.ts +++ b/src/validator.ts @@ -42,7 +42,7 @@ export function validatePullRequest(pullrequest: Commit, commits: ConventionalCo if (pullRequestValue < commitsValue) { result.errors.push( DiagnosticsMessage.createError(result.hash, { - text: `A Pull Request title MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, + text: `A Pull Request MUST correlate with a Semantic Versioning identifier (\`MAJOR\`, \`MINOR\`, or \`PATCH\`) with the same or higher precedence than its associated commits`, linenumber: 1, column: 1, }) diff --git a/test/configuration.test.ts b/test/configuration.test.ts new file mode 100644 index 0000000..90bfcb3 --- /dev/null +++ b/test/configuration.test.ts @@ -0,0 +1,258 @@ +/* + * SPDX-FileCopyrightText: 2024 Kevin de Jong + * SPDX-License-Identifier: MIT + */ + +import * as core from "@actions/core"; +import * as github from "@actions/github"; + +import { Configuration } from "../src/configuration"; +import { FileSource, GitHubSource, GitSource } from "../src/datasources"; + +jest.mock("../src/datasources"); + +describe("FileSource", () => { + test("No Configuration file", async () => { + const config = new Configuration(); + await config.fromDatasource(new FileSource("")); + + expect(config.includeCommits).toBe(true); + expect(config.includePullRequest).toBe(false); + expect(config.updatePullRequestLabels).toBe(false); + expect(config.scopes).toStrictEqual([]); + expect(config.types).toStrictEqual([]); + }); + + test("Configuration file", async () => { + const config = new Configuration(); + + const datasource = new FileSource(""); + // Mock the getConfigurationFile method + datasource.getConfigurationFile = jest.fn().mockResolvedValue(`{ + "includeCommits": false, + "includePullRequest": true, + "updatePullRequestLabels": true, + "scopes": ["test-scope"], + "types": ["test-type"] + }`); + await config.fromDatasource(datasource, "configuration.json"); + + // These will be ignored as they only apply for GitHub Actions + expect(config.includeCommits).toBe(true); + expect(config.includePullRequest).toBe(false); + expect(config.updatePullRequestLabels).toBe(false); + + // These will be set + expect(config.scopes).toStrictEqual(["test-scope"]); + expect(config.types).toStrictEqual(["test-type"]); + }); +}); + +describe("GitSource", () => { + test("No Configuration file", async () => { + const config = new Configuration(); + await config.fromDatasource(new GitSource()); + + expect(config.includeCommits).toBe(true); + expect(config.includePullRequest).toBe(false); + expect(config.updatePullRequestLabels).toBe(false); + expect(config.scopes).toStrictEqual([]); + expect(config.types).toStrictEqual([]); + }); + + test("Configuration file", async () => { + const config = new Configuration(); + + const datasource = new GitSource(); + // Mock the getConfigurationFile method + datasource.getConfigurationFile = jest.fn().mockResolvedValue(`{ + "githubAction": { + "includeCommits": false, + "includePullRequest": true, + "updatePullRequestLabels": true + }, + "scopes": ["test-scope"], + "types": ["test-type"] + }`); + await config.fromDatasource(datasource, "configuration.json"); + + // These will be ignored as they only apply for GitHub Actions + expect(config.includeCommits).toBe(true); + expect(config.includePullRequest).toBe(false); + expect(config.updatePullRequestLabels).toBe(false); + + // These will be set + expect(config.scopes).toStrictEqual(["test-scope"]); + expect(config.types).toStrictEqual(["test-type"]); + }); +}); + +describe("GitHubSource", () => { + test("Auto Detect: No merge strategy configuration", async () => { + // Disable the GitHub Action inputs + jest.spyOn(core, "getInput").mockReturnValue(""); + jest.spyOn(core, "getBooleanInput").mockReturnValue(false); + + // Set the payload + github.context.payload.pull_request = { number: 1, base: { repo: {} } }; + + const config = new Configuration(); + await expect(config.fromDatasource(new GitHubSource())).rejects.toThrow(); + }); + + test("Auto Detect: allow rebase merge", async () => { + // Disable the GitHub Action inputs + jest.spyOn(core, "getInput").mockReturnValue(""); + jest.spyOn(core, "getBooleanInput").mockReturnValue(false); + + // Set the payload + github.context.payload.pull_request = { + number: 1, + base: { repo: { allow_merge_commit: true, allow_squash_merge: true, allow_rebase_merge: true } }, + }; + + const config = new Configuration(); + await config.fromDatasource(new GitHubSource()); + + expect(config.includeCommits).toBe(true); + }); + + test("Auto Detect: disallow rebase merge", async () => { + // Disable the GitHub Action inputs + jest.spyOn(core, "getInput").mockReturnValue(""); + jest.spyOn(core, "getBooleanInput").mockReturnValue(false); + + // Set the payload + github.context.payload.pull_request = { + number: 1, + base: { repo: { allow_merge_commit: true, allow_squash_merge: true, allow_rebase_merge: false } }, + }; + + const config = new Configuration(); + await config.fromDatasource(new GitHubSource()); + + expect(config.includeCommits).toBe(false); + }); + + test("Configuration file only", async () => { + // Disable the GitHub Action inputs + jest.spyOn(core, "getInput").mockReturnValue(""); + jest.spyOn(core, "getBooleanInput").mockReturnValue(false); + + const datasource = new GitHubSource(); + datasource.getConfigurationFile = jest.fn().mockResolvedValue(`{ + "githubAction": { + "includeCommits": true, + "includePullRequest": true, + "updatePullRequestLabels": true + }, + "scopes": ["test-scope"], + "types": ["test-type"] + }`); + + // Set the payload + github.context.payload.pull_request = { + number: 1, + base: { repo: { allow_merge_commit: true, allow_squash_merge: true, allow_rebase_merge: false } }, + }; + + const config = new Configuration(); + await config.fromDatasource(datasource, "configuration.json"); + + // GitHub Actions configuration items + expect(config.includeCommits).toBe(true); + expect(config.includePullRequest).toBe(true); + expect(config.updatePullRequestLabels).toBe(true); + + // Generic configuration items + expect(config.scopes).toStrictEqual(["test-scope"]); + expect(config.types).toStrictEqual(["test-type"]); + }); + + test("Inputs only", async () => { + jest.spyOn(core, "getInput").mockImplementation((name: string) => { + if (name === "include-commits") return "true"; + if (name === "update-labels") return "true"; + return ""; + }); + + jest.spyOn(core, "getBooleanInput").mockImplementation((name: string) => { + if (name === "include-commits") return true; + if (name === "update-labels") return true; + return false; + }); + + jest.spyOn(core, "getMultilineInput").mockImplementation((name: string) => { + if (name === "scopes") return ["test-scope"]; + if (name === "types") return ["test-type"]; + return []; + }); + + // Set the payload + github.context.payload.pull_request = { + number: 1, + base: { repo: { allow_merge_commit: true, allow_squash_merge: true, allow_rebase_merge: false } }, + }; + + const config = new Configuration(); + await config.fromDatasource(new GitHubSource()); + + // GitHub Actions configuration items + expect(config.includeCommits).toBe(true); + expect(config.includePullRequest).toBe(true); + expect(config.updatePullRequestLabels).toBe(true); + + // Generic configuration items + expect(config.scopes).toStrictEqual(["test-scope"]); + expect(config.types).toStrictEqual(["test-type"]); + }); + + test("Inputs and Configuration", async () => { + jest.spyOn(core, "getInput").mockImplementation((name: string) => { + if (name === "include-commits") return "false"; + if (name === "update-labels") return "false"; + return ""; + }); + + jest.spyOn(core, "getBooleanInput").mockImplementation((name: string) => { + if (name === "include-commits") return false; + if (name === "update-labels") return false; + return false; + }); + + jest.spyOn(core, "getMultilineInput").mockImplementation((name: string) => { + if (name === "scopes") return ["test-scope"]; + if (name === "types") return ["test-type"]; + return []; + }); + + const datasource = new GitHubSource(); + datasource.getConfigurationFile = jest.fn().mockResolvedValue(`{ + "githubAction": { + "includeCommits": true, + "includePullRequest": true, + "updatePullRequestLabels": true + }, + "scopes": ["wrong-scope"], + "types": ["wrong-type"] + }`); + + // Set the payload + github.context.payload.pull_request = { + number: 1, + base: { repo: { allow_merge_commit: true, allow_squash_merge: true, allow_rebase_merge: false } }, + }; + + const config = new Configuration(); + await config.fromDatasource(datasource); + + // GitHub Actions configuration items + expect(config.includeCommits).toBe(false); + expect(config.includePullRequest).toBe(true); + expect(config.updatePullRequestLabels).toBe(false); + + // Generic configuration items + expect(config.scopes).toStrictEqual(["test-scope"]); + expect(config.types).toStrictEqual(["test-type"]); + }); +}); diff --git a/test/validator.test.ts b/test/validator.test.ts index 133ed1b..55b10b6 100644 --- a/test/validator.test.ts +++ b/test/validator.test.ts @@ -59,19 +59,10 @@ BREAKING CHANGE: this will be ignored and raise a warning... test("Valid Pull Request message", () => { const result = validator.validatePullRequest( - Commit.fromString({ - hash: "0a0b0c0d", - message: "feat: Add new feature", - }), + Commit.fromString({ hash: "0a0b0c0d", message: "feat: Add new feature" }), [ - ConventionalCommit.fromString({ - hash: "0a0b0c0d", - message: "feat: Add new feature", - }), - ConventionalCommit.fromString({ - hash: "0a0b0c0d", - message: "fix: Fixed a bug", - }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat: Add new feature" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "fix: Fixed a bug" }), ] ); @@ -96,56 +87,103 @@ BREAKING CHANGE: this will be ignored and raise a warning... // Scope is not a noun expect(result.errors.length).toBe(2); }); +}); - test("Pull Request > Commits", () => { - const result = validator.validatePullRequest( - Commit.fromString({ +describe("Validate Pull Request version bump", () => { + const testData = [ + { + description: "Pull Request < Commit", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + commits: [ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat: add new feature" })], + error: true, + }, + { + description: "Pull Request < Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + commits: [ + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat: add new feature" }), + ], + error: true, + }, + { + description: "Pull Request === Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "chore!: silly change" }), + commits: [ + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat!: add new feature" }), + ], + error: false, + }, + { + description: "Pull Request === Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat: add a new feature" }), + commits: [ + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat: add new feature" }), + ], + error: false, + }, + { + description: "Pull Request === Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", - message: "feat!: Add new breaking change", + message: "feat: add a new feature\n\nBREAKING-CHANGE: This is breaking", }), - [ - ConventionalCommit.fromString({ - hash: "0a0b0c0d", - message: "feat: Add new feature", - }), - ] - ); - - expect(result.errors.length).toBe(0); - }); - - test("Pull Request === Commits", () => { - const result = validator.validatePullRequest( - Commit.fromString({ + commits: [ + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat!: add new feature" }), + ], + error: false, + }, + { + description: "Pull Request === Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", - message: "feat: Add new feature", + message: "feat: add a new feature\n\nBREAKING-CHANGE: This is breaking", }), - [ + commits: [ ConventionalCommit.fromString({ hash: "0a0b0c0d", - message: "feat: Add new feature", + message: "chore: silly change\n\nBREAKING CHANGE: This is breaking?", }), - ] - ); - - expect(result.errors.length).toBe(0); - }); - - test("Pull Request < Commits", () => { - const result = validator.validatePullRequest( - Commit.fromString({ + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat: add new feature" }), + ], + error: false, + }, + { + description: "Pull Request > Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", - message: "chore: Add new breaking change", + message: "fix: add fix\n\nBREAKING-CHANGE: This is breaking", }), - [ - ConventionalCommit.fromString({ - hash: "0a0b0c0d", - message: "feat: Add new feature", - }), - ] - ); - - // Pull Request < Commits - expect(result.errors.length).toBe(1); + commits: [ + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "fix: fixed a bug" }), + ], + error: false, + }, + { + description: "Pull Request > Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat: add a new feature" }), + commits: [ + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "fix: fixed a bug" }), + ], + error: false, + }, + ]; + + it.each(testData)("$test.description", test => { + const result = validator.validatePullRequest(test.pullRequest, test.commits); + + if (test.error) { + expect(result.errors.length).toBe(1); + expect(result.errors[0].message.text).toBe( + "A Pull Request MUST correlate with a Semantic Versioning identifier (`MAJOR`, `MINOR`, or `PATCH`) with the same or higher precedence than its associated commits" + ); + } else { + expect(result.errors.length).toBe(0); + } }); }); From ffee899855a302c2e290dd51723c8f2c47472a2b Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Wed, 17 Jan 2024 13:48:24 +0100 Subject: [PATCH 05/22] fix: prevent failure when comparing PR against non-compliant commits This commit prevents the error... ``` Cannot read properties of undefined (reading 'breaking') ``` ...when validating both the Pull Request and its associated commits, where the associated commits are all non-compliant with Conventional Commits. --- lib/action/index.js | 4 + lib/cli/index.js | 4 + lib/precommit/index.js | 4 + package-lock.json | 409 ++++++++++++++++++++++++++--------------- src/validator.ts | 4 + test/validator.test.ts | 62 ++++++- 6 files changed, 332 insertions(+), 155 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index f365448..1bf625f 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -41727,6 +41727,10 @@ function validatePullRequest(pullrequest, commits) { }; const pullRequestValue = orderValue(result); const validConventionalCommits = commits.filter(commit => commit.isValid); + // No valid commits found, return the pull request validation result + if (validConventionalCommits.length === 0) + return result; + // Sort the commits by order of precedence (SemVer) and validate against the Pull Request (SemVer) const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.hash, { diff --git a/lib/cli/index.js b/lib/cli/index.js index 5feb295..ead4acc 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -41562,6 +41562,10 @@ function validatePullRequest(pullrequest, commits) { }; const pullRequestValue = orderValue(result); const validConventionalCommits = commits.filter(commit => commit.isValid); + // No valid commits found, return the pull request validation result + if (validConventionalCommits.length === 0) + return result; + // Sort the commits by order of precedence (SemVer) and validate against the Pull Request (SemVer) const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.hash, { diff --git a/lib/precommit/index.js b/lib/precommit/index.js index 6b74f96..162499c 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -41545,6 +41545,10 @@ function validatePullRequest(pullrequest, commits) { }; const pullRequestValue = orderValue(result); const validConventionalCommits = commits.filter(commit => commit.isValid); + // No valid commits found, return the pull request validation result + if (validConventionalCommits.length === 0) + return result; + // Sort the commits by order of precedence (SemVer) and validate against the Pull Request (SemVer) const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { result.errors.push(diagnose_it_1.DiagnosticsMessage.createError(result.hash, { diff --git a/package-lock.json b/package-lock.json index ff78745..e3eb5d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -187,9 +187,9 @@ } }, "node_modules/@babel/core": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.6.tgz", - "integrity": "sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw==", + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.7.tgz", + "integrity": "sha512-+UpDgowcmqe36d4NwqvKsyPMlOLNGMsfMmQ5WGCu+siCe3t3dfe9njrzGfdN4qq+bcNUt0+Vw6haRxBOycs4dw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", @@ -197,10 +197,10 @@ "@babel/generator": "^7.23.6", "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.6", + "@babel/helpers": "^7.23.7", "@babel/parser": "^7.23.6", "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.6", + "@babel/traverse": "^7.23.7", "@babel/types": "^7.23.6", "convert-source-map": "^2.0.0", "debug": "^4.1.0", @@ -391,13 +391,13 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.6.tgz", - "integrity": "sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA==", + "version": "7.23.8", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.8.tgz", + "integrity": "sha512-KDqYz4PiOWvDFrdHLPhKtCThtIcKVy6avWD2oG4GEvyQ+XDZwHD4YQd+H2vNMnq2rkdxsDkU82T+Vk8U/WXHRQ==", "dev": true, "dependencies": { "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.6", + "@babel/traverse": "^7.23.7", "@babel/types": "^7.23.6" }, "engines": { @@ -693,9 +693,9 @@ } }, "node_modules/@babel/traverse": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.6.tgz", - "integrity": "sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==", + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.7.tgz", + "integrity": "sha512-tY3mM8rH9jM0YHFGyfC0/xf+SB5eKUu7HPj7/k3fpi9dAlsMc5YbQvDi0Sh2QTPXqMhyaAtzAr807TIyfQrmyg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", @@ -743,9 +743,9 @@ "dev": true }, "node_modules/@dev-build-deploy/commit-it": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.0.3.tgz", - "integrity": "sha512-snSsstI8kytKXmEY5MXxj0pYM2t1JD0uf2uOTQSgHg6pKfC1A8YeiCUFPqbNFSeALLI580RZ3FafTTvU+Gyjyw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.0.4.tgz", + "integrity": "sha512-yhAj8RH0c8w4VCGYbt77JnRxemb/uwQrC/LpHEs0euiCTooTZW8VTGXgsOH/KnJC0lHeSoIHNF/Axk2UPSnU9A==", "dependencies": { "@dev-build-deploy/diagnose-it": "^1", "chalk": "<5" @@ -819,6 +819,28 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@eslint/js": { "version": "8.56.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", @@ -837,19 +859,41 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -864,9 +908,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", "dev": true }, "node_modules/@istanbuljs/load-nyc-config": { @@ -1294,9 +1338,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", - "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "version": "0.3.21", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz", + "integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -1532,9 +1576,9 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.20.4", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.4.tgz", - "integrity": "sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.5.tgz", + "integrity": "sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ==", "dev": true, "dependencies": { "@babel/types": "^7.20.7" @@ -1596,9 +1640,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.19.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.3.tgz", - "integrity": "sha512-k5fggr14DwAytoA/t8rPrIz++lXK7/DqckthCmoZOKNsEbJkId4Z//BqgApXBUGrGddrigYa1oqheo/7YmW4rg==", + "version": "18.19.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.8.tgz", + "integrity": "sha512-g1pZtPhsvGVTwmeVoexWZLTQaOvXwoSq//pTL0DHeNzUDrFnir4fgETdhjhIxjVnN+hKOuh98+E1eMLnUXstFg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -1643,16 +1687,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.14.0.tgz", - "integrity": "sha512-1ZJBykBCXaSHG94vMMKmiHoL0MhNHKSVlcHVYZNw+BKxufhqQVTOawNpwwI1P5nIFZ/4jLVop0mcY6mJJDFNaw==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.0.tgz", + "integrity": "sha512-DUCUkQNklCQYnrBSSikjVChdc84/vMPDQSgJTHBZ64G9bA9w0Crc0rd2diujKbTdp6w2J47qkeHQLoi0rpLCdg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.14.0", - "@typescript-eslint/type-utils": "6.14.0", - "@typescript-eslint/utils": "6.14.0", - "@typescript-eslint/visitor-keys": "6.14.0", + "@typescript-eslint/scope-manager": "6.19.0", + "@typescript-eslint/type-utils": "6.19.0", + "@typescript-eslint/utils": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1678,15 +1722,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.14.0.tgz", - "integrity": "sha512-QjToC14CKacd4Pa7JK4GeB/vHmWFJckec49FR4hmIRf97+KXole0T97xxu9IFiPxVQ1DBWrQ5wreLwAGwWAVQA==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.0.tgz", + "integrity": "sha512-1DyBLG5SH7PYCd00QlroiW60YJ4rWMuUGa/JBV0iZuqi4l4IK3twKPq5ZkEebmGqRjXWVgsUzfd3+nZveewgow==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.14.0", - "@typescript-eslint/types": "6.14.0", - "@typescript-eslint/typescript-estree": "6.14.0", - "@typescript-eslint/visitor-keys": "6.14.0", + "@typescript-eslint/scope-manager": "6.19.0", + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/typescript-estree": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0", "debug": "^4.3.4" }, "engines": { @@ -1706,13 +1750,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.14.0.tgz", - "integrity": "sha512-VT7CFWHbZipPncAZtuALr9y3EuzY1b1t1AEkIq2bTXUPKw+pHoXflGNG5L+Gv6nKul1cz1VH8fz16IThIU0tdg==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.0.tgz", + "integrity": "sha512-dO1XMhV2ehBI6QN8Ufi7I10wmUovmLU0Oru3n5LVlM2JuzB4M+dVphCPLkVpKvGij2j/pHBWuJ9piuXx+BhzxQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.14.0", - "@typescript-eslint/visitor-keys": "6.14.0" + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1723,13 +1767,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.14.0.tgz", - "integrity": "sha512-x6OC9Q7HfYKqjnuNu5a7kffIYs3No30isapRBJl1iCHLitD8O0lFbRcVGiOcuyN837fqXzPZ1NS10maQzZMKqw==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.0.tgz", + "integrity": "sha512-mcvS6WSWbjiSxKCwBcXtOM5pRkPQ6kcDds/juxcy/727IQr3xMEcwr/YLHW2A2+Fp5ql6khjbKBzOyjuPqGi/w==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.14.0", - "@typescript-eslint/utils": "6.14.0", + "@typescript-eslint/typescript-estree": "6.19.0", + "@typescript-eslint/utils": "6.19.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1750,9 +1794,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.14.0.tgz", - "integrity": "sha512-uty9H2K4Xs8E47z3SnXEPRNDfsis8JO27amp2GNCnzGETEW3yTqEIVg5+AI7U276oGF/tw6ZA+UesxeQ104ceA==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.0.tgz", + "integrity": "sha512-lFviGV/vYhOy3m8BJ/nAKoAyNhInTdXpftonhWle66XHAtT1ouBlkjL496b5H5hb8dWXHwtypTqgtb/DEa+j5A==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1763,16 +1807,17 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.14.0.tgz", - "integrity": "sha512-yPkaLwK0yH2mZKFE/bXkPAkkFgOv15GJAUzgUVonAbv0Hr4PK/N2yaA/4XQbTZQdygiDkpt5DkxPELqHguNvyw==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.0.tgz", + "integrity": "sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.14.0", - "@typescript-eslint/visitor-keys": "6.14.0", + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", + "minimatch": "9.0.3", "semver": "^7.5.4", "ts-api-utils": "^1.0.1" }, @@ -1790,17 +1835,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.14.0.tgz", - "integrity": "sha512-XwRTnbvRr7Ey9a1NT6jqdKX8y/atWG+8fAIu3z73HSP8h06i3r/ClMhmaF/RGWGW1tHJEwij1uEg2GbEmPYvYg==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.0.tgz", + "integrity": "sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.14.0", - "@typescript-eslint/types": "6.14.0", - "@typescript-eslint/typescript-estree": "6.14.0", + "@typescript-eslint/scope-manager": "6.19.0", + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/typescript-estree": "6.19.0", "semver": "^7.5.4" }, "engines": { @@ -1815,12 +1860,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.14.0.tgz", - "integrity": "sha512-fB5cw6GRhJUz03MrROVuj5Zm/Q+XWlVdIsFj+Zb1Hvqouc8t+XP2H5y53QYU/MGtd2dPg6/vJJlhoX3xc2ehfw==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.0.tgz", + "integrity": "sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.14.0", + "@typescript-eslint/types": "6.19.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1847,9 +1892,9 @@ } }, "node_modules/acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -2209,13 +2254,12 @@ "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -2322,9 +2366,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001570", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz", - "integrity": "sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==", + "version": "1.0.30001578", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001578.tgz", + "integrity": "sha512-J/jkFgsQ3NEl4w2lCoM9ZPxrD+FoBNJ7uJUpGVjIg/j0OwJosWM36EPDv+Yyi0V4twBk9pPmlFS+PLykgEvUmg==", "dev": true, "funding": [ { @@ -2619,9 +2663,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.614", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz", - "integrity": "sha512-X4ze/9Sc3QWs6h92yerwqv7aB/uU8vCjZcrMjA8N9R1pjMFRe44dLsck5FzLilOYvcXuDn93B+bpGYyufc70gQ==", + "version": "1.4.635", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.635.tgz", + "integrity": "sha512-iu/2D0zolKU3iDGXXxdOzNf72Jnokn+K1IN6Kk4iV6l1Tr2g/qy+mvmtfAiBwZe5S3aB5r92vp+zSZ69scYRrg==", "dev": true }, "node_modules/emittery": { @@ -2935,6 +2979,16 @@ "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" } }, + "node_modules/eslint-plugin-import/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/eslint-plugin-import/node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", @@ -2956,6 +3010,18 @@ "node": ">=0.10.0" } }, + "node_modules/eslint-plugin-import/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/eslint-plugin-import/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -2966,9 +3032,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "27.6.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.0.tgz", - "integrity": "sha512-MTlusnnDMChbElsszJvrwD1dN3x6nZl//s4JD23BxB6MgR66TZlL064su24xEIS3VACfAoHV1vgyMgPw8nkdng==", + "version": "27.6.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.3.tgz", + "integrity": "sha512-+YsJFVH6R+tOiO3gCJon5oqn4KWc+mDq2leudk8mrp8RFubLOo9CVyi3cib4L7XMpxExmkmBZQTPDYVBzgpgOA==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^5.10.0" @@ -3140,6 +3206,28 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -3307,9 +3395,9 @@ "dev": true }, "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -3563,6 +3651,28 @@ "node": ">=10.13.0" } }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -4962,15 +5072,18 @@ } }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/minimist": { @@ -5066,30 +5179,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/npm-run-all2/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/npm-run-all2/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -5448,9 +5537,9 @@ } }, "node_modules/prettier": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", - "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -5620,9 +5709,9 @@ } }, "node_modules/read-pkg/node_modules/type-fest": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.8.3.tgz", - "integrity": "sha512-//BaTm14Q/gHBn09xlnKNqfI8t6bmdzx2DXYfPBNofN0WUybCEUDcbCWcTa0oF09lzLjZgPphXAsvRiMK0V6Bw==", + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.9.0.tgz", + "integrity": "sha512-KS/6lh/ynPGiHD/LnAobrEFq3Ad4pBzOlJ1wAnJx9N4EYoqFhMfLIBjUT2UEx4wg5ZE+cC1ob6DCSpppVo+rtg==", "dev": true, "engines": { "node": ">=16" @@ -5771,13 +5860,13 @@ } }, "node_modules/safe-array-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", - "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.0.tgz", + "integrity": "sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", + "call-bind": "^1.0.5", + "get-intrinsic": "^1.2.2", "has-symbols": "^1.0.3", "isarray": "^2.0.5" }, @@ -5789,15 +5878,18 @@ } }, "node_modules/safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.2.tgz", + "integrity": "sha512-83S9w6eFq12BBIJYvjMux6/dkirb8+4zJRA9cxNBVb7Wq5fJBW+Xze48WqR8pxua7bDuAaaAxtVVd4Idjp1dBQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", + "call-bind": "^1.0.5", + "get-intrinsic": "^1.2.2", "is-regex": "^1.1.4" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -5836,15 +5928,16 @@ "dev": true }, "node_modules/set-function-length": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", - "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", + "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", "dev": true, "dependencies": { "define-data-property": "^1.1.1", - "get-intrinsic": "^1.2.1", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.2", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "has-property-descriptors": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -5915,9 +6008,9 @@ "dev": true }, "node_modules/simple-git": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.21.0.tgz", - "integrity": "sha512-oTzw9248AF5bDTMk9MrxsRzEzivMlY+DWH0yWS4VYpMhNLhDWnN06pCtaUyPnqv/FpsdeNmRqmZugMABHRPdDA==", + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.22.0.tgz", + "integrity": "sha512-6JujwSs0ac82jkGjMHiCnTifvf1crOiY/+tfs/Pqih6iow7VrpNKRRNdWm6RtaXpvvv/JGNYhlUtLhGFqHF+Yw==", "dependencies": { "@kwsites/file-exists": "^1.1.1", "@kwsites/promise-deferred": "^1.1.1", @@ -6181,6 +6274,28 @@ "node": ">=8" } }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", diff --git a/src/validator.ts b/src/validator.ts index e1cf8ec..7596456 100644 --- a/src/validator.ts +++ b/src/validator.ts @@ -37,6 +37,10 @@ export function validatePullRequest(pullrequest: Commit, commits: ConventionalCo const pullRequestValue = orderValue(result); const validConventionalCommits = commits.filter(commit => commit.isValid); + // No valid commits found, return the pull request validation result + if (validConventionalCommits.length === 0) return result; + + // Sort the commits by order of precedence (SemVer) and validate against the Pull Request (SemVer) const commitsValue = orderValue(validConventionalCommits.sort((a, b) => (orderValue(a) < orderValue(b) ? 1 : -1))[0]); if (pullRequestValue < commitsValue) { diff --git a/test/validator.test.ts b/test/validator.test.ts index 55b10b6..b86da81 100644 --- a/test/validator.test.ts +++ b/test/validator.test.ts @@ -89,7 +89,47 @@ BREAKING CHANGE: this will be ignored and raise a warning... }); }); -describe("Validate Pull Request version bump", () => { +describe("Validate invalid Pull Request vs Commits", () => { + const testData = [ + { + description: "Invalid Pull Request", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat (no noun): Add new feature" }), + commits: [ + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat: add new feature" }), + ], + errorCount: 2, + }, + { + description: "Valid and Invalid Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat: Add new feature" }), + commits: [ + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat (no noun)!: silly change" }), + ], + errorCount: 0, + }, + { + description: "Only Invalid Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat: Add new feature" }), + commits: [ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat (no noun)!: silly change" })], + errorCount: 0, + }, + { + description: "No Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat: Add new feature" }), + commits: [], + errorCount: 0, + }, + ]; + + it.each(testData)("$test.description", test => { + const result = validator.validatePullRequest(test.pullRequest, test.commits); + expect(result.errors.length).toBe(test.errorCount); + }); +}); + +describe("Validate valid Pull Request vs Commits", () => { const testData = [ { description: "Pull Request < Commit", @@ -107,7 +147,7 @@ describe("Validate Pull Request version bump", () => { error: true, }, { - description: "Pull Request === Commits", + description: "Breaking Pull Request === Breaking Commits", pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "chore!: silly change" }), commits: [ ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), @@ -116,16 +156,22 @@ describe("Validate Pull Request version bump", () => { error: false, }, { - description: "Pull Request === Commits", + description: "Pull Request === Invalid Commits", pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat: add a new feature" }), commits: [ - ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), - ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat: add new feature" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore (no noun): silly change" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "add new feature" }), ], error: false, }, { - description: "Pull Request === Commits", + description: "Pull Request === No Commits", + pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat: add a new feature" }), + commits: [], + error: false, + }, + { + description: "Pull Request (BREAKING CHANGE) === Breaking Commits", pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat: add a new feature\n\nBREAKING-CHANGE: This is breaking", @@ -137,7 +183,7 @@ describe("Validate Pull Request version bump", () => { error: false, }, { - description: "Pull Request === Commits", + description: "Pull Request (BREAKING CHANGE) === Commits (BREAKING CHANGE)", pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "feat: add a new feature\n\nBREAKING-CHANGE: This is breaking", @@ -152,7 +198,7 @@ describe("Validate Pull Request version bump", () => { error: false, }, { - description: "Pull Request > Commits", + description: "Pull Request (BREAKING CHANGE) > Commits", pullRequest: Commit.fromString({ hash: "0a0b0c0d", message: "fix: add fix\n\nBREAKING-CHANGE: This is breaking", From 78f24bec90a6f5a6565d1955ea9a71815dcebe11 Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Wed, 17 Jan 2024 15:04:21 +0100 Subject: [PATCH 06/22] docs: update documentation to mention FORCE_COLOR for colored output --- docs/github-action.md | 6 ++++++ lib/action/index.js | 2 +- src/entrypoints/action.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/github-action.md b/docs/github-action.md index fba371b..9d605bd 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -46,6 +46,9 @@ jobs: commit-me: name: Conventional Commits Compliance runs-on: ubuntu-latest + env: + # Enable colored output in GitHub Actions + FORCE_COLOR: 3 steps: - uses: dev-build-deploy/commit-me@v0 with: @@ -77,6 +80,9 @@ jobs: commit-me: name: Conventional Commits Compliance runs-on: ubuntu-latest + env: + # Enable colored output in GitHub Actions + FORCE_COLOR: 3 steps: - uses: dev-build-deploy/commit-me@v0 with: diff --git a/lib/action/index.js b/lib/action/index.js index 1bf625f..657eaa9 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -41506,7 +41506,7 @@ async function run() { if (config.includePullRequest === true) { core.startGroup(`🔎 Scanning Pull Request`); const resultPullrequest = (0, validator_1.validatePullRequest)(commit_it_1.Commit.fromString({ - hash: `#${github.context.payload.pull_request.number}`, + hash: `PullRequest`, message: [github.context.payload.pull_request.title, "", github.context.payload.pull_request.body].join("\n"), }), allResults); allResults.push(resultPullrequest); diff --git a/src/entrypoints/action.ts b/src/entrypoints/action.ts index 577cde5..feac7e5 100644 --- a/src/entrypoints/action.ts +++ b/src/entrypoints/action.ts @@ -110,7 +110,7 @@ async function run(): Promise { core.startGroup(`🔎 Scanning Pull Request`); const resultPullrequest = validatePullRequest( Commit.fromString({ - hash: `#${github.context.payload.pull_request.number}`, + hash: `PullRequest`, message: [github.context.payload.pull_request.title, "", github.context.payload.pull_request.body].join("\n"), }), allResults From b1dec93c1632e5bd1adb2e590a46a2e81d35bd8a Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Wed, 17 Jan 2024 21:28:27 +0100 Subject: [PATCH 07/22] fix: ignore both fixup! and merge commits This commit updates the ignore patterns for both `fixup!` and merge commits. The latter supports the default commit message subjects as generated by GitHub, GitLab and BitBucket. --- lib/action/index.js | 54 ++++++++++++++++++++++++++++++++++-------- lib/cli/index.js | 54 ++++++++++++++++++++++++++++++++++-------- lib/precommit/index.js | 54 ++++++++++++++++++++++++++++++++++-------- package-lock.json | 12 +++++----- src/validator.ts | 2 +- test/validator.test.ts | 20 ++++++++++++++++ 6 files changed, 159 insertions(+), 37 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index 657eaa9..e1dee17 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -2190,6 +2190,12 @@ class Commit { get raw() { return this._commit.raw; } + get isFixupCommit() { + return this._commit.attributes.isFixup; + } + get isMergeCommit() { + return this._commit.attributes.isMerge; + } toJSON() { return this._commit; } @@ -2237,6 +2243,22 @@ function getFooterElementsFromParagraph(footer) { return Object.keys(result).length > 0 ? result : undefined; } exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; +/** + * Checks if the provided subject is a common (default) merge pattern. + * Currently supported: + * - GitHub + * - BitBucket + * - GitLab + * + * @param subject The subject to check + * @returns True if the subject is a common merge pattern, false otherwise + */ +function subjectIsMergePattern(subject) { + const githubMergeRegex = /^Merge pull request #(\d+) from '?(.*)'?$/; + const bitbucketMergeRegex = /^Merged in '?(.*)'? \(pull request #(\d+)\)$/; + const gitlabMergeRegex = /^Merge branch '?(.*?)'? into '?(.*?)'?$/; + return githubMergeRegex.test(subject) || bitbucketMergeRegex.test(subject) || gitlabMergeRegex.test(subject); +} /** * Parses the provided commit message (full message, not just the subject) into * a Commit object. @@ -2261,13 +2283,20 @@ function parseCommitMessage(message) { if (body === "") body = undefined; } + const subject = paragraphs[0].trim(); + const isFixup = subject.toLowerCase().startsWith("fixup!"); + const isMerge = subjectIsMergePattern(subject); return { - subject: paragraphs[0].trim(), - body: body, + subject, + body, footer: getFooterElementsFromParagraph(footer ?? "")?.reduce((acc, cur) => { acc[cur.key] = cur.value; return acc; }, {}), + attributes: { + isFixup, + isMerge, + }, }; } exports.parseCommitMessage = parseCommitMessage; @@ -2405,6 +2434,13 @@ class ConventionalCommit { return (this._raw.breaking.value?.trimEnd() === "!" || (this.footer !== undefined && ("BREAKING CHANGE" in this.footer || "BREAKING-CHANGE" in this.footer))); } + // Attributes + get isFixupCommit() { + return this._raw.commit.isFixupCommit; + } + get isMergeCommit() { + return this._raw.commit.isMergeCommit; + } // Raw get raw() { return this._raw.commit.raw; @@ -2435,6 +2471,10 @@ class ConventionalCommit { errors: this.errors, warnings: this.warnings, }, + attributes: { + isFixup: this.isFixupCommit, + isMerge: this.isMergeCommit, + }, }; } // Private validation function @@ -2564,13 +2604,7 @@ function parseCommitMessage(commit, hash) { .splice(1) .join("\n") .trim(); - return { - raw, - hash: hash, - author: author, - committer: committer, - ...ccommit.parseCommitMessage(raw), - }; + return { raw, hash, author, committer, ...ccommit.parseCommitMessage(raw) }; } /** * Reads a (local) commit message from the .git/objects folder @@ -41751,7 +41785,7 @@ exports.validatePullRequest = validatePullRequest; * @see https://www.conventionalcommits.org/en/v1.0.0/ */ function validateCommits(commits) { - return commits.filter(commit => !commit.subject.startsWith("fixup!")).map(commit => validateCommit(commit)); + return commits.filter(commit => !commit.isFixupCommit && !commit.isMergeCommit).map(commit => validateCommit(commit)); } exports.validateCommits = validateCommits; diff --git a/lib/cli/index.js b/lib/cli/index.js index ead4acc..9ef6fe6 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -2191,6 +2191,12 @@ class Commit { get raw() { return this._commit.raw; } + get isFixupCommit() { + return this._commit.attributes.isFixup; + } + get isMergeCommit() { + return this._commit.attributes.isMerge; + } toJSON() { return this._commit; } @@ -2238,6 +2244,22 @@ function getFooterElementsFromParagraph(footer) { return Object.keys(result).length > 0 ? result : undefined; } exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; +/** + * Checks if the provided subject is a common (default) merge pattern. + * Currently supported: + * - GitHub + * - BitBucket + * - GitLab + * + * @param subject The subject to check + * @returns True if the subject is a common merge pattern, false otherwise + */ +function subjectIsMergePattern(subject) { + const githubMergeRegex = /^Merge pull request #(\d+) from '?(.*)'?$/; + const bitbucketMergeRegex = /^Merged in '?(.*)'? \(pull request #(\d+)\)$/; + const gitlabMergeRegex = /^Merge branch '?(.*?)'? into '?(.*?)'?$/; + return githubMergeRegex.test(subject) || bitbucketMergeRegex.test(subject) || gitlabMergeRegex.test(subject); +} /** * Parses the provided commit message (full message, not just the subject) into * a Commit object. @@ -2262,13 +2284,20 @@ function parseCommitMessage(message) { if (body === "") body = undefined; } + const subject = paragraphs[0].trim(); + const isFixup = subject.toLowerCase().startsWith("fixup!"); + const isMerge = subjectIsMergePattern(subject); return { - subject: paragraphs[0].trim(), - body: body, + subject, + body, footer: getFooterElementsFromParagraph(footer ?? "")?.reduce((acc, cur) => { acc[cur.key] = cur.value; return acc; }, {}), + attributes: { + isFixup, + isMerge, + }, }; } exports.parseCommitMessage = parseCommitMessage; @@ -2406,6 +2435,13 @@ class ConventionalCommit { return (this._raw.breaking.value?.trimEnd() === "!" || (this.footer !== undefined && ("BREAKING CHANGE" in this.footer || "BREAKING-CHANGE" in this.footer))); } + // Attributes + get isFixupCommit() { + return this._raw.commit.isFixupCommit; + } + get isMergeCommit() { + return this._raw.commit.isMergeCommit; + } // Raw get raw() { return this._raw.commit.raw; @@ -2436,6 +2472,10 @@ class ConventionalCommit { errors: this.errors, warnings: this.warnings, }, + attributes: { + isFixup: this.isFixupCommit, + isMerge: this.isMergeCommit, + }, }; } // Private validation function @@ -2565,13 +2605,7 @@ function parseCommitMessage(commit, hash) { .splice(1) .join("\n") .trim(); - return { - raw, - hash: hash, - author: author, - committer: committer, - ...ccommit.parseCommitMessage(raw), - }; + return { raw, hash, author, committer, ...ccommit.parseCommitMessage(raw) }; } /** * Reads a (local) commit message from the .git/objects folder @@ -41586,7 +41620,7 @@ exports.validatePullRequest = validatePullRequest; * @see https://www.conventionalcommits.org/en/v1.0.0/ */ function validateCommits(commits) { - return commits.filter(commit => !commit.subject.startsWith("fixup!")).map(commit => validateCommit(commit)); + return commits.filter(commit => !commit.isFixupCommit && !commit.isMergeCommit).map(commit => validateCommit(commit)); } exports.validateCommits = validateCommits; diff --git a/lib/precommit/index.js b/lib/precommit/index.js index 162499c..d00e239 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -2191,6 +2191,12 @@ class Commit { get raw() { return this._commit.raw; } + get isFixupCommit() { + return this._commit.attributes.isFixup; + } + get isMergeCommit() { + return this._commit.attributes.isMerge; + } toJSON() { return this._commit; } @@ -2238,6 +2244,22 @@ function getFooterElementsFromParagraph(footer) { return Object.keys(result).length > 0 ? result : undefined; } exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; +/** + * Checks if the provided subject is a common (default) merge pattern. + * Currently supported: + * - GitHub + * - BitBucket + * - GitLab + * + * @param subject The subject to check + * @returns True if the subject is a common merge pattern, false otherwise + */ +function subjectIsMergePattern(subject) { + const githubMergeRegex = /^Merge pull request #(\d+) from '?(.*)'?$/; + const bitbucketMergeRegex = /^Merged in '?(.*)'? \(pull request #(\d+)\)$/; + const gitlabMergeRegex = /^Merge branch '?(.*?)'? into '?(.*?)'?$/; + return githubMergeRegex.test(subject) || bitbucketMergeRegex.test(subject) || gitlabMergeRegex.test(subject); +} /** * Parses the provided commit message (full message, not just the subject) into * a Commit object. @@ -2262,13 +2284,20 @@ function parseCommitMessage(message) { if (body === "") body = undefined; } + const subject = paragraphs[0].trim(); + const isFixup = subject.toLowerCase().startsWith("fixup!"); + const isMerge = subjectIsMergePattern(subject); return { - subject: paragraphs[0].trim(), - body: body, + subject, + body, footer: getFooterElementsFromParagraph(footer ?? "")?.reduce((acc, cur) => { acc[cur.key] = cur.value; return acc; }, {}), + attributes: { + isFixup, + isMerge, + }, }; } exports.parseCommitMessage = parseCommitMessage; @@ -2406,6 +2435,13 @@ class ConventionalCommit { return (this._raw.breaking.value?.trimEnd() === "!" || (this.footer !== undefined && ("BREAKING CHANGE" in this.footer || "BREAKING-CHANGE" in this.footer))); } + // Attributes + get isFixupCommit() { + return this._raw.commit.isFixupCommit; + } + get isMergeCommit() { + return this._raw.commit.isMergeCommit; + } // Raw get raw() { return this._raw.commit.raw; @@ -2436,6 +2472,10 @@ class ConventionalCommit { errors: this.errors, warnings: this.warnings, }, + attributes: { + isFixup: this.isFixupCommit, + isMerge: this.isMergeCommit, + }, }; } // Private validation function @@ -2565,13 +2605,7 @@ function parseCommitMessage(commit, hash) { .splice(1) .join("\n") .trim(); - return { - raw, - hash: hash, - author: author, - committer: committer, - ...ccommit.parseCommitMessage(raw), - }; + return { raw, hash, author, committer, ...ccommit.parseCommitMessage(raw) }; } /** * Reads a (local) commit message from the .git/objects folder @@ -41569,7 +41603,7 @@ exports.validatePullRequest = validatePullRequest; * @see https://www.conventionalcommits.org/en/v1.0.0/ */ function validateCommits(commits) { - return commits.filter(commit => !commit.subject.startsWith("fixup!")).map(commit => validateCommit(commit)); + return commits.filter(commit => !commit.isFixupCommit && !commit.isMergeCommit).map(commit => validateCommit(commit)); } exports.validateCommits = validateCommits; diff --git a/package-lock.json b/package-lock.json index e3eb5d8..9378b67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -743,9 +743,9 @@ "dev": true }, "node_modules/@dev-build-deploy/commit-it": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.0.4.tgz", - "integrity": "sha512-yhAj8RH0c8w4VCGYbt77JnRxemb/uwQrC/LpHEs0euiCTooTZW8VTGXgsOH/KnJC0lHeSoIHNF/Axk2UPSnU9A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.1.0.tgz", + "integrity": "sha512-ivPexRuSLBOKhjnyxou0iGomsxj63mtLpReL437AKFOCWoCC2ruu76lSWShGdLSf4jjv8oxV9+YH5RJGbc4Vew==", "dependencies": { "@dev-build-deploy/diagnose-it": "^1", "chalk": "<5" @@ -2663,9 +2663,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.635", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.635.tgz", - "integrity": "sha512-iu/2D0zolKU3iDGXXxdOzNf72Jnokn+K1IN6Kk4iV6l1Tr2g/qy+mvmtfAiBwZe5S3aB5r92vp+zSZ69scYRrg==", + "version": "1.4.636", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.636.tgz", + "integrity": "sha512-NLE0GIy1OL9wRiKL20h9TkctBEYZuc99tquSS9MVdTahnuHputoETHeqDzgqGqyOY9NUH0g9wjfEuw5OD+wRcQ==", "dev": true }, "node_modules/emittery": { diff --git a/src/validator.ts b/src/validator.ts index 7596456..9039605 100644 --- a/src/validator.ts +++ b/src/validator.ts @@ -65,5 +65,5 @@ export function validatePullRequest(pullrequest: Commit, commits: ConventionalCo * @see https://www.conventionalcommits.org/en/v1.0.0/ */ export function validateCommits(commits: Commit[]): ConventionalCommit[] { - return commits.filter(commit => !commit.subject.startsWith("fixup!")).map(commit => validateCommit(commit)); + return commits.filter(commit => !commit.isFixupCommit && !commit.isMergeCommit).map(commit => validateCommit(commit)); } diff --git a/test/validator.test.ts b/test/validator.test.ts index b86da81..ad15628 100644 --- a/test/validator.test.ts +++ b/test/validator.test.ts @@ -233,3 +233,23 @@ describe("Validate valid Pull Request vs Commits", () => { } }); }); + +describe("Ignore fixup and merge commits", () => { + const testData = [ + "fixup! feat: add new feature", + "fixup! fixup! feat: add new feature", + "Merge pull request #123 from some-branch/feature/branch", + "Merge pull request #123 from 'some-branch/feature/branch'", + "Merged in ci/some-branch (pull request #123)", + "Merged in 'ci/some-branch' (pull request #123)", + "Merge branch 'ci/some-branch' into 'main'", + "Merge branch 'ci/some-branch' into main", + "Merge branch ci/some-branch into main", + ]; + + it.each(testData)("$test", test => { + const result = validator.validateCommits([Commit.fromString({ hash: "0a0b0c0d", message: test })]); + + expect(result.length).toBe(0); + }); +}); From 27f09bd98cad709a51a99f80de1937547cedb4c5 Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Wed, 17 Jan 2024 21:39:00 +0100 Subject: [PATCH 08/22] chore(deps): enable auto-updating dependencies --- .github/.commit-me.json | 2 +- .github/dependabot.yml | 2 -- .pre-commit-config.yaml | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/.commit-me.json b/.github/.commit-me.json index e5f4d98..153f824 100644 --- a/.github/.commit-me.json +++ b/.github/.commit-me.json @@ -1,4 +1,4 @@ { "types": [ "build", "chore", "ci", "docs", "style", "refactor", "perf", "test" ], - "scopes": [ "cli", "precommit", "action" ] + "scopes": [ "cli", "precommit", "action", "deps" ] } diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fde1bb0..43f583d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,7 +7,6 @@ updates: directory: "/" schedule: interval: "daily" - open-pull-requests-limit: 0 - package-ecosystem: "npm" directory: "/" @@ -15,4 +14,3 @@ updates: interval: "weekly" allow: - dependency-type: "production" - open-pull-requests-limit: 0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 309ec37..3d5425e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: - repo: https://github.com/dev-build-deploy/commit-me - rev: v1.1.0 + rev: v1.3.1 hooks: - id: commit-me args: [ @@ -12,6 +12,6 @@ repos: ] - repo: https://github.com/dev-build-deploy/reuse-me - rev: v0.10.0 + rev: v1.0.0 hooks: - id: reuse-me From b32199536cf52fcb2e4ef84492f88f302e0eee02 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 20:40:03 +0000 Subject: [PATCH 09/22] chore(deps): bump actions/setup-node from 3 to 4 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index f1fec58..342666c 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v3 - name: Set up Node.js 16.x - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 16.x From 72060fede215fd2c36a0e880084d5e4ee859e116 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 20:43:10 +0000 Subject: [PATCH 10/22] chore(deps): bump actions/publish-action from 0.2.2 to 0.3.0 Bumps [actions/publish-action](https://github.com/actions/publish-action) from 0.2.2 to 0.3.0. - [Commits](https://github.com/actions/publish-action/compare/v0.2.2...v0.3.0) --- updated-dependencies: - dependency-name: actions/publish-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8cd3fc..f391909 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,6 +57,6 @@ jobs: ref: ${{ fromJSON(needs.release-me.outputs.release).tag_name }} - name: Update the ${{ fromJSON(needs.release-me.outputs.release).tag_name }} tag - uses: actions/publish-action@v0.2.2 + uses: actions/publish-action@v0.3.0 with: source-tag: ${{ fromJSON(needs.release-me.outputs.release).tag_name }} From e5b2ac1f0b3865b285dd55f6d257b672fece233c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 20:54:48 +0000 Subject: [PATCH 11/22] chore(deps): bump dev-build-deploy/reuse-me from 0 to 1 Bumps [dev-build-deploy/reuse-me](https://github.com/dev-build-deploy/reuse-me) from 0 to 1. - [Release notes](https://github.com/dev-build-deploy/reuse-me/releases) - [Commits](https://github.com/dev-build-deploy/reuse-me/compare/v0...v1) --- updated-dependencies: - dependency-name: dev-build-deploy/reuse-me dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/copyright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copyright.yml b/.github/workflows/copyright.yml index 7a44a71..9da1260 100644 --- a/.github/workflows/copyright.yml +++ b/.github/workflows/copyright.yml @@ -14,4 +14,4 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: dev-build-deploy/reuse-me@v0 + - uses: dev-build-deploy/reuse-me@v1 From abc90ee04b514001520efa202249b352da707653 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 21:06:13 +0000 Subject: [PATCH 12/22] chore(deps): bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/conventional-commits.yml | 2 +- .github/workflows/copyright.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/validate.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml index 7293b40..6944c4a 100644 --- a/.github/workflows/conventional-commits.yml +++ b/.github/workflows/conventional-commits.yml @@ -24,7 +24,7 @@ jobs: name: Conventional Commits Compliance runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run CommitMe uses: ./ with: diff --git a/.github/workflows/copyright.yml b/.github/workflows/copyright.yml index 9da1260..530af2e 100644 --- a/.github/workflows/copyright.yml +++ b/.github/workflows/copyright.yml @@ -13,5 +13,5 @@ jobs: name: REUSE compliance runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dev-build-deploy/reuse-me@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f391909..d7dc5e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,7 +52,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ fromJSON(needs.release-me.outputs.release).tag_name }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 342666c..9a11a32 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Node.js 16.x uses: actions/setup-node@v4 From 8fc01ac4ca99d28c669b7327d45bc4fed5ea715b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 02:51:36 +0000 Subject: [PATCH 13/22] chore(deps): bump commander from 11.1.0 to 12.0.0 Bumps [commander](https://github.com/tj/commander.js) from 11.1.0 to 12.0.0. - [Release notes](https://github.com/tj/commander.js/releases) - [Changelog](https://github.com/tj/commander.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/tj/commander.js/compare/v11.1.0...v12.0.0) --- updated-dependencies: - dependency-name: commander dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- lib/cli/index.js | 487 +++++++++++++++++++++++++---------------- lib/precommit/index.js | 487 +++++++++++++++++++++++++---------------- package-lock.json | 10 +- package.json | 2 +- 4 files changed, 604 insertions(+), 382 deletions(-) diff --git a/lib/cli/index.js b/lib/cli/index.js index 9ef6fe6..864a109 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -43503,7 +43503,7 @@ module.exports = parseParams /***/ }), /***/ 4379: -/***/ ((module, exports, __nccwpck_require__) => { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { const { Argument } = __nccwpck_require__(9414); const { Command } = __nccwpck_require__(552); @@ -43511,13 +43511,11 @@ const { CommanderError, InvalidArgumentError } = __nccwpck_require__(2625); const { Help } = __nccwpck_require__(5153); const { Option } = __nccwpck_require__(6558); -/** - * Expose the root command. - */ +exports.program = new Command(); -exports = module.exports = new Command(); -exports.program = exports; // More explicit access to global command. -// createArgument, createCommand, and createOption are implicitly available as they are methods on program. +exports.createCommand = (name) => new Command(name); +exports.createOption = (flags, description) => new Option(flags, description); +exports.createArgument = (name, description) => new Argument(name, description); /** * Expose classes @@ -43590,7 +43588,7 @@ class Argument { } /** - * @api private + * @package internal use only */ _concatValue(value, previous) { @@ -43670,7 +43668,7 @@ class Argument { * * @param {Argument} arg * @return {string} - * @api private + * @private */ function humanReadableArgName(arg) { @@ -43699,7 +43697,7 @@ const process = __nccwpck_require__(7282); const { Argument, humanReadableArgName } = __nccwpck_require__(9414); const { CommanderError } = __nccwpck_require__(2625); const { Help } = __nccwpck_require__(5153); -const { Option, splitOptionFlags, DualOptions } = __nccwpck_require__(6558); +const { Option, DualOptions } = __nccwpck_require__(6558); const { suggestSimilar } = __nccwpck_require__(7592); class Command extends EventEmitter { @@ -43744,7 +43742,7 @@ class Command extends EventEmitter { this._enablePositionalOptions = false; this._passThroughOptions = false; this._lifeCycleHooks = {}; // a hash of arrays - /** @type {boolean | string} */ + /** @type {(boolean | string)} */ this._showHelpAfterError = false; this._showSuggestionAfterError = true; @@ -43758,15 +43756,11 @@ class Command extends EventEmitter { }; this._hidden = false; - this._hasHelpOption = true; - this._helpFlags = '-h, --help'; - this._helpDescription = 'display help for command'; - this._helpShortFlag = '-h'; - this._helpLongFlag = '--help'; - this._addImplicitHelpCommand = undefined; // Deliberately undefined, not decided whether true or false - this._helpCommandName = 'help'; - this._helpCommandnameAndArgs = 'help [command]'; - this._helpCommandDescription = 'display help for command'; + /** @type {(Option | null | undefined)} */ + this._helpOption = undefined; // Lazy created on demand. May be null if help option is disabled. + this._addImplicitHelpCommand = undefined; // undecided whether true or false yet, not inherited + /** @type {Command} */ + this._helpCommand = undefined; // lazy initialised, inherited this._helpConfiguration = {}; } @@ -43780,14 +43774,8 @@ class Command extends EventEmitter { */ copyInheritedSettings(sourceCommand) { this._outputConfiguration = sourceCommand._outputConfiguration; - this._hasHelpOption = sourceCommand._hasHelpOption; - this._helpFlags = sourceCommand._helpFlags; - this._helpDescription = sourceCommand._helpDescription; - this._helpShortFlag = sourceCommand._helpShortFlag; - this._helpLongFlag = sourceCommand._helpLongFlag; - this._helpCommandName = sourceCommand._helpCommandName; - this._helpCommandnameAndArgs = sourceCommand._helpCommandnameAndArgs; - this._helpCommandDescription = sourceCommand._helpCommandDescription; + this._helpOption = sourceCommand._helpOption; + this._helpCommand = sourceCommand._helpCommand; this._helpConfiguration = sourceCommand._helpConfiguration; this._exitCallback = sourceCommand._exitCallback; this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties; @@ -43802,7 +43790,7 @@ class Command extends EventEmitter { /** * @returns {Command[]} - * @api private + * @private */ _getCommandAndAncestors() { @@ -43833,7 +43821,7 @@ class Command extends EventEmitter { * .command('stop [service]', 'stop named service, or all if no name supplied'); * * @param {string} nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` - * @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) + * @param {(Object|string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) * @param {Object} [execOpts] - configuration options (for executable) * @return {Command} returns new command for action handler, or `this` for executable command */ @@ -43857,7 +43845,7 @@ class Command extends EventEmitter { cmd._hidden = !!(opts.noHelp || opts.hidden); // noHelp is deprecated old name for hidden cmd._executableFile = opts.executableFile || null; // Custom name for executable file, set missing to null to match constructor if (args) cmd.arguments(args); - this.commands.push(cmd); + this._registerCommand(cmd); cmd.parent = this; cmd.copyInheritedSettings(this); @@ -43895,7 +43883,7 @@ class Command extends EventEmitter { * or with a subclass of Help by overriding createHelp(). * * @param {Object} [configuration] - configuration options - * @return {Command|Object} `this` command for chaining, or stored configuration + * @return {(Command|Object)} `this` command for chaining, or stored configuration */ configureHelp(configuration) { @@ -43921,7 +43909,7 @@ class Command extends EventEmitter { * outputError(str, write) // used for displaying errors, and not used for displaying help * * @param {Object} [configuration] - configuration options - * @return {Command|Object} `this` command for chaining, or stored configuration + * @return {(Command|Object)} `this` command for chaining, or stored configuration */ configureOutput(configuration) { @@ -43934,7 +43922,7 @@ class Command extends EventEmitter { /** * Display the help or a custom message after an error occurs. * - * @param {boolean|string} [displayHelp] + * @param {(boolean|string)} [displayHelp] * @return {Command} `this` command for chaining */ showHelpAfterError(displayHelp = true) { @@ -43974,8 +43962,10 @@ class Command extends EventEmitter { if (opts.isDefault) this._defaultCommandName = cmd._name; if (opts.noHelp || opts.hidden) cmd._hidden = true; // modifying passed command due to existing implementation - this.commands.push(cmd); + this._registerCommand(cmd); cmd.parent = this; + cmd._checkForBrokenPassThrough(); + return this; } @@ -44006,7 +43996,7 @@ class Command extends EventEmitter { * * @param {string} name * @param {string} [description] - * @param {Function|*} [fn] - custom argument processing function + * @param {(Function|*)} [fn] - custom argument processing function * @param {*} [defaultValue] * @return {Command} `this` command for chaining */ @@ -44059,39 +44049,76 @@ class Command extends EventEmitter { } /** - * Override default decision whether to add implicit help command. + * Customise or override default help command. By default a help command is automatically added if your command has subcommands. * - * addHelpCommand() // force on - * addHelpCommand(false); // force off - * addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details + * program.helpCommand('help [cmd]'); + * program.helpCommand('help [cmd]', 'show help'); + * program.helpCommand(false); // suppress default help command + * program.helpCommand(true); // add help command even if no subcommands * + * @param {string|boolean} enableOrNameAndArgs - enable with custom name and/or arguments, or boolean to override whether added + * @param {string} [description] - custom description * @return {Command} `this` command for chaining */ - addHelpCommand(enableOrNameAndArgs, description) { - if (enableOrNameAndArgs === false) { - this._addImplicitHelpCommand = false; - } else { - this._addImplicitHelpCommand = true; - if (typeof enableOrNameAndArgs === 'string') { - this._helpCommandName = enableOrNameAndArgs.split(' ')[0]; - this._helpCommandnameAndArgs = enableOrNameAndArgs; - } - this._helpCommandDescription = description || this._helpCommandDescription; + helpCommand(enableOrNameAndArgs, description) { + if (typeof enableOrNameAndArgs === 'boolean') { + this._addImplicitHelpCommand = enableOrNameAndArgs; + return this; } + + enableOrNameAndArgs = enableOrNameAndArgs ?? 'help [command]'; + const [, helpName, helpArgs] = enableOrNameAndArgs.match(/([^ ]+) *(.*)/); + const helpDescription = description ?? 'display help for command'; + + const helpCommand = this.createCommand(helpName); + helpCommand.helpOption(false); + if (helpArgs) helpCommand.arguments(helpArgs); + if (helpDescription) helpCommand.description(helpDescription); + + this._addImplicitHelpCommand = true; + this._helpCommand = helpCommand; + return this; } /** - * @return {boolean} - * @api private + * Add prepared custom help command. + * + * @param {(Command|string|boolean)} helpCommand - custom help command, or deprecated enableOrNameAndArgs as for `.helpCommand()` + * @param {string} [deprecatedDescription] - deprecated custom description used with custom name only + * @return {Command} `this` command for chaining */ + addHelpCommand(helpCommand, deprecatedDescription) { + // If not passed an object, call through to helpCommand for backwards compatibility, + // as addHelpCommand was originally used like helpCommand is now. + if (typeof helpCommand !== 'object') { + this.helpCommand(helpCommand, deprecatedDescription); + return this; + } - _hasImplicitHelpCommand() { - if (this._addImplicitHelpCommand === undefined) { - return this.commands.length && !this._actionHandler && !this._findCommand('help'); + this._addImplicitHelpCommand = true; + this._helpCommand = helpCommand; + return this; + } + + /** + * Lazy create help command. + * + * @return {(Command|null)} + * @package + */ + _getHelpCommand() { + const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? + (this.commands.length && !this._actionHandler && !this._findCommand('help')); + + if (hasImplicitHelpCommand) { + if (this._helpCommand === undefined) { + this.helpCommand(undefined, undefined); // use default name and description + } + return this._helpCommand; } - return this._addImplicitHelpCommand; + return null; } /** @@ -44145,7 +44172,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * @param {string} code an id string representing the error * @param {string} message human-readable description of the error * @return never - * @api private + * @private */ _exit(exitCode, code, message) { @@ -44207,11 +44234,11 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Wrap parseArgs to catch 'commander.invalidArgument'. * - * @param {Option | Argument} target + * @param {(Option | Argument)} target * @param {string} value * @param {*} previous * @param {string} invalidArgumentMessage - * @api private + * @private */ _callParseArg(target, value, previous, invalidArgumentMessage) { @@ -44226,6 +44253,49 @@ Expecting one of '${allowedValues.join("', '")}'`); } } + /** + * Check for option flag conflicts. + * Register option if no conflicts found, or throw on conflict. + * + * @param {Option} option + * @api private + */ + + _registerOption(option) { + const matchingOption = (option.short && this._findOption(option.short)) || + (option.long && this._findOption(option.long)); + if (matchingOption) { + const matchingFlag = (option.long && this._findOption(option.long)) ? option.long : option.short; + throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}' +- already used by option '${matchingOption.flags}'`); + } + + this.options.push(option); + } + + /** + * Check for command name and alias conflicts with existing commands. + * Register command if no conflicts found, or throw on conflict. + * + * @param {Command} command + * @api private + */ + + _registerCommand(command) { + const knownBy = (cmd) => { + return [cmd.name()].concat(cmd.aliases()); + }; + + const alreadyUsed = knownBy(command).find((name) => this._findCommand(name)); + if (alreadyUsed) { + const existingCmd = knownBy(this._findCommand(alreadyUsed)).join('|'); + const newCmd = knownBy(command).join('|'); + throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`); + } + + this.commands.push(command); + } + /** * Add an option. * @@ -44233,6 +44303,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * @return {Command} `this` command for chaining */ addOption(option) { + this._registerOption(option); + const oname = option.name(); const name = option.attributeName(); @@ -44247,9 +44319,6 @@ Expecting one of '${allowedValues.join("', '")}'`); this.setOptionValueWithSource(name, option.defaultValue, 'default'); } - // register the option - this.options.push(option); - // handler for cli and env supplied values const handleOptionValue = (val, invalidValueMessage, valueSource) => { // val is null for optional option used without an optional-argument. @@ -44297,7 +44366,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Internal implementation shared by .option() and .requiredOption() * - * @api private + * @private */ _optionEx(config, flags, description, fn, defaultValue) { if (typeof flags === 'object' && flags instanceof Option) { @@ -44339,7 +44408,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} flags * @param {string} [description] - * @param {Function|*} [parseArg] - custom option processing function or default value + * @param {(Function|*)} [parseArg] - custom option processing function or default value * @param {*} [defaultValue] * @return {Command} `this` command for chaining */ @@ -44356,7 +44425,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} flags * @param {string} [description] - * @param {Function|*} [parseArg] - custom option processing function or default value + * @param {(Function|*)} [parseArg] - custom option processing function or default value * @param {*} [defaultValue] * @return {Command} `this` command for chaining */ @@ -44373,7 +44442,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b` * - * @param {Boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag. + * @param {boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag. */ combineFlagAndOptionalValue(combine = true) { this._combineFlagAndOptionalValue = !!combine; @@ -44383,7 +44452,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow unknown options on the command line. * - * @param {Boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown + * @param {boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown * for unknown options. */ allowUnknownOption(allowUnknown = true) { @@ -44394,7 +44463,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow excess command-arguments on the command line. Pass false to make excess arguments an error. * - * @param {Boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown + * @param {boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown * for excess arguments. */ allowExcessArguments(allowExcess = true) { @@ -44407,7 +44476,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions. * The default behaviour is non-positional and global options may appear anywhere on the command line. * - * @param {Boolean} [positional=true] + * @param {boolean} [positional=true] */ enablePositionalOptions(positional = true) { this._enablePositionalOptions = !!positional; @@ -44420,17 +44489,25 @@ Expecting one of '${allowedValues.join("', '")}'`); * positional options to have been enabled on the program (parent commands). * The default behaviour is non-positional and options may appear before or after command-arguments. * - * @param {Boolean} [passThrough=true] + * @param {boolean} [passThrough=true] * for unknown options. */ passThroughOptions(passThrough = true) { this._passThroughOptions = !!passThrough; - if (!!this.parent && passThrough && !this.parent._enablePositionalOptions) { - throw new Error('passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)'); - } + this._checkForBrokenPassThrough(); return this; } + /** + * @private + */ + + _checkForBrokenPassThrough() { + if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) { + throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`); + } + } + /** * Whether to store option values as properties on command object, * or store separately (specify false). In both cases the option values can be accessed using .opts(). @@ -44443,9 +44520,9 @@ Expecting one of '${allowedValues.join("', '")}'`); if (this.options.length) { throw new Error('call .storeOptionsAsProperties() before adding options'); } - // if (Object.keys(this._optionValues).length) { - // throw new Error('call .storeOptionsAsProperties() before setting option values'); - // } + if (Object.keys(this._optionValues).length) { + throw new Error('call .storeOptionsAsProperties() before setting option values'); + } this._storeOptionsAsProperties = !!storeAsProperties; return this; } @@ -44530,7 +44607,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Get user arguments from implied or explicit arguments. * Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches. * - * @api private + * @private */ _prepareUserArgs(argv, parseOptions) { @@ -44633,7 +44710,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Execute a sub-command executable. * - * @api private + * @private */ _executeSubCommand(subcommand, args) { @@ -44720,15 +44797,15 @@ Expecting one of '${allowedValues.join("', '")}'`); } // By default terminate process when spawned process terminates. - // Suppressing the exit if exitCallback defined is a bit messy and of limited use, but does allow process to stay running! const exitCallback = this._exitCallback; - if (!exitCallback) { - proc.on('close', process.exit.bind(process)); - } else { - proc.on('close', () => { - exitCallback(new CommanderError(process.exitCode || 0, 'commander.executeSubCommandAsync', '(close)')); - }); - } + proc.on('close', (code, _signal) => { + code = code ?? 1; // code is null if spawned process terminated due to a signal + if (!exitCallback) { + process.exit(code); + } else { + exitCallback(new CommanderError(code, 'commander.executeSubCommandAsync', '(close)')); + } + }); proc.on('error', (err) => { // @ts-ignore if (err.code === 'ENOENT') { @@ -44758,7 +44835,7 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * @api private + * @private */ _dispatchSubcommand(commandName, operands, unknown) { @@ -44781,7 +44858,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Invoke help directly if possible, or dispatch if necessary. * e.g. help foo * - * @api private + * @private */ _dispatchHelpCommand(subcommandName) { @@ -44795,14 +44872,14 @@ Expecting one of '${allowedValues.join("', '")}'`); // Fallback to parsing the help flag to invoke the help. return this._dispatchSubcommand(subcommandName, [], [ - this._helpLongFlag || this._helpShortFlag + this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help' ]); } /** * Check this.args against expected this.registeredArguments. * - * @api private + * @private */ _checkNumberOfArguments() { @@ -44824,7 +44901,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Process this.args using this.registeredArguments and save as this.processedArgs! * - * @api private + * @private */ _processArguments() { @@ -44869,10 +44946,10 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Once we have a promise we chain, but call synchronously until then. * - * @param {Promise|undefined} promise + * @param {(Promise|undefined)} promise * @param {Function} fn - * @return {Promise|undefined} - * @api private + * @return {(Promise|undefined)} + * @private */ _chainOrCall(promise, fn) { @@ -44887,10 +44964,10 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * - * @param {Promise|undefined} promise + * @param {(Promise|undefined)} promise * @param {string} event - * @return {Promise|undefined} - * @api private + * @return {(Promise|undefined)} + * @private */ _chainOrCallHooks(promise, event) { @@ -44918,11 +44995,11 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * - * @param {Promise|undefined} promise + * @param {(Promise|undefined)} promise * @param {Command} subCommand * @param {string} event - * @return {Promise|undefined} - * @api private + * @return {(Promise|undefined)} + * @private */ _chainOrCallSubCommandHook(promise, subCommand, event) { @@ -44941,7 +45018,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Process arguments in context of this command. * Returns action result, in case it is a promise. * - * @api private + * @private */ _parseCommand(operands, unknown) { @@ -44955,11 +45032,11 @@ Expecting one of '${allowedValues.join("', '")}'`); if (operands && this._findCommand(operands[0])) { return this._dispatchSubcommand(operands[0], operands.slice(1), unknown); } - if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) { + if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) { return this._dispatchHelpCommand(operands[1]); } if (this._defaultCommandName) { - outputHelpIfRequested(this, unknown); // Run the help for default command from parent rather than passing to default command + this._outputHelpIfRequested(unknown); // Run the help for default command from parent rather than passing to default command return this._dispatchSubcommand(this._defaultCommandName, operands, unknown); } if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) { @@ -44967,7 +45044,7 @@ Expecting one of '${allowedValues.join("', '")}'`); this.help({ error: true }); } - outputHelpIfRequested(this, parsed.unknown); + this._outputHelpIfRequested(parsed.unknown); this._checkForMissingMandatoryOptions(); this._checkForConflictingOptions(); @@ -45025,7 +45102,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Find matching command. * - * @api private + * @private */ _findCommand(name) { if (!name) return undefined; @@ -45037,7 +45114,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} arg * @return {Option} - * @api private + * @package internal use only */ _findOption(arg) { @@ -45048,7 +45125,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Display an error message if a mandatory option does not have a value. * Called after checking for help flags in leaf subcommand. * - * @api private + * @private */ _checkForMissingMandatoryOptions() { @@ -45065,7 +45142,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Display an error message if conflicting options are used together in this. * - * @api private + * @private */ _checkForConflictingLocalOptions() { const definedNonDefaultOptions = this.options.filter( @@ -45096,7 +45173,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Display an error message if conflicting options are used together. * Called after checking for help flags in leaf subcommand. * - * @api private + * @private */ _checkForConflictingOptions() { // Walk up hierarchy so can call in subcommand after checking for displaying help. @@ -45117,8 +45194,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * sub --unknown uuu op => [sub], [--unknown uuu op] * sub -- --unknown uuu op => [sub --unknown uuu op], [] * - * @param {String[]} argv - * @return {{operands: String[], unknown: String[]}} + * @param {string[]} argv + * @return {{operands: string[], unknown: string[]}} */ parseOptions(argv) { @@ -45212,7 +45289,7 @@ Expecting one of '${allowedValues.join("', '")}'`); operands.push(arg); if (args.length > 0) unknown.push(...args); break; - } else if (arg === this._helpCommandName && this._hasImplicitHelpCommand()) { + } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) { operands.push(arg); if (args.length > 0) operands.push(...args); break; @@ -45300,7 +45377,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Apply any option related environment variables, if option does * not have a value from cli or client code. * - * @api private + * @private */ _parseOptionsEnv() { this.options.forEach((option) => { @@ -45323,7 +45400,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Apply any implied option values, if option is undefined or default value. * - * @api private + * @private */ _parseOptionsImplied() { const dualHelper = new DualOptions(this.options); @@ -45347,7 +45424,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Argument `name` is missing. * * @param {string} name - * @api private + * @private */ missingArgument(name) { @@ -45359,7 +45436,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * `Option` is missing an argument. * * @param {Option} option - * @api private + * @private */ optionMissingArgument(option) { @@ -45371,7 +45448,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * `Option` does not have a value, and is a mandatory option. * * @param {Option} option - * @api private + * @private */ missingMandatoryOptionValue(option) { @@ -45384,7 +45461,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {Option} option * @param {Option} conflictingOption - * @api private + * @private */ _conflictingOption(option, conflictingOption) { // The calling code does not know whether a negated option is the source of the @@ -45421,7 +45498,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Unknown option `flag`. * * @param {string} flag - * @api private + * @private */ unknownOption(flag) { @@ -45450,7 +45527,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Excess arguments, more than expected. * * @param {string[]} receivedArgs - * @api private + * @private */ _excessArguments(receivedArgs) { @@ -45466,7 +45543,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Unknown command. * - * @api private + * @private */ unknownCommand() { @@ -45497,7 +45574,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * @param {string} [str] * @param {string} [flags] * @param {string} [description] - * @return {this | string | undefined} `this` command for chaining, or version string if no arguments + * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments */ version(str, flags, description) { @@ -45506,8 +45583,9 @@ Expecting one of '${allowedValues.join("', '")}'`); flags = flags || '-V, --version'; description = description || 'output the version number'; const versionOption = this.createOption(flags, description); - this._versionOptionName = versionOption.attributeName(); // [sic] not defined in constructor, partly legacy, partly only needed at root - this.options.push(versionOption); + this._versionOptionName = versionOption.attributeName(); + this._registerOption(versionOption); + this.on('option:' + versionOption.name(), () => { this._outputConfiguration.writeOut(`${str}\n`); this._exit(0, 'commander.version', str); @@ -45520,7 +45598,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} [str] * @param {Object} [argsDescription] - * @return {string|Command} + * @return {(string|Command)} */ description(str, argsDescription) { if (str === undefined && argsDescription === undefined) return this._description; @@ -45535,7 +45613,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Set the summary. Used when listed as subcommand of parent. * * @param {string} [str] - * @return {string|Command} + * @return {(string|Command)} */ summary(str) { if (str === undefined) return this._summary; @@ -45549,7 +45627,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help. * * @param {string} [alias] - * @return {string|Command} + * @return {(string|Command)} */ alias(alias) { @@ -45563,6 +45641,12 @@ Expecting one of '${allowedValues.join("', '")}'`); } if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); + const matchingCommand = this.parent?._findCommand(alias); + if (matchingCommand) { + // c.f. _registerCommand + const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join('|'); + throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`); + } command._aliases.push(alias); return this; @@ -45574,7 +45658,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Only the first alias is shown in the auto-generated help. * * @param {string[]} [aliases] - * @return {string[]|Command} + * @return {(string[]|Command)} */ aliases(aliases) { @@ -45589,7 +45673,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Set / get the command usage `str`. * * @param {string} [str] - * @return {String|Command} + * @return {(string|Command)} */ usage(str) { @@ -45600,7 +45684,7 @@ Expecting one of '${allowedValues.join("', '")}'`); return humanReadableArgName(arg); }); return [].concat( - (this.options.length || this._hasHelpOption ? '[options]' : []), + (this.options.length || (this._helpOption !== null) ? '[options]' : []), (this.commands.length ? '[command]' : []), (this.registeredArguments.length ? args : []) ).join(' '); @@ -45614,7 +45698,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Get or set the name of the command. * * @param {string} [str] - * @return {string|Command} + * @return {(string|Command)} */ name(str) { @@ -45651,7 +45735,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * program.executableDir('subcommands'); * * @param {string} [path] - * @return {string|null|Command} + * @return {(string|null|Command)} */ executableDir(path) { @@ -45676,7 +45760,7 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * @api private + * @private */ _getHelpContext(contextOptions) { @@ -45721,38 +45805,72 @@ Expecting one of '${allowedValues.join("', '")}'`); } context.write(helpInformation); - if (this._helpLongFlag) { - this.emit(this._helpLongFlag); // deprecated + if (this._getHelpOption()?.long) { + this.emit(this._getHelpOption().long); // deprecated } this.emit('afterHelp', context); this._getCommandAndAncestors().forEach(command => command.emit('afterAllHelp', context)); } /** - * You can pass in flags and a description to override the help - * flags and help description for your command. Pass in false to - * disable the built-in help option. + * You can pass in flags and a description to customise the built-in help option. + * Pass in false to disable the built-in help option. + * + * @example + * program.helpOption('-?, --help' 'show help'); // customise + * program.helpOption(false); // disable * - * @param {string | boolean} [flags] + * @param {(string | boolean)} flags * @param {string} [description] * @return {Command} `this` command for chaining */ helpOption(flags, description) { + // Support disabling built-in help option. if (typeof flags === 'boolean') { - this._hasHelpOption = flags; + if (flags) { + this._helpOption = this._helpOption ?? undefined; // preserve existing option + } else { + this._helpOption = null; // disable + } return this; } - this._helpFlags = flags || this._helpFlags; - this._helpDescription = description || this._helpDescription; - const helpFlags = splitOptionFlags(this._helpFlags); - this._helpShortFlag = helpFlags.shortFlag; - this._helpLongFlag = helpFlags.longFlag; + // Customise flags and description. + flags = flags ?? '-h, --help'; + description = description ?? 'display help for command'; + this._helpOption = this.createOption(flags, description); return this; } + /** + * Lazy create help option. + * Returns null if has been disabled with .helpOption(false). + * + * @returns {(Option | null)} the help option + * @package internal use only + */ + _getHelpOption() { + // Lazy create help option on demand. + if (this._helpOption === undefined) { + this.helpOption(undefined, undefined); + } + return this._helpOption; + } + + /** + * Supply your own option to use for the built-in help option. + * This is an alternative to using helpOption() to customise the flags and description etc. + * + * @param {Option} option + * @return {Command} `this` command for chaining + */ + addHelpOption(option) { + this._helpOption = option; + return this; + } + /** * Output help information and exit. * @@ -45778,7 +45896,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands. * * @param {string} position - before or after built-in help - * @param {string | Function} text - string to add, or a function returning a string + * @param {(string | Function)} text - string to add, or a function returning a string * @return {Command} `this` command for chaining */ addHelpText(position, text) { @@ -45802,22 +45920,22 @@ Expecting one of '${allowedValues.join("', '")}'`); }); return this; } -} -/** - * Output help information if help flags specified - * - * @param {Command} cmd - command to output help for - * @param {Array} args - array of options to search for help flags - * @api private - */ + /** + * Output help information if help flags specified + * + * @param {Array} args - array of options to search for help flags + * @private + */ -function outputHelpIfRequested(cmd, args) { - const helpOption = cmd._hasHelpOption && args.find(arg => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag); - if (helpOption) { - cmd.outputHelp(); - // (Do not have all displayed text available so only passing placeholder.) - cmd._exit(0, 'commander.helpDisplayed', '(outputHelp)'); + _outputHelpIfRequested(args) { + const helpOption = this._getHelpOption(); + const helpRequested = helpOption && args.find(arg => helpOption.is(arg)); + if (helpRequested) { + this.outputHelp(); + // (Do not have all displayed text available so only passing placeholder.) + this._exit(0, 'commander.helpDisplayed', '(outputHelp)'); + } } } @@ -45826,7 +45944,7 @@ function outputHelpIfRequested(cmd, args) { * * @param {string[]} args - array of arguments from node.execArgv * @returns {string[]} - * @api private + * @private */ function incrementNodeInspectorPort(args) { @@ -45954,13 +46072,8 @@ class Help { visibleCommands(cmd) { const visibleCommands = cmd.commands.filter(cmd => !cmd._hidden); - if (cmd._hasImplicitHelpCommand()) { - // Create a command matching the implicit help command. - const [, helpName, helpArgs] = cmd._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/); - const helpCommand = cmd.createCommand(helpName) - .helpOption(false); - helpCommand.description(cmd._helpCommandDescription); - if (helpArgs) helpCommand.arguments(helpArgs); + const helpCommand = cmd._getHelpCommand(); + if (helpCommand && !helpCommand._hidden) { visibleCommands.push(helpCommand); } if (this.sortSubcommands) { @@ -45996,19 +46109,19 @@ class Help { visibleOptions(cmd) { const visibleOptions = cmd.options.filter((option) => !option.hidden); - // Implicit help - const showShortHelpFlag = cmd._hasHelpOption && cmd._helpShortFlag && !cmd._findOption(cmd._helpShortFlag); - const showLongHelpFlag = cmd._hasHelpOption && !cmd._findOption(cmd._helpLongFlag); - if (showShortHelpFlag || showLongHelpFlag) { - let helpOption; - if (!showShortHelpFlag) { - helpOption = cmd.createOption(cmd._helpLongFlag, cmd._helpDescription); - } else if (!showLongHelpFlag) { - helpOption = cmd.createOption(cmd._helpShortFlag, cmd._helpDescription); - } else { - helpOption = cmd.createOption(cmd._helpFlags, cmd._helpDescription); + // Built-in help option. + const helpOption = cmd._getHelpOption(); + if (helpOption && !helpOption.hidden) { + // Automatically hide conflicting flags. Bit dubious but a historical behaviour that is convenient for single-command programs. + const removeShort = helpOption.short && cmd._findOption(helpOption.short); + const removeLong = helpOption.long && cmd._findOption(helpOption.long); + if (!removeShort && !removeLong) { + visibleOptions.push(helpOption); // no changes needed + } else if (helpOption.long && !removeLong) { + visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description)); + } else if (helpOption.short && !removeShort) { + visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description)); } - visibleOptions.push(helpOption); } if (this.sortOptions) { visibleOptions.sort(this.compareOptions); @@ -46471,7 +46584,7 @@ class Option { * new Option('--rgb').conflicts('cmyk'); * new Option('--js').conflicts(['ts', 'jsx']); * - * @param {string | string[]} names + * @param {(string | string[])} names * @return {Option} */ @@ -46555,7 +46668,7 @@ class Option { } /** - * @api private + * @package internal use only */ _concatValue(value, previous) { @@ -46605,7 +46718,6 @@ class Option { * as a object attribute key. * * @return {string} - * @api private */ attributeName() { @@ -46617,7 +46729,7 @@ class Option { * * @param {string} arg * @return {boolean} - * @api private + * @package internal use only */ is(arg) { @@ -46630,7 +46742,7 @@ class Option { * Options are one of boolean, negated, required argument, or optional argument. * * @return {boolean} - * @api private + * @package internal use only */ isBoolean() { @@ -46690,7 +46802,7 @@ class DualOptions { * * @param {string} str * @return {string} - * @api private + * @private */ function camelcase(str) { @@ -46702,7 +46814,7 @@ function camelcase(str) { /** * Split the short and long flag out of something like '-m,--mixed ' * - * @api private + * @private */ function splitOptionFlags(flags) { @@ -46722,7 +46834,6 @@ function splitOptionFlags(flags) { } exports.Option = Option; -exports.splitOptionFlags = splitOptionFlags; exports.DualOptions = DualOptions; diff --git a/lib/precommit/index.js b/lib/precommit/index.js index d00e239..1c44141 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -43486,7 +43486,7 @@ module.exports = parseParams /***/ }), /***/ 4379: -/***/ ((module, exports, __nccwpck_require__) => { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { const { Argument } = __nccwpck_require__(9414); const { Command } = __nccwpck_require__(552); @@ -43494,13 +43494,11 @@ const { CommanderError, InvalidArgumentError } = __nccwpck_require__(2625); const { Help } = __nccwpck_require__(5153); const { Option } = __nccwpck_require__(6558); -/** - * Expose the root command. - */ +exports.program = new Command(); -exports = module.exports = new Command(); -exports.program = exports; // More explicit access to global command. -// createArgument, createCommand, and createOption are implicitly available as they are methods on program. +exports.createCommand = (name) => new Command(name); +exports.createOption = (flags, description) => new Option(flags, description); +exports.createArgument = (name, description) => new Argument(name, description); /** * Expose classes @@ -43573,7 +43571,7 @@ class Argument { } /** - * @api private + * @package internal use only */ _concatValue(value, previous) { @@ -43653,7 +43651,7 @@ class Argument { * * @param {Argument} arg * @return {string} - * @api private + * @private */ function humanReadableArgName(arg) { @@ -43682,7 +43680,7 @@ const process = __nccwpck_require__(7282); const { Argument, humanReadableArgName } = __nccwpck_require__(9414); const { CommanderError } = __nccwpck_require__(2625); const { Help } = __nccwpck_require__(5153); -const { Option, splitOptionFlags, DualOptions } = __nccwpck_require__(6558); +const { Option, DualOptions } = __nccwpck_require__(6558); const { suggestSimilar } = __nccwpck_require__(7592); class Command extends EventEmitter { @@ -43727,7 +43725,7 @@ class Command extends EventEmitter { this._enablePositionalOptions = false; this._passThroughOptions = false; this._lifeCycleHooks = {}; // a hash of arrays - /** @type {boolean | string} */ + /** @type {(boolean | string)} */ this._showHelpAfterError = false; this._showSuggestionAfterError = true; @@ -43741,15 +43739,11 @@ class Command extends EventEmitter { }; this._hidden = false; - this._hasHelpOption = true; - this._helpFlags = '-h, --help'; - this._helpDescription = 'display help for command'; - this._helpShortFlag = '-h'; - this._helpLongFlag = '--help'; - this._addImplicitHelpCommand = undefined; // Deliberately undefined, not decided whether true or false - this._helpCommandName = 'help'; - this._helpCommandnameAndArgs = 'help [command]'; - this._helpCommandDescription = 'display help for command'; + /** @type {(Option | null | undefined)} */ + this._helpOption = undefined; // Lazy created on demand. May be null if help option is disabled. + this._addImplicitHelpCommand = undefined; // undecided whether true or false yet, not inherited + /** @type {Command} */ + this._helpCommand = undefined; // lazy initialised, inherited this._helpConfiguration = {}; } @@ -43763,14 +43757,8 @@ class Command extends EventEmitter { */ copyInheritedSettings(sourceCommand) { this._outputConfiguration = sourceCommand._outputConfiguration; - this._hasHelpOption = sourceCommand._hasHelpOption; - this._helpFlags = sourceCommand._helpFlags; - this._helpDescription = sourceCommand._helpDescription; - this._helpShortFlag = sourceCommand._helpShortFlag; - this._helpLongFlag = sourceCommand._helpLongFlag; - this._helpCommandName = sourceCommand._helpCommandName; - this._helpCommandnameAndArgs = sourceCommand._helpCommandnameAndArgs; - this._helpCommandDescription = sourceCommand._helpCommandDescription; + this._helpOption = sourceCommand._helpOption; + this._helpCommand = sourceCommand._helpCommand; this._helpConfiguration = sourceCommand._helpConfiguration; this._exitCallback = sourceCommand._exitCallback; this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties; @@ -43785,7 +43773,7 @@ class Command extends EventEmitter { /** * @returns {Command[]} - * @api private + * @private */ _getCommandAndAncestors() { @@ -43816,7 +43804,7 @@ class Command extends EventEmitter { * .command('stop [service]', 'stop named service, or all if no name supplied'); * * @param {string} nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` - * @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) + * @param {(Object|string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) * @param {Object} [execOpts] - configuration options (for executable) * @return {Command} returns new command for action handler, or `this` for executable command */ @@ -43840,7 +43828,7 @@ class Command extends EventEmitter { cmd._hidden = !!(opts.noHelp || opts.hidden); // noHelp is deprecated old name for hidden cmd._executableFile = opts.executableFile || null; // Custom name for executable file, set missing to null to match constructor if (args) cmd.arguments(args); - this.commands.push(cmd); + this._registerCommand(cmd); cmd.parent = this; cmd.copyInheritedSettings(this); @@ -43878,7 +43866,7 @@ class Command extends EventEmitter { * or with a subclass of Help by overriding createHelp(). * * @param {Object} [configuration] - configuration options - * @return {Command|Object} `this` command for chaining, or stored configuration + * @return {(Command|Object)} `this` command for chaining, or stored configuration */ configureHelp(configuration) { @@ -43904,7 +43892,7 @@ class Command extends EventEmitter { * outputError(str, write) // used for displaying errors, and not used for displaying help * * @param {Object} [configuration] - configuration options - * @return {Command|Object} `this` command for chaining, or stored configuration + * @return {(Command|Object)} `this` command for chaining, or stored configuration */ configureOutput(configuration) { @@ -43917,7 +43905,7 @@ class Command extends EventEmitter { /** * Display the help or a custom message after an error occurs. * - * @param {boolean|string} [displayHelp] + * @param {(boolean|string)} [displayHelp] * @return {Command} `this` command for chaining */ showHelpAfterError(displayHelp = true) { @@ -43957,8 +43945,10 @@ class Command extends EventEmitter { if (opts.isDefault) this._defaultCommandName = cmd._name; if (opts.noHelp || opts.hidden) cmd._hidden = true; // modifying passed command due to existing implementation - this.commands.push(cmd); + this._registerCommand(cmd); cmd.parent = this; + cmd._checkForBrokenPassThrough(); + return this; } @@ -43989,7 +43979,7 @@ class Command extends EventEmitter { * * @param {string} name * @param {string} [description] - * @param {Function|*} [fn] - custom argument processing function + * @param {(Function|*)} [fn] - custom argument processing function * @param {*} [defaultValue] * @return {Command} `this` command for chaining */ @@ -44042,39 +44032,76 @@ class Command extends EventEmitter { } /** - * Override default decision whether to add implicit help command. + * Customise or override default help command. By default a help command is automatically added if your command has subcommands. * - * addHelpCommand() // force on - * addHelpCommand(false); // force off - * addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details + * program.helpCommand('help [cmd]'); + * program.helpCommand('help [cmd]', 'show help'); + * program.helpCommand(false); // suppress default help command + * program.helpCommand(true); // add help command even if no subcommands * + * @param {string|boolean} enableOrNameAndArgs - enable with custom name and/or arguments, or boolean to override whether added + * @param {string} [description] - custom description * @return {Command} `this` command for chaining */ - addHelpCommand(enableOrNameAndArgs, description) { - if (enableOrNameAndArgs === false) { - this._addImplicitHelpCommand = false; - } else { - this._addImplicitHelpCommand = true; - if (typeof enableOrNameAndArgs === 'string') { - this._helpCommandName = enableOrNameAndArgs.split(' ')[0]; - this._helpCommandnameAndArgs = enableOrNameAndArgs; - } - this._helpCommandDescription = description || this._helpCommandDescription; + helpCommand(enableOrNameAndArgs, description) { + if (typeof enableOrNameAndArgs === 'boolean') { + this._addImplicitHelpCommand = enableOrNameAndArgs; + return this; } + + enableOrNameAndArgs = enableOrNameAndArgs ?? 'help [command]'; + const [, helpName, helpArgs] = enableOrNameAndArgs.match(/([^ ]+) *(.*)/); + const helpDescription = description ?? 'display help for command'; + + const helpCommand = this.createCommand(helpName); + helpCommand.helpOption(false); + if (helpArgs) helpCommand.arguments(helpArgs); + if (helpDescription) helpCommand.description(helpDescription); + + this._addImplicitHelpCommand = true; + this._helpCommand = helpCommand; + return this; } /** - * @return {boolean} - * @api private + * Add prepared custom help command. + * + * @param {(Command|string|boolean)} helpCommand - custom help command, or deprecated enableOrNameAndArgs as for `.helpCommand()` + * @param {string} [deprecatedDescription] - deprecated custom description used with custom name only + * @return {Command} `this` command for chaining */ + addHelpCommand(helpCommand, deprecatedDescription) { + // If not passed an object, call through to helpCommand for backwards compatibility, + // as addHelpCommand was originally used like helpCommand is now. + if (typeof helpCommand !== 'object') { + this.helpCommand(helpCommand, deprecatedDescription); + return this; + } - _hasImplicitHelpCommand() { - if (this._addImplicitHelpCommand === undefined) { - return this.commands.length && !this._actionHandler && !this._findCommand('help'); + this._addImplicitHelpCommand = true; + this._helpCommand = helpCommand; + return this; + } + + /** + * Lazy create help command. + * + * @return {(Command|null)} + * @package + */ + _getHelpCommand() { + const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? + (this.commands.length && !this._actionHandler && !this._findCommand('help')); + + if (hasImplicitHelpCommand) { + if (this._helpCommand === undefined) { + this.helpCommand(undefined, undefined); // use default name and description + } + return this._helpCommand; } - return this._addImplicitHelpCommand; + return null; } /** @@ -44128,7 +44155,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * @param {string} code an id string representing the error * @param {string} message human-readable description of the error * @return never - * @api private + * @private */ _exit(exitCode, code, message) { @@ -44190,11 +44217,11 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Wrap parseArgs to catch 'commander.invalidArgument'. * - * @param {Option | Argument} target + * @param {(Option | Argument)} target * @param {string} value * @param {*} previous * @param {string} invalidArgumentMessage - * @api private + * @private */ _callParseArg(target, value, previous, invalidArgumentMessage) { @@ -44209,6 +44236,49 @@ Expecting one of '${allowedValues.join("', '")}'`); } } + /** + * Check for option flag conflicts. + * Register option if no conflicts found, or throw on conflict. + * + * @param {Option} option + * @api private + */ + + _registerOption(option) { + const matchingOption = (option.short && this._findOption(option.short)) || + (option.long && this._findOption(option.long)); + if (matchingOption) { + const matchingFlag = (option.long && this._findOption(option.long)) ? option.long : option.short; + throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}' +- already used by option '${matchingOption.flags}'`); + } + + this.options.push(option); + } + + /** + * Check for command name and alias conflicts with existing commands. + * Register command if no conflicts found, or throw on conflict. + * + * @param {Command} command + * @api private + */ + + _registerCommand(command) { + const knownBy = (cmd) => { + return [cmd.name()].concat(cmd.aliases()); + }; + + const alreadyUsed = knownBy(command).find((name) => this._findCommand(name)); + if (alreadyUsed) { + const existingCmd = knownBy(this._findCommand(alreadyUsed)).join('|'); + const newCmd = knownBy(command).join('|'); + throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`); + } + + this.commands.push(command); + } + /** * Add an option. * @@ -44216,6 +44286,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * @return {Command} `this` command for chaining */ addOption(option) { + this._registerOption(option); + const oname = option.name(); const name = option.attributeName(); @@ -44230,9 +44302,6 @@ Expecting one of '${allowedValues.join("', '")}'`); this.setOptionValueWithSource(name, option.defaultValue, 'default'); } - // register the option - this.options.push(option); - // handler for cli and env supplied values const handleOptionValue = (val, invalidValueMessage, valueSource) => { // val is null for optional option used without an optional-argument. @@ -44280,7 +44349,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Internal implementation shared by .option() and .requiredOption() * - * @api private + * @private */ _optionEx(config, flags, description, fn, defaultValue) { if (typeof flags === 'object' && flags instanceof Option) { @@ -44322,7 +44391,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} flags * @param {string} [description] - * @param {Function|*} [parseArg] - custom option processing function or default value + * @param {(Function|*)} [parseArg] - custom option processing function or default value * @param {*} [defaultValue] * @return {Command} `this` command for chaining */ @@ -44339,7 +44408,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} flags * @param {string} [description] - * @param {Function|*} [parseArg] - custom option processing function or default value + * @param {(Function|*)} [parseArg] - custom option processing function or default value * @param {*} [defaultValue] * @return {Command} `this` command for chaining */ @@ -44356,7 +44425,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b` * - * @param {Boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag. + * @param {boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag. */ combineFlagAndOptionalValue(combine = true) { this._combineFlagAndOptionalValue = !!combine; @@ -44366,7 +44435,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow unknown options on the command line. * - * @param {Boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown + * @param {boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown * for unknown options. */ allowUnknownOption(allowUnknown = true) { @@ -44377,7 +44446,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow excess command-arguments on the command line. Pass false to make excess arguments an error. * - * @param {Boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown + * @param {boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown * for excess arguments. */ allowExcessArguments(allowExcess = true) { @@ -44390,7 +44459,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions. * The default behaviour is non-positional and global options may appear anywhere on the command line. * - * @param {Boolean} [positional=true] + * @param {boolean} [positional=true] */ enablePositionalOptions(positional = true) { this._enablePositionalOptions = !!positional; @@ -44403,17 +44472,25 @@ Expecting one of '${allowedValues.join("', '")}'`); * positional options to have been enabled on the program (parent commands). * The default behaviour is non-positional and options may appear before or after command-arguments. * - * @param {Boolean} [passThrough=true] + * @param {boolean} [passThrough=true] * for unknown options. */ passThroughOptions(passThrough = true) { this._passThroughOptions = !!passThrough; - if (!!this.parent && passThrough && !this.parent._enablePositionalOptions) { - throw new Error('passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)'); - } + this._checkForBrokenPassThrough(); return this; } + /** + * @private + */ + + _checkForBrokenPassThrough() { + if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) { + throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`); + } + } + /** * Whether to store option values as properties on command object, * or store separately (specify false). In both cases the option values can be accessed using .opts(). @@ -44426,9 +44503,9 @@ Expecting one of '${allowedValues.join("', '")}'`); if (this.options.length) { throw new Error('call .storeOptionsAsProperties() before adding options'); } - // if (Object.keys(this._optionValues).length) { - // throw new Error('call .storeOptionsAsProperties() before setting option values'); - // } + if (Object.keys(this._optionValues).length) { + throw new Error('call .storeOptionsAsProperties() before setting option values'); + } this._storeOptionsAsProperties = !!storeAsProperties; return this; } @@ -44513,7 +44590,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Get user arguments from implied or explicit arguments. * Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches. * - * @api private + * @private */ _prepareUserArgs(argv, parseOptions) { @@ -44616,7 +44693,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Execute a sub-command executable. * - * @api private + * @private */ _executeSubCommand(subcommand, args) { @@ -44703,15 +44780,15 @@ Expecting one of '${allowedValues.join("', '")}'`); } // By default terminate process when spawned process terminates. - // Suppressing the exit if exitCallback defined is a bit messy and of limited use, but does allow process to stay running! const exitCallback = this._exitCallback; - if (!exitCallback) { - proc.on('close', process.exit.bind(process)); - } else { - proc.on('close', () => { - exitCallback(new CommanderError(process.exitCode || 0, 'commander.executeSubCommandAsync', '(close)')); - }); - } + proc.on('close', (code, _signal) => { + code = code ?? 1; // code is null if spawned process terminated due to a signal + if (!exitCallback) { + process.exit(code); + } else { + exitCallback(new CommanderError(code, 'commander.executeSubCommandAsync', '(close)')); + } + }); proc.on('error', (err) => { // @ts-ignore if (err.code === 'ENOENT') { @@ -44741,7 +44818,7 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * @api private + * @private */ _dispatchSubcommand(commandName, operands, unknown) { @@ -44764,7 +44841,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Invoke help directly if possible, or dispatch if necessary. * e.g. help foo * - * @api private + * @private */ _dispatchHelpCommand(subcommandName) { @@ -44778,14 +44855,14 @@ Expecting one of '${allowedValues.join("', '")}'`); // Fallback to parsing the help flag to invoke the help. return this._dispatchSubcommand(subcommandName, [], [ - this._helpLongFlag || this._helpShortFlag + this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help' ]); } /** * Check this.args against expected this.registeredArguments. * - * @api private + * @private */ _checkNumberOfArguments() { @@ -44807,7 +44884,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Process this.args using this.registeredArguments and save as this.processedArgs! * - * @api private + * @private */ _processArguments() { @@ -44852,10 +44929,10 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Once we have a promise we chain, but call synchronously until then. * - * @param {Promise|undefined} promise + * @param {(Promise|undefined)} promise * @param {Function} fn - * @return {Promise|undefined} - * @api private + * @return {(Promise|undefined)} + * @private */ _chainOrCall(promise, fn) { @@ -44870,10 +44947,10 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * - * @param {Promise|undefined} promise + * @param {(Promise|undefined)} promise * @param {string} event - * @return {Promise|undefined} - * @api private + * @return {(Promise|undefined)} + * @private */ _chainOrCallHooks(promise, event) { @@ -44901,11 +44978,11 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * - * @param {Promise|undefined} promise + * @param {(Promise|undefined)} promise * @param {Command} subCommand * @param {string} event - * @return {Promise|undefined} - * @api private + * @return {(Promise|undefined)} + * @private */ _chainOrCallSubCommandHook(promise, subCommand, event) { @@ -44924,7 +45001,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Process arguments in context of this command. * Returns action result, in case it is a promise. * - * @api private + * @private */ _parseCommand(operands, unknown) { @@ -44938,11 +45015,11 @@ Expecting one of '${allowedValues.join("', '")}'`); if (operands && this._findCommand(operands[0])) { return this._dispatchSubcommand(operands[0], operands.slice(1), unknown); } - if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) { + if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) { return this._dispatchHelpCommand(operands[1]); } if (this._defaultCommandName) { - outputHelpIfRequested(this, unknown); // Run the help for default command from parent rather than passing to default command + this._outputHelpIfRequested(unknown); // Run the help for default command from parent rather than passing to default command return this._dispatchSubcommand(this._defaultCommandName, operands, unknown); } if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) { @@ -44950,7 +45027,7 @@ Expecting one of '${allowedValues.join("', '")}'`); this.help({ error: true }); } - outputHelpIfRequested(this, parsed.unknown); + this._outputHelpIfRequested(parsed.unknown); this._checkForMissingMandatoryOptions(); this._checkForConflictingOptions(); @@ -45008,7 +45085,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Find matching command. * - * @api private + * @private */ _findCommand(name) { if (!name) return undefined; @@ -45020,7 +45097,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} arg * @return {Option} - * @api private + * @package internal use only */ _findOption(arg) { @@ -45031,7 +45108,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Display an error message if a mandatory option does not have a value. * Called after checking for help flags in leaf subcommand. * - * @api private + * @private */ _checkForMissingMandatoryOptions() { @@ -45048,7 +45125,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Display an error message if conflicting options are used together in this. * - * @api private + * @private */ _checkForConflictingLocalOptions() { const definedNonDefaultOptions = this.options.filter( @@ -45079,7 +45156,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Display an error message if conflicting options are used together. * Called after checking for help flags in leaf subcommand. * - * @api private + * @private */ _checkForConflictingOptions() { // Walk up hierarchy so can call in subcommand after checking for displaying help. @@ -45100,8 +45177,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * sub --unknown uuu op => [sub], [--unknown uuu op] * sub -- --unknown uuu op => [sub --unknown uuu op], [] * - * @param {String[]} argv - * @return {{operands: String[], unknown: String[]}} + * @param {string[]} argv + * @return {{operands: string[], unknown: string[]}} */ parseOptions(argv) { @@ -45195,7 +45272,7 @@ Expecting one of '${allowedValues.join("', '")}'`); operands.push(arg); if (args.length > 0) unknown.push(...args); break; - } else if (arg === this._helpCommandName && this._hasImplicitHelpCommand()) { + } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) { operands.push(arg); if (args.length > 0) operands.push(...args); break; @@ -45283,7 +45360,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Apply any option related environment variables, if option does * not have a value from cli or client code. * - * @api private + * @private */ _parseOptionsEnv() { this.options.forEach((option) => { @@ -45306,7 +45383,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Apply any implied option values, if option is undefined or default value. * - * @api private + * @private */ _parseOptionsImplied() { const dualHelper = new DualOptions(this.options); @@ -45330,7 +45407,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Argument `name` is missing. * * @param {string} name - * @api private + * @private */ missingArgument(name) { @@ -45342,7 +45419,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * `Option` is missing an argument. * * @param {Option} option - * @api private + * @private */ optionMissingArgument(option) { @@ -45354,7 +45431,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * `Option` does not have a value, and is a mandatory option. * * @param {Option} option - * @api private + * @private */ missingMandatoryOptionValue(option) { @@ -45367,7 +45444,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {Option} option * @param {Option} conflictingOption - * @api private + * @private */ _conflictingOption(option, conflictingOption) { // The calling code does not know whether a negated option is the source of the @@ -45404,7 +45481,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Unknown option `flag`. * * @param {string} flag - * @api private + * @private */ unknownOption(flag) { @@ -45433,7 +45510,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Excess arguments, more than expected. * * @param {string[]} receivedArgs - * @api private + * @private */ _excessArguments(receivedArgs) { @@ -45449,7 +45526,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Unknown command. * - * @api private + * @private */ unknownCommand() { @@ -45480,7 +45557,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * @param {string} [str] * @param {string} [flags] * @param {string} [description] - * @return {this | string | undefined} `this` command for chaining, or version string if no arguments + * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments */ version(str, flags, description) { @@ -45489,8 +45566,9 @@ Expecting one of '${allowedValues.join("', '")}'`); flags = flags || '-V, --version'; description = description || 'output the version number'; const versionOption = this.createOption(flags, description); - this._versionOptionName = versionOption.attributeName(); // [sic] not defined in constructor, partly legacy, partly only needed at root - this.options.push(versionOption); + this._versionOptionName = versionOption.attributeName(); + this._registerOption(versionOption); + this.on('option:' + versionOption.name(), () => { this._outputConfiguration.writeOut(`${str}\n`); this._exit(0, 'commander.version', str); @@ -45503,7 +45581,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} [str] * @param {Object} [argsDescription] - * @return {string|Command} + * @return {(string|Command)} */ description(str, argsDescription) { if (str === undefined && argsDescription === undefined) return this._description; @@ -45518,7 +45596,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Set the summary. Used when listed as subcommand of parent. * * @param {string} [str] - * @return {string|Command} + * @return {(string|Command)} */ summary(str) { if (str === undefined) return this._summary; @@ -45532,7 +45610,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help. * * @param {string} [alias] - * @return {string|Command} + * @return {(string|Command)} */ alias(alias) { @@ -45546,6 +45624,12 @@ Expecting one of '${allowedValues.join("', '")}'`); } if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); + const matchingCommand = this.parent?._findCommand(alias); + if (matchingCommand) { + // c.f. _registerCommand + const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join('|'); + throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`); + } command._aliases.push(alias); return this; @@ -45557,7 +45641,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Only the first alias is shown in the auto-generated help. * * @param {string[]} [aliases] - * @return {string[]|Command} + * @return {(string[]|Command)} */ aliases(aliases) { @@ -45572,7 +45656,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Set / get the command usage `str`. * * @param {string} [str] - * @return {String|Command} + * @return {(string|Command)} */ usage(str) { @@ -45583,7 +45667,7 @@ Expecting one of '${allowedValues.join("', '")}'`); return humanReadableArgName(arg); }); return [].concat( - (this.options.length || this._hasHelpOption ? '[options]' : []), + (this.options.length || (this._helpOption !== null) ? '[options]' : []), (this.commands.length ? '[command]' : []), (this.registeredArguments.length ? args : []) ).join(' '); @@ -45597,7 +45681,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Get or set the name of the command. * * @param {string} [str] - * @return {string|Command} + * @return {(string|Command)} */ name(str) { @@ -45634,7 +45718,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * program.executableDir('subcommands'); * * @param {string} [path] - * @return {string|null|Command} + * @return {(string|null|Command)} */ executableDir(path) { @@ -45659,7 +45743,7 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * @api private + * @private */ _getHelpContext(contextOptions) { @@ -45704,38 +45788,72 @@ Expecting one of '${allowedValues.join("', '")}'`); } context.write(helpInformation); - if (this._helpLongFlag) { - this.emit(this._helpLongFlag); // deprecated + if (this._getHelpOption()?.long) { + this.emit(this._getHelpOption().long); // deprecated } this.emit('afterHelp', context); this._getCommandAndAncestors().forEach(command => command.emit('afterAllHelp', context)); } /** - * You can pass in flags and a description to override the help - * flags and help description for your command. Pass in false to - * disable the built-in help option. + * You can pass in flags and a description to customise the built-in help option. + * Pass in false to disable the built-in help option. + * + * @example + * program.helpOption('-?, --help' 'show help'); // customise + * program.helpOption(false); // disable * - * @param {string | boolean} [flags] + * @param {(string | boolean)} flags * @param {string} [description] * @return {Command} `this` command for chaining */ helpOption(flags, description) { + // Support disabling built-in help option. if (typeof flags === 'boolean') { - this._hasHelpOption = flags; + if (flags) { + this._helpOption = this._helpOption ?? undefined; // preserve existing option + } else { + this._helpOption = null; // disable + } return this; } - this._helpFlags = flags || this._helpFlags; - this._helpDescription = description || this._helpDescription; - const helpFlags = splitOptionFlags(this._helpFlags); - this._helpShortFlag = helpFlags.shortFlag; - this._helpLongFlag = helpFlags.longFlag; + // Customise flags and description. + flags = flags ?? '-h, --help'; + description = description ?? 'display help for command'; + this._helpOption = this.createOption(flags, description); return this; } + /** + * Lazy create help option. + * Returns null if has been disabled with .helpOption(false). + * + * @returns {(Option | null)} the help option + * @package internal use only + */ + _getHelpOption() { + // Lazy create help option on demand. + if (this._helpOption === undefined) { + this.helpOption(undefined, undefined); + } + return this._helpOption; + } + + /** + * Supply your own option to use for the built-in help option. + * This is an alternative to using helpOption() to customise the flags and description etc. + * + * @param {Option} option + * @return {Command} `this` command for chaining + */ + addHelpOption(option) { + this._helpOption = option; + return this; + } + /** * Output help information and exit. * @@ -45761,7 +45879,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands. * * @param {string} position - before or after built-in help - * @param {string | Function} text - string to add, or a function returning a string + * @param {(string | Function)} text - string to add, or a function returning a string * @return {Command} `this` command for chaining */ addHelpText(position, text) { @@ -45785,22 +45903,22 @@ Expecting one of '${allowedValues.join("', '")}'`); }); return this; } -} -/** - * Output help information if help flags specified - * - * @param {Command} cmd - command to output help for - * @param {Array} args - array of options to search for help flags - * @api private - */ + /** + * Output help information if help flags specified + * + * @param {Array} args - array of options to search for help flags + * @private + */ -function outputHelpIfRequested(cmd, args) { - const helpOption = cmd._hasHelpOption && args.find(arg => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag); - if (helpOption) { - cmd.outputHelp(); - // (Do not have all displayed text available so only passing placeholder.) - cmd._exit(0, 'commander.helpDisplayed', '(outputHelp)'); + _outputHelpIfRequested(args) { + const helpOption = this._getHelpOption(); + const helpRequested = helpOption && args.find(arg => helpOption.is(arg)); + if (helpRequested) { + this.outputHelp(); + // (Do not have all displayed text available so only passing placeholder.) + this._exit(0, 'commander.helpDisplayed', '(outputHelp)'); + } } } @@ -45809,7 +45927,7 @@ function outputHelpIfRequested(cmd, args) { * * @param {string[]} args - array of arguments from node.execArgv * @returns {string[]} - * @api private + * @private */ function incrementNodeInspectorPort(args) { @@ -45937,13 +46055,8 @@ class Help { visibleCommands(cmd) { const visibleCommands = cmd.commands.filter(cmd => !cmd._hidden); - if (cmd._hasImplicitHelpCommand()) { - // Create a command matching the implicit help command. - const [, helpName, helpArgs] = cmd._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/); - const helpCommand = cmd.createCommand(helpName) - .helpOption(false); - helpCommand.description(cmd._helpCommandDescription); - if (helpArgs) helpCommand.arguments(helpArgs); + const helpCommand = cmd._getHelpCommand(); + if (helpCommand && !helpCommand._hidden) { visibleCommands.push(helpCommand); } if (this.sortSubcommands) { @@ -45979,19 +46092,19 @@ class Help { visibleOptions(cmd) { const visibleOptions = cmd.options.filter((option) => !option.hidden); - // Implicit help - const showShortHelpFlag = cmd._hasHelpOption && cmd._helpShortFlag && !cmd._findOption(cmd._helpShortFlag); - const showLongHelpFlag = cmd._hasHelpOption && !cmd._findOption(cmd._helpLongFlag); - if (showShortHelpFlag || showLongHelpFlag) { - let helpOption; - if (!showShortHelpFlag) { - helpOption = cmd.createOption(cmd._helpLongFlag, cmd._helpDescription); - } else if (!showLongHelpFlag) { - helpOption = cmd.createOption(cmd._helpShortFlag, cmd._helpDescription); - } else { - helpOption = cmd.createOption(cmd._helpFlags, cmd._helpDescription); + // Built-in help option. + const helpOption = cmd._getHelpOption(); + if (helpOption && !helpOption.hidden) { + // Automatically hide conflicting flags. Bit dubious but a historical behaviour that is convenient for single-command programs. + const removeShort = helpOption.short && cmd._findOption(helpOption.short); + const removeLong = helpOption.long && cmd._findOption(helpOption.long); + if (!removeShort && !removeLong) { + visibleOptions.push(helpOption); // no changes needed + } else if (helpOption.long && !removeLong) { + visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description)); + } else if (helpOption.short && !removeShort) { + visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description)); } - visibleOptions.push(helpOption); } if (this.sortOptions) { visibleOptions.sort(this.compareOptions); @@ -46454,7 +46567,7 @@ class Option { * new Option('--rgb').conflicts('cmyk'); * new Option('--js').conflicts(['ts', 'jsx']); * - * @param {string | string[]} names + * @param {(string | string[])} names * @return {Option} */ @@ -46538,7 +46651,7 @@ class Option { } /** - * @api private + * @package internal use only */ _concatValue(value, previous) { @@ -46588,7 +46701,6 @@ class Option { * as a object attribute key. * * @return {string} - * @api private */ attributeName() { @@ -46600,7 +46712,7 @@ class Option { * * @param {string} arg * @return {boolean} - * @api private + * @package internal use only */ is(arg) { @@ -46613,7 +46725,7 @@ class Option { * Options are one of boolean, negated, required argument, or optional argument. * * @return {boolean} - * @api private + * @package internal use only */ isBoolean() { @@ -46673,7 +46785,7 @@ class DualOptions { * * @param {string} str * @return {string} - * @api private + * @private */ function camelcase(str) { @@ -46685,7 +46797,7 @@ function camelcase(str) { /** * Split the short and long flag out of something like '-m,--mixed ' * - * @api private + * @private */ function splitOptionFlags(flags) { @@ -46705,7 +46817,6 @@ function splitOptionFlags(flags) { } exports.Option = Option; -exports.splitOptionFlags = splitOptionFlags; exports.DualOptions = DualOptions; diff --git a/package-lock.json b/package-lock.json index 9378b67..ead9268 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@actions/github": "^6", "@dev-build-deploy/commit-it": "^2", "@dev-build-deploy/diagnose-it": "^1", - "commander": "^11", + "commander": "^12", "simple-git": "^3" }, "bin": { @@ -2477,11 +2477,11 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/commander": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", - "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz", + "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==", "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/concat-map": { diff --git a/package.json b/package.json index beed04c..847538d 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@actions/github": "^6", "@dev-build-deploy/commit-it": "^2", "@dev-build-deploy/diagnose-it": "^1", - "commander": "^11", + "commander": "^12", "simple-git": "^3" }, "devDependencies": { From 38d4cb09a1bf468012516a3bfbfad325f3435915 Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Tue, 2 Apr 2024 08:50:29 +0200 Subject: [PATCH 14/22] feat: extend supported "nouns" as part of the scope The Conventional Commits specification refers to "nouns" as supported in the Scope, however, the original implementation was limited to single words in lower case. With this commit we extend the definition to: > A noun is defined as a single word which can be capitalized or > contain hyphens --- lib/action/index.js | 1637 ++++++++++++++++++++++++++++++---------- lib/cli/index.js | 1637 ++++++++++++++++++++++++++++++---------- lib/precommit/index.js | 1637 ++++++++++++++++++++++++++++++---------- package-lock.json | 1386 +++++++++++++++++----------------- test/validator.test.ts | 5 + 5 files changed, 4393 insertions(+), 1909 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index e1dee17..3dd1620 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -1843,7 +1843,7 @@ class HttpClient { if (this._keepAlive && useProxy) { agent = this._proxyAgent; } - if (this._keepAlive && !useProxy) { + if (!useProxy) { agent = this._agent; } // if agent is already assigned use that agent. @@ -1875,16 +1875,12 @@ class HttpClient { 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) { + // if tunneling agent isn't assigned create a new agent + if (!agent) { const options = { keepAlive: this._keepAlive, maxSockets }; agent = usingSsl ? new https.Agent(options) : new http.Agent(options); this._agent = agent; } - // if not using private agent and tunnel agent isn't setup then use global agent - if (!agent) { - agent = usingSsl ? https.globalAgent : http.globalAgent; - } if (usingSsl && this._ignoreSslError) { // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options @@ -2777,7 +2773,29 @@ exports.commitRules = void 0; const diagnose_it_1 = __nccwpck_require__(4657); const chalk_1 = __importDefault(__nccwpck_require__(8818)); const commit_1 = __nccwpck_require__(8065); +/** + * Checks whether the provided string is a noun. + * A noun is defined as a single word which can be capitalized or contain hyphens, therefore + * it will not support multi-word nouns (i.e. New York). + * + * @param str String to check + * @returns True if the string is a noun, false otherwise. + * + * @internal + */ function isNoun(str) { + return /^[A-Za-z][a-z]*(-[A-Za-z][a-z]*)*$/.test(str); +} +/** + * Validates whether the provided type valid. + * A valid type is defined as a single word, all lowercase, no spaces, and no special characters. + * + * @param str String to check + * @returns True if the string is a valid type, false otherwise. + * + * @internal + */ +function isValidType(str) { return !str.trim().includes(" ") && !/[^a-z]/i.test(str.trim()); } function highlightString(str, substring) { @@ -2829,9 +2847,10 @@ class CC01 { // Validated with EC-02 } else { - // Ensure that we have a noun - if (!isNoun(commit.type.value)) + // Ensure that we have a valid type (single word, no spaces, no special characters) + if (!isValidType(commit.type.value)) { errors.push(createDiagnosticsMessage(commit, this.description, "which consists of a noun", "type")); + } // Validate for spacing after the type if (commit.type.value.trim() !== commit.type.value) { if (commit.scope.value) { @@ -2992,7 +3011,7 @@ class EC02 { const expectedTypes = ["feat", "fix", ...Array.from(uniqueAddedTypes)]; this.description = `Commits ${uniqueAddedTypes.size > 0 ? "MUST" : "MAY"} be prefixed with a type, which consists of one of the configured values (${expectedTypes.join(", ")}).`; if (commit.type.value === undefined || - !isNoun(commit.type.value) || + !isValidType(commit.type.value) || expectedTypes.includes(commit.type.value.toLowerCase().trimEnd())) { return []; } @@ -4488,7 +4507,7 @@ var import_graphql = __nccwpck_require__(8467); var import_auth_token = __nccwpck_require__(334); // pkg/dist-src/version.js -var VERSION = "5.0.2"; +var VERSION = "5.1.0"; // pkg/dist-src/index.js var noop = () => { @@ -5197,7 +5216,7 @@ __export(dist_src_exports, { module.exports = __toCommonJS(dist_src_exports); // pkg/dist-src/version.js -var VERSION = "9.1.5"; +var VERSION = "9.2.1"; // pkg/dist-src/normalize-paginated-list-response.js function normalizePaginatedListResponse(response) { @@ -5358,6 +5377,8 @@ var paginatingEndpoints = [ "GET /orgs/{org}/members/{username}/codespaces", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", + "GET /orgs/{org}/organization-roles/{role_id}/teams", + "GET /orgs/{org}/organization-roles/{role_id}/users", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", @@ -5594,7 +5615,7 @@ __export(dist_src_exports, { module.exports = __toCommonJS(dist_src_exports); // pkg/dist-src/version.js -var VERSION = "10.2.0"; +var VERSION = "10.4.1"; // pkg/dist-src/generated/endpoints.js var Endpoints = { @@ -5721,6 +5742,9 @@ var Endpoints = { "GET /repos/{owner}/{repo}/actions/permissions/selected-actions" ], getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + getCustomOidcSubClaimForRepo: [ + "GET /repos/{owner}/{repo}/actions/oidc/customization/sub" + ], getEnvironmentPublicKey: [ "GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key" ], @@ -5873,6 +5897,9 @@ var Endpoints = { setCustomLabelsForSelfHostedRunnerForRepo: [ "PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels" ], + setCustomOidcSubClaimForRepo: [ + "PUT /repos/{owner}/{repo}/actions/oidc/customization/sub" + ], setGithubActionsDefaultWorkflowPermissionsOrganization: [ "PUT /orgs/{org}/actions/permissions/workflow" ], @@ -5942,6 +5969,7 @@ var Endpoints = { listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"], markNotificationsAsRead: ["PUT /notifications"], markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"], + markThreadAsDone: ["DELETE /notifications/threads/{thread_id}"], markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"], setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"], setThreadSubscription: [ @@ -6218,10 +6246,10 @@ var Endpoints = { updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"] }, copilot: { - addCopilotForBusinessSeatsForTeams: [ + addCopilotSeatsForTeams: [ "POST /orgs/{org}/copilot/billing/selected_teams" ], - addCopilotForBusinessSeatsForUsers: [ + addCopilotSeatsForUsers: [ "POST /orgs/{org}/copilot/billing/selected_users" ], cancelCopilotSeatAssignmentForTeams: [ @@ -6534,10 +6562,24 @@ var Endpoints = { } ] }, + oidc: { + getOidcCustomSubTemplateForOrg: [ + "GET /orgs/{org}/actions/oidc/customization/sub" + ], + updateOidcCustomSubTemplateForOrg: [ + "PUT /orgs/{org}/actions/oidc/customization/sub" + ] + }, orgs: { addSecurityManagerTeam: [ "PUT /orgs/{org}/security-managers/teams/{team_slug}" ], + assignTeamToOrgRole: [ + "PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}" + ], + assignUserToOrgRole: [ + "PUT /orgs/{org}/organization-roles/users/{username}/{role_id}" + ], blockUser: ["PUT /orgs/{org}/blocks/{username}"], cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"], checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"], @@ -6546,6 +6588,7 @@ var Endpoints = { convertMemberToOutsideCollaborator: [ "PUT /orgs/{org}/outside_collaborators/{username}" ], + createCustomOrganizationRole: ["POST /orgs/{org}/organization-roles"], createInvitation: ["POST /orgs/{org}/invitations"], createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"], createOrUpdateCustomPropertiesValuesForRepos: [ @@ -6556,6 +6599,9 @@ var Endpoints = { ], createWebhook: ["POST /orgs/{org}/hooks"], delete: ["DELETE /orgs/{org}"], + deleteCustomOrganizationRole: [ + "DELETE /orgs/{org}/organization-roles/{role_id}" + ], deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], enableOrDisableSecurityProductOnAllOrgRepos: [ "POST /orgs/{org}/{security_product}/{enablement}" @@ -6567,6 +6613,7 @@ var Endpoints = { ], getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], + getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"], getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"], getWebhookDelivery: [ @@ -6582,6 +6629,12 @@ var Endpoints = { listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], listMembers: ["GET /orgs/{org}/members"], listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"], + listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"], + listOrgRoleUsers: ["GET /orgs/{org}/organization-roles/{role_id}/users"], + listOrgRoles: ["GET /orgs/{org}/organization-roles"], + listOrganizationFineGrainedPermissions: [ + "GET /orgs/{org}/organization-fine-grained-permissions" + ], listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"], listPatGrantRepositories: [ "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories" @@ -6596,6 +6649,9 @@ var Endpoints = { listSecurityManagerTeams: ["GET /orgs/{org}/security-managers"], listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"], listWebhooks: ["GET /orgs/{org}/hooks"], + patchCustomOrganizationRole: [ + "PATCH /orgs/{org}/organization-roles/{role_id}" + ], pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"], redeliverWebhookDelivery: [ "POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts" @@ -6620,6 +6676,18 @@ var Endpoints = { reviewPatGrantRequestsInBulk: [ "POST /orgs/{org}/personal-access-token-requests" ], + revokeAllOrgRolesTeam: [ + "DELETE /orgs/{org}/organization-roles/teams/{team_slug}" + ], + revokeAllOrgRolesUser: [ + "DELETE /orgs/{org}/organization-roles/users/{username}" + ], + revokeOrgRoleTeam: [ + "DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}" + ], + revokeOrgRoleUser: [ + "DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}" + ], setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"], setPublicMembershipForAuthenticatedUser: [ "PUT /orgs/{org}/public_members/{username}" @@ -6910,6 +6978,9 @@ var Endpoints = { {}, { mapToData: "users" } ], + cancelPagesDeployment: [ + "POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel" + ], checkAutomatedSecurityFixes: [ "GET /repos/{owner}/{repo}/automated-security-fixes" ], @@ -6945,12 +7016,15 @@ var Endpoints = { createForAuthenticatedUser: ["POST /user/repos"], createFork: ["POST /repos/{owner}/{repo}/forks"], createInOrg: ["POST /orgs/{org}/repos"], + createOrUpdateCustomPropertiesValues: [ + "PATCH /repos/{owner}/{repo}/properties/values" + ], createOrUpdateEnvironment: [ "PUT /repos/{owner}/{repo}/environments/{environment_name}" ], createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"], createOrgRuleset: ["POST /orgs/{org}/rulesets"], - createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployment"], + createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployments"], createPagesSite: ["POST /repos/{owner}/{repo}/pages"], createRelease: ["POST /repos/{owner}/{repo}/releases"], createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"], @@ -7103,6 +7177,9 @@ var Endpoints = { getOrgRulesets: ["GET /orgs/{org}/rulesets"], getPages: ["GET /repos/{owner}/{repo}/pages"], getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"], + getPagesDeployment: [ + "GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}" + ], getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"], getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"], getPullRequestReviewProtection: [ @@ -7313,6 +7390,9 @@ var Endpoints = { ] }, securityAdvisories: { + createFork: [ + "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks" + ], createPrivateVulnerabilityReport: [ "POST /repos/{owner}/{repo}/security-advisories/reports" ], @@ -7804,7 +7884,7 @@ var import_endpoint = __nccwpck_require__(9440); var import_universal_user_agent = __nccwpck_require__(5030); // pkg/dist-src/version.js -var VERSION = "8.1.6"; +var VERSION = "8.2.0"; // pkg/dist-src/is-plain-object.js function isPlainObject(value) { @@ -7948,11 +8028,17 @@ async function getResponseData(response) { function toErrorMessage(data) { if (typeof data === "string") return data; + let suffix; + if ("documentation_url" in data) { + suffix = ` - ${data.documentation_url}`; + } else { + suffix = ""; + } if ("message" in data) { if (Array.isArray(data.errors)) { - return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}`; + return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}${suffix}`; } - return data.message; + return `${data.message}${suffix}`; } return `Unknown error: ${JSON.stringify(data)}`; } @@ -11007,6 +11093,8 @@ Diff.prototype = { /*istanbul ignore end*/ diff: function diff(oldString, newString) { /*istanbul ignore start*/ + var _options$timeout; + var /*istanbul ignore end*/ options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -11045,68 +11133,104 @@ Diff.prototype = { maxEditLength = Math.min(maxEditLength, options.maxEditLength); } + var maxExecutionTime = + /*istanbul ignore start*/ + (_options$timeout = + /*istanbul ignore end*/ + options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; + var abortAfterTimestamp = Date.now() + maxExecutionTime; var bestPath = [{ - newPos: -1, - components: [] + oldPos: -1, + lastComponent: undefined }]; // Seed editLength = 0, i.e. the content starts with the same values - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { + if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // Identity per the equality and tokenizer return done([{ value: this.join(newString), count: newString.length }]); - } // Main worker method. checks all permutations of a given edit length for acceptance. - + } // Once we hit the right edge of the edit graph on some diagonal k, we can + // definitely reach the end of the edit graph in no more than k edits, so + // there's no point in considering any moves to diagonal k+1 any more (from + // which we're guaranteed to need at least k+1 more edits). + // Similarly, once we've reached the bottom of the edit graph, there's no + // point considering moves to lower diagonals. + // We record this fact by setting minDiagonalToConsider and + // maxDiagonalToConsider to some finite value once we've hit the edge of + // the edit graph. + // This optimization is not faithful to the original algorithm presented in + // Myers's paper, which instead pointlessly extends D-paths off the end of + // the edit graph - see page 7 of Myers's paper which notes this point + // explicitly and illustrates it with a diagram. This has major performance + // implications for some common scenarios. For instance, to compute a diff + // where the new text simply appends d characters on the end of the + // original text of length n, the true Myers algorithm will take O(n+d^2) + // time while this optimization needs only O(n+d) time. + + + var minDiagonalToConsider = -Infinity, + maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { + for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { var basePath = /*istanbul ignore start*/ void 0 /*istanbul ignore end*/ ; + var removePath = bestPath[diagonalPath - 1], + addPath = bestPath[diagonalPath + 1]; - var addPath = bestPath[diagonalPath - 1], - removePath = bestPath[diagonalPath + 1], - _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - - if (addPath) { + if (removePath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } - var canAdd = addPath && addPath.newPos + 1 < newLen, - canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; + var canAdd = false; + + if (addPath) { + // what newPos will be after we do an insertion: + var addPathNewPos = addPath.oldPos - diagonalPath; + canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; + } + + var canRemove = removePath && removePath.oldPos + 1 < oldLen; if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; } // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin + // path whose position in the old string is the farthest from the origin // and does not pass the bounds of the diff graph + // TODO: Remove the `+ 1` here to make behavior match Myers algorithm + // and prefer to order removals before insertions. - if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { - basePath = clonePath(removePath); - self.pushComponent(basePath.components, undefined, true); + if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) { + basePath = self.addToPath(addPath, true, undefined, 0); } else { - basePath = addPath; // No need to clone, we've pulled it from the list - - basePath.newPos++; - self.pushComponent(basePath.components, true, undefined); + basePath = self.addToPath(removePath, undefined, true, 1); } - _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath); - if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { - return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); + if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // If we have hit the end of both strings, then we are done + return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); } else { - // Otherwise track this path as a potential candidate and continue. bestPath[diagonalPath] = basePath; + + if (basePath.oldPos + 1 >= oldLen) { + maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); + } + + if (newPos + 1 >= newLen) { + minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); + } } } @@ -11120,7 +11244,7 @@ Diff.prototype = { if (callback) { (function exec() { setTimeout(function () { - if (editLength > maxEditLength) { + if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { return callback(); } @@ -11130,7 +11254,7 @@ Diff.prototype = { }, 0); })(); } else { - while (editLength <= maxEditLength) { + while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { var ret = execEditLength(); if (ret) { @@ -11143,23 +11267,29 @@ Diff.prototype = { /*istanbul ignore start*/ /*istanbul ignore end*/ - pushComponent: function pushComponent(components, added, removed) { - var last = components[components.length - 1]; + addToPath: function addToPath(path, added, removed, oldPosInc) { + var last = path.lastComponent; if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length - 1] = { - count: last.count + 1, - added: added, - removed: removed + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: last.count + 1, + added: added, + removed: removed, + previousComponent: last.previousComponent + } }; } else { - components.push({ - count: 1, - added: added, - removed: removed - }); + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: 1, + added: added, + removed: removed, + previousComponent: last + } + }; } }, @@ -11169,8 +11299,8 @@ Diff.prototype = { extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, commonCount = 0; while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { @@ -11180,13 +11310,14 @@ Diff.prototype = { } if (commonCount) { - basePath.components.push({ - count: commonCount - }); + basePath.lastComponent = { + count: commonCount, + previousComponent: basePath.lastComponent + }; } - basePath.newPos = newPos; - return oldPos; + basePath.oldPos = oldPos; + return newPos; }, /*istanbul ignore start*/ @@ -11237,7 +11368,20 @@ Diff.prototype = { } }; -function buildValues(diff, components, newString, oldString, useLongestToken) { +function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { + // First we convert our linked list of components in reverse order to an + // array in the right order: + var components = []; + var nextComponent; + + while (lastComponent) { + components.push(lastComponent); + nextComponent = lastComponent.previousComponent; + delete lastComponent.previousComponent; + lastComponent = nextComponent; + } + + components.reverse(); var componentPos = 0, componentLen = components.length, newPos = 0, @@ -11280,23 +11424,16 @@ function buildValues(diff, components, newString, oldString, useLongestToken) { // This is only available for string mode. - var lastComponent = components[componentLen - 1]; + var finalComponent = components[componentLen - 1]; - if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { - components[componentLen - 2].value += lastComponent.value; + if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) { + components[componentLen - 2].value += finalComponent.value; components.pop(); } return components; } - -function clonePath(path) { - return { - newPos: path.newPos, - components: path.components.slice(0) - }; -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2siLCJzZWxmIiwiZG9uZSIsInZhbHVlIiwic2V0VGltZW91dCIsInVuZGVmaW5lZCIsImNhc3RJbnB1dCIsInJlbW92ZUVtcHR5IiwidG9rZW5pemUiLCJuZXdMZW4iLCJsZW5ndGgiLCJvbGRMZW4iLCJlZGl0TGVuZ3RoIiwibWF4RWRpdExlbmd0aCIsIk1hdGgiLCJtaW4iLCJiZXN0UGF0aCIsIm5ld1BvcyIsImNvbXBvbmVudHMiLCJvbGRQb3MiLCJleHRyYWN0Q29tbW9uIiwiam9pbiIsImNvdW50IiwiZXhlY0VkaXRMZW5ndGgiLCJkaWFnb25hbFBhdGgiLCJiYXNlUGF0aCIsImFkZFBhdGgiLCJyZW1vdmVQYXRoI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dO1xuICBpZiAoY29tcG9uZW50TGVuID4gMVxuICAgICAgJiYgdHlwZW9mIGxhc3RDb21wb25lbnQudmFsdWUgPT09ICdzdHJpbmcnXG4gICAgICAmJiAobGFzdENvbXBvbmVudC5hZGRlZCB8fCBsYXN0Q29tcG9uZW50LnJlbW92ZWQpXG4gICAgICAmJiBkaWZmLmVxdWFscygnJywgbGFzdENvbXBvbmVudC52YWx1ZSkpIHtcbiAgICBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDJdLnZhbHVlICs9IGxhc3RDb21wb25lbnQudmFsdWU7XG4gICAgY29tcG9uZW50cy5wb3AoKTtcbiAgfVxuXG4gIHJldHVybiBjb21wb25lbnRzO1xufVxuXG5mdW5jdGlvbiBjbG9uZVBhdGgocGF0aCkge1xuICByZXR1cm4geyBuZXdQb3M6IHBhdGgubmV3UG9zLCBjb21wb25lbnRzOiBwYXRoLmNvbXBvbmVudHMuc2xpY2UoMCkgfTtcbn1cbiJdfQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2siLCJzZWxmIiwiZG9uZSIsInZhbHVlIiwic2V0VGltZW91dCIsInVuZGVmaW5lZCIsImNhc3RJbnB1dCIsInJlbW92ZUVtcHR5IiwidG9rZW5pemUiLCJuZXdMZW4iLCJsZW5ndGgiLCJvbGRMZW4iLCJlZGl0TGVuZ3RoIiwibWF4RWRpdExlbmd0aCIsIk1hdGgiLCJtaW4iLCJtYXhFeGVjdXRpb25UaW1lIiwidGltZW91dCIsIkluZmluaXR5IiwiYWJvcnRBZnRlclRpbWVzdGFtcCIsIkRhdGUiLCJub3ciLCJiZXN0UGF0aCIsIm9sZFBvcyIsImxhc3RDb21wb25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gPSB0bXA7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgLy8gU3BlY2lhbCBjYXNlIGhhbmRsZSBmb3Igd2hlbiBvbmUgdGVybWluYWwgaXMgaWdub3JlZCAoaS5lLiB3aGl0ZXNwYWNlKS5cbiAgLy8gRm9yIHRoaXMgY2FzZSB3ZSBtZXJnZSB0aGUgdGVybWluYWwgaW50byB0aGUgcHJpb3Igc3RyaW5nIGFuZCBkcm9wIHRoZSBjaGFuZ2UuXG4gIC8vIFRoaXMgaXMgb25seSBhdmFpbGFibGUgZm9yIHN0cmluZyBtb2RlLlxuICBsZXQgZmluYWxDb21wb25lbnQgPSBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDFdO1xuICBpZiAoY29tcG9uZW50TGVuID4gMVxuICAgICAgJiYgdHlwZW9mIGZpbmFsQ29tcG9uZW50LnZhbHVlID09PSAnc3RyaW5nJ1xuICAgICAgJiYgKGZpbmFsQ29tcG9uZW50LmFkZGVkIHx8IGZpbmFsQ29tcG9uZW50LnJlbW92ZWQpXG4gICAgICAmJiBkaWZmLmVxdWFscygnJywgZmluYWxDb21wb25lbnQudmFsdWUpKSB7XG4gICAgY29tcG9uZW50c1tjb21wb25lbnRMZW4gLSAyXS52YWx1ZSArPSBmaW5hbENvbXBvbmVudC52YWx1ZTtcbiAgICBjb21wb25lbnRzLnBvcCgpO1xuICB9XG5cbiAgcmV0dXJuIGNvbXBvbmVudHM7XG59XG4iXX0= /***/ }), @@ -11611,6 +11748,11 @@ exports.lineDiff = lineDiff; /*istanbul ignore end*/ lineDiff.tokenize = function (value) { + if (this.options.stripTrailingCr) { + // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior + value = value.replace(/\r\n/g, '\n'); + } + var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line @@ -11658,7 +11800,7 @@ function diffTrimmedLines(oldStr, newStr, callback) { }); return lineDiff.diff(oldStr, newStr, options); } -//# sourceMappingURL=data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cblxuICByZXR1cm4gcmV0TGluZXM7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZkxpbmVzKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjaykgeyByZXR1cm4gbGluZURpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spOyB9XG5leHBvcnQgZnVuY3Rpb24gZGlmZlRyaW1tZWRMaW5lcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHtcbiAgbGV0IG9wdGlvbnMgPSBnZW5lcmF0ZU9wdGlvbnMoY2FsbGJhY2ssIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbiJdfQ== /***/ }), @@ -11928,6 +12070,12 @@ Object.defineProperty(exports, "merge", ({ return _merge.merge; } })); +Object.defineProperty(exports, "reversePatch", ({ + enumerable: true, + get: function get() { + return _reverse.reversePatch; + } +})); Object.defineProperty(exports, "structuredPatch", ({ enumerable: true, get: function get() { @@ -11946,6 +12094,12 @@ Object.defineProperty(exports, "createPatch", ({ return _create.createPatch; } })); +Object.defineProperty(exports, "formatPatch", ({ + enumerable: true, + get: function get() { + return _create.formatPatch; + } +})); Object.defineProperty(exports, "convertChangesToDMP", ({ enumerable: true, get: function get() { @@ -12026,6 +12180,12 @@ _merge = __nccwpck_require__(2640) /*istanbul ignore end*/ ; +var +/*istanbul ignore start*/ +_reverse = __nccwpck_require__(1794) +/*istanbul ignore end*/ +; + var /*istanbul ignore start*/ _create = __nccwpck_require__(4543) @@ -12047,7 +12207,7 @@ _xml = __nccwpck_require__(6982) /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } /*istanbul ignore end*/ -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcy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3J0IHtyZXZlcnNlUGF0Y2h9IGZyb20gJy4vcGF0Y2gvcmV2ZXJzZSc7XG5pbXBvcnQge3N0cnVjdHVyZWRQYXRjaCwgY3JlYXRlVHdvRmlsZXNQYXRjaCwgY3JlYXRlUGF0Y2gsIGZvcm1hdFBhdGNofSBmcm9tICcuL3BhdGNoL2NyZWF0ZSc7XG5cbmltcG9ydCB7Y29udmVydENoYW5nZXNUb0RNUH0gZnJvbSAnLi9jb252ZXJ0L2RtcCc7XG5pbXBvcnQge2NvbnZlcnRDaGFuZ2VzVG9YTUx9IGZyb20gJy4vY29udmVydC94bWwnO1xuXG5leHBvcnQge1xuICBEaWZmLFxuXG4gIGRpZmZDaGFycyxcbiAgZGlmZldvcmRzLFxuICBkaWZmV29yZHNXaXRoU3BhY2UsXG4gIGRpZmZMaW5lcyxcbiAgZGlmZlRyaW1tZWRMaW5lcyxcbiAgZGlmZlNlbnRlbmNlcyxcblxuICBkaWZmQ3NzLFxuICBkaWZmSnNvbixcblxuICBkaWZmQXJyYXlzLFxuXG4gIHN0cnVjdHVyZWRQYXRjaCxcbiAgY3JlYXRlVHdvRmlsZXNQYXRjaCxcbiAgY3JlYXRlUGF0Y2gsXG4gIGZvcm1hdFBhdGNoLFxuICBhcHBseVBhdGNoLFxuICBhcHBseVBhdGNoZXMsXG4gIHBhcnNlUGF0Y2gsXG4gIG1lcmdlLFxuICByZXZlcnNlUGF0Y2gsXG4gIGNvbnZlcnRDaGFuZ2VzVG9ETVAsXG4gIGNvbnZlcnRDaGFuZ2VzVG9YTUwsXG4gIGNhbm9uaWNhbGl6ZVxufTtcbiJdfQ== /***/ }), @@ -12206,7 +12366,7 @@ function applyPatch(source, uniDiff) { var line = _hunk.lines[j], operation = line.length > 0 ? line[0] : ' ', content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters[j]; + delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n'; if (operation === ' ') { _toPos++; @@ -12293,7 +12453,7 @@ function applyPatches(uniDiff, options) { processIndex(); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJwYXJzZVBhdGNoIiwiQXJyYXkiLCJpc0FycmF5IiwibGVuZ3RoIiwiRXJyb3IiLCJsaW5lcyIsInNwbGl0IiwiZGVsaW1pdGVycyIsIm1hdGNoIiwiaHVua3MiLCJjb21wYXJlTGluZSIsImxpbmVOdW1iZXIiLCJsaW5lIiwib3BlcmF0aW9uIiwicGF0Y2hDb250ZW50IiwiZXJyb3JDb3VudCIsImZ1enpGYWN0b3IiLCJtaW5MaW5lIiwib2Zmc2V0IiwicmVtb3ZlRU9GTkwiLCJhZGRFT0ZOTCIsImh1bmtGaXRzIiwiaHVuayIsInRvUG9zIiwiaiIsImNvbnRlbnQiLCJzdWJzdHIiLCJpIiwibWF4TGluZSIsIm9sZExpbmVzIiwibG9jYWxPZmZzZXQiLCJvbGRTdGFydCIsIml0ZXJhdG9yIiwiZGlzdGFuY2VJdGVyYXRvciIsInVuZGVmaW5lZCIsImRpZmZPZmZzZXQiLCJuZXdMaW5lcyIsImRlbGltaXRlciIsImxpbmVkZWxpbWl0ZXJzIiwic3BsaWNlIiwicHJldmlvdXNPcGVyYXRpb24iLCJwb3AiLCJwdXNoIiwiX2siLCJqb2luIiwiYXBwbHlQYXRjaGVzIiwiY3VycmVudEluZGV4IiwicHJvY2Vzc0luZGV4IiwiaW5kZXgiLCJjb21wbGV0ZSIsImxvYWRGaWxlIiwiZXJyIiwiZGF0YSIsInVwZGF0ZWRDb250ZW50IiwicGF0Y2hlZCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUF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yBqKyspIHtcbiAgICAgIGxldCBsaW5lID0gaHVuay5saW5lc1tqXSxcbiAgICAgICAgICBvcGVyYXRpb24gPSAobGluZS5sZW5ndGggPiAwID8gbGluZVswXSA6ICcgJyksXG4gICAgICAgICAgY29udGVudCA9IChsaW5lLmxlbmd0aCA+IDAgPyBsaW5lLnN1YnN0cigxKSA6IGxpbmUpO1xuXG4gICAgICBpZiAob3BlcmF0aW9uID09PSAnICcgfHwgb3BlcmF0aW9uID09PSAnLScpIHtcbiAgICAgICAgLy8gQ29udGV4dCBzYW5pdHkgY2hlY2tcbiAgICAgICAgaWYgKCFjb21wYXJlTGluZSh0b1BvcyArIDEsIGxpbmVzW3RvUG9zXSwgb3BlcmF0aW9uLCBjb250ZW50KSkge1xuICAgICAgICAgIGVycm9yQ291bnQrKztcblxuICAgICAgICAgIGlmIChlcnJvckNvdW50ID4gZnV6ekZhY3Rvcikge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0b1BvcysrO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB0cnVlO1xuICB9XG5cbiAgLy8gU2VhcmNoIGJlc3QgZml0IG9mZnNldHMgZm9yIGVhY2ggaHVuayBiYXNlZCBvbiB0aGUgcHJldmlvdXMgb25lc1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGh1bmtzLmxlbmd0aDsgaSsrKSB7XG4gICAgbGV0IGh1bmsgPSBodW5rc1tpXSxcbiAgICAgICAgbWF4TGluZSA9IGxpbmVzLmxlbmd0aCAtIGh1bmsub2xkTGluZXMsXG4gICAgICAgIGxvY2FsT2Zmc2V0ID0gMCxcbiAgICAgICAgdG9Qb3MgPSBvZmZzZXQgKyBodW5rLm9sZFN0YXJ0IC0gMTtcblxuICAgIGxldCBpdGVyYXRvciA9IGRpc3RhbmNlSXRlcmF0b3IodG9Qb3MsIG1pbkxpbmUsIG1heExpbmUpO1xuXG4gICAgZm9yICg7IG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gICAgICBvcHRpb25zLnBhdGNoZWQoaW5kZXgsIHVwZGF0ZWRDb250ZW50LCBmdW5jdGlvbihlcnIpIHtcbiAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKGVycik7XG4gICAgICAgIH1cblxuICAgICAgICBwcm9jZXNzSW5kZXgoKTtcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9XG4gIHByb2Nlc3NJbmRleCgpO1xufVxuIl19 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJwYXJzZVBhdGNoIiwiQXJyYXkiLCJpc0FycmF5IiwibGVuZ3RoIiwiRXJyb3IiLCJsaW5lcyIsInNwbGl0IiwiZGVsaW1pdGVycyIsIm1hdGNoIiwiaHVua3MiLCJjb21wYXJlTGluZSIsImxpbmVOdW1iZXIiLCJsaW5lIiwib3BlcmF0aW9uIiwicGF0Y2hDb250ZW50IiwiZXJyb3JDb3VudCIsImZ1enpGYWN0b3IiLCJtaW5MaW5lIiwib2Zmc2V0IiwicmVtb3ZlRU9GTkwiLCJhZGRFT0ZOTCIsImh1bmtGaXRzIiwiaHVuayIsInRvUG9zIiwiaiIsImNvbnRlbnQiLCJzdWJzdHIiLCJpIiwibWF4TGluZSIsIm9sZExpbmVzIiwibG9jYWxPZmZzZXQiLCJvbGRTdGFydCIsIml0ZXJhdG9yIiwiZGlzdGFuY2VJdGVyYXRvciIsInVuZGVmaW5lZCIsImRpZmZPZmZzZXQiLCJuZXdMaW5lcyIsImRlbGltaXRlciIsImxpbmVkZWxpbWl0ZXJzIiwic3BsaWNlIiwicHJldmlvdXNPcGVyYXRpb24iLCJwb3AiLCJwdXNoIiwiX2siLCJqb2luIiwiYXBwbHlQYXRj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ZW50SW5kZXgrK107XG4gICAgaWYgKCFpbmRleCkge1xuICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoKTtcbiAgICB9XG5cbiAgICBvcHRpb25zLmxvYWRGaWxlKGluZGV4LCBmdW5jdGlvbihlcnIsIGRhdGEpIHtcbiAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoZXJyKTtcbiAgICAgIH1cblxuICAgICAgbGV0IHVwZGF0ZWRDb250ZW50ID0gYXBwbHlQYXRjaChkYXRhLCBpbmRleCwgb3B0aW9ucyk7XG4gICAgICBvcHRpb25zLnBhdGNoZWQoaW5kZXgsIHVwZGF0ZWRDb250ZW50LCBmdW5jdGlvbihlcnIpIHtcbiAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKGVycik7XG4gICAgICAgIH1cblxuICAgICAgICBwcm9jZXNzSW5kZXgoKTtcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9XG4gIHByb2Nlc3NJbmRleCgpO1xufVxuIl19 /***/ }), @@ -12536,6 +12696,10 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne } function formatPatch(diff) { + if (Array.isArray(diff)) { + return diff.map(formatPatch).join('\n'); + } + var ret = []; if (diff.oldFileName == diff.newFileName) { @@ -12573,7 +12737,7 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9jcmVhdGUuanMiXSwibmFtZXMiOlsic3RydWN0dXJlZFBhdGNoIiwib2xkRmlsZU5hbWUiLCJuZXdGaWxlTmFtZSIsIm9sZFN0ciIsIm5ld1N0ci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odW5rLm5ld0xpbmVzXG4gICAgICArICcgQEAnXG4gICAgKTtcbiAgICByZXQucHVzaC5hcHBseShyZXQsIGh1bmsubGluZXMpO1xuICB9XG5cbiAgcmV0dXJuIHJldC5qb2luKCdcXG4nKSArICdcXG4nO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlVHdvRmlsZXNQYXRjaChvbGRGaWxlTmFtZSwgbmV3RmlsZU5hbWUsIG9sZFN0ciwgbmV3U3RyLCBvbGRIZWFkZXIsIG5ld0hlYWRlciwgb3B0aW9ucykge1xuICByZXR1cm4gZm9ybWF0UGF0Y2goc3RydWN0dXJlZFBhdGNoKG9sZEZpbGVOYW1lLCBuZXdGaWxlTmFtZSwgb2xkU3RyLCBuZXdTdHIsIG9sZEhlYWRlciwgbmV3SGVhZGVyLCBvcHRpb25zKSk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBjcmVhdGVQYXRjaChmaWxlTmFtZSwgb2xkU3RyLCBuZXdTdHIsIG9sZEhlYWRlciwgbmV3SGVhZGVyLCBvcHRpb25zKSB7XG4gIHJldHVybiBjcmVhdGVUd29GaWxlc1BhdGNoKGZpbGVOYW1lLCBmaWxlTmFtZSwgb2xkU3RyLCBuZXdTdHIsIG9sZEhlYWRlciwgbmV3SGVhZGVyLCBvcHRpb25zKTtcbn1cbiJdfQ== /***/ }), @@ -13372,6 +13536,77 @@ function parsePatch(uniDiff) { //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9wYXJzZS5qcyJdLCJuYW1lcyI6WyJwYXJzZVBhdGNoIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJkaWZmc3RyIiwic3BsaXQiLCJkZWxpbWl0ZXJzIiwibWF0Y2giLCJsaXN0IiwiaSIsInBhcnNlSW5kZXgiLCJpbmRleCIsInB1c2giLCJsZW5ndGgiLCJsaW5lIiwidGVzdCIsImhlYWRlciIsImV4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ICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBIYW5kbGUgdGhlIGVtcHR5IGJsb2NrIGNvdW50IGNhc2VcbiAgICBpZiAoIWFkZENvdW50ICYmIGh1bmsubmV3TGluZXMgPT09IDEpIHtcbiAgICAgIGh1bmsubmV3TGluZXMgPSAwO1xuICAgIH1cbiAgICBpZiAoIXJlbW92ZUNvdW50ICYmIGh1bmsub2xkTGluZXMgPT09IDEpIHtcbiAgICAgIGh1bmsub2xkTGluZXMgPSAwO1xuICAgIH1cblxuICAgIC8vIFBlcmZvcm0gb3B0aW9uYWwgc2FuaXR5IGNoZWNraW5nXG4gICAgaWYgKG9wdGlvbnMuc3RyaWN0KSB7XG4gICAgICBpZiAoYWRkQ291bnQgIT09IGh1bmsubmV3TGluZXMpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdBZGRlZCBsaW5lIGNvdW50IGRpZCBub3QgbWF0Y2ggZm9yIGh1bmsgYXQgbGluZSAnICsgKGNodW5rSGVhZGVySW5kZXggKyAxKSk7XG4gICAgICB9XG4gICAgICBpZiAocmVtb3ZlQ291bnQgIT09IGh1bmsub2xkTGluZXMpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdSZW1vdmVkIGxpbmUgY291bnQgZGlkIG5vdCBtYXRjaCBmb3IgaHVuayBhdCBsaW5lICcgKyAoY2h1bmtIZWFkZXJJbmRleCArIDEpKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gaHVuaztcbiAgfVxuXG4gIHdoaWxlIChpIDwgZGlmZnN0ci5sZW5ndGgpIHtcbiAgICBwYXJzZUluZGV4KCk7XG4gIH1cblxuICByZXR1cm4gbGlzdDtcbn1cbiJdfQ== +/***/ }), + +/***/ 1794: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +/*istanbul ignore start*/ + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.reversePatch = reversePatch; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/*istanbul ignore end*/ +function reversePatch(structuredPatch) { + if (Array.isArray(structuredPatch)) { + return structuredPatch.map(reversePatch).reverse(); + } + + return ( + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + structuredPatch), {}, { + oldFileName: structuredPatch.newFileName, + oldHeader: structuredPatch.newHeader, + newFileName: structuredPatch.oldFileName, + newHeader: structuredPatch.oldHeader, + hunks: structuredPatch.hunks.map(function (hunk) { + return { + oldLines: hunk.newLines, + oldStart: hunk.newStart, + newLines: hunk.oldLines, + newStart: hunk.oldStart, + linedelimiters: hunk.linedelimiters, + lines: hunk.lines.map(function (l) { + if (l.startsWith('-')) { + return ( + /*istanbul ignore start*/ + "+".concat( + /*istanbul ignore end*/ + l.slice(1)) + ); + } + + if (l.startsWith('+')) { + return ( + /*istanbul ignore start*/ + "-".concat( + /*istanbul ignore end*/ + l.slice(1)) + ); + } + + return l; + }) + }; + }) + }) + ); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbI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xcbiAgICBvbGRIZWFkZXI6IHN0cnVjdHVyZWRQYXRjaC5uZXdIZWFkZXIsXG4gICAgbmV3RmlsZU5hbWU6IHN0cnVjdHVyZWRQYXRjaC5vbGRGaWxlTmFtZSxcbiAgICBuZXdIZWFkZXI6IHN0cnVjdHVyZWRQYXRjaC5vbGRIZWFkZXIsXG4gICAgaHVua3M6IHN0cnVjdHVyZWRQYXRjaC5odW5rcy5tYXAoaHVuayA9PiB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICBvbGRMaW5lczogaHVuay5uZXdMaW5lcyxcbiAgICAgICAgb2xkU3RhcnQ6IGh1bmsubmV3U3RhcnQsXG4gICAgICAgIG5ld0xpbmVzOiBodW5rLm9sZExpbmVzLFxuICAgICAgICBuZXdTdGFydDogaHVuay5vbGRTdGFydCxcbiAgICAgICAgbGluZWRlbGltaXRlcnM6IGh1bmsubGluZWRlbGltaXRlcnMsXG4gICAgICAgIGxpbmVzOiBodW5rLmxpbmVzLm1hcChsID0+IHtcbiAgICAgICAgICBpZiAobC5zdGFydHNXaXRoKCctJykpIHsgcmV0dXJuIGArJHtsLnNsaWNlKDEpfWA7IH1cbiAgICAgICAgICBpZiAobC5zdGFydHNXaXRoKCcrJykpIHsgcmV0dXJuIGAtJHtsLnNsaWNlKDEpfWA7IH1cbiAgICAgICAgICByZXR1cm4gbDtcbiAgICAgICAgfSlcbiAgICAgIH07XG4gICAgfSlcbiAgfTtcbn1cbiJdfQ== + + /***/ }), /***/ 8935: @@ -13748,6 +13983,8 @@ function onceStrict (fn) { /***/ 9103: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + var __create = Object.create; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; @@ -13771,7 +14008,6 @@ var __spreadValues = (a, b) => { return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; @@ -13782,22 +14018,19 @@ var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; -var __reExport = (target, module2, copyDefault, desc) => { - if (module2 && typeof module2 === "object" || typeof module2 === "function") { - for (let key of __getOwnPropNames(module2)) - if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) - __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } - return target; -}; -var __toESM = (module2, isNodeMode) => { - return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); + return to; }; -var __toCommonJS = /* @__PURE__ */ ((cache2) => { - return (module2, temp) => { - return cache2 && cache2.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache2 && cache2.set(module2, temp), temp); - }; -})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { @@ -13823,6 +14056,7 @@ var __async = (__this, __arguments, generator) => { var GitError; var init_git_error = __esm({ "src/lib/errors/git-error.ts"() { + "use strict"; GitError = class extends Error { constructor(task, message) { super(message); @@ -13837,6 +14071,7 @@ var init_git_error = __esm({ var GitResponseError; var init_git_response_error = __esm({ "src/lib/errors/git-response-error.ts"() { + "use strict"; init_git_error(); GitResponseError = class extends GitError { constructor(git, message) { @@ -13862,6 +14097,7 @@ function toPaths(pathSpec) { var cache; var init_pathspec = __esm({ "src/lib/args/pathspec.ts"() { + "use strict"; cache = /* @__PURE__ */ new WeakMap(); } }); @@ -13870,6 +14106,7 @@ var init_pathspec = __esm({ var GitConstructError; var init_git_construct_error = __esm({ "src/lib/errors/git-construct-error.ts"() { + "use strict"; init_git_error(); GitConstructError = class extends GitError { constructor(config, message) { @@ -13884,6 +14121,7 @@ var init_git_construct_error = __esm({ var GitPluginError; var init_git_plugin_error = __esm({ "src/lib/errors/git-plugin-error.ts"() { + "use strict"; init_git_error(); GitPluginError = class extends GitError { constructor(task, plugin, message) { @@ -13900,6 +14138,7 @@ var init_git_plugin_error = __esm({ var TaskConfigurationError; var init_task_configuration_error = __esm({ "src/lib/errors/task-configuration-error.ts"() { + "use strict"; init_git_error(); TaskConfigurationError = class extends GitError { constructor(message) { @@ -14000,7 +14239,10 @@ function bufferToString(input) { return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8"); } function pick(source, properties) { - return Object.assign({}, ...properties.map((property) => property in source ? { [property]: source[property] } : {})); + return Object.assign( + {}, + ...properties.map((property) => property in source ? { [property]: source[property] } : {}) + ); } function delay(duration = 0) { return new Promise((done) => setTimeout(done, duration)); @@ -14014,6 +14256,7 @@ function orVoid(input) { var import_file_exists, NULL, NOOP, objectToString; var init_util = __esm({ "src/lib/utils/util.ts"() { + "use strict"; import_file_exists = __nccwpck_require__(4751); NULL = "\0"; NOOP = () => { @@ -14042,6 +14285,7 @@ function filterFunction(input) { var filterArray, filterString, filterStringArray, filterStringOrStringArray, filterHasLength; var init_argument_filters = __esm({ "src/lib/utils/argument-filters.ts"() { + "use strict"; init_util(); init_pathspec(); filterArray = (input) => { @@ -14069,6 +14313,7 @@ var init_argument_filters = __esm({ var ExitCodes; var init_exit_codes = __esm({ "src/lib/utils/exit-codes.ts"() { + "use strict"; ExitCodes = /* @__PURE__ */ ((ExitCodes2) => { ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS"; ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR"; @@ -14083,6 +14328,7 @@ var init_exit_codes = __esm({ var GitOutputStreams; var init_git_output_streams = __esm({ "src/lib/utils/git-output-streams.ts"() { + "use strict"; GitOutputStreams = class { constructor(stdOut, stdErr) { this.stdOut = stdOut; @@ -14099,6 +14345,7 @@ var init_git_output_streams = __esm({ var LineParser, RemoteLineParser; var init_line_parser = __esm({ "src/lib/utils/line-parser.ts"() { + "use strict"; LineParser = class { constructor(regExp, useMatches) { this.matches = []; @@ -14150,7 +14397,10 @@ var init_line_parser = __esm({ // src/lib/utils/simple-git-options.ts function createInstanceConfig(...options) { const baseDir = process.cwd(); - const config = Object.assign(__spreadValues({ baseDir }, defaultOptions), ...options.filter((o) => typeof o === "object" && o)); + const config = Object.assign( + __spreadValues({ baseDir }, defaultOptions), + ...options.filter((o) => typeof o === "object" && o) + ); config.baseDir = config.baseDir || baseDir; config.trimmed = config.trimmed === true; return config; @@ -14158,6 +14408,7 @@ function createInstanceConfig(...options) { var defaultOptions; var init_simple_git_options = __esm({ "src/lib/utils/simple-git-options.ts"() { + "use strict"; defaultOptions = { binary: "git", maxConcurrentProcesses: 5, @@ -14211,6 +14462,7 @@ function trailingFunctionArgument(args, includeNoop = true) { } var init_task_options = __esm({ "src/lib/utils/task-options.ts"() { + "use strict"; init_argument_filters(); init_util(); init_pathspec(); @@ -14237,6 +14489,7 @@ function parseStringResponse(result, parsers12, texts, trim = true) { } var init_task_parser = __esm({ "src/lib/utils/task-parser.ts"() { + "use strict"; init_util(); } }); @@ -14289,6 +14542,7 @@ __export(utils_exports, { }); var init_utils = __esm({ "src/lib/utils/index.ts"() { + "use strict"; init_argument_filters(); init_exit_codes(); init_git_output_streams(); @@ -14349,6 +14603,7 @@ function isNotRepoMessage(error) { var CheckRepoActions, onError, parser; var init_check_is_repo = __esm({ "src/lib/tasks/check-is-repo.ts"() { + "use strict"; init_utils(); CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => { CheckRepoActions2["BARE"] = "bare"; @@ -14382,6 +14637,7 @@ function cleanSummaryParser(dryRun, text) { var CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp; var init_CleanSummary = __esm({ "src/lib/responses/CleanSummary.ts"() { + "use strict"; init_utils(); CleanResponse = class { constructor(dryRun) { @@ -14451,6 +14707,7 @@ function isEmptyTask(task) { var EMPTY_COMMANDS; var init_task = __esm({ "src/lib/tasks/task.ts"() { + "use strict"; init_task_configuration_error(); EMPTY_COMMANDS = []; } @@ -14527,6 +14784,7 @@ function isInteractiveMode(option) { var CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues; var init_clean = __esm({ "src/lib/tasks/clean.ts"() { + "use strict"; init_CleanSummary(); init_utils(); init_task(); @@ -14600,6 +14858,7 @@ function* configParser(text, requestedKey = null) { var ConfigList; var init_ConfigList = __esm({ "src/lib/responses/ConfigList.ts"() { + "use strict"; init_utils(); ConfigList = class { constructor() { @@ -14687,19 +14946,34 @@ function listConfigTask(scope) { function config_default() { return { addConfig(key, value, ...rest) { - return this._runTask(addConfigTask(key, value, rest[0] === true, asConfigScope(rest[1], "local" /* local */)), trailingFunctionArgument(arguments)); + return this._runTask( + addConfigTask( + key, + value, + rest[0] === true, + asConfigScope(rest[1], "local" /* local */) + ), + trailingFunctionArgument(arguments) + ); }, getConfig(key, scope) { - return this._runTask(getConfigTask(key, asConfigScope(scope, void 0)), trailingFunctionArgument(arguments)); + return this._runTask( + getConfigTask(key, asConfigScope(scope, void 0)), + trailingFunctionArgument(arguments) + ); }, listConfig(...rest) { - return this._runTask(listConfigTask(asConfigScope(rest[0], void 0)), trailingFunctionArgument(arguments)); + return this._runTask( + listConfigTask(asConfigScope(rest[0], void 0)), + trailingFunctionArgument(arguments) + ); } }; } var GitConfigScope; var init_config = __esm({ "src/lib/tasks/config.ts"() { + "use strict"; init_ConfigList(); init_utils(); GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => { @@ -14719,6 +14993,7 @@ function isDiffNameStatus(input) { var DiffNameStatus, diffNameStatus; var init_diff_name_status = __esm({ "src/lib/tasks/diff-name-status.ts"() { + "use strict"; DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => { DiffNameStatus2["ADDED"] = "A"; DiffNameStatus2["COPIED"] = "C"; @@ -14763,26 +15038,33 @@ function grep_default() { const options = getTrailingOptions(arguments); for (const option of disallowedOptions) { if (options.includes(option)) { - return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then); + return this._runTask( + configurationErrorTask(`git.grep: use of "${option}" is not supported.`), + then + ); } } if (typeof searchTerm === "string") { searchTerm = grepQueryBuilder().param(searchTerm); } const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm]; - return this._runTask({ - commands, - format: "utf-8", - parser(stdOut) { - return parseGrep(stdOut); - } - }, then); + return this._runTask( + { + commands, + format: "utf-8", + parser(stdOut) { + return parseGrep(stdOut); + } + }, + then + ); } }; } var disallowedOptions, Query, _a, GrepQuery; var init_grep = __esm({ "src/lib/tasks/grep.ts"() { + "use strict"; init_utils(); init_task(); disallowedOptions = ["-h"]; @@ -14840,6 +15122,7 @@ function isValidResetMode(mode) { var ResetMode, ResetModes; var init_reset = __esm({ "src/lib/tasks/reset.ts"() { + "use strict"; init_task(); ResetMode = /* @__PURE__ */ ((ResetMode2) => { ResetMode2["MIXED"] = "mixed"; @@ -14871,6 +15154,7 @@ __export(api_exports, { }); var init_api = __esm({ "src/lib/api.ts"() { + "use strict"; init_pathspec(); init_git_construct_error(); init_git_error(); @@ -14913,6 +15197,7 @@ function abortPlugin(signal) { } var init_abort_plugin = __esm({ "src/lib/plugins/abort-plugin.ts"() { + "use strict"; init_git_plugin_error(); } }); @@ -14928,17 +15213,33 @@ function preventProtocolOverride(arg, next) { if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) { return; } - throw new GitPluginError(void 0, "unsafe", "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol"); + throw new GitPluginError( + void 0, + "unsafe", + "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol" + ); } function preventUploadPack(arg, method) { if (/^\s*--(upload|receive)-pack/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`); + throw new GitPluginError( + void 0, + "unsafe", + `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack` + ); } if (method === "clone" && /^\s*-u\b/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of clone with option -u is not permitted without enabling allowUnsafePack`); + throw new GitPluginError( + void 0, + "unsafe", + `Use of clone with option -u is not permitted without enabling allowUnsafePack` + ); } if (method === "push" && /^\s*--exec\b/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of push with option --exec is not permitted without enabling allowUnsafePack`); + throw new GitPluginError( + void 0, + "unsafe", + `Use of push with option --exec is not permitted without enabling allowUnsafePack` + ); } } function blockUnsafeOperationsPlugin({ @@ -14959,6 +15260,7 @@ function blockUnsafeOperationsPlugin({ } var init_block_unsafe_operations_plugin = __esm({ "src/lib/plugins/block-unsafe-operations-plugin.ts"() { + "use strict"; init_git_plugin_error(); } }); @@ -14975,6 +15277,7 @@ function commandConfigPrefixingPlugin(configuration) { } var init_command_config_prefixing_plugin = __esm({ "src/lib/plugins/command-config-prefixing-plugin.ts"() { + "use strict"; init_utils(); } }); @@ -15023,11 +15326,11 @@ function completionDetectionPlugin({ type: "spawn.after", action(_0, _1) { return __async(this, arguments, function* (_data, { spawned, close }) { - var _a2, _b; + var _a3, _b; const events = createEvents(); let deferClose = true; let quickClose = () => void (deferClose = false); - (_a2 = spawned.stdout) == null ? void 0 : _a2.on("data", quickClose); + (_a3 = spawned.stdout) == null ? void 0 : _a3.on("data", quickClose); (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose); spawned.on("error", quickClose); spawned.on("close", (code) => events.close(code)); @@ -15048,12 +15351,58 @@ function completionDetectionPlugin({ var import_promise_deferred, never; var init_completion_detection_plugin = __esm({ "src/lib/plugins/completion-detection.plugin.ts"() { + "use strict"; import_promise_deferred = __nccwpck_require__(9819); init_utils(); never = (0, import_promise_deferred.deferred)().promise; } }); +// src/lib/plugins/custom-binary.plugin.ts +function isBadArgument(arg) { + return !arg || !/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(arg); +} +function toBinaryConfig(input, allowUnsafe) { + if (input.length < 1 || input.length > 2) { + throw new GitPluginError(void 0, "binary", WRONG_NUMBER_ERR); + } + const isBad = input.some(isBadArgument); + if (isBad) { + if (allowUnsafe) { + console.warn(WRONG_CHARS_ERR); + } else { + throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR); + } + } + const [binary, prefix] = input; + return { + binary, + prefix + }; +} +function customBinaryPlugin(plugins, input = ["git"], allowUnsafe = false) { + let config = toBinaryConfig(asArray(input), allowUnsafe); + plugins.on("binary", (input2) => { + config = toBinaryConfig(asArray(input2), allowUnsafe); + }); + plugins.append("spawn.binary", () => { + return config.binary; + }); + plugins.append("spawn.args", (data) => { + return config.prefix ? [config.prefix, ...data] : data; + }); +} +var WRONG_NUMBER_ERR, WRONG_CHARS_ERR; +var init_custom_binary_plugin = __esm({ + "src/lib/plugins/custom-binary.plugin.ts"() { + "use strict"; + init_git_plugin_error(); + init_utils(); + WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`; + WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`; + } +}); + // src/lib/plugins/error-detection.plugin.ts function isTaskError(result) { return !!(result.exitCode && result.stdErr.length); @@ -15089,18 +15438,32 @@ function errorDetectionPlugin(config) { } var init_error_detection_plugin = __esm({ "src/lib/plugins/error-detection.plugin.ts"() { + "use strict"; init_git_error(); } }); // src/lib/plugins/plugin-store.ts -var PluginStore; +var import_node_events, PluginStore; var init_plugin_store = __esm({ "src/lib/plugins/plugin-store.ts"() { + "use strict"; + import_node_events = __nccwpck_require__(5673); init_utils(); PluginStore = class { constructor() { this.plugins = /* @__PURE__ */ new Set(); + this.events = new import_node_events.EventEmitter(); + } + on(type, listener) { + this.events.on(type, listener); + } + reconfigure(type, data) { + this.events.emit(type, data); + } + append(type, action) { + const plugin = append(this.plugins, { type, action }); + return () => this.plugins.delete(plugin); } add(plugin) { const plugins = []; @@ -15165,6 +15528,7 @@ function progressEventStage(input) { } var init_progress_monitor_plugin = __esm({ "src/lib/plugins/progress-monitor-plugin.ts"() { + "use strict"; init_utils(); } }); @@ -15172,6 +15536,7 @@ var init_progress_monitor_plugin = __esm({ // src/lib/plugins/simple-git-plugin.ts var init_simple_git_plugin = __esm({ "src/lib/plugins/simple-git-plugin.ts"() { + "use strict"; } }); @@ -15187,6 +15552,7 @@ function spawnOptionsPlugin(spawnOptions) { } var init_spawn_options_plugin = __esm({ "src/lib/plugins/spawn-options-plugin.ts"() { + "use strict"; init_utils(); } }); @@ -15230,6 +15596,7 @@ function timeoutPlugin({ } var init_timout_plugin = __esm({ "src/lib/plugins/timout-plugin.ts"() { + "use strict"; init_git_plugin_error(); } }); @@ -15237,10 +15604,12 @@ var init_timout_plugin = __esm({ // src/lib/plugins/index.ts var init_plugins = __esm({ "src/lib/plugins/index.ts"() { + "use strict"; init_abort_plugin(); init_block_unsafe_operations_plugin(); init_command_config_prefixing_plugin(); init_completion_detection_plugin(); + init_custom_binary_plugin(); init_error_detection_plugin(); init_plugin_store(); init_progress_monitor_plugin(); @@ -15267,7 +15636,9 @@ function suffixPathsPlugin() { continue; } if (param === "--") { - append2(data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item)); + append2( + data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item) + ); break; } prefix.push(param); @@ -15278,6 +15649,7 @@ function suffixPathsPlugin() { } var init_suffix_paths_plugin = __esm({ "src/lib/plugins/suffix-paths.plugin.ts"() { + "use strict"; init_pathspec(); } }); @@ -15317,7 +15689,10 @@ function createLogger(label, verbose, initialStep, infoDebugger = createLog()) { const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger); return step(initialStep); function sibling(name, initial) { - return append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)); + return append( + spawned, + createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger) + ); } function step(phase) { const stepPrefix = phase && `[${phase}]` || ""; @@ -15334,6 +15709,7 @@ function createLogger(label, verbose, initialStep, infoDebugger = createLog()) { var import_debug; var init_git_logger = __esm({ "src/lib/git-logger.ts"() { + "use strict"; import_debug = __toESM(__nccwpck_require__(8237)); init_utils(); import_debug.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-"); @@ -15350,6 +15726,7 @@ var init_git_logger = __esm({ var _TasksPendingQueue, TasksPendingQueue; var init_tasks_pending_queue = __esm({ "src/lib/runners/tasks-pending-queue.ts"() { + "use strict"; init_git_error(); init_git_logger(); _TasksPendingQueue = class { @@ -15379,9 +15756,14 @@ var init_tasks_pending_queue = __esm({ for (const [task, { logger }] of Array.from(this._queue.entries())) { if (task === err.task) { logger.info(`Failed %o`, err); - logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`); + logger( + `Fatal exception, any as-yet un-started tasks run through this executor will not be attempted` + ); } else { - logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message); + logger.info( + `A fatal exception occurred in a previous task, the queue has been purged: %o`, + err.message + ); } this.complete(task); } @@ -15435,6 +15817,7 @@ function onDataReceived(target, name, logger, output) { var import_child_process, GitExecutorChain; var init_git_executor_chain = __esm({ "src/lib/runners/git-executor-chain.ts"() { + "use strict"; import_child_process = __nccwpck_require__(8493); init_git_error(); init_task(); @@ -15448,9 +15831,6 @@ var init_git_executor_chain = __esm({ this._chain = Promise.resolve(); this._queue = new TasksPendingQueue(); } - get binary() { - return this._executor.binary; - } get cwd() { return this._cwd || this._executor.cwd; } @@ -15493,8 +15873,19 @@ var init_git_executor_chain = __esm({ } attemptRemoteTask(task, logger) { return __async(this, null, function* () { - const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext(task, task.commands)); - const raw = yield this.gitResponse(task, this.binary, args, this.outputHandler, logger.step("SPAWN")); + const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands)); + const args = this._plugins.exec( + "spawn.args", + [...task.commands], + pluginContext(task, task.commands) + ); + const raw = yield this.gitResponse( + task, + binary, + args, + this.outputHandler, + logger.step("SPAWN") + ); const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE")); logger(`passing response to task's parser as a %s`, task.format); if (isBufferTask(task)) { @@ -15513,17 +15904,36 @@ var init_git_executor_chain = __esm({ const { exitCode, rejection, stdOut, stdErr } = result; return new Promise((done, fail) => { logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode); - const { error } = this._plugins.exec("task.error", { error: rejection }, __spreadValues(__spreadValues({}, pluginContext(task, args)), result)); + const { error } = this._plugins.exec( + "task.error", + { error: rejection }, + __spreadValues(__spreadValues({}, pluginContext(task, args)), result) + ); if (error && task.onError) { logger.info(`exitCode=%s handling with custom error handler`); - return task.onError(result, error, (newStdOut) => { - logger.info(`custom error handler treated as success`); - logger(`custom error returned a %s`, objectToString(newStdOut)); - done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr))); - }, fail); + return task.onError( + result, + error, + (newStdOut) => { + logger.info(`custom error handler treated as success`); + logger(`custom error returned a %s`, objectToString(newStdOut)); + done( + new GitOutputStreams( + Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, + Buffer.concat(stdErr) + ) + ); + }, + fail + ); } if (error) { - logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection); + logger.info( + `handling as error: exitCode=%s stdErr=%s rejection=%o`, + exitCode, + stdErr.length, + rejection + ); return fail(error); } logger.info(`retrieving task output complete`); @@ -15533,11 +15943,15 @@ var init_git_executor_chain = __esm({ gitResponse(task, command, args, outputHandler, logger) { return __async(this, null, function* () { const outputLogger = logger.sibling("output"); - const spawnOptions = this._plugins.exec("spawn.options", { - cwd: this.cwd, - env: this.env, - windowsHide: true - }, pluginContext(task, task.commands)); + const spawnOptions = this._plugins.exec( + "spawn.options", + { + cwd: this.cwd, + env: this.env, + windowsHide: true + }, + pluginContext(task, task.commands) + ); return new Promise((done) => { const stdOut = []; const stdErr = []; @@ -15558,8 +15972,14 @@ var init_git_executor_chain = __esm({ } })); const spawned = (0, import_child_process.spawn)(command, args, spawnOptions); - spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))); - spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))); + spawned.stdout.on( + "data", + onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")) + ); + spawned.stderr.on( + "data", + onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")) + ); spawned.on("error", onErrorReceived(stdErr, logger)); if (outputHandler) { logger(`Passing child process stdOut/stdErr to custom outputHandler`); @@ -15607,10 +16027,10 @@ __export(git_executor_exports, { var GitExecutor; var init_git_executor = __esm({ "src/lib/runners/git-executor.ts"() { + "use strict"; init_git_executor_chain(); GitExecutor = class { - constructor(binary = "git", cwd, _scheduler, _plugins) { - this.binary = binary; + constructor(cwd, _scheduler, _plugins) { this.cwd = cwd; this._scheduler = _scheduler; this._plugins = _plugins; @@ -15633,14 +16053,19 @@ function taskCallback(task, response, callback = NOOP) { }; const onError2 = (err) => { if ((err == null ? void 0 : err.task) === task) { - callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, void 0); + callback( + err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, + void 0 + ); } }; response.then(onSuccess, onError2); } function addDeprecationNoticeToError(err) { let log = (name) => { - console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`); + console.warn( + `simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3` + ); log = NOOP; }; return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {})); @@ -15661,6 +16086,7 @@ function addDeprecationNoticeToError(err) { } var init_task_callback = __esm({ "src/lib/task-callback.ts"() { + "use strict"; init_git_response_error(); init_utils(); } @@ -15677,6 +16103,7 @@ function changeWorkingDirectoryTask(directory, root) { } var init_change_working_directory = __esm({ "src/lib/tasks/change-working-directory.ts"() { + "use strict"; init_utils(); init_task(); } @@ -15693,18 +16120,28 @@ function checkoutTask(args) { function checkout_default() { return { checkout() { - return this._runTask(checkoutTask(getTrailingOptions(arguments, 1)), trailingFunctionArgument(arguments)); + return this._runTask( + checkoutTask(getTrailingOptions(arguments, 1)), + trailingFunctionArgument(arguments) + ); }, checkoutBranch(branchName, startPoint) { - return this._runTask(checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + return this._runTask( + checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments) + ); }, checkoutLocalBranch(branchName) { - return this._runTask(checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + return this._runTask( + checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments) + ); } }; } var init_checkout = __esm({ "src/lib/tasks/checkout.ts"() { + "use strict"; init_utils(); init_task(); } @@ -15728,6 +16165,7 @@ function parseCommitResult(stdOut) { var parsers; var init_parse_commit = __esm({ "src/lib/parsers/parse-commit.ts"() { + "use strict"; init_utils(); parsers = [ new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => { @@ -15746,20 +16184,26 @@ var init_parse_commit = __esm({ name: parts.join("<").trim() }; }), - new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => { - result.summary.changes = parseInt(changes, 10) || 0; - result.summary.insertions = parseInt(insertions, 10) || 0; - result.summary.deletions = parseInt(deletions, 10) || 0; - }), - new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => { - result.summary.changes = parseInt(changes, 10) || 0; - const count = parseInt(lines, 10) || 0; - if (direction === "-") { - result.summary.deletions = count; - } else if (direction === "+") { - result.summary.insertions = count; + new LineParser( + /(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, + (result, [changes, insertions, deletions]) => { + result.summary.changes = parseInt(changes, 10) || 0; + result.summary.insertions = parseInt(insertions, 10) || 0; + result.summary.deletions = parseInt(deletions, 10) || 0; + } + ), + new LineParser( + /^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, + (result, [changes, lines, direction]) => { + result.summary.changes = parseInt(changes, 10) || 0; + const count = parseInt(lines, 10) || 0; + if (direction === "-") { + result.summary.deletions = count; + } else if (direction === "+") { + result.summary.insertions = count; + } } - }) + ) ]; } }); @@ -15784,16 +16228,23 @@ function commit_default() { return { commit(message, ...rest) { const next = trailingFunctionArgument(arguments); - const task = rejectDeprecatedSignatures(message) || commitTask(asArray(message), asArray(filterType(rest[0], filterStringOrStringArray, [])), [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]); + const task = rejectDeprecatedSignatures(message) || commitTask( + asArray(message), + asArray(filterType(rest[0], filterStringOrStringArray, [])), + [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)] + ); return this._runTask(task, next); } }; function rejectDeprecatedSignatures(message) { - return !filterStringOrStringArray(message) && configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`); + return !filterStringOrStringArray(message) && configurationErrorTask( + `git.commit: requires the commit message to be supplied as a string/string[]` + ); } } var init_commit = __esm({ "src/lib/tasks/commit.ts"() { + "use strict"; init_parse_commit(); init_utils(); init_task(); @@ -15804,12 +16255,16 @@ var init_commit = __esm({ function first_commit_default() { return { firstCommit() { - return this._runTask(straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), + trailingFunctionArgument(arguments) + ); } }; } var init_first_commit = __esm({ "src/lib/tasks/first-commit.ts"() { + "use strict"; init_utils(); init_task(); } @@ -15825,6 +16280,7 @@ function hashObjectTask(filePath, write) { } var init_hash_object = __esm({ "src/lib/tasks/hash-object.ts"() { + "use strict"; init_task(); } }); @@ -15853,6 +16309,7 @@ function parseInit(bare, path, text) { var InitSummary, initResponseRegex, reInitResponseRegex; var init_InitSummary = __esm({ "src/lib/responses/InitSummary.ts"() { + "use strict"; InitSummary = class { constructor(bare, path, existing, gitDir) { this.bare = bare; @@ -15886,6 +16343,7 @@ function initTask(bare = false, path, customArgs) { var bareCommand; var init_init = __esm({ "src/lib/tasks/init.ts"() { + "use strict"; init_InitSummary(); bareCommand = "--bare"; } @@ -15907,6 +16365,7 @@ function isLogFormat(customArg) { var logFormatRegex; var init_log_format = __esm({ "src/lib/args/log-format.ts"() { + "use strict"; logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/; } }); @@ -15915,6 +16374,7 @@ var init_log_format = __esm({ var DiffSummary; var init_DiffSummary = __esm({ "src/lib/responses/DiffSummary.ts"() { + "use strict"; DiffSummary = class { constructor() { this.changed = 0; @@ -15934,51 +16394,64 @@ function getDiffParser(format = "" /* NONE */) { var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers; var init_parse_diff_summary = __esm({ "src/lib/parsers/parse-diff-summary.ts"() { + "use strict"; init_log_format(); init_DiffSummary(); init_diff_name_status(); init_utils(); statParser = [ - new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => { - result.files.push({ - file: file.trim(), - changes: asNumber(changes), - insertions: alterations.replace(/[^+]/g, "").length, - deletions: alterations.replace(/[^-]/g, "").length, - binary: false - }); - }), - new LineParser(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, (result, [file, before, after]) => { - result.files.push({ - file: file.trim(), - before: asNumber(before), - after: asNumber(after), - binary: true - }); - }), - new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, (result, [changed, summary]) => { - const inserted = /(\d+) i/.exec(summary); - const deleted = /(\d+) d/.exec(summary); - result.changed = asNumber(changed); - result.insertions = asNumber(inserted == null ? void 0 : inserted[1]); - result.deletions = asNumber(deleted == null ? void 0 : deleted[1]); - }) + new LineParser( + /^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, + (result, [file, changes, alterations = ""]) => { + result.files.push({ + file: file.trim(), + changes: asNumber(changes), + insertions: alterations.replace(/[^+]/g, "").length, + deletions: alterations.replace(/[^-]/g, "").length, + binary: false + }); + } + ), + new LineParser( + /^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, + (result, [file, before, after]) => { + result.files.push({ + file: file.trim(), + before: asNumber(before), + after: asNumber(after), + binary: true + }); + } + ), + new LineParser( + /(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, + (result, [changed, summary]) => { + const inserted = /(\d+) i/.exec(summary); + const deleted = /(\d+) d/.exec(summary); + result.changed = asNumber(changed); + result.insertions = asNumber(inserted == null ? void 0 : inserted[1]); + result.deletions = asNumber(deleted == null ? void 0 : deleted[1]); + } + ) ]; numStatParser = [ - new LineParser(/(\d+)\t(\d+)\t(.+)$/, (result, [changesInsert, changesDelete, file]) => { - const insertions = asNumber(changesInsert); - const deletions = asNumber(changesDelete); - result.changed++; - result.insertions += insertions; - result.deletions += deletions; - result.files.push({ - file, - changes: insertions + deletions, - insertions, - deletions, - binary: false - }); - }), + new LineParser( + /(\d+)\t(\d+)\t(.+)$/, + (result, [changesInsert, changesDelete, file]) => { + const insertions = asNumber(changesInsert); + const deletions = asNumber(changesDelete); + result.changed++; + result.insertions += insertions; + result.deletions += deletions; + result.files.push({ + file, + changes: insertions + deletions, + insertions, + deletions, + binary: false + }); + } + ), new LineParser(/-\t-\t(.+)$/, (result, [file]) => { result.changed++; result.files.push({ @@ -16002,17 +16475,20 @@ var init_parse_diff_summary = __esm({ }) ]; nameStatusParser = [ - new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, _similarity, from, _to, to]) => { - result.changed++; - result.files.push({ - file: to != null ? to : from, - changes: 0, - status: orVoid(isDiffNameStatus(status) && status), - insertions: 0, - deletions: 0, - binary: false - }); - }) + new LineParser( + /([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, + (result, [status, _similarity, from, _to, to]) => { + result.changed++; + result.files.push({ + file: to != null ? to : from, + changes: 0, + status: orVoid(isDiffNameStatus(status) && status), + insertions: 0, + deletions: 0, + binary: false + }); + } + ) ]; diffSummaryParsers = { ["" /* NONE */]: statParser, @@ -16026,17 +16502,27 @@ var init_parse_diff_summary = __esm({ // src/lib/parsers/parse-list-log-summary.ts function lineBuilder(tokens, fields) { - return fields.reduce((line, field, index) => { - line[field] = tokens[index] || ""; - return line; - }, /* @__PURE__ */ Object.create({ diff: null })); + return fields.reduce( + (line, field, index) => { + line[field] = tokens[index] || ""; + return line; + }, + /* @__PURE__ */ Object.create({ diff: null }) + ); } function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "" /* NONE */) { const parseDiffResult = getDiffParser(logFormat); return function(stdOut) { - const all = toLinesWithContent(stdOut, true, START_BOUNDARY).map(function(item) { + const all = toLinesWithContent( + stdOut, + true, + START_BOUNDARY + ).map(function(item) { const lineDetail = item.trim().split(COMMIT_BOUNDARY); - const listLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields); + const listLogLine = lineBuilder( + lineDetail[0].trim().split(splitter), + fields + ); if (lineDetail.length > 1 && !!lineDetail[1].trim()) { listLogLine.diff = parseDiffResult(lineDetail[1]); } @@ -16052,6 +16538,7 @@ function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNa var START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames; var init_parse_list_log_summary = __esm({ "src/lib/parsers/parse-list-log-summary.ts"() { + "use strict"; init_utils(); init_parse_diff_summary(); init_log_format(); @@ -16085,14 +16572,19 @@ function diffSummaryTask(customArgs) { function validateLogFormatConfig(customArgs) { const flags = customArgs.filter(isLogFormat); if (flags.length > 1) { - return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${flags.join(",")}`); + return configurationErrorTask( + `Summary flags are mutually exclusive - pick one of ${flags.join(",")}` + ); } if (flags.length && customArgs.includes("-z")) { - return configurationErrorTask(`Summary flag ${flags} parsing is not compatible with null termination option '-z'`); + return configurationErrorTask( + `Summary flag ${flags} parsing is not compatible with null termination option '-z'` + ); } } var init_diff = __esm({ "src/lib/tasks/diff.ts"() { + "use strict"; init_log_format(); init_parse_diff_summary(); init_task(); @@ -16164,7 +16656,10 @@ function log_default() { return { log(...rest) { const next = trailingFunctionArgument(arguments); - const options = parseLogOptions(trailingOptionsArgument(arguments), filterType(arguments[0], filterArray)); + const options = parseLogOptions( + trailingOptionsArgument(arguments), + filterType(arguments[0], filterArray) + ); const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options); return this._runTask(task, next); } @@ -16173,12 +16668,15 @@ function log_default() { return logTask(options.splitter, options.fields, options.commands); } function rejectDeprecatedSignatures(from, to) { - return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`); + return filterString(from) && filterString(to) && configurationErrorTask( + `git.log(string, string) should be replaced with git.log({ from: string, to: string })` + ); } } var excludeOptions; var init_log = __esm({ "src/lib/tasks/log.ts"() { + "use strict"; init_log_format(); init_pathspec(); init_parse_list_log_summary(); @@ -16208,6 +16706,7 @@ var init_log = __esm({ var MergeSummaryConflict, MergeSummaryDetail; var init_MergeSummary = __esm({ "src/lib/responses/MergeSummary.ts"() { + "use strict"; MergeSummaryConflict = class { constructor(reason, file = null, meta) { this.reason = reason; @@ -16244,6 +16743,7 @@ var init_MergeSummary = __esm({ var PullSummary, PullFailedSummary; var init_PullSummary = __esm({ "src/lib/responses/PullSummary.ts"() { + "use strict"; PullSummary = class { constructor() { this.remoteMessages = { @@ -16303,24 +16803,34 @@ function asObjectCount(source) { var remoteMessagesObjectParsers; var init_parse_remote_objects = __esm({ "src/lib/parsers/parse-remote-objects.ts"() { + "use strict"; init_utils(); remoteMessagesObjectParsers = [ - new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => { - const key = action.toLowerCase(); - const enumeration = objectEnumerationResult(result.remoteMessages); - Object.assign(enumeration, { [key]: asNumber(count) }); - }), - new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => { - const key = action.toLowerCase(); - const enumeration = objectEnumerationResult(result.remoteMessages); - Object.assign(enumeration, { [key]: asNumber(count) }); - }), - new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => { - const objects = objectEnumerationResult(result.remoteMessages); - objects.total = asObjectCount(total); - objects.reused = asObjectCount(reused); - objects.packReused = asNumber(packReused); - }) + new RemoteLineParser( + /^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, + (result, [action, count]) => { + const key = action.toLowerCase(); + const enumeration = objectEnumerationResult(result.remoteMessages); + Object.assign(enumeration, { [key]: asNumber(count) }); + } + ), + new RemoteLineParser( + /^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, + (result, [action, count]) => { + const key = action.toLowerCase(); + const enumeration = objectEnumerationResult(result.remoteMessages); + Object.assign(enumeration, { [key]: asNumber(count) }); + } + ), + new RemoteLineParser( + /total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, + (result, [total, reused, packReused]) => { + const objects = objectEnumerationResult(result.remoteMessages); + objects.total = asObjectCount(total); + objects.reused = asObjectCount(reused); + objects.packReused = asNumber(packReused); + } + ) ]; } }); @@ -16332,6 +16842,7 @@ function parseRemoteMessages(_stdOut, stdErr) { var parsers2, RemoteMessageSummary; var init_parse_remote_messages = __esm({ "src/lib/parsers/parse-remote-messages.ts"() { + "use strict"; init_utils(); init_parse_remote_objects(); parsers2 = [ @@ -16340,16 +16851,22 @@ var init_parse_remote_messages = __esm({ return false; }), ...remoteMessagesObjectParsers, - new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => { - result.remoteMessages.pullRequestUrl = pullRequestUrl; - }), - new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => { - result.remoteMessages.vulnerabilities = { - count: asNumber(count), - summary, - url - }; - }) + new RemoteLineParser( + [/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], + (result, [pullRequestUrl]) => { + result.remoteMessages.pullRequestUrl = pullRequestUrl; + } + ), + new RemoteLineParser( + [/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], + (result, [count, summary, url]) => { + result.remoteMessages.vulnerabilities = { + count: asNumber(count), + summary, + url + }; + } + ) ]; RemoteMessageSummary = class { constructor() { @@ -16367,6 +16884,7 @@ function parsePullErrorResult(stdOut, stdErr) { var FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult; var init_parse_pull = __esm({ "src/lib/parsers/parse-pull.ts"() { + "use strict"; init_PullSummary(); init_utils(); init_parse_remote_messages(); @@ -16400,18 +16918,25 @@ var init_parse_pull = __esm({ errorParsers = [ new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)), new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)), - new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => { - result.branch.local = branchLocal; - result.hash.local = hashLocal; - result.branch.remote = branchRemote; - result.hash.remote = hashRemote; - }) + new LineParser( + /([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, + (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => { + result.branch.local = branchLocal; + result.hash.local = hashLocal; + result.branch.remote = branchRemote; + result.hash.remote = hashRemote; + } + ) ]; parsePullDetail = (stdOut, stdErr) => { return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]); }; parsePullResult = (stdOut, stdErr) => { - return Object.assign(new PullSummary(), parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr)); + return Object.assign( + new PullSummary(), + parsePullDetail(stdOut, stdErr), + parseRemoteMessages(stdOut, stdErr) + ); }; } }); @@ -16420,6 +16945,7 @@ var init_parse_pull = __esm({ var parsers4, parseMergeResult, parseMergeDetail; var init_parse_merge = __esm({ "src/lib/parsers/parse-merge.ts"() { + "use strict"; init_MergeSummary(); init_utils(); init_parse_pull(); @@ -16430,9 +16956,12 @@ var init_parse_merge = __esm({ new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => { summary.conflicts.push(new MergeSummaryConflict(reason, file)); }), - new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => { - summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef })); - }), + new LineParser( + /^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, + (summary, [reason, file, deleteRef]) => { + summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef })); + } + ), new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => { summary.conflicts.push(new MergeSummaryConflict(reason, null)); }), @@ -16468,6 +16997,7 @@ function mergeTask(customArgs) { } var init_merge = __esm({ "src/lib/tasks/merge.ts"() { + "use strict"; init_git_response_error(); init_parse_merge(); init_task(); @@ -16492,6 +17022,7 @@ function pushResultPushedItem(local, remote, status) { var parsers5, parsePushResult, parsePushDetail; var init_parse_push = __esm({ "src/lib/parsers/parse-push.ts"() { + "use strict"; init_utils(); init_parse_remote_messages(); parsers5 = [ @@ -16506,25 +17037,31 @@ var init_parse_push = __esm({ new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => { result.pushed.push(pushResultPushedItem(local, remote, type)); }), - new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => { - result.branch = __spreadProps(__spreadValues({}, result.branch || {}), { - local, - remote, - remoteName - }); - }), - new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => { - result.update = { - head: { + new LineParser( + /^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, + (result, [local, remote, remoteName]) => { + result.branch = __spreadProps(__spreadValues({}, result.branch || {}), { local, - remote - }, - hash: { - from, - to - } - }; - }) + remote, + remoteName + }); + } + ), + new LineParser( + /^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, + (result, [local, remote, from, to]) => { + result.update = { + head: { + local, + remote + }, + hash: { + from, + to + } + }; + } + ) ]; parsePushResult = (stdOut, stdErr) => { const pushDetail = parsePushDetail(stdOut, stdErr); @@ -16566,6 +17103,7 @@ function pushTask(ref = {}, customArgs) { } var init_push = __esm({ "src/lib/tasks/push.ts"() { + "use strict"; init_parse_push(); init_utils(); } @@ -16579,16 +17117,23 @@ function show_default() { if (!commands.includes("--binary")) { commands.splice(1, 0, "--binary"); } - return this._runTask(straightThroughBufferTask(commands), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughBufferTask(commands), + trailingFunctionArgument(arguments) + ); }, show() { const commands = ["show", ...getTrailingOptions(arguments, 1)]; - return this._runTask(straightThroughStringTask(commands), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(commands), + trailingFunctionArgument(arguments) + ); } }; } var init_show = __esm({ "src/lib/tasks/show.ts"() { + "use strict"; init_utils(); init_task(); } @@ -16598,13 +17143,14 @@ var init_show = __esm({ var fromPathRegex, FileStatusSummary; var init_FileStatusSummary = __esm({ "src/lib/responses/FileStatusSummary.ts"() { + "use strict"; fromPathRegex = /^(.+) -> (.+)$/; FileStatusSummary = class { constructor(path, index, working_dir) { this.path = path; this.index = index; this.working_dir = working_dir; - if (index + working_dir === "R") { + if ("R" === index + working_dir) { const detail = fromPathRegex.exec(path) || [null, path, path]; this.from = detail[1] || ""; this.path = detail[2] || ""; @@ -16652,6 +17198,7 @@ function splitLine(result, lineStr) { var StatusSummary, parsers6, parseStatusSummary; var init_StatusSummary = __esm({ "src/lib/responses/StatusSummary.ts"() { + "use strict"; init_utils(); init_FileStatusSummary(); StatusSummary = class { @@ -16676,14 +17223,46 @@ var init_StatusSummary = __esm({ } }; parsers6 = new Map([ - parser2(" " /* NONE */, "A" /* ADDED */, (result, file) => append(result.created, file)), - parser2(" " /* NONE */, "D" /* DELETED */, (result, file) => append(result.deleted, file)), - parser2(" " /* NONE */, "M" /* MODIFIED */, (result, file) => append(result.modified, file)), - parser2("A" /* ADDED */, " " /* NONE */, (result, file) => append(result.created, file) && append(result.staged, file)), - parser2("A" /* ADDED */, "M" /* MODIFIED */, (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)), - parser2("D" /* DELETED */, " " /* NONE */, (result, file) => append(result.deleted, file) && append(result.staged, file)), - parser2("M" /* MODIFIED */, " " /* NONE */, (result, file) => append(result.modified, file) && append(result.staged, file)), - parser2("M" /* MODIFIED */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) && append(result.staged, file)), + parser2( + " " /* NONE */, + "A" /* ADDED */, + (result, file) => append(result.created, file) + ), + parser2( + " " /* NONE */, + "D" /* DELETED */, + (result, file) => append(result.deleted, file) + ), + parser2( + " " /* NONE */, + "M" /* MODIFIED */, + (result, file) => append(result.modified, file) + ), + parser2( + "A" /* ADDED */, + " " /* NONE */, + (result, file) => append(result.created, file) && append(result.staged, file) + ), + parser2( + "A" /* ADDED */, + "M" /* MODIFIED */, + (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file) + ), + parser2( + "D" /* DELETED */, + " " /* NONE */, + (result, file) => append(result.deleted, file) && append(result.staged, file) + ), + parser2( + "M" /* MODIFIED */, + " " /* NONE */, + (result, file) => append(result.modified, file) && append(result.staged, file) + ), + parser2( + "M" /* MODIFIED */, + "M" /* MODIFIED */, + (result, file) => append(result.modified, file) && append(result.staged, file) + ), parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => { append(result.renamed, renamedFile(file)); }), @@ -16695,10 +17274,23 @@ var init_StatusSummary = __esm({ parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { append(_result.ignored = _result.ignored || [], _file); }), - parser2("?" /* UNTRACKED */, "?" /* UNTRACKED */, (result, file) => append(result.not_added, file)), + parser2( + "?" /* UNTRACKED */, + "?" /* UNTRACKED */, + (result, file) => append(result.not_added, file) + ), ...conflicts("A" /* ADDED */, "A" /* ADDED */, "U" /* UNMERGED */), - ...conflicts("D" /* DELETED */, "D" /* DELETED */, "U" /* UNMERGED */), - ...conflicts("U" /* UNMERGED */, "A" /* ADDED */, "D" /* DELETED */, "U" /* UNMERGED */), + ...conflicts( + "D" /* DELETED */, + "D" /* DELETED */, + "U" /* UNMERGED */ + ), + ...conflicts( + "U" /* UNMERGED */, + "A" /* ADDED */, + "D" /* DELETED */, + "U" /* UNMERGED */ + ), [ "##", (result, line) => { @@ -16761,6 +17353,7 @@ function statusTask(customArgs) { var ignoredOptions; var init_status = __esm({ "src/lib/tasks/status.ts"() { + "use strict"; init_StatusSummary(); ignoredOptions = ["--null", "-z"]; } @@ -16768,19 +17361,23 @@ var init_status = __esm({ // src/lib/tasks/version.ts function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) { - return Object.defineProperty({ - major, - minor, - patch, - agent, - installed - }, "toString", { - value() { - return `${this.major}.${this.minor}.${this.patch}`; + return Object.defineProperty( + { + major, + minor, + patch, + agent, + installed }, - configurable: false, - enumerable: false - }); + "toString", + { + value() { + return `${this.major}.${this.minor}.${this.patch}`; + }, + configurable: false, + enumerable: false + } + ); } function notInstalledResponse() { return versionResponse(0, 0, 0, "", false); @@ -16811,15 +17408,25 @@ function versionParser(stdOut) { var NOT_INSTALLED, parsers7; var init_version = __esm({ "src/lib/tasks/version.ts"() { + "use strict"; init_utils(); NOT_INSTALLED = "installed=false"; parsers7 = [ - new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, (result, [major, minor, patch, agent = ""]) => { - Object.assign(result, versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)); - }), - new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/, (result, [major, minor, patch, agent = ""]) => { - Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent)); - }) + new LineParser( + /version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, + (result, [major, minor, patch, agent = ""]) => { + Object.assign( + result, + versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent) + ); + } + ), + new LineParser( + /version (\d+)\.(\d+)\.(\D+)(.+)?$/, + (result, [major, minor, patch, agent = ""]) => { + Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent)); + } + ) ]; } }); @@ -16832,6 +17439,7 @@ __export(simple_git_api_exports, { var SimpleGitApi; var init_simple_git_api = __esm({ "src/lib/simple-git-api.ts"() { + "use strict"; init_task_callback(); init_change_working_directory(); init_checkout(); @@ -16866,7 +17474,10 @@ var init_simple_git_api = __esm({ }); } add(files) { - return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(["add", ...asArray(files)]), + trailingFunctionArgument(arguments) + ); } cwd(directory) { const next = trailingFunctionArgument(arguments); @@ -16874,44 +17485,88 @@ var init_simple_git_api = __esm({ return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next); } if (typeof (directory == null ? void 0 : directory.path) === "string") { - return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || void 0), next); + return this._runTask( + changeWorkingDirectoryTask( + directory.path, + directory.root && this._executor || void 0 + ), + next + ); } - return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next); + return this._runTask( + configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), + next + ); } hashObject(path, write) { - return this._runTask(hashObjectTask(path, write === true), trailingFunctionArgument(arguments)); + return this._runTask( + hashObjectTask(path, write === true), + trailingFunctionArgument(arguments) + ); } init(bare) { - return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + return this._runTask( + initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), + trailingFunctionArgument(arguments) + ); } merge() { - return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + return this._runTask( + mergeTask(getTrailingOptions(arguments)), + trailingFunctionArgument(arguments) + ); } mergeFromTo(remote, branch) { if (!(filterString(remote) && filterString(branch))) { - return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`)); + return this._runTask( + configurationErrorTask( + `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings` + ) + ); } - return this._runTask(mergeTask([remote, branch, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments, false)); + return this._runTask( + mergeTask([remote, branch, ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments, false) + ); } outputHandler(handler) { this._executor.outputHandler = handler; return this; } push() { - const task = pushTask({ - remote: filterType(arguments[0], filterString), - branch: filterType(arguments[1], filterString) - }, getTrailingOptions(arguments)); + const task = pushTask( + { + remote: filterType(arguments[0], filterString), + branch: filterType(arguments[1], filterString) + }, + getTrailingOptions(arguments) + ); return this._runTask(task, trailingFunctionArgument(arguments)); } stash() { - return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments) + ); } status() { - return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + return this._runTask( + statusTask(getTrailingOptions(arguments)), + trailingFunctionArgument(arguments) + ); } }; - Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default()); + Object.assign( + SimpleGitApi.prototype, + checkout_default(), + commit_default(), + config_default(), + first_commit_default(), + grep_default(), + log_default(), + show_default(), + version_default() + ); } }); @@ -16923,6 +17578,7 @@ __export(scheduler_exports, { var import_promise_deferred2, createScheduledTask, Scheduler; var init_scheduler = __esm({ "src/lib/runners/scheduler.ts"() { + "use strict"; init_utils(); import_promise_deferred2 = __nccwpck_require__(9819); init_git_logger(); @@ -16948,7 +17604,12 @@ var init_scheduler = __esm({ } schedule() { if (!this.pending.length || this.running.length >= this.concurrency) { - this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency); + this.logger( + `Schedule attempt ignored, pending=%s running=%s concurrency=%s`, + this.pending.length, + this.running.length, + this.concurrency + ); return; } const task = append(this.running, this.pending.shift()); @@ -16979,6 +17640,7 @@ function applyPatchTask(patches, customArgs) { } var init_apply_patch = __esm({ "src/lib/tasks/apply-patch.ts"() { + "use strict"; init_task(); } }); @@ -17001,6 +17663,7 @@ function branchDeletionFailure(branch) { var BranchDeletionBatch; var init_BranchDeleteSummary = __esm({ "src/lib/responses/BranchDeleteSummary.ts"() { + "use strict"; BranchDeletionBatch = class { constructor() { this.all = []; @@ -17021,6 +17684,7 @@ function hasBranchDeletionError(data, processExitCode) { var deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions; var init_parse_branch_delete = __esm({ "src/lib/parsers/parse-branch-delete.ts"() { + "use strict"; init_BranchDeleteSummary(); init_utils(); deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/; @@ -17048,6 +17712,7 @@ var init_parse_branch_delete = __esm({ var BranchSummaryResult; var init_BranchSummary = __esm({ "src/lib/responses/BranchSummary.ts"() { + "use strict"; BranchSummaryResult = class { constructor() { this.all = []; @@ -17083,15 +17748,22 @@ function parseBranchSummary(stdOut) { var parsers9; var init_parse_branch = __esm({ "src/lib/parsers/parse-branch.ts"() { + "use strict"; init_BranchSummary(); init_utils(); parsers9 = [ - new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => { - result.push(branchStatus(current), true, name, commit, label); - }), - new LineParser(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => { - result.push(branchStatus(current), false, name, commit, label); - }) + new LineParser( + /^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, + (result, [current, name, commit, label]) => { + result.push(branchStatus(current), true, name, commit, label); + } + ), + new LineParser( + new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$", "s"), + (result, [current, name, commit, label]) => { + result.push(branchStatus(current), false, name, commit, label); + } + ) ]; } }); @@ -17163,13 +17835,17 @@ function deleteBranchTask(branch, forceDelete = false) { if (!hasBranchDeletionError(String(error), exitCode)) { return fail(error); } - throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error)); + throw new GitResponseError( + task.parser(bufferToString(stdOut), bufferToString(stdErr)), + String(error) + ); } }; return task; } var init_branch = __esm({ "src/lib/tasks/branch.ts"() { + "use strict"; init_git_response_error(); init_parse_branch_delete(); init_parse_branch(); @@ -17181,6 +17857,7 @@ var init_branch = __esm({ var parseCheckIgnore; var init_CheckIgnore = __esm({ "src/lib/responses/CheckIgnore.ts"() { + "use strict"; parseCheckIgnore = (text) => { return text.split(/\n/g).map((line) => line.trim()).filter((file) => !!file); }; @@ -17201,6 +17878,7 @@ function checkIgnoreTask(paths) { } var init_check_ignore = __esm({ "src/lib/tasks/check-ignore.ts"() { + "use strict"; init_CheckIgnore(); } }); @@ -17230,6 +17908,7 @@ function cloneMirrorTask(repo, directory, customArgs) { } var init_clone = __esm({ "src/lib/tasks/clone.ts"() { + "use strict"; init_task(); init_utils(); } @@ -17250,6 +17929,7 @@ function parseFetchResult(stdOut, stdErr) { var parsers10; var init_parse_fetch = __esm({ "src/lib/parsers/parse-fetch.ts"() { + "use strict"; init_utils(); parsers10 = [ new LineParser(/From (.+)$/, (result, [remote]) => { @@ -17272,14 +17952,17 @@ var init_parse_fetch = __esm({ tracking }); }), - new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, (result, [from, to, name, tracking]) => { - result.updated.push({ - name, - tracking, - to, - from - }); - }) + new LineParser( + /\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, + (result, [from, to, name, tracking]) => { + result.updated.push({ + name, + tracking, + to, + from + }); + } + ) ]; } }); @@ -17309,6 +17992,7 @@ function fetchTask(remote, branch, customArgs) { } var init_fetch = __esm({ "src/lib/tasks/fetch.ts"() { + "use strict"; init_parse_fetch(); init_task(); } @@ -17321,6 +18005,7 @@ function parseMoveResult(stdOut) { var parsers11; var init_parse_move = __esm({ "src/lib/parsers/parse-move.ts"() { + "use strict"; init_utils(); parsers11 = [ new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => { @@ -17344,6 +18029,7 @@ function moveTask(from, to) { } var init_move = __esm({ "src/lib/tasks/move.ts"() { + "use strict"; init_parse_move(); init_utils(); } @@ -17366,7 +18052,10 @@ function pullTask(remote, branch, customArgs) { return parsePullResult(stdOut, stdErr); }, onError(result, _error, _done, fail) { - const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr)); + const pullError = parsePullErrorResult( + bufferToString(result.stdOut), + bufferToString(result.stdErr) + ); if (pullError) { return fail(new GitResponseError(pullError)); } @@ -17376,6 +18065,7 @@ function pullTask(remote, branch, customArgs) { } var init_pull = __esm({ "src/lib/tasks/pull.ts"() { + "use strict"; init_git_response_error(); init_parse_pull(); init_utils(); @@ -17408,6 +18098,7 @@ function forEach(text, handler) { } var init_GetRemoteSummary = __esm({ "src/lib/responses/GetRemoteSummary.ts"() { + "use strict"; init_utils(); } }); @@ -17421,7 +18112,7 @@ __export(remote_exports, { remoteTask: () => remoteTask, removeRemoteTask: () => removeRemoteTask }); -function addRemoteTask(remoteName, remoteRepo, customArgs = []) { +function addRemoteTask(remoteName, remoteRepo, customArgs) { return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]); } function getRemotesTask(verbose) { @@ -17435,14 +18126,14 @@ function getRemotesTask(verbose) { parser: verbose ? parseGetRemotesVerbose : parseGetRemotes }; } -function listRemotesTask(customArgs = []) { +function listRemotesTask(customArgs) { const commands = [...customArgs]; if (commands[0] !== "ls-remote") { commands.unshift("ls-remote"); } return straightThroughStringTask(commands); } -function remoteTask(customArgs = []) { +function remoteTask(customArgs) { const commands = [...customArgs]; if (commands[0] !== "remote") { commands.unshift("remote"); @@ -17454,6 +18145,7 @@ function removeRemoteTask(remoteName) { } var init_remote = __esm({ "src/lib/tasks/remote.ts"() { + "use strict"; init_GetRemoteSummary(); init_task(); } @@ -17467,7 +18159,11 @@ __export(stash_list_exports, { function stashListTask(opt = {}, customArgs) { const options = parseLogOptions(opt); const commands = ["stash", "list", ...options.commands, ...customArgs]; - const parser3 = createListLogSummaryParser(options.splitter, options.fields, logFormatFromCommand(commands)); + const parser3 = createListLogSummaryParser( + options.splitter, + options.fields, + logFormatFromCommand(commands) + ); return validateLogFormatConfig(commands) || { commands, format: "utf-8", @@ -17476,6 +18172,7 @@ function stashListTask(opt = {}, customArgs) { } var init_stash_list = __esm({ "src/lib/tasks/stash-list.ts"() { + "use strict"; init_log_format(); init_parse_list_log_summary(); init_diff(); @@ -17509,6 +18206,7 @@ function updateSubModuleTask(customArgs) { } var init_sub_module = __esm({ "src/lib/tasks/sub-module.ts"() { + "use strict"; init_task(); } }); @@ -17537,6 +18235,7 @@ function toNumber(input) { var TagList, parseTagList; var init_TagList = __esm({ "src/lib/responses/TagList.ts"() { + "use strict"; TagList = class { constructor(all, latest) { this.all = all; @@ -17604,6 +18303,7 @@ function addAnnotatedTagTask(name, tagMessage) { } var init_tag = __esm({ "src/lib/tasks/tag.ts"() { + "use strict"; init_TagList(); } }); @@ -17611,6 +18311,7 @@ var init_tag = __esm({ // src/git.js var require_git = __commonJS({ "src/git.js"(exports2, module2) { + "use strict"; var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports)); var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports)); var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports)); @@ -17660,12 +18361,17 @@ var require_git = __commonJS({ var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports)); var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports)); function Git2(options, plugins) { - this._executor = new GitExecutor2(options.binary, options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins); + this._plugins = plugins; + this._executor = new GitExecutor2( + options.baseDir, + new Scheduler2(options.maxConcurrentProcesses), + plugins + ); this._trimmed = options.trimmed; } (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2; Git2.prototype.customBinary = function(command) { - this._executor.binary = command; + this._plugins.reconfigure("binary", command); return this; }; Git2.prototype.env = function(name, value) { @@ -17677,7 +18383,13 @@ var require_git = __commonJS({ return this; }; Git2.prototype.stashList = function(options) { - return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments)); + return this._runTask( + stashListTask2( + trailingOptionsArgument2(arguments) || {}, + filterArray2(options) && options || [] + ), + trailingFunctionArgument2(arguments) + ); }; function createCloneTask(api, task, repoPath, localPath) { if (typeof repoPath !== "string") { @@ -17686,10 +18398,16 @@ var require_git = __commonJS({ return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments)); } Git2.prototype.clone = function() { - return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments)); + return this._runTask( + createCloneTask("clone", cloneTask2, ...arguments), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.mirror = function() { - return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments)); + return this._runTask( + createCloneTask("mirror", cloneMirrorTask2, ...arguments), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.mv = function(from, to) { return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments)); @@ -17703,46 +18421,86 @@ var require_git = __commonJS({ }); }; Git2.prototype.pull = function(remote, branch, options, then) { - return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + pullTask2( + filterType2(remote, filterString2), + filterType2(branch, filterString2), + getTrailingOptions2(arguments) + ), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.fetch = function(remote, branch) { - return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + fetchTask2( + filterType2(remote, filterString2), + filterType2(branch, filterString2), + getTrailingOptions2(arguments) + ), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.silent = function(silence) { - console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"); + console.warn( + "simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3" + ); return this; }; Git2.prototype.tags = function(options, then) { - return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + tagListTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.rebase = function() { - return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.reset = function(mode) { - return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.revert = function(commit) { const next = trailingFunctionArgument2(arguments); if (typeof commit !== "string") { return this._runTask(configurationErrorTask2("Commit must be a string"), next); } - return this._runTask(straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), next); + return this._runTask( + straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), + next + ); }; Git2.prototype.addTag = function(name) { const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name"); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) { - return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments)); + return this._runTask( + addAnnotatedTagTask2(tagName, tagMessage), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) { - return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); + return this._runTask( + deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) { - return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); + return this._runTask( + deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.branch = function(options, then) { - return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + branchTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.branchLocal = function(then) { return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments)); @@ -17759,7 +18517,10 @@ var require_git = __commonJS({ command.push(...getTrailingOptions2(arguments, 0, true)); var next = trailingFunctionArgument2(arguments); if (!command.length) { - return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next); + return this._runTask( + configurationErrorTask2("Raw: must supply one or more command to execute"), + next + ); } return this._runTask(straightThroughStringTask2(command, this._trimmed), next); }; @@ -17767,19 +18528,34 @@ var require_git = __commonJS({ return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments)); }; Git2.prototype.submoduleUpdate = function(args, then) { - return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); + return this._runTask( + updateSubModuleTask2(getTrailingOptions2(arguments, true)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.submoduleInit = function(args, then) { - return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); + return this._runTask( + initSubModuleTask2(getTrailingOptions2(arguments, true)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.subModule = function(options, then) { - return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + subModuleTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.listRemote = function() { - return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + listRemotesTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.addRemote = function(remoteName, remoteRepo, then) { - return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.removeRemote = function(remoteName, then) { return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments)); @@ -17788,7 +18564,10 @@ var require_git = __commonJS({ return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments)); }; Git2.prototype.remote = function(options, then) { - return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + remoteTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.tag = function(options, then) { const command = getTrailingOptions2(arguments); @@ -17798,17 +18577,29 @@ var require_git = __commonJS({ return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments)); }; Git2.prototype.updateServerInfo = function(then) { - return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["update-server-info"]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.pushTags = function(remote, then) { - const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments)); + const task = pushTagsTask2( + { remote: filterType2(remote, filterString2) }, + getTrailingOptions2(arguments) + ); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.rm = function(files) { - return this._runTask(straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.rmKeepLocal = function(files) { - return this._runTask(straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.catFile = function(options, then) { return this._catFile("utf-8", arguments); @@ -17821,7 +18612,10 @@ var require_git = __commonJS({ var command = ["cat-file"]; var options = args[0]; if (typeof options === "string") { - return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler); + return this._runTask( + configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), + handler + ); } if (Array.isArray(options)) { command.push.apply(command, options); @@ -17830,25 +18624,38 @@ var require_git = __commonJS({ return this._runTask(task, handler); }; Git2.prototype.diff = function(options, then) { - const task = filterString2(options) ? configurationErrorTask2("git.diff: supplying options as a single string is no longer supported, switch to an array of strings") : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]); + const task = filterString2(options) ? configurationErrorTask2( + "git.diff: supplying options as a single string is no longer supported, switch to an array of strings" + ) : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.diffSummary = function() { - return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments)); + return this._runTask( + diffSummaryTask2(getTrailingOptions2(arguments, 1)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.applyPatch = function(patches) { - const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(`git.applyPatch requires one or more string patches as the first argument`) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1))); + const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2( + `git.applyPatch requires one or more string patches as the first argument` + ) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1))); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.revparse = function() { const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)]; - return this._runTask(straightThroughStringTask2(commands, true), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(commands, true), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.clean = function(mode, options, then) { const usingCleanOptionsArray = isCleanOptionsArray2(mode); const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || ""; const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0)); - return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments)); + return this._runTask( + cleanWithOptionsTask2(cleanMode, customArgs), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.exec = function(then) { const task = { @@ -17866,10 +18673,16 @@ var require_git = __commonJS({ return this; }; Git2.prototype.checkIgnore = function(pathnames, then) { - return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments)); + return this._runTask( + checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.checkIsRepo = function(checkType, then) { - return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments)); + return this._runTask( + checkIsRepoTask2(filterType2(checkType, filterString2)), + trailingFunctionArgument2(arguments) + ); }; module2.exports = Git2; } @@ -17892,10 +18705,17 @@ function gitExportFactory(factory) { return Object.assign(factory.bind(null), api_exports); } function gitInstanceFactory(baseDir, options) { + var _a2; const plugins = new PluginStore(); - const config = createInstanceConfig(baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, options); + const config = createInstanceConfig( + baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, + options + ); if (!folderExists(config.baseDir)) { - throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`); + throw new GitConstructError( + config, + `Cannot use simple-git on a directory that does not exist` + ); } if (Array.isArray(config.config)) { plugins.add(commandConfigPrefixingPlugin(config.config)); @@ -17909,11 +18729,13 @@ function gitInstanceFactory(baseDir, options) { config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions)); plugins.add(errorDetectionPlugin(errorDetectionHandler(true))); config.errors && plugins.add(errorDetectionPlugin(config.errors)); + customBinaryPlugin(plugins, config.binary, (_a2 = config.unsafe) == null ? void 0 : _a2.allowUnsafeCustomBinary); return new Git(config, plugins); } var Git; var init_git_factory = __esm({ "src/lib/git-factory.ts"() { + "use strict"; init_api(); init_plugins(); init_suffix_paths_plugin(); @@ -17941,22 +18763,27 @@ function gitP(...args) { function chainReturn() { return chain; } - const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce((api, name) => { - const isAsync = functionNamesPromiseApi.includes(name); - const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api); - const alternative = isAsync ? chainReturn : builderReturn; - Object.defineProperty(api, name, { - enumerable: false, - configurable: false, - value: git ? valid : alternative - }); - return api; - }, {}); + const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce( + (api, name) => { + const isAsync = functionNamesPromiseApi.includes(name); + const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api); + const alternative = isAsync ? chainReturn : builderReturn; + Object.defineProperty(api, name, { + enumerable: false, + configurable: false, + value: git ? valid : alternative + }); + return api; + }, + {} + ); return promiseApi; function asyncWrapper(fn, git2) { return function(...args2) { if (typeof args2[args2.length] === "function") { - throw new TypeError("Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to " + fn); + throw new TypeError( + "Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to " + fn + ); } return chain.then(function() { return new Promise(function(resolve, reject) { @@ -17991,6 +18818,7 @@ function toError(error) { var functionNamesBuilderApi, functionNamesPromiseApi; var init_promise_wrapped = __esm({ "src/lib/runners/promise-wrapped.ts"() { + "use strict"; init_git_response_error(); init_git_factory(); functionNamesBuilderApi = ["customBinary", "env", "outputHandler", "silent"]; @@ -30270,6 +31098,9 @@ function httpRedirectFetch (fetchParams, response) { // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name request.headersList.delete('authorization') + // https://fetch.spec.whatwg.org/#authentication-entries + request.headersList.delete('proxy-authorization', true) + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. request.headersList.delete('cookie') request.headersList.delete('host') @@ -42124,7 +42955,7 @@ Dicer.prototype._write = function (data, encoding, cb) { if (this._headerFirst && this._isPreamble) { if (!this._part) { this._part = new PartStream(this._partOpts) - if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() } + if (this.listenerCount('preamble') !== 0) { this.emit('preamble', this._part) } else { this._ignore() } } const r = this._hparser.push(data) if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() } @@ -42181,7 +43012,7 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { } } if (this._dashes === 2) { - if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) } + if ((start + i) < end && this.listenerCount('trailer') !== 0) { this.emit('trailer', data.slice(start + i, end)) } this.reset() this._finished = true // no more parts will be added @@ -42199,7 +43030,13 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { this._part._read = function (n) { self._unpause() } - if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() } + if (this._isPreamble && this.listenerCount('preamble') !== 0) { + this.emit('preamble', this._part) + } else if (this._isPreamble !== true && this.listenerCount('part') !== 0) { + this.emit('part', this._part) + } else { + this._ignore() + } if (!this._isPreamble) { this._inHeader = true } } if (data && start < end && !this._ignoreData) { @@ -42882,7 +43719,7 @@ function Multipart (boy, cfg) { ++nfiles - if (!boy._events.file) { + if (boy.listenerCount('file') === 0) { self.parser._ignore() return } @@ -43411,7 +44248,7 @@ const decoders = { if (textDecoders.has(this.toString())) { try { return textDecoders.get(this).decode(data) - } catch (e) { } + } catch {} } return typeof data === 'string' ? data diff --git a/lib/cli/index.js b/lib/cli/index.js index 864a109..be5b8ba 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -1844,7 +1844,7 @@ class HttpClient { if (this._keepAlive && useProxy) { agent = this._proxyAgent; } - if (this._keepAlive && !useProxy) { + if (!useProxy) { agent = this._agent; } // if agent is already assigned use that agent. @@ -1876,16 +1876,12 @@ class HttpClient { 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) { + // if tunneling agent isn't assigned create a new agent + if (!agent) { const options = { keepAlive: this._keepAlive, maxSockets }; agent = usingSsl ? new https.Agent(options) : new http.Agent(options); this._agent = agent; } - // if not using private agent and tunnel agent isn't setup then use global agent - if (!agent) { - agent = usingSsl ? https.globalAgent : http.globalAgent; - } if (usingSsl && this._ignoreSslError) { // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options @@ -2778,7 +2774,29 @@ exports.commitRules = void 0; const diagnose_it_1 = __nccwpck_require__(4657); const chalk_1 = __importDefault(__nccwpck_require__(8818)); const commit_1 = __nccwpck_require__(8065); +/** + * Checks whether the provided string is a noun. + * A noun is defined as a single word which can be capitalized or contain hyphens, therefore + * it will not support multi-word nouns (i.e. New York). + * + * @param str String to check + * @returns True if the string is a noun, false otherwise. + * + * @internal + */ function isNoun(str) { + return /^[A-Za-z][a-z]*(-[A-Za-z][a-z]*)*$/.test(str); +} +/** + * Validates whether the provided type valid. + * A valid type is defined as a single word, all lowercase, no spaces, and no special characters. + * + * @param str String to check + * @returns True if the string is a valid type, false otherwise. + * + * @internal + */ +function isValidType(str) { return !str.trim().includes(" ") && !/[^a-z]/i.test(str.trim()); } function highlightString(str, substring) { @@ -2830,9 +2848,10 @@ class CC01 { // Validated with EC-02 } else { - // Ensure that we have a noun - if (!isNoun(commit.type.value)) + // Ensure that we have a valid type (single word, no spaces, no special characters) + if (!isValidType(commit.type.value)) { errors.push(createDiagnosticsMessage(commit, this.description, "which consists of a noun", "type")); + } // Validate for spacing after the type if (commit.type.value.trim() !== commit.type.value) { if (commit.scope.value) { @@ -2993,7 +3012,7 @@ class EC02 { const expectedTypes = ["feat", "fix", ...Array.from(uniqueAddedTypes)]; this.description = `Commits ${uniqueAddedTypes.size > 0 ? "MUST" : "MAY"} be prefixed with a type, which consists of one of the configured values (${expectedTypes.join(", ")}).`; if (commit.type.value === undefined || - !isNoun(commit.type.value) || + !isValidType(commit.type.value) || expectedTypes.includes(commit.type.value.toLowerCase().trimEnd())) { return []; } @@ -4489,7 +4508,7 @@ var import_graphql = __nccwpck_require__(8467); var import_auth_token = __nccwpck_require__(334); // pkg/dist-src/version.js -var VERSION = "5.0.2"; +var VERSION = "5.1.0"; // pkg/dist-src/index.js var noop = () => { @@ -5198,7 +5217,7 @@ __export(dist_src_exports, { module.exports = __toCommonJS(dist_src_exports); // pkg/dist-src/version.js -var VERSION = "9.1.5"; +var VERSION = "9.2.1"; // pkg/dist-src/normalize-paginated-list-response.js function normalizePaginatedListResponse(response) { @@ -5359,6 +5378,8 @@ var paginatingEndpoints = [ "GET /orgs/{org}/members/{username}/codespaces", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", + "GET /orgs/{org}/organization-roles/{role_id}/teams", + "GET /orgs/{org}/organization-roles/{role_id}/users", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", @@ -5595,7 +5616,7 @@ __export(dist_src_exports, { module.exports = __toCommonJS(dist_src_exports); // pkg/dist-src/version.js -var VERSION = "10.2.0"; +var VERSION = "10.4.1"; // pkg/dist-src/generated/endpoints.js var Endpoints = { @@ -5722,6 +5743,9 @@ var Endpoints = { "GET /repos/{owner}/{repo}/actions/permissions/selected-actions" ], getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + getCustomOidcSubClaimForRepo: [ + "GET /repos/{owner}/{repo}/actions/oidc/customization/sub" + ], getEnvironmentPublicKey: [ "GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key" ], @@ -5874,6 +5898,9 @@ var Endpoints = { setCustomLabelsForSelfHostedRunnerForRepo: [ "PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels" ], + setCustomOidcSubClaimForRepo: [ + "PUT /repos/{owner}/{repo}/actions/oidc/customization/sub" + ], setGithubActionsDefaultWorkflowPermissionsOrganization: [ "PUT /orgs/{org}/actions/permissions/workflow" ], @@ -5943,6 +5970,7 @@ var Endpoints = { listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"], markNotificationsAsRead: ["PUT /notifications"], markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"], + markThreadAsDone: ["DELETE /notifications/threads/{thread_id}"], markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"], setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"], setThreadSubscription: [ @@ -6219,10 +6247,10 @@ var Endpoints = { updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"] }, copilot: { - addCopilotForBusinessSeatsForTeams: [ + addCopilotSeatsForTeams: [ "POST /orgs/{org}/copilot/billing/selected_teams" ], - addCopilotForBusinessSeatsForUsers: [ + addCopilotSeatsForUsers: [ "POST /orgs/{org}/copilot/billing/selected_users" ], cancelCopilotSeatAssignmentForTeams: [ @@ -6535,10 +6563,24 @@ var Endpoints = { } ] }, + oidc: { + getOidcCustomSubTemplateForOrg: [ + "GET /orgs/{org}/actions/oidc/customization/sub" + ], + updateOidcCustomSubTemplateForOrg: [ + "PUT /orgs/{org}/actions/oidc/customization/sub" + ] + }, orgs: { addSecurityManagerTeam: [ "PUT /orgs/{org}/security-managers/teams/{team_slug}" ], + assignTeamToOrgRole: [ + "PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}" + ], + assignUserToOrgRole: [ + "PUT /orgs/{org}/organization-roles/users/{username}/{role_id}" + ], blockUser: ["PUT /orgs/{org}/blocks/{username}"], cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"], checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"], @@ -6547,6 +6589,7 @@ var Endpoints = { convertMemberToOutsideCollaborator: [ "PUT /orgs/{org}/outside_collaborators/{username}" ], + createCustomOrganizationRole: ["POST /orgs/{org}/organization-roles"], createInvitation: ["POST /orgs/{org}/invitations"], createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"], createOrUpdateCustomPropertiesValuesForRepos: [ @@ -6557,6 +6600,9 @@ var Endpoints = { ], createWebhook: ["POST /orgs/{org}/hooks"], delete: ["DELETE /orgs/{org}"], + deleteCustomOrganizationRole: [ + "DELETE /orgs/{org}/organization-roles/{role_id}" + ], deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], enableOrDisableSecurityProductOnAllOrgRepos: [ "POST /orgs/{org}/{security_product}/{enablement}" @@ -6568,6 +6614,7 @@ var Endpoints = { ], getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], + getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"], getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"], getWebhookDelivery: [ @@ -6583,6 +6630,12 @@ var Endpoints = { listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], listMembers: ["GET /orgs/{org}/members"], listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"], + listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"], + listOrgRoleUsers: ["GET /orgs/{org}/organization-roles/{role_id}/users"], + listOrgRoles: ["GET /orgs/{org}/organization-roles"], + listOrganizationFineGrainedPermissions: [ + "GET /orgs/{org}/organization-fine-grained-permissions" + ], listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"], listPatGrantRepositories: [ "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories" @@ -6597,6 +6650,9 @@ var Endpoints = { listSecurityManagerTeams: ["GET /orgs/{org}/security-managers"], listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"], listWebhooks: ["GET /orgs/{org}/hooks"], + patchCustomOrganizationRole: [ + "PATCH /orgs/{org}/organization-roles/{role_id}" + ], pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"], redeliverWebhookDelivery: [ "POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts" @@ -6621,6 +6677,18 @@ var Endpoints = { reviewPatGrantRequestsInBulk: [ "POST /orgs/{org}/personal-access-token-requests" ], + revokeAllOrgRolesTeam: [ + "DELETE /orgs/{org}/organization-roles/teams/{team_slug}" + ], + revokeAllOrgRolesUser: [ + "DELETE /orgs/{org}/organization-roles/users/{username}" + ], + revokeOrgRoleTeam: [ + "DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}" + ], + revokeOrgRoleUser: [ + "DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}" + ], setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"], setPublicMembershipForAuthenticatedUser: [ "PUT /orgs/{org}/public_members/{username}" @@ -6911,6 +6979,9 @@ var Endpoints = { {}, { mapToData: "users" } ], + cancelPagesDeployment: [ + "POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel" + ], checkAutomatedSecurityFixes: [ "GET /repos/{owner}/{repo}/automated-security-fixes" ], @@ -6946,12 +7017,15 @@ var Endpoints = { createForAuthenticatedUser: ["POST /user/repos"], createFork: ["POST /repos/{owner}/{repo}/forks"], createInOrg: ["POST /orgs/{org}/repos"], + createOrUpdateCustomPropertiesValues: [ + "PATCH /repos/{owner}/{repo}/properties/values" + ], createOrUpdateEnvironment: [ "PUT /repos/{owner}/{repo}/environments/{environment_name}" ], createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"], createOrgRuleset: ["POST /orgs/{org}/rulesets"], - createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployment"], + createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployments"], createPagesSite: ["POST /repos/{owner}/{repo}/pages"], createRelease: ["POST /repos/{owner}/{repo}/releases"], createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"], @@ -7104,6 +7178,9 @@ var Endpoints = { getOrgRulesets: ["GET /orgs/{org}/rulesets"], getPages: ["GET /repos/{owner}/{repo}/pages"], getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"], + getPagesDeployment: [ + "GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}" + ], getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"], getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"], getPullRequestReviewProtection: [ @@ -7314,6 +7391,9 @@ var Endpoints = { ] }, securityAdvisories: { + createFork: [ + "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks" + ], createPrivateVulnerabilityReport: [ "POST /repos/{owner}/{repo}/security-advisories/reports" ], @@ -7805,7 +7885,7 @@ var import_endpoint = __nccwpck_require__(9440); var import_universal_user_agent = __nccwpck_require__(5030); // pkg/dist-src/version.js -var VERSION = "8.1.6"; +var VERSION = "8.2.0"; // pkg/dist-src/is-plain-object.js function isPlainObject(value) { @@ -7949,11 +8029,17 @@ async function getResponseData(response) { function toErrorMessage(data) { if (typeof data === "string") return data; + let suffix; + if ("documentation_url" in data) { + suffix = ` - ${data.documentation_url}`; + } else { + suffix = ""; + } if ("message" in data) { if (Array.isArray(data.errors)) { - return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}`; + return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}${suffix}`; } - return data.message; + return `${data.message}${suffix}`; } return `Unknown error: ${JSON.stringify(data)}`; } @@ -11008,6 +11094,8 @@ Diff.prototype = { /*istanbul ignore end*/ diff: function diff(oldString, newString) { /*istanbul ignore start*/ + var _options$timeout; + var /*istanbul ignore end*/ options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -11046,68 +11134,104 @@ Diff.prototype = { maxEditLength = Math.min(maxEditLength, options.maxEditLength); } + var maxExecutionTime = + /*istanbul ignore start*/ + (_options$timeout = + /*istanbul ignore end*/ + options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; + var abortAfterTimestamp = Date.now() + maxExecutionTime; var bestPath = [{ - newPos: -1, - components: [] + oldPos: -1, + lastComponent: undefined }]; // Seed editLength = 0, i.e. the content starts with the same values - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { + if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // Identity per the equality and tokenizer return done([{ value: this.join(newString), count: newString.length }]); - } // Main worker method. checks all permutations of a given edit length for acceptance. - + } // Once we hit the right edge of the edit graph on some diagonal k, we can + // definitely reach the end of the edit graph in no more than k edits, so + // there's no point in considering any moves to diagonal k+1 any more (from + // which we're guaranteed to need at least k+1 more edits). + // Similarly, once we've reached the bottom of the edit graph, there's no + // point considering moves to lower diagonals. + // We record this fact by setting minDiagonalToConsider and + // maxDiagonalToConsider to some finite value once we've hit the edge of + // the edit graph. + // This optimization is not faithful to the original algorithm presented in + // Myers's paper, which instead pointlessly extends D-paths off the end of + // the edit graph - see page 7 of Myers's paper which notes this point + // explicitly and illustrates it with a diagram. This has major performance + // implications for some common scenarios. For instance, to compute a diff + // where the new text simply appends d characters on the end of the + // original text of length n, the true Myers algorithm will take O(n+d^2) + // time while this optimization needs only O(n+d) time. + + + var minDiagonalToConsider = -Infinity, + maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { + for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { var basePath = /*istanbul ignore start*/ void 0 /*istanbul ignore end*/ ; + var removePath = bestPath[diagonalPath - 1], + addPath = bestPath[diagonalPath + 1]; - var addPath = bestPath[diagonalPath - 1], - removePath = bestPath[diagonalPath + 1], - _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - - if (addPath) { + if (removePath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } - var canAdd = addPath && addPath.newPos + 1 < newLen, - canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; + var canAdd = false; + + if (addPath) { + // what newPos will be after we do an insertion: + var addPathNewPos = addPath.oldPos - diagonalPath; + canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; + } + + var canRemove = removePath && removePath.oldPos + 1 < oldLen; if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; } // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin + // path whose position in the old string is the farthest from the origin // and does not pass the bounds of the diff graph + // TODO: Remove the `+ 1` here to make behavior match Myers algorithm + // and prefer to order removals before insertions. - if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { - basePath = clonePath(removePath); - self.pushComponent(basePath.components, undefined, true); + if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) { + basePath = self.addToPath(addPath, true, undefined, 0); } else { - basePath = addPath; // No need to clone, we've pulled it from the list - - basePath.newPos++; - self.pushComponent(basePath.components, true, undefined); + basePath = self.addToPath(removePath, undefined, true, 1); } - _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath); - if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { - return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); + if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // If we have hit the end of both strings, then we are done + return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); } else { - // Otherwise track this path as a potential candidate and continue. bestPath[diagonalPath] = basePath; + + if (basePath.oldPos + 1 >= oldLen) { + maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); + } + + if (newPos + 1 >= newLen) { + minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); + } } } @@ -11121,7 +11245,7 @@ Diff.prototype = { if (callback) { (function exec() { setTimeout(function () { - if (editLength > maxEditLength) { + if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { return callback(); } @@ -11131,7 +11255,7 @@ Diff.prototype = { }, 0); })(); } else { - while (editLength <= maxEditLength) { + while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { var ret = execEditLength(); if (ret) { @@ -11144,23 +11268,29 @@ Diff.prototype = { /*istanbul ignore start*/ /*istanbul ignore end*/ - pushComponent: function pushComponent(components, added, removed) { - var last = components[components.length - 1]; + addToPath: function addToPath(path, added, removed, oldPosInc) { + var last = path.lastComponent; if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length - 1] = { - count: last.count + 1, - added: added, - removed: removed + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: last.count + 1, + added: added, + removed: removed, + previousComponent: last.previousComponent + } }; } else { - components.push({ - count: 1, - added: added, - removed: removed - }); + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: 1, + added: added, + removed: removed, + previousComponent: last + } + }; } }, @@ -11170,8 +11300,8 @@ Diff.prototype = { extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, commonCount = 0; while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { @@ -11181,13 +11311,14 @@ Diff.prototype = { } if (commonCount) { - basePath.components.push({ - count: commonCount - }); + basePath.lastComponent = { + count: commonCount, + previousComponent: basePath.lastComponent + }; } - basePath.newPos = newPos; - return oldPos; + basePath.oldPos = oldPos; + return newPos; }, /*istanbul ignore start*/ @@ -11238,7 +11369,20 @@ Diff.prototype = { } }; -function buildValues(diff, components, newString, oldString, useLongestToken) { +function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { + // First we convert our linked list of components in reverse order to an + // array in the right order: + var components = []; + var nextComponent; + + while (lastComponent) { + components.push(lastComponent); + nextComponent = lastComponent.previousComponent; + delete lastComponent.previousComponent; + lastComponent = nextComponent; + } + + components.reverse(); var componentPos = 0, componentLen = components.length, newPos = 0, @@ -11281,23 +11425,16 @@ function buildValues(diff, components, newString, oldString, useLongestToken) { // This is only available for string mode. - var lastComponent = components[componentLen - 1]; + var finalComponent = components[componentLen - 1]; - if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { - components[componentLen - 2].value += lastComponent.value; + if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) { + components[componentLen - 2].value += finalComponent.value; components.pop(); } return components; } - -function clonePath(path) { - return { - newPos: path.newPos, - components: path.components.slice(0) - }; -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2siLCJzZWxmIiwiZG9uZSIsInZhbHVlIiwic2V0VGltZW91dCIsInVuZGVmaW5lZCIsImNhc3RJbnB1dCIsInJlbW92ZUVtcHR5IiwidG9rZW5pemUiLCJuZXdMZW4iLCJsZW5ndGgiLCJvbGRMZW4iLCJlZGl0TGVuZ3RoIiwibWF4RWRpdExlbmd0aCIsIk1hdGgiL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lcm1pbmFsIGludG8gdGhlIHByaW9yIHN0cmluZyBhbmQgZHJvcCB0aGUgY2hhbmdlLlxuICAvLyBUaGlzIGlzIG9ubHkgYXZhaWxhYmxlIGZvciBzdHJpbmcgbW9kZS5cbiAgbGV0IGxhc3RDb21wb25lbnQgPSBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDFdO1xuICBpZiAoY29tcG9uZW50TGVuID4gMVxuICAgICAgJiYgdHlwZW9mIGxhc3RDb21wb25lbnQudmFsdWUgPT09ICdzdHJpbmcnXG4gICAgICAmJiAobGFzdENvbXBvbmVudC5hZGRlZCB8fCBsYXN0Q29tcG9uZW50LnJlbW92ZWQpXG4gICAgICAmJiBkaWZmLmVxdWFscygnJywgbGFzdENvbXBvbmVudC52YWx1ZSkpIHtcbiAgICBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDJdLnZhbHVlICs9IGxhc3RDb21wb25lbnQudmFsdWU7XG4gICAgY29tcG9uZW50cy5wb3AoKTtcbiAgfVxuXG4gIHJldHVybiBjb21wb25lbnRzO1xufVxuXG5mdW5jdGlvbiBjbG9uZVBhdGgocGF0aCkge1xuICByZXR1cm4geyBuZXdQb3M6IHBhdGgubmV3UG9zLCBjb21wb25lbnRzOiBwYXRoLmNvbXBvbmVudHMuc2xpY2UoMCkgfTtcbn1cbiJdfQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2siLCJzZWxmIiwiZG9uZSIsInZhbHVlIiwic2V0VGltZW91dCIsInVuZGVmaW5lZCIsImNhc3RJbnB1dCIsInJlbW92ZUVtcHR5IiwidG9rZW5pemUiLCJuZXdMZW4iLCJsZW5ndGgiLCJvbGRMZW4iLCJ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kZGVkKSB7XG4gICAgICAgIGxldCB0bXAgPSBjb21wb25lbnRzW2NvbXBvbmVudFBvcyAtIDFdO1xuICAgICAgICBjb21wb25lbnRzW2NvbXBvbmVudFBvcyAtIDFdID0gY29tcG9uZW50c1tjb21wb25lbnRQb3NdO1xuICAgICAgICBjb21wb25lbnRzW2NvbXBvbmVudFBvc10gPSB0bXA7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgLy8gU3BlY2lhbCBjYXNlIGhhbmRsZSBmb3Igd2hlbiBvbmUgdGVybWluYWwgaXMgaWdub3JlZCAoaS5lLiB3aGl0ZXNwYWNlKS5cbiAgLy8gRm9yIHRoaXMgY2FzZSB3ZSBtZXJnZSB0aGUgdGVybWluYWwgaW50byB0aGUgcHJpb3Igc3RyaW5nIGFuZCBkcm9wIHRoZSBjaGFuZ2UuXG4gIC8vIFRoaXMgaXMgb25seSBhdmFpbGFibGUgZm9yIHN0cmluZyBtb2RlLlxuICBsZXQgZmluYWxDb21wb25lbnQgPSBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDFdO1xuICBpZiAoY29tcG9uZW50TGVuID4gMVxuICAgICAgJiYgdHlwZW9mIGZpbmFsQ29tcG9uZW50LnZhbHVlID09PSAnc3RyaW5nJ1xuICAgICAgJiYgKGZpbmFsQ29tcG9uZW50LmFkZGVkIHx8IGZpbmFsQ29tcG9uZW50LnJlbW92ZWQpXG4gICAgICAmJiBkaWZmLmVxdWFscygnJywgZmluYWxDb21wb25lbnQudmFsdWUpKSB7XG4gICAgY29tcG9uZW50c1tjb21wb25lbnRMZW4gLSAyXS52YWx1ZSArPSBmaW5hbENvbXBvbmVudC52YWx1ZTtcbiAgICBjb21wb25lbnRzLnBvcCgpO1xuICB9XG5cbiAgcmV0dXJuIGNvbXBvbmVudHM7XG59XG4iXX0= /***/ }), @@ -11612,6 +11749,11 @@ exports.lineDiff = lineDiff; /*istanbul ignore end*/ lineDiff.tokenize = function (value) { + if (this.options.stripTrailingCr) { + // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior + value = value.replace(/\r\n/g, '\n'); + } + var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line @@ -11659,7 +11801,7 @@ function diffTrimmedLines(oldStr, newStr, callback) { }); return lineDiff.diff(oldStr, newStr, options); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOlsibGluZURpZmYiLCJEaWZmIiwidG9rZW5pemUiLCJ2YWx1ZSIsInJldExpbmVzIiwibGluZXNBbmROZXdsaW5lcyIsInNwbGl0IiwibGVuZ3RoIiwicG9wIiwiaSIsImxpbmUiLCJvcHRpb25zIiwibmV3bGluZUlzVG9rZW4iLCJpZ25vcmVXaGl0ZXNwYWNlIiwidHJpbSIsInB1c2giLCJkaWZmTGluZXMiLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiLCJkaWZmVHJpbW1lZExpbmVzIiwiZ2VuZXJhdGVPcHRpb25zIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTs7Ozs7QUFFTyxJQUFNQSxRQUFRLEdBQUc7QUFBSUM7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUEsQ0FBSixFQUFqQjs7Ozs7O0FBQ1BELFFBQVEsQ0FBQ0UsUUFBVCxHQUFvQixVQUFTQyxLQUFULEVBQWdCO0FBQ2xDLE1BQUlDLFFBQVEsR0FBRyxFQUFmO0FBQUEsTUFDSUMsZ0JBQWdCLEdBQUdGLEtBQUssQ0FBQ0csS0FBTixDQUFZLFdBQVosQ0FEdkIsQ0FEa0MsQ0FJbEM7O0FBQ0EsTUFBSSxDQUFDRCxnQk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ndGggLSAxXSArPSBsaW5lO1xuICAgIH0gZWxzZSB7XG4gICAgICBpZiAodGhpcy5vcHRpb25zLmlnbm9yZVdoaXRlc3BhY2UpIHtcbiAgICAgICAgbGluZSA9IGxpbmUudHJpbSgpO1xuICAgICAgfVxuICAgICAgcmV0TGluZXMucHVzaChsaW5lKTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gcmV0TGluZXM7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZkxpbmVzKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjaykgeyByZXR1cm4gbGluZURpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spOyB9XG5leHBvcnQgZnVuY3Rpb24gZGlmZlRyaW1tZWRMaW5lcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHtcbiAgbGV0IG9wdGlvbnMgPSBnZW5lcmF0ZU9wdGlvbnMoY2FsbGJhY2ssIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbiJdfQ== /***/ }), @@ -11929,6 +12071,12 @@ Object.defineProperty(exports, "merge", ({ return _merge.merge; } })); +Object.defineProperty(exports, "reversePatch", ({ + enumerable: true, + get: function get() { + return _reverse.reversePatch; + } +})); Object.defineProperty(exports, "structuredPatch", ({ enumerable: true, get: function get() { @@ -11947,6 +12095,12 @@ Object.defineProperty(exports, "createPatch", ({ return _create.createPatch; } })); +Object.defineProperty(exports, "formatPatch", ({ + enumerable: true, + get: function get() { + return _create.formatPatch; + } +})); Object.defineProperty(exports, "convertChangesToDMP", ({ enumerable: true, get: function get() { @@ -12027,6 +12181,12 @@ _merge = __nccwpck_require__(2640) /*istanbul ignore end*/ ; +var +/*istanbul ignore start*/ +_reverse = __nccwpck_require__(1794) +/*istanbul ignore end*/ +; + var /*istanbul ignore start*/ _create = __nccwpck_require__(4543) @@ -12048,7 +12208,7 @@ _xml = __nccwpck_require__(6982) /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } /*istanbul ignore end*/ -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQWdCQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTs7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBRUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUVBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBRUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTs7QUFFQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUEiLCJzb3VyY2VzQ29udGVudCI6WyIvKiBTZWUgTElDRU5TRSBmaWxlIGZvciB0ZXJtcyBvZiB1c2UgKi9cblxuLypcbiAqIFRleHQgZGlmZiBpbXBsZW1lbnRh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@@ -12207,7 +12367,7 @@ function applyPatch(source, uniDiff) { var line = _hunk.lines[j], operation = line.length > 0 ? line[0] : ' ', content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters[j]; + delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n'; if (operation === ' ') { _toPos++; @@ -12294,7 +12454,7 @@ function applyPatches(uniDiff, options) { processIndex(); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJwYXJzZVBhdGNoIiwiQXJyYXkiLCJpc0FycmF5IiwibGVuZ3RoIiwiRXJyb3IiLCJsaW5lcyIsInNwbGl0IiwiZGVsaW1pdGVycyIsIm1hdGNoIiwiaHVua3MiLCJjb21wYXJlTGluZSIsImxpbmVOdW1iZXIiLCJsaW5lIiwib3BlcmF0aW9uIiwicGF0Y2hDb250ZW50IiwiZXJyb3JDb3VudCIsImZ1enpGYWN0b3IiLCJtaW5MaW5lIiwib2Zmc2V0IiwicmVtb3ZlRU9GTkwiLCJhZGRFT0ZOTCIsImh1bmtGaXRzIiwiaHVuayIsInRvUG9zIiwiaiIsImNvbnRlbnQiLCJzdWJzdHIiLCJpIiwibWF4TGluZSIsIm9sZExpbmVzIiwibG9jYWxPZmZzZXQiLCJvbGRTdGFydCIsIml0ZXJhdG9yIiwiZGlzdGFuY2VJdGVyYXRvciIsInVuZGVmaW5lZCIsImRpZmZPZmZzZXQiLCJuZXdMaW5lcyIsImRlbGltaXRlciIsImxpbmVkZWxpbWl0ZXJzIiwic3BsaWNlIiwicHJldmlvdXNPcGVyYXRpb24iLCJwb3AiLCJwdXNoIiwiX2siLCJqb2luIiwiYXBwbHlQYXRjaGVzIiwiY3VycmVudEluZGV4IiwicHJvY2Vzc0luZGV4IiwiaW5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gKiBDaGVja3MgaWYgdGhlIGh1bmsgZXhhY3RseSBmaXRzIG9uIHRoZSBwcm92aWRlZCBsb2NhdGlvblxuICAgKi9cbiAgZnVuY3Rpb24gaHVua0ZpdHMoaHVuaywgdG9Qb3MpIHtcbiAgICBmb3IgKGxldCBqID0gMDsgaiA8IGh1bmsubGluZXMubGVuZ3RoOyBqKyspIHtcbiAgICAgIGxldCBsaW5lID0gaHVuay5saW5lc1tqXSxcbiAgICAgICAgICBvcGVyYXRpb24gPSAobGluZS5sZW5ndGggPiAwID8gbGluZVswXSA6ICcgJyksXG4gICAgICAgICAgY29udGVudCA9IChsaW5lLmxlbmd0aCA+IDAgPyBsaW5lLnN1YnN0cigxKSA6IGxpbmUpO1xuXG4gICAgICBpZiAob3BlcmF0aW9uID09PSAnICcgfHwgb3BlcmF0aW9uID09PSAnLScpIHtcbiAgICAgICAgLy8gQ29udGV4dCBzYW5pdHkgY2hlY2tcbiAgICAgICAgaWYgKCFjb21wYXJlTGluZSh0b1BvcyArIDEsIGxpbmVzW3RvUG9zXSwgb3BlcmF0aW9uLCBjb250ZW50KSkge1xuICAgICAgICAgIGVycm9yQ291bnQrKztcblxuICAgICAgICAgIGlmIChlcnJvckNvdW50ID4gZnV6ekZhY3Rvcikge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0b1BvcysrO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB0cnVlO1xuICB9XG5cbiAgLy8gU2VhcmNoIGJlc3QgZml0IG9mZnNldHMgZm9yIGVhY2ggaHVuayBiYXNlZCBvbiB0aGUgcHJldmlvdXMgb25lc1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGh1bmtzLmxlbmd0aDsgaSsrKSB7XG4gICAgbGV0IGh1bmsgPSBodW5rc1tpXSxcbiAgICAgICAgbWF4TGluZSA9IGxpbmVzLmxlbmd0aCAtIGh1bmsub2xkTGluZXMsXG4gICAgIC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GlvbihlcnIsIGRhdGEpIHtcbiAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoZXJyKTtcbiAgICAgIH1cblxuICAgICAgbGV0IHVwZGF0ZWRDb250ZW50ID0gYXBwbHlQYXRjaChkYXRhLCBpbmRleCwgb3B0aW9ucyk7XG4gICAgICBvcHRpb25zLnBhdGNoZWQoaW5kZXgsIHVwZGF0ZWRDb250ZW50LCBmdW5jdGlvbihlcnIpIHtcbiAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKGVycik7XG4gICAgICAgIH1cblxuICAgICAgICBwcm9jZXNzSW5kZXgoKTtcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9XG4gIHByb2Nlc3NJbmRleCgpO1xufVxuIl19 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJwYXJzZVBhdGNoIiwiQXJyYXkiLCJpc0FycmF5IiwibGVuZ3RoIiwiRXJyb3IiLCJsaW5lcyIsInNwbGl0IiwiZGVsaW1pdGVycyIsIm1hdGNoIiwiaHVua3MiLCJjb21wYXJlTGluZSIsImxpbmVOdW1iZXIiLCJsaW5lIiwib3BlcmF0aW9uIiwicGF0Y2hDb250ZW50IiwiZXJyb3JDb3VudCIsImZ1enpGYWN0b3IiLCJtaW5MaW5lIiwib2Zmc2V0IiwicmVtb3ZlRU9GTkwiLCJhZGRFT0ZOTCIsImh1bmtGaXRzIiwiaHVuayIsInRvUG9zIiwiaiIsImNvbnRlbnQiLCJzdWJzdHIiLCJpIiwibWF4TGluZSIsIm9sZExpbmVzIiwibG9jYWxPZmZzZXQiLCJvbGRTdGFydCIsIml0ZXJhdG9yIiwi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lmZiA9PT0gJ3N0cmluZycpIHtcbiAgICB1bmlEaWZmID0gcGFyc2VQYXRjaCh1bmlEaWZmKTtcbiAgfVxuXG4gIGxldCBjdXJyZW50SW5kZXggPSAwO1xuICBmdW5jdGlvbiBwcm9jZXNzSW5kZXgoKSB7XG4gICAgbGV0IGluZGV4ID0gdW5pRGlmZltjdXJyZW50SW5kZXgrK107XG4gICAgaWYgKCFpbmRleCkge1xuICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoKTtcbiAgICB9XG5cbiAgICBvcHRpb25zLmxvYWRGaWxlKGluZGV4LCBmdW5jdGlvbihlcnIsIGRhdGEpIHtcbiAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoZXJyKTtcbiAgICAgIH1cblxuICAgICAgbGV0IHVwZGF0ZWRDb250ZW50ID0gYXBwbHlQYXRjaChkYXRhLCBpbmRleCwgb3B0aW9ucyk7XG4gICAgICBvcHRpb25zLnBhdGNoZWQoaW5kZXgsIHVwZGF0ZWRDb250ZW50LCBmdW5jdGlvbihlcnIpIHtcbiAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKGVycik7XG4gICAgICAgIH1cblxuICAgICAgICBwcm9jZXNzSW5kZXgoKTtcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9XG4gIHByb2Nlc3NJbmRleCgpO1xufVxuIl19 /***/ }), @@ -12537,6 +12697,10 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne } function formatPatch(diff) { + if (Array.isArray(diff)) { + return diff.map(formatPatch).join('\n'); + } + var ret = []; if (diff.oldFileName == diff.newFileName) { @@ -12574,7 +12738,7 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); } -//# sourceM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0xpbmVzID09PSAwKSB7XG4gICAgICBodW5rLm5ld1N0YXJ0IC09IDE7XG4gICAgfVxuICAgIHJldC5wdXNoKFxuICAgICAgJ0BAIC0nICsgaHVuay5vbGRTdGFydCArICcsJyArIGh1bmsub2xkTGluZXNcbiAgICAgICsgJyArJyArIGh1bmsubmV3U3RhcnQgKyAnLCcgKyBodW5rLm5ld0xpbmVzXG4gICAgICArICcgQEAnXG4gICAgKTtcbiAgICByZXQucHVzaC5hcHBseShyZXQsIGh1bmsubGluZXMpO1xuICB9XG5cbiAgcmV0dXJuIHJldC5qb2luKCdcXG4nKSArICdcXG4nO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlVHdvRmlsZXNQYXRjaChvbGRGaWxlTmFtZSwgbmV3RmlsZU5hbWUsIG9sZFN0ciwgbmV3U3RyLCBvbGRIZWFkZXIsIG5ld0hlYWRlciwgb3B0aW9ucykge1xuICByZXR1cm4gZm9ybWF0UGF0Y2goc3RydWN0dXJlZFBhdGNoKG9sZEZpbGVOYW1lLCBuZXdGaWxlTmFtZSwgb2xkU3RyLCBuZXdTdHIsIG9sZEhlYWRlciwgbmV3SGVhZGVyLCBvcHRpb25zKSk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBjcmVhdGVQYXRjaChmaWxlTmFtZSwgb2xkU3RyLCBuZXdTdHIsIG9sZEhlYWRlciwgbmV3SGVhZGVyLCBvcHRpb25zKSB7XG4gIHJldHVybiBjcmVhdGVUd29GaWxlc1BhdGNoKGZpbGVOYW1lLCBmaWxlTmFtZSwgb2xkU3RyLCBuZXdTdHIsIG9sZEhlYWRlciwgbmV3SGVhZGVyLCBvcHRpb25zKTtcbn1cbiJdfQ== /***/ }), @@ -13373,6 +13537,77 @@ function parsePatch(uniDiff) { //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9wYXJzZS5qcyJdLCJuYW1lcyI6Wy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pIDwgZGlmZnN0ci5sZW5ndGgpIHtcbiAgICBwYXJzZUluZGV4KCk7XG4gIH1cblxuICByZXR1cm4gbGlzdDtcbn1cbiJdfQ== +/***/ }), + +/***/ 1794: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +/*istanbul ignore start*/ + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.reversePatch = reversePatch; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/*istanbul ignore end*/ +function reversePatch(structuredPatch) { + if (Array.isArray(structuredPatch)) { + return structuredPatch.map(reversePatch).reverse(); + } + + return ( + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + structuredPatch), {}, { + oldFileName: structuredPatch.newFileName, + oldHeader: structuredPatch.newHeader, + newFileName: structuredPatch.oldFileName, + newHeader: structuredPatch.oldHeader, + hunks: structuredPatch.hunks.map(function (hunk) { + return { + oldLines: hunk.newLines, + oldStart: hunk.newStart, + newLines: hunk.oldLines, + newStart: hunk.oldStart, + linedelimiters: hunk.linedelimiters, + lines: hunk.lines.map(function (l) { + if (l.startsWith('-')) { + return ( + /*istanbul ignore start*/ + "+".concat( + /*istanbul ignore end*/ + l.slice(1)) + ); + } + + if (l.startsWith('+')) { + return ( + /*istanbul ignore start*/ + "-".concat( + /*istanbul ignore end*/ + l.slice(1)) + ); + } + + return l; + }) + }; + }) + }) + ); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9yZXZlcnNlLmpzIl0sIm5hbWVzIjpbInJldmVyc2VQYXRjaCIsInN0cnVjdHVyZWRQYXRjaCIsIkFycmF5IiwiaXNBcnJheSIsIm1hcCIsInJldmVyc2UiLCJvbGRGaWxlTmFtZSIsIm5ld0ZpbGVOYW1lIiwib2xkSGVhZGVyIiwibmV3SGVhZGVyIiwiaHVua3MiLCJodW5rIiwib2xkTGluZXMiLCJuZXdMaW5lcyIsIm9sZFN0YXJ0IiwibmV3U3RhcnQiLCJsaW5lZGVsaW1pdGVycyIsImxpbmVzIiwibCIsInN0YXJ0c1dpdGgiLCJzbGljZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7O0FBQU8sU0FBU0EsWUFBVCxDQUFzQkMsZUFBdEIsRUFBdUM7QUFDNUMsTUFBSUMsS0FBSyxDQUFDQyxPQUFOLENBQWNGLGVBQWQsQ0FBSixFQUFvQztBQUNsQyxXQUFPQSxlQUFlLENBQUNHLEdBQWhCLENBQW9CSixZQUFwQixFQUFrQ0ssT0FBbEMsRUFBUDtBQUNEOztBQUVEO0FBQUE7QUFBQTtBQUFBO0FBQ0tKLElBQUFBLGVBREw7QUFFRUssTUFBQUEsV0FBVyxFQUFFTCxlQUFlLENBQUNNLFdBRi9CO0FBR0VDLE1BQUFBLFNBQVMsRUFBRVAsZUFBZSxDQUFDUSxTQUg3QjtBQUlFRixNQUFBQSxXQUFXLEVBQUVOLGVBQWUsQ0FBQ0ssV0FKL0I7QUFLRUcsTUFBQUEsU0FBUyxFQUFFUixlQUFlLENBQUNPLFNBTDdCO0FBTU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VybiBzdHJ1Y3R1cmVkUGF0Y2gubWFwKHJldmVyc2VQYXRjaCkucmV2ZXJzZSgpO1xuICB9XG5cbiAgcmV0dXJuIHtcbiAgICAuLi5zdHJ1Y3R1cmVkUGF0Y2gsXG4gICAgb2xkRmlsZU5hbWU6IHN0cnVjdHVyZWRQYXRjaC5uZXdGaWxlTmFtZSxcbiAgICBvbGRIZWFkZXI6IHN0cnVjdHVyZWRQYXRjaC5uZXdIZWFkZXIsXG4gICAgbmV3RmlsZU5hbWU6IHN0cnVjdHVyZWRQYXRjaC5vbGRGaWxlTmFtZSxcbiAgICBuZXdIZWFkZXI6IHN0cnVjdHVyZWRQYXRjaC5vbGRIZWFkZXIsXG4gICAgaHVua3M6IHN0cnVjdHVyZWRQYXRjaC5odW5rcy5tYXAoaHVuayA9PiB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICBvbGRMaW5lczogaHVuay5uZXdMaW5lcyxcbiAgICAgICAgb2xkU3RhcnQ6IGh1bmsubmV3U3RhcnQsXG4gICAgICAgIG5ld0xpbmVzOiBodW5rLm9sZExpbmVzLFxuICAgICAgICBuZXdTdGFydDogaHVuay5vbGRTdGFydCxcbiAgICAgICAgbGluZWRlbGltaXRlcnM6IGh1bmsubGluZWRlbGltaXRlcnMsXG4gICAgICAgIGxpbmVzOiBodW5rLmxpbmVzLm1hcChsID0+IHtcbiAgICAgICAgICBpZiAobC5zdGFydHNXaXRoKCctJykpIHsgcmV0dXJuIGArJHtsLnNsaWNlKDEpfWA7IH1cbiAgICAgICAgICBpZiAobC5zdGFydHNXaXRoKCcrJykpIHsgcmV0dXJuIGAtJHtsLnNsaWNlKDEpfWA7IH1cbiAgICAgICAgICByZXR1cm4gbDtcbiAgICAgICAgfSlcbiAgICAgIH07XG4gICAgfSlcbiAgfTtcbn1cbiJdfQ== + + /***/ }), /***/ 8935: @@ -13749,6 +13984,8 @@ function onceStrict (fn) { /***/ 9103: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + var __create = Object.create; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; @@ -13772,7 +14009,6 @@ var __spreadValues = (a, b) => { return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; @@ -13783,22 +14019,19 @@ var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; -var __reExport = (target, module2, copyDefault, desc) => { - if (module2 && typeof module2 === "object" || typeof module2 === "function") { - for (let key of __getOwnPropNames(module2)) - if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) - __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } - return target; -}; -var __toESM = (module2, isNodeMode) => { - return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); + return to; }; -var __toCommonJS = /* @__PURE__ */ ((cache2) => { - return (module2, temp) => { - return cache2 && cache2.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache2 && cache2.set(module2, temp), temp); - }; -})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { @@ -13824,6 +14057,7 @@ var __async = (__this, __arguments, generator) => { var GitError; var init_git_error = __esm({ "src/lib/errors/git-error.ts"() { + "use strict"; GitError = class extends Error { constructor(task, message) { super(message); @@ -13838,6 +14072,7 @@ var init_git_error = __esm({ var GitResponseError; var init_git_response_error = __esm({ "src/lib/errors/git-response-error.ts"() { + "use strict"; init_git_error(); GitResponseError = class extends GitError { constructor(git, message) { @@ -13863,6 +14098,7 @@ function toPaths(pathSpec) { var cache; var init_pathspec = __esm({ "src/lib/args/pathspec.ts"() { + "use strict"; cache = /* @__PURE__ */ new WeakMap(); } }); @@ -13871,6 +14107,7 @@ var init_pathspec = __esm({ var GitConstructError; var init_git_construct_error = __esm({ "src/lib/errors/git-construct-error.ts"() { + "use strict"; init_git_error(); GitConstructError = class extends GitError { constructor(config, message) { @@ -13885,6 +14122,7 @@ var init_git_construct_error = __esm({ var GitPluginError; var init_git_plugin_error = __esm({ "src/lib/errors/git-plugin-error.ts"() { + "use strict"; init_git_error(); GitPluginError = class extends GitError { constructor(task, plugin, message) { @@ -13901,6 +14139,7 @@ var init_git_plugin_error = __esm({ var TaskConfigurationError; var init_task_configuration_error = __esm({ "src/lib/errors/task-configuration-error.ts"() { + "use strict"; init_git_error(); TaskConfigurationError = class extends GitError { constructor(message) { @@ -14001,7 +14240,10 @@ function bufferToString(input) { return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8"); } function pick(source, properties) { - return Object.assign({}, ...properties.map((property) => property in source ? { [property]: source[property] } : {})); + return Object.assign( + {}, + ...properties.map((property) => property in source ? { [property]: source[property] } : {}) + ); } function delay(duration = 0) { return new Promise((done) => setTimeout(done, duration)); @@ -14015,6 +14257,7 @@ function orVoid(input) { var import_file_exists, NULL, NOOP, objectToString; var init_util = __esm({ "src/lib/utils/util.ts"() { + "use strict"; import_file_exists = __nccwpck_require__(4751); NULL = "\0"; NOOP = () => { @@ -14043,6 +14286,7 @@ function filterFunction(input) { var filterArray, filterString, filterStringArray, filterStringOrStringArray, filterHasLength; var init_argument_filters = __esm({ "src/lib/utils/argument-filters.ts"() { + "use strict"; init_util(); init_pathspec(); filterArray = (input) => { @@ -14070,6 +14314,7 @@ var init_argument_filters = __esm({ var ExitCodes; var init_exit_codes = __esm({ "src/lib/utils/exit-codes.ts"() { + "use strict"; ExitCodes = /* @__PURE__ */ ((ExitCodes2) => { ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS"; ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR"; @@ -14084,6 +14329,7 @@ var init_exit_codes = __esm({ var GitOutputStreams; var init_git_output_streams = __esm({ "src/lib/utils/git-output-streams.ts"() { + "use strict"; GitOutputStreams = class { constructor(stdOut, stdErr) { this.stdOut = stdOut; @@ -14100,6 +14346,7 @@ var init_git_output_streams = __esm({ var LineParser, RemoteLineParser; var init_line_parser = __esm({ "src/lib/utils/line-parser.ts"() { + "use strict"; LineParser = class { constructor(regExp, useMatches) { this.matches = []; @@ -14151,7 +14398,10 @@ var init_line_parser = __esm({ // src/lib/utils/simple-git-options.ts function createInstanceConfig(...options) { const baseDir = process.cwd(); - const config = Object.assign(__spreadValues({ baseDir }, defaultOptions), ...options.filter((o) => typeof o === "object" && o)); + const config = Object.assign( + __spreadValues({ baseDir }, defaultOptions), + ...options.filter((o) => typeof o === "object" && o) + ); config.baseDir = config.baseDir || baseDir; config.trimmed = config.trimmed === true; return config; @@ -14159,6 +14409,7 @@ function createInstanceConfig(...options) { var defaultOptions; var init_simple_git_options = __esm({ "src/lib/utils/simple-git-options.ts"() { + "use strict"; defaultOptions = { binary: "git", maxConcurrentProcesses: 5, @@ -14212,6 +14463,7 @@ function trailingFunctionArgument(args, includeNoop = true) { } var init_task_options = __esm({ "src/lib/utils/task-options.ts"() { + "use strict"; init_argument_filters(); init_util(); init_pathspec(); @@ -14238,6 +14490,7 @@ function parseStringResponse(result, parsers12, texts, trim = true) { } var init_task_parser = __esm({ "src/lib/utils/task-parser.ts"() { + "use strict"; init_util(); } }); @@ -14290,6 +14543,7 @@ __export(utils_exports, { }); var init_utils = __esm({ "src/lib/utils/index.ts"() { + "use strict"; init_argument_filters(); init_exit_codes(); init_git_output_streams(); @@ -14350,6 +14604,7 @@ function isNotRepoMessage(error) { var CheckRepoActions, onError, parser; var init_check_is_repo = __esm({ "src/lib/tasks/check-is-repo.ts"() { + "use strict"; init_utils(); CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => { CheckRepoActions2["BARE"] = "bare"; @@ -14383,6 +14638,7 @@ function cleanSummaryParser(dryRun, text) { var CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp; var init_CleanSummary = __esm({ "src/lib/responses/CleanSummary.ts"() { + "use strict"; init_utils(); CleanResponse = class { constructor(dryRun) { @@ -14452,6 +14708,7 @@ function isEmptyTask(task) { var EMPTY_COMMANDS; var init_task = __esm({ "src/lib/tasks/task.ts"() { + "use strict"; init_task_configuration_error(); EMPTY_COMMANDS = []; } @@ -14528,6 +14785,7 @@ function isInteractiveMode(option) { var CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues; var init_clean = __esm({ "src/lib/tasks/clean.ts"() { + "use strict"; init_CleanSummary(); init_utils(); init_task(); @@ -14601,6 +14859,7 @@ function* configParser(text, requestedKey = null) { var ConfigList; var init_ConfigList = __esm({ "src/lib/responses/ConfigList.ts"() { + "use strict"; init_utils(); ConfigList = class { constructor() { @@ -14688,19 +14947,34 @@ function listConfigTask(scope) { function config_default() { return { addConfig(key, value, ...rest) { - return this._runTask(addConfigTask(key, value, rest[0] === true, asConfigScope(rest[1], "local" /* local */)), trailingFunctionArgument(arguments)); + return this._runTask( + addConfigTask( + key, + value, + rest[0] === true, + asConfigScope(rest[1], "local" /* local */) + ), + trailingFunctionArgument(arguments) + ); }, getConfig(key, scope) { - return this._runTask(getConfigTask(key, asConfigScope(scope, void 0)), trailingFunctionArgument(arguments)); + return this._runTask( + getConfigTask(key, asConfigScope(scope, void 0)), + trailingFunctionArgument(arguments) + ); }, listConfig(...rest) { - return this._runTask(listConfigTask(asConfigScope(rest[0], void 0)), trailingFunctionArgument(arguments)); + return this._runTask( + listConfigTask(asConfigScope(rest[0], void 0)), + trailingFunctionArgument(arguments) + ); } }; } var GitConfigScope; var init_config = __esm({ "src/lib/tasks/config.ts"() { + "use strict"; init_ConfigList(); init_utils(); GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => { @@ -14720,6 +14994,7 @@ function isDiffNameStatus(input) { var DiffNameStatus, diffNameStatus; var init_diff_name_status = __esm({ "src/lib/tasks/diff-name-status.ts"() { + "use strict"; DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => { DiffNameStatus2["ADDED"] = "A"; DiffNameStatus2["COPIED"] = "C"; @@ -14764,26 +15039,33 @@ function grep_default() { const options = getTrailingOptions(arguments); for (const option of disallowedOptions) { if (options.includes(option)) { - return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then); + return this._runTask( + configurationErrorTask(`git.grep: use of "${option}" is not supported.`), + then + ); } } if (typeof searchTerm === "string") { searchTerm = grepQueryBuilder().param(searchTerm); } const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm]; - return this._runTask({ - commands, - format: "utf-8", - parser(stdOut) { - return parseGrep(stdOut); - } - }, then); + return this._runTask( + { + commands, + format: "utf-8", + parser(stdOut) { + return parseGrep(stdOut); + } + }, + then + ); } }; } var disallowedOptions, Query, _a, GrepQuery; var init_grep = __esm({ "src/lib/tasks/grep.ts"() { + "use strict"; init_utils(); init_task(); disallowedOptions = ["-h"]; @@ -14841,6 +15123,7 @@ function isValidResetMode(mode) { var ResetMode, ResetModes; var init_reset = __esm({ "src/lib/tasks/reset.ts"() { + "use strict"; init_task(); ResetMode = /* @__PURE__ */ ((ResetMode2) => { ResetMode2["MIXED"] = "mixed"; @@ -14872,6 +15155,7 @@ __export(api_exports, { }); var init_api = __esm({ "src/lib/api.ts"() { + "use strict"; init_pathspec(); init_git_construct_error(); init_git_error(); @@ -14914,6 +15198,7 @@ function abortPlugin(signal) { } var init_abort_plugin = __esm({ "src/lib/plugins/abort-plugin.ts"() { + "use strict"; init_git_plugin_error(); } }); @@ -14929,17 +15214,33 @@ function preventProtocolOverride(arg, next) { if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) { return; } - throw new GitPluginError(void 0, "unsafe", "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol"); + throw new GitPluginError( + void 0, + "unsafe", + "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol" + ); } function preventUploadPack(arg, method) { if (/^\s*--(upload|receive)-pack/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`); + throw new GitPluginError( + void 0, + "unsafe", + `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack` + ); } if (method === "clone" && /^\s*-u\b/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of clone with option -u is not permitted without enabling allowUnsafePack`); + throw new GitPluginError( + void 0, + "unsafe", + `Use of clone with option -u is not permitted without enabling allowUnsafePack` + ); } if (method === "push" && /^\s*--exec\b/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of push with option --exec is not permitted without enabling allowUnsafePack`); + throw new GitPluginError( + void 0, + "unsafe", + `Use of push with option --exec is not permitted without enabling allowUnsafePack` + ); } } function blockUnsafeOperationsPlugin({ @@ -14960,6 +15261,7 @@ function blockUnsafeOperationsPlugin({ } var init_block_unsafe_operations_plugin = __esm({ "src/lib/plugins/block-unsafe-operations-plugin.ts"() { + "use strict"; init_git_plugin_error(); } }); @@ -14976,6 +15278,7 @@ function commandConfigPrefixingPlugin(configuration) { } var init_command_config_prefixing_plugin = __esm({ "src/lib/plugins/command-config-prefixing-plugin.ts"() { + "use strict"; init_utils(); } }); @@ -15024,11 +15327,11 @@ function completionDetectionPlugin({ type: "spawn.after", action(_0, _1) { return __async(this, arguments, function* (_data, { spawned, close }) { - var _a2, _b; + var _a3, _b; const events = createEvents(); let deferClose = true; let quickClose = () => void (deferClose = false); - (_a2 = spawned.stdout) == null ? void 0 : _a2.on("data", quickClose); + (_a3 = spawned.stdout) == null ? void 0 : _a3.on("data", quickClose); (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose); spawned.on("error", quickClose); spawned.on("close", (code) => events.close(code)); @@ -15049,12 +15352,58 @@ function completionDetectionPlugin({ var import_promise_deferred, never; var init_completion_detection_plugin = __esm({ "src/lib/plugins/completion-detection.plugin.ts"() { + "use strict"; import_promise_deferred = __nccwpck_require__(9819); init_utils(); never = (0, import_promise_deferred.deferred)().promise; } }); +// src/lib/plugins/custom-binary.plugin.ts +function isBadArgument(arg) { + return !arg || !/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(arg); +} +function toBinaryConfig(input, allowUnsafe) { + if (input.length < 1 || input.length > 2) { + throw new GitPluginError(void 0, "binary", WRONG_NUMBER_ERR); + } + const isBad = input.some(isBadArgument); + if (isBad) { + if (allowUnsafe) { + console.warn(WRONG_CHARS_ERR); + } else { + throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR); + } + } + const [binary, prefix] = input; + return { + binary, + prefix + }; +} +function customBinaryPlugin(plugins, input = ["git"], allowUnsafe = false) { + let config = toBinaryConfig(asArray(input), allowUnsafe); + plugins.on("binary", (input2) => { + config = toBinaryConfig(asArray(input2), allowUnsafe); + }); + plugins.append("spawn.binary", () => { + return config.binary; + }); + plugins.append("spawn.args", (data) => { + return config.prefix ? [config.prefix, ...data] : data; + }); +} +var WRONG_NUMBER_ERR, WRONG_CHARS_ERR; +var init_custom_binary_plugin = __esm({ + "src/lib/plugins/custom-binary.plugin.ts"() { + "use strict"; + init_git_plugin_error(); + init_utils(); + WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`; + WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`; + } +}); + // src/lib/plugins/error-detection.plugin.ts function isTaskError(result) { return !!(result.exitCode && result.stdErr.length); @@ -15090,18 +15439,32 @@ function errorDetectionPlugin(config) { } var init_error_detection_plugin = __esm({ "src/lib/plugins/error-detection.plugin.ts"() { + "use strict"; init_git_error(); } }); // src/lib/plugins/plugin-store.ts -var PluginStore; +var import_node_events, PluginStore; var init_plugin_store = __esm({ "src/lib/plugins/plugin-store.ts"() { + "use strict"; + import_node_events = __nccwpck_require__(5673); init_utils(); PluginStore = class { constructor() { this.plugins = /* @__PURE__ */ new Set(); + this.events = new import_node_events.EventEmitter(); + } + on(type, listener) { + this.events.on(type, listener); + } + reconfigure(type, data) { + this.events.emit(type, data); + } + append(type, action) { + const plugin = append(this.plugins, { type, action }); + return () => this.plugins.delete(plugin); } add(plugin) { const plugins = []; @@ -15166,6 +15529,7 @@ function progressEventStage(input) { } var init_progress_monitor_plugin = __esm({ "src/lib/plugins/progress-monitor-plugin.ts"() { + "use strict"; init_utils(); } }); @@ -15173,6 +15537,7 @@ var init_progress_monitor_plugin = __esm({ // src/lib/plugins/simple-git-plugin.ts var init_simple_git_plugin = __esm({ "src/lib/plugins/simple-git-plugin.ts"() { + "use strict"; } }); @@ -15188,6 +15553,7 @@ function spawnOptionsPlugin(spawnOptions) { } var init_spawn_options_plugin = __esm({ "src/lib/plugins/spawn-options-plugin.ts"() { + "use strict"; init_utils(); } }); @@ -15231,6 +15597,7 @@ function timeoutPlugin({ } var init_timout_plugin = __esm({ "src/lib/plugins/timout-plugin.ts"() { + "use strict"; init_git_plugin_error(); } }); @@ -15238,10 +15605,12 @@ var init_timout_plugin = __esm({ // src/lib/plugins/index.ts var init_plugins = __esm({ "src/lib/plugins/index.ts"() { + "use strict"; init_abort_plugin(); init_block_unsafe_operations_plugin(); init_command_config_prefixing_plugin(); init_completion_detection_plugin(); + init_custom_binary_plugin(); init_error_detection_plugin(); init_plugin_store(); init_progress_monitor_plugin(); @@ -15268,7 +15637,9 @@ function suffixPathsPlugin() { continue; } if (param === "--") { - append2(data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item)); + append2( + data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item) + ); break; } prefix.push(param); @@ -15279,6 +15650,7 @@ function suffixPathsPlugin() { } var init_suffix_paths_plugin = __esm({ "src/lib/plugins/suffix-paths.plugin.ts"() { + "use strict"; init_pathspec(); } }); @@ -15318,7 +15690,10 @@ function createLogger(label, verbose, initialStep, infoDebugger = createLog()) { const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger); return step(initialStep); function sibling(name, initial) { - return append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)); + return append( + spawned, + createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger) + ); } function step(phase) { const stepPrefix = phase && `[${phase}]` || ""; @@ -15335,6 +15710,7 @@ function createLogger(label, verbose, initialStep, infoDebugger = createLog()) { var import_debug; var init_git_logger = __esm({ "src/lib/git-logger.ts"() { + "use strict"; import_debug = __toESM(__nccwpck_require__(8237)); init_utils(); import_debug.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-"); @@ -15351,6 +15727,7 @@ var init_git_logger = __esm({ var _TasksPendingQueue, TasksPendingQueue; var init_tasks_pending_queue = __esm({ "src/lib/runners/tasks-pending-queue.ts"() { + "use strict"; init_git_error(); init_git_logger(); _TasksPendingQueue = class { @@ -15380,9 +15757,14 @@ var init_tasks_pending_queue = __esm({ for (const [task, { logger }] of Array.from(this._queue.entries())) { if (task === err.task) { logger.info(`Failed %o`, err); - logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`); + logger( + `Fatal exception, any as-yet un-started tasks run through this executor will not be attempted` + ); } else { - logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message); + logger.info( + `A fatal exception occurred in a previous task, the queue has been purged: %o`, + err.message + ); } this.complete(task); } @@ -15436,6 +15818,7 @@ function onDataReceived(target, name, logger, output) { var import_child_process, GitExecutorChain; var init_git_executor_chain = __esm({ "src/lib/runners/git-executor-chain.ts"() { + "use strict"; import_child_process = __nccwpck_require__(2081); init_git_error(); init_task(); @@ -15449,9 +15832,6 @@ var init_git_executor_chain = __esm({ this._chain = Promise.resolve(); this._queue = new TasksPendingQueue(); } - get binary() { - return this._executor.binary; - } get cwd() { return this._cwd || this._executor.cwd; } @@ -15494,8 +15874,19 @@ var init_git_executor_chain = __esm({ } attemptRemoteTask(task, logger) { return __async(this, null, function* () { - const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext(task, task.commands)); - const raw = yield this.gitResponse(task, this.binary, args, this.outputHandler, logger.step("SPAWN")); + const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands)); + const args = this._plugins.exec( + "spawn.args", + [...task.commands], + pluginContext(task, task.commands) + ); + const raw = yield this.gitResponse( + task, + binary, + args, + this.outputHandler, + logger.step("SPAWN") + ); const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE")); logger(`passing response to task's parser as a %s`, task.format); if (isBufferTask(task)) { @@ -15514,17 +15905,36 @@ var init_git_executor_chain = __esm({ const { exitCode, rejection, stdOut, stdErr } = result; return new Promise((done, fail) => { logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode); - const { error } = this._plugins.exec("task.error", { error: rejection }, __spreadValues(__spreadValues({}, pluginContext(task, args)), result)); + const { error } = this._plugins.exec( + "task.error", + { error: rejection }, + __spreadValues(__spreadValues({}, pluginContext(task, args)), result) + ); if (error && task.onError) { logger.info(`exitCode=%s handling with custom error handler`); - return task.onError(result, error, (newStdOut) => { - logger.info(`custom error handler treated as success`); - logger(`custom error returned a %s`, objectToString(newStdOut)); - done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr))); - }, fail); + return task.onError( + result, + error, + (newStdOut) => { + logger.info(`custom error handler treated as success`); + logger(`custom error returned a %s`, objectToString(newStdOut)); + done( + new GitOutputStreams( + Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, + Buffer.concat(stdErr) + ) + ); + }, + fail + ); } if (error) { - logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection); + logger.info( + `handling as error: exitCode=%s stdErr=%s rejection=%o`, + exitCode, + stdErr.length, + rejection + ); return fail(error); } logger.info(`retrieving task output complete`); @@ -15534,11 +15944,15 @@ var init_git_executor_chain = __esm({ gitResponse(task, command, args, outputHandler, logger) { return __async(this, null, function* () { const outputLogger = logger.sibling("output"); - const spawnOptions = this._plugins.exec("spawn.options", { - cwd: this.cwd, - env: this.env, - windowsHide: true - }, pluginContext(task, task.commands)); + const spawnOptions = this._plugins.exec( + "spawn.options", + { + cwd: this.cwd, + env: this.env, + windowsHide: true + }, + pluginContext(task, task.commands) + ); return new Promise((done) => { const stdOut = []; const stdErr = []; @@ -15559,8 +15973,14 @@ var init_git_executor_chain = __esm({ } })); const spawned = (0, import_child_process.spawn)(command, args, spawnOptions); - spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))); - spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))); + spawned.stdout.on( + "data", + onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")) + ); + spawned.stderr.on( + "data", + onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")) + ); spawned.on("error", onErrorReceived(stdErr, logger)); if (outputHandler) { logger(`Passing child process stdOut/stdErr to custom outputHandler`); @@ -15608,10 +16028,10 @@ __export(git_executor_exports, { var GitExecutor; var init_git_executor = __esm({ "src/lib/runners/git-executor.ts"() { + "use strict"; init_git_executor_chain(); GitExecutor = class { - constructor(binary = "git", cwd, _scheduler, _plugins) { - this.binary = binary; + constructor(cwd, _scheduler, _plugins) { this.cwd = cwd; this._scheduler = _scheduler; this._plugins = _plugins; @@ -15634,14 +16054,19 @@ function taskCallback(task, response, callback = NOOP) { }; const onError2 = (err) => { if ((err == null ? void 0 : err.task) === task) { - callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, void 0); + callback( + err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, + void 0 + ); } }; response.then(onSuccess, onError2); } function addDeprecationNoticeToError(err) { let log = (name) => { - console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`); + console.warn( + `simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3` + ); log = NOOP; }; return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {})); @@ -15662,6 +16087,7 @@ function addDeprecationNoticeToError(err) { } var init_task_callback = __esm({ "src/lib/task-callback.ts"() { + "use strict"; init_git_response_error(); init_utils(); } @@ -15678,6 +16104,7 @@ function changeWorkingDirectoryTask(directory, root) { } var init_change_working_directory = __esm({ "src/lib/tasks/change-working-directory.ts"() { + "use strict"; init_utils(); init_task(); } @@ -15694,18 +16121,28 @@ function checkoutTask(args) { function checkout_default() { return { checkout() { - return this._runTask(checkoutTask(getTrailingOptions(arguments, 1)), trailingFunctionArgument(arguments)); + return this._runTask( + checkoutTask(getTrailingOptions(arguments, 1)), + trailingFunctionArgument(arguments) + ); }, checkoutBranch(branchName, startPoint) { - return this._runTask(checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + return this._runTask( + checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments) + ); }, checkoutLocalBranch(branchName) { - return this._runTask(checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + return this._runTask( + checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments) + ); } }; } var init_checkout = __esm({ "src/lib/tasks/checkout.ts"() { + "use strict"; init_utils(); init_task(); } @@ -15729,6 +16166,7 @@ function parseCommitResult(stdOut) { var parsers; var init_parse_commit = __esm({ "src/lib/parsers/parse-commit.ts"() { + "use strict"; init_utils(); parsers = [ new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => { @@ -15747,20 +16185,26 @@ var init_parse_commit = __esm({ name: parts.join("<").trim() }; }), - new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => { - result.summary.changes = parseInt(changes, 10) || 0; - result.summary.insertions = parseInt(insertions, 10) || 0; - result.summary.deletions = parseInt(deletions, 10) || 0; - }), - new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => { - result.summary.changes = parseInt(changes, 10) || 0; - const count = parseInt(lines, 10) || 0; - if (direction === "-") { - result.summary.deletions = count; - } else if (direction === "+") { - result.summary.insertions = count; + new LineParser( + /(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, + (result, [changes, insertions, deletions]) => { + result.summary.changes = parseInt(changes, 10) || 0; + result.summary.insertions = parseInt(insertions, 10) || 0; + result.summary.deletions = parseInt(deletions, 10) || 0; + } + ), + new LineParser( + /^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, + (result, [changes, lines, direction]) => { + result.summary.changes = parseInt(changes, 10) || 0; + const count = parseInt(lines, 10) || 0; + if (direction === "-") { + result.summary.deletions = count; + } else if (direction === "+") { + result.summary.insertions = count; + } } - }) + ) ]; } }); @@ -15785,16 +16229,23 @@ function commit_default() { return { commit(message, ...rest) { const next = trailingFunctionArgument(arguments); - const task = rejectDeprecatedSignatures(message) || commitTask(asArray(message), asArray(filterType(rest[0], filterStringOrStringArray, [])), [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]); + const task = rejectDeprecatedSignatures(message) || commitTask( + asArray(message), + asArray(filterType(rest[0], filterStringOrStringArray, [])), + [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)] + ); return this._runTask(task, next); } }; function rejectDeprecatedSignatures(message) { - return !filterStringOrStringArray(message) && configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`); + return !filterStringOrStringArray(message) && configurationErrorTask( + `git.commit: requires the commit message to be supplied as a string/string[]` + ); } } var init_commit = __esm({ "src/lib/tasks/commit.ts"() { + "use strict"; init_parse_commit(); init_utils(); init_task(); @@ -15805,12 +16256,16 @@ var init_commit = __esm({ function first_commit_default() { return { firstCommit() { - return this._runTask(straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), + trailingFunctionArgument(arguments) + ); } }; } var init_first_commit = __esm({ "src/lib/tasks/first-commit.ts"() { + "use strict"; init_utils(); init_task(); } @@ -15826,6 +16281,7 @@ function hashObjectTask(filePath, write) { } var init_hash_object = __esm({ "src/lib/tasks/hash-object.ts"() { + "use strict"; init_task(); } }); @@ -15854,6 +16310,7 @@ function parseInit(bare, path, text) { var InitSummary, initResponseRegex, reInitResponseRegex; var init_InitSummary = __esm({ "src/lib/responses/InitSummary.ts"() { + "use strict"; InitSummary = class { constructor(bare, path, existing, gitDir) { this.bare = bare; @@ -15887,6 +16344,7 @@ function initTask(bare = false, path, customArgs) { var bareCommand; var init_init = __esm({ "src/lib/tasks/init.ts"() { + "use strict"; init_InitSummary(); bareCommand = "--bare"; } @@ -15908,6 +16366,7 @@ function isLogFormat(customArg) { var logFormatRegex; var init_log_format = __esm({ "src/lib/args/log-format.ts"() { + "use strict"; logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/; } }); @@ -15916,6 +16375,7 @@ var init_log_format = __esm({ var DiffSummary; var init_DiffSummary = __esm({ "src/lib/responses/DiffSummary.ts"() { + "use strict"; DiffSummary = class { constructor() { this.changed = 0; @@ -15935,51 +16395,64 @@ function getDiffParser(format = "" /* NONE */) { var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers; var init_parse_diff_summary = __esm({ "src/lib/parsers/parse-diff-summary.ts"() { + "use strict"; init_log_format(); init_DiffSummary(); init_diff_name_status(); init_utils(); statParser = [ - new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => { - result.files.push({ - file: file.trim(), - changes: asNumber(changes), - insertions: alterations.replace(/[^+]/g, "").length, - deletions: alterations.replace(/[^-]/g, "").length, - binary: false - }); - }), - new LineParser(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, (result, [file, before, after]) => { - result.files.push({ - file: file.trim(), - before: asNumber(before), - after: asNumber(after), - binary: true - }); - }), - new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, (result, [changed, summary]) => { - const inserted = /(\d+) i/.exec(summary); - const deleted = /(\d+) d/.exec(summary); - result.changed = asNumber(changed); - result.insertions = asNumber(inserted == null ? void 0 : inserted[1]); - result.deletions = asNumber(deleted == null ? void 0 : deleted[1]); - }) + new LineParser( + /^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, + (result, [file, changes, alterations = ""]) => { + result.files.push({ + file: file.trim(), + changes: asNumber(changes), + insertions: alterations.replace(/[^+]/g, "").length, + deletions: alterations.replace(/[^-]/g, "").length, + binary: false + }); + } + ), + new LineParser( + /^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, + (result, [file, before, after]) => { + result.files.push({ + file: file.trim(), + before: asNumber(before), + after: asNumber(after), + binary: true + }); + } + ), + new LineParser( + /(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, + (result, [changed, summary]) => { + const inserted = /(\d+) i/.exec(summary); + const deleted = /(\d+) d/.exec(summary); + result.changed = asNumber(changed); + result.insertions = asNumber(inserted == null ? void 0 : inserted[1]); + result.deletions = asNumber(deleted == null ? void 0 : deleted[1]); + } + ) ]; numStatParser = [ - new LineParser(/(\d+)\t(\d+)\t(.+)$/, (result, [changesInsert, changesDelete, file]) => { - const insertions = asNumber(changesInsert); - const deletions = asNumber(changesDelete); - result.changed++; - result.insertions += insertions; - result.deletions += deletions; - result.files.push({ - file, - changes: insertions + deletions, - insertions, - deletions, - binary: false - }); - }), + new LineParser( + /(\d+)\t(\d+)\t(.+)$/, + (result, [changesInsert, changesDelete, file]) => { + const insertions = asNumber(changesInsert); + const deletions = asNumber(changesDelete); + result.changed++; + result.insertions += insertions; + result.deletions += deletions; + result.files.push({ + file, + changes: insertions + deletions, + insertions, + deletions, + binary: false + }); + } + ), new LineParser(/-\t-\t(.+)$/, (result, [file]) => { result.changed++; result.files.push({ @@ -16003,17 +16476,20 @@ var init_parse_diff_summary = __esm({ }) ]; nameStatusParser = [ - new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, _similarity, from, _to, to]) => { - result.changed++; - result.files.push({ - file: to != null ? to : from, - changes: 0, - status: orVoid(isDiffNameStatus(status) && status), - insertions: 0, - deletions: 0, - binary: false - }); - }) + new LineParser( + /([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, + (result, [status, _similarity, from, _to, to]) => { + result.changed++; + result.files.push({ + file: to != null ? to : from, + changes: 0, + status: orVoid(isDiffNameStatus(status) && status), + insertions: 0, + deletions: 0, + binary: false + }); + } + ) ]; diffSummaryParsers = { ["" /* NONE */]: statParser, @@ -16027,17 +16503,27 @@ var init_parse_diff_summary = __esm({ // src/lib/parsers/parse-list-log-summary.ts function lineBuilder(tokens, fields) { - return fields.reduce((line, field, index) => { - line[field] = tokens[index] || ""; - return line; - }, /* @__PURE__ */ Object.create({ diff: null })); + return fields.reduce( + (line, field, index) => { + line[field] = tokens[index] || ""; + return line; + }, + /* @__PURE__ */ Object.create({ diff: null }) + ); } function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "" /* NONE */) { const parseDiffResult = getDiffParser(logFormat); return function(stdOut) { - const all = toLinesWithContent(stdOut, true, START_BOUNDARY).map(function(item) { + const all = toLinesWithContent( + stdOut, + true, + START_BOUNDARY + ).map(function(item) { const lineDetail = item.trim().split(COMMIT_BOUNDARY); - const listLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields); + const listLogLine = lineBuilder( + lineDetail[0].trim().split(splitter), + fields + ); if (lineDetail.length > 1 && !!lineDetail[1].trim()) { listLogLine.diff = parseDiffResult(lineDetail[1]); } @@ -16053,6 +16539,7 @@ function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNa var START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames; var init_parse_list_log_summary = __esm({ "src/lib/parsers/parse-list-log-summary.ts"() { + "use strict"; init_utils(); init_parse_diff_summary(); init_log_format(); @@ -16086,14 +16573,19 @@ function diffSummaryTask(customArgs) { function validateLogFormatConfig(customArgs) { const flags = customArgs.filter(isLogFormat); if (flags.length > 1) { - return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${flags.join(",")}`); + return configurationErrorTask( + `Summary flags are mutually exclusive - pick one of ${flags.join(",")}` + ); } if (flags.length && customArgs.includes("-z")) { - return configurationErrorTask(`Summary flag ${flags} parsing is not compatible with null termination option '-z'`); + return configurationErrorTask( + `Summary flag ${flags} parsing is not compatible with null termination option '-z'` + ); } } var init_diff = __esm({ "src/lib/tasks/diff.ts"() { + "use strict"; init_log_format(); init_parse_diff_summary(); init_task(); @@ -16165,7 +16657,10 @@ function log_default() { return { log(...rest) { const next = trailingFunctionArgument(arguments); - const options = parseLogOptions(trailingOptionsArgument(arguments), filterType(arguments[0], filterArray)); + const options = parseLogOptions( + trailingOptionsArgument(arguments), + filterType(arguments[0], filterArray) + ); const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options); return this._runTask(task, next); } @@ -16174,12 +16669,15 @@ function log_default() { return logTask(options.splitter, options.fields, options.commands); } function rejectDeprecatedSignatures(from, to) { - return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`); + return filterString(from) && filterString(to) && configurationErrorTask( + `git.log(string, string) should be replaced with git.log({ from: string, to: string })` + ); } } var excludeOptions; var init_log = __esm({ "src/lib/tasks/log.ts"() { + "use strict"; init_log_format(); init_pathspec(); init_parse_list_log_summary(); @@ -16209,6 +16707,7 @@ var init_log = __esm({ var MergeSummaryConflict, MergeSummaryDetail; var init_MergeSummary = __esm({ "src/lib/responses/MergeSummary.ts"() { + "use strict"; MergeSummaryConflict = class { constructor(reason, file = null, meta) { this.reason = reason; @@ -16245,6 +16744,7 @@ var init_MergeSummary = __esm({ var PullSummary, PullFailedSummary; var init_PullSummary = __esm({ "src/lib/responses/PullSummary.ts"() { + "use strict"; PullSummary = class { constructor() { this.remoteMessages = { @@ -16304,24 +16804,34 @@ function asObjectCount(source) { var remoteMessagesObjectParsers; var init_parse_remote_objects = __esm({ "src/lib/parsers/parse-remote-objects.ts"() { + "use strict"; init_utils(); remoteMessagesObjectParsers = [ - new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => { - const key = action.toLowerCase(); - const enumeration = objectEnumerationResult(result.remoteMessages); - Object.assign(enumeration, { [key]: asNumber(count) }); - }), - new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => { - const key = action.toLowerCase(); - const enumeration = objectEnumerationResult(result.remoteMessages); - Object.assign(enumeration, { [key]: asNumber(count) }); - }), - new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => { - const objects = objectEnumerationResult(result.remoteMessages); - objects.total = asObjectCount(total); - objects.reused = asObjectCount(reused); - objects.packReused = asNumber(packReused); - }) + new RemoteLineParser( + /^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, + (result, [action, count]) => { + const key = action.toLowerCase(); + const enumeration = objectEnumerationResult(result.remoteMessages); + Object.assign(enumeration, { [key]: asNumber(count) }); + } + ), + new RemoteLineParser( + /^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, + (result, [action, count]) => { + const key = action.toLowerCase(); + const enumeration = objectEnumerationResult(result.remoteMessages); + Object.assign(enumeration, { [key]: asNumber(count) }); + } + ), + new RemoteLineParser( + /total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, + (result, [total, reused, packReused]) => { + const objects = objectEnumerationResult(result.remoteMessages); + objects.total = asObjectCount(total); + objects.reused = asObjectCount(reused); + objects.packReused = asNumber(packReused); + } + ) ]; } }); @@ -16333,6 +16843,7 @@ function parseRemoteMessages(_stdOut, stdErr) { var parsers2, RemoteMessageSummary; var init_parse_remote_messages = __esm({ "src/lib/parsers/parse-remote-messages.ts"() { + "use strict"; init_utils(); init_parse_remote_objects(); parsers2 = [ @@ -16341,16 +16852,22 @@ var init_parse_remote_messages = __esm({ return false; }), ...remoteMessagesObjectParsers, - new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => { - result.remoteMessages.pullRequestUrl = pullRequestUrl; - }), - new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => { - result.remoteMessages.vulnerabilities = { - count: asNumber(count), - summary, - url - }; - }) + new RemoteLineParser( + [/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], + (result, [pullRequestUrl]) => { + result.remoteMessages.pullRequestUrl = pullRequestUrl; + } + ), + new RemoteLineParser( + [/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], + (result, [count, summary, url]) => { + result.remoteMessages.vulnerabilities = { + count: asNumber(count), + summary, + url + }; + } + ) ]; RemoteMessageSummary = class { constructor() { @@ -16368,6 +16885,7 @@ function parsePullErrorResult(stdOut, stdErr) { var FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult; var init_parse_pull = __esm({ "src/lib/parsers/parse-pull.ts"() { + "use strict"; init_PullSummary(); init_utils(); init_parse_remote_messages(); @@ -16401,18 +16919,25 @@ var init_parse_pull = __esm({ errorParsers = [ new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)), new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)), - new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => { - result.branch.local = branchLocal; - result.hash.local = hashLocal; - result.branch.remote = branchRemote; - result.hash.remote = hashRemote; - }) + new LineParser( + /([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, + (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => { + result.branch.local = branchLocal; + result.hash.local = hashLocal; + result.branch.remote = branchRemote; + result.hash.remote = hashRemote; + } + ) ]; parsePullDetail = (stdOut, stdErr) => { return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]); }; parsePullResult = (stdOut, stdErr) => { - return Object.assign(new PullSummary(), parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr)); + return Object.assign( + new PullSummary(), + parsePullDetail(stdOut, stdErr), + parseRemoteMessages(stdOut, stdErr) + ); }; } }); @@ -16421,6 +16946,7 @@ var init_parse_pull = __esm({ var parsers4, parseMergeResult, parseMergeDetail; var init_parse_merge = __esm({ "src/lib/parsers/parse-merge.ts"() { + "use strict"; init_MergeSummary(); init_utils(); init_parse_pull(); @@ -16431,9 +16957,12 @@ var init_parse_merge = __esm({ new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => { summary.conflicts.push(new MergeSummaryConflict(reason, file)); }), - new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => { - summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef })); - }), + new LineParser( + /^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, + (summary, [reason, file, deleteRef]) => { + summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef })); + } + ), new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => { summary.conflicts.push(new MergeSummaryConflict(reason, null)); }), @@ -16469,6 +16998,7 @@ function mergeTask(customArgs) { } var init_merge = __esm({ "src/lib/tasks/merge.ts"() { + "use strict"; init_git_response_error(); init_parse_merge(); init_task(); @@ -16493,6 +17023,7 @@ function pushResultPushedItem(local, remote, status) { var parsers5, parsePushResult, parsePushDetail; var init_parse_push = __esm({ "src/lib/parsers/parse-push.ts"() { + "use strict"; init_utils(); init_parse_remote_messages(); parsers5 = [ @@ -16507,25 +17038,31 @@ var init_parse_push = __esm({ new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => { result.pushed.push(pushResultPushedItem(local, remote, type)); }), - new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => { - result.branch = __spreadProps(__spreadValues({}, result.branch || {}), { - local, - remote, - remoteName - }); - }), - new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => { - result.update = { - head: { + new LineParser( + /^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, + (result, [local, remote, remoteName]) => { + result.branch = __spreadProps(__spreadValues({}, result.branch || {}), { local, - remote - }, - hash: { - from, - to - } - }; - }) + remote, + remoteName + }); + } + ), + new LineParser( + /^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, + (result, [local, remote, from, to]) => { + result.update = { + head: { + local, + remote + }, + hash: { + from, + to + } + }; + } + ) ]; parsePushResult = (stdOut, stdErr) => { const pushDetail = parsePushDetail(stdOut, stdErr); @@ -16567,6 +17104,7 @@ function pushTask(ref = {}, customArgs) { } var init_push = __esm({ "src/lib/tasks/push.ts"() { + "use strict"; init_parse_push(); init_utils(); } @@ -16580,16 +17118,23 @@ function show_default() { if (!commands.includes("--binary")) { commands.splice(1, 0, "--binary"); } - return this._runTask(straightThroughBufferTask(commands), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughBufferTask(commands), + trailingFunctionArgument(arguments) + ); }, show() { const commands = ["show", ...getTrailingOptions(arguments, 1)]; - return this._runTask(straightThroughStringTask(commands), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(commands), + trailingFunctionArgument(arguments) + ); } }; } var init_show = __esm({ "src/lib/tasks/show.ts"() { + "use strict"; init_utils(); init_task(); } @@ -16599,13 +17144,14 @@ var init_show = __esm({ var fromPathRegex, FileStatusSummary; var init_FileStatusSummary = __esm({ "src/lib/responses/FileStatusSummary.ts"() { + "use strict"; fromPathRegex = /^(.+) -> (.+)$/; FileStatusSummary = class { constructor(path, index, working_dir) { this.path = path; this.index = index; this.working_dir = working_dir; - if (index + working_dir === "R") { + if ("R" === index + working_dir) { const detail = fromPathRegex.exec(path) || [null, path, path]; this.from = detail[1] || ""; this.path = detail[2] || ""; @@ -16653,6 +17199,7 @@ function splitLine(result, lineStr) { var StatusSummary, parsers6, parseStatusSummary; var init_StatusSummary = __esm({ "src/lib/responses/StatusSummary.ts"() { + "use strict"; init_utils(); init_FileStatusSummary(); StatusSummary = class { @@ -16677,14 +17224,46 @@ var init_StatusSummary = __esm({ } }; parsers6 = new Map([ - parser2(" " /* NONE */, "A" /* ADDED */, (result, file) => append(result.created, file)), - parser2(" " /* NONE */, "D" /* DELETED */, (result, file) => append(result.deleted, file)), - parser2(" " /* NONE */, "M" /* MODIFIED */, (result, file) => append(result.modified, file)), - parser2("A" /* ADDED */, " " /* NONE */, (result, file) => append(result.created, file) && append(result.staged, file)), - parser2("A" /* ADDED */, "M" /* MODIFIED */, (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)), - parser2("D" /* DELETED */, " " /* NONE */, (result, file) => append(result.deleted, file) && append(result.staged, file)), - parser2("M" /* MODIFIED */, " " /* NONE */, (result, file) => append(result.modified, file) && append(result.staged, file)), - parser2("M" /* MODIFIED */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) && append(result.staged, file)), + parser2( + " " /* NONE */, + "A" /* ADDED */, + (result, file) => append(result.created, file) + ), + parser2( + " " /* NONE */, + "D" /* DELETED */, + (result, file) => append(result.deleted, file) + ), + parser2( + " " /* NONE */, + "M" /* MODIFIED */, + (result, file) => append(result.modified, file) + ), + parser2( + "A" /* ADDED */, + " " /* NONE */, + (result, file) => append(result.created, file) && append(result.staged, file) + ), + parser2( + "A" /* ADDED */, + "M" /* MODIFIED */, + (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file) + ), + parser2( + "D" /* DELETED */, + " " /* NONE */, + (result, file) => append(result.deleted, file) && append(result.staged, file) + ), + parser2( + "M" /* MODIFIED */, + " " /* NONE */, + (result, file) => append(result.modified, file) && append(result.staged, file) + ), + parser2( + "M" /* MODIFIED */, + "M" /* MODIFIED */, + (result, file) => append(result.modified, file) && append(result.staged, file) + ), parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => { append(result.renamed, renamedFile(file)); }), @@ -16696,10 +17275,23 @@ var init_StatusSummary = __esm({ parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { append(_result.ignored = _result.ignored || [], _file); }), - parser2("?" /* UNTRACKED */, "?" /* UNTRACKED */, (result, file) => append(result.not_added, file)), + parser2( + "?" /* UNTRACKED */, + "?" /* UNTRACKED */, + (result, file) => append(result.not_added, file) + ), ...conflicts("A" /* ADDED */, "A" /* ADDED */, "U" /* UNMERGED */), - ...conflicts("D" /* DELETED */, "D" /* DELETED */, "U" /* UNMERGED */), - ...conflicts("U" /* UNMERGED */, "A" /* ADDED */, "D" /* DELETED */, "U" /* UNMERGED */), + ...conflicts( + "D" /* DELETED */, + "D" /* DELETED */, + "U" /* UNMERGED */ + ), + ...conflicts( + "U" /* UNMERGED */, + "A" /* ADDED */, + "D" /* DELETED */, + "U" /* UNMERGED */ + ), [ "##", (result, line) => { @@ -16762,6 +17354,7 @@ function statusTask(customArgs) { var ignoredOptions; var init_status = __esm({ "src/lib/tasks/status.ts"() { + "use strict"; init_StatusSummary(); ignoredOptions = ["--null", "-z"]; } @@ -16769,19 +17362,23 @@ var init_status = __esm({ // src/lib/tasks/version.ts function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) { - return Object.defineProperty({ - major, - minor, - patch, - agent, - installed - }, "toString", { - value() { - return `${this.major}.${this.minor}.${this.patch}`; + return Object.defineProperty( + { + major, + minor, + patch, + agent, + installed }, - configurable: false, - enumerable: false - }); + "toString", + { + value() { + return `${this.major}.${this.minor}.${this.patch}`; + }, + configurable: false, + enumerable: false + } + ); } function notInstalledResponse() { return versionResponse(0, 0, 0, "", false); @@ -16812,15 +17409,25 @@ function versionParser(stdOut) { var NOT_INSTALLED, parsers7; var init_version = __esm({ "src/lib/tasks/version.ts"() { + "use strict"; init_utils(); NOT_INSTALLED = "installed=false"; parsers7 = [ - new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, (result, [major, minor, patch, agent = ""]) => { - Object.assign(result, versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)); - }), - new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/, (result, [major, minor, patch, agent = ""]) => { - Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent)); - }) + new LineParser( + /version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, + (result, [major, minor, patch, agent = ""]) => { + Object.assign( + result, + versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent) + ); + } + ), + new LineParser( + /version (\d+)\.(\d+)\.(\D+)(.+)?$/, + (result, [major, minor, patch, agent = ""]) => { + Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent)); + } + ) ]; } }); @@ -16833,6 +17440,7 @@ __export(simple_git_api_exports, { var SimpleGitApi; var init_simple_git_api = __esm({ "src/lib/simple-git-api.ts"() { + "use strict"; init_task_callback(); init_change_working_directory(); init_checkout(); @@ -16867,7 +17475,10 @@ var init_simple_git_api = __esm({ }); } add(files) { - return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(["add", ...asArray(files)]), + trailingFunctionArgument(arguments) + ); } cwd(directory) { const next = trailingFunctionArgument(arguments); @@ -16875,44 +17486,88 @@ var init_simple_git_api = __esm({ return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next); } if (typeof (directory == null ? void 0 : directory.path) === "string") { - return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || void 0), next); + return this._runTask( + changeWorkingDirectoryTask( + directory.path, + directory.root && this._executor || void 0 + ), + next + ); } - return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next); + return this._runTask( + configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), + next + ); } hashObject(path, write) { - return this._runTask(hashObjectTask(path, write === true), trailingFunctionArgument(arguments)); + return this._runTask( + hashObjectTask(path, write === true), + trailingFunctionArgument(arguments) + ); } init(bare) { - return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + return this._runTask( + initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), + trailingFunctionArgument(arguments) + ); } merge() { - return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + return this._runTask( + mergeTask(getTrailingOptions(arguments)), + trailingFunctionArgument(arguments) + ); } mergeFromTo(remote, branch) { if (!(filterString(remote) && filterString(branch))) { - return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`)); + return this._runTask( + configurationErrorTask( + `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings` + ) + ); } - return this._runTask(mergeTask([remote, branch, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments, false)); + return this._runTask( + mergeTask([remote, branch, ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments, false) + ); } outputHandler(handler) { this._executor.outputHandler = handler; return this; } push() { - const task = pushTask({ - remote: filterType(arguments[0], filterString), - branch: filterType(arguments[1], filterString) - }, getTrailingOptions(arguments)); + const task = pushTask( + { + remote: filterType(arguments[0], filterString), + branch: filterType(arguments[1], filterString) + }, + getTrailingOptions(arguments) + ); return this._runTask(task, trailingFunctionArgument(arguments)); } stash() { - return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments) + ); } status() { - return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + return this._runTask( + statusTask(getTrailingOptions(arguments)), + trailingFunctionArgument(arguments) + ); } }; - Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default()); + Object.assign( + SimpleGitApi.prototype, + checkout_default(), + commit_default(), + config_default(), + first_commit_default(), + grep_default(), + log_default(), + show_default(), + version_default() + ); } }); @@ -16924,6 +17579,7 @@ __export(scheduler_exports, { var import_promise_deferred2, createScheduledTask, Scheduler; var init_scheduler = __esm({ "src/lib/runners/scheduler.ts"() { + "use strict"; init_utils(); import_promise_deferred2 = __nccwpck_require__(9819); init_git_logger(); @@ -16949,7 +17605,12 @@ var init_scheduler = __esm({ } schedule() { if (!this.pending.length || this.running.length >= this.concurrency) { - this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency); + this.logger( + `Schedule attempt ignored, pending=%s running=%s concurrency=%s`, + this.pending.length, + this.running.length, + this.concurrency + ); return; } const task = append(this.running, this.pending.shift()); @@ -16980,6 +17641,7 @@ function applyPatchTask(patches, customArgs) { } var init_apply_patch = __esm({ "src/lib/tasks/apply-patch.ts"() { + "use strict"; init_task(); } }); @@ -17002,6 +17664,7 @@ function branchDeletionFailure(branch) { var BranchDeletionBatch; var init_BranchDeleteSummary = __esm({ "src/lib/responses/BranchDeleteSummary.ts"() { + "use strict"; BranchDeletionBatch = class { constructor() { this.all = []; @@ -17022,6 +17685,7 @@ function hasBranchDeletionError(data, processExitCode) { var deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions; var init_parse_branch_delete = __esm({ "src/lib/parsers/parse-branch-delete.ts"() { + "use strict"; init_BranchDeleteSummary(); init_utils(); deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/; @@ -17049,6 +17713,7 @@ var init_parse_branch_delete = __esm({ var BranchSummaryResult; var init_BranchSummary = __esm({ "src/lib/responses/BranchSummary.ts"() { + "use strict"; BranchSummaryResult = class { constructor() { this.all = []; @@ -17084,15 +17749,22 @@ function parseBranchSummary(stdOut) { var parsers9; var init_parse_branch = __esm({ "src/lib/parsers/parse-branch.ts"() { + "use strict"; init_BranchSummary(); init_utils(); parsers9 = [ - new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => { - result.push(branchStatus(current), true, name, commit, label); - }), - new LineParser(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => { - result.push(branchStatus(current), false, name, commit, label); - }) + new LineParser( + /^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, + (result, [current, name, commit, label]) => { + result.push(branchStatus(current), true, name, commit, label); + } + ), + new LineParser( + new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$", "s"), + (result, [current, name, commit, label]) => { + result.push(branchStatus(current), false, name, commit, label); + } + ) ]; } }); @@ -17164,13 +17836,17 @@ function deleteBranchTask(branch, forceDelete = false) { if (!hasBranchDeletionError(String(error), exitCode)) { return fail(error); } - throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error)); + throw new GitResponseError( + task.parser(bufferToString(stdOut), bufferToString(stdErr)), + String(error) + ); } }; return task; } var init_branch = __esm({ "src/lib/tasks/branch.ts"() { + "use strict"; init_git_response_error(); init_parse_branch_delete(); init_parse_branch(); @@ -17182,6 +17858,7 @@ var init_branch = __esm({ var parseCheckIgnore; var init_CheckIgnore = __esm({ "src/lib/responses/CheckIgnore.ts"() { + "use strict"; parseCheckIgnore = (text) => { return text.split(/\n/g).map((line) => line.trim()).filter((file) => !!file); }; @@ -17202,6 +17879,7 @@ function checkIgnoreTask(paths) { } var init_check_ignore = __esm({ "src/lib/tasks/check-ignore.ts"() { + "use strict"; init_CheckIgnore(); } }); @@ -17231,6 +17909,7 @@ function cloneMirrorTask(repo, directory, customArgs) { } var init_clone = __esm({ "src/lib/tasks/clone.ts"() { + "use strict"; init_task(); init_utils(); } @@ -17251,6 +17930,7 @@ function parseFetchResult(stdOut, stdErr) { var parsers10; var init_parse_fetch = __esm({ "src/lib/parsers/parse-fetch.ts"() { + "use strict"; init_utils(); parsers10 = [ new LineParser(/From (.+)$/, (result, [remote]) => { @@ -17273,14 +17953,17 @@ var init_parse_fetch = __esm({ tracking }); }), - new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, (result, [from, to, name, tracking]) => { - result.updated.push({ - name, - tracking, - to, - from - }); - }) + new LineParser( + /\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, + (result, [from, to, name, tracking]) => { + result.updated.push({ + name, + tracking, + to, + from + }); + } + ) ]; } }); @@ -17310,6 +17993,7 @@ function fetchTask(remote, branch, customArgs) { } var init_fetch = __esm({ "src/lib/tasks/fetch.ts"() { + "use strict"; init_parse_fetch(); init_task(); } @@ -17322,6 +18006,7 @@ function parseMoveResult(stdOut) { var parsers11; var init_parse_move = __esm({ "src/lib/parsers/parse-move.ts"() { + "use strict"; init_utils(); parsers11 = [ new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => { @@ -17345,6 +18030,7 @@ function moveTask(from, to) { } var init_move = __esm({ "src/lib/tasks/move.ts"() { + "use strict"; init_parse_move(); init_utils(); } @@ -17367,7 +18053,10 @@ function pullTask(remote, branch, customArgs) { return parsePullResult(stdOut, stdErr); }, onError(result, _error, _done, fail) { - const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr)); + const pullError = parsePullErrorResult( + bufferToString(result.stdOut), + bufferToString(result.stdErr) + ); if (pullError) { return fail(new GitResponseError(pullError)); } @@ -17377,6 +18066,7 @@ function pullTask(remote, branch, customArgs) { } var init_pull = __esm({ "src/lib/tasks/pull.ts"() { + "use strict"; init_git_response_error(); init_parse_pull(); init_utils(); @@ -17409,6 +18099,7 @@ function forEach(text, handler) { } var init_GetRemoteSummary = __esm({ "src/lib/responses/GetRemoteSummary.ts"() { + "use strict"; init_utils(); } }); @@ -17422,7 +18113,7 @@ __export(remote_exports, { remoteTask: () => remoteTask, removeRemoteTask: () => removeRemoteTask }); -function addRemoteTask(remoteName, remoteRepo, customArgs = []) { +function addRemoteTask(remoteName, remoteRepo, customArgs) { return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]); } function getRemotesTask(verbose) { @@ -17436,14 +18127,14 @@ function getRemotesTask(verbose) { parser: verbose ? parseGetRemotesVerbose : parseGetRemotes }; } -function listRemotesTask(customArgs = []) { +function listRemotesTask(customArgs) { const commands = [...customArgs]; if (commands[0] !== "ls-remote") { commands.unshift("ls-remote"); } return straightThroughStringTask(commands); } -function remoteTask(customArgs = []) { +function remoteTask(customArgs) { const commands = [...customArgs]; if (commands[0] !== "remote") { commands.unshift("remote"); @@ -17455,6 +18146,7 @@ function removeRemoteTask(remoteName) { } var init_remote = __esm({ "src/lib/tasks/remote.ts"() { + "use strict"; init_GetRemoteSummary(); init_task(); } @@ -17468,7 +18160,11 @@ __export(stash_list_exports, { function stashListTask(opt = {}, customArgs) { const options = parseLogOptions(opt); const commands = ["stash", "list", ...options.commands, ...customArgs]; - const parser3 = createListLogSummaryParser(options.splitter, options.fields, logFormatFromCommand(commands)); + const parser3 = createListLogSummaryParser( + options.splitter, + options.fields, + logFormatFromCommand(commands) + ); return validateLogFormatConfig(commands) || { commands, format: "utf-8", @@ -17477,6 +18173,7 @@ function stashListTask(opt = {}, customArgs) { } var init_stash_list = __esm({ "src/lib/tasks/stash-list.ts"() { + "use strict"; init_log_format(); init_parse_list_log_summary(); init_diff(); @@ -17510,6 +18207,7 @@ function updateSubModuleTask(customArgs) { } var init_sub_module = __esm({ "src/lib/tasks/sub-module.ts"() { + "use strict"; init_task(); } }); @@ -17538,6 +18236,7 @@ function toNumber(input) { var TagList, parseTagList; var init_TagList = __esm({ "src/lib/responses/TagList.ts"() { + "use strict"; TagList = class { constructor(all, latest) { this.all = all; @@ -17605,6 +18304,7 @@ function addAnnotatedTagTask(name, tagMessage) { } var init_tag = __esm({ "src/lib/tasks/tag.ts"() { + "use strict"; init_TagList(); } }); @@ -17612,6 +18312,7 @@ var init_tag = __esm({ // src/git.js var require_git = __commonJS({ "src/git.js"(exports2, module2) { + "use strict"; var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports)); var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports)); var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports)); @@ -17661,12 +18362,17 @@ var require_git = __commonJS({ var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports)); var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports)); function Git2(options, plugins) { - this._executor = new GitExecutor2(options.binary, options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins); + this._plugins = plugins; + this._executor = new GitExecutor2( + options.baseDir, + new Scheduler2(options.maxConcurrentProcesses), + plugins + ); this._trimmed = options.trimmed; } (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2; Git2.prototype.customBinary = function(command) { - this._executor.binary = command; + this._plugins.reconfigure("binary", command); return this; }; Git2.prototype.env = function(name, value) { @@ -17678,7 +18384,13 @@ var require_git = __commonJS({ return this; }; Git2.prototype.stashList = function(options) { - return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments)); + return this._runTask( + stashListTask2( + trailingOptionsArgument2(arguments) || {}, + filterArray2(options) && options || [] + ), + trailingFunctionArgument2(arguments) + ); }; function createCloneTask(api, task, repoPath, localPath) { if (typeof repoPath !== "string") { @@ -17687,10 +18399,16 @@ var require_git = __commonJS({ return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments)); } Git2.prototype.clone = function() { - return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments)); + return this._runTask( + createCloneTask("clone", cloneTask2, ...arguments), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.mirror = function() { - return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments)); + return this._runTask( + createCloneTask("mirror", cloneMirrorTask2, ...arguments), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.mv = function(from, to) { return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments)); @@ -17704,46 +18422,86 @@ var require_git = __commonJS({ }); }; Git2.prototype.pull = function(remote, branch, options, then) { - return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + pullTask2( + filterType2(remote, filterString2), + filterType2(branch, filterString2), + getTrailingOptions2(arguments) + ), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.fetch = function(remote, branch) { - return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + fetchTask2( + filterType2(remote, filterString2), + filterType2(branch, filterString2), + getTrailingOptions2(arguments) + ), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.silent = function(silence) { - console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"); + console.warn( + "simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3" + ); return this; }; Git2.prototype.tags = function(options, then) { - return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + tagListTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.rebase = function() { - return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.reset = function(mode) { - return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.revert = function(commit) { const next = trailingFunctionArgument2(arguments); if (typeof commit !== "string") { return this._runTask(configurationErrorTask2("Commit must be a string"), next); } - return this._runTask(straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), next); + return this._runTask( + straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), + next + ); }; Git2.prototype.addTag = function(name) { const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name"); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) { - return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments)); + return this._runTask( + addAnnotatedTagTask2(tagName, tagMessage), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) { - return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); + return this._runTask( + deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) { - return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); + return this._runTask( + deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.branch = function(options, then) { - return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + branchTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.branchLocal = function(then) { return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments)); @@ -17760,7 +18518,10 @@ var require_git = __commonJS({ command.push(...getTrailingOptions2(arguments, 0, true)); var next = trailingFunctionArgument2(arguments); if (!command.length) { - return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next); + return this._runTask( + configurationErrorTask2("Raw: must supply one or more command to execute"), + next + ); } return this._runTask(straightThroughStringTask2(command, this._trimmed), next); }; @@ -17768,19 +18529,34 @@ var require_git = __commonJS({ return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments)); }; Git2.prototype.submoduleUpdate = function(args, then) { - return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); + return this._runTask( + updateSubModuleTask2(getTrailingOptions2(arguments, true)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.submoduleInit = function(args, then) { - return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); + return this._runTask( + initSubModuleTask2(getTrailingOptions2(arguments, true)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.subModule = function(options, then) { - return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + subModuleTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.listRemote = function() { - return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + listRemotesTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.addRemote = function(remoteName, remoteRepo, then) { - return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.removeRemote = function(remoteName, then) { return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments)); @@ -17789,7 +18565,10 @@ var require_git = __commonJS({ return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments)); }; Git2.prototype.remote = function(options, then) { - return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + remoteTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.tag = function(options, then) { const command = getTrailingOptions2(arguments); @@ -17799,17 +18578,29 @@ var require_git = __commonJS({ return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments)); }; Git2.prototype.updateServerInfo = function(then) { - return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["update-server-info"]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.pushTags = function(remote, then) { - const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments)); + const task = pushTagsTask2( + { remote: filterType2(remote, filterString2) }, + getTrailingOptions2(arguments) + ); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.rm = function(files) { - return this._runTask(straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.rmKeepLocal = function(files) { - return this._runTask(straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.catFile = function(options, then) { return this._catFile("utf-8", arguments); @@ -17822,7 +18613,10 @@ var require_git = __commonJS({ var command = ["cat-file"]; var options = args[0]; if (typeof options === "string") { - return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler); + return this._runTask( + configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), + handler + ); } if (Array.isArray(options)) { command.push.apply(command, options); @@ -17831,25 +18625,38 @@ var require_git = __commonJS({ return this._runTask(task, handler); }; Git2.prototype.diff = function(options, then) { - const task = filterString2(options) ? configurationErrorTask2("git.diff: supplying options as a single string is no longer supported, switch to an array of strings") : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]); + const task = filterString2(options) ? configurationErrorTask2( + "git.diff: supplying options as a single string is no longer supported, switch to an array of strings" + ) : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.diffSummary = function() { - return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments)); + return this._runTask( + diffSummaryTask2(getTrailingOptions2(arguments, 1)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.applyPatch = function(patches) { - const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(`git.applyPatch requires one or more string patches as the first argument`) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1))); + const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2( + `git.applyPatch requires one or more string patches as the first argument` + ) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1))); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.revparse = function() { const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)]; - return this._runTask(straightThroughStringTask2(commands, true), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(commands, true), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.clean = function(mode, options, then) { const usingCleanOptionsArray = isCleanOptionsArray2(mode); const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || ""; const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0)); - return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments)); + return this._runTask( + cleanWithOptionsTask2(cleanMode, customArgs), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.exec = function(then) { const task = { @@ -17867,10 +18674,16 @@ var require_git = __commonJS({ return this; }; Git2.prototype.checkIgnore = function(pathnames, then) { - return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments)); + return this._runTask( + checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.checkIsRepo = function(checkType, then) { - return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments)); + return this._runTask( + checkIsRepoTask2(filterType2(checkType, filterString2)), + trailingFunctionArgument2(arguments) + ); }; module2.exports = Git2; } @@ -17893,10 +18706,17 @@ function gitExportFactory(factory) { return Object.assign(factory.bind(null), api_exports); } function gitInstanceFactory(baseDir, options) { + var _a2; const plugins = new PluginStore(); - const config = createInstanceConfig(baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, options); + const config = createInstanceConfig( + baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, + options + ); if (!folderExists(config.baseDir)) { - throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`); + throw new GitConstructError( + config, + `Cannot use simple-git on a directory that does not exist` + ); } if (Array.isArray(config.config)) { plugins.add(commandConfigPrefixingPlugin(config.config)); @@ -17910,11 +18730,13 @@ function gitInstanceFactory(baseDir, options) { config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions)); plugins.add(errorDetectionPlugin(errorDetectionHandler(true))); config.errors && plugins.add(errorDetectionPlugin(config.errors)); + customBinaryPlugin(plugins, config.binary, (_a2 = config.unsafe) == null ? void 0 : _a2.allowUnsafeCustomBinary); return new Git(config, plugins); } var Git; var init_git_factory = __esm({ "src/lib/git-factory.ts"() { + "use strict"; init_api(); init_plugins(); init_suffix_paths_plugin(); @@ -17942,22 +18764,27 @@ function gitP(...args) { function chainReturn() { return chain; } - const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce((api, name) => { - const isAsync = functionNamesPromiseApi.includes(name); - const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api); - const alternative = isAsync ? chainReturn : builderReturn; - Object.defineProperty(api, name, { - enumerable: false, - configurable: false, - value: git ? valid : alternative - }); - return api; - }, {}); + const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce( + (api, name) => { + const isAsync = functionNamesPromiseApi.includes(name); + const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api); + const alternative = isAsync ? chainReturn : builderReturn; + Object.defineProperty(api, name, { + enumerable: false, + configurable: false, + value: git ? valid : alternative + }); + return api; + }, + {} + ); return promiseApi; function asyncWrapper(fn, git2) { return function(...args2) { if (typeof args2[args2.length] === "function") { - throw new TypeError("Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to " + fn); + throw new TypeError( + "Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to " + fn + ); } return chain.then(function() { return new Promise(function(resolve, reject) { @@ -17992,6 +18819,7 @@ function toError(error) { var functionNamesBuilderApi, functionNamesPromiseApi; var init_promise_wrapped = __esm({ "src/lib/runners/promise-wrapped.ts"() { + "use strict"; init_git_response_error(); init_git_factory(); functionNamesBuilderApi = ["customBinary", "env", "outputHandler", "silent"]; @@ -30271,6 +31099,9 @@ function httpRedirectFetch (fetchParams, response) { // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name request.headersList.delete('authorization') + // https://fetch.spec.whatwg.org/#authentication-entries + request.headersList.delete('proxy-authorization', true) + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. request.headersList.delete('cookie') request.headersList.delete('host') @@ -41967,7 +42798,7 @@ Dicer.prototype._write = function (data, encoding, cb) { if (this._headerFirst && this._isPreamble) { if (!this._part) { this._part = new PartStream(this._partOpts) - if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() } + if (this.listenerCount('preamble') !== 0) { this.emit('preamble', this._part) } else { this._ignore() } } const r = this._hparser.push(data) if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() } @@ -42024,7 +42855,7 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { } } if (this._dashes === 2) { - if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) } + if ((start + i) < end && this.listenerCount('trailer') !== 0) { this.emit('trailer', data.slice(start + i, end)) } this.reset() this._finished = true // no more parts will be added @@ -42042,7 +42873,13 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { this._part._read = function (n) { self._unpause() } - if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() } + if (this._isPreamble && this.listenerCount('preamble') !== 0) { + this.emit('preamble', this._part) + } else if (this._isPreamble !== true && this.listenerCount('part') !== 0) { + this.emit('part', this._part) + } else { + this._ignore() + } if (!this._isPreamble) { this._inHeader = true } } if (data && start < end && !this._ignoreData) { @@ -42725,7 +43562,7 @@ function Multipart (boy, cfg) { ++nfiles - if (!boy._events.file) { + if (boy.listenerCount('file') === 0) { self.parser._ignore() return } @@ -43254,7 +44091,7 @@ const decoders = { if (textDecoders.has(this.toString())) { try { return textDecoders.get(this).decode(data) - } catch (e) { } + } catch {} } return typeof data === 'string' ? data diff --git a/lib/precommit/index.js b/lib/precommit/index.js index 1c44141..20cd587 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -1844,7 +1844,7 @@ class HttpClient { if (this._keepAlive && useProxy) { agent = this._proxyAgent; } - if (this._keepAlive && !useProxy) { + if (!useProxy) { agent = this._agent; } // if agent is already assigned use that agent. @@ -1876,16 +1876,12 @@ class HttpClient { 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) { + // if tunneling agent isn't assigned create a new agent + if (!agent) { const options = { keepAlive: this._keepAlive, maxSockets }; agent = usingSsl ? new https.Agent(options) : new http.Agent(options); this._agent = agent; } - // if not using private agent and tunnel agent isn't setup then use global agent - if (!agent) { - agent = usingSsl ? https.globalAgent : http.globalAgent; - } if (usingSsl && this._ignoreSslError) { // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options @@ -2778,7 +2774,29 @@ exports.commitRules = void 0; const diagnose_it_1 = __nccwpck_require__(4657); const chalk_1 = __importDefault(__nccwpck_require__(8818)); const commit_1 = __nccwpck_require__(8065); +/** + * Checks whether the provided string is a noun. + * A noun is defined as a single word which can be capitalized or contain hyphens, therefore + * it will not support multi-word nouns (i.e. New York). + * + * @param str String to check + * @returns True if the string is a noun, false otherwise. + * + * @internal + */ function isNoun(str) { + return /^[A-Za-z][a-z]*(-[A-Za-z][a-z]*)*$/.test(str); +} +/** + * Validates whether the provided type valid. + * A valid type is defined as a single word, all lowercase, no spaces, and no special characters. + * + * @param str String to check + * @returns True if the string is a valid type, false otherwise. + * + * @internal + */ +function isValidType(str) { return !str.trim().includes(" ") && !/[^a-z]/i.test(str.trim()); } function highlightString(str, substring) { @@ -2830,9 +2848,10 @@ class CC01 { // Validated with EC-02 } else { - // Ensure that we have a noun - if (!isNoun(commit.type.value)) + // Ensure that we have a valid type (single word, no spaces, no special characters) + if (!isValidType(commit.type.value)) { errors.push(createDiagnosticsMessage(commit, this.description, "which consists of a noun", "type")); + } // Validate for spacing after the type if (commit.type.value.trim() !== commit.type.value) { if (commit.scope.value) { @@ -2993,7 +3012,7 @@ class EC02 { const expectedTypes = ["feat", "fix", ...Array.from(uniqueAddedTypes)]; this.description = `Commits ${uniqueAddedTypes.size > 0 ? "MUST" : "MAY"} be prefixed with a type, which consists of one of the configured values (${expectedTypes.join(", ")}).`; if (commit.type.value === undefined || - !isNoun(commit.type.value) || + !isValidType(commit.type.value) || expectedTypes.includes(commit.type.value.toLowerCase().trimEnd())) { return []; } @@ -4489,7 +4508,7 @@ var import_graphql = __nccwpck_require__(8467); var import_auth_token = __nccwpck_require__(334); // pkg/dist-src/version.js -var VERSION = "5.0.2"; +var VERSION = "5.1.0"; // pkg/dist-src/index.js var noop = () => { @@ -5198,7 +5217,7 @@ __export(dist_src_exports, { module.exports = __toCommonJS(dist_src_exports); // pkg/dist-src/version.js -var VERSION = "9.1.5"; +var VERSION = "9.2.1"; // pkg/dist-src/normalize-paginated-list-response.js function normalizePaginatedListResponse(response) { @@ -5359,6 +5378,8 @@ var paginatingEndpoints = [ "GET /orgs/{org}/members/{username}/codespaces", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", + "GET /orgs/{org}/organization-roles/{role_id}/teams", + "GET /orgs/{org}/organization-roles/{role_id}/users", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", @@ -5595,7 +5616,7 @@ __export(dist_src_exports, { module.exports = __toCommonJS(dist_src_exports); // pkg/dist-src/version.js -var VERSION = "10.2.0"; +var VERSION = "10.4.1"; // pkg/dist-src/generated/endpoints.js var Endpoints = { @@ -5722,6 +5743,9 @@ var Endpoints = { "GET /repos/{owner}/{repo}/actions/permissions/selected-actions" ], getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + getCustomOidcSubClaimForRepo: [ + "GET /repos/{owner}/{repo}/actions/oidc/customization/sub" + ], getEnvironmentPublicKey: [ "GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key" ], @@ -5874,6 +5898,9 @@ var Endpoints = { setCustomLabelsForSelfHostedRunnerForRepo: [ "PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels" ], + setCustomOidcSubClaimForRepo: [ + "PUT /repos/{owner}/{repo}/actions/oidc/customization/sub" + ], setGithubActionsDefaultWorkflowPermissionsOrganization: [ "PUT /orgs/{org}/actions/permissions/workflow" ], @@ -5943,6 +5970,7 @@ var Endpoints = { listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"], markNotificationsAsRead: ["PUT /notifications"], markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"], + markThreadAsDone: ["DELETE /notifications/threads/{thread_id}"], markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"], setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"], setThreadSubscription: [ @@ -6219,10 +6247,10 @@ var Endpoints = { updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"] }, copilot: { - addCopilotForBusinessSeatsForTeams: [ + addCopilotSeatsForTeams: [ "POST /orgs/{org}/copilot/billing/selected_teams" ], - addCopilotForBusinessSeatsForUsers: [ + addCopilotSeatsForUsers: [ "POST /orgs/{org}/copilot/billing/selected_users" ], cancelCopilotSeatAssignmentForTeams: [ @@ -6535,10 +6563,24 @@ var Endpoints = { } ] }, + oidc: { + getOidcCustomSubTemplateForOrg: [ + "GET /orgs/{org}/actions/oidc/customization/sub" + ], + updateOidcCustomSubTemplateForOrg: [ + "PUT /orgs/{org}/actions/oidc/customization/sub" + ] + }, orgs: { addSecurityManagerTeam: [ "PUT /orgs/{org}/security-managers/teams/{team_slug}" ], + assignTeamToOrgRole: [ + "PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}" + ], + assignUserToOrgRole: [ + "PUT /orgs/{org}/organization-roles/users/{username}/{role_id}" + ], blockUser: ["PUT /orgs/{org}/blocks/{username}"], cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"], checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"], @@ -6547,6 +6589,7 @@ var Endpoints = { convertMemberToOutsideCollaborator: [ "PUT /orgs/{org}/outside_collaborators/{username}" ], + createCustomOrganizationRole: ["POST /orgs/{org}/organization-roles"], createInvitation: ["POST /orgs/{org}/invitations"], createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"], createOrUpdateCustomPropertiesValuesForRepos: [ @@ -6557,6 +6600,9 @@ var Endpoints = { ], createWebhook: ["POST /orgs/{org}/hooks"], delete: ["DELETE /orgs/{org}"], + deleteCustomOrganizationRole: [ + "DELETE /orgs/{org}/organization-roles/{role_id}" + ], deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], enableOrDisableSecurityProductOnAllOrgRepos: [ "POST /orgs/{org}/{security_product}/{enablement}" @@ -6568,6 +6614,7 @@ var Endpoints = { ], getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], + getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"], getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"], getWebhookDelivery: [ @@ -6583,6 +6630,12 @@ var Endpoints = { listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], listMembers: ["GET /orgs/{org}/members"], listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"], + listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"], + listOrgRoleUsers: ["GET /orgs/{org}/organization-roles/{role_id}/users"], + listOrgRoles: ["GET /orgs/{org}/organization-roles"], + listOrganizationFineGrainedPermissions: [ + "GET /orgs/{org}/organization-fine-grained-permissions" + ], listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"], listPatGrantRepositories: [ "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories" @@ -6597,6 +6650,9 @@ var Endpoints = { listSecurityManagerTeams: ["GET /orgs/{org}/security-managers"], listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"], listWebhooks: ["GET /orgs/{org}/hooks"], + patchCustomOrganizationRole: [ + "PATCH /orgs/{org}/organization-roles/{role_id}" + ], pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"], redeliverWebhookDelivery: [ "POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts" @@ -6621,6 +6677,18 @@ var Endpoints = { reviewPatGrantRequestsInBulk: [ "POST /orgs/{org}/personal-access-token-requests" ], + revokeAllOrgRolesTeam: [ + "DELETE /orgs/{org}/organization-roles/teams/{team_slug}" + ], + revokeAllOrgRolesUser: [ + "DELETE /orgs/{org}/organization-roles/users/{username}" + ], + revokeOrgRoleTeam: [ + "DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}" + ], + revokeOrgRoleUser: [ + "DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}" + ], setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"], setPublicMembershipForAuthenticatedUser: [ "PUT /orgs/{org}/public_members/{username}" @@ -6911,6 +6979,9 @@ var Endpoints = { {}, { mapToData: "users" } ], + cancelPagesDeployment: [ + "POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel" + ], checkAutomatedSecurityFixes: [ "GET /repos/{owner}/{repo}/automated-security-fixes" ], @@ -6946,12 +7017,15 @@ var Endpoints = { createForAuthenticatedUser: ["POST /user/repos"], createFork: ["POST /repos/{owner}/{repo}/forks"], createInOrg: ["POST /orgs/{org}/repos"], + createOrUpdateCustomPropertiesValues: [ + "PATCH /repos/{owner}/{repo}/properties/values" + ], createOrUpdateEnvironment: [ "PUT /repos/{owner}/{repo}/environments/{environment_name}" ], createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"], createOrgRuleset: ["POST /orgs/{org}/rulesets"], - createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployment"], + createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployments"], createPagesSite: ["POST /repos/{owner}/{repo}/pages"], createRelease: ["POST /repos/{owner}/{repo}/releases"], createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"], @@ -7104,6 +7178,9 @@ var Endpoints = { getOrgRulesets: ["GET /orgs/{org}/rulesets"], getPages: ["GET /repos/{owner}/{repo}/pages"], getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"], + getPagesDeployment: [ + "GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}" + ], getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"], getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"], getPullRequestReviewProtection: [ @@ -7314,6 +7391,9 @@ var Endpoints = { ] }, securityAdvisories: { + createFork: [ + "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks" + ], createPrivateVulnerabilityReport: [ "POST /repos/{owner}/{repo}/security-advisories/reports" ], @@ -7805,7 +7885,7 @@ var import_endpoint = __nccwpck_require__(9440); var import_universal_user_agent = __nccwpck_require__(5030); // pkg/dist-src/version.js -var VERSION = "8.1.6"; +var VERSION = "8.2.0"; // pkg/dist-src/is-plain-object.js function isPlainObject(value) { @@ -7949,11 +8029,17 @@ async function getResponseData(response) { function toErrorMessage(data) { if (typeof data === "string") return data; + let suffix; + if ("documentation_url" in data) { + suffix = ` - ${data.documentation_url}`; + } else { + suffix = ""; + } if ("message" in data) { if (Array.isArray(data.errors)) { - return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}`; + return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}${suffix}`; } - return data.message; + return `${data.message}${suffix}`; } return `Unknown error: ${JSON.stringify(data)}`; } @@ -11008,6 +11094,8 @@ Diff.prototype = { /*istanbul ignore end*/ diff: function diff(oldString, newString) { /*istanbul ignore start*/ + var _options$timeout; + var /*istanbul ignore end*/ options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; @@ -11046,68 +11134,104 @@ Diff.prototype = { maxEditLength = Math.min(maxEditLength, options.maxEditLength); } + var maxExecutionTime = + /*istanbul ignore start*/ + (_options$timeout = + /*istanbul ignore end*/ + options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; + var abortAfterTimestamp = Date.now() + maxExecutionTime; var bestPath = [{ - newPos: -1, - components: [] + oldPos: -1, + lastComponent: undefined }]; // Seed editLength = 0, i.e. the content starts with the same values - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { + if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // Identity per the equality and tokenizer return done([{ value: this.join(newString), count: newString.length }]); - } // Main worker method. checks all permutations of a given edit length for acceptance. - + } // Once we hit the right edge of the edit graph on some diagonal k, we can + // definitely reach the end of the edit graph in no more than k edits, so + // there's no point in considering any moves to diagonal k+1 any more (from + // which we're guaranteed to need at least k+1 more edits). + // Similarly, once we've reached the bottom of the edit graph, there's no + // point considering moves to lower diagonals. + // We record this fact by setting minDiagonalToConsider and + // maxDiagonalToConsider to some finite value once we've hit the edge of + // the edit graph. + // This optimization is not faithful to the original algorithm presented in + // Myers's paper, which instead pointlessly extends D-paths off the end of + // the edit graph - see page 7 of Myers's paper which notes this point + // explicitly and illustrates it with a diagram. This has major performance + // implications for some common scenarios. For instance, to compute a diff + // where the new text simply appends d characters on the end of the + // original text of length n, the true Myers algorithm will take O(n+d^2) + // time while this optimization needs only O(n+d) time. + + + var minDiagonalToConsider = -Infinity, + maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { + for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { var basePath = /*istanbul ignore start*/ void 0 /*istanbul ignore end*/ ; + var removePath = bestPath[diagonalPath - 1], + addPath = bestPath[diagonalPath + 1]; - var addPath = bestPath[diagonalPath - 1], - removePath = bestPath[diagonalPath + 1], - _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - - if (addPath) { + if (removePath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } - var canAdd = addPath && addPath.newPos + 1 < newLen, - canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; + var canAdd = false; + + if (addPath) { + // what newPos will be after we do an insertion: + var addPathNewPos = addPath.oldPos - diagonalPath; + canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; + } + + var canRemove = removePath && removePath.oldPos + 1 < oldLen; if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; } // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin + // path whose position in the old string is the farthest from the origin // and does not pass the bounds of the diff graph + // TODO: Remove the `+ 1` here to make behavior match Myers algorithm + // and prefer to order removals before insertions. - if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { - basePath = clonePath(removePath); - self.pushComponent(basePath.components, undefined, true); + if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) { + basePath = self.addToPath(addPath, true, undefined, 0); } else { - basePath = addPath; // No need to clone, we've pulled it from the list - - basePath.newPos++; - self.pushComponent(basePath.components, true, undefined); + basePath = self.addToPath(removePath, undefined, true, 1); } - _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath); - if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { - return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); + if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // If we have hit the end of both strings, then we are done + return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); } else { - // Otherwise track this path as a potential candidate and continue. bestPath[diagonalPath] = basePath; + + if (basePath.oldPos + 1 >= oldLen) { + maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); + } + + if (newPos + 1 >= newLen) { + minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); + } } } @@ -11121,7 +11245,7 @@ Diff.prototype = { if (callback) { (function exec() { setTimeout(function () { - if (editLength > maxEditLength) { + if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { return callback(); } @@ -11131,7 +11255,7 @@ Diff.prototype = { }, 0); })(); } else { - while (editLength <= maxEditLength) { + while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { var ret = execEditLength(); if (ret) { @@ -11144,23 +11268,29 @@ Diff.prototype = { /*istanbul ignore start*/ /*istanbul ignore end*/ - pushComponent: function pushComponent(components, added, removed) { - var last = components[components.length - 1]; + addToPath: function addToPath(path, added, removed, oldPosInc) { + var last = path.lastComponent; if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length - 1] = { - count: last.count + 1, - added: added, - removed: removed + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: last.count + 1, + added: added, + removed: removed, + previousComponent: last.previousComponent + } }; } else { - components.push({ - count: 1, - added: added, - removed: removed - }); + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: 1, + added: added, + removed: removed, + previousComponent: last + } + }; } }, @@ -11170,8 +11300,8 @@ Diff.prototype = { extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, commonCount = 0; while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { @@ -11181,13 +11311,14 @@ Diff.prototype = { } if (commonCount) { - basePath.components.push({ - count: commonCount - }); + basePath.lastComponent = { + count: commonCount, + previousComponent: basePath.lastComponent + }; } - basePath.newPos = newPos; - return oldPos; + basePath.oldPos = oldPos; + return newPos; }, /*istanbul ignore start*/ @@ -11238,7 +11369,20 @@ Diff.prototype = { } }; -function buildValues(diff, components, newString, oldString, useLongestToken) { +function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { + // First we convert our linked list of components in reverse order to an + // array in the right order: + var components = []; + var nextComponent; + + while (lastComponent) { + components.push(lastComponent); + nextComponent = lastComponent.previousComponent; + delete lastComponent.previousComponent; + lastComponent = nextComponent; + } + + components.reverse(); var componentPos = 0, componentLen = components.length, newPos = 0, @@ -11281,23 +11425,16 @@ function buildValues(diff, components, newString, oldString, useLongestToken) { // This is only available for string mode. - var lastComponent = components[componentLen - 1]; + var finalComponent = components[componentLen - 1]; - if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { - components[componentLen - 2].value += lastComponent.value; + if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) { + components[componentLen - 2].value += finalComponent.value; components.pop(); } return components; } - -function clonePath(path) { - return { - newPos: path.newPos, - components: path.components.slice(0) - }; -} -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2si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ID0gdG1wO1xuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIC8vIFNwZWNpYWwgY2FzZSBoYW5kbGUgZm9yIHdoZW4gb25lIHRlcm1pbmFsIGlzIGlnbm9yZWQgKGkuZS4gd2hpdGVzcGFjZSkuXG4gIC8vIEZvciB0aGlzIGNhc2Ugd2UgbWVyZ2UgdGhlIHRlcm1pbmFsIGludG8gdGhlIHByaW9yIHN0cmluZyBhbmQgZHJvcCB0aGUgY2hhbmdlLlxuICAvLyBUaGlzIGlzIG9ubHkgYXZhaWxhYmxlIGZvciBzdHJpbmcgbW9kZS5cbiAgbGV0IGxhc3RDb21wb25lbnQgPSBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDFdO1xuICBpZiAoY29tcG9uZW50TGVuID4gMVxuICAgICAgJiYgdHlwZW9mIGxhc3RDb21wb25lbnQudmFsdWUgPT09ICdzdHJpbmcnXG4gICAgICAmJiAobGFzdENvbXBvbmVudC5hZGRlZCB8fCBsYXN0Q29tcG9uZW50LnJlbW92ZWQpXG4gICAgICAmJiBkaWZmLmVxdWFscygnJywgbGFzdENvbXBvbmVudC52YWx1ZSkpIHtcbiAgICBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDJdLnZhbHVlICs9IGxhc3RDb21wb25lbnQudmFsdWU7XG4gICAgY29tcG9uZW50cy5wb3AoKTtcbiAgfVxuXG4gIHJldHVybiBjb21wb25lbnRzO1xufVxuXG5mdW5jdGlvbiBjbG9uZVBhdGgocGF0aCkge1xuICByZXR1cm4geyBuZXdQb3M6IHBhdGgubmV3UG9zLCBjb21wb25lbnRzOiBwYXRoLmNvbXBvbmVudHMuc2xpY2UoMCkgfTtcbn1cbiJdfQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJ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hbENvbXBvbmVudC52YWx1ZTtcbiAgICBjb21wb25lbnRzLnBvcCgpO1xuICB9XG5cbiAgcmV0dXJuIGNvbXBvbmVudHM7XG59XG4iXX0= /***/ }), @@ -11612,6 +11749,11 @@ exports.lineDiff = lineDiff; /*istanbul ignore end*/ lineDiff.tokenize = function (value) { + if (this.options.stripTrailingCr) { + // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior + value = value.replace(/\r\n/g, '\n'); + } + var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line @@ -11659,7 +11801,7 @@ function diffTrimmedLines(oldStr, newStr, callback) { }); return lineDiff.diff(oldStr, newStr, options); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOlsibGluZURpZmYiLCJEaWZmIiwidG9rZW5pemUiLCJ2YWx1ZSIsInJldExpbmVzIiwibGluZXNBbmROZXdsaW5lcyIsInNwbGl0IiwibGVuZ3RoIiwicG9wIiwiaSIsImxpbmUiLCJvcHRpb25zIiwibmV3bGluZUlzVG9rZW4iLCJpZ25vcmVXaGl0ZXNwYWNlIiwidHJpbSIsInB1c2giLCJkaWZmTGluZXMiLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiLCJkaWZmVHJpbW1lZExpbmVzIiwiZ2VuZXJhdGVPcHRpb25zIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTs7Ozs7QUFFTyxJQUFNQSxRQUFRLEdBQUc7QUFBSUM7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUEsQ0FBSixFQUFqQjs7Ozs7O0FBQ1BELFFBQVEsQ0FBQ0UsUUFBV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IDwgbGluZXNBbmROZXdsaW5lcy5sZW5ndGg7IGkrKykge1xuICAgIGxldCBsaW5lID0gbGluZXNBbmROZXdsaW5lc1tpXTtcblxuICAgIGlmIChpICUgMiAmJiAhdGhpcy5vcHRpb25zLm5ld2xpbmVJc1Rva2VuKSB7XG4gICAgICByZXRMaW5lc1tyZXRMaW5lcy5sZW5ndGggLSAxXSArPSBsaW5lO1xuICAgIH0gZWxzZSB7XG4gICAgICBpZiAodGhpcy5vcHRpb25zLmlnbm9yZVdoaXRlc3BhY2UpIHtcbiAgICAgICAgbGluZSA9IGxpbmUudHJpbSgpO1xuICAgICAgfVxuICAgICAgcmV0TGluZXMucHVzaChsaW5lKTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gcmV0TGluZXM7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZkxpbmVzKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjaykgeyByZXR1cm4gbGluZURpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spOyB9XG5leHBvcnQgZnVuY3Rpb24gZGlmZlRyaW1tZWRMaW5lcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHtcbiAgbGV0IG9wdGlvbnMgPSBnZW5lcmF0ZU9wdGlvbnMoY2FsbGJhY2ssIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbiJdfQ== /***/ }), @@ -11929,6 +12071,12 @@ Object.defineProperty(exports, "merge", ({ return _merge.merge; } })); +Object.defineProperty(exports, "reversePatch", ({ + enumerable: true, + get: function get() { + return _reverse.reversePatch; + } +})); Object.defineProperty(exports, "structuredPatch", ({ enumerable: true, get: function get() { @@ -11947,6 +12095,12 @@ Object.defineProperty(exports, "createPatch", ({ return _create.createPatch; } })); +Object.defineProperty(exports, "formatPatch", ({ + enumerable: true, + get: function get() { + return _create.formatPatch; + } +})); Object.defineProperty(exports, "convertChangesToDMP", ({ enumerable: true, get: function get() { @@ -12027,6 +12181,12 @@ _merge = __nccwpck_require__(2640) /*istanbul ignore end*/ ; +var +/*istanbul ignore start*/ +_reverse = __nccwpck_require__(1794) +/*istanbul ignore end*/ +; + var /*istanbul ignore start*/ _create = __nccwpck_require__(4543) @@ -12048,7 +12208,7 @@ _xml = __nccwpck_require__(6982) /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } /*istanbul ignore end*/ -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQWdCQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTs7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBRUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUVBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBRUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7QUFBQTtBQUFBO0FBQUE7QU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oLFxuICBhcHBseVBhdGNoZXMsXG4gIHBhcnNlUGF0Y2gsXG4gIG1lcmdlLFxuICByZXZlcnNlUGF0Y2gsXG4gIGNvbnZlcnRDaGFuZ2VzVG9ETVAsXG4gIGNvbnZlcnRDaGFuZ2VzVG9YTUwsXG4gIGNhbm9uaWNhbGl6ZVxufTtcbiJdfQ== /***/ }), @@ -12207,7 +12367,7 @@ function applyPatch(source, uniDiff) { var line = _hunk.lines[j], operation = line.length > 0 ? line[0] : ' ', content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters[j]; + delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n'; if (operation === ' ') { _toPos++; @@ -12294,7 +12454,7 @@ function applyPatches(uniDiff, options) { processIndex(); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJwYXJzZVBhdGNoIiwiQXJyYXkiLCJpc0FycmF5IiwibGVuZ3RoIiwiRXJyb3IiLCJsaW5lcyIsInNwbGl0IiwiZGVsaW1pdGVycyIsIm1hdGNoIiwiaHVua3MiLCJjb21wYXJlTGluZSIsImxpbmVOdW1iZXIiLCJsaW5lIiwib3BlcmF0aW9uIiwicGF0Y2hDb250ZW50IiwiZXJyb3JDb3VudCIsImZ1enpGYWN0b3IiLCJtaW5MaW5lIiwib2Zmc2V0IiwicmVtb3ZlRU9GTkwiLCJhZGRFT0ZOTCIsImh1bmtGaXRzIiwiaHVuayIsInRvUG9zIiwiaiIsImNvbnRlbnQiLCJzdWJzdHIiLCJpIiwibWF4TGluZSIsIm9sZExpbmVzIiwibG9jYWxPZmZzZXQiLCJvbGRTdGFydCIsIml0ZXJhdG9yIiwiZGlzdGFuY2VJdGVyYXRvciIsInVuZGVmaW5lZCIsImRpZmZ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IGVycm9yQ291bnQgPSAwLFxuICAgICAgZnV6ekZhY3RvciA9IG9wdGlvbnMuZnV6ekZhY3RvciB8fCAwLFxuICAgICAgbWluTGluZSA9IDAsXG4gICAgICBvZmZzZXQgPSAwLFxuXG4gICAgICByZW1vdmVFT0ZOTCxcbiAgICAgIGFkZEVPRk5MO1xuXG4gIC8qKlxuICAgKiBDaGVja3MgaWYgdGhlIGh1bmsgZXhhY3RseSBmaXRzIG9uIHRoZSBwcm92aWRlZCBsb2NhdGlvblxuICAgKi9cbiAgZnVuY3Rpb24gaHVua0ZpdHMoaHVuaywgdG9Qb3MpIHtcbiAgICBmb3IgKGxldCBqID0gMDsgaiA8IGh1bmsubGluZXMubGVuZ3RoOyBqKyspIHtcbiAgICAgIGxldCBsaW5lID0gaHVuay5saW5lc1tqXSxcbiAgICAgICAgICBvcGVyYXRpb24gPSAobGluZS5sZW5ndGggPiAwID8gbGluZVswXSA6ICcgJyksXG4gICAgICAgICAgY29udGVudCA9IChsaW5lLmxlbmd0aCA+IDAgPyBsaW5lLnN1YnN0cigxKSA6IGxpbmUpO1xuXG4gICAgICBpZiAob3BlcmF0aW9uID09PSAnICcgfHwgb3BlcmF0aW9uID09PSAnLScpIHtcbiAgICAgICAgLy8gQ29udGV4dCBzYW5pdHkgY2hlY2tcbiAgICAgICAgaWYgKCFjb21wYXJlTGluZSh0b1BvcyArIDEsIGxpbmVzW3RvUG9zXSwgb3BlcmF0aW9uLCBjb250ZW50KSkge1xuICAgICAgICAgIGVycm9yQ291bnQrKztcblxuICAgICAgICAgIGlmIChlcnJvckNvdW50ID4gZnV6ekZhY3Rvcikge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0b1BvcysrO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB0cnVlO1xuICB9XG5cbiAgLy8gU2VhcmNoIGJlc3QgZml0IG9mZnNldHMgZm9yIGVhY2ggaHVuayBiY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m9jZXNzSW5kZXgoKSB7XG4gICAgbGV0IGluZGV4ID0gdW5pRGlmZltjdXJyZW50SW5kZXgrK107XG4gICAgaWYgKCFpbmRleCkge1xuICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoKTtcbiAgICB9XG5cbiAgICBvcHRpb25zLmxvYWRGaWxlKGluZGV4LCBmdW5jdGlvbihlcnIsIGRhdGEpIHtcbiAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoZXJyKTtcbiAgICAgIH1cblxuICAgICAgbGV0IHVwZGF0ZWRDb250ZW50ID0gYXBwbHlQYXRjaChkYXRhLCBpbmRleCwgb3B0aW9ucyk7XG4gICAgICBvcHRpb25zLnBhdGNoZWQoaW5kZXgsIHVwZGF0ZWRDb250ZW50LCBmdW5jdGlvbihlcnIpIHtcbiAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKGVycik7XG4gICAgICAgIH1cblxuICAgICAgICBwcm9jZXNzSW5kZXgoKTtcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9XG4gIHByb2Nlc3NJbmRleCgpO1xufVxuIl19 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJwYXJzZVBhdGNoIiwiQXJyYXkiLCJpc0FycmF5IiwibGVuZ3RoIiwiRXJyb3IiLCJsaW5lcyIsInNwbGl0IiwiZGVsaW1pdGVycyIsIm1hdGNoIiwiaHVua3MiLCJjb21wYXJlTGluZSIsImxpbmVOdW1iZXIiLCJsaW5lIiwib3BlcmF0aW9uIiwicGF0Y2hDb250ZW50IiwiZXJyb3JDb3VudCIsImZ1enpGYWN0b3IiLCJtaW5MaW5lI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CcnKTtcbn1cblxuLy8gV3JhcHBlciB0aGF0IHN1cHBvcnRzIG11bHRpcGxlIGZpbGUgcGF0Y2hlcyB2aWEgY2FsbGJhY2tzLlxuZXhwb3J0IGZ1bmN0aW9uIGFwcGx5UGF0Y2hlcyh1bmlEaWZmLCBvcHRpb25zKSB7XG4gIGlmICh0eXBlb2YgdW5pRGlmZiA9PT0gJ3N0cmluZycpIHtcbiAgICB1bmlEaWZmID0gcGFyc2VQYXRjaCh1bmlEaWZmKTtcbiAgfVxuXG4gIGxldCBjdXJyZW50SW5kZXggPSAwO1xuICBmdW5jdGlvbiBwcm9jZXNzSW5kZXgoKSB7XG4gICAgbGV0IGluZGV4ID0gdW5pRGlmZltjdXJyZW50SW5kZXgrK107XG4gICAgaWYgKCFpbmRleCkge1xuICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoKTtcbiAgICB9XG5cbiAgICBvcHRpb25zLmxvYWRGaWxlKGluZGV4LCBmdW5jdGlvbihlcnIsIGRhdGEpIHtcbiAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoZXJyKTtcbiAgICAgIH1cblxuICAgICAgbGV0IHVwZGF0ZWRDb250ZW50ID0gYXBwbHlQYXRjaChkYXRhLCBpbmRleCwgb3B0aW9ucyk7XG4gICAgICBvcHRpb25zLnBhdGNoZWQoaW5kZXgsIHVwZGF0ZWRDb250ZW50LCBmdW5jdGlvbihlcnIpIHtcbiAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKGVycik7XG4gICAgICAgIH1cblxuICAgICAgICBwcm9jZXNzSW5kZXgoKTtcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9XG4gIHByb2Nlc3NJbmRleCgpO1xufVxuIl19 /***/ }), @@ -12537,6 +12697,10 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne } function formatPatch(diff) { + if (Array.isArray(diff)) { + return diff.map(formatPatch).join('\n'); + } + var ret = []; if (diff.oldFileName == diff.newFileName) { @@ -12574,7 +12738,7 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9jcmVhdGUuanMiXSwibmFtZXMiOlsic3RydWN0dXJlZFBhdGNoIiwib2xkRmlsZU5hbWUiLCJuZXdGaWxlTmFtZSIsIm9sZFN0ciIsIm5ld1N0ciIsIm9sZEhlYWRlciIsIm5ld0hlYWRlciIsIm9wdGlvbnMiLCJjb250ZXh0IiwiZGlmZiIsImRpZmZMaW5lcyIsInB1c2giLCJ2YWx1ZSIsImxpbmVzIiwiY29udGV4dExpbmVzIiwibWFwIiwiZW50cnkiLCJodW5rcyIsIm9sZFJhbmdlU3RhcnQiLCJuZXdSYW5nZVN0YXJ0IiwiY3VyUmFuZ2UiLCJvbGRMaW5lIiwibmV3TGluZSIsImkiLCJjdXJyZW50IiwicmVwbGFjZSIsInNwbGl0IiwiYWRkZWQiLCJyZW1vdmVkIiwicHJldiIsInNsaWNlIiwibGVuZ3RoIiwiY29udGV4dFNpemUiLCJNYXRoIiwibWluIiwiaHVuayIsIm9sZFN0YXJ0Iiwib2xkTGluZXMiLCJuZXdTdGFydCIsIm5ld0xpbmVzIiwib2xkRU9GTmV3bGluZSIsInRlc3QiLCJuZXdFT0ZOZXdsaW5lIiwibm9ObEJlZm9yZUFkZHMiLCJzcGxpY2UiLCJmb3JtYXRQYXRjaCIsInJldCIsImFwcGx5Iiwiam9pbiIsImNyZWF0ZVR3b0ZpbGVzUGF0Y2giLCJjcmVhdGVQYXRjaCIsImZpbGVOYW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs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G4gICAgICAgIGh1bmsubGluZXMucHVzaChkaWZmc3RyW2ldKTtcbiAgICAgICAgaHVuay5saW5lZGVsaW1pdGVycy5wdXNoKGRlbGltaXRlcnNbaV0gfHwgJ1xcbicpO1xuXG4gICAgICAgIGlmIChvcGVyYXRpb24gPT09ICcrJykge1xuICAgICAgICAgIGFkZENvdW50Kys7XG4gICAgICAgIH0gZWxzZSBpZiAob3BlcmF0aW9uID09PSAnLScpIHtcbiAgICAgICAgICByZW1vdmVDb3VudCsrO1xuICAgICAgICB9IGVsc2UgaWYgKG9wZXJhdGlvbiA9PT0gJyAnKSB7XG4gICAgICAgICAgYWRkQ291bnQrKztcbiAgICAgICAgICByZW1vdmVDb3VudCsrO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBIYW5kbGUgdGhlIGVtcHR5IGJsb2NrIGNvdW50IGNhc2VcbiAgICBpZiAoIWFkZENvdW50ICYmIGh1bmsubmV3TGluZXMgPT09IDEpIHtcbiAgICAgIGh1bmsubmV3TGluZXMgPSAwO1xuICAgIH1cbiAgICBpZiAoIXJlbW92ZUNvdW50ICYmIGh1bmsub2xkTGluZXMgPT09IDEpIHtcbiAgICAgIGh1bmsub2xkTGluZXMgPSAwO1xuICAgIH1cblxuICAgIC8vIFBlcmZvcm0gb3B0aW9uYWwgc2FuaXR5IGNoZWNraW5nXG4gICAgaWYgKG9wdGlvbnMuc3RyaWN0KSB7XG4gICAgICBpZiAoYWRkQ291bnQgIT09IGh1bmsubmV3TGluZXMpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdBZGRlZCBsaW5lIGNvdW50IGRpZCBub3QgbWF0Y2ggZm9yIGh1bmsgYXQgbGluZSAnICsgKGNodW5rSGVhZGVySW5kZXggKyAxKSk7XG4gICAgICB9XG4gICAgICBpZiAocmVtb3ZlQ291bnQgIT09IGh1bmsub2xkTGluZXMpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdSZW1vdmVkIGxpbmUgY291bnQgZGlkIG5vdCBtYXRjaCBmb3IgaHVuayBhdCBsaW5lICcgKyAoY2h1bmtIZWFkZXJJbmRleCArIDEpKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gaHVuaztcbiAgfVxuXG4gIHdoaWxlIChpIDwgZGlmZnN0ci5sZW5ndGgpIHtcbiAgICBwYXJzZUluZGV4KCk7XG4gIH1cblxuICByZXR1cm4gbGlzdDtcbn1cbiJdfQ== +/***/ }), + +/***/ 1794: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +/*istanbul ignore start*/ + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.reversePatch = reversePatch; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/*istanbul ignore end*/ +function reversePatch(structuredPatch) { + if (Array.isArray(structuredPatch)) { + return structuredPatch.map(reversePatch).reverse(); + } + + return ( + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + structuredPatch), {}, { + oldFileName: structuredPatch.newFileName, + oldHeader: structuredPatch.newHeader, + newFileName: structuredPatch.oldFileName, + newHeader: structuredPatch.oldHeader, + hunks: structuredPatch.hunks.map(function (hunk) { + return { + oldLines: hunk.newLines, + oldStart: hunk.newStart, + newLines: hunk.oldLines, + newStart: hunk.oldStart, + linedelimiters: hunk.linedelimiters, + lines: hunk.lines.map(function (l) { + if (l.startsWith('-')) { + return ( + /*istanbul ignore start*/ + "+".concat( + /*istanbul ignore end*/ + l.slice(1)) + ); + } + + if (l.startsWith('+')) { + return ( + /*istanbul ignore start*/ + "-".concat( + /*istanbul ignore end*/ + l.slice(1)) + ); + } + + return l; + }) + }; + }) + }) + ); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9yZXZlcnNlLmpzIl0sIm5hbWVzIjpbInJldmVyc2VQYXRjaCIsInN0cnVjdHVyZWRQYXRjaCIsIkFycmF5IiwiaXNBcnJheSIsIm1hcCIsInJldmVyc2UiLCJvbGRGaWxlTmFtZSIsIm5ld0ZpbGVOYW1lIiwib2xkSGVhZGVyIiwibmV3SGVhZGVyIiwiaHVua3MiLCJodW5rIiwib2xkTGluZXMiLCJuZXdMaW5lcyIsIm9sZFN0YXJ0IiwibmV3U3RhcnQiLCJsaW5lZGVsaW1pdGVycyIsImxpbmVzIiwibCIsInN0YXJ0c1dpdGgiLCJzbGljZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7O0FBQU8sU0FBU0EsWUFBVCxDQUFzQkMsZUFBdEIsRUFBdUM7QUFDNUMsTUFBSUMsS0FBSyxDQUFDQyxPQUFOLENBQWNGLGVBQWQsQ0FBSixFQUFvQztBQUNsQyxXQUFPQSxlQUFlLENBQUNHLEdBQWhCLENBQW9CSixZQUFwQixFQUFrQ0ssT0FBbEMsRUFBUDtBQUNEOztBQUVEO0FBQUE7QUFBQTtBQUFBO0FBQ0tKLElBQUFBLGVBREw7QUFFRUssTUFBQUEsV0FBVyxFQUFFT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NsaWNlKDEpfWA7IH1cbiAgICAgICAgICByZXR1cm4gbDtcbiAgICAgICAgfSlcbiAgICAgIH07XG4gICAgfSlcbiAgfTtcbn1cbiJdfQ== + + /***/ }), /***/ 8935: @@ -13749,6 +13984,8 @@ function onceStrict (fn) { /***/ 9103: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; + var __create = Object.create; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; @@ -13772,7 +14009,6 @@ var __spreadValues = (a, b) => { return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; @@ -13783,22 +14019,19 @@ var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; -var __reExport = (target, module2, copyDefault, desc) => { - if (module2 && typeof module2 === "object" || typeof module2 === "function") { - for (let key of __getOwnPropNames(module2)) - if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) - __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } - return target; -}; -var __toESM = (module2, isNodeMode) => { - return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); + return to; }; -var __toCommonJS = /* @__PURE__ */ ((cache2) => { - return (module2, temp) => { - return cache2 && cache2.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache2 && cache2.set(module2, temp), temp); - }; -})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { @@ -13824,6 +14057,7 @@ var __async = (__this, __arguments, generator) => { var GitError; var init_git_error = __esm({ "src/lib/errors/git-error.ts"() { + "use strict"; GitError = class extends Error { constructor(task, message) { super(message); @@ -13838,6 +14072,7 @@ var init_git_error = __esm({ var GitResponseError; var init_git_response_error = __esm({ "src/lib/errors/git-response-error.ts"() { + "use strict"; init_git_error(); GitResponseError = class extends GitError { constructor(git, message) { @@ -13863,6 +14098,7 @@ function toPaths(pathSpec) { var cache; var init_pathspec = __esm({ "src/lib/args/pathspec.ts"() { + "use strict"; cache = /* @__PURE__ */ new WeakMap(); } }); @@ -13871,6 +14107,7 @@ var init_pathspec = __esm({ var GitConstructError; var init_git_construct_error = __esm({ "src/lib/errors/git-construct-error.ts"() { + "use strict"; init_git_error(); GitConstructError = class extends GitError { constructor(config, message) { @@ -13885,6 +14122,7 @@ var init_git_construct_error = __esm({ var GitPluginError; var init_git_plugin_error = __esm({ "src/lib/errors/git-plugin-error.ts"() { + "use strict"; init_git_error(); GitPluginError = class extends GitError { constructor(task, plugin, message) { @@ -13901,6 +14139,7 @@ var init_git_plugin_error = __esm({ var TaskConfigurationError; var init_task_configuration_error = __esm({ "src/lib/errors/task-configuration-error.ts"() { + "use strict"; init_git_error(); TaskConfigurationError = class extends GitError { constructor(message) { @@ -14001,7 +14240,10 @@ function bufferToString(input) { return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8"); } function pick(source, properties) { - return Object.assign({}, ...properties.map((property) => property in source ? { [property]: source[property] } : {})); + return Object.assign( + {}, + ...properties.map((property) => property in source ? { [property]: source[property] } : {}) + ); } function delay(duration = 0) { return new Promise((done) => setTimeout(done, duration)); @@ -14015,6 +14257,7 @@ function orVoid(input) { var import_file_exists, NULL, NOOP, objectToString; var init_util = __esm({ "src/lib/utils/util.ts"() { + "use strict"; import_file_exists = __nccwpck_require__(4751); NULL = "\0"; NOOP = () => { @@ -14043,6 +14286,7 @@ function filterFunction(input) { var filterArray, filterString, filterStringArray, filterStringOrStringArray, filterHasLength; var init_argument_filters = __esm({ "src/lib/utils/argument-filters.ts"() { + "use strict"; init_util(); init_pathspec(); filterArray = (input) => { @@ -14070,6 +14314,7 @@ var init_argument_filters = __esm({ var ExitCodes; var init_exit_codes = __esm({ "src/lib/utils/exit-codes.ts"() { + "use strict"; ExitCodes = /* @__PURE__ */ ((ExitCodes2) => { ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS"; ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR"; @@ -14084,6 +14329,7 @@ var init_exit_codes = __esm({ var GitOutputStreams; var init_git_output_streams = __esm({ "src/lib/utils/git-output-streams.ts"() { + "use strict"; GitOutputStreams = class { constructor(stdOut, stdErr) { this.stdOut = stdOut; @@ -14100,6 +14346,7 @@ var init_git_output_streams = __esm({ var LineParser, RemoteLineParser; var init_line_parser = __esm({ "src/lib/utils/line-parser.ts"() { + "use strict"; LineParser = class { constructor(regExp, useMatches) { this.matches = []; @@ -14151,7 +14398,10 @@ var init_line_parser = __esm({ // src/lib/utils/simple-git-options.ts function createInstanceConfig(...options) { const baseDir = process.cwd(); - const config = Object.assign(__spreadValues({ baseDir }, defaultOptions), ...options.filter((o) => typeof o === "object" && o)); + const config = Object.assign( + __spreadValues({ baseDir }, defaultOptions), + ...options.filter((o) => typeof o === "object" && o) + ); config.baseDir = config.baseDir || baseDir; config.trimmed = config.trimmed === true; return config; @@ -14159,6 +14409,7 @@ function createInstanceConfig(...options) { var defaultOptions; var init_simple_git_options = __esm({ "src/lib/utils/simple-git-options.ts"() { + "use strict"; defaultOptions = { binary: "git", maxConcurrentProcesses: 5, @@ -14212,6 +14463,7 @@ function trailingFunctionArgument(args, includeNoop = true) { } var init_task_options = __esm({ "src/lib/utils/task-options.ts"() { + "use strict"; init_argument_filters(); init_util(); init_pathspec(); @@ -14238,6 +14490,7 @@ function parseStringResponse(result, parsers12, texts, trim = true) { } var init_task_parser = __esm({ "src/lib/utils/task-parser.ts"() { + "use strict"; init_util(); } }); @@ -14290,6 +14543,7 @@ __export(utils_exports, { }); var init_utils = __esm({ "src/lib/utils/index.ts"() { + "use strict"; init_argument_filters(); init_exit_codes(); init_git_output_streams(); @@ -14350,6 +14604,7 @@ function isNotRepoMessage(error) { var CheckRepoActions, onError, parser; var init_check_is_repo = __esm({ "src/lib/tasks/check-is-repo.ts"() { + "use strict"; init_utils(); CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => { CheckRepoActions2["BARE"] = "bare"; @@ -14383,6 +14638,7 @@ function cleanSummaryParser(dryRun, text) { var CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp; var init_CleanSummary = __esm({ "src/lib/responses/CleanSummary.ts"() { + "use strict"; init_utils(); CleanResponse = class { constructor(dryRun) { @@ -14452,6 +14708,7 @@ function isEmptyTask(task) { var EMPTY_COMMANDS; var init_task = __esm({ "src/lib/tasks/task.ts"() { + "use strict"; init_task_configuration_error(); EMPTY_COMMANDS = []; } @@ -14528,6 +14785,7 @@ function isInteractiveMode(option) { var CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues; var init_clean = __esm({ "src/lib/tasks/clean.ts"() { + "use strict"; init_CleanSummary(); init_utils(); init_task(); @@ -14601,6 +14859,7 @@ function* configParser(text, requestedKey = null) { var ConfigList; var init_ConfigList = __esm({ "src/lib/responses/ConfigList.ts"() { + "use strict"; init_utils(); ConfigList = class { constructor() { @@ -14688,19 +14947,34 @@ function listConfigTask(scope) { function config_default() { return { addConfig(key, value, ...rest) { - return this._runTask(addConfigTask(key, value, rest[0] === true, asConfigScope(rest[1], "local" /* local */)), trailingFunctionArgument(arguments)); + return this._runTask( + addConfigTask( + key, + value, + rest[0] === true, + asConfigScope(rest[1], "local" /* local */) + ), + trailingFunctionArgument(arguments) + ); }, getConfig(key, scope) { - return this._runTask(getConfigTask(key, asConfigScope(scope, void 0)), trailingFunctionArgument(arguments)); + return this._runTask( + getConfigTask(key, asConfigScope(scope, void 0)), + trailingFunctionArgument(arguments) + ); }, listConfig(...rest) { - return this._runTask(listConfigTask(asConfigScope(rest[0], void 0)), trailingFunctionArgument(arguments)); + return this._runTask( + listConfigTask(asConfigScope(rest[0], void 0)), + trailingFunctionArgument(arguments) + ); } }; } var GitConfigScope; var init_config = __esm({ "src/lib/tasks/config.ts"() { + "use strict"; init_ConfigList(); init_utils(); GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => { @@ -14720,6 +14994,7 @@ function isDiffNameStatus(input) { var DiffNameStatus, diffNameStatus; var init_diff_name_status = __esm({ "src/lib/tasks/diff-name-status.ts"() { + "use strict"; DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => { DiffNameStatus2["ADDED"] = "A"; DiffNameStatus2["COPIED"] = "C"; @@ -14764,26 +15039,33 @@ function grep_default() { const options = getTrailingOptions(arguments); for (const option of disallowedOptions) { if (options.includes(option)) { - return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then); + return this._runTask( + configurationErrorTask(`git.grep: use of "${option}" is not supported.`), + then + ); } } if (typeof searchTerm === "string") { searchTerm = grepQueryBuilder().param(searchTerm); } const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm]; - return this._runTask({ - commands, - format: "utf-8", - parser(stdOut) { - return parseGrep(stdOut); - } - }, then); + return this._runTask( + { + commands, + format: "utf-8", + parser(stdOut) { + return parseGrep(stdOut); + } + }, + then + ); } }; } var disallowedOptions, Query, _a, GrepQuery; var init_grep = __esm({ "src/lib/tasks/grep.ts"() { + "use strict"; init_utils(); init_task(); disallowedOptions = ["-h"]; @@ -14841,6 +15123,7 @@ function isValidResetMode(mode) { var ResetMode, ResetModes; var init_reset = __esm({ "src/lib/tasks/reset.ts"() { + "use strict"; init_task(); ResetMode = /* @__PURE__ */ ((ResetMode2) => { ResetMode2["MIXED"] = "mixed"; @@ -14872,6 +15155,7 @@ __export(api_exports, { }); var init_api = __esm({ "src/lib/api.ts"() { + "use strict"; init_pathspec(); init_git_construct_error(); init_git_error(); @@ -14914,6 +15198,7 @@ function abortPlugin(signal) { } var init_abort_plugin = __esm({ "src/lib/plugins/abort-plugin.ts"() { + "use strict"; init_git_plugin_error(); } }); @@ -14929,17 +15214,33 @@ function preventProtocolOverride(arg, next) { if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) { return; } - throw new GitPluginError(void 0, "unsafe", "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol"); + throw new GitPluginError( + void 0, + "unsafe", + "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol" + ); } function preventUploadPack(arg, method) { if (/^\s*--(upload|receive)-pack/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`); + throw new GitPluginError( + void 0, + "unsafe", + `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack` + ); } if (method === "clone" && /^\s*-u\b/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of clone with option -u is not permitted without enabling allowUnsafePack`); + throw new GitPluginError( + void 0, + "unsafe", + `Use of clone with option -u is not permitted without enabling allowUnsafePack` + ); } if (method === "push" && /^\s*--exec\b/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of push with option --exec is not permitted without enabling allowUnsafePack`); + throw new GitPluginError( + void 0, + "unsafe", + `Use of push with option --exec is not permitted without enabling allowUnsafePack` + ); } } function blockUnsafeOperationsPlugin({ @@ -14960,6 +15261,7 @@ function blockUnsafeOperationsPlugin({ } var init_block_unsafe_operations_plugin = __esm({ "src/lib/plugins/block-unsafe-operations-plugin.ts"() { + "use strict"; init_git_plugin_error(); } }); @@ -14976,6 +15278,7 @@ function commandConfigPrefixingPlugin(configuration) { } var init_command_config_prefixing_plugin = __esm({ "src/lib/plugins/command-config-prefixing-plugin.ts"() { + "use strict"; init_utils(); } }); @@ -15024,11 +15327,11 @@ function completionDetectionPlugin({ type: "spawn.after", action(_0, _1) { return __async(this, arguments, function* (_data, { spawned, close }) { - var _a2, _b; + var _a3, _b; const events = createEvents(); let deferClose = true; let quickClose = () => void (deferClose = false); - (_a2 = spawned.stdout) == null ? void 0 : _a2.on("data", quickClose); + (_a3 = spawned.stdout) == null ? void 0 : _a3.on("data", quickClose); (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose); spawned.on("error", quickClose); spawned.on("close", (code) => events.close(code)); @@ -15049,12 +15352,58 @@ function completionDetectionPlugin({ var import_promise_deferred, never; var init_completion_detection_plugin = __esm({ "src/lib/plugins/completion-detection.plugin.ts"() { + "use strict"; import_promise_deferred = __nccwpck_require__(9819); init_utils(); never = (0, import_promise_deferred.deferred)().promise; } }); +// src/lib/plugins/custom-binary.plugin.ts +function isBadArgument(arg) { + return !arg || !/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(arg); +} +function toBinaryConfig(input, allowUnsafe) { + if (input.length < 1 || input.length > 2) { + throw new GitPluginError(void 0, "binary", WRONG_NUMBER_ERR); + } + const isBad = input.some(isBadArgument); + if (isBad) { + if (allowUnsafe) { + console.warn(WRONG_CHARS_ERR); + } else { + throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR); + } + } + const [binary, prefix] = input; + return { + binary, + prefix + }; +} +function customBinaryPlugin(plugins, input = ["git"], allowUnsafe = false) { + let config = toBinaryConfig(asArray(input), allowUnsafe); + plugins.on("binary", (input2) => { + config = toBinaryConfig(asArray(input2), allowUnsafe); + }); + plugins.append("spawn.binary", () => { + return config.binary; + }); + plugins.append("spawn.args", (data) => { + return config.prefix ? [config.prefix, ...data] : data; + }); +} +var WRONG_NUMBER_ERR, WRONG_CHARS_ERR; +var init_custom_binary_plugin = __esm({ + "src/lib/plugins/custom-binary.plugin.ts"() { + "use strict"; + init_git_plugin_error(); + init_utils(); + WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`; + WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`; + } +}); + // src/lib/plugins/error-detection.plugin.ts function isTaskError(result) { return !!(result.exitCode && result.stdErr.length); @@ -15090,18 +15439,32 @@ function errorDetectionPlugin(config) { } var init_error_detection_plugin = __esm({ "src/lib/plugins/error-detection.plugin.ts"() { + "use strict"; init_git_error(); } }); // src/lib/plugins/plugin-store.ts -var PluginStore; +var import_node_events, PluginStore; var init_plugin_store = __esm({ "src/lib/plugins/plugin-store.ts"() { + "use strict"; + import_node_events = __nccwpck_require__(5673); init_utils(); PluginStore = class { constructor() { this.plugins = /* @__PURE__ */ new Set(); + this.events = new import_node_events.EventEmitter(); + } + on(type, listener) { + this.events.on(type, listener); + } + reconfigure(type, data) { + this.events.emit(type, data); + } + append(type, action) { + const plugin = append(this.plugins, { type, action }); + return () => this.plugins.delete(plugin); } add(plugin) { const plugins = []; @@ -15166,6 +15529,7 @@ function progressEventStage(input) { } var init_progress_monitor_plugin = __esm({ "src/lib/plugins/progress-monitor-plugin.ts"() { + "use strict"; init_utils(); } }); @@ -15173,6 +15537,7 @@ var init_progress_monitor_plugin = __esm({ // src/lib/plugins/simple-git-plugin.ts var init_simple_git_plugin = __esm({ "src/lib/plugins/simple-git-plugin.ts"() { + "use strict"; } }); @@ -15188,6 +15553,7 @@ function spawnOptionsPlugin(spawnOptions) { } var init_spawn_options_plugin = __esm({ "src/lib/plugins/spawn-options-plugin.ts"() { + "use strict"; init_utils(); } }); @@ -15231,6 +15597,7 @@ function timeoutPlugin({ } var init_timout_plugin = __esm({ "src/lib/plugins/timout-plugin.ts"() { + "use strict"; init_git_plugin_error(); } }); @@ -15238,10 +15605,12 @@ var init_timout_plugin = __esm({ // src/lib/plugins/index.ts var init_plugins = __esm({ "src/lib/plugins/index.ts"() { + "use strict"; init_abort_plugin(); init_block_unsafe_operations_plugin(); init_command_config_prefixing_plugin(); init_completion_detection_plugin(); + init_custom_binary_plugin(); init_error_detection_plugin(); init_plugin_store(); init_progress_monitor_plugin(); @@ -15268,7 +15637,9 @@ function suffixPathsPlugin() { continue; } if (param === "--") { - append2(data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item)); + append2( + data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item) + ); break; } prefix.push(param); @@ -15279,6 +15650,7 @@ function suffixPathsPlugin() { } var init_suffix_paths_plugin = __esm({ "src/lib/plugins/suffix-paths.plugin.ts"() { + "use strict"; init_pathspec(); } }); @@ -15318,7 +15690,10 @@ function createLogger(label, verbose, initialStep, infoDebugger = createLog()) { const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger); return step(initialStep); function sibling(name, initial) { - return append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)); + return append( + spawned, + createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger) + ); } function step(phase) { const stepPrefix = phase && `[${phase}]` || ""; @@ -15335,6 +15710,7 @@ function createLogger(label, verbose, initialStep, infoDebugger = createLog()) { var import_debug; var init_git_logger = __esm({ "src/lib/git-logger.ts"() { + "use strict"; import_debug = __toESM(__nccwpck_require__(8237)); init_utils(); import_debug.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-"); @@ -15351,6 +15727,7 @@ var init_git_logger = __esm({ var _TasksPendingQueue, TasksPendingQueue; var init_tasks_pending_queue = __esm({ "src/lib/runners/tasks-pending-queue.ts"() { + "use strict"; init_git_error(); init_git_logger(); _TasksPendingQueue = class { @@ -15380,9 +15757,14 @@ var init_tasks_pending_queue = __esm({ for (const [task, { logger }] of Array.from(this._queue.entries())) { if (task === err.task) { logger.info(`Failed %o`, err); - logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`); + logger( + `Fatal exception, any as-yet un-started tasks run through this executor will not be attempted` + ); } else { - logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message); + logger.info( + `A fatal exception occurred in a previous task, the queue has been purged: %o`, + err.message + ); } this.complete(task); } @@ -15436,6 +15818,7 @@ function onDataReceived(target, name, logger, output) { var import_child_process, GitExecutorChain; var init_git_executor_chain = __esm({ "src/lib/runners/git-executor-chain.ts"() { + "use strict"; import_child_process = __nccwpck_require__(2081); init_git_error(); init_task(); @@ -15449,9 +15832,6 @@ var init_git_executor_chain = __esm({ this._chain = Promise.resolve(); this._queue = new TasksPendingQueue(); } - get binary() { - return this._executor.binary; - } get cwd() { return this._cwd || this._executor.cwd; } @@ -15494,8 +15874,19 @@ var init_git_executor_chain = __esm({ } attemptRemoteTask(task, logger) { return __async(this, null, function* () { - const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext(task, task.commands)); - const raw = yield this.gitResponse(task, this.binary, args, this.outputHandler, logger.step("SPAWN")); + const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands)); + const args = this._plugins.exec( + "spawn.args", + [...task.commands], + pluginContext(task, task.commands) + ); + const raw = yield this.gitResponse( + task, + binary, + args, + this.outputHandler, + logger.step("SPAWN") + ); const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE")); logger(`passing response to task's parser as a %s`, task.format); if (isBufferTask(task)) { @@ -15514,17 +15905,36 @@ var init_git_executor_chain = __esm({ const { exitCode, rejection, stdOut, stdErr } = result; return new Promise((done, fail) => { logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode); - const { error } = this._plugins.exec("task.error", { error: rejection }, __spreadValues(__spreadValues({}, pluginContext(task, args)), result)); + const { error } = this._plugins.exec( + "task.error", + { error: rejection }, + __spreadValues(__spreadValues({}, pluginContext(task, args)), result) + ); if (error && task.onError) { logger.info(`exitCode=%s handling with custom error handler`); - return task.onError(result, error, (newStdOut) => { - logger.info(`custom error handler treated as success`); - logger(`custom error returned a %s`, objectToString(newStdOut)); - done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr))); - }, fail); + return task.onError( + result, + error, + (newStdOut) => { + logger.info(`custom error handler treated as success`); + logger(`custom error returned a %s`, objectToString(newStdOut)); + done( + new GitOutputStreams( + Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, + Buffer.concat(stdErr) + ) + ); + }, + fail + ); } if (error) { - logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection); + logger.info( + `handling as error: exitCode=%s stdErr=%s rejection=%o`, + exitCode, + stdErr.length, + rejection + ); return fail(error); } logger.info(`retrieving task output complete`); @@ -15534,11 +15944,15 @@ var init_git_executor_chain = __esm({ gitResponse(task, command, args, outputHandler, logger) { return __async(this, null, function* () { const outputLogger = logger.sibling("output"); - const spawnOptions = this._plugins.exec("spawn.options", { - cwd: this.cwd, - env: this.env, - windowsHide: true - }, pluginContext(task, task.commands)); + const spawnOptions = this._plugins.exec( + "spawn.options", + { + cwd: this.cwd, + env: this.env, + windowsHide: true + }, + pluginContext(task, task.commands) + ); return new Promise((done) => { const stdOut = []; const stdErr = []; @@ -15559,8 +15973,14 @@ var init_git_executor_chain = __esm({ } })); const spawned = (0, import_child_process.spawn)(command, args, spawnOptions); - spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))); - spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))); + spawned.stdout.on( + "data", + onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")) + ); + spawned.stderr.on( + "data", + onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")) + ); spawned.on("error", onErrorReceived(stdErr, logger)); if (outputHandler) { logger(`Passing child process stdOut/stdErr to custom outputHandler`); @@ -15608,10 +16028,10 @@ __export(git_executor_exports, { var GitExecutor; var init_git_executor = __esm({ "src/lib/runners/git-executor.ts"() { + "use strict"; init_git_executor_chain(); GitExecutor = class { - constructor(binary = "git", cwd, _scheduler, _plugins) { - this.binary = binary; + constructor(cwd, _scheduler, _plugins) { this.cwd = cwd; this._scheduler = _scheduler; this._plugins = _plugins; @@ -15634,14 +16054,19 @@ function taskCallback(task, response, callback = NOOP) { }; const onError2 = (err) => { if ((err == null ? void 0 : err.task) === task) { - callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, void 0); + callback( + err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, + void 0 + ); } }; response.then(onSuccess, onError2); } function addDeprecationNoticeToError(err) { let log = (name) => { - console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`); + console.warn( + `simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3` + ); log = NOOP; }; return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {})); @@ -15662,6 +16087,7 @@ function addDeprecationNoticeToError(err) { } var init_task_callback = __esm({ "src/lib/task-callback.ts"() { + "use strict"; init_git_response_error(); init_utils(); } @@ -15678,6 +16104,7 @@ function changeWorkingDirectoryTask(directory, root) { } var init_change_working_directory = __esm({ "src/lib/tasks/change-working-directory.ts"() { + "use strict"; init_utils(); init_task(); } @@ -15694,18 +16121,28 @@ function checkoutTask(args) { function checkout_default() { return { checkout() { - return this._runTask(checkoutTask(getTrailingOptions(arguments, 1)), trailingFunctionArgument(arguments)); + return this._runTask( + checkoutTask(getTrailingOptions(arguments, 1)), + trailingFunctionArgument(arguments) + ); }, checkoutBranch(branchName, startPoint) { - return this._runTask(checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + return this._runTask( + checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments) + ); }, checkoutLocalBranch(branchName) { - return this._runTask(checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + return this._runTask( + checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments) + ); } }; } var init_checkout = __esm({ "src/lib/tasks/checkout.ts"() { + "use strict"; init_utils(); init_task(); } @@ -15729,6 +16166,7 @@ function parseCommitResult(stdOut) { var parsers; var init_parse_commit = __esm({ "src/lib/parsers/parse-commit.ts"() { + "use strict"; init_utils(); parsers = [ new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => { @@ -15747,20 +16185,26 @@ var init_parse_commit = __esm({ name: parts.join("<").trim() }; }), - new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => { - result.summary.changes = parseInt(changes, 10) || 0; - result.summary.insertions = parseInt(insertions, 10) || 0; - result.summary.deletions = parseInt(deletions, 10) || 0; - }), - new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => { - result.summary.changes = parseInt(changes, 10) || 0; - const count = parseInt(lines, 10) || 0; - if (direction === "-") { - result.summary.deletions = count; - } else if (direction === "+") { - result.summary.insertions = count; + new LineParser( + /(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, + (result, [changes, insertions, deletions]) => { + result.summary.changes = parseInt(changes, 10) || 0; + result.summary.insertions = parseInt(insertions, 10) || 0; + result.summary.deletions = parseInt(deletions, 10) || 0; + } + ), + new LineParser( + /^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, + (result, [changes, lines, direction]) => { + result.summary.changes = parseInt(changes, 10) || 0; + const count = parseInt(lines, 10) || 0; + if (direction === "-") { + result.summary.deletions = count; + } else if (direction === "+") { + result.summary.insertions = count; + } } - }) + ) ]; } }); @@ -15785,16 +16229,23 @@ function commit_default() { return { commit(message, ...rest) { const next = trailingFunctionArgument(arguments); - const task = rejectDeprecatedSignatures(message) || commitTask(asArray(message), asArray(filterType(rest[0], filterStringOrStringArray, [])), [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]); + const task = rejectDeprecatedSignatures(message) || commitTask( + asArray(message), + asArray(filterType(rest[0], filterStringOrStringArray, [])), + [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)] + ); return this._runTask(task, next); } }; function rejectDeprecatedSignatures(message) { - return !filterStringOrStringArray(message) && configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`); + return !filterStringOrStringArray(message) && configurationErrorTask( + `git.commit: requires the commit message to be supplied as a string/string[]` + ); } } var init_commit = __esm({ "src/lib/tasks/commit.ts"() { + "use strict"; init_parse_commit(); init_utils(); init_task(); @@ -15805,12 +16256,16 @@ var init_commit = __esm({ function first_commit_default() { return { firstCommit() { - return this._runTask(straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), + trailingFunctionArgument(arguments) + ); } }; } var init_first_commit = __esm({ "src/lib/tasks/first-commit.ts"() { + "use strict"; init_utils(); init_task(); } @@ -15826,6 +16281,7 @@ function hashObjectTask(filePath, write) { } var init_hash_object = __esm({ "src/lib/tasks/hash-object.ts"() { + "use strict"; init_task(); } }); @@ -15854,6 +16310,7 @@ function parseInit(bare, path, text) { var InitSummary, initResponseRegex, reInitResponseRegex; var init_InitSummary = __esm({ "src/lib/responses/InitSummary.ts"() { + "use strict"; InitSummary = class { constructor(bare, path, existing, gitDir) { this.bare = bare; @@ -15887,6 +16344,7 @@ function initTask(bare = false, path, customArgs) { var bareCommand; var init_init = __esm({ "src/lib/tasks/init.ts"() { + "use strict"; init_InitSummary(); bareCommand = "--bare"; } @@ -15908,6 +16366,7 @@ function isLogFormat(customArg) { var logFormatRegex; var init_log_format = __esm({ "src/lib/args/log-format.ts"() { + "use strict"; logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/; } }); @@ -15916,6 +16375,7 @@ var init_log_format = __esm({ var DiffSummary; var init_DiffSummary = __esm({ "src/lib/responses/DiffSummary.ts"() { + "use strict"; DiffSummary = class { constructor() { this.changed = 0; @@ -15935,51 +16395,64 @@ function getDiffParser(format = "" /* NONE */) { var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers; var init_parse_diff_summary = __esm({ "src/lib/parsers/parse-diff-summary.ts"() { + "use strict"; init_log_format(); init_DiffSummary(); init_diff_name_status(); init_utils(); statParser = [ - new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => { - result.files.push({ - file: file.trim(), - changes: asNumber(changes), - insertions: alterations.replace(/[^+]/g, "").length, - deletions: alterations.replace(/[^-]/g, "").length, - binary: false - }); - }), - new LineParser(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, (result, [file, before, after]) => { - result.files.push({ - file: file.trim(), - before: asNumber(before), - after: asNumber(after), - binary: true - }); - }), - new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, (result, [changed, summary]) => { - const inserted = /(\d+) i/.exec(summary); - const deleted = /(\d+) d/.exec(summary); - result.changed = asNumber(changed); - result.insertions = asNumber(inserted == null ? void 0 : inserted[1]); - result.deletions = asNumber(deleted == null ? void 0 : deleted[1]); - }) + new LineParser( + /^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, + (result, [file, changes, alterations = ""]) => { + result.files.push({ + file: file.trim(), + changes: asNumber(changes), + insertions: alterations.replace(/[^+]/g, "").length, + deletions: alterations.replace(/[^-]/g, "").length, + binary: false + }); + } + ), + new LineParser( + /^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, + (result, [file, before, after]) => { + result.files.push({ + file: file.trim(), + before: asNumber(before), + after: asNumber(after), + binary: true + }); + } + ), + new LineParser( + /(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, + (result, [changed, summary]) => { + const inserted = /(\d+) i/.exec(summary); + const deleted = /(\d+) d/.exec(summary); + result.changed = asNumber(changed); + result.insertions = asNumber(inserted == null ? void 0 : inserted[1]); + result.deletions = asNumber(deleted == null ? void 0 : deleted[1]); + } + ) ]; numStatParser = [ - new LineParser(/(\d+)\t(\d+)\t(.+)$/, (result, [changesInsert, changesDelete, file]) => { - const insertions = asNumber(changesInsert); - const deletions = asNumber(changesDelete); - result.changed++; - result.insertions += insertions; - result.deletions += deletions; - result.files.push({ - file, - changes: insertions + deletions, - insertions, - deletions, - binary: false - }); - }), + new LineParser( + /(\d+)\t(\d+)\t(.+)$/, + (result, [changesInsert, changesDelete, file]) => { + const insertions = asNumber(changesInsert); + const deletions = asNumber(changesDelete); + result.changed++; + result.insertions += insertions; + result.deletions += deletions; + result.files.push({ + file, + changes: insertions + deletions, + insertions, + deletions, + binary: false + }); + } + ), new LineParser(/-\t-\t(.+)$/, (result, [file]) => { result.changed++; result.files.push({ @@ -16003,17 +16476,20 @@ var init_parse_diff_summary = __esm({ }) ]; nameStatusParser = [ - new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, _similarity, from, _to, to]) => { - result.changed++; - result.files.push({ - file: to != null ? to : from, - changes: 0, - status: orVoid(isDiffNameStatus(status) && status), - insertions: 0, - deletions: 0, - binary: false - }); - }) + new LineParser( + /([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, + (result, [status, _similarity, from, _to, to]) => { + result.changed++; + result.files.push({ + file: to != null ? to : from, + changes: 0, + status: orVoid(isDiffNameStatus(status) && status), + insertions: 0, + deletions: 0, + binary: false + }); + } + ) ]; diffSummaryParsers = { ["" /* NONE */]: statParser, @@ -16027,17 +16503,27 @@ var init_parse_diff_summary = __esm({ // src/lib/parsers/parse-list-log-summary.ts function lineBuilder(tokens, fields) { - return fields.reduce((line, field, index) => { - line[field] = tokens[index] || ""; - return line; - }, /* @__PURE__ */ Object.create({ diff: null })); + return fields.reduce( + (line, field, index) => { + line[field] = tokens[index] || ""; + return line; + }, + /* @__PURE__ */ Object.create({ diff: null }) + ); } function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "" /* NONE */) { const parseDiffResult = getDiffParser(logFormat); return function(stdOut) { - const all = toLinesWithContent(stdOut, true, START_BOUNDARY).map(function(item) { + const all = toLinesWithContent( + stdOut, + true, + START_BOUNDARY + ).map(function(item) { const lineDetail = item.trim().split(COMMIT_BOUNDARY); - const listLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields); + const listLogLine = lineBuilder( + lineDetail[0].trim().split(splitter), + fields + ); if (lineDetail.length > 1 && !!lineDetail[1].trim()) { listLogLine.diff = parseDiffResult(lineDetail[1]); } @@ -16053,6 +16539,7 @@ function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNa var START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames; var init_parse_list_log_summary = __esm({ "src/lib/parsers/parse-list-log-summary.ts"() { + "use strict"; init_utils(); init_parse_diff_summary(); init_log_format(); @@ -16086,14 +16573,19 @@ function diffSummaryTask(customArgs) { function validateLogFormatConfig(customArgs) { const flags = customArgs.filter(isLogFormat); if (flags.length > 1) { - return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${flags.join(",")}`); + return configurationErrorTask( + `Summary flags are mutually exclusive - pick one of ${flags.join(",")}` + ); } if (flags.length && customArgs.includes("-z")) { - return configurationErrorTask(`Summary flag ${flags} parsing is not compatible with null termination option '-z'`); + return configurationErrorTask( + `Summary flag ${flags} parsing is not compatible with null termination option '-z'` + ); } } var init_diff = __esm({ "src/lib/tasks/diff.ts"() { + "use strict"; init_log_format(); init_parse_diff_summary(); init_task(); @@ -16165,7 +16657,10 @@ function log_default() { return { log(...rest) { const next = trailingFunctionArgument(arguments); - const options = parseLogOptions(trailingOptionsArgument(arguments), filterType(arguments[0], filterArray)); + const options = parseLogOptions( + trailingOptionsArgument(arguments), + filterType(arguments[0], filterArray) + ); const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options); return this._runTask(task, next); } @@ -16174,12 +16669,15 @@ function log_default() { return logTask(options.splitter, options.fields, options.commands); } function rejectDeprecatedSignatures(from, to) { - return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`); + return filterString(from) && filterString(to) && configurationErrorTask( + `git.log(string, string) should be replaced with git.log({ from: string, to: string })` + ); } } var excludeOptions; var init_log = __esm({ "src/lib/tasks/log.ts"() { + "use strict"; init_log_format(); init_pathspec(); init_parse_list_log_summary(); @@ -16209,6 +16707,7 @@ var init_log = __esm({ var MergeSummaryConflict, MergeSummaryDetail; var init_MergeSummary = __esm({ "src/lib/responses/MergeSummary.ts"() { + "use strict"; MergeSummaryConflict = class { constructor(reason, file = null, meta) { this.reason = reason; @@ -16245,6 +16744,7 @@ var init_MergeSummary = __esm({ var PullSummary, PullFailedSummary; var init_PullSummary = __esm({ "src/lib/responses/PullSummary.ts"() { + "use strict"; PullSummary = class { constructor() { this.remoteMessages = { @@ -16304,24 +16804,34 @@ function asObjectCount(source) { var remoteMessagesObjectParsers; var init_parse_remote_objects = __esm({ "src/lib/parsers/parse-remote-objects.ts"() { + "use strict"; init_utils(); remoteMessagesObjectParsers = [ - new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => { - const key = action.toLowerCase(); - const enumeration = objectEnumerationResult(result.remoteMessages); - Object.assign(enumeration, { [key]: asNumber(count) }); - }), - new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => { - const key = action.toLowerCase(); - const enumeration = objectEnumerationResult(result.remoteMessages); - Object.assign(enumeration, { [key]: asNumber(count) }); - }), - new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => { - const objects = objectEnumerationResult(result.remoteMessages); - objects.total = asObjectCount(total); - objects.reused = asObjectCount(reused); - objects.packReused = asNumber(packReused); - }) + new RemoteLineParser( + /^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, + (result, [action, count]) => { + const key = action.toLowerCase(); + const enumeration = objectEnumerationResult(result.remoteMessages); + Object.assign(enumeration, { [key]: asNumber(count) }); + } + ), + new RemoteLineParser( + /^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, + (result, [action, count]) => { + const key = action.toLowerCase(); + const enumeration = objectEnumerationResult(result.remoteMessages); + Object.assign(enumeration, { [key]: asNumber(count) }); + } + ), + new RemoteLineParser( + /total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, + (result, [total, reused, packReused]) => { + const objects = objectEnumerationResult(result.remoteMessages); + objects.total = asObjectCount(total); + objects.reused = asObjectCount(reused); + objects.packReused = asNumber(packReused); + } + ) ]; } }); @@ -16333,6 +16843,7 @@ function parseRemoteMessages(_stdOut, stdErr) { var parsers2, RemoteMessageSummary; var init_parse_remote_messages = __esm({ "src/lib/parsers/parse-remote-messages.ts"() { + "use strict"; init_utils(); init_parse_remote_objects(); parsers2 = [ @@ -16341,16 +16852,22 @@ var init_parse_remote_messages = __esm({ return false; }), ...remoteMessagesObjectParsers, - new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => { - result.remoteMessages.pullRequestUrl = pullRequestUrl; - }), - new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => { - result.remoteMessages.vulnerabilities = { - count: asNumber(count), - summary, - url - }; - }) + new RemoteLineParser( + [/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], + (result, [pullRequestUrl]) => { + result.remoteMessages.pullRequestUrl = pullRequestUrl; + } + ), + new RemoteLineParser( + [/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], + (result, [count, summary, url]) => { + result.remoteMessages.vulnerabilities = { + count: asNumber(count), + summary, + url + }; + } + ) ]; RemoteMessageSummary = class { constructor() { @@ -16368,6 +16885,7 @@ function parsePullErrorResult(stdOut, stdErr) { var FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult; var init_parse_pull = __esm({ "src/lib/parsers/parse-pull.ts"() { + "use strict"; init_PullSummary(); init_utils(); init_parse_remote_messages(); @@ -16401,18 +16919,25 @@ var init_parse_pull = __esm({ errorParsers = [ new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)), new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)), - new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => { - result.branch.local = branchLocal; - result.hash.local = hashLocal; - result.branch.remote = branchRemote; - result.hash.remote = hashRemote; - }) + new LineParser( + /([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, + (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => { + result.branch.local = branchLocal; + result.hash.local = hashLocal; + result.branch.remote = branchRemote; + result.hash.remote = hashRemote; + } + ) ]; parsePullDetail = (stdOut, stdErr) => { return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]); }; parsePullResult = (stdOut, stdErr) => { - return Object.assign(new PullSummary(), parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr)); + return Object.assign( + new PullSummary(), + parsePullDetail(stdOut, stdErr), + parseRemoteMessages(stdOut, stdErr) + ); }; } }); @@ -16421,6 +16946,7 @@ var init_parse_pull = __esm({ var parsers4, parseMergeResult, parseMergeDetail; var init_parse_merge = __esm({ "src/lib/parsers/parse-merge.ts"() { + "use strict"; init_MergeSummary(); init_utils(); init_parse_pull(); @@ -16431,9 +16957,12 @@ var init_parse_merge = __esm({ new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => { summary.conflicts.push(new MergeSummaryConflict(reason, file)); }), - new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => { - summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef })); - }), + new LineParser( + /^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, + (summary, [reason, file, deleteRef]) => { + summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef })); + } + ), new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => { summary.conflicts.push(new MergeSummaryConflict(reason, null)); }), @@ -16469,6 +16998,7 @@ function mergeTask(customArgs) { } var init_merge = __esm({ "src/lib/tasks/merge.ts"() { + "use strict"; init_git_response_error(); init_parse_merge(); init_task(); @@ -16493,6 +17023,7 @@ function pushResultPushedItem(local, remote, status) { var parsers5, parsePushResult, parsePushDetail; var init_parse_push = __esm({ "src/lib/parsers/parse-push.ts"() { + "use strict"; init_utils(); init_parse_remote_messages(); parsers5 = [ @@ -16507,25 +17038,31 @@ var init_parse_push = __esm({ new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => { result.pushed.push(pushResultPushedItem(local, remote, type)); }), - new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => { - result.branch = __spreadProps(__spreadValues({}, result.branch || {}), { - local, - remote, - remoteName - }); - }), - new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => { - result.update = { - head: { + new LineParser( + /^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, + (result, [local, remote, remoteName]) => { + result.branch = __spreadProps(__spreadValues({}, result.branch || {}), { local, - remote - }, - hash: { - from, - to - } - }; - }) + remote, + remoteName + }); + } + ), + new LineParser( + /^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, + (result, [local, remote, from, to]) => { + result.update = { + head: { + local, + remote + }, + hash: { + from, + to + } + }; + } + ) ]; parsePushResult = (stdOut, stdErr) => { const pushDetail = parsePushDetail(stdOut, stdErr); @@ -16567,6 +17104,7 @@ function pushTask(ref = {}, customArgs) { } var init_push = __esm({ "src/lib/tasks/push.ts"() { + "use strict"; init_parse_push(); init_utils(); } @@ -16580,16 +17118,23 @@ function show_default() { if (!commands.includes("--binary")) { commands.splice(1, 0, "--binary"); } - return this._runTask(straightThroughBufferTask(commands), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughBufferTask(commands), + trailingFunctionArgument(arguments) + ); }, show() { const commands = ["show", ...getTrailingOptions(arguments, 1)]; - return this._runTask(straightThroughStringTask(commands), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(commands), + trailingFunctionArgument(arguments) + ); } }; } var init_show = __esm({ "src/lib/tasks/show.ts"() { + "use strict"; init_utils(); init_task(); } @@ -16599,13 +17144,14 @@ var init_show = __esm({ var fromPathRegex, FileStatusSummary; var init_FileStatusSummary = __esm({ "src/lib/responses/FileStatusSummary.ts"() { + "use strict"; fromPathRegex = /^(.+) -> (.+)$/; FileStatusSummary = class { constructor(path, index, working_dir) { this.path = path; this.index = index; this.working_dir = working_dir; - if (index + working_dir === "R") { + if ("R" === index + working_dir) { const detail = fromPathRegex.exec(path) || [null, path, path]; this.from = detail[1] || ""; this.path = detail[2] || ""; @@ -16653,6 +17199,7 @@ function splitLine(result, lineStr) { var StatusSummary, parsers6, parseStatusSummary; var init_StatusSummary = __esm({ "src/lib/responses/StatusSummary.ts"() { + "use strict"; init_utils(); init_FileStatusSummary(); StatusSummary = class { @@ -16677,14 +17224,46 @@ var init_StatusSummary = __esm({ } }; parsers6 = new Map([ - parser2(" " /* NONE */, "A" /* ADDED */, (result, file) => append(result.created, file)), - parser2(" " /* NONE */, "D" /* DELETED */, (result, file) => append(result.deleted, file)), - parser2(" " /* NONE */, "M" /* MODIFIED */, (result, file) => append(result.modified, file)), - parser2("A" /* ADDED */, " " /* NONE */, (result, file) => append(result.created, file) && append(result.staged, file)), - parser2("A" /* ADDED */, "M" /* MODIFIED */, (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)), - parser2("D" /* DELETED */, " " /* NONE */, (result, file) => append(result.deleted, file) && append(result.staged, file)), - parser2("M" /* MODIFIED */, " " /* NONE */, (result, file) => append(result.modified, file) && append(result.staged, file)), - parser2("M" /* MODIFIED */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) && append(result.staged, file)), + parser2( + " " /* NONE */, + "A" /* ADDED */, + (result, file) => append(result.created, file) + ), + parser2( + " " /* NONE */, + "D" /* DELETED */, + (result, file) => append(result.deleted, file) + ), + parser2( + " " /* NONE */, + "M" /* MODIFIED */, + (result, file) => append(result.modified, file) + ), + parser2( + "A" /* ADDED */, + " " /* NONE */, + (result, file) => append(result.created, file) && append(result.staged, file) + ), + parser2( + "A" /* ADDED */, + "M" /* MODIFIED */, + (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file) + ), + parser2( + "D" /* DELETED */, + " " /* NONE */, + (result, file) => append(result.deleted, file) && append(result.staged, file) + ), + parser2( + "M" /* MODIFIED */, + " " /* NONE */, + (result, file) => append(result.modified, file) && append(result.staged, file) + ), + parser2( + "M" /* MODIFIED */, + "M" /* MODIFIED */, + (result, file) => append(result.modified, file) && append(result.staged, file) + ), parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => { append(result.renamed, renamedFile(file)); }), @@ -16696,10 +17275,23 @@ var init_StatusSummary = __esm({ parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { append(_result.ignored = _result.ignored || [], _file); }), - parser2("?" /* UNTRACKED */, "?" /* UNTRACKED */, (result, file) => append(result.not_added, file)), + parser2( + "?" /* UNTRACKED */, + "?" /* UNTRACKED */, + (result, file) => append(result.not_added, file) + ), ...conflicts("A" /* ADDED */, "A" /* ADDED */, "U" /* UNMERGED */), - ...conflicts("D" /* DELETED */, "D" /* DELETED */, "U" /* UNMERGED */), - ...conflicts("U" /* UNMERGED */, "A" /* ADDED */, "D" /* DELETED */, "U" /* UNMERGED */), + ...conflicts( + "D" /* DELETED */, + "D" /* DELETED */, + "U" /* UNMERGED */ + ), + ...conflicts( + "U" /* UNMERGED */, + "A" /* ADDED */, + "D" /* DELETED */, + "U" /* UNMERGED */ + ), [ "##", (result, line) => { @@ -16762,6 +17354,7 @@ function statusTask(customArgs) { var ignoredOptions; var init_status = __esm({ "src/lib/tasks/status.ts"() { + "use strict"; init_StatusSummary(); ignoredOptions = ["--null", "-z"]; } @@ -16769,19 +17362,23 @@ var init_status = __esm({ // src/lib/tasks/version.ts function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) { - return Object.defineProperty({ - major, - minor, - patch, - agent, - installed - }, "toString", { - value() { - return `${this.major}.${this.minor}.${this.patch}`; + return Object.defineProperty( + { + major, + minor, + patch, + agent, + installed }, - configurable: false, - enumerable: false - }); + "toString", + { + value() { + return `${this.major}.${this.minor}.${this.patch}`; + }, + configurable: false, + enumerable: false + } + ); } function notInstalledResponse() { return versionResponse(0, 0, 0, "", false); @@ -16812,15 +17409,25 @@ function versionParser(stdOut) { var NOT_INSTALLED, parsers7; var init_version = __esm({ "src/lib/tasks/version.ts"() { + "use strict"; init_utils(); NOT_INSTALLED = "installed=false"; parsers7 = [ - new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, (result, [major, minor, patch, agent = ""]) => { - Object.assign(result, versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)); - }), - new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/, (result, [major, minor, patch, agent = ""]) => { - Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent)); - }) + new LineParser( + /version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, + (result, [major, minor, patch, agent = ""]) => { + Object.assign( + result, + versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent) + ); + } + ), + new LineParser( + /version (\d+)\.(\d+)\.(\D+)(.+)?$/, + (result, [major, minor, patch, agent = ""]) => { + Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent)); + } + ) ]; } }); @@ -16833,6 +17440,7 @@ __export(simple_git_api_exports, { var SimpleGitApi; var init_simple_git_api = __esm({ "src/lib/simple-git-api.ts"() { + "use strict"; init_task_callback(); init_change_working_directory(); init_checkout(); @@ -16867,7 +17475,10 @@ var init_simple_git_api = __esm({ }); } add(files) { - return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(["add", ...asArray(files)]), + trailingFunctionArgument(arguments) + ); } cwd(directory) { const next = trailingFunctionArgument(arguments); @@ -16875,44 +17486,88 @@ var init_simple_git_api = __esm({ return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next); } if (typeof (directory == null ? void 0 : directory.path) === "string") { - return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || void 0), next); + return this._runTask( + changeWorkingDirectoryTask( + directory.path, + directory.root && this._executor || void 0 + ), + next + ); } - return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next); + return this._runTask( + configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), + next + ); } hashObject(path, write) { - return this._runTask(hashObjectTask(path, write === true), trailingFunctionArgument(arguments)); + return this._runTask( + hashObjectTask(path, write === true), + trailingFunctionArgument(arguments) + ); } init(bare) { - return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + return this._runTask( + initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), + trailingFunctionArgument(arguments) + ); } merge() { - return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + return this._runTask( + mergeTask(getTrailingOptions(arguments)), + trailingFunctionArgument(arguments) + ); } mergeFromTo(remote, branch) { if (!(filterString(remote) && filterString(branch))) { - return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`)); + return this._runTask( + configurationErrorTask( + `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings` + ) + ); } - return this._runTask(mergeTask([remote, branch, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments, false)); + return this._runTask( + mergeTask([remote, branch, ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments, false) + ); } outputHandler(handler) { this._executor.outputHandler = handler; return this; } push() { - const task = pushTask({ - remote: filterType(arguments[0], filterString), - branch: filterType(arguments[1], filterString) - }, getTrailingOptions(arguments)); + const task = pushTask( + { + remote: filterType(arguments[0], filterString), + branch: filterType(arguments[1], filterString) + }, + getTrailingOptions(arguments) + ); return this._runTask(task, trailingFunctionArgument(arguments)); } stash() { - return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + return this._runTask( + straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), + trailingFunctionArgument(arguments) + ); } status() { - return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + return this._runTask( + statusTask(getTrailingOptions(arguments)), + trailingFunctionArgument(arguments) + ); } }; - Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default()); + Object.assign( + SimpleGitApi.prototype, + checkout_default(), + commit_default(), + config_default(), + first_commit_default(), + grep_default(), + log_default(), + show_default(), + version_default() + ); } }); @@ -16924,6 +17579,7 @@ __export(scheduler_exports, { var import_promise_deferred2, createScheduledTask, Scheduler; var init_scheduler = __esm({ "src/lib/runners/scheduler.ts"() { + "use strict"; init_utils(); import_promise_deferred2 = __nccwpck_require__(9819); init_git_logger(); @@ -16949,7 +17605,12 @@ var init_scheduler = __esm({ } schedule() { if (!this.pending.length || this.running.length >= this.concurrency) { - this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency); + this.logger( + `Schedule attempt ignored, pending=%s running=%s concurrency=%s`, + this.pending.length, + this.running.length, + this.concurrency + ); return; } const task = append(this.running, this.pending.shift()); @@ -16980,6 +17641,7 @@ function applyPatchTask(patches, customArgs) { } var init_apply_patch = __esm({ "src/lib/tasks/apply-patch.ts"() { + "use strict"; init_task(); } }); @@ -17002,6 +17664,7 @@ function branchDeletionFailure(branch) { var BranchDeletionBatch; var init_BranchDeleteSummary = __esm({ "src/lib/responses/BranchDeleteSummary.ts"() { + "use strict"; BranchDeletionBatch = class { constructor() { this.all = []; @@ -17022,6 +17685,7 @@ function hasBranchDeletionError(data, processExitCode) { var deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions; var init_parse_branch_delete = __esm({ "src/lib/parsers/parse-branch-delete.ts"() { + "use strict"; init_BranchDeleteSummary(); init_utils(); deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/; @@ -17049,6 +17713,7 @@ var init_parse_branch_delete = __esm({ var BranchSummaryResult; var init_BranchSummary = __esm({ "src/lib/responses/BranchSummary.ts"() { + "use strict"; BranchSummaryResult = class { constructor() { this.all = []; @@ -17084,15 +17749,22 @@ function parseBranchSummary(stdOut) { var parsers9; var init_parse_branch = __esm({ "src/lib/parsers/parse-branch.ts"() { + "use strict"; init_BranchSummary(); init_utils(); parsers9 = [ - new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => { - result.push(branchStatus(current), true, name, commit, label); - }), - new LineParser(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => { - result.push(branchStatus(current), false, name, commit, label); - }) + new LineParser( + /^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, + (result, [current, name, commit, label]) => { + result.push(branchStatus(current), true, name, commit, label); + } + ), + new LineParser( + new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$", "s"), + (result, [current, name, commit, label]) => { + result.push(branchStatus(current), false, name, commit, label); + } + ) ]; } }); @@ -17164,13 +17836,17 @@ function deleteBranchTask(branch, forceDelete = false) { if (!hasBranchDeletionError(String(error), exitCode)) { return fail(error); } - throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error)); + throw new GitResponseError( + task.parser(bufferToString(stdOut), bufferToString(stdErr)), + String(error) + ); } }; return task; } var init_branch = __esm({ "src/lib/tasks/branch.ts"() { + "use strict"; init_git_response_error(); init_parse_branch_delete(); init_parse_branch(); @@ -17182,6 +17858,7 @@ var init_branch = __esm({ var parseCheckIgnore; var init_CheckIgnore = __esm({ "src/lib/responses/CheckIgnore.ts"() { + "use strict"; parseCheckIgnore = (text) => { return text.split(/\n/g).map((line) => line.trim()).filter((file) => !!file); }; @@ -17202,6 +17879,7 @@ function checkIgnoreTask(paths) { } var init_check_ignore = __esm({ "src/lib/tasks/check-ignore.ts"() { + "use strict"; init_CheckIgnore(); } }); @@ -17231,6 +17909,7 @@ function cloneMirrorTask(repo, directory, customArgs) { } var init_clone = __esm({ "src/lib/tasks/clone.ts"() { + "use strict"; init_task(); init_utils(); } @@ -17251,6 +17930,7 @@ function parseFetchResult(stdOut, stdErr) { var parsers10; var init_parse_fetch = __esm({ "src/lib/parsers/parse-fetch.ts"() { + "use strict"; init_utils(); parsers10 = [ new LineParser(/From (.+)$/, (result, [remote]) => { @@ -17273,14 +17953,17 @@ var init_parse_fetch = __esm({ tracking }); }), - new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, (result, [from, to, name, tracking]) => { - result.updated.push({ - name, - tracking, - to, - from - }); - }) + new LineParser( + /\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, + (result, [from, to, name, tracking]) => { + result.updated.push({ + name, + tracking, + to, + from + }); + } + ) ]; } }); @@ -17310,6 +17993,7 @@ function fetchTask(remote, branch, customArgs) { } var init_fetch = __esm({ "src/lib/tasks/fetch.ts"() { + "use strict"; init_parse_fetch(); init_task(); } @@ -17322,6 +18006,7 @@ function parseMoveResult(stdOut) { var parsers11; var init_parse_move = __esm({ "src/lib/parsers/parse-move.ts"() { + "use strict"; init_utils(); parsers11 = [ new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => { @@ -17345,6 +18030,7 @@ function moveTask(from, to) { } var init_move = __esm({ "src/lib/tasks/move.ts"() { + "use strict"; init_parse_move(); init_utils(); } @@ -17367,7 +18053,10 @@ function pullTask(remote, branch, customArgs) { return parsePullResult(stdOut, stdErr); }, onError(result, _error, _done, fail) { - const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr)); + const pullError = parsePullErrorResult( + bufferToString(result.stdOut), + bufferToString(result.stdErr) + ); if (pullError) { return fail(new GitResponseError(pullError)); } @@ -17377,6 +18066,7 @@ function pullTask(remote, branch, customArgs) { } var init_pull = __esm({ "src/lib/tasks/pull.ts"() { + "use strict"; init_git_response_error(); init_parse_pull(); init_utils(); @@ -17409,6 +18099,7 @@ function forEach(text, handler) { } var init_GetRemoteSummary = __esm({ "src/lib/responses/GetRemoteSummary.ts"() { + "use strict"; init_utils(); } }); @@ -17422,7 +18113,7 @@ __export(remote_exports, { remoteTask: () => remoteTask, removeRemoteTask: () => removeRemoteTask }); -function addRemoteTask(remoteName, remoteRepo, customArgs = []) { +function addRemoteTask(remoteName, remoteRepo, customArgs) { return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]); } function getRemotesTask(verbose) { @@ -17436,14 +18127,14 @@ function getRemotesTask(verbose) { parser: verbose ? parseGetRemotesVerbose : parseGetRemotes }; } -function listRemotesTask(customArgs = []) { +function listRemotesTask(customArgs) { const commands = [...customArgs]; if (commands[0] !== "ls-remote") { commands.unshift("ls-remote"); } return straightThroughStringTask(commands); } -function remoteTask(customArgs = []) { +function remoteTask(customArgs) { const commands = [...customArgs]; if (commands[0] !== "remote") { commands.unshift("remote"); @@ -17455,6 +18146,7 @@ function removeRemoteTask(remoteName) { } var init_remote = __esm({ "src/lib/tasks/remote.ts"() { + "use strict"; init_GetRemoteSummary(); init_task(); } @@ -17468,7 +18160,11 @@ __export(stash_list_exports, { function stashListTask(opt = {}, customArgs) { const options = parseLogOptions(opt); const commands = ["stash", "list", ...options.commands, ...customArgs]; - const parser3 = createListLogSummaryParser(options.splitter, options.fields, logFormatFromCommand(commands)); + const parser3 = createListLogSummaryParser( + options.splitter, + options.fields, + logFormatFromCommand(commands) + ); return validateLogFormatConfig(commands) || { commands, format: "utf-8", @@ -17477,6 +18173,7 @@ function stashListTask(opt = {}, customArgs) { } var init_stash_list = __esm({ "src/lib/tasks/stash-list.ts"() { + "use strict"; init_log_format(); init_parse_list_log_summary(); init_diff(); @@ -17510,6 +18207,7 @@ function updateSubModuleTask(customArgs) { } var init_sub_module = __esm({ "src/lib/tasks/sub-module.ts"() { + "use strict"; init_task(); } }); @@ -17538,6 +18236,7 @@ function toNumber(input) { var TagList, parseTagList; var init_TagList = __esm({ "src/lib/responses/TagList.ts"() { + "use strict"; TagList = class { constructor(all, latest) { this.all = all; @@ -17605,6 +18304,7 @@ function addAnnotatedTagTask(name, tagMessage) { } var init_tag = __esm({ "src/lib/tasks/tag.ts"() { + "use strict"; init_TagList(); } }); @@ -17612,6 +18312,7 @@ var init_tag = __esm({ // src/git.js var require_git = __commonJS({ "src/git.js"(exports2, module2) { + "use strict"; var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports)); var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports)); var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports)); @@ -17661,12 +18362,17 @@ var require_git = __commonJS({ var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports)); var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports)); function Git2(options, plugins) { - this._executor = new GitExecutor2(options.binary, options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins); + this._plugins = plugins; + this._executor = new GitExecutor2( + options.baseDir, + new Scheduler2(options.maxConcurrentProcesses), + plugins + ); this._trimmed = options.trimmed; } (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2; Git2.prototype.customBinary = function(command) { - this._executor.binary = command; + this._plugins.reconfigure("binary", command); return this; }; Git2.prototype.env = function(name, value) { @@ -17678,7 +18384,13 @@ var require_git = __commonJS({ return this; }; Git2.prototype.stashList = function(options) { - return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments)); + return this._runTask( + stashListTask2( + trailingOptionsArgument2(arguments) || {}, + filterArray2(options) && options || [] + ), + trailingFunctionArgument2(arguments) + ); }; function createCloneTask(api, task, repoPath, localPath) { if (typeof repoPath !== "string") { @@ -17687,10 +18399,16 @@ var require_git = __commonJS({ return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments)); } Git2.prototype.clone = function() { - return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments)); + return this._runTask( + createCloneTask("clone", cloneTask2, ...arguments), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.mirror = function() { - return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments)); + return this._runTask( + createCloneTask("mirror", cloneMirrorTask2, ...arguments), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.mv = function(from, to) { return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments)); @@ -17704,46 +18422,86 @@ var require_git = __commonJS({ }); }; Git2.prototype.pull = function(remote, branch, options, then) { - return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + pullTask2( + filterType2(remote, filterString2), + filterType2(branch, filterString2), + getTrailingOptions2(arguments) + ), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.fetch = function(remote, branch) { - return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + fetchTask2( + filterType2(remote, filterString2), + filterType2(branch, filterString2), + getTrailingOptions2(arguments) + ), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.silent = function(silence) { - console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"); + console.warn( + "simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3" + ); return this; }; Git2.prototype.tags = function(options, then) { - return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + tagListTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.rebase = function() { - return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.reset = function(mode) { - return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.revert = function(commit) { const next = trailingFunctionArgument2(arguments); if (typeof commit !== "string") { return this._runTask(configurationErrorTask2("Commit must be a string"), next); } - return this._runTask(straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), next); + return this._runTask( + straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), + next + ); }; Git2.prototype.addTag = function(name) { const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name"); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) { - return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments)); + return this._runTask( + addAnnotatedTagTask2(tagName, tagMessage), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) { - return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); + return this._runTask( + deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) { - return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); + return this._runTask( + deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.branch = function(options, then) { - return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + branchTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.branchLocal = function(then) { return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments)); @@ -17760,7 +18518,10 @@ var require_git = __commonJS({ command.push(...getTrailingOptions2(arguments, 0, true)); var next = trailingFunctionArgument2(arguments); if (!command.length) { - return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next); + return this._runTask( + configurationErrorTask2("Raw: must supply one or more command to execute"), + next + ); } return this._runTask(straightThroughStringTask2(command, this._trimmed), next); }; @@ -17768,19 +18529,34 @@ var require_git = __commonJS({ return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments)); }; Git2.prototype.submoduleUpdate = function(args, then) { - return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); + return this._runTask( + updateSubModuleTask2(getTrailingOptions2(arguments, true)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.submoduleInit = function(args, then) { - return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); + return this._runTask( + initSubModuleTask2(getTrailingOptions2(arguments, true)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.subModule = function(options, then) { - return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + subModuleTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.listRemote = function() { - return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + listRemotesTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.addRemote = function(remoteName, remoteRepo, then) { - return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.removeRemote = function(remoteName, then) { return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments)); @@ -17789,7 +18565,10 @@ var require_git = __commonJS({ return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments)); }; Git2.prototype.remote = function(options, then) { - return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + return this._runTask( + remoteTask2(getTrailingOptions2(arguments)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.tag = function(options, then) { const command = getTrailingOptions2(arguments); @@ -17799,17 +18578,29 @@ var require_git = __commonJS({ return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments)); }; Git2.prototype.updateServerInfo = function(then) { - return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["update-server-info"]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.pushTags = function(remote, then) { - const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments)); + const task = pushTagsTask2( + { remote: filterType2(remote, filterString2) }, + getTrailingOptions2(arguments) + ); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.rm = function(files) { - return this._runTask(straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.rmKeepLocal = function(files) { - return this._runTask(straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.catFile = function(options, then) { return this._catFile("utf-8", arguments); @@ -17822,7 +18613,10 @@ var require_git = __commonJS({ var command = ["cat-file"]; var options = args[0]; if (typeof options === "string") { - return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler); + return this._runTask( + configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), + handler + ); } if (Array.isArray(options)) { command.push.apply(command, options); @@ -17831,25 +18625,38 @@ var require_git = __commonJS({ return this._runTask(task, handler); }; Git2.prototype.diff = function(options, then) { - const task = filterString2(options) ? configurationErrorTask2("git.diff: supplying options as a single string is no longer supported, switch to an array of strings") : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]); + const task = filterString2(options) ? configurationErrorTask2( + "git.diff: supplying options as a single string is no longer supported, switch to an array of strings" + ) : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.diffSummary = function() { - return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments)); + return this._runTask( + diffSummaryTask2(getTrailingOptions2(arguments, 1)), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.applyPatch = function(patches) { - const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(`git.applyPatch requires one or more string patches as the first argument`) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1))); + const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2( + `git.applyPatch requires one or more string patches as the first argument` + ) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1))); return this._runTask(task, trailingFunctionArgument2(arguments)); }; Git2.prototype.revparse = function() { const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)]; - return this._runTask(straightThroughStringTask2(commands, true), trailingFunctionArgument2(arguments)); + return this._runTask( + straightThroughStringTask2(commands, true), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.clean = function(mode, options, then) { const usingCleanOptionsArray = isCleanOptionsArray2(mode); const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || ""; const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0)); - return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments)); + return this._runTask( + cleanWithOptionsTask2(cleanMode, customArgs), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.exec = function(then) { const task = { @@ -17867,10 +18674,16 @@ var require_git = __commonJS({ return this; }; Git2.prototype.checkIgnore = function(pathnames, then) { - return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments)); + return this._runTask( + checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), + trailingFunctionArgument2(arguments) + ); }; Git2.prototype.checkIsRepo = function(checkType, then) { - return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments)); + return this._runTask( + checkIsRepoTask2(filterType2(checkType, filterString2)), + trailingFunctionArgument2(arguments) + ); }; module2.exports = Git2; } @@ -17893,10 +18706,17 @@ function gitExportFactory(factory) { return Object.assign(factory.bind(null), api_exports); } function gitInstanceFactory(baseDir, options) { + var _a2; const plugins = new PluginStore(); - const config = createInstanceConfig(baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, options); + const config = createInstanceConfig( + baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, + options + ); if (!folderExists(config.baseDir)) { - throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`); + throw new GitConstructError( + config, + `Cannot use simple-git on a directory that does not exist` + ); } if (Array.isArray(config.config)) { plugins.add(commandConfigPrefixingPlugin(config.config)); @@ -17910,11 +18730,13 @@ function gitInstanceFactory(baseDir, options) { config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions)); plugins.add(errorDetectionPlugin(errorDetectionHandler(true))); config.errors && plugins.add(errorDetectionPlugin(config.errors)); + customBinaryPlugin(plugins, config.binary, (_a2 = config.unsafe) == null ? void 0 : _a2.allowUnsafeCustomBinary); return new Git(config, plugins); } var Git; var init_git_factory = __esm({ "src/lib/git-factory.ts"() { + "use strict"; init_api(); init_plugins(); init_suffix_paths_plugin(); @@ -17942,22 +18764,27 @@ function gitP(...args) { function chainReturn() { return chain; } - const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce((api, name) => { - const isAsync = functionNamesPromiseApi.includes(name); - const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api); - const alternative = isAsync ? chainReturn : builderReturn; - Object.defineProperty(api, name, { - enumerable: false, - configurable: false, - value: git ? valid : alternative - }); - return api; - }, {}); + const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce( + (api, name) => { + const isAsync = functionNamesPromiseApi.includes(name); + const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api); + const alternative = isAsync ? chainReturn : builderReturn; + Object.defineProperty(api, name, { + enumerable: false, + configurable: false, + value: git ? valid : alternative + }); + return api; + }, + {} + ); return promiseApi; function asyncWrapper(fn, git2) { return function(...args2) { if (typeof args2[args2.length] === "function") { - throw new TypeError("Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to " + fn); + throw new TypeError( + "Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to " + fn + ); } return chain.then(function() { return new Promise(function(resolve, reject) { @@ -17992,6 +18819,7 @@ function toError(error) { var functionNamesBuilderApi, functionNamesPromiseApi; var init_promise_wrapped = __esm({ "src/lib/runners/promise-wrapped.ts"() { + "use strict"; init_git_response_error(); init_git_factory(); functionNamesBuilderApi = ["customBinary", "env", "outputHandler", "silent"]; @@ -30271,6 +31099,9 @@ function httpRedirectFetch (fetchParams, response) { // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name request.headersList.delete('authorization') + // https://fetch.spec.whatwg.org/#authentication-entries + request.headersList.delete('proxy-authorization', true) + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. request.headersList.delete('cookie') request.headersList.delete('host') @@ -41950,7 +42781,7 @@ Dicer.prototype._write = function (data, encoding, cb) { if (this._headerFirst && this._isPreamble) { if (!this._part) { this._part = new PartStream(this._partOpts) - if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() } + if (this.listenerCount('preamble') !== 0) { this.emit('preamble', this._part) } else { this._ignore() } } const r = this._hparser.push(data) if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() } @@ -42007,7 +42838,7 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { } } if (this._dashes === 2) { - if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) } + if ((start + i) < end && this.listenerCount('trailer') !== 0) { this.emit('trailer', data.slice(start + i, end)) } this.reset() this._finished = true // no more parts will be added @@ -42025,7 +42856,13 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { this._part._read = function (n) { self._unpause() } - if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() } + if (this._isPreamble && this.listenerCount('preamble') !== 0) { + this.emit('preamble', this._part) + } else if (this._isPreamble !== true && this.listenerCount('part') !== 0) { + this.emit('part', this._part) + } else { + this._ignore() + } if (!this._isPreamble) { this._inHeader = true } } if (data && start < end && !this._ignoreData) { @@ -42708,7 +43545,7 @@ function Multipart (boy, cfg) { ++nfiles - if (!boy._events.file) { + if (boy.listenerCount('file') === 0) { self.parser._ignore() return } @@ -43237,7 +44074,7 @@ const decoders = { if (textDecoders.has(this.toString())) { try { return textDecoders.get(this).decode(data) - } catch (e) { } + } catch {} } return typeof data === 'string' ? data diff --git a/package-lock.json b/package-lock.json index ead9268..ba557b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,136 +72,65 @@ } }, "node_modules/@actions/http-client": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz", - "integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.1.tgz", + "integrity": "sha512-KhC/cZsq7f8I4LfZSJKgCvEwfkE8o1538VoBeoGzokVLLnbFDEAdFD3UhoMklxo2un9NJVBdANOresx7vTHlHw==", "dependencies": { "tunnel": "^0.0.6", "undici": "^5.25.4" } }, "node_modules/@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/code-frame": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", - "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", + "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", "dev": true, "dependencies": { - "@babel/highlight": "^7.23.4", - "chalk": "^2.4.2" + "@babel/highlight": "^7.24.2", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/code-frame/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/code-frame/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/code-frame/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/compat-data": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", - "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.24.1.tgz", + "integrity": "sha512-Pc65opHDliVpRHuKfzI+gSA4zcgr65O4cl64fFJIWEEh8JoHIHh0Oez1Eo8Arz8zq/JhgKodQaxEwUPRtZylVA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.23.7", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.7.tgz", - "integrity": "sha512-+UpDgowcmqe36d4NwqvKsyPMlOLNGMsfMmQ5WGCu+siCe3t3dfe9njrzGfdN4qq+bcNUt0+Vw6haRxBOycs4dw==", + "version": "7.24.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.3.tgz", + "integrity": "sha512-5FcvN1JHw2sHJChotgx8Ek0lyuh4kCKelgMTTqhYJJtloNvUfpAFMeNQUtdlIaktwrSV9LtCdqwk48wL2wBacQ==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.6", + "@babel/code-frame": "^7.24.2", + "@babel/generator": "^7.24.1", "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.7", - "@babel/parser": "^7.23.6", - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.7", - "@babel/types": "^7.23.6", + "@babel/helpers": "^7.24.1", + "@babel/parser": "^7.24.1", + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -226,14 +155,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", - "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.1.tgz", + "integrity": "sha512-DfCRfZsBcrPEHUfuBMgbJ1Ut01Y/itOs+hY2nFLgqsqXd52/iSiVq5TITtUasIUgm+IIKdY2/1I7auiQOEeC9A==", "dev": true, "dependencies": { - "@babel/types": "^7.23.6", - "@jridgewell/gen-mapping": "^0.3.2", - "@jridgewell/trace-mapping": "^0.3.17", + "@babel/types": "^7.24.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^2.5.1" }, "engines": { @@ -300,12 +229,12 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", - "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", + "version": "7.24.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz", + "integrity": "sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg==", "dev": true, "dependencies": { - "@babel/types": "^7.22.15" + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -331,9 +260,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz", + "integrity": "sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==", "dev": true, "engines": { "node": ">=6.9.0" @@ -364,9 +293,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", - "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz", + "integrity": "sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -391,28 +320,29 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.8", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.8.tgz", - "integrity": "sha512-KDqYz4PiOWvDFrdHLPhKtCThtIcKVy6avWD2oG4GEvyQ+XDZwHD4YQd+H2vNMnq2rkdxsDkU82T+Vk8U/WXHRQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.1.tgz", + "integrity": "sha512-BpU09QqEe6ZCHuIHFphEFgvNSrubve1FtyMton26ekZ85gRGi6LrTF7zArARp2YvyFxloeiRmtSCq5sjh1WqIg==", "dev": true, "dependencies": { - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.7", - "@babel/types": "^7.23.6" + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", - "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.2.tgz", + "integrity": "sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", - "js-tokens": "^4.0.0" + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" @@ -490,9 +420,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz", - "integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.1.tgz", + "integrity": "sha512-Zo9c7N3xdOIQrNip7Lc9wvRPzlRtovHVE4lkz8WEDr7uYh/GMQhSiIgFxGIArRHYdJE5kxtZjAf8rT0xhdLCzg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -562,12 +492,12 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz", - "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.1.tgz", + "integrity": "sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" + "@babel/helper-plugin-utils": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -664,12 +594,12 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz", - "integrity": "sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.1.tgz", + "integrity": "sha512-Yhnmvy5HZEnHUty6i++gcfH1/l68AHnItFHnaCv6hn9dNh0hQvvQJsxpi4BMBFN5DLeHBuucT/0DgzXif/OyRw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" + "@babel/helper-plugin-utils": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -679,33 +609,33 @@ } }, "node_modules/@babel/template": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", - "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", + "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.13", - "@babel/parser": "^7.22.15", - "@babel/types": "^7.22.15" + "@babel/code-frame": "^7.23.5", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.23.7", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.7.tgz", - "integrity": "sha512-tY3mM8rH9jM0YHFGyfC0/xf+SB5eKUu7HPj7/k3fpi9dAlsMc5YbQvDi0Sh2QTPXqMhyaAtzAr807TIyfQrmyg==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.1.tgz", + "integrity": "sha512-xuU6o9m68KeqZbQuDt2TcKSxUw/mrsvavlEqQ1leZ/B+C9tk6E4sRWy97WaXgvq5E+nU3cXMxv3WKOCanVMCmQ==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.6", + "@babel/code-frame": "^7.24.1", + "@babel/generator": "^7.24.1", "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.6", - "@babel/types": "^7.23.6", + "@babel/parser": "^7.24.1", + "@babel/types": "^7.24.0", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -723,9 +653,9 @@ } }, "node_modules/@babel/types": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", - "integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.23.4", @@ -743,9 +673,9 @@ "dev": true }, "node_modules/@dev-build-deploy/commit-it": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.1.0.tgz", - "integrity": "sha512-ivPexRuSLBOKhjnyxou0iGomsxj63mtLpReL437AKFOCWoCC2ruu76lSWShGdLSf4jjv8oxV9+YH5RJGbc4Vew==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.2.0.tgz", + "integrity": "sha512-FTG1egTOCsZAgSdqRzwTodNAsidtmp0ocFrAB4uToQI7WgY20wLl09XkudCoZbe2ZkW2m2fwSNgqLTJcICiE9Q==", "dependencies": { "@dev-build-deploy/diagnose-it": "^1", "chalk": "<5" @@ -842,18 +772,18 @@ } }, "node_modules/@eslint/js": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", - "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@fastify/busboy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", - "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", "engines": { "node": ">=14" } @@ -908,9 +838,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "dev": true }, "node_modules/@istanbuljs/load-nyc-config": { @@ -1300,32 +1230,32 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", "dev": true, "dependencies": { - "@jridgewell/set-array": "^1.0.1", + "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" @@ -1338,9 +1268,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.21", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz", - "integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -1404,9 +1334,9 @@ } }, "node_modules/@octokit/core": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.0.2.tgz", - "integrity": "sha512-cZUy1gUvd4vttMic7C0lwPed8IYXWYp8kHIMatyhY8t8n3Cpw2ILczkV5pGMPqef7v0bLo0pOHrEHarsau2Ydg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.1.0.tgz", + "integrity": "sha512-BDa2VAMLSh3otEiaMJ/3Y36GU4qf6GI+VivQ/P41NC6GHcdxpKlqV0ikSZ5gdQsmS3ojXeRx5vasgNTinF0Q4g==", "dependencies": { "@octokit/auth-token": "^4.0.0", "@octokit/graphql": "^7.0.0", @@ -1448,40 +1378,41 @@ "node_modules/@octokit/openapi-types": { "version": "19.1.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.1.0.tgz", - "integrity": "sha512-6G+ywGClliGQwRsjvqVYpklIfa7oRPA0vyhPQG/1Feh+B+wU0vGH1JiJ5T25d3g1JZYBHzR2qefLi9x8Gt+cpw==" + "integrity": "sha512-6G+ywGClliGQwRsjvqVYpklIfa7oRPA0vyhPQG/1Feh+B+wU0vGH1JiJ5T25d3g1JZYBHzR2qefLi9x8Gt+cpw==", + "dev": true }, "node_modules/@octokit/plugin-paginate-rest": { - "version": "9.1.5", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.1.5.tgz", - "integrity": "sha512-WKTQXxK+bu49qzwv4qKbMMRXej1DU2gq017euWyKVudA6MldaSSQuxtz+vGbhxV4CjxpUxjZu6rM2wfc1FiWVg==", + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", + "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", "dependencies": { - "@octokit/types": "^12.4.0" + "@octokit/types": "^12.6.0" }, "engines": { "node": ">= 18" }, "peerDependencies": { - "@octokit/core": ">=5" + "@octokit/core": "5" } }, "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.2.0.tgz", - "integrity": "sha512-ePbgBMYtGoRNXDyKGvr9cyHjQ163PbwD0y1MkDJCpkO2YH4OeXX40c4wYHKikHGZcpGPbcRLuy0unPUuafco8Q==", + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", + "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", "dependencies": { - "@octokit/types": "^12.3.0" + "@octokit/types": "^12.6.0" }, "engines": { "node": ">= 18" }, "peerDependencies": { - "@octokit/core": ">=5" + "@octokit/core": "5" } }, "node_modules/@octokit/request": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.1.6.tgz", - "integrity": "sha512-YhPaGml3ncZC1NfXpP3WZ7iliL1ap6tLkAp6MvbK2fTTPytzVUyUesBBogcdMm86uRYO5rHaM1xIWxigWZ17MQ==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.2.0.tgz", + "integrity": "sha512-exPif6x5uwLqv1N1irkLG1zZNJkOtj8bZxuVHd71U5Ftuxf2wGNvAJyNBcPbPC+EBzwYEbBDdSFb8EPcjpYxPQ==", "dependencies": { "@octokit/endpoint": "^9.0.0", "@octokit/request-error": "^5.0.0", @@ -1506,13 +1437,18 @@ } }, "node_modules/@octokit/types": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.4.0.tgz", - "integrity": "sha512-FLWs/AvZllw/AGVs+nJ+ELCDZZJk+kY0zMen118xhL2zD0s1etIUHm1odgjP7epxYU1ln7SZxEUWYop5bhsdgQ==", + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", "dependencies": { - "@octokit/openapi-types": "^19.1.0" + "@octokit/openapi-types": "^20.0.0" } }, + "node_modules/@octokit/types/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==" + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -1520,9 +1456,9 @@ "dev": true }, "node_modules/@sinonjs/commons": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", - "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, "dependencies": { "type-detect": "4.0.8" @@ -1538,9 +1474,9 @@ } }, "node_modules/@tsconfig/node20": { - "version": "20.1.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node20/-/node20-20.1.2.tgz", - "integrity": "sha512-madaWq2k+LYMEhmcp0fs+OGaLFk0OenpHa4gmI4VEmCKX4PJntQ6fnnGADVFrVkBj0wIdAlQnK/MrlYTHsa1gQ==", + "version": "20.1.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node20/-/node20-20.1.4.tgz", + "integrity": "sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==", "dev": true }, "node_modules/@types/babel__core": { @@ -1618,9 +1554,9 @@ } }, "node_modules/@types/jest": { - "version": "29.5.11", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz", - "integrity": "sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==", + "version": "29.5.12", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz", + "integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==", "dev": true, "dependencies": { "expect": "^29.0.0", @@ -1640,29 +1576,23 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.19.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.8.tgz", - "integrity": "sha512-g1pZtPhsvGVTwmeVoexWZLTQaOvXwoSq//pTL0DHeNzUDrFnir4fgETdhjhIxjVnN+hKOuh98+E1eMLnUXstFg==", + "version": "18.19.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.28.tgz", + "integrity": "sha512-J5cOGD9n4x3YGgVuaND6khm5x07MMdAKkRyXnjVR6KFhLMNh2yONGiP7Z+4+tBOt5mK+GvDTiacTOVGGpqiecw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", - "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", - "dev": true - }, "node_modules/@types/sarif": { "version": "2.1.7", "resolved": "https://registry.npmjs.org/@types/sarif/-/sarif-2.1.7.tgz", "integrity": "sha512-kRz0VEkJqWLf1LLVN4pT1cg1Z9wAuvI6L97V3m2f5B76Tg8d413ddvLBPTEHAZJlnn4XSvu0FkZtViCQGVyrXQ==" }, "node_modules/@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", "dev": true }, "node_modules/@types/stack-utils": { @@ -1687,16 +1617,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.0.tgz", - "integrity": "sha512-DUCUkQNklCQYnrBSSikjVChdc84/vMPDQSgJTHBZ64G9bA9w0Crc0rd2diujKbTdp6w2J47qkeHQLoi0rpLCdg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.19.0", - "@typescript-eslint/type-utils": "6.19.0", - "@typescript-eslint/utils": "6.19.0", - "@typescript-eslint/visitor-keys": "6.19.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1722,15 +1652,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.0.tgz", - "integrity": "sha512-1DyBLG5SH7PYCd00QlroiW60YJ4rWMuUGa/JBV0iZuqi4l4IK3twKPq5ZkEebmGqRjXWVgsUzfd3+nZveewgow==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", + "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.19.0", - "@typescript-eslint/types": "6.19.0", - "@typescript-eslint/typescript-estree": "6.19.0", - "@typescript-eslint/visitor-keys": "6.19.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4" }, "engines": { @@ -1750,13 +1680,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.0.tgz", - "integrity": "sha512-dO1XMhV2ehBI6QN8Ufi7I10wmUovmLU0Oru3n5LVlM2JuzB4M+dVphCPLkVpKvGij2j/pHBWuJ9piuXx+BhzxQ==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.19.0", - "@typescript-eslint/visitor-keys": "6.19.0" + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1767,13 +1697,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.0.tgz", - "integrity": "sha512-mcvS6WSWbjiSxKCwBcXtOM5pRkPQ6kcDds/juxcy/727IQr3xMEcwr/YLHW2A2+Fp5ql6khjbKBzOyjuPqGi/w==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.19.0", - "@typescript-eslint/utils": "6.19.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1794,9 +1724,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.0.tgz", - "integrity": "sha512-lFviGV/vYhOy3m8BJ/nAKoAyNhInTdXpftonhWle66XHAtT1ouBlkjL496b5H5hb8dWXHwtypTqgtb/DEa+j5A==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1807,13 +1737,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.0.tgz", - "integrity": "sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.19.0", - "@typescript-eslint/visitor-keys": "6.19.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1835,17 +1765,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.0.tgz", - "integrity": "sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.19.0", - "@typescript-eslint/types": "6.19.0", - "@typescript-eslint/typescript-estree": "6.19.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", "semver": "^7.5.4" }, "engines": { @@ -1860,12 +1790,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.0.tgz", - "integrity": "sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/types": "6.21.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1998,28 +1928,32 @@ "dev": true }, "node_modules/array-buffer-byte-length": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", - "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", + "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "is-array-buffer": "^3.0.1" + "call-bind": "^1.0.5", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/array-includes": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", - "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", "is-string": "^1.0.7" }, "engines": { @@ -2039,16 +1973,17 @@ } }, "node_modules/array.prototype.findlastindex": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", - "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", + "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0", - "get-intrinsic": "^1.2.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -2094,17 +2029,18 @@ } }, "node_modules/arraybuffer.prototype.slice": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", - "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", + "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", "dev": true, "dependencies": { - "array-buffer-byte-length": "^1.0.0", - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", - "is-array-buffer": "^3.0.2", + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.3", + "es-errors": "^1.2.1", + "get-intrinsic": "^1.2.3", + "is-array-buffer": "^3.0.4", "is-shared-array-buffer": "^1.0.2" }, "engines": { @@ -2115,10 +2051,13 @@ } }, "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -2275,9 +2214,9 @@ } }, "node_modules/browserslist": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", - "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", + "version": "4.23.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz", + "integrity": "sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==", "dev": true, "funding": [ { @@ -2294,8 +2233,8 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001565", - "electron-to-chromium": "^1.4.601", + "caniuse-lite": "^1.0.30001587", + "electron-to-chromium": "^1.4.668", "node-releases": "^2.0.14", "update-browserslist-db": "^1.0.13" }, @@ -2334,14 +2273,19 @@ "dev": true }, "node_modules/call-bind": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", - "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dev": true, "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.1", - "set-function-length": "^1.1.1" + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2366,9 +2310,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001578", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001578.tgz", - "integrity": "sha512-J/jkFgsQ3NEl4w2lCoM9ZPxrD+FoBNJ7uJUpGVjIg/j0OwJosWM36EPDv+Yyi0V4twBk9pPmlFS+PLykgEvUmg==", + "version": "1.0.30001605", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001605.tgz", + "integrity": "sha512-nXwGlFWo34uliI9z3n6Qc0wZaf7zaZWA1CPZ169La5mV3I/gem7bst0vr5XQH5TJXZIMfDeZyOrZnSlVzKxxHQ==", "dev": true, "funding": [ { @@ -2531,6 +2475,57 @@ "node": ">= 8" } }, + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2577,17 +2572,20 @@ } }, "node_modules/define-data-property": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", - "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/define-properties": { @@ -2622,9 +2620,9 @@ } }, "node_modules/diff": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", - "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", "engines": { "node": ">=0.3.1" } @@ -2663,9 +2661,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.636", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.636.tgz", - "integrity": "sha512-NLE0GIy1OL9wRiKL20h9TkctBEYZuc99tquSS9MVdTahnuHputoETHeqDzgqGqyOY9NUH0g9wjfEuw5OD+wRcQ==", + "version": "1.4.723", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.723.tgz", + "integrity": "sha512-rxFVtrMGMFROr4qqU6n95rUi9IlfIm+lIAt+hOToy/9r6CDv0XiEcQdC3VP71y1pE5CFTzKV0RvxOGYCPWWHPw==", "dev": true }, "node_modules/emittery": { @@ -2687,9 +2685,9 @@ "dev": true }, "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.16.0.tgz", + "integrity": "sha512-O+QWCviPNSSLAD9Ucn8Awv+poAkqn3T1XY5/N7kR7rQO9yfSGWkYZDwpJ+iKF7B8rxaQKWngSqACpgzeapSyoA==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -2709,50 +2707,57 @@ } }, "node_modules/es-abstract": { - "version": "1.22.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz", - "integrity": "sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==", - "dev": true, - "dependencies": { - "array-buffer-byte-length": "^1.0.0", - "arraybuffer.prototype.slice": "^1.0.2", - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.5", - "es-set-tostringtag": "^2.0.1", + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "arraybuffer.prototype.slice": "^1.0.3", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.0.3", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", - "get-intrinsic": "^1.2.2", - "get-symbol-description": "^1.0.0", + "get-intrinsic": "^1.2.4", + "get-symbol-description": "^1.0.2", "globalthis": "^1.0.3", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "has-proto": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", "has-symbols": "^1.0.3", - "hasown": "^2.0.0", - "internal-slot": "^1.0.5", - "is-array-buffer": "^3.0.2", + "hasown": "^2.0.2", + "internal-slot": "^1.0.7", + "is-array-buffer": "^3.0.4", "is-callable": "^1.2.7", - "is-negative-zero": "^2.0.2", + "is-data-view": "^1.0.1", + "is-negative-zero": "^2.0.3", "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", + "is-shared-array-buffer": "^1.0.3", "is-string": "^1.0.7", - "is-typed-array": "^1.1.12", + "is-typed-array": "^1.1.13", "is-weakref": "^1.0.2", "object-inspect": "^1.13.1", "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.5.1", - "safe-array-concat": "^1.0.1", - "safe-regex-test": "^1.0.0", - "string.prototype.trim": "^1.2.8", - "string.prototype.trimend": "^1.0.7", - "string.prototype.trimstart": "^1.0.7", - "typed-array-buffer": "^1.0.0", - "typed-array-byte-length": "^1.0.0", - "typed-array-byte-offset": "^1.0.0", - "typed-array-length": "^1.0.4", + "object.assign": "^4.1.5", + "regexp.prototype.flags": "^1.5.2", + "safe-array-concat": "^1.1.2", + "safe-regex-test": "^1.0.3", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.6", "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.13" + "which-typed-array": "^1.1.15" }, "engines": { "node": ">= 0.4" @@ -2761,15 +2766,48 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-set-tostringtag": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", - "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.2", - "has-tostringtag": "^1.0.0", - "hasown": "^2.0.0" + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" }, "engines": { "node": ">= 0.4" @@ -2802,9 +2840,9 @@ } }, "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", "dev": true, "engines": { "node": ">=6" @@ -2823,16 +2861,16 @@ } }, "node_modules/eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", @@ -2923,9 +2961,9 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", - "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", + "integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", "dev": true, "dependencies": { "debug": "^3.2.7" @@ -3032,9 +3070,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "27.6.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.3.tgz", - "integrity": "sha512-+YsJFVH6R+tOiO3gCJon5oqn4KWc+mDq2leudk8mrp8RFubLOo9CVyi3cib4L7XMpxExmkmBZQTPDYVBzgpgOA==", + "version": "27.9.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz", + "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^5.10.0" @@ -3043,7 +3081,7 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0", + "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0", "eslint": "^7.0.0 || ^8.0.0", "jest": "*" }, @@ -3395,9 +3433,9 @@ "dev": true }, "node_modules/fastq": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", - "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -3467,9 +3505,9 @@ } }, "node_modules/flatted": { - "version": "3.2.9", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", - "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true }, "node_modules/for-each": { @@ -3556,16 +3594,20 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", - "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dev": true, "dependencies": { + "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3592,13 +3634,14 @@ } }, "node_modules/get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", + "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" + "call-bind": "^1.0.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4" }, "engines": { "node": ">= 0.4" @@ -3608,9 +3651,9 @@ } }, "node_modules/get-tsconfig": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", - "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.3.tgz", + "integrity": "sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==", "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" @@ -3765,21 +3808,21 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", - "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.2" + "es-define-property": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", "dev": true, "engines": { "node": ">= 0.4" @@ -3801,12 +3844,12 @@ } }, "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", "dev": true, "dependencies": { - "has-symbols": "^1.0.2" + "has-symbols": "^1.0.3" }, "engines": { "node": ">= 0.4" @@ -3816,9 +3859,9 @@ } }, "node_modules/hasown": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, "dependencies": { "function-bind": "^1.1.2" @@ -3827,27 +3870,6 @@ "node": ">= 0.4" } }, - "node_modules/hosted-git-info": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", - "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", - "dev": true, - "dependencies": { - "lru-cache": "^10.0.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/hosted-git-info/node_modules/lru-cache": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", - "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", - "dev": true, - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -3864,9 +3886,9 @@ } }, "node_modules/ignore": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", - "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true, "engines": { "node": ">= 4" @@ -3933,12 +3955,12 @@ "dev": true }, "node_modules/internal-slot": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", - "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", + "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.2", + "es-errors": "^1.3.0", "hasown": "^2.0.0", "side-channel": "^1.0.4" }, @@ -3947,14 +3969,16 @@ } }, "node_modules/is-array-buffer": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", - "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", + "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.0", - "is-typed-array": "^1.1.10" + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4018,6 +4042,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "dev": true, + "dependencies": { + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-date-object": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", @@ -4073,9 +4112,9 @@ } }, "node_modules/is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", "dev": true, "engines": { "node": ">= 0.4" @@ -4134,12 +4173,15 @@ } }, "node_modules/is-shared-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", - "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2" + "call-bind": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4188,12 +4230,12 @@ } }, "node_modules/is-typed-array": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", - "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", "dev": true, "dependencies": { - "which-typed-array": "^1.1.11" + "which-typed-array": "^1.1.14" }, "engines": { "node": ">= 0.4" @@ -4236,14 +4278,14 @@ } }, "node_modules/istanbul-lib-instrument": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz", - "integrity": "sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.2.tgz", + "integrity": "sha512-1WUsZ9R1lA0HtBSohTkm39WTPlNKSJ5iFk7UwqXkBLoHQT+hfqPsfsTDVuZdKGaBwn7din9bS7SsnoAr943hvw==", "dev": true, "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", "istanbul-lib-coverage": "^3.2.0", "semver": "^7.5.4" }, @@ -4280,9 +4322,9 @@ } }, "node_modules/istanbul-reports": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", - "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", @@ -5118,21 +5160,6 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, - "node_modules/normalize-package-data": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.0.tgz", - "integrity": "sha512-UL7ELRVxYBHBgYEtZCXjxuD5vPxnmvMGq0jp/dGPKKrN7tfsBh2IY7TlJ15WWwdjRWD3RJbnsygUurTK3xkPkg==", - "dev": true, - "dependencies": { - "hosted-git-info": "^7.0.0", - "is-core-module": "^2.8.1", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -5142,10 +5169,19 @@ "node": ">=0.10.0" } }, + "node_modules/npm-normalize-package-bin": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.1.tgz", + "integrity": "sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/npm-run-all2": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/npm-run-all2/-/npm-run-all2-6.1.1.tgz", - "integrity": "sha512-lWLbkPZ5BSdXtN8lR+0rc8caKoPdymycpZksyDEC9MOBvfdwTXZ0uVhb7bMcGeXv2/BKtfQuo6Zn3zfc8rxNXA==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/npm-run-all2/-/npm-run-all2-6.1.2.tgz", + "integrity": "sha512-WwwnS8Ft+RpXve6T2EIEVpFLSqN+ORHRvgNk3H9N62SZXjmzKoRhMFg3I17TK3oMaAEr+XFbRirWS2Fn3BCPSg==", "dev": true, "dependencies": { "ansi-styles": "^6.2.1", @@ -5153,7 +5189,7 @@ "memorystream": "^0.3.1", "minimatch": "^9.0.0", "pidtree": "^0.6.0", - "read-pkg": "^8.0.0", + "read-package-json-fast": "^3.0.2", "shell-quote": "^1.7.3" }, "bin": { @@ -5228,14 +5264,15 @@ } }, "node_modules/object.fromentries": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", - "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -5245,26 +5282,28 @@ } }, "node_modules/object.groupby": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", - "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/object.values": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", - "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", + "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -5527,6 +5566,15 @@ "node": ">=8" } }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -5537,9 +5585,9 @@ } }, "node_modules/prettier": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", - "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -5600,9 +5648,9 @@ } }, "node_modules/pure-rand": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.4.tgz", - "integrity": "sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", "dev": true, "funding": [ { @@ -5641,25 +5689,20 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, - "node_modules/read-pkg": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-8.1.0.tgz", - "integrity": "sha512-PORM8AgzXeskHO/WEv312k9U03B8K9JSiWF/8N9sUuFjBa+9SF2u6K7VClzXwDXab51jCd8Nd36CNM+zR97ScQ==", + "node_modules/read-package-json-fast": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-3.0.2.tgz", + "integrity": "sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==", "dev": true, "dependencies": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^6.0.0", - "parse-json": "^7.0.0", - "type-fest": "^4.2.0" + "json-parse-even-better-errors": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" }, "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/read-pkg/node_modules/json-parse-even-better-errors": { + "node_modules/read-package-json-fast/node_modules/json-parse-even-better-errors": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.1.tgz", "integrity": "sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==", @@ -5668,67 +5711,16 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/read-pkg/node_modules/lines-and-columns": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.4.tgz", - "integrity": "sha512-wM1+Z03eypVAVUCE7QdSqpVIvelbOakn1M0bPDoA4SGWPx3sNDVUiMo3L6To6WWGClB7VyXnhQ4Sn7gxiJbE6A==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/read-pkg/node_modules/parse-json": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-7.1.1.tgz", - "integrity": "sha512-SgOTCX/EZXtZxBE5eJ97P4yGM5n37BwRU+YMsH4vNzFqJV/oWFXXCmwFlgWUM4PrakybVOueJJ6pwHqSVhTFDw==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.21.4", - "error-ex": "^1.3.2", - "json-parse-even-better-errors": "^3.0.0", - "lines-and-columns": "^2.0.3", - "type-fest": "^3.8.0" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg/node_modules/parse-json/node_modules/type-fest": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", - "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", - "dev": true, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg/node_modules/type-fest": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.9.0.tgz", - "integrity": "sha512-KS/6lh/ynPGiHD/LnAobrEFq3Ad4pBzOlJ1wAnJx9N4EYoqFhMfLIBjUT2UEx4wg5ZE+cC1ob6DCSpppVo+rtg==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/regexp.prototype.flags": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", - "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", + "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "set-function-name": "^2.0.0" + "call-bind": "^1.0.6", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "set-function-name": "^2.0.1" }, "engines": { "node": ">= 0.4" @@ -5860,13 +5852,13 @@ } }, "node_modules/safe-array-concat": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.0.tgz", - "integrity": "sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", "dev": true, "dependencies": { - "call-bind": "^1.0.5", - "get-intrinsic": "^1.2.2", + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", "has-symbols": "^1.0.3", "isarray": "^2.0.5" }, @@ -5878,13 +5870,13 @@ } }, "node_modules/safe-regex-test": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.2.tgz", - "integrity": "sha512-83S9w6eFq12BBIJYvjMux6/dkirb8+4zJRA9cxNBVb7Wq5fJBW+Xze48WqR8pxua7bDuAaaAxtVVd4Idjp1dBQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", + "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", "dev": true, "dependencies": { - "call-bind": "^1.0.5", - "get-intrinsic": "^1.2.2", + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", "is-regex": "^1.1.4" }, "engines": { @@ -5895,9 +5887,9 @@ } }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -5928,30 +5920,32 @@ "dev": true }, "node_modules/set-function-length": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", - "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "dev": true, "dependencies": { - "define-data-property": "^1.1.1", + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.2", + "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.1" + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" } }, "node_modules/set-function-name": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", - "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", "dev": true, "dependencies": { - "define-data-property": "^1.0.1", + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.0" + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -5988,14 +5982,18 @@ } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6008,9 +6006,9 @@ "dev": true }, "node_modules/simple-git": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.22.0.tgz", - "integrity": "sha512-6JujwSs0ac82jkGjMHiCnTifvf1crOiY/+tfs/Pqih6iow7VrpNKRRNdWm6RtaXpvvv/JGNYhlUtLhGFqHF+Yw==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.24.0.tgz", + "integrity": "sha512-QqAKee9Twv+3k8IFOFfPB2hnk6as6Y6ACUpwCtQvRYBAes23Wv3SZlHVobAzqcE8gfsisCvPw3HGW3HYM+VYYw==", "dependencies": { "@kwsites/file-exists": "^1.1.1", "@kwsites/promise-deferred": "^1.1.1", @@ -6055,38 +6053,6 @@ "source-map": "^0.6.0" } }, - "node_modules/spdx-correct": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", - "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", - "dev": true, - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.16", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.16.tgz", - "integrity": "sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==", - "dev": true - }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -6142,14 +6108,15 @@ } }, "node_modules/string.prototype.trim": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", - "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -6159,28 +6126,31 @@ } }, "node_modules/string.prototype.trimend": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", - "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", - "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6330,21 +6300,21 @@ } }, "node_modules/ts-api-utils": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", - "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", "dev": true, "engines": { - "node": ">=16.13.0" + "node": ">=16" }, "peerDependencies": { "typescript": ">=4.2.0" } }, "node_modules/ts-jest": { - "version": "29.1.1", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", - "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", + "version": "29.1.2", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", + "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", "dev": true, "dependencies": { "bs-logger": "0.x", @@ -6360,7 +6330,7 @@ "ts-jest": "cli.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.0.0 || >=20.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", @@ -6480,29 +6450,30 @@ } }, "node_modules/typed-array-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", - "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", - "is-typed-array": "^1.1.10" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.13" }, "engines": { "node": ">= 0.4" } }, "node_modules/typed-array-byte-length": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", - "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", + "call-bind": "^1.0.7", "for-each": "^0.3.3", - "has-proto": "^1.0.1", - "is-typed-array": "^1.1.10" + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" }, "engines": { "node": ">= 0.4" @@ -6512,16 +6483,17 @@ } }, "node_modules/typed-array-byte-offset": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", - "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", "dev": true, "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", "for-each": "^0.3.3", - "has-proto": "^1.0.1", - "is-typed-array": "^1.1.10" + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" }, "engines": { "node": ">= 0.4" @@ -6531,23 +6503,29 @@ } }, "node_modules/typed-array-length": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", - "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", + "call-bind": "^1.0.7", "for-each": "^0.3.3", - "is-typed-array": "^1.1.9" + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", + "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -6573,9 +6551,9 @@ } }, "node_modules/undici": { - "version": "5.28.2", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz", - "integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==", + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", "dependencies": { "@fastify/busboy": "^2.0.0" }, @@ -6655,16 +6633,6 @@ "node": ">=10.12.0" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -6706,16 +6674,16 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", - "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", "dev": true, "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" diff --git a/test/validator.test.ts b/test/validator.test.ts index ad15628..a1af03a 100644 --- a/test/validator.test.ts +++ b/test/validator.test.ts @@ -143,6 +143,7 @@ describe("Validate valid Pull Request vs Commits", () => { commits: [ ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat: add new feature" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore(deps-dev): update dependencies" }), ], error: true, }, @@ -152,6 +153,7 @@ describe("Validate valid Pull Request vs Commits", () => { commits: [ ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat!: add new feature" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore(deps-dev): update dependencies" }), ], error: false, }, @@ -179,6 +181,7 @@ describe("Validate valid Pull Request vs Commits", () => { commits: [ ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "feat!: add new feature" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore(deps-dev): update dependencies" }), ], error: false, }, @@ -206,6 +209,7 @@ describe("Validate valid Pull Request vs Commits", () => { commits: [ ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "fix: fixed a bug" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore(deps-dev): update dependencies" }), ], error: false, }, @@ -215,6 +219,7 @@ describe("Validate valid Pull Request vs Commits", () => { commits: [ ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore: silly change" }), ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "fix: fixed a bug" }), + ConventionalCommit.fromString({ hash: "0a0b0c0d", message: "chore(deps-dev): update dependencies" }), ], error: false, }, From ee548476f93faa57a8af7ad1ca218a14ba863c31 Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Tue, 9 Apr 2024 10:01:11 +0200 Subject: [PATCH 15/22] chore: add additional accepted Conventional Commit scopes --- .github/.commit-me.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/.commit-me.json b/.github/.commit-me.json index 153f824..08b04c9 100644 --- a/.github/.commit-me.json +++ b/.github/.commit-me.json @@ -1,4 +1,4 @@ { "types": [ "build", "chore", "ci", "docs", "style", "refactor", "perf", "test" ], - "scopes": [ "cli", "precommit", "action", "deps" ] + "scopes": [ "cli", "precommit", "action", "deps", "dev-deps", "security" ] } From 56a8b6c307c12c5597618372a2635e5c6a759a1d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Apr 2024 17:41:06 +0000 Subject: [PATCH 16/22] fix(security): bump undici from 5.28.3 to 5.28.4 Bumps [undici](https://github.com/nodejs/undici) from 5.28.3 to 5.28.4. - [Release notes](https://github.com/nodejs/undici/releases) - [Commits](https://github.com/nodejs/undici/compare/v5.28.3...v5.28.4) Addresses the following CVEs: - CVE-2024-30260 - CVE-2024-30261 --- updated-dependencies: - dependency-name: undici dependency-type: indirect ... Signed-off-by: dependabot[bot] --- lib/action/index.js | 297 +++++++++++++++++++++++++++++++++++------ lib/cli/index.js | 297 +++++++++++++++++++++++++++++++++++------ lib/precommit/index.js | 297 +++++++++++++++++++++++++++++++++++------ package-lock.json | 6 +- 4 files changed, 771 insertions(+), 126 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index 3dd1620..4b575c6 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -25650,6 +25650,132 @@ function onConnectTimeout (socket) { module.exports = buildConnector +/***/ }), + +/***/ 4462: +/***/ ((module) => { + +"use strict"; + + +/** @type {Record} */ +const headerNameLowerCasedRecord = {} + +// https://developer.mozilla.org/docs/Web/HTTP/Headers +const wellknownHeaderNames = [ + 'Accept', + 'Accept-Encoding', + 'Accept-Language', + 'Accept-Ranges', + 'Access-Control-Allow-Credentials', + 'Access-Control-Allow-Headers', + 'Access-Control-Allow-Methods', + 'Access-Control-Allow-Origin', + 'Access-Control-Expose-Headers', + 'Access-Control-Max-Age', + 'Access-Control-Request-Headers', + 'Access-Control-Request-Method', + 'Age', + 'Allow', + 'Alt-Svc', + 'Alt-Used', + 'Authorization', + 'Cache-Control', + 'Clear-Site-Data', + 'Connection', + 'Content-Disposition', + 'Content-Encoding', + 'Content-Language', + 'Content-Length', + 'Content-Location', + 'Content-Range', + 'Content-Security-Policy', + 'Content-Security-Policy-Report-Only', + 'Content-Type', + 'Cookie', + 'Cross-Origin-Embedder-Policy', + 'Cross-Origin-Opener-Policy', + 'Cross-Origin-Resource-Policy', + 'Date', + 'Device-Memory', + 'Downlink', + 'ECT', + 'ETag', + 'Expect', + 'Expect-CT', + 'Expires', + 'Forwarded', + 'From', + 'Host', + 'If-Match', + 'If-Modified-Since', + 'If-None-Match', + 'If-Range', + 'If-Unmodified-Since', + 'Keep-Alive', + 'Last-Modified', + 'Link', + 'Location', + 'Max-Forwards', + 'Origin', + 'Permissions-Policy', + 'Pragma', + 'Proxy-Authenticate', + 'Proxy-Authorization', + 'RTT', + 'Range', + 'Referer', + 'Referrer-Policy', + 'Refresh', + 'Retry-After', + 'Sec-WebSocket-Accept', + 'Sec-WebSocket-Extensions', + 'Sec-WebSocket-Key', + 'Sec-WebSocket-Protocol', + 'Sec-WebSocket-Version', + 'Server', + 'Server-Timing', + 'Service-Worker-Allowed', + 'Service-Worker-Navigation-Preload', + 'Set-Cookie', + 'SourceMap', + 'Strict-Transport-Security', + 'Supports-Loading-Mode', + 'TE', + 'Timing-Allow-Origin', + 'Trailer', + 'Transfer-Encoding', + 'Upgrade', + 'Upgrade-Insecure-Requests', + 'User-Agent', + 'Vary', + 'Via', + 'WWW-Authenticate', + 'X-Content-Type-Options', + 'X-DNS-Prefetch-Control', + 'X-Frame-Options', + 'X-Permitted-Cross-Domain-Policies', + 'X-Powered-By', + 'X-Requested-With', + 'X-XSS-Protection' +] + +for (let i = 0; i < wellknownHeaderNames.length; ++i) { + const key = wellknownHeaderNames[i] + const lowerCasedKey = key.toLowerCase() + headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] = + lowerCasedKey +} + +// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`. +Object.setPrototypeOf(headerNameLowerCasedRecord, null) + +module.exports = { + wellknownHeaderNames, + headerNameLowerCasedRecord +} + + /***/ }), /***/ 8045: @@ -26482,6 +26608,7 @@ const { InvalidArgumentError } = __nccwpck_require__(8045) const { Blob } = __nccwpck_require__(4300) const nodeUtil = __nccwpck_require__(3837) const { stringify } = __nccwpck_require__(3477) +const { headerNameLowerCasedRecord } = __nccwpck_require__(4462) const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) @@ -26691,6 +26818,15 @@ function parseKeepAliveTimeout (val) { return m ? parseInt(m[1], 10) * 1000 : null } +/** + * Retrieves a header name and returns its lowercase value. + * @param {string | Buffer} value Header name + * @returns {string} + */ +function headerNameToString (value) { + return headerNameLowerCasedRecord[value] || value.toLowerCase() +} + function parseHeaders (headers, obj = {}) { // For H2 support if (!Array.isArray(headers)) return headers @@ -26962,6 +27098,7 @@ module.exports = { isIterable, isAsyncIterable, isDestroyed, + headerNameToString, parseRawHeaders, parseHeaders, parseKeepAliveTimeout, @@ -33609,14 +33746,18 @@ const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983 const assert = __nccwpck_require__(9491) const { isUint8Array } = __nccwpck_require__(9830) +let supportedHashes = [] + // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable /** @type {import('crypto')|undefined} */ let crypto try { crypto = __nccwpck_require__(6113) + const possibleRelevantHashes = ['sha256', 'sha384', 'sha512'] + supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)) +/* c8 ignore next 3 */ } catch { - } function responseURL (response) { @@ -34144,66 +34285,56 @@ function bytesMatch (bytes, metadataList) { return true } - // 3. If parsedMetadata is the empty set, return true. + // 3. If response is not eligible for integrity validation, return false. + // TODO + + // 4. If parsedMetadata is the empty set, return true. if (parsedMetadata.length === 0) { return true } - // 4. Let metadata be the result of getting the strongest + // 5. Let metadata be the result of getting the strongest // metadata from parsedMetadata. - const list = parsedMetadata.sort((c, d) => d.algo.localeCompare(c.algo)) - // get the strongest algorithm - const strongest = list[0].algo - // get all entries that use the strongest algorithm; ignore weaker - const metadata = list.filter((item) => item.algo === strongest) + const strongest = getStrongestMetadata(parsedMetadata) + const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest) - // 5. For each item in metadata: + // 6. For each item in metadata: for (const item of metadata) { // 1. Let algorithm be the alg component of item. const algorithm = item.algo // 2. Let expectedValue be the val component of item. - let expectedValue = item.hash + const expectedValue = item.hash // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e // "be liberal with padding". This is annoying, and it's not even in the spec. - if (expectedValue.endsWith('==')) { - expectedValue = expectedValue.slice(0, -2) - } - // 3. Let actualValue be the result of applying algorithm to bytes. let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64') - if (actualValue.endsWith('==')) { - actualValue = actualValue.slice(0, -2) + if (actualValue[actualValue.length - 1] === '=') { + if (actualValue[actualValue.length - 2] === '=') { + actualValue = actualValue.slice(0, -2) + } else { + actualValue = actualValue.slice(0, -1) + } } // 4. If actualValue is a case-sensitive match for expectedValue, // return true. - if (actualValue === expectedValue) { - return true - } - - let actualBase64URL = crypto.createHash(algorithm).update(bytes).digest('base64url') - - if (actualBase64URL.endsWith('==')) { - actualBase64URL = actualBase64URL.slice(0, -2) - } - - if (actualBase64URL === expectedValue) { + if (compareBase64Mixed(actualValue, expectedValue)) { return true } } - // 6. Return false. + // 7. Return false. return false } // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options // https://www.w3.org/TR/CSP2/#source-list-syntax // https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1 -const parseHashWithOptions = /((?sha256|sha384|sha512)-(?[A-z0-9+/]{1}.*={0,2}))( +[\x21-\x7e]?)?/i +const parseHashWithOptions = /(?sha256|sha384|sha512)-((?[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i /** * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata @@ -34217,8 +34348,6 @@ function parseMetadata (metadata) { // 2. Let empty be equal to true. let empty = true - const supportedHashes = crypto.getHashes() - // 3. For each token returned by splitting metadata on spaces: for (const token of metadata.split(' ')) { // 1. Set empty to false. @@ -34228,7 +34357,11 @@ function parseMetadata (metadata) { const parsedToken = parseHashWithOptions.exec(token) // 3. If token does not parse, continue to the next token. - if (parsedToken === null || parsedToken.groups === undefined) { + if ( + parsedToken === null || + parsedToken.groups === undefined || + parsedToken.groups.algo === undefined + ) { // Note: Chromium blocks the request at this point, but Firefox // gives a warning that an invalid integrity was given. The // correct behavior is to ignore these, and subsequently not @@ -34237,11 +34370,11 @@ function parseMetadata (metadata) { } // 4. Let algorithm be the hash-algo component of token. - const algorithm = parsedToken.groups.algo + const algorithm = parsedToken.groups.algo.toLowerCase() // 5. If algorithm is a hash function recognized by the user // agent, add the parsed token to result. - if (supportedHashes.includes(algorithm.toLowerCase())) { + if (supportedHashes.includes(algorithm)) { result.push(parsedToken.groups) } } @@ -34254,6 +34387,82 @@ function parseMetadata (metadata) { return result } +/** + * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList + */ +function getStrongestMetadata (metadataList) { + // Let algorithm be the algo component of the first item in metadataList. + // Can be sha256 + let algorithm = metadataList[0].algo + // If the algorithm is sha512, then it is the strongest + // and we can return immediately + if (algorithm[3] === '5') { + return algorithm + } + + for (let i = 1; i < metadataList.length; ++i) { + const metadata = metadataList[i] + // If the algorithm is sha512, then it is the strongest + // and we can break the loop immediately + if (metadata.algo[3] === '5') { + algorithm = 'sha512' + break + // If the algorithm is sha384, then a potential sha256 or sha384 is ignored + } else if (algorithm[3] === '3') { + continue + // algorithm is sha256, check if algorithm is sha384 and if so, set it as + // the strongest + } else if (metadata.algo[3] === '3') { + algorithm = 'sha384' + } + } + return algorithm +} + +function filterMetadataListByAlgorithm (metadataList, algorithm) { + if (metadataList.length === 1) { + return metadataList + } + + let pos = 0 + for (let i = 0; i < metadataList.length; ++i) { + if (metadataList[i].algo === algorithm) { + metadataList[pos++] = metadataList[i] + } + } + + metadataList.length = pos + + return metadataList +} + +/** + * Compares two base64 strings, allowing for base64url + * in the second string. + * +* @param {string} actualValue always base64 + * @param {string} expectedValue base64 or base64url + * @returns {boolean} + */ +function compareBase64Mixed (actualValue, expectedValue) { + if (actualValue.length !== expectedValue.length) { + return false + } + for (let i = 0; i < actualValue.length; ++i) { + if (actualValue[i] !== expectedValue[i]) { + if ( + (actualValue[i] === '+' && expectedValue[i] === '-') || + (actualValue[i] === '/' && expectedValue[i] === '_') + ) { + continue + } + return false + } + } + + return true +} + // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) { // TODO @@ -34669,7 +34878,8 @@ module.exports = { urlHasHttpsScheme, urlIsHttpHttpsScheme, readAllBytes, - normalizeMethodRecord + normalizeMethodRecord, + parseMetadata } @@ -36756,12 +36966,17 @@ function parseLocation (statusCode, headers) { // https://tools.ietf.org/html/rfc7231#section-6.4.4 function shouldRemoveHeader (header, removeContent, unknownOrigin) { - return ( - (header.length === 4 && header.toString().toLowerCase() === 'host') || - (removeContent && header.toString().toLowerCase().indexOf('content-') === 0) || - (unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') || - (unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie') - ) + if (header.length === 4) { + return util.headerNameToString(header) === 'host' + } + if (removeContent && util.headerNameToString(header).startsWith('content-')) { + return true + } + if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) { + const name = util.headerNameToString(header) + return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization' + } + return false } // https://tools.ietf.org/html/rfc7231#section-6.4 diff --git a/lib/cli/index.js b/lib/cli/index.js index be5b8ba..fe8a2cb 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -25651,6 +25651,132 @@ function onConnectTimeout (socket) { module.exports = buildConnector +/***/ }), + +/***/ 4462: +/***/ ((module) => { + +"use strict"; + + +/** @type {Record} */ +const headerNameLowerCasedRecord = {} + +// https://developer.mozilla.org/docs/Web/HTTP/Headers +const wellknownHeaderNames = [ + 'Accept', + 'Accept-Encoding', + 'Accept-Language', + 'Accept-Ranges', + 'Access-Control-Allow-Credentials', + 'Access-Control-Allow-Headers', + 'Access-Control-Allow-Methods', + 'Access-Control-Allow-Origin', + 'Access-Control-Expose-Headers', + 'Access-Control-Max-Age', + 'Access-Control-Request-Headers', + 'Access-Control-Request-Method', + 'Age', + 'Allow', + 'Alt-Svc', + 'Alt-Used', + 'Authorization', + 'Cache-Control', + 'Clear-Site-Data', + 'Connection', + 'Content-Disposition', + 'Content-Encoding', + 'Content-Language', + 'Content-Length', + 'Content-Location', + 'Content-Range', + 'Content-Security-Policy', + 'Content-Security-Policy-Report-Only', + 'Content-Type', + 'Cookie', + 'Cross-Origin-Embedder-Policy', + 'Cross-Origin-Opener-Policy', + 'Cross-Origin-Resource-Policy', + 'Date', + 'Device-Memory', + 'Downlink', + 'ECT', + 'ETag', + 'Expect', + 'Expect-CT', + 'Expires', + 'Forwarded', + 'From', + 'Host', + 'If-Match', + 'If-Modified-Since', + 'If-None-Match', + 'If-Range', + 'If-Unmodified-Since', + 'Keep-Alive', + 'Last-Modified', + 'Link', + 'Location', + 'Max-Forwards', + 'Origin', + 'Permissions-Policy', + 'Pragma', + 'Proxy-Authenticate', + 'Proxy-Authorization', + 'RTT', + 'Range', + 'Referer', + 'Referrer-Policy', + 'Refresh', + 'Retry-After', + 'Sec-WebSocket-Accept', + 'Sec-WebSocket-Extensions', + 'Sec-WebSocket-Key', + 'Sec-WebSocket-Protocol', + 'Sec-WebSocket-Version', + 'Server', + 'Server-Timing', + 'Service-Worker-Allowed', + 'Service-Worker-Navigation-Preload', + 'Set-Cookie', + 'SourceMap', + 'Strict-Transport-Security', + 'Supports-Loading-Mode', + 'TE', + 'Timing-Allow-Origin', + 'Trailer', + 'Transfer-Encoding', + 'Upgrade', + 'Upgrade-Insecure-Requests', + 'User-Agent', + 'Vary', + 'Via', + 'WWW-Authenticate', + 'X-Content-Type-Options', + 'X-DNS-Prefetch-Control', + 'X-Frame-Options', + 'X-Permitted-Cross-Domain-Policies', + 'X-Powered-By', + 'X-Requested-With', + 'X-XSS-Protection' +] + +for (let i = 0; i < wellknownHeaderNames.length; ++i) { + const key = wellknownHeaderNames[i] + const lowerCasedKey = key.toLowerCase() + headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] = + lowerCasedKey +} + +// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`. +Object.setPrototypeOf(headerNameLowerCasedRecord, null) + +module.exports = { + wellknownHeaderNames, + headerNameLowerCasedRecord +} + + /***/ }), /***/ 8045: @@ -26483,6 +26609,7 @@ const { InvalidArgumentError } = __nccwpck_require__(8045) const { Blob } = __nccwpck_require__(4300) const nodeUtil = __nccwpck_require__(3837) const { stringify } = __nccwpck_require__(3477) +const { headerNameLowerCasedRecord } = __nccwpck_require__(4462) const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) @@ -26692,6 +26819,15 @@ function parseKeepAliveTimeout (val) { return m ? parseInt(m[1], 10) * 1000 : null } +/** + * Retrieves a header name and returns its lowercase value. + * @param {string | Buffer} value Header name + * @returns {string} + */ +function headerNameToString (value) { + return headerNameLowerCasedRecord[value] || value.toLowerCase() +} + function parseHeaders (headers, obj = {}) { // For H2 support if (!Array.isArray(headers)) return headers @@ -26963,6 +27099,7 @@ module.exports = { isIterable, isAsyncIterable, isDestroyed, + headerNameToString, parseRawHeaders, parseHeaders, parseKeepAliveTimeout, @@ -33610,14 +33747,18 @@ const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983 const assert = __nccwpck_require__(9491) const { isUint8Array } = __nccwpck_require__(9830) +let supportedHashes = [] + // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable /** @type {import('crypto')|undefined} */ let crypto try { crypto = __nccwpck_require__(6113) + const possibleRelevantHashes = ['sha256', 'sha384', 'sha512'] + supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)) +/* c8 ignore next 3 */ } catch { - } function responseURL (response) { @@ -34145,66 +34286,56 @@ function bytesMatch (bytes, metadataList) { return true } - // 3. If parsedMetadata is the empty set, return true. + // 3. If response is not eligible for integrity validation, return false. + // TODO + + // 4. If parsedMetadata is the empty set, return true. if (parsedMetadata.length === 0) { return true } - // 4. Let metadata be the result of getting the strongest + // 5. Let metadata be the result of getting the strongest // metadata from parsedMetadata. - const list = parsedMetadata.sort((c, d) => d.algo.localeCompare(c.algo)) - // get the strongest algorithm - const strongest = list[0].algo - // get all entries that use the strongest algorithm; ignore weaker - const metadata = list.filter((item) => item.algo === strongest) + const strongest = getStrongestMetadata(parsedMetadata) + const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest) - // 5. For each item in metadata: + // 6. For each item in metadata: for (const item of metadata) { // 1. Let algorithm be the alg component of item. const algorithm = item.algo // 2. Let expectedValue be the val component of item. - let expectedValue = item.hash + const expectedValue = item.hash // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e // "be liberal with padding". This is annoying, and it's not even in the spec. - if (expectedValue.endsWith('==')) { - expectedValue = expectedValue.slice(0, -2) - } - // 3. Let actualValue be the result of applying algorithm to bytes. let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64') - if (actualValue.endsWith('==')) { - actualValue = actualValue.slice(0, -2) + if (actualValue[actualValue.length - 1] === '=') { + if (actualValue[actualValue.length - 2] === '=') { + actualValue = actualValue.slice(0, -2) + } else { + actualValue = actualValue.slice(0, -1) + } } // 4. If actualValue is a case-sensitive match for expectedValue, // return true. - if (actualValue === expectedValue) { - return true - } - - let actualBase64URL = crypto.createHash(algorithm).update(bytes).digest('base64url') - - if (actualBase64URL.endsWith('==')) { - actualBase64URL = actualBase64URL.slice(0, -2) - } - - if (actualBase64URL === expectedValue) { + if (compareBase64Mixed(actualValue, expectedValue)) { return true } } - // 6. Return false. + // 7. Return false. return false } // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options // https://www.w3.org/TR/CSP2/#source-list-syntax // https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1 -const parseHashWithOptions = /((?sha256|sha384|sha512)-(?[A-z0-9+/]{1}.*={0,2}))( +[\x21-\x7e]?)?/i +const parseHashWithOptions = /(?sha256|sha384|sha512)-((?[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i /** * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata @@ -34218,8 +34349,6 @@ function parseMetadata (metadata) { // 2. Let empty be equal to true. let empty = true - const supportedHashes = crypto.getHashes() - // 3. For each token returned by splitting metadata on spaces: for (const token of metadata.split(' ')) { // 1. Set empty to false. @@ -34229,7 +34358,11 @@ function parseMetadata (metadata) { const parsedToken = parseHashWithOptions.exec(token) // 3. If token does not parse, continue to the next token. - if (parsedToken === null || parsedToken.groups === undefined) { + if ( + parsedToken === null || + parsedToken.groups === undefined || + parsedToken.groups.algo === undefined + ) { // Note: Chromium blocks the request at this point, but Firefox // gives a warning that an invalid integrity was given. The // correct behavior is to ignore these, and subsequently not @@ -34238,11 +34371,11 @@ function parseMetadata (metadata) { } // 4. Let algorithm be the hash-algo component of token. - const algorithm = parsedToken.groups.algo + const algorithm = parsedToken.groups.algo.toLowerCase() // 5. If algorithm is a hash function recognized by the user // agent, add the parsed token to result. - if (supportedHashes.includes(algorithm.toLowerCase())) { + if (supportedHashes.includes(algorithm)) { result.push(parsedToken.groups) } } @@ -34255,6 +34388,82 @@ function parseMetadata (metadata) { return result } +/** + * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList + */ +function getStrongestMetadata (metadataList) { + // Let algorithm be the algo component of the first item in metadataList. + // Can be sha256 + let algorithm = metadataList[0].algo + // If the algorithm is sha512, then it is the strongest + // and we can return immediately + if (algorithm[3] === '5') { + return algorithm + } + + for (let i = 1; i < metadataList.length; ++i) { + const metadata = metadataList[i] + // If the algorithm is sha512, then it is the strongest + // and we can break the loop immediately + if (metadata.algo[3] === '5') { + algorithm = 'sha512' + break + // If the algorithm is sha384, then a potential sha256 or sha384 is ignored + } else if (algorithm[3] === '3') { + continue + // algorithm is sha256, check if algorithm is sha384 and if so, set it as + // the strongest + } else if (metadata.algo[3] === '3') { + algorithm = 'sha384' + } + } + return algorithm +} + +function filterMetadataListByAlgorithm (metadataList, algorithm) { + if (metadataList.length === 1) { + return metadataList + } + + let pos = 0 + for (let i = 0; i < metadataList.length; ++i) { + if (metadataList[i].algo === algorithm) { + metadataList[pos++] = metadataList[i] + } + } + + metadataList.length = pos + + return metadataList +} + +/** + * Compares two base64 strings, allowing for base64url + * in the second string. + * +* @param {string} actualValue always base64 + * @param {string} expectedValue base64 or base64url + * @returns {boolean} + */ +function compareBase64Mixed (actualValue, expectedValue) { + if (actualValue.length !== expectedValue.length) { + return false + } + for (let i = 0; i < actualValue.length; ++i) { + if (actualValue[i] !== expectedValue[i]) { + if ( + (actualValue[i] === '+' && expectedValue[i] === '-') || + (actualValue[i] === '/' && expectedValue[i] === '_') + ) { + continue + } + return false + } + } + + return true +} + // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) { // TODO @@ -34670,7 +34879,8 @@ module.exports = { urlHasHttpsScheme, urlIsHttpHttpsScheme, readAllBytes, - normalizeMethodRecord + normalizeMethodRecord, + parseMetadata } @@ -36757,12 +36967,17 @@ function parseLocation (statusCode, headers) { // https://tools.ietf.org/html/rfc7231#section-6.4.4 function shouldRemoveHeader (header, removeContent, unknownOrigin) { - return ( - (header.length === 4 && header.toString().toLowerCase() === 'host') || - (removeContent && header.toString().toLowerCase().indexOf('content-') === 0) || - (unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') || - (unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie') - ) + if (header.length === 4) { + return util.headerNameToString(header) === 'host' + } + if (removeContent && util.headerNameToString(header).startsWith('content-')) { + return true + } + if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) { + const name = util.headerNameToString(header) + return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization' + } + return false } // https://tools.ietf.org/html/rfc7231#section-6.4 diff --git a/lib/precommit/index.js b/lib/precommit/index.js index 20cd587..d9cec2b 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -25651,6 +25651,132 @@ function onConnectTimeout (socket) { module.exports = buildConnector +/***/ }), + +/***/ 4462: +/***/ ((module) => { + +"use strict"; + + +/** @type {Record} */ +const headerNameLowerCasedRecord = {} + +// https://developer.mozilla.org/docs/Web/HTTP/Headers +const wellknownHeaderNames = [ + 'Accept', + 'Accept-Encoding', + 'Accept-Language', + 'Accept-Ranges', + 'Access-Control-Allow-Credentials', + 'Access-Control-Allow-Headers', + 'Access-Control-Allow-Methods', + 'Access-Control-Allow-Origin', + 'Access-Control-Expose-Headers', + 'Access-Control-Max-Age', + 'Access-Control-Request-Headers', + 'Access-Control-Request-Method', + 'Age', + 'Allow', + 'Alt-Svc', + 'Alt-Used', + 'Authorization', + 'Cache-Control', + 'Clear-Site-Data', + 'Connection', + 'Content-Disposition', + 'Content-Encoding', + 'Content-Language', + 'Content-Length', + 'Content-Location', + 'Content-Range', + 'Content-Security-Policy', + 'Content-Security-Policy-Report-Only', + 'Content-Type', + 'Cookie', + 'Cross-Origin-Embedder-Policy', + 'Cross-Origin-Opener-Policy', + 'Cross-Origin-Resource-Policy', + 'Date', + 'Device-Memory', + 'Downlink', + 'ECT', + 'ETag', + 'Expect', + 'Expect-CT', + 'Expires', + 'Forwarded', + 'From', + 'Host', + 'If-Match', + 'If-Modified-Since', + 'If-None-Match', + 'If-Range', + 'If-Unmodified-Since', + 'Keep-Alive', + 'Last-Modified', + 'Link', + 'Location', + 'Max-Forwards', + 'Origin', + 'Permissions-Policy', + 'Pragma', + 'Proxy-Authenticate', + 'Proxy-Authorization', + 'RTT', + 'Range', + 'Referer', + 'Referrer-Policy', + 'Refresh', + 'Retry-After', + 'Sec-WebSocket-Accept', + 'Sec-WebSocket-Extensions', + 'Sec-WebSocket-Key', + 'Sec-WebSocket-Protocol', + 'Sec-WebSocket-Version', + 'Server', + 'Server-Timing', + 'Service-Worker-Allowed', + 'Service-Worker-Navigation-Preload', + 'Set-Cookie', + 'SourceMap', + 'Strict-Transport-Security', + 'Supports-Loading-Mode', + 'TE', + 'Timing-Allow-Origin', + 'Trailer', + 'Transfer-Encoding', + 'Upgrade', + 'Upgrade-Insecure-Requests', + 'User-Agent', + 'Vary', + 'Via', + 'WWW-Authenticate', + 'X-Content-Type-Options', + 'X-DNS-Prefetch-Control', + 'X-Frame-Options', + 'X-Permitted-Cross-Domain-Policies', + 'X-Powered-By', + 'X-Requested-With', + 'X-XSS-Protection' +] + +for (let i = 0; i < wellknownHeaderNames.length; ++i) { + const key = wellknownHeaderNames[i] + const lowerCasedKey = key.toLowerCase() + headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] = + lowerCasedKey +} + +// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`. +Object.setPrototypeOf(headerNameLowerCasedRecord, null) + +module.exports = { + wellknownHeaderNames, + headerNameLowerCasedRecord +} + + /***/ }), /***/ 8045: @@ -26483,6 +26609,7 @@ const { InvalidArgumentError } = __nccwpck_require__(8045) const { Blob } = __nccwpck_require__(4300) const nodeUtil = __nccwpck_require__(3837) const { stringify } = __nccwpck_require__(3477) +const { headerNameLowerCasedRecord } = __nccwpck_require__(4462) const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) @@ -26692,6 +26819,15 @@ function parseKeepAliveTimeout (val) { return m ? parseInt(m[1], 10) * 1000 : null } +/** + * Retrieves a header name and returns its lowercase value. + * @param {string | Buffer} value Header name + * @returns {string} + */ +function headerNameToString (value) { + return headerNameLowerCasedRecord[value] || value.toLowerCase() +} + function parseHeaders (headers, obj = {}) { // For H2 support if (!Array.isArray(headers)) return headers @@ -26963,6 +27099,7 @@ module.exports = { isIterable, isAsyncIterable, isDestroyed, + headerNameToString, parseRawHeaders, parseHeaders, parseKeepAliveTimeout, @@ -33610,14 +33747,18 @@ const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983 const assert = __nccwpck_require__(9491) const { isUint8Array } = __nccwpck_require__(9830) +let supportedHashes = [] + // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable /** @type {import('crypto')|undefined} */ let crypto try { crypto = __nccwpck_require__(6113) + const possibleRelevantHashes = ['sha256', 'sha384', 'sha512'] + supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)) +/* c8 ignore next 3 */ } catch { - } function responseURL (response) { @@ -34145,66 +34286,56 @@ function bytesMatch (bytes, metadataList) { return true } - // 3. If parsedMetadata is the empty set, return true. + // 3. If response is not eligible for integrity validation, return false. + // TODO + + // 4. If parsedMetadata is the empty set, return true. if (parsedMetadata.length === 0) { return true } - // 4. Let metadata be the result of getting the strongest + // 5. Let metadata be the result of getting the strongest // metadata from parsedMetadata. - const list = parsedMetadata.sort((c, d) => d.algo.localeCompare(c.algo)) - // get the strongest algorithm - const strongest = list[0].algo - // get all entries that use the strongest algorithm; ignore weaker - const metadata = list.filter((item) => item.algo === strongest) + const strongest = getStrongestMetadata(parsedMetadata) + const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest) - // 5. For each item in metadata: + // 6. For each item in metadata: for (const item of metadata) { // 1. Let algorithm be the alg component of item. const algorithm = item.algo // 2. Let expectedValue be the val component of item. - let expectedValue = item.hash + const expectedValue = item.hash // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e // "be liberal with padding". This is annoying, and it's not even in the spec. - if (expectedValue.endsWith('==')) { - expectedValue = expectedValue.slice(0, -2) - } - // 3. Let actualValue be the result of applying algorithm to bytes. let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64') - if (actualValue.endsWith('==')) { - actualValue = actualValue.slice(0, -2) + if (actualValue[actualValue.length - 1] === '=') { + if (actualValue[actualValue.length - 2] === '=') { + actualValue = actualValue.slice(0, -2) + } else { + actualValue = actualValue.slice(0, -1) + } } // 4. If actualValue is a case-sensitive match for expectedValue, // return true. - if (actualValue === expectedValue) { - return true - } - - let actualBase64URL = crypto.createHash(algorithm).update(bytes).digest('base64url') - - if (actualBase64URL.endsWith('==')) { - actualBase64URL = actualBase64URL.slice(0, -2) - } - - if (actualBase64URL === expectedValue) { + if (compareBase64Mixed(actualValue, expectedValue)) { return true } } - // 6. Return false. + // 7. Return false. return false } // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options // https://www.w3.org/TR/CSP2/#source-list-syntax // https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1 -const parseHashWithOptions = /((?sha256|sha384|sha512)-(?[A-z0-9+/]{1}.*={0,2}))( +[\x21-\x7e]?)?/i +const parseHashWithOptions = /(?sha256|sha384|sha512)-((?[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i /** * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata @@ -34218,8 +34349,6 @@ function parseMetadata (metadata) { // 2. Let empty be equal to true. let empty = true - const supportedHashes = crypto.getHashes() - // 3. For each token returned by splitting metadata on spaces: for (const token of metadata.split(' ')) { // 1. Set empty to false. @@ -34229,7 +34358,11 @@ function parseMetadata (metadata) { const parsedToken = parseHashWithOptions.exec(token) // 3. If token does not parse, continue to the next token. - if (parsedToken === null || parsedToken.groups === undefined) { + if ( + parsedToken === null || + parsedToken.groups === undefined || + parsedToken.groups.algo === undefined + ) { // Note: Chromium blocks the request at this point, but Firefox // gives a warning that an invalid integrity was given. The // correct behavior is to ignore these, and subsequently not @@ -34238,11 +34371,11 @@ function parseMetadata (metadata) { } // 4. Let algorithm be the hash-algo component of token. - const algorithm = parsedToken.groups.algo + const algorithm = parsedToken.groups.algo.toLowerCase() // 5. If algorithm is a hash function recognized by the user // agent, add the parsed token to result. - if (supportedHashes.includes(algorithm.toLowerCase())) { + if (supportedHashes.includes(algorithm)) { result.push(parsedToken.groups) } } @@ -34255,6 +34388,82 @@ function parseMetadata (metadata) { return result } +/** + * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList + */ +function getStrongestMetadata (metadataList) { + // Let algorithm be the algo component of the first item in metadataList. + // Can be sha256 + let algorithm = metadataList[0].algo + // If the algorithm is sha512, then it is the strongest + // and we can return immediately + if (algorithm[3] === '5') { + return algorithm + } + + for (let i = 1; i < metadataList.length; ++i) { + const metadata = metadataList[i] + // If the algorithm is sha512, then it is the strongest + // and we can break the loop immediately + if (metadata.algo[3] === '5') { + algorithm = 'sha512' + break + // If the algorithm is sha384, then a potential sha256 or sha384 is ignored + } else if (algorithm[3] === '3') { + continue + // algorithm is sha256, check if algorithm is sha384 and if so, set it as + // the strongest + } else if (metadata.algo[3] === '3') { + algorithm = 'sha384' + } + } + return algorithm +} + +function filterMetadataListByAlgorithm (metadataList, algorithm) { + if (metadataList.length === 1) { + return metadataList + } + + let pos = 0 + for (let i = 0; i < metadataList.length; ++i) { + if (metadataList[i].algo === algorithm) { + metadataList[pos++] = metadataList[i] + } + } + + metadataList.length = pos + + return metadataList +} + +/** + * Compares two base64 strings, allowing for base64url + * in the second string. + * +* @param {string} actualValue always base64 + * @param {string} expectedValue base64 or base64url + * @returns {boolean} + */ +function compareBase64Mixed (actualValue, expectedValue) { + if (actualValue.length !== expectedValue.length) { + return false + } + for (let i = 0; i < actualValue.length; ++i) { + if (actualValue[i] !== expectedValue[i]) { + if ( + (actualValue[i] === '+' && expectedValue[i] === '-') || + (actualValue[i] === '/' && expectedValue[i] === '_') + ) { + continue + } + return false + } + } + + return true +} + // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) { // TODO @@ -34670,7 +34879,8 @@ module.exports = { urlHasHttpsScheme, urlIsHttpHttpsScheme, readAllBytes, - normalizeMethodRecord + normalizeMethodRecord, + parseMetadata } @@ -36757,12 +36967,17 @@ function parseLocation (statusCode, headers) { // https://tools.ietf.org/html/rfc7231#section-6.4.4 function shouldRemoveHeader (header, removeContent, unknownOrigin) { - return ( - (header.length === 4 && header.toString().toLowerCase() === 'host') || - (removeContent && header.toString().toLowerCase().indexOf('content-') === 0) || - (unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') || - (unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie') - ) + if (header.length === 4) { + return util.headerNameToString(header) === 'host' + } + if (removeContent && util.headerNameToString(header).startsWith('content-')) { + return true + } + if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) { + const name = util.headerNameToString(header) + return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization' + } + return false } // https://tools.ietf.org/html/rfc7231#section-6.4 diff --git a/package-lock.json b/package-lock.json index ba557b0..5a46c74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6551,9 +6551,9 @@ } }, "node_modules/undici": { - "version": "5.28.3", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", - "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", "dependencies": { "@fastify/busboy": "^2.0.0" }, From 1a8ee6833ee25341a8ec37647f07eda98e3d7dcd Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Wed, 10 Apr 2024 14:14:31 +0200 Subject: [PATCH 17/22] fix: improve error handling for missing content Use proper type handling for Request Errors provided by Octokit requests. --- lib/action/index.js | 10 +++++++--- lib/cli/index.js | 10 +++++++--- lib/precommit/index.js | 10 +++++++--- src/datasources.ts | 10 +++++++--- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index 4b575c6..f3ddbdf 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -42372,6 +42372,7 @@ const assert_1 = __importDefault(__nccwpck_require__(9491)); const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); const github = __importStar(__nccwpck_require__(5438)); +const request_error_1 = __nccwpck_require__(537); const commit_it_1 = __nccwpck_require__(9403); const simple_git_1 = __nccwpck_require__(9103); /** @@ -42448,10 +42449,13 @@ class GitHubSource { return Buffer.from(config.content, "base64").toString(); } catch (error) { - if (error.message !== "Not Found") { - throw error; + if (error instanceof request_error_1.RequestError && error.response) { + const reponseData = error.response.data; + if ("message" in reponseData && reponseData.message === "Not Found") { + return undefined; + } } - return undefined; + throw error; } } } diff --git a/lib/cli/index.js b/lib/cli/index.js index fe8a2cb..96135cc 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -42373,6 +42373,7 @@ const assert_1 = __importDefault(__nccwpck_require__(9491)); const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); const github = __importStar(__nccwpck_require__(5438)); +const request_error_1 = __nccwpck_require__(537); const commit_it_1 = __nccwpck_require__(9403); const simple_git_1 = __nccwpck_require__(9103); /** @@ -42449,10 +42450,13 @@ class GitHubSource { return Buffer.from(config.content, "base64").toString(); } catch (error) { - if (error.message !== "Not Found") { - throw error; + if (error instanceof request_error_1.RequestError && error.response) { + const reponseData = error.response.data; + if ("message" in reponseData && reponseData.message === "Not Found") { + return undefined; + } } - return undefined; + throw error; } } } diff --git a/lib/precommit/index.js b/lib/precommit/index.js index d9cec2b..cde5abd 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -42373,6 +42373,7 @@ const assert_1 = __importDefault(__nccwpck_require__(9491)); const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); const github = __importStar(__nccwpck_require__(5438)); +const request_error_1 = __nccwpck_require__(537); const commit_it_1 = __nccwpck_require__(9403); const simple_git_1 = __nccwpck_require__(9103); /** @@ -42449,10 +42450,13 @@ class GitHubSource { return Buffer.from(config.content, "base64").toString(); } catch (error) { - if (error.message !== "Not Found") { - throw error; + if (error instanceof request_error_1.RequestError && error.response) { + const reponseData = error.response.data; + if ("message" in reponseData && reponseData.message === "Not Found") { + return undefined; + } } - return undefined; + throw error; } } } diff --git a/src/datasources.ts b/src/datasources.ts index 9bc9d65..a3734db 100644 --- a/src/datasources.ts +++ b/src/datasources.ts @@ -8,6 +8,7 @@ import * as fs from "fs"; import * as core from "@actions/core"; import * as github from "@actions/github"; +import { RequestError } from "@octokit/request-error"; import { Commit } from "@dev-build-deploy/commit-it"; import { simpleGit } from "simple-git"; @@ -110,10 +111,13 @@ export class GitHubSource implements IDataSource { return Buffer.from(config.content, "base64").toString(); } catch (error: unknown) { - if ((error as Error).message !== "Not Found") { - throw error; + if (error instanceof RequestError && error.response) { + const reponseData = error.response.data as Record + if ("message" in reponseData && reponseData.message === "Not Found") { + return undefined; + } } - return undefined; + throw error; } } } From 3e4b05860d83d9120140d8dd220b0d389ddc79a9 Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Mon, 17 Jun 2024 16:49:06 +0200 Subject: [PATCH 18/22] feat: support merges of remote branches Co-authored-by: @tobias-kleinschmidt-fnt --- lib/action/index.js | 2 +- lib/cli/index.js | 2 +- lib/precommit/index.js | 2 +- package-lock.json | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index f3ddbdf..a1d6c9e 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -2252,7 +2252,7 @@ exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; function subjectIsMergePattern(subject) { const githubMergeRegex = /^Merge pull request #(\d+) from '?(.*)'?$/; const bitbucketMergeRegex = /^Merged in '?(.*)'? \(pull request #(\d+)\)$/; - const gitlabMergeRegex = /^Merge branch '?(.*?)'? into '?(.*?)'?$/; + const gitlabMergeRegex = /^Merge( remote-tracking)? branch '?(.*?)'? into '?(.*?)'?$/; return githubMergeRegex.test(subject) || bitbucketMergeRegex.test(subject) || gitlabMergeRegex.test(subject); } /** diff --git a/lib/cli/index.js b/lib/cli/index.js index 96135cc..390c41b 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -2253,7 +2253,7 @@ exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; function subjectIsMergePattern(subject) { const githubMergeRegex = /^Merge pull request #(\d+) from '?(.*)'?$/; const bitbucketMergeRegex = /^Merged in '?(.*)'? \(pull request #(\d+)\)$/; - const gitlabMergeRegex = /^Merge branch '?(.*?)'? into '?(.*?)'?$/; + const gitlabMergeRegex = /^Merge( remote-tracking)? branch '?(.*?)'? into '?(.*?)'?$/; return githubMergeRegex.test(subject) || bitbucketMergeRegex.test(subject) || gitlabMergeRegex.test(subject); } /** diff --git a/lib/precommit/index.js b/lib/precommit/index.js index cde5abd..2d61c90 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -2253,7 +2253,7 @@ exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; function subjectIsMergePattern(subject) { const githubMergeRegex = /^Merge pull request #(\d+) from '?(.*)'?$/; const bitbucketMergeRegex = /^Merged in '?(.*)'? \(pull request #(\d+)\)$/; - const gitlabMergeRegex = /^Merge branch '?(.*?)'? into '?(.*?)'?$/; + const gitlabMergeRegex = /^Merge( remote-tracking)? branch '?(.*?)'? into '?(.*?)'?$/; return githubMergeRegex.test(subject) || bitbucketMergeRegex.test(subject) || gitlabMergeRegex.test(subject); } /** diff --git a/package-lock.json b/package-lock.json index 5a46c74..fd90b55 100644 --- a/package-lock.json +++ b/package-lock.json @@ -673,9 +673,9 @@ "dev": true }, "node_modules/@dev-build-deploy/commit-it": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.2.0.tgz", - "integrity": "sha512-FTG1egTOCsZAgSdqRzwTodNAsidtmp0ocFrAB4uToQI7WgY20wLl09XkudCoZbe2ZkW2m2fwSNgqLTJcICiE9Q==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.3.0.tgz", + "integrity": "sha512-LZiPqr9y41hFKWH+WUhPQqXv1l9CzL5mAXyR1gJ2H0sylkC0ggD1WX/hWvxdRF4L7vqBftQSmr39RYI+Ff2q7g==", "dependencies": { "@dev-build-deploy/diagnose-it": "^1", "chalk": "<5" From 558809dde28148e54420791dc82a1510f9ff28bd Mon Sep 17 00:00:00 2001 From: Kevin de Jong Date: Mon, 17 Jun 2024 16:55:28 +0200 Subject: [PATCH 19/22] chore(deps): update braces to 3.0.3 --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index fd90b55..7afefee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2202,12 +2202,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -3463,9 +3463,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" From 744a57bb3aa0060452c0fcfdc5edc0f88f3f11f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:57:59 +0000 Subject: [PATCH 20/22] chore(deps): bump simple-git from 3.24.0 to 3.25.0 Bumps [simple-git](https://github.com/steveukx/git-js/tree/HEAD/simple-git) from 3.24.0 to 3.25.0. - [Release notes](https://github.com/steveukx/git-js/releases) - [Changelog](https://github.com/steveukx/git-js/blob/main/simple-git/CHANGELOG.md) - [Commits](https://github.com/steveukx/git-js/commits/simple-git@3.25.0/simple-git) --- updated-dependencies: - dependency-name: simple-git dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- lib/action/index.js | 107 ++++++++++++++++++++++++++++++----------- lib/cli/index.js | 107 ++++++++++++++++++++++++++++++----------- lib/precommit/index.js | 107 ++++++++++++++++++++++++++++++----------- package-lock.json | 14 +++--- 4 files changed, 244 insertions(+), 91 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index a1d6c9e..9a1434a 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -10823,11 +10823,11 @@ function getDate() { } /** - * Invokes `util.format()` with the specified arguments and writes to stderr. + * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr. */ function log(...args) { - return process.stderr.write(util.format(...args) + '\n'); + return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); } /** @@ -14218,6 +14218,11 @@ function remove(target, item) { function asArray(source) { return Array.isArray(source) ? source : [source]; } +function asCamelCase(str) { + return str.replace(/[\s-]+(.)/g, (_all, chr) => { + return chr.toUpperCase(); + }); +} function asStringArray(source) { return asArray(source).map(String); } @@ -14470,8 +14475,8 @@ var init_task_options = __esm({ }); // src/lib/utils/task-parser.ts -function callTaskParser(parser3, streams) { - return parser3(streams.stdOut, streams.stdErr); +function callTaskParser(parser4, streams) { + return parser4(streams.stdOut, streams.stdErr); } function parseStringResponse(result, parsers12, texts, trim = true) { asArray(texts).forEach((text) => { @@ -14506,6 +14511,7 @@ __export(utils_exports, { append: () => append, appendTaskOptions: () => appendTaskOptions, asArray: () => asArray, + asCamelCase: () => asCamelCase, asFunction: () => asFunction, asNumber: () => asNumber, asStringArray: () => asStringArray, @@ -14664,11 +14670,11 @@ __export(task_exports, { straightThroughBufferTask: () => straightThroughBufferTask, straightThroughStringTask: () => straightThroughStringTask }); -function adhocExecTask(parser3) { +function adhocExecTask(parser4) { return { commands: EMPTY_COMMANDS, format: "empty", - parser: parser3 + parser: parser4 }; } function configurationErrorTask(error) { @@ -16147,6 +16153,49 @@ var init_checkout = __esm({ } }); +// src/lib/tasks/count-objects.ts +function countObjectsResponse() { + return { + count: 0, + garbage: 0, + inPack: 0, + packs: 0, + prunePackable: 0, + size: 0, + sizeGarbage: 0, + sizePack: 0 + }; +} +function count_objects_default() { + return { + countObjects() { + return this._runTask({ + commands: ["count-objects", "--verbose"], + format: "utf-8", + parser(stdOut) { + return parseStringResponse(countObjectsResponse(), [parser2], stdOut); + } + }); + } + }; +} +var parser2; +var init_count_objects = __esm({ + "src/lib/tasks/count-objects.ts"() { + "use strict"; + init_utils(); + parser2 = new LineParser( + /([a-z-]+): (\d+)$/, + (result, [key, value]) => { + const property = asCamelCase(key); + if (result.hasOwnProperty(property)) { + result[property] = asNumber(value); + } + } + ); + } +}); + // src/lib/parsers/parse-commit.ts function parseCommitResult(stdOut) { const result = { @@ -16388,8 +16437,8 @@ var init_DiffSummary = __esm({ // src/lib/parsers/parse-diff-summary.ts function getDiffParser(format = "" /* NONE */) { - const parser3 = diffSummaryParsers[format]; - return (stdOut) => parseStringResponse(new DiffSummary(), parser3, stdOut, false); + const parser4 = diffSummaryParsers[format]; + return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false); } var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers; var init_parse_diff_summary = __esm({ @@ -16645,11 +16694,11 @@ function parseLogOptions(opt = {}, customArgs = []) { }; } function logTask(splitter, fields, customArgs) { - const parser3 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs)); + const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs)); return { commands: ["log", ...customArgs], format: "utf-8", - parser: parser3 + parser: parser4 }; } function log_default() { @@ -17168,11 +17217,11 @@ function renamedFile(line) { to }; } -function parser2(indexX, indexY, handler) { +function parser3(indexX, indexY, handler) { return [`${indexX}${indexY}`, handler]; } function conflicts(indexX, ...indexY) { - return indexY.map((y) => parser2(indexX, y, (result, file) => append(result.conflicted, file))); + return indexY.map((y) => parser3(indexX, y, (result, file) => append(result.conflicted, file))); } function splitLine(result, lineStr) { const trimmed2 = lineStr.trim(); @@ -17223,58 +17272,58 @@ var init_StatusSummary = __esm({ } }; parsers6 = new Map([ - parser2( + parser3( " " /* NONE */, "A" /* ADDED */, (result, file) => append(result.created, file) ), - parser2( + parser3( " " /* NONE */, "D" /* DELETED */, (result, file) => append(result.deleted, file) ), - parser2( + parser3( " " /* NONE */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) ), - parser2( + parser3( "A" /* ADDED */, " " /* NONE */, (result, file) => append(result.created, file) && append(result.staged, file) ), - parser2( + parser3( "A" /* ADDED */, "M" /* MODIFIED */, (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file) ), - parser2( + parser3( "D" /* DELETED */, " " /* NONE */, (result, file) => append(result.deleted, file) && append(result.staged, file) ), - parser2( + parser3( "M" /* MODIFIED */, " " /* NONE */, (result, file) => append(result.modified, file) && append(result.staged, file) ), - parser2( + parser3( "M" /* MODIFIED */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) && append(result.staged, file) ), - parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => { + parser3("R" /* RENAMED */, " " /* NONE */, (result, file) => { append(result.renamed, renamedFile(file)); }), - parser2("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => { + parser3("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => { const renamed = renamedFile(file); append(result.renamed, renamed); append(result.modified, renamed.to); }), - parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { + parser3("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { append(_result.ignored = _result.ignored || [], _file); }), - parser2( + parser3( "?" /* UNTRACKED */, "?" /* UNTRACKED */, (result, file) => append(result.not_added, file) @@ -17443,6 +17492,7 @@ var init_simple_git_api = __esm({ init_task_callback(); init_change_working_directory(); init_checkout(); + init_count_objects(); init_commit(); init_config(); init_first_commit(); @@ -17561,6 +17611,7 @@ var init_simple_git_api = __esm({ checkout_default(), commit_default(), config_default(), + count_objects_default(), first_commit_default(), grep_default(), log_default(), @@ -17802,11 +17853,11 @@ function branchTask(customArgs) { }; } function branchLocalTask() { - const parser3 = parseBranchSummary; + const parser4 = parseBranchSummary; return { format: "utf-8", commands: ["branch", "-v"], - parser: parser3 + parser: parser4 }; } function deleteBranchesTask(branches, forceDelete = false) { @@ -18159,7 +18210,7 @@ __export(stash_list_exports, { function stashListTask(opt = {}, customArgs) { const options = parseLogOptions(opt); const commands = ["stash", "list", ...options.commands, ...customArgs]; - const parser3 = createListLogSummaryParser( + const parser4 = createListLogSummaryParser( options.splitter, options.fields, logFormatFromCommand(commands) @@ -18167,7 +18218,7 @@ function stashListTask(opt = {}, customArgs) { return validateLogFormatConfig(commands) || { commands, format: "utf-8", - parser: parser3 + parser: parser4 }; } var init_stash_list = __esm({ diff --git a/lib/cli/index.js b/lib/cli/index.js index 390c41b..054c084 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -10824,11 +10824,11 @@ function getDate() { } /** - * Invokes `util.format()` with the specified arguments and writes to stderr. + * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr. */ function log(...args) { - return process.stderr.write(util.format(...args) + '\n'); + return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); } /** @@ -14219,6 +14219,11 @@ function remove(target, item) { function asArray(source) { return Array.isArray(source) ? source : [source]; } +function asCamelCase(str) { + return str.replace(/[\s-]+(.)/g, (_all, chr) => { + return chr.toUpperCase(); + }); +} function asStringArray(source) { return asArray(source).map(String); } @@ -14471,8 +14476,8 @@ var init_task_options = __esm({ }); // src/lib/utils/task-parser.ts -function callTaskParser(parser3, streams) { - return parser3(streams.stdOut, streams.stdErr); +function callTaskParser(parser4, streams) { + return parser4(streams.stdOut, streams.stdErr); } function parseStringResponse(result, parsers12, texts, trim = true) { asArray(texts).forEach((text) => { @@ -14507,6 +14512,7 @@ __export(utils_exports, { append: () => append, appendTaskOptions: () => appendTaskOptions, asArray: () => asArray, + asCamelCase: () => asCamelCase, asFunction: () => asFunction, asNumber: () => asNumber, asStringArray: () => asStringArray, @@ -14665,11 +14671,11 @@ __export(task_exports, { straightThroughBufferTask: () => straightThroughBufferTask, straightThroughStringTask: () => straightThroughStringTask }); -function adhocExecTask(parser3) { +function adhocExecTask(parser4) { return { commands: EMPTY_COMMANDS, format: "empty", - parser: parser3 + parser: parser4 }; } function configurationErrorTask(error) { @@ -16148,6 +16154,49 @@ var init_checkout = __esm({ } }); +// src/lib/tasks/count-objects.ts +function countObjectsResponse() { + return { + count: 0, + garbage: 0, + inPack: 0, + packs: 0, + prunePackable: 0, + size: 0, + sizeGarbage: 0, + sizePack: 0 + }; +} +function count_objects_default() { + return { + countObjects() { + return this._runTask({ + commands: ["count-objects", "--verbose"], + format: "utf-8", + parser(stdOut) { + return parseStringResponse(countObjectsResponse(), [parser2], stdOut); + } + }); + } + }; +} +var parser2; +var init_count_objects = __esm({ + "src/lib/tasks/count-objects.ts"() { + "use strict"; + init_utils(); + parser2 = new LineParser( + /([a-z-]+): (\d+)$/, + (result, [key, value]) => { + const property = asCamelCase(key); + if (result.hasOwnProperty(property)) { + result[property] = asNumber(value); + } + } + ); + } +}); + // src/lib/parsers/parse-commit.ts function parseCommitResult(stdOut) { const result = { @@ -16389,8 +16438,8 @@ var init_DiffSummary = __esm({ // src/lib/parsers/parse-diff-summary.ts function getDiffParser(format = "" /* NONE */) { - const parser3 = diffSummaryParsers[format]; - return (stdOut) => parseStringResponse(new DiffSummary(), parser3, stdOut, false); + const parser4 = diffSummaryParsers[format]; + return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false); } var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers; var init_parse_diff_summary = __esm({ @@ -16646,11 +16695,11 @@ function parseLogOptions(opt = {}, customArgs = []) { }; } function logTask(splitter, fields, customArgs) { - const parser3 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs)); + const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs)); return { commands: ["log", ...customArgs], format: "utf-8", - parser: parser3 + parser: parser4 }; } function log_default() { @@ -17169,11 +17218,11 @@ function renamedFile(line) { to }; } -function parser2(indexX, indexY, handler) { +function parser3(indexX, indexY, handler) { return [`${indexX}${indexY}`, handler]; } function conflicts(indexX, ...indexY) { - return indexY.map((y) => parser2(indexX, y, (result, file) => append(result.conflicted, file))); + return indexY.map((y) => parser3(indexX, y, (result, file) => append(result.conflicted, file))); } function splitLine(result, lineStr) { const trimmed2 = lineStr.trim(); @@ -17224,58 +17273,58 @@ var init_StatusSummary = __esm({ } }; parsers6 = new Map([ - parser2( + parser3( " " /* NONE */, "A" /* ADDED */, (result, file) => append(result.created, file) ), - parser2( + parser3( " " /* NONE */, "D" /* DELETED */, (result, file) => append(result.deleted, file) ), - parser2( + parser3( " " /* NONE */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) ), - parser2( + parser3( "A" /* ADDED */, " " /* NONE */, (result, file) => append(result.created, file) && append(result.staged, file) ), - parser2( + parser3( "A" /* ADDED */, "M" /* MODIFIED */, (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file) ), - parser2( + parser3( "D" /* DELETED */, " " /* NONE */, (result, file) => append(result.deleted, file) && append(result.staged, file) ), - parser2( + parser3( "M" /* MODIFIED */, " " /* NONE */, (result, file) => append(result.modified, file) && append(result.staged, file) ), - parser2( + parser3( "M" /* MODIFIED */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) && append(result.staged, file) ), - parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => { + parser3("R" /* RENAMED */, " " /* NONE */, (result, file) => { append(result.renamed, renamedFile(file)); }), - parser2("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => { + parser3("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => { const renamed = renamedFile(file); append(result.renamed, renamed); append(result.modified, renamed.to); }), - parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { + parser3("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { append(_result.ignored = _result.ignored || [], _file); }), - parser2( + parser3( "?" /* UNTRACKED */, "?" /* UNTRACKED */, (result, file) => append(result.not_added, file) @@ -17444,6 +17493,7 @@ var init_simple_git_api = __esm({ init_task_callback(); init_change_working_directory(); init_checkout(); + init_count_objects(); init_commit(); init_config(); init_first_commit(); @@ -17562,6 +17612,7 @@ var init_simple_git_api = __esm({ checkout_default(), commit_default(), config_default(), + count_objects_default(), first_commit_default(), grep_default(), log_default(), @@ -17803,11 +17854,11 @@ function branchTask(customArgs) { }; } function branchLocalTask() { - const parser3 = parseBranchSummary; + const parser4 = parseBranchSummary; return { format: "utf-8", commands: ["branch", "-v"], - parser: parser3 + parser: parser4 }; } function deleteBranchesTask(branches, forceDelete = false) { @@ -18160,7 +18211,7 @@ __export(stash_list_exports, { function stashListTask(opt = {}, customArgs) { const options = parseLogOptions(opt); const commands = ["stash", "list", ...options.commands, ...customArgs]; - const parser3 = createListLogSummaryParser( + const parser4 = createListLogSummaryParser( options.splitter, options.fields, logFormatFromCommand(commands) @@ -18168,7 +18219,7 @@ function stashListTask(opt = {}, customArgs) { return validateLogFormatConfig(commands) || { commands, format: "utf-8", - parser: parser3 + parser: parser4 }; } var init_stash_list = __esm({ diff --git a/lib/precommit/index.js b/lib/precommit/index.js index 2d61c90..0821227 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -10824,11 +10824,11 @@ function getDate() { } /** - * Invokes `util.format()` with the specified arguments and writes to stderr. + * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr. */ function log(...args) { - return process.stderr.write(util.format(...args) + '\n'); + return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); } /** @@ -14219,6 +14219,11 @@ function remove(target, item) { function asArray(source) { return Array.isArray(source) ? source : [source]; } +function asCamelCase(str) { + return str.replace(/[\s-]+(.)/g, (_all, chr) => { + return chr.toUpperCase(); + }); +} function asStringArray(source) { return asArray(source).map(String); } @@ -14471,8 +14476,8 @@ var init_task_options = __esm({ }); // src/lib/utils/task-parser.ts -function callTaskParser(parser3, streams) { - return parser3(streams.stdOut, streams.stdErr); +function callTaskParser(parser4, streams) { + return parser4(streams.stdOut, streams.stdErr); } function parseStringResponse(result, parsers12, texts, trim = true) { asArray(texts).forEach((text) => { @@ -14507,6 +14512,7 @@ __export(utils_exports, { append: () => append, appendTaskOptions: () => appendTaskOptions, asArray: () => asArray, + asCamelCase: () => asCamelCase, asFunction: () => asFunction, asNumber: () => asNumber, asStringArray: () => asStringArray, @@ -14665,11 +14671,11 @@ __export(task_exports, { straightThroughBufferTask: () => straightThroughBufferTask, straightThroughStringTask: () => straightThroughStringTask }); -function adhocExecTask(parser3) { +function adhocExecTask(parser4) { return { commands: EMPTY_COMMANDS, format: "empty", - parser: parser3 + parser: parser4 }; } function configurationErrorTask(error) { @@ -16148,6 +16154,49 @@ var init_checkout = __esm({ } }); +// src/lib/tasks/count-objects.ts +function countObjectsResponse() { + return { + count: 0, + garbage: 0, + inPack: 0, + packs: 0, + prunePackable: 0, + size: 0, + sizeGarbage: 0, + sizePack: 0 + }; +} +function count_objects_default() { + return { + countObjects() { + return this._runTask({ + commands: ["count-objects", "--verbose"], + format: "utf-8", + parser(stdOut) { + return parseStringResponse(countObjectsResponse(), [parser2], stdOut); + } + }); + } + }; +} +var parser2; +var init_count_objects = __esm({ + "src/lib/tasks/count-objects.ts"() { + "use strict"; + init_utils(); + parser2 = new LineParser( + /([a-z-]+): (\d+)$/, + (result, [key, value]) => { + const property = asCamelCase(key); + if (result.hasOwnProperty(property)) { + result[property] = asNumber(value); + } + } + ); + } +}); + // src/lib/parsers/parse-commit.ts function parseCommitResult(stdOut) { const result = { @@ -16389,8 +16438,8 @@ var init_DiffSummary = __esm({ // src/lib/parsers/parse-diff-summary.ts function getDiffParser(format = "" /* NONE */) { - const parser3 = diffSummaryParsers[format]; - return (stdOut) => parseStringResponse(new DiffSummary(), parser3, stdOut, false); + const parser4 = diffSummaryParsers[format]; + return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false); } var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers; var init_parse_diff_summary = __esm({ @@ -16646,11 +16695,11 @@ function parseLogOptions(opt = {}, customArgs = []) { }; } function logTask(splitter, fields, customArgs) { - const parser3 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs)); + const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs)); return { commands: ["log", ...customArgs], format: "utf-8", - parser: parser3 + parser: parser4 }; } function log_default() { @@ -17169,11 +17218,11 @@ function renamedFile(line) { to }; } -function parser2(indexX, indexY, handler) { +function parser3(indexX, indexY, handler) { return [`${indexX}${indexY}`, handler]; } function conflicts(indexX, ...indexY) { - return indexY.map((y) => parser2(indexX, y, (result, file) => append(result.conflicted, file))); + return indexY.map((y) => parser3(indexX, y, (result, file) => append(result.conflicted, file))); } function splitLine(result, lineStr) { const trimmed2 = lineStr.trim(); @@ -17224,58 +17273,58 @@ var init_StatusSummary = __esm({ } }; parsers6 = new Map([ - parser2( + parser3( " " /* NONE */, "A" /* ADDED */, (result, file) => append(result.created, file) ), - parser2( + parser3( " " /* NONE */, "D" /* DELETED */, (result, file) => append(result.deleted, file) ), - parser2( + parser3( " " /* NONE */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) ), - parser2( + parser3( "A" /* ADDED */, " " /* NONE */, (result, file) => append(result.created, file) && append(result.staged, file) ), - parser2( + parser3( "A" /* ADDED */, "M" /* MODIFIED */, (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file) ), - parser2( + parser3( "D" /* DELETED */, " " /* NONE */, (result, file) => append(result.deleted, file) && append(result.staged, file) ), - parser2( + parser3( "M" /* MODIFIED */, " " /* NONE */, (result, file) => append(result.modified, file) && append(result.staged, file) ), - parser2( + parser3( "M" /* MODIFIED */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) && append(result.staged, file) ), - parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => { + parser3("R" /* RENAMED */, " " /* NONE */, (result, file) => { append(result.renamed, renamedFile(file)); }), - parser2("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => { + parser3("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => { const renamed = renamedFile(file); append(result.renamed, renamed); append(result.modified, renamed.to); }), - parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { + parser3("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { append(_result.ignored = _result.ignored || [], _file); }), - parser2( + parser3( "?" /* UNTRACKED */, "?" /* UNTRACKED */, (result, file) => append(result.not_added, file) @@ -17444,6 +17493,7 @@ var init_simple_git_api = __esm({ init_task_callback(); init_change_working_directory(); init_checkout(); + init_count_objects(); init_commit(); init_config(); init_first_commit(); @@ -17562,6 +17612,7 @@ var init_simple_git_api = __esm({ checkout_default(), commit_default(), config_default(), + count_objects_default(), first_commit_default(), grep_default(), log_default(), @@ -17803,11 +17854,11 @@ function branchTask(customArgs) { }; } function branchLocalTask() { - const parser3 = parseBranchSummary; + const parser4 = parseBranchSummary; return { format: "utf-8", commands: ["branch", "-v"], - parser: parser3 + parser: parser4 }; } function deleteBranchesTask(branches, forceDelete = false) { @@ -18160,7 +18211,7 @@ __export(stash_list_exports, { function stashListTask(opt = {}, customArgs) { const options = parseLogOptions(opt); const commands = ["stash", "list", ...options.commands, ...customArgs]; - const parser3 = createListLogSummaryParser( + const parser4 = createListLogSummaryParser( options.splitter, options.fields, logFormatFromCommand(commands) @@ -18168,7 +18219,7 @@ function stashListTask(opt = {}, customArgs) { return validateLogFormatConfig(commands) || { commands, format: "utf-8", - parser: parser3 + parser: parser4 }; } var init_stash_list = __esm({ diff --git a/package-lock.json b/package-lock.json index 7afefee..01d2dda 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2527,9 +2527,9 @@ } }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", "dependencies": { "ms": "2.1.2" }, @@ -6006,13 +6006,13 @@ "dev": true }, "node_modules/simple-git": { - "version": "3.24.0", - "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.24.0.tgz", - "integrity": "sha512-QqAKee9Twv+3k8IFOFfPB2hnk6as6Y6ACUpwCtQvRYBAes23Wv3SZlHVobAzqcE8gfsisCvPw3HGW3HYM+VYYw==", + "version": "3.25.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.25.0.tgz", + "integrity": "sha512-KIY5sBnzc4yEcJXW7Tdv4viEz8KyG+nU0hay+DWZasvdFOYKeUZ6Xc25LUHHjw0tinPT7O1eY6pzX7pRT1K8rw==", "dependencies": { "@kwsites/file-exists": "^1.1.1", "@kwsites/promise-deferred": "^1.1.1", - "debug": "^4.3.4" + "debug": "^4.3.5" }, "funding": { "type": "github", From 5c4fc91edbac8cc592578bfee84ec59530c0b12e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:57:58 +0000 Subject: [PATCH 21/22] chore(deps): bump commander from 12.0.0 to 12.1.0 Bumps [commander](https://github.com/tj/commander.js) from 12.0.0 to 12.1.0. - [Release notes](https://github.com/tj/commander.js/releases) - [Changelog](https://github.com/tj/commander.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/tj/commander.js/compare/v12.0.0...v12.1.0) --- updated-dependencies: - dependency-name: commander dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- lib/cli/index.js | 835 ++++++++++++++++++++++++++++------------- lib/precommit/index.js | 835 ++++++++++++++++++++++++++++------------- package-lock.json | 6 +- src/datasources.ts | 2 +- 4 files changed, 1140 insertions(+), 538 deletions(-) diff --git a/lib/cli/index.js b/lib/cli/index.js index 054c084..669367c 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -11439,7 +11439,7 @@ function buildValues(diff, lastComponent, newString, oldString, useLongestToken) /***/ }), -/***/ 1005: +/***/ 2081: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -12123,7 +12123,7 @@ _base = _interopRequireDefault(__nccwpck_require__(1653)) var /*istanbul ignore start*/ -_character = __nccwpck_require__(1005) +_character = __nccwpck_require__(2081) /*istanbul ignore end*/ ; @@ -15825,7 +15825,7 @@ var import_child_process, GitExecutorChain; var init_git_executor_chain = __esm({ "src/lib/runners/git-executor-chain.ts"() { "use strict"; - import_child_process = __nccwpck_require__(2081); + import_child_process = __nccwpck_require__(8493); init_git_error(); init_task(); init_utils(); @@ -42752,7 +42752,7 @@ module.exports = require("buffer"); /***/ }), -/***/ 2081: +/***/ 8493: /***/ ((module) => { "use strict"; @@ -42832,6 +42832,14 @@ module.exports = require("net"); /***/ }), +/***/ 7718: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:child_process"); + +/***/ }), + /***/ 5673: /***/ ((module) => { @@ -42840,6 +42848,30 @@ module.exports = require("node:events"); /***/ }), +/***/ 7561: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:fs"); + +/***/ }), + +/***/ 9411: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:path"); + +/***/ }), + +/***/ 7742: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:process"); + +/***/ }), + /***/ 4492: /***/ ((module) => { @@ -42880,14 +42912,6 @@ module.exports = require("perf_hooks"); /***/ }), -/***/ 7282: -/***/ ((module) => { - -"use strict"; -module.exports = require("process"); - -/***/ }), - /***/ 3477: /***/ ((module) => { @@ -44695,7 +44719,7 @@ class Argument { } /** - * @package internal use only + * @package */ _concatValue(value, previous) { @@ -44743,7 +44767,9 @@ class Argument { this.argChoices = values.slice(); this.parseArg = (arg, previous) => { if (!this.argChoices.includes(arg)) { - throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(', ')}.`); + throw new InvalidArgumentError( + `Allowed choices are ${this.argChoices.join(', ')}.`, + ); } if (this.variadic) { return this._concatValue(arg, previous); @@ -44755,6 +44781,8 @@ class Argument { /** * Make argument required. + * + * @returns {Argument} */ argRequired() { this.required = true; @@ -44763,6 +44791,8 @@ class Argument { /** * Make argument optional. + * + * @returns {Argument} */ argOptional() { this.required = false; @@ -44781,9 +44811,7 @@ class Argument { function humanReadableArgName(arg) { const nameOutput = arg.name() + (arg.variadic === true ? '...' : ''); - return arg.required - ? '<' + nameOutput + '>' - : '[' + nameOutput + ']'; + return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']'; } exports.Argument = Argument; @@ -44795,11 +44823,11 @@ exports.humanReadableArgName = humanReadableArgName; /***/ 552: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -const EventEmitter = (__nccwpck_require__(2361).EventEmitter); -const childProcess = __nccwpck_require__(2081); -const path = __nccwpck_require__(1017); -const fs = __nccwpck_require__(7147); -const process = __nccwpck_require__(7282); +const EventEmitter = (__nccwpck_require__(5673).EventEmitter); +const childProcess = __nccwpck_require__(7718); +const path = __nccwpck_require__(9411); +const fs = __nccwpck_require__(7561); +const process = __nccwpck_require__(7742); const { Argument, humanReadableArgName } = __nccwpck_require__(9414); const { CommanderError } = __nccwpck_require__(2625); @@ -44857,9 +44885,11 @@ class Command extends EventEmitter { this._outputConfiguration = { writeOut: (str) => process.stdout.write(str), writeErr: (str) => process.stderr.write(str), - getOutHelpWidth: () => process.stdout.isTTY ? process.stdout.columns : undefined, - getErrHelpWidth: () => process.stderr.isTTY ? process.stderr.columns : undefined, - outputError: (str, write) => write(str) + getOutHelpWidth: () => + process.stdout.isTTY ? process.stdout.columns : undefined, + getErrHelpWidth: () => + process.stderr.isTTY ? process.stderr.columns : undefined, + outputError: (str, write) => write(str), }; this._hidden = false; @@ -44886,7 +44916,8 @@ class Command extends EventEmitter { this._helpConfiguration = sourceCommand._helpConfiguration; this._exitCallback = sourceCommand._exitCallback; this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties; - this._combineFlagAndOptionalValue = sourceCommand._combineFlagAndOptionalValue; + this._combineFlagAndOptionalValue = + sourceCommand._combineFlagAndOptionalValue; this._allowExcessArguments = sourceCommand._allowExcessArguments; this._enablePositionalOptions = sourceCommand._enablePositionalOptions; this._showHelpAfterError = sourceCommand._showHelpAfterError; @@ -44902,6 +44933,7 @@ class Command extends EventEmitter { _getCommandAndAncestors() { const result = []; + // eslint-disable-next-line @typescript-eslint/no-this-alias for (let command = this; command; command = command.parent) { result.push(command); } @@ -44928,8 +44960,8 @@ class Command extends EventEmitter { * .command('stop [service]', 'stop named service, or all if no name supplied'); * * @param {string} nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` - * @param {(Object|string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) - * @param {Object} [execOpts] - configuration options (for executable) + * @param {(object | string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) + * @param {object} [execOpts] - configuration options (for executable) * @return {Command} returns new command for action handler, or `this` for executable command */ @@ -44989,8 +45021,8 @@ class Command extends EventEmitter { * You can customise the help by overriding Help properties using configureHelp(), * or with a subclass of Help by overriding createHelp(). * - * @param {Object} [configuration] - configuration options - * @return {(Command|Object)} `this` command for chaining, or stored configuration + * @param {object} [configuration] - configuration options + * @return {(Command | object)} `this` command for chaining, or stored configuration */ configureHelp(configuration) { @@ -45015,8 +45047,8 @@ class Command extends EventEmitter { * // functions based on what is being written out * outputError(str, write) // used for displaying errors, and not used for displaying help * - * @param {Object} [configuration] - configuration options - * @return {(Command|Object)} `this` command for chaining, or stored configuration + * @param {object} [configuration] - configuration options + * @return {(Command | object)} `this` command for chaining, or stored configuration */ configureOutput(configuration) { @@ -45055,7 +45087,7 @@ class Command extends EventEmitter { * See .command() for creating an attached subcommand which inherits settings from its parent. * * @param {Command} cmd - new subcommand - * @param {Object} [opts] - configuration options + * @param {object} [opts] - configuration options * @return {Command} `this` command for chaining */ @@ -45131,9 +45163,12 @@ class Command extends EventEmitter { */ arguments(names) { - names.trim().split(/ +/).forEach((detail) => { - this.argument(detail); - }); + names + .trim() + .split(/ +/) + .forEach((detail) => { + this.argument(detail); + }); return this; } @@ -45146,10 +45181,18 @@ class Command extends EventEmitter { addArgument(argument) { const previousArgument = this.registeredArguments.slice(-1)[0]; if (previousArgument && previousArgument.variadic) { - throw new Error(`only the last argument can be variadic '${previousArgument.name()}'`); + throw new Error( + `only the last argument can be variadic '${previousArgument.name()}'`, + ); } - if (argument.required && argument.defaultValue !== undefined && argument.parseArg === undefined) { - throw new Error(`a default value for a required argument is never used: '${argument.name()}'`); + if ( + argument.required && + argument.defaultValue !== undefined && + argument.parseArg === undefined + ) { + throw new Error( + `a default value for a required argument is never used: '${argument.name()}'`, + ); } this.registeredArguments.push(argument); return this; @@ -45158,6 +45201,7 @@ class Command extends EventEmitter { /** * Customise or override default help command. By default a help command is automatically added if your command has subcommands. * + * @example * program.helpCommand('help [cmd]'); * program.helpCommand('help [cmd]', 'show help'); * program.helpCommand(false); // suppress default help command @@ -45216,8 +45260,11 @@ class Command extends EventEmitter { * @package */ _getHelpCommand() { - const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? - (this.commands.length && !this._actionHandler && !this._findCommand('help')); + const hasImplicitHelpCommand = + this._addImplicitHelpCommand ?? + (this.commands.length && + !this._actionHandler && + !this._findCommand('help')); if (hasImplicitHelpCommand) { if (this._helpCommand === undefined) { @@ -45365,14 +45412,18 @@ Expecting one of '${allowedValues.join("', '")}'`); * Register option if no conflicts found, or throw on conflict. * * @param {Option} option - * @api private + * @private */ _registerOption(option) { - const matchingOption = (option.short && this._findOption(option.short)) || + const matchingOption = + (option.short && this._findOption(option.short)) || (option.long && this._findOption(option.long)); if (matchingOption) { - const matchingFlag = (option.long && this._findOption(option.long)) ? option.long : option.short; + const matchingFlag = + option.long && this._findOption(option.long) + ? option.long + : option.short; throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}' - already used by option '${matchingOption.flags}'`); } @@ -45385,7 +45436,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Register command if no conflicts found, or throw on conflict. * * @param {Command} command - * @api private + * @private */ _registerCommand(command) { @@ -45393,11 +45444,15 @@ Expecting one of '${allowedValues.join("', '")}'`); return [cmd.name()].concat(cmd.aliases()); }; - const alreadyUsed = knownBy(command).find((name) => this._findCommand(name)); + const alreadyUsed = knownBy(command).find((name) => + this._findCommand(name), + ); if (alreadyUsed) { const existingCmd = knownBy(this._findCommand(alreadyUsed)).join('|'); const newCmd = knownBy(command).join('|'); - throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`); + throw new Error( + `cannot add command '${newCmd}' as already have command '${existingCmd}'`, + ); } this.commands.push(command); @@ -45420,7 +45475,11 @@ Expecting one of '${allowedValues.join("', '")}'`); // --no-foo is special and defaults foo to true, unless a --foo option is already defined const positiveLongFlag = option.long.replace(/^--no-/, '--'); if (!this._findOption(positiveLongFlag)) { - this.setOptionValueWithSource(name, option.defaultValue === undefined ? true : option.defaultValue, 'default'); + this.setOptionValueWithSource( + name, + option.defaultValue === undefined ? true : option.defaultValue, + 'default', + ); } } else if (option.defaultValue !== undefined) { this.setOptionValueWithSource(name, option.defaultValue, 'default'); @@ -45473,11 +45532,14 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Internal implementation shared by .option() and .requiredOption() * + * @return {Command} `this` command for chaining * @private */ _optionEx(config, flags, description, fn, defaultValue) { if (typeof flags === 'object' && flags instanceof Option) { - throw new Error('To add an Option object use addOption() instead of option() or requiredOption()'); + throw new Error( + 'To add an Option object use addOption() instead of option() or requiredOption()', + ); } const option = this.createOption(flags, description); option.makeOptionMandatory(!!config.mandatory); @@ -45525,20 +45587,26 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * Add a required option which must have a value after parsing. This usually means - * the option must be specified on the command line. (Otherwise the same as .option().) - * - * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. - * - * @param {string} flags - * @param {string} [description] - * @param {(Function|*)} [parseArg] - custom option processing function or default value - * @param {*} [defaultValue] - * @return {Command} `this` command for chaining - */ + * Add a required option which must have a value after parsing. This usually means + * the option must be specified on the command line. (Otherwise the same as .option().) + * + * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. + * + * @param {string} flags + * @param {string} [description] + * @param {(Function|*)} [parseArg] - custom option processing function or default value + * @param {*} [defaultValue] + * @return {Command} `this` command for chaining + */ requiredOption(flags, description, parseArg, defaultValue) { - return this._optionEx({ mandatory: true }, flags, description, parseArg, defaultValue); + return this._optionEx( + { mandatory: true }, + flags, + description, + parseArg, + defaultValue, + ); } /** @@ -45549,7 +45617,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b` * - * @param {boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag. + * @param {boolean} [combine] - if `true` or omitted, an optional value can be specified directly after the flag. + * @return {Command} `this` command for chaining */ combineFlagAndOptionalValue(combine = true) { this._combineFlagAndOptionalValue = !!combine; @@ -45559,8 +45628,8 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow unknown options on the command line. * - * @param {boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown - * for unknown options. + * @param {boolean} [allowUnknown] - if `true` or omitted, no error will be thrown for unknown options. + * @return {Command} `this` command for chaining */ allowUnknownOption(allowUnknown = true) { this._allowUnknownOption = !!allowUnknown; @@ -45570,8 +45639,8 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow excess command-arguments on the command line. Pass false to make excess arguments an error. * - * @param {boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown - * for excess arguments. + * @param {boolean} [allowExcess] - if `true` or omitted, no error will be thrown for excess arguments. + * @return {Command} `this` command for chaining */ allowExcessArguments(allowExcess = true) { this._allowExcessArguments = !!allowExcess; @@ -45583,7 +45652,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions. * The default behaviour is non-positional and global options may appear anywhere on the command line. * - * @param {boolean} [positional=true] + * @param {boolean} [positional] + * @return {Command} `this` command for chaining */ enablePositionalOptions(positional = true) { this._enablePositionalOptions = !!positional; @@ -45596,8 +45666,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * positional options to have been enabled on the program (parent commands). * The default behaviour is non-positional and options may appear before or after command-arguments. * - * @param {boolean} [passThrough=true] - * for unknown options. + * @param {boolean} [passThrough] for unknown options. + * @return {Command} `this` command for chaining */ passThroughOptions(passThrough = true) { this._passThroughOptions = !!passThrough; @@ -45610,25 +45680,33 @@ Expecting one of '${allowedValues.join("', '")}'`); */ _checkForBrokenPassThrough() { - if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) { - throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`); + if ( + this.parent && + this._passThroughOptions && + !this.parent._enablePositionalOptions + ) { + throw new Error( + `passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`, + ); } } /** - * Whether to store option values as properties on command object, - * or store separately (specify false). In both cases the option values can be accessed using .opts(). - * - * @param {boolean} [storeAsProperties=true] - * @return {Command} `this` command for chaining - */ + * Whether to store option values as properties on command object, + * or store separately (specify false). In both cases the option values can be accessed using .opts(). + * + * @param {boolean} [storeAsProperties=true] + * @return {Command} `this` command for chaining + */ storeOptionsAsProperties(storeAsProperties = true) { if (this.options.length) { throw new Error('call .storeOptionsAsProperties() before adding options'); } if (Object.keys(this._optionValues).length) { - throw new Error('call .storeOptionsAsProperties() before setting option values'); + throw new Error( + 'call .storeOptionsAsProperties() before setting option values', + ); } this._storeOptionsAsProperties = !!storeAsProperties; return this; @@ -45638,7 +45716,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Retrieve option value. * * @param {string} key - * @return {Object} value + * @return {object} value */ getOptionValue(key) { @@ -45652,7 +45730,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Store option value. * * @param {string} key - * @param {Object} value + * @param {object} value * @return {Command} `this` command for chaining */ @@ -45661,13 +45739,13 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * Store option value and where the value came from. - * - * @param {string} key - * @param {Object} value - * @param {string} source - expected values are default/config/env/cli/implied - * @return {Command} `this` command for chaining - */ + * Store option value and where the value came from. + * + * @param {string} key + * @param {object} value + * @param {string} source - expected values are default/config/env/cli/implied + * @return {Command} `this` command for chaining + */ setOptionValueWithSource(key, value, source) { if (this._storeOptionsAsProperties) { @@ -45680,24 +45758,24 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * Get source of option value. - * Expected values are default | config | env | cli | implied - * - * @param {string} key - * @return {string} - */ + * Get source of option value. + * Expected values are default | config | env | cli | implied + * + * @param {string} key + * @return {string} + */ getOptionValueSource(key) { return this._optionValueSources[key]; } /** - * Get source of option value. See also .optsWithGlobals(). - * Expected values are default | config | env | cli | implied - * - * @param {string} key - * @return {string} - */ + * Get source of option value. See also .optsWithGlobals(). + * Expected values are default | config | env | cli | implied + * + * @param {string} key + * @return {string} + */ getOptionValueSourceWithGlobals(key) { // global overwrites local, like optsWithGlobals @@ -45723,17 +45801,30 @@ Expecting one of '${allowedValues.join("', '")}'`); } parseOptions = parseOptions || {}; - // Default to using process.argv - if (argv === undefined) { - argv = process.argv; - // @ts-ignore: unknown property - if (process.versions && process.versions.electron) { + // auto-detect argument conventions if nothing supplied + if (argv === undefined && parseOptions.from === undefined) { + if (process.versions?.electron) { parseOptions.from = 'electron'; } + // check node specific options for scenarios where user CLI args follow executable without scriptname + const execArgv = process.execArgv ?? []; + if ( + execArgv.includes('-e') || + execArgv.includes('--eval') || + execArgv.includes('-p') || + execArgv.includes('--print') + ) { + parseOptions.from = 'eval'; // internal usage, not documented + } + } + + // default to using process.argv + if (argv === undefined) { + argv = process.argv; } this.rawArgs = argv.slice(); - // make it a little easier for callers by supporting various argv conventions + // extract the user args and scriptPath let userArgs; switch (parseOptions.from) { case undefined: @@ -45742,7 +45833,7 @@ Expecting one of '${allowedValues.join("', '")}'`); userArgs = argv.slice(2); break; case 'electron': - // @ts-ignore: unknown property + // @ts-ignore: because defaultApp is an unknown property if (process.defaultApp) { this._scriptPath = argv[1]; userArgs = argv.slice(2); @@ -45753,12 +45844,18 @@ Expecting one of '${allowedValues.join("', '")}'`); case 'user': userArgs = argv.slice(0); break; + case 'eval': + userArgs = argv.slice(1); + break; default: - throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`); + throw new Error( + `unexpected parse option { from: '${parseOptions.from}' }`, + ); } // Find default name for program from arguments. - if (!this._name && this._scriptPath) this.nameFromFilename(this._scriptPath); + if (!this._name && this._scriptPath) + this.nameFromFilename(this._scriptPath); this._name = this._name || 'program'; return userArgs; @@ -45767,16 +45864,22 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Parse `argv`, setting options and invoking commands when defined. * - * The default expectation is that the arguments are from node and have the application as argv[0] - * and the script being run in argv[1], with user parameters after that. + * Use parseAsync instead of parse if any of your action handlers are async. + * + * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode! + * + * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`: + * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that + * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged + * - `'user'`: just user arguments * * @example - * program.parse(process.argv); - * program.parse(); // implicitly use process.argv and auto-detect node vs electron conventions + * program.parse(); // parse process.argv and auto-detect electron and special node flags + * program.parse(process.argv); // assume argv[0] is app and argv[1] is script * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0] * * @param {string[]} [argv] - optional, defaults to process.argv - * @param {Object} [parseOptions] - optionally specify style of options with from: node/user/electron + * @param {object} [parseOptions] - optionally specify style of options with from: node/user/electron * @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron' * @return {Command} `this` command for chaining */ @@ -45791,18 +45894,20 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Parse `argv`, setting options and invoking commands when defined. * - * Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise. + * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode! * - * The default expectation is that the arguments are from node and have the application as argv[0] - * and the script being run in argv[1], with user parameters after that. + * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`: + * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that + * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged + * - `'user'`: just user arguments * * @example - * await program.parseAsync(process.argv); - * await program.parseAsync(); // implicitly use process.argv and auto-detect node vs electron conventions + * await program.parseAsync(); // parse process.argv and auto-detect electron and special node flags + * await program.parseAsync(process.argv); // assume argv[0] is app and argv[1] is script * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0] * * @param {string[]} [argv] - * @param {Object} [parseOptions] + * @param {object} [parseOptions] * @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron' * @return {Promise} */ @@ -45834,7 +45939,9 @@ Expecting one of '${allowedValues.join("', '")}'`); if (sourceExt.includes(path.extname(baseName))) return undefined; // Try all the extensions. - const foundExt = sourceExt.find(ext => fs.existsSync(`${localBin}${ext}`)); + const foundExt = sourceExt.find((ext) => + fs.existsSync(`${localBin}${ext}`), + ); if (foundExt) return `${localBin}${foundExt}`; return undefined; @@ -45845,7 +45952,8 @@ Expecting one of '${allowedValues.join("', '")}'`); this._checkForConflictingOptions(); // executableFile and executableDir might be full path, or just a name - let executableFile = subcommand._executableFile || `${this._name}-${subcommand._name}`; + let executableFile = + subcommand._executableFile || `${this._name}-${subcommand._name}`; let executableDir = this._executableDir || ''; if (this._scriptPath) { let resolvedScriptPath; // resolve possible symlink for installed npm binary @@ -45854,7 +45962,10 @@ Expecting one of '${allowedValues.join("', '")}'`); } catch (err) { resolvedScriptPath = this._scriptPath; } - executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir); + executableDir = path.resolve( + path.dirname(resolvedScriptPath), + executableDir, + ); } // Look for a local file in preference to a command in PATH. @@ -45863,9 +45974,15 @@ Expecting one of '${allowedValues.join("', '")}'`); // Legacy search using prefix of script name instead of command name if (!localFile && !subcommand._executableFile && this._scriptPath) { - const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath)); + const legacyName = path.basename( + this._scriptPath, + path.extname(this._scriptPath), + ); if (legacyName !== this._name) { - localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`); + localFile = findFile( + executableDir, + `${legacyName}-${subcommand._name}`, + ); } } executableFile = localFile || executableFile; @@ -45891,12 +46008,13 @@ Expecting one of '${allowedValues.join("', '")}'`); proc = childProcess.spawn(process.execPath, args, { stdio: 'inherit' }); } - if (!proc.killed) { // testing mainly to avoid leak warnings during unit tests with mocked spawn + if (!proc.killed) { + // testing mainly to avoid leak warnings during unit tests with mocked spawn const signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP']; signals.forEach((signal) => { - // @ts-ignore process.on(signal, () => { if (proc.killed === false && proc.exitCode === null) { + // @ts-ignore because signals not typed to known strings proc.kill(signal); } }); @@ -45905,16 +46023,22 @@ Expecting one of '${allowedValues.join("', '")}'`); // By default terminate process when spawned process terminates. const exitCallback = this._exitCallback; - proc.on('close', (code, _signal) => { + proc.on('close', (code) => { code = code ?? 1; // code is null if spawned process terminated due to a signal if (!exitCallback) { process.exit(code); } else { - exitCallback(new CommanderError(code, 'commander.executeSubCommandAsync', '(close)')); + exitCallback( + new CommanderError( + code, + 'commander.executeSubCommandAsync', + '(close)', + ), + ); } }); proc.on('error', (err) => { - // @ts-ignore + // @ts-ignore: because err.code is an unknown property if (err.code === 'ENOENT') { const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` @@ -45924,14 +46048,18 @@ Expecting one of '${allowedValues.join("', '")}'`); - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - ${executableDirMessage}`; throw new Error(executableMissing); - // @ts-ignore + // @ts-ignore: because err.code is an unknown property } else if (err.code === 'EACCES') { throw new Error(`'${executableFile}' not executable`); } if (!exitCallback) { process.exit(1); } else { - const wrappedError = new CommanderError(1, 'commander.executeSubCommandAsync', '(error)'); + const wrappedError = new CommanderError( + 1, + 'commander.executeSubCommandAsync', + '(error)', + ); wrappedError.nestedError = err; exitCallback(wrappedError); } @@ -45950,7 +46078,11 @@ Expecting one of '${allowedValues.join("', '")}'`); if (!subCommand) this.help({ error: true }); let promiseChain; - promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, 'preSubcommand'); + promiseChain = this._chainOrCallSubCommandHook( + promiseChain, + subCommand, + 'preSubcommand', + ); promiseChain = this._chainOrCall(promiseChain, () => { if (subCommand._executableHandler) { this._executeSubCommand(subCommand, operands.concat(unknown)); @@ -45978,9 +46110,11 @@ Expecting one of '${allowedValues.join("', '")}'`); } // Fallback to parsing the help flag to invoke the help. - return this._dispatchSubcommand(subcommandName, [], [ - this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help' - ]); + return this._dispatchSubcommand( + subcommandName, + [], + [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help'], + ); } /** @@ -45997,7 +46131,10 @@ Expecting one of '${allowedValues.join("', '")}'`); } }); // too many - if (this.registeredArguments.length > 0 && this.registeredArguments[this.registeredArguments.length - 1].variadic) { + if ( + this.registeredArguments.length > 0 && + this.registeredArguments[this.registeredArguments.length - 1].variadic + ) { return; } if (this.args.length > this.registeredArguments.length) { @@ -46017,7 +46154,12 @@ Expecting one of '${allowedValues.join("', '")}'`); let parsedValue = value; if (value !== null && argument.parseArg) { const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`; - parsedValue = this._callParseArg(argument, value, previous, invalidValueMessage); + parsedValue = this._callParseArg( + argument, + value, + previous, + invalidValueMessage, + ); } return parsedValue; }; @@ -46082,8 +46224,8 @@ Expecting one of '${allowedValues.join("', '")}'`); const hooks = []; this._getCommandAndAncestors() .reverse() - .filter(cmd => cmd._lifeCycleHooks[event] !== undefined) - .forEach(hookedCommand => { + .filter((cmd) => cmd._lifeCycleHooks[event] !== undefined) + .forEach((hookedCommand) => { hookedCommand._lifeCycleHooks[event].forEach((callback) => { hooks.push({ hookedCommand, callback }); }); @@ -46139,14 +46281,26 @@ Expecting one of '${allowedValues.join("', '")}'`); if (operands && this._findCommand(operands[0])) { return this._dispatchSubcommand(operands[0], operands.slice(1), unknown); } - if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) { + if ( + this._getHelpCommand() && + operands[0] === this._getHelpCommand().name() + ) { return this._dispatchHelpCommand(operands[1]); } if (this._defaultCommandName) { this._outputHelpIfRequested(unknown); // Run the help for default command from parent rather than passing to default command - return this._dispatchSubcommand(this._defaultCommandName, operands, unknown); + return this._dispatchSubcommand( + this._defaultCommandName, + operands, + unknown, + ); } - if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) { + if ( + this.commands.length && + this.args.length === 0 && + !this._actionHandler && + !this._defaultCommandName + ) { // probably missing subcommand and no handler, user needs help (and exit) this.help({ error: true }); } @@ -46169,7 +46323,9 @@ Expecting one of '${allowedValues.join("', '")}'`); let promiseChain; promiseChain = this._chainOrCallHooks(promiseChain, 'preAction'); - promiseChain = this._chainOrCall(promiseChain, () => this._actionHandler(this.processedArgs)); + promiseChain = this._chainOrCall(promiseChain, () => + this._actionHandler(this.processedArgs), + ); if (this.parent) { promiseChain = this._chainOrCall(promiseChain, () => { this.parent.emit(commandEvent, operands, unknown); // legacy @@ -46183,7 +46339,8 @@ Expecting one of '${allowedValues.join("', '")}'`); this._processArguments(); this.parent.emit(commandEvent, operands, unknown); // legacy } else if (operands.length) { - if (this._findCommand('*')) { // legacy default command + if (this._findCommand('*')) { + // legacy default command return this._dispatchSubcommand('*', operands, unknown); } if (this.listenerCount('command:*')) { @@ -46210,10 +46367,13 @@ Expecting one of '${allowedValues.join("', '")}'`); * Find matching command. * * @private + * @return {Command | undefined} */ _findCommand(name) { if (!name) return undefined; - return this.commands.find(cmd => cmd._name === name || cmd._aliases.includes(name)); + return this.commands.find( + (cmd) => cmd._name === name || cmd._aliases.includes(name), + ); } /** @@ -46221,11 +46381,11 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} arg * @return {Option} - * @package internal use only + * @package */ _findOption(arg) { - return this.options.find(option => option.is(arg)); + return this.options.find((option) => option.is(arg)); } /** @@ -46239,7 +46399,10 @@ Expecting one of '${allowedValues.join("', '")}'`); // Walk up hierarchy so can call in subcommand after checking for displaying help. this._getCommandAndAncestors().forEach((cmd) => { cmd.options.forEach((anOption) => { - if (anOption.mandatory && (cmd.getOptionValue(anOption.attributeName()) === undefined)) { + if ( + anOption.mandatory && + cmd.getOptionValue(anOption.attributeName()) === undefined + ) { cmd.missingMandatoryOptionValue(anOption); } }); @@ -46252,23 +46415,21 @@ Expecting one of '${allowedValues.join("', '")}'`); * @private */ _checkForConflictingLocalOptions() { - const definedNonDefaultOptions = this.options.filter( - (option) => { - const optionKey = option.attributeName(); - if (this.getOptionValue(optionKey) === undefined) { - return false; - } - return this.getOptionValueSource(optionKey) !== 'default'; + const definedNonDefaultOptions = this.options.filter((option) => { + const optionKey = option.attributeName(); + if (this.getOptionValue(optionKey) === undefined) { + return false; } - ); + return this.getOptionValueSource(optionKey) !== 'default'; + }); const optionsWithConflicting = definedNonDefaultOptions.filter( - (option) => option.conflictsWith.length > 0 + (option) => option.conflictsWith.length > 0, ); optionsWithConflicting.forEach((option) => { const conflictingAndDefined = definedNonDefaultOptions.find((defined) => - option.conflictsWith.includes(defined.attributeName()) + option.conflictsWith.includes(defined.attributeName()), ); if (conflictingAndDefined) { this._conflictingOption(option, conflictingAndDefined); @@ -46348,7 +46509,8 @@ Expecting one of '${allowedValues.join("', '")}'`); value = args.shift(); } this.emit(`option:${option.name()}`, value); - } else { // boolean flag + } else { + // boolean flag this.emit(`option:${option.name()}`); } activeVariadicOption = option.variadic ? option : null; @@ -46360,7 +46522,10 @@ Expecting one of '${allowedValues.join("', '")}'`); if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') { const option = this._findOption(`-${arg[1]}`); if (option) { - if (option.required || (option.optional && this._combineFlagAndOptionalValue)) { + if ( + option.required || + (option.optional && this._combineFlagAndOptionalValue) + ) { // option with value following in same argument this.emit(`option:${option.name()}`, arg.slice(2)); } else { @@ -46391,12 +46556,19 @@ Expecting one of '${allowedValues.join("', '")}'`); } // If using positionalOptions, stop processing our options at subcommand. - if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) { + if ( + (this._enablePositionalOptions || this._passThroughOptions) && + operands.length === 0 && + unknown.length === 0 + ) { if (this._findCommand(arg)) { operands.push(arg); if (args.length > 0) unknown.push(...args); break; - } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) { + } else if ( + this._getHelpCommand() && + arg === this._getHelpCommand().name() + ) { operands.push(arg); if (args.length > 0) operands.push(...args); break; @@ -46424,7 +46596,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Return an object containing local option values as key-value pairs. * - * @return {Object} + * @return {object} */ opts() { if (this._storeOptionsAsProperties) { @@ -46434,7 +46606,8 @@ Expecting one of '${allowedValues.join("', '")}'`); for (let i = 0; i < len; i++) { const key = this.options[i].attributeName(); - result[key] = key === this._versionOptionName ? this._version : this[key]; + result[key] = + key === this._versionOptionName ? this._version : this[key]; } return result; } @@ -46445,13 +46618,13 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Return an object containing merged local and global option values as key-value pairs. * - * @return {Object} + * @return {object} */ optsWithGlobals() { // globals overwrite locals return this._getCommandAndAncestors().reduce( (combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()), - {} + {}, ); } @@ -46459,13 +46632,16 @@ Expecting one of '${allowedValues.join("', '")}'`); * Display error message and exit (or call exitOverride). * * @param {string} message - * @param {Object} [errorOptions] + * @param {object} [errorOptions] * @param {string} [errorOptions.code] - an id string representing the error * @param {number} [errorOptions.exitCode] - used with process.exit */ error(message, errorOptions) { // output handling - this._outputConfiguration.outputError(`${message}\n`, this._outputConfiguration.writeErr); + this._outputConfiguration.outputError( + `${message}\n`, + this._outputConfiguration.writeErr, + ); if (typeof this._showHelpAfterError === 'string') { this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`); } else if (this._showHelpAfterError) { @@ -46491,11 +46667,18 @@ Expecting one of '${allowedValues.join("', '")}'`); if (option.envVar && option.envVar in process.env) { const optionKey = option.attributeName(); // Priority check. Do not overwrite cli or options from unknown source (client-code). - if (this.getOptionValue(optionKey) === undefined || ['default', 'config', 'env'].includes(this.getOptionValueSource(optionKey))) { - if (option.required || option.optional) { // option can take a value + if ( + this.getOptionValue(optionKey) === undefined || + ['default', 'config', 'env'].includes( + this.getOptionValueSource(optionKey), + ) + ) { + if (option.required || option.optional) { + // option can take a value // keep very simple, optional always takes value this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]); - } else { // boolean + } else { + // boolean // keep very simple, only care that envVar defined and not the value this.emit(`optionEnv:${option.name()}`); } @@ -46512,17 +46695,30 @@ Expecting one of '${allowedValues.join("', '")}'`); _parseOptionsImplied() { const dualHelper = new DualOptions(this.options); const hasCustomOptionValue = (optionKey) => { - return this.getOptionValue(optionKey) !== undefined && !['default', 'implied'].includes(this.getOptionValueSource(optionKey)); + return ( + this.getOptionValue(optionKey) !== undefined && + !['default', 'implied'].includes(this.getOptionValueSource(optionKey)) + ); }; this.options - .filter(option => (option.implied !== undefined) && - hasCustomOptionValue(option.attributeName()) && - dualHelper.valueFromOption(this.getOptionValue(option.attributeName()), option)) + .filter( + (option) => + option.implied !== undefined && + hasCustomOptionValue(option.attributeName()) && + dualHelper.valueFromOption( + this.getOptionValue(option.attributeName()), + option, + ), + ) .forEach((option) => { Object.keys(option.implied) - .filter(impliedKey => !hasCustomOptionValue(impliedKey)) - .forEach(impliedKey => { - this.setOptionValueWithSource(impliedKey, option.implied[impliedKey], 'implied'); + .filter((impliedKey) => !hasCustomOptionValue(impliedKey)) + .forEach((impliedKey) => { + this.setOptionValueWithSource( + impliedKey, + option.implied[impliedKey], + 'implied', + ); }); }); } @@ -46576,12 +46772,18 @@ Expecting one of '${allowedValues.join("', '")}'`); const findBestOptionFromValue = (option) => { const optionKey = option.attributeName(); const optionValue = this.getOptionValue(optionKey); - const negativeOption = this.options.find(target => target.negate && optionKey === target.attributeName()); - const positiveOption = this.options.find(target => !target.negate && optionKey === target.attributeName()); - if (negativeOption && ( - (negativeOption.presetArg === undefined && optionValue === false) || - (negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg) - )) { + const negativeOption = this.options.find( + (target) => target.negate && optionKey === target.attributeName(), + ); + const positiveOption = this.options.find( + (target) => !target.negate && optionKey === target.attributeName(), + ); + if ( + negativeOption && + ((negativeOption.presetArg === undefined && optionValue === false) || + (negativeOption.presetArg !== undefined && + optionValue === negativeOption.presetArg)) + ) { return negativeOption; } return positiveOption || option; @@ -46615,11 +46817,14 @@ Expecting one of '${allowedValues.join("', '")}'`); if (flag.startsWith('--') && this._showSuggestionAfterError) { // Looping to pick up the global options too let candidateFlags = []; + // eslint-disable-next-line @typescript-eslint/no-this-alias let command = this; do { - const moreFlags = command.createHelp().visibleOptions(command) - .filter(option => option.long) - .map(option => option.long); + const moreFlags = command + .createHelp() + .visibleOptions(command) + .filter((option) => option.long) + .map((option) => option.long); candidateFlags = candidateFlags.concat(moreFlags); command = command.parent; } while (command && !command._enablePositionalOptions); @@ -46641,7 +46846,7 @@ Expecting one of '${allowedValues.join("', '")}'`); if (this._allowExcessArguments) return; const expected = this.registeredArguments.length; - const s = (expected === 1) ? '' : 's'; + const s = expected === 1 ? '' : 's'; const forSubcommand = this.parent ? ` for '${this.name()}'` : ''; const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`; this.error(message, { code: 'commander.excessArguments' }); @@ -46659,11 +46864,13 @@ Expecting one of '${allowedValues.join("', '")}'`); if (this._showSuggestionAfterError) { const candidateNames = []; - this.createHelp().visibleCommands(this).forEach((command) => { - candidateNames.push(command.name()); - // just visible alias - if (command.alias()) candidateNames.push(command.alias()); - }); + this.createHelp() + .visibleCommands(this) + .forEach((command) => { + candidateNames.push(command.name()); + // just visible alias + if (command.alias()) candidateNames.push(command.alias()); + }); suggestion = suggestSimilar(unknownName, candidateNames); } @@ -46704,11 +46911,12 @@ Expecting one of '${allowedValues.join("', '")}'`); * Set the description. * * @param {string} [str] - * @param {Object} [argsDescription] + * @param {object} [argsDescription] * @return {(string|Command)} */ description(str, argsDescription) { - if (str === undefined && argsDescription === undefined) return this._description; + if (str === undefined && argsDescription === undefined) + return this._description; this._description = str; if (argsDescription) { this._argsDescription = argsDescription; @@ -46741,18 +46949,27 @@ Expecting one of '${allowedValues.join("', '")}'`); if (alias === undefined) return this._aliases[0]; // just return first, for backwards compatibility /** @type {Command} */ + // eslint-disable-next-line @typescript-eslint/no-this-alias let command = this; - if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) { + if ( + this.commands.length !== 0 && + this.commands[this.commands.length - 1]._executableHandler + ) { // assume adding alias for last added executable subcommand, rather than this command = this.commands[this.commands.length - 1]; } - if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); + if (alias === command._name) + throw new Error("Command alias can't be the same as its name"); const matchingCommand = this.parent?._findCommand(alias); if (matchingCommand) { // c.f. _registerCommand - const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join('|'); - throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`); + const existingCmd = [matchingCommand.name()] + .concat(matchingCommand.aliases()) + .join('|'); + throw new Error( + `cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`, + ); } command._aliases.push(alias); @@ -46790,11 +47007,13 @@ Expecting one of '${allowedValues.join("', '")}'`); const args = this.registeredArguments.map((arg) => { return humanReadableArgName(arg); }); - return [].concat( - (this.options.length || (this._helpOption !== null) ? '[options]' : []), - (this.commands.length ? '[command]' : []), - (this.registeredArguments.length ? args : []) - ).join(' '); + return [] + .concat( + this.options.length || this._helpOption !== null ? '[options]' : [], + this.commands.length ? '[command]' : [], + this.registeredArguments.length ? args : [], + ) + .join(' '); } this._usage = str; @@ -46861,7 +47080,10 @@ Expecting one of '${allowedValues.join("', '")}'`); helpInformation(contextOptions) { const helper = this.createHelp(); if (helper.helpWidth === undefined) { - helper.helpWidth = (contextOptions && contextOptions.error) ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth(); + helper.helpWidth = + contextOptions && contextOptions.error + ? this._outputConfiguration.getErrHelpWidth() + : this._outputConfiguration.getOutHelpWidth(); } return helper.formatHelp(this, helper); } @@ -46900,13 +47122,18 @@ Expecting one of '${allowedValues.join("', '")}'`); } const context = this._getHelpContext(contextOptions); - this._getCommandAndAncestors().reverse().forEach(command => command.emit('beforeAllHelp', context)); + this._getCommandAndAncestors() + .reverse() + .forEach((command) => command.emit('beforeAllHelp', context)); this.emit('beforeHelp', context); let helpInformation = this.helpInformation(context); if (deprecatedCallback) { helpInformation = deprecatedCallback(helpInformation); - if (typeof helpInformation !== 'string' && !Buffer.isBuffer(helpInformation)) { + if ( + typeof helpInformation !== 'string' && + !Buffer.isBuffer(helpInformation) + ) { throw new Error('outputHelp callback must return a string or a Buffer'); } } @@ -46916,7 +47143,9 @@ Expecting one of '${allowedValues.join("', '")}'`); this.emit(this._getHelpOption().long); // deprecated } this.emit('afterHelp', context); - this._getCommandAndAncestors().forEach(command => command.emit('afterAllHelp', context)); + this._getCommandAndAncestors().forEach((command) => + command.emit('afterAllHelp', context), + ); } /** @@ -46956,7 +47185,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Returns null if has been disabled with .helpOption(false). * * @returns {(Option | null)} the help option - * @package internal use only + * @package */ _getHelpOption() { // Lazy create help option on demand. @@ -46989,7 +47218,12 @@ Expecting one of '${allowedValues.join("', '")}'`); help(contextOptions) { this.outputHelp(contextOptions); let exitCode = process.exitCode || 0; - if (exitCode === 0 && contextOptions && typeof contextOptions !== 'function' && contextOptions.error) { + if ( + exitCode === 0 && + contextOptions && + typeof contextOptions !== 'function' && + contextOptions.error + ) { exitCode = 1; } // message: do not have all displayed text available so only passing placeholder. @@ -47037,7 +47271,7 @@ Expecting one of '${allowedValues.join("', '")}'`); _outputHelpIfRequested(args) { const helpOption = this._getHelpOption(); - const helpRequested = helpOption && args.find(arg => helpOption.is(arg)); + const helpRequested = helpOption && args.find((arg) => helpOption.is(arg)); if (helpRequested) { this.outputHelp(); // (Do not have all displayed text available so only passing placeholder.) @@ -47070,7 +47304,9 @@ function incrementNodeInspectorPort(args) { if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) { // e.g. --inspect debugOption = match[1]; - } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) { + } else if ( + (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null + ) { debugOption = match[1]; if (/^\d+$/.test(match[3])) { // e.g. --inspect=1234 @@ -47079,7 +47315,9 @@ function incrementNodeInspectorPort(args) { // e.g. --inspect=localhost debugHost = match[3]; } - } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) { + } else if ( + (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null + ) { // e.g. --inspect=localhost:1234 debugOption = match[1]; debugHost = match[3]; @@ -47103,7 +47341,6 @@ exports.Command = Command; /** * CommanderError class - * @class */ class CommanderError extends Error { /** @@ -47111,7 +47348,6 @@ class CommanderError extends Error { * @param {number} exitCode suggested exit code which could be used with process.exit * @param {string} code an id string representing the error * @param {string} message human-readable description of the error - * @constructor */ constructor(exitCode, code, message) { super(message); @@ -47126,13 +47362,11 @@ class CommanderError extends Error { /** * InvalidArgumentError class - * @class */ class InvalidArgumentError extends CommanderError { /** * Constructs the InvalidArgumentError class * @param {string} [message] explanation of why argument is invalid - * @constructor */ constructor(message) { super(1, 'commander.invalidArgument', message); @@ -47178,14 +47412,14 @@ class Help { */ visibleCommands(cmd) { - const visibleCommands = cmd.commands.filter(cmd => !cmd._hidden); + const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden); const helpCommand = cmd._getHelpCommand(); if (helpCommand && !helpCommand._hidden) { visibleCommands.push(helpCommand); } if (this.sortSubcommands) { visibleCommands.sort((a, b) => { - // @ts-ignore: overloaded return type + // @ts-ignore: because overloaded return type return a.name().localeCompare(b.name()); }); } @@ -47197,12 +47431,14 @@ class Help { * * @param {Option} a * @param {Option} b - * @returns number + * @returns {number} */ compareOptions(a, b) { const getSortKey = (option) => { // WYSIWYG for order displayed in help. Short used for comparison if present. No special handling for negated. - return option.short ? option.short.replace(/^-/, '') : option.long.replace(/^--/, ''); + return option.short + ? option.short.replace(/^-/, '') + : option.long.replace(/^--/, ''); }; return getSortKey(a).localeCompare(getSortKey(b)); } @@ -47225,9 +47461,13 @@ class Help { if (!removeShort && !removeLong) { visibleOptions.push(helpOption); // no changes needed } else if (helpOption.long && !removeLong) { - visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description)); + visibleOptions.push( + cmd.createOption(helpOption.long, helpOption.description), + ); } else if (helpOption.short && !removeShort) { - visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description)); + visibleOptions.push( + cmd.createOption(helpOption.short, helpOption.description), + ); } } if (this.sortOptions) { @@ -47247,8 +47487,14 @@ class Help { if (!this.showGlobalOptions) return []; const globalOptions = []; - for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) { - const visibleOptions = ancestorCmd.options.filter((option) => !option.hidden); + for ( + let ancestorCmd = cmd.parent; + ancestorCmd; + ancestorCmd = ancestorCmd.parent + ) { + const visibleOptions = ancestorCmd.options.filter( + (option) => !option.hidden, + ); globalOptions.push(...visibleOptions); } if (this.sortOptions) { @@ -47267,13 +47513,14 @@ class Help { visibleArguments(cmd) { // Side effect! Apply the legacy descriptions before the arguments are displayed. if (cmd._argsDescription) { - cmd.registeredArguments.forEach(argument => { - argument.description = argument.description || cmd._argsDescription[argument.name()] || ''; + cmd.registeredArguments.forEach((argument) => { + argument.description = + argument.description || cmd._argsDescription[argument.name()] || ''; }); } // If there are any arguments with a description then return all the arguments. - if (cmd.registeredArguments.find(argument => argument.description)) { + if (cmd.registeredArguments.find((argument) => argument.description)) { return cmd.registeredArguments; } return []; @@ -47288,11 +47535,15 @@ class Help { subcommandTerm(cmd) { // Legacy. Ignores custom usage string, and nested commands. - const args = cmd.registeredArguments.map(arg => humanReadableArgName(arg)).join(' '); - return cmd._name + + const args = cmd.registeredArguments + .map((arg) => humanReadableArgName(arg)) + .join(' '); + return ( + cmd._name + (cmd._aliases[0] ? '|' + cmd._aliases[0] : '') + (cmd.options.length ? ' [options]' : '') + // simplistic check for non-help option - (args ? ' ' + args : ''); + (args ? ' ' + args : '') + ); } /** @@ -47387,7 +47638,11 @@ class Help { cmdName = cmdName + '|' + cmd._aliases[0]; } let ancestorCmdNames = ''; - for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) { + for ( + let ancestorCmd = cmd.parent; + ancestorCmd; + ancestorCmd = ancestorCmd.parent + ) { ancestorCmdNames = ancestorCmd.name() + ' ' + ancestorCmdNames; } return ancestorCmdNames + cmdName + ' ' + cmd.usage(); @@ -47401,7 +47656,7 @@ class Help { */ commandDescription(cmd) { - // @ts-ignore: overloaded return type + // @ts-ignore: because overloaded return type return cmd.description(); } @@ -47414,7 +47669,7 @@ class Help { */ subcommandDescription(cmd) { - // @ts-ignore: overloaded return type + // @ts-ignore: because overloaded return type return cmd.summary() || cmd.description(); } @@ -47431,15 +47686,20 @@ class Help { if (option.argChoices) { extraInfo.push( // use stringify to match the display of the default value - `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`); + `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`, + ); } if (option.defaultValue !== undefined) { // default for boolean and negated more for programmer than end user, // but show true/false for boolean option as may be for hand-rolled env or config processing. - const showDefault = option.required || option.optional || + const showDefault = + option.required || + option.optional || (option.isBoolean() && typeof option.defaultValue === 'boolean'); if (showDefault) { - extraInfo.push(`default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`); + extraInfo.push( + `default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`, + ); } } // preset for boolean and negated are more for programmer than end user @@ -47468,10 +47728,13 @@ class Help { if (argument.argChoices) { extraInfo.push( // use stringify to match the display of the default value - `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`); + `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`, + ); } if (argument.defaultValue !== undefined) { - extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`); + extraInfo.push( + `default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`, + ); } if (extraInfo.length > 0) { const extraDescripton = `(${extraInfo.join(', ')})`; @@ -47499,7 +47762,11 @@ class Help { function formatItem(term, description) { if (description) { const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`; - return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth); + return helper.wrap( + fullText, + helpWidth - itemIndentWidth, + termWidth + itemSeparatorWidth, + ); } return term; } @@ -47513,12 +47780,18 @@ class Help { // Description const commandDescription = helper.commandDescription(cmd); if (commandDescription.length > 0) { - output = output.concat([helper.wrap(commandDescription, helpWidth, 0), '']); + output = output.concat([ + helper.wrap(commandDescription, helpWidth, 0), + '', + ]); } // Arguments const argumentList = helper.visibleArguments(cmd).map((argument) => { - return formatItem(helper.argumentTerm(argument), helper.argumentDescription(argument)); + return formatItem( + helper.argumentTerm(argument), + helper.argumentDescription(argument), + ); }); if (argumentList.length > 0) { output = output.concat(['Arguments:', formatList(argumentList), '']); @@ -47526,24 +47799,39 @@ class Help { // Options const optionList = helper.visibleOptions(cmd).map((option) => { - return formatItem(helper.optionTerm(option), helper.optionDescription(option)); + return formatItem( + helper.optionTerm(option), + helper.optionDescription(option), + ); }); if (optionList.length > 0) { output = output.concat(['Options:', formatList(optionList), '']); } if (this.showGlobalOptions) { - const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => { - return formatItem(helper.optionTerm(option), helper.optionDescription(option)); - }); + const globalOptionList = helper + .visibleGlobalOptions(cmd) + .map((option) => { + return formatItem( + helper.optionTerm(option), + helper.optionDescription(option), + ); + }); if (globalOptionList.length > 0) { - output = output.concat(['Global Options:', formatList(globalOptionList), '']); + output = output.concat([ + 'Global Options:', + formatList(globalOptionList), + '', + ]); } } // Commands const commandList = helper.visibleCommands(cmd).map((cmd) => { - return formatItem(helper.subcommandTerm(cmd), helper.subcommandDescription(cmd)); + return formatItem( + helper.subcommandTerm(cmd), + helper.subcommandDescription(cmd), + ); }); if (commandList.length > 0) { output = output.concat(['Commands:', formatList(commandList), '']); @@ -47565,7 +47853,7 @@ class Help { helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), - helper.longestArgumentTermLength(cmd, helper) + helper.longestArgumentTermLength(cmd, helper), ); } @@ -47583,7 +47871,8 @@ class Help { wrap(str, width, indent, minColumnWidth = 40) { // Full \s characters, minus the linefeeds. - const indents = ' \\f\\t\\v\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff'; + const indents = + ' \\f\\t\\v\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff'; // Detect manually wrapped and indented strings by searching for line break followed by spaces. const manualIndent = new RegExp(`[\\n][${indents}]+`); if (str.match(manualIndent)) return str; @@ -47598,12 +47887,20 @@ class Help { const breaks = `\\s${zeroWidthSpace}`; // Match line end (so empty lines don't collapse), // or as much text as will fit in column, or excess text up to first break. - const regex = new RegExp(`\n|.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`, 'g'); + const regex = new RegExp( + `\n|.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`, + 'g', + ); const lines = columnText.match(regex) || []; - return leadingStr + lines.map((line, i) => { - if (line === '\n') return ''; // preserve empty lines - return ((i > 0) ? indentString : '') + line.trimEnd(); - }).join('\n'); + return ( + leadingStr + + lines + .map((line, i) => { + if (line === '\n') return ''; // preserve empty lines + return (i > 0 ? indentString : '') + line.trimEnd(); + }) + .join('\n') + ); } } @@ -47710,7 +48007,7 @@ class Option { * .addOption(new Option('--log', 'write logging information to file')) * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' })); * - * @param {Object} impliedOptionValues + * @param {object} impliedOptionValues * @return {Option} */ implies(impliedOptionValues) { @@ -47775,7 +48072,7 @@ class Option { } /** - * @package internal use only + * @package */ _concatValue(value, previous) { @@ -47797,7 +48094,9 @@ class Option { this.argChoices = values.slice(); this.parseArg = (arg, previous) => { if (!this.argChoices.includes(arg)) { - throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(', ')}.`); + throw new InvalidArgumentError( + `Allowed choices are ${this.argChoices.join(', ')}.`, + ); } if (this.variadic) { return this._concatValue(arg, previous); @@ -47836,7 +48135,7 @@ class Option { * * @param {string} arg * @return {boolean} - * @package internal use only + * @package */ is(arg) { @@ -47849,7 +48148,7 @@ class Option { * Options are one of boolean, negated, required argument, or optional argument. * * @return {boolean} - * @package internal use only + * @package */ isBoolean() { @@ -47872,7 +48171,7 @@ class DualOptions { this.positiveOptions = new Map(); this.negativeOptions = new Map(); this.dualOptions = new Set(); - options.forEach(option => { + options.forEach((option) => { if (option.negate) { this.negativeOptions.set(option.attributeName(), option); } else { @@ -47899,7 +48198,7 @@ class DualOptions { // Use the value to deduce if (probably) came from the option. const preset = this.negativeOptions.get(optionKey).presetArg; - const negativeValue = (preset !== undefined) ? preset : false; + const negativeValue = preset !== undefined ? preset : false; return option.negate === (negativeValue === value); } } @@ -47930,7 +48229,8 @@ function splitOptionFlags(flags) { // Use original very loose parsing to maintain backwards compatibility for now, // which allowed for example unintended `-sw, --short-word` [sic]. const flagParts = flags.split(/[ |,]+/); - if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1])) shortFlag = flagParts.shift(); + if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1])) + shortFlag = flagParts.shift(); longFlag = flagParts.shift(); // Add support for lone short flag without significantly changing parsing! if (!shortFlag && /^-[^-]$/.test(longFlag)) { @@ -47957,7 +48257,8 @@ function editDistance(a, b) { // (Simple implementation.) // Quick early exit, return worst case. - if (Math.abs(a.length - b.length) > maxDistance) return Math.max(a.length, b.length); + if (Math.abs(a.length - b.length) > maxDistance) + return Math.max(a.length, b.length); // distance between prefix substrings of a and b const d = []; @@ -47983,7 +48284,7 @@ function editDistance(a, b) { d[i][j] = Math.min( d[i - 1][j] + 1, // deletion d[i][j - 1] + 1, // insertion - d[i - 1][j - 1] + cost // substitution + d[i - 1][j - 1] + cost, // substitution ); // transposition if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { @@ -48011,7 +48312,7 @@ function suggestSimilar(word, candidates) { const searchingOptions = word.startsWith('--'); if (searchingOptions) { word = word.slice(2); - candidates = candidates.map(candidate => candidate.slice(2)); + candidates = candidates.map((candidate) => candidate.slice(2)); } let similar = []; @@ -48036,7 +48337,7 @@ function suggestSimilar(word, candidates) { similar.sort((a, b) => a.localeCompare(b)); if (searchingOptions) { - similar = similar.map(candidate => `--${candidate}`); + similar = similar.map((candidate) => `--${candidate}`); } if (similar.length > 1) { diff --git a/lib/precommit/index.js b/lib/precommit/index.js index 0821227..6ec37d5 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -11439,7 +11439,7 @@ function buildValues(diff, lastComponent, newString, oldString, useLongestToken) /***/ }), -/***/ 1005: +/***/ 2081: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -12123,7 +12123,7 @@ _base = _interopRequireDefault(__nccwpck_require__(1653)) var /*istanbul ignore start*/ -_character = __nccwpck_require__(1005) +_character = __nccwpck_require__(2081) /*istanbul ignore end*/ ; @@ -15825,7 +15825,7 @@ var import_child_process, GitExecutorChain; var init_git_executor_chain = __esm({ "src/lib/runners/git-executor-chain.ts"() { "use strict"; - import_child_process = __nccwpck_require__(2081); + import_child_process = __nccwpck_require__(8493); init_git_error(); init_task(); init_utils(); @@ -42735,7 +42735,7 @@ module.exports = require("buffer"); /***/ }), -/***/ 2081: +/***/ 8493: /***/ ((module) => { "use strict"; @@ -42815,6 +42815,14 @@ module.exports = require("net"); /***/ }), +/***/ 7718: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:child_process"); + +/***/ }), + /***/ 5673: /***/ ((module) => { @@ -42823,6 +42831,30 @@ module.exports = require("node:events"); /***/ }), +/***/ 7561: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:fs"); + +/***/ }), + +/***/ 9411: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:path"); + +/***/ }), + +/***/ 7742: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:process"); + +/***/ }), + /***/ 4492: /***/ ((module) => { @@ -42863,14 +42895,6 @@ module.exports = require("perf_hooks"); /***/ }), -/***/ 7282: -/***/ ((module) => { - -"use strict"; -module.exports = require("process"); - -/***/ }), - /***/ 3477: /***/ ((module) => { @@ -44678,7 +44702,7 @@ class Argument { } /** - * @package internal use only + * @package */ _concatValue(value, previous) { @@ -44726,7 +44750,9 @@ class Argument { this.argChoices = values.slice(); this.parseArg = (arg, previous) => { if (!this.argChoices.includes(arg)) { - throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(', ')}.`); + throw new InvalidArgumentError( + `Allowed choices are ${this.argChoices.join(', ')}.`, + ); } if (this.variadic) { return this._concatValue(arg, previous); @@ -44738,6 +44764,8 @@ class Argument { /** * Make argument required. + * + * @returns {Argument} */ argRequired() { this.required = true; @@ -44746,6 +44774,8 @@ class Argument { /** * Make argument optional. + * + * @returns {Argument} */ argOptional() { this.required = false; @@ -44764,9 +44794,7 @@ class Argument { function humanReadableArgName(arg) { const nameOutput = arg.name() + (arg.variadic === true ? '...' : ''); - return arg.required - ? '<' + nameOutput + '>' - : '[' + nameOutput + ']'; + return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']'; } exports.Argument = Argument; @@ -44778,11 +44806,11 @@ exports.humanReadableArgName = humanReadableArgName; /***/ 552: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -const EventEmitter = (__nccwpck_require__(2361).EventEmitter); -const childProcess = __nccwpck_require__(2081); -const path = __nccwpck_require__(1017); -const fs = __nccwpck_require__(7147); -const process = __nccwpck_require__(7282); +const EventEmitter = (__nccwpck_require__(5673).EventEmitter); +const childProcess = __nccwpck_require__(7718); +const path = __nccwpck_require__(9411); +const fs = __nccwpck_require__(7561); +const process = __nccwpck_require__(7742); const { Argument, humanReadableArgName } = __nccwpck_require__(9414); const { CommanderError } = __nccwpck_require__(2625); @@ -44840,9 +44868,11 @@ class Command extends EventEmitter { this._outputConfiguration = { writeOut: (str) => process.stdout.write(str), writeErr: (str) => process.stderr.write(str), - getOutHelpWidth: () => process.stdout.isTTY ? process.stdout.columns : undefined, - getErrHelpWidth: () => process.stderr.isTTY ? process.stderr.columns : undefined, - outputError: (str, write) => write(str) + getOutHelpWidth: () => + process.stdout.isTTY ? process.stdout.columns : undefined, + getErrHelpWidth: () => + process.stderr.isTTY ? process.stderr.columns : undefined, + outputError: (str, write) => write(str), }; this._hidden = false; @@ -44869,7 +44899,8 @@ class Command extends EventEmitter { this._helpConfiguration = sourceCommand._helpConfiguration; this._exitCallback = sourceCommand._exitCallback; this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties; - this._combineFlagAndOptionalValue = sourceCommand._combineFlagAndOptionalValue; + this._combineFlagAndOptionalValue = + sourceCommand._combineFlagAndOptionalValue; this._allowExcessArguments = sourceCommand._allowExcessArguments; this._enablePositionalOptions = sourceCommand._enablePositionalOptions; this._showHelpAfterError = sourceCommand._showHelpAfterError; @@ -44885,6 +44916,7 @@ class Command extends EventEmitter { _getCommandAndAncestors() { const result = []; + // eslint-disable-next-line @typescript-eslint/no-this-alias for (let command = this; command; command = command.parent) { result.push(command); } @@ -44911,8 +44943,8 @@ class Command extends EventEmitter { * .command('stop [service]', 'stop named service, or all if no name supplied'); * * @param {string} nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` - * @param {(Object|string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) - * @param {Object} [execOpts] - configuration options (for executable) + * @param {(object | string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) + * @param {object} [execOpts] - configuration options (for executable) * @return {Command} returns new command for action handler, or `this` for executable command */ @@ -44972,8 +45004,8 @@ class Command extends EventEmitter { * You can customise the help by overriding Help properties using configureHelp(), * or with a subclass of Help by overriding createHelp(). * - * @param {Object} [configuration] - configuration options - * @return {(Command|Object)} `this` command for chaining, or stored configuration + * @param {object} [configuration] - configuration options + * @return {(Command | object)} `this` command for chaining, or stored configuration */ configureHelp(configuration) { @@ -44998,8 +45030,8 @@ class Command extends EventEmitter { * // functions based on what is being written out * outputError(str, write) // used for displaying errors, and not used for displaying help * - * @param {Object} [configuration] - configuration options - * @return {(Command|Object)} `this` command for chaining, or stored configuration + * @param {object} [configuration] - configuration options + * @return {(Command | object)} `this` command for chaining, or stored configuration */ configureOutput(configuration) { @@ -45038,7 +45070,7 @@ class Command extends EventEmitter { * See .command() for creating an attached subcommand which inherits settings from its parent. * * @param {Command} cmd - new subcommand - * @param {Object} [opts] - configuration options + * @param {object} [opts] - configuration options * @return {Command} `this` command for chaining */ @@ -45114,9 +45146,12 @@ class Command extends EventEmitter { */ arguments(names) { - names.trim().split(/ +/).forEach((detail) => { - this.argument(detail); - }); + names + .trim() + .split(/ +/) + .forEach((detail) => { + this.argument(detail); + }); return this; } @@ -45129,10 +45164,18 @@ class Command extends EventEmitter { addArgument(argument) { const previousArgument = this.registeredArguments.slice(-1)[0]; if (previousArgument && previousArgument.variadic) { - throw new Error(`only the last argument can be variadic '${previousArgument.name()}'`); + throw new Error( + `only the last argument can be variadic '${previousArgument.name()}'`, + ); } - if (argument.required && argument.defaultValue !== undefined && argument.parseArg === undefined) { - throw new Error(`a default value for a required argument is never used: '${argument.name()}'`); + if ( + argument.required && + argument.defaultValue !== undefined && + argument.parseArg === undefined + ) { + throw new Error( + `a default value for a required argument is never used: '${argument.name()}'`, + ); } this.registeredArguments.push(argument); return this; @@ -45141,6 +45184,7 @@ class Command extends EventEmitter { /** * Customise or override default help command. By default a help command is automatically added if your command has subcommands. * + * @example * program.helpCommand('help [cmd]'); * program.helpCommand('help [cmd]', 'show help'); * program.helpCommand(false); // suppress default help command @@ -45199,8 +45243,11 @@ class Command extends EventEmitter { * @package */ _getHelpCommand() { - const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? - (this.commands.length && !this._actionHandler && !this._findCommand('help')); + const hasImplicitHelpCommand = + this._addImplicitHelpCommand ?? + (this.commands.length && + !this._actionHandler && + !this._findCommand('help')); if (hasImplicitHelpCommand) { if (this._helpCommand === undefined) { @@ -45348,14 +45395,18 @@ Expecting one of '${allowedValues.join("', '")}'`); * Register option if no conflicts found, or throw on conflict. * * @param {Option} option - * @api private + * @private */ _registerOption(option) { - const matchingOption = (option.short && this._findOption(option.short)) || + const matchingOption = + (option.short && this._findOption(option.short)) || (option.long && this._findOption(option.long)); if (matchingOption) { - const matchingFlag = (option.long && this._findOption(option.long)) ? option.long : option.short; + const matchingFlag = + option.long && this._findOption(option.long) + ? option.long + : option.short; throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}' - already used by option '${matchingOption.flags}'`); } @@ -45368,7 +45419,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Register command if no conflicts found, or throw on conflict. * * @param {Command} command - * @api private + * @private */ _registerCommand(command) { @@ -45376,11 +45427,15 @@ Expecting one of '${allowedValues.join("', '")}'`); return [cmd.name()].concat(cmd.aliases()); }; - const alreadyUsed = knownBy(command).find((name) => this._findCommand(name)); + const alreadyUsed = knownBy(command).find((name) => + this._findCommand(name), + ); if (alreadyUsed) { const existingCmd = knownBy(this._findCommand(alreadyUsed)).join('|'); const newCmd = knownBy(command).join('|'); - throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`); + throw new Error( + `cannot add command '${newCmd}' as already have command '${existingCmd}'`, + ); } this.commands.push(command); @@ -45403,7 +45458,11 @@ Expecting one of '${allowedValues.join("', '")}'`); // --no-foo is special and defaults foo to true, unless a --foo option is already defined const positiveLongFlag = option.long.replace(/^--no-/, '--'); if (!this._findOption(positiveLongFlag)) { - this.setOptionValueWithSource(name, option.defaultValue === undefined ? true : option.defaultValue, 'default'); + this.setOptionValueWithSource( + name, + option.defaultValue === undefined ? true : option.defaultValue, + 'default', + ); } } else if (option.defaultValue !== undefined) { this.setOptionValueWithSource(name, option.defaultValue, 'default'); @@ -45456,11 +45515,14 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Internal implementation shared by .option() and .requiredOption() * + * @return {Command} `this` command for chaining * @private */ _optionEx(config, flags, description, fn, defaultValue) { if (typeof flags === 'object' && flags instanceof Option) { - throw new Error('To add an Option object use addOption() instead of option() or requiredOption()'); + throw new Error( + 'To add an Option object use addOption() instead of option() or requiredOption()', + ); } const option = this.createOption(flags, description); option.makeOptionMandatory(!!config.mandatory); @@ -45508,20 +45570,26 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * Add a required option which must have a value after parsing. This usually means - * the option must be specified on the command line. (Otherwise the same as .option().) - * - * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. - * - * @param {string} flags - * @param {string} [description] - * @param {(Function|*)} [parseArg] - custom option processing function or default value - * @param {*} [defaultValue] - * @return {Command} `this` command for chaining - */ + * Add a required option which must have a value after parsing. This usually means + * the option must be specified on the command line. (Otherwise the same as .option().) + * + * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. + * + * @param {string} flags + * @param {string} [description] + * @param {(Function|*)} [parseArg] - custom option processing function or default value + * @param {*} [defaultValue] + * @return {Command} `this` command for chaining + */ requiredOption(flags, description, parseArg, defaultValue) { - return this._optionEx({ mandatory: true }, flags, description, parseArg, defaultValue); + return this._optionEx( + { mandatory: true }, + flags, + description, + parseArg, + defaultValue, + ); } /** @@ -45532,7 +45600,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b` * - * @param {boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag. + * @param {boolean} [combine] - if `true` or omitted, an optional value can be specified directly after the flag. + * @return {Command} `this` command for chaining */ combineFlagAndOptionalValue(combine = true) { this._combineFlagAndOptionalValue = !!combine; @@ -45542,8 +45611,8 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow unknown options on the command line. * - * @param {boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown - * for unknown options. + * @param {boolean} [allowUnknown] - if `true` or omitted, no error will be thrown for unknown options. + * @return {Command} `this` command for chaining */ allowUnknownOption(allowUnknown = true) { this._allowUnknownOption = !!allowUnknown; @@ -45553,8 +45622,8 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow excess command-arguments on the command line. Pass false to make excess arguments an error. * - * @param {boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown - * for excess arguments. + * @param {boolean} [allowExcess] - if `true` or omitted, no error will be thrown for excess arguments. + * @return {Command} `this` command for chaining */ allowExcessArguments(allowExcess = true) { this._allowExcessArguments = !!allowExcess; @@ -45566,7 +45635,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions. * The default behaviour is non-positional and global options may appear anywhere on the command line. * - * @param {boolean} [positional=true] + * @param {boolean} [positional] + * @return {Command} `this` command for chaining */ enablePositionalOptions(positional = true) { this._enablePositionalOptions = !!positional; @@ -45579,8 +45649,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * positional options to have been enabled on the program (parent commands). * The default behaviour is non-positional and options may appear before or after command-arguments. * - * @param {boolean} [passThrough=true] - * for unknown options. + * @param {boolean} [passThrough] for unknown options. + * @return {Command} `this` command for chaining */ passThroughOptions(passThrough = true) { this._passThroughOptions = !!passThrough; @@ -45593,25 +45663,33 @@ Expecting one of '${allowedValues.join("', '")}'`); */ _checkForBrokenPassThrough() { - if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) { - throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`); + if ( + this.parent && + this._passThroughOptions && + !this.parent._enablePositionalOptions + ) { + throw new Error( + `passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`, + ); } } /** - * Whether to store option values as properties on command object, - * or store separately (specify false). In both cases the option values can be accessed using .opts(). - * - * @param {boolean} [storeAsProperties=true] - * @return {Command} `this` command for chaining - */ + * Whether to store option values as properties on command object, + * or store separately (specify false). In both cases the option values can be accessed using .opts(). + * + * @param {boolean} [storeAsProperties=true] + * @return {Command} `this` command for chaining + */ storeOptionsAsProperties(storeAsProperties = true) { if (this.options.length) { throw new Error('call .storeOptionsAsProperties() before adding options'); } if (Object.keys(this._optionValues).length) { - throw new Error('call .storeOptionsAsProperties() before setting option values'); + throw new Error( + 'call .storeOptionsAsProperties() before setting option values', + ); } this._storeOptionsAsProperties = !!storeAsProperties; return this; @@ -45621,7 +45699,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Retrieve option value. * * @param {string} key - * @return {Object} value + * @return {object} value */ getOptionValue(key) { @@ -45635,7 +45713,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Store option value. * * @param {string} key - * @param {Object} value + * @param {object} value * @return {Command} `this` command for chaining */ @@ -45644,13 +45722,13 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * Store option value and where the value came from. - * - * @param {string} key - * @param {Object} value - * @param {string} source - expected values are default/config/env/cli/implied - * @return {Command} `this` command for chaining - */ + * Store option value and where the value came from. + * + * @param {string} key + * @param {object} value + * @param {string} source - expected values are default/config/env/cli/implied + * @return {Command} `this` command for chaining + */ setOptionValueWithSource(key, value, source) { if (this._storeOptionsAsProperties) { @@ -45663,24 +45741,24 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * Get source of option value. - * Expected values are default | config | env | cli | implied - * - * @param {string} key - * @return {string} - */ + * Get source of option value. + * Expected values are default | config | env | cli | implied + * + * @param {string} key + * @return {string} + */ getOptionValueSource(key) { return this._optionValueSources[key]; } /** - * Get source of option value. See also .optsWithGlobals(). - * Expected values are default | config | env | cli | implied - * - * @param {string} key - * @return {string} - */ + * Get source of option value. See also .optsWithGlobals(). + * Expected values are default | config | env | cli | implied + * + * @param {string} key + * @return {string} + */ getOptionValueSourceWithGlobals(key) { // global overwrites local, like optsWithGlobals @@ -45706,17 +45784,30 @@ Expecting one of '${allowedValues.join("', '")}'`); } parseOptions = parseOptions || {}; - // Default to using process.argv - if (argv === undefined) { - argv = process.argv; - // @ts-ignore: unknown property - if (process.versions && process.versions.electron) { + // auto-detect argument conventions if nothing supplied + if (argv === undefined && parseOptions.from === undefined) { + if (process.versions?.electron) { parseOptions.from = 'electron'; } + // check node specific options for scenarios where user CLI args follow executable without scriptname + const execArgv = process.execArgv ?? []; + if ( + execArgv.includes('-e') || + execArgv.includes('--eval') || + execArgv.includes('-p') || + execArgv.includes('--print') + ) { + parseOptions.from = 'eval'; // internal usage, not documented + } + } + + // default to using process.argv + if (argv === undefined) { + argv = process.argv; } this.rawArgs = argv.slice(); - // make it a little easier for callers by supporting various argv conventions + // extract the user args and scriptPath let userArgs; switch (parseOptions.from) { case undefined: @@ -45725,7 +45816,7 @@ Expecting one of '${allowedValues.join("', '")}'`); userArgs = argv.slice(2); break; case 'electron': - // @ts-ignore: unknown property + // @ts-ignore: because defaultApp is an unknown property if (process.defaultApp) { this._scriptPath = argv[1]; userArgs = argv.slice(2); @@ -45736,12 +45827,18 @@ Expecting one of '${allowedValues.join("', '")}'`); case 'user': userArgs = argv.slice(0); break; + case 'eval': + userArgs = argv.slice(1); + break; default: - throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`); + throw new Error( + `unexpected parse option { from: '${parseOptions.from}' }`, + ); } // Find default name for program from arguments. - if (!this._name && this._scriptPath) this.nameFromFilename(this._scriptPath); + if (!this._name && this._scriptPath) + this.nameFromFilename(this._scriptPath); this._name = this._name || 'program'; return userArgs; @@ -45750,16 +45847,22 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Parse `argv`, setting options and invoking commands when defined. * - * The default expectation is that the arguments are from node and have the application as argv[0] - * and the script being run in argv[1], with user parameters after that. + * Use parseAsync instead of parse if any of your action handlers are async. + * + * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode! + * + * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`: + * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that + * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged + * - `'user'`: just user arguments * * @example - * program.parse(process.argv); - * program.parse(); // implicitly use process.argv and auto-detect node vs electron conventions + * program.parse(); // parse process.argv and auto-detect electron and special node flags + * program.parse(process.argv); // assume argv[0] is app and argv[1] is script * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0] * * @param {string[]} [argv] - optional, defaults to process.argv - * @param {Object} [parseOptions] - optionally specify style of options with from: node/user/electron + * @param {object} [parseOptions] - optionally specify style of options with from: node/user/electron * @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron' * @return {Command} `this` command for chaining */ @@ -45774,18 +45877,20 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Parse `argv`, setting options and invoking commands when defined. * - * Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise. + * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode! * - * The default expectation is that the arguments are from node and have the application as argv[0] - * and the script being run in argv[1], with user parameters after that. + * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`: + * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that + * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged + * - `'user'`: just user arguments * * @example - * await program.parseAsync(process.argv); - * await program.parseAsync(); // implicitly use process.argv and auto-detect node vs electron conventions + * await program.parseAsync(); // parse process.argv and auto-detect electron and special node flags + * await program.parseAsync(process.argv); // assume argv[0] is app and argv[1] is script * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0] * * @param {string[]} [argv] - * @param {Object} [parseOptions] + * @param {object} [parseOptions] * @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron' * @return {Promise} */ @@ -45817,7 +45922,9 @@ Expecting one of '${allowedValues.join("', '")}'`); if (sourceExt.includes(path.extname(baseName))) return undefined; // Try all the extensions. - const foundExt = sourceExt.find(ext => fs.existsSync(`${localBin}${ext}`)); + const foundExt = sourceExt.find((ext) => + fs.existsSync(`${localBin}${ext}`), + ); if (foundExt) return `${localBin}${foundExt}`; return undefined; @@ -45828,7 +45935,8 @@ Expecting one of '${allowedValues.join("', '")}'`); this._checkForConflictingOptions(); // executableFile and executableDir might be full path, or just a name - let executableFile = subcommand._executableFile || `${this._name}-${subcommand._name}`; + let executableFile = + subcommand._executableFile || `${this._name}-${subcommand._name}`; let executableDir = this._executableDir || ''; if (this._scriptPath) { let resolvedScriptPath; // resolve possible symlink for installed npm binary @@ -45837,7 +45945,10 @@ Expecting one of '${allowedValues.join("', '")}'`); } catch (err) { resolvedScriptPath = this._scriptPath; } - executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir); + executableDir = path.resolve( + path.dirname(resolvedScriptPath), + executableDir, + ); } // Look for a local file in preference to a command in PATH. @@ -45846,9 +45957,15 @@ Expecting one of '${allowedValues.join("', '")}'`); // Legacy search using prefix of script name instead of command name if (!localFile && !subcommand._executableFile && this._scriptPath) { - const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath)); + const legacyName = path.basename( + this._scriptPath, + path.extname(this._scriptPath), + ); if (legacyName !== this._name) { - localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`); + localFile = findFile( + executableDir, + `${legacyName}-${subcommand._name}`, + ); } } executableFile = localFile || executableFile; @@ -45874,12 +45991,13 @@ Expecting one of '${allowedValues.join("', '")}'`); proc = childProcess.spawn(process.execPath, args, { stdio: 'inherit' }); } - if (!proc.killed) { // testing mainly to avoid leak warnings during unit tests with mocked spawn + if (!proc.killed) { + // testing mainly to avoid leak warnings during unit tests with mocked spawn const signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP']; signals.forEach((signal) => { - // @ts-ignore process.on(signal, () => { if (proc.killed === false && proc.exitCode === null) { + // @ts-ignore because signals not typed to known strings proc.kill(signal); } }); @@ -45888,16 +46006,22 @@ Expecting one of '${allowedValues.join("', '")}'`); // By default terminate process when spawned process terminates. const exitCallback = this._exitCallback; - proc.on('close', (code, _signal) => { + proc.on('close', (code) => { code = code ?? 1; // code is null if spawned process terminated due to a signal if (!exitCallback) { process.exit(code); } else { - exitCallback(new CommanderError(code, 'commander.executeSubCommandAsync', '(close)')); + exitCallback( + new CommanderError( + code, + 'commander.executeSubCommandAsync', + '(close)', + ), + ); } }); proc.on('error', (err) => { - // @ts-ignore + // @ts-ignore: because err.code is an unknown property if (err.code === 'ENOENT') { const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` @@ -45907,14 +46031,18 @@ Expecting one of '${allowedValues.join("', '")}'`); - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - ${executableDirMessage}`; throw new Error(executableMissing); - // @ts-ignore + // @ts-ignore: because err.code is an unknown property } else if (err.code === 'EACCES') { throw new Error(`'${executableFile}' not executable`); } if (!exitCallback) { process.exit(1); } else { - const wrappedError = new CommanderError(1, 'commander.executeSubCommandAsync', '(error)'); + const wrappedError = new CommanderError( + 1, + 'commander.executeSubCommandAsync', + '(error)', + ); wrappedError.nestedError = err; exitCallback(wrappedError); } @@ -45933,7 +46061,11 @@ Expecting one of '${allowedValues.join("', '")}'`); if (!subCommand) this.help({ error: true }); let promiseChain; - promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, 'preSubcommand'); + promiseChain = this._chainOrCallSubCommandHook( + promiseChain, + subCommand, + 'preSubcommand', + ); promiseChain = this._chainOrCall(promiseChain, () => { if (subCommand._executableHandler) { this._executeSubCommand(subCommand, operands.concat(unknown)); @@ -45961,9 +46093,11 @@ Expecting one of '${allowedValues.join("', '")}'`); } // Fallback to parsing the help flag to invoke the help. - return this._dispatchSubcommand(subcommandName, [], [ - this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help' - ]); + return this._dispatchSubcommand( + subcommandName, + [], + [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help'], + ); } /** @@ -45980,7 +46114,10 @@ Expecting one of '${allowedValues.join("', '")}'`); } }); // too many - if (this.registeredArguments.length > 0 && this.registeredArguments[this.registeredArguments.length - 1].variadic) { + if ( + this.registeredArguments.length > 0 && + this.registeredArguments[this.registeredArguments.length - 1].variadic + ) { return; } if (this.args.length > this.registeredArguments.length) { @@ -46000,7 +46137,12 @@ Expecting one of '${allowedValues.join("', '")}'`); let parsedValue = value; if (value !== null && argument.parseArg) { const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`; - parsedValue = this._callParseArg(argument, value, previous, invalidValueMessage); + parsedValue = this._callParseArg( + argument, + value, + previous, + invalidValueMessage, + ); } return parsedValue; }; @@ -46065,8 +46207,8 @@ Expecting one of '${allowedValues.join("', '")}'`); const hooks = []; this._getCommandAndAncestors() .reverse() - .filter(cmd => cmd._lifeCycleHooks[event] !== undefined) - .forEach(hookedCommand => { + .filter((cmd) => cmd._lifeCycleHooks[event] !== undefined) + .forEach((hookedCommand) => { hookedCommand._lifeCycleHooks[event].forEach((callback) => { hooks.push({ hookedCommand, callback }); }); @@ -46122,14 +46264,26 @@ Expecting one of '${allowedValues.join("', '")}'`); if (operands && this._findCommand(operands[0])) { return this._dispatchSubcommand(operands[0], operands.slice(1), unknown); } - if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) { + if ( + this._getHelpCommand() && + operands[0] === this._getHelpCommand().name() + ) { return this._dispatchHelpCommand(operands[1]); } if (this._defaultCommandName) { this._outputHelpIfRequested(unknown); // Run the help for default command from parent rather than passing to default command - return this._dispatchSubcommand(this._defaultCommandName, operands, unknown); + return this._dispatchSubcommand( + this._defaultCommandName, + operands, + unknown, + ); } - if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) { + if ( + this.commands.length && + this.args.length === 0 && + !this._actionHandler && + !this._defaultCommandName + ) { // probably missing subcommand and no handler, user needs help (and exit) this.help({ error: true }); } @@ -46152,7 +46306,9 @@ Expecting one of '${allowedValues.join("', '")}'`); let promiseChain; promiseChain = this._chainOrCallHooks(promiseChain, 'preAction'); - promiseChain = this._chainOrCall(promiseChain, () => this._actionHandler(this.processedArgs)); + promiseChain = this._chainOrCall(promiseChain, () => + this._actionHandler(this.processedArgs), + ); if (this.parent) { promiseChain = this._chainOrCall(promiseChain, () => { this.parent.emit(commandEvent, operands, unknown); // legacy @@ -46166,7 +46322,8 @@ Expecting one of '${allowedValues.join("', '")}'`); this._processArguments(); this.parent.emit(commandEvent, operands, unknown); // legacy } else if (operands.length) { - if (this._findCommand('*')) { // legacy default command + if (this._findCommand('*')) { + // legacy default command return this._dispatchSubcommand('*', operands, unknown); } if (this.listenerCount('command:*')) { @@ -46193,10 +46350,13 @@ Expecting one of '${allowedValues.join("', '")}'`); * Find matching command. * * @private + * @return {Command | undefined} */ _findCommand(name) { if (!name) return undefined; - return this.commands.find(cmd => cmd._name === name || cmd._aliases.includes(name)); + return this.commands.find( + (cmd) => cmd._name === name || cmd._aliases.includes(name), + ); } /** @@ -46204,11 +46364,11 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} arg * @return {Option} - * @package internal use only + * @package */ _findOption(arg) { - return this.options.find(option => option.is(arg)); + return this.options.find((option) => option.is(arg)); } /** @@ -46222,7 +46382,10 @@ Expecting one of '${allowedValues.join("', '")}'`); // Walk up hierarchy so can call in subcommand after checking for displaying help. this._getCommandAndAncestors().forEach((cmd) => { cmd.options.forEach((anOption) => { - if (anOption.mandatory && (cmd.getOptionValue(anOption.attributeName()) === undefined)) { + if ( + anOption.mandatory && + cmd.getOptionValue(anOption.attributeName()) === undefined + ) { cmd.missingMandatoryOptionValue(anOption); } }); @@ -46235,23 +46398,21 @@ Expecting one of '${allowedValues.join("', '")}'`); * @private */ _checkForConflictingLocalOptions() { - const definedNonDefaultOptions = this.options.filter( - (option) => { - const optionKey = option.attributeName(); - if (this.getOptionValue(optionKey) === undefined) { - return false; - } - return this.getOptionValueSource(optionKey) !== 'default'; + const definedNonDefaultOptions = this.options.filter((option) => { + const optionKey = option.attributeName(); + if (this.getOptionValue(optionKey) === undefined) { + return false; } - ); + return this.getOptionValueSource(optionKey) !== 'default'; + }); const optionsWithConflicting = definedNonDefaultOptions.filter( - (option) => option.conflictsWith.length > 0 + (option) => option.conflictsWith.length > 0, ); optionsWithConflicting.forEach((option) => { const conflictingAndDefined = definedNonDefaultOptions.find((defined) => - option.conflictsWith.includes(defined.attributeName()) + option.conflictsWith.includes(defined.attributeName()), ); if (conflictingAndDefined) { this._conflictingOption(option, conflictingAndDefined); @@ -46331,7 +46492,8 @@ Expecting one of '${allowedValues.join("', '")}'`); value = args.shift(); } this.emit(`option:${option.name()}`, value); - } else { // boolean flag + } else { + // boolean flag this.emit(`option:${option.name()}`); } activeVariadicOption = option.variadic ? option : null; @@ -46343,7 +46505,10 @@ Expecting one of '${allowedValues.join("', '")}'`); if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') { const option = this._findOption(`-${arg[1]}`); if (option) { - if (option.required || (option.optional && this._combineFlagAndOptionalValue)) { + if ( + option.required || + (option.optional && this._combineFlagAndOptionalValue) + ) { // option with value following in same argument this.emit(`option:${option.name()}`, arg.slice(2)); } else { @@ -46374,12 +46539,19 @@ Expecting one of '${allowedValues.join("', '")}'`); } // If using positionalOptions, stop processing our options at subcommand. - if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) { + if ( + (this._enablePositionalOptions || this._passThroughOptions) && + operands.length === 0 && + unknown.length === 0 + ) { if (this._findCommand(arg)) { operands.push(arg); if (args.length > 0) unknown.push(...args); break; - } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) { + } else if ( + this._getHelpCommand() && + arg === this._getHelpCommand().name() + ) { operands.push(arg); if (args.length > 0) operands.push(...args); break; @@ -46407,7 +46579,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Return an object containing local option values as key-value pairs. * - * @return {Object} + * @return {object} */ opts() { if (this._storeOptionsAsProperties) { @@ -46417,7 +46589,8 @@ Expecting one of '${allowedValues.join("', '")}'`); for (let i = 0; i < len; i++) { const key = this.options[i].attributeName(); - result[key] = key === this._versionOptionName ? this._version : this[key]; + result[key] = + key === this._versionOptionName ? this._version : this[key]; } return result; } @@ -46428,13 +46601,13 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Return an object containing merged local and global option values as key-value pairs. * - * @return {Object} + * @return {object} */ optsWithGlobals() { // globals overwrite locals return this._getCommandAndAncestors().reduce( (combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()), - {} + {}, ); } @@ -46442,13 +46615,16 @@ Expecting one of '${allowedValues.join("', '")}'`); * Display error message and exit (or call exitOverride). * * @param {string} message - * @param {Object} [errorOptions] + * @param {object} [errorOptions] * @param {string} [errorOptions.code] - an id string representing the error * @param {number} [errorOptions.exitCode] - used with process.exit */ error(message, errorOptions) { // output handling - this._outputConfiguration.outputError(`${message}\n`, this._outputConfiguration.writeErr); + this._outputConfiguration.outputError( + `${message}\n`, + this._outputConfiguration.writeErr, + ); if (typeof this._showHelpAfterError === 'string') { this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`); } else if (this._showHelpAfterError) { @@ -46474,11 +46650,18 @@ Expecting one of '${allowedValues.join("', '")}'`); if (option.envVar && option.envVar in process.env) { const optionKey = option.attributeName(); // Priority check. Do not overwrite cli or options from unknown source (client-code). - if (this.getOptionValue(optionKey) === undefined || ['default', 'config', 'env'].includes(this.getOptionValueSource(optionKey))) { - if (option.required || option.optional) { // option can take a value + if ( + this.getOptionValue(optionKey) === undefined || + ['default', 'config', 'env'].includes( + this.getOptionValueSource(optionKey), + ) + ) { + if (option.required || option.optional) { + // option can take a value // keep very simple, optional always takes value this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]); - } else { // boolean + } else { + // boolean // keep very simple, only care that envVar defined and not the value this.emit(`optionEnv:${option.name()}`); } @@ -46495,17 +46678,30 @@ Expecting one of '${allowedValues.join("', '")}'`); _parseOptionsImplied() { const dualHelper = new DualOptions(this.options); const hasCustomOptionValue = (optionKey) => { - return this.getOptionValue(optionKey) !== undefined && !['default', 'implied'].includes(this.getOptionValueSource(optionKey)); + return ( + this.getOptionValue(optionKey) !== undefined && + !['default', 'implied'].includes(this.getOptionValueSource(optionKey)) + ); }; this.options - .filter(option => (option.implied !== undefined) && - hasCustomOptionValue(option.attributeName()) && - dualHelper.valueFromOption(this.getOptionValue(option.attributeName()), option)) + .filter( + (option) => + option.implied !== undefined && + hasCustomOptionValue(option.attributeName()) && + dualHelper.valueFromOption( + this.getOptionValue(option.attributeName()), + option, + ), + ) .forEach((option) => { Object.keys(option.implied) - .filter(impliedKey => !hasCustomOptionValue(impliedKey)) - .forEach(impliedKey => { - this.setOptionValueWithSource(impliedKey, option.implied[impliedKey], 'implied'); + .filter((impliedKey) => !hasCustomOptionValue(impliedKey)) + .forEach((impliedKey) => { + this.setOptionValueWithSource( + impliedKey, + option.implied[impliedKey], + 'implied', + ); }); }); } @@ -46559,12 +46755,18 @@ Expecting one of '${allowedValues.join("', '")}'`); const findBestOptionFromValue = (option) => { const optionKey = option.attributeName(); const optionValue = this.getOptionValue(optionKey); - const negativeOption = this.options.find(target => target.negate && optionKey === target.attributeName()); - const positiveOption = this.options.find(target => !target.negate && optionKey === target.attributeName()); - if (negativeOption && ( - (negativeOption.presetArg === undefined && optionValue === false) || - (negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg) - )) { + const negativeOption = this.options.find( + (target) => target.negate && optionKey === target.attributeName(), + ); + const positiveOption = this.options.find( + (target) => !target.negate && optionKey === target.attributeName(), + ); + if ( + negativeOption && + ((negativeOption.presetArg === undefined && optionValue === false) || + (negativeOption.presetArg !== undefined && + optionValue === negativeOption.presetArg)) + ) { return negativeOption; } return positiveOption || option; @@ -46598,11 +46800,14 @@ Expecting one of '${allowedValues.join("', '")}'`); if (flag.startsWith('--') && this._showSuggestionAfterError) { // Looping to pick up the global options too let candidateFlags = []; + // eslint-disable-next-line @typescript-eslint/no-this-alias let command = this; do { - const moreFlags = command.createHelp().visibleOptions(command) - .filter(option => option.long) - .map(option => option.long); + const moreFlags = command + .createHelp() + .visibleOptions(command) + .filter((option) => option.long) + .map((option) => option.long); candidateFlags = candidateFlags.concat(moreFlags); command = command.parent; } while (command && !command._enablePositionalOptions); @@ -46624,7 +46829,7 @@ Expecting one of '${allowedValues.join("', '")}'`); if (this._allowExcessArguments) return; const expected = this.registeredArguments.length; - const s = (expected === 1) ? '' : 's'; + const s = expected === 1 ? '' : 's'; const forSubcommand = this.parent ? ` for '${this.name()}'` : ''; const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`; this.error(message, { code: 'commander.excessArguments' }); @@ -46642,11 +46847,13 @@ Expecting one of '${allowedValues.join("', '")}'`); if (this._showSuggestionAfterError) { const candidateNames = []; - this.createHelp().visibleCommands(this).forEach((command) => { - candidateNames.push(command.name()); - // just visible alias - if (command.alias()) candidateNames.push(command.alias()); - }); + this.createHelp() + .visibleCommands(this) + .forEach((command) => { + candidateNames.push(command.name()); + // just visible alias + if (command.alias()) candidateNames.push(command.alias()); + }); suggestion = suggestSimilar(unknownName, candidateNames); } @@ -46687,11 +46894,12 @@ Expecting one of '${allowedValues.join("', '")}'`); * Set the description. * * @param {string} [str] - * @param {Object} [argsDescription] + * @param {object} [argsDescription] * @return {(string|Command)} */ description(str, argsDescription) { - if (str === undefined && argsDescription === undefined) return this._description; + if (str === undefined && argsDescription === undefined) + return this._description; this._description = str; if (argsDescription) { this._argsDescription = argsDescription; @@ -46724,18 +46932,27 @@ Expecting one of '${allowedValues.join("', '")}'`); if (alias === undefined) return this._aliases[0]; // just return first, for backwards compatibility /** @type {Command} */ + // eslint-disable-next-line @typescript-eslint/no-this-alias let command = this; - if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) { + if ( + this.commands.length !== 0 && + this.commands[this.commands.length - 1]._executableHandler + ) { // assume adding alias for last added executable subcommand, rather than this command = this.commands[this.commands.length - 1]; } - if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); + if (alias === command._name) + throw new Error("Command alias can't be the same as its name"); const matchingCommand = this.parent?._findCommand(alias); if (matchingCommand) { // c.f. _registerCommand - const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join('|'); - throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`); + const existingCmd = [matchingCommand.name()] + .concat(matchingCommand.aliases()) + .join('|'); + throw new Error( + `cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`, + ); } command._aliases.push(alias); @@ -46773,11 +46990,13 @@ Expecting one of '${allowedValues.join("', '")}'`); const args = this.registeredArguments.map((arg) => { return humanReadableArgName(arg); }); - return [].concat( - (this.options.length || (this._helpOption !== null) ? '[options]' : []), - (this.commands.length ? '[command]' : []), - (this.registeredArguments.length ? args : []) - ).join(' '); + return [] + .concat( + this.options.length || this._helpOption !== null ? '[options]' : [], + this.commands.length ? '[command]' : [], + this.registeredArguments.length ? args : [], + ) + .join(' '); } this._usage = str; @@ -46844,7 +47063,10 @@ Expecting one of '${allowedValues.join("', '")}'`); helpInformation(contextOptions) { const helper = this.createHelp(); if (helper.helpWidth === undefined) { - helper.helpWidth = (contextOptions && contextOptions.error) ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth(); + helper.helpWidth = + contextOptions && contextOptions.error + ? this._outputConfiguration.getErrHelpWidth() + : this._outputConfiguration.getOutHelpWidth(); } return helper.formatHelp(this, helper); } @@ -46883,13 +47105,18 @@ Expecting one of '${allowedValues.join("', '")}'`); } const context = this._getHelpContext(contextOptions); - this._getCommandAndAncestors().reverse().forEach(command => command.emit('beforeAllHelp', context)); + this._getCommandAndAncestors() + .reverse() + .forEach((command) => command.emit('beforeAllHelp', context)); this.emit('beforeHelp', context); let helpInformation = this.helpInformation(context); if (deprecatedCallback) { helpInformation = deprecatedCallback(helpInformation); - if (typeof helpInformation !== 'string' && !Buffer.isBuffer(helpInformation)) { + if ( + typeof helpInformation !== 'string' && + !Buffer.isBuffer(helpInformation) + ) { throw new Error('outputHelp callback must return a string or a Buffer'); } } @@ -46899,7 +47126,9 @@ Expecting one of '${allowedValues.join("', '")}'`); this.emit(this._getHelpOption().long); // deprecated } this.emit('afterHelp', context); - this._getCommandAndAncestors().forEach(command => command.emit('afterAllHelp', context)); + this._getCommandAndAncestors().forEach((command) => + command.emit('afterAllHelp', context), + ); } /** @@ -46939,7 +47168,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Returns null if has been disabled with .helpOption(false). * * @returns {(Option | null)} the help option - * @package internal use only + * @package */ _getHelpOption() { // Lazy create help option on demand. @@ -46972,7 +47201,12 @@ Expecting one of '${allowedValues.join("', '")}'`); help(contextOptions) { this.outputHelp(contextOptions); let exitCode = process.exitCode || 0; - if (exitCode === 0 && contextOptions && typeof contextOptions !== 'function' && contextOptions.error) { + if ( + exitCode === 0 && + contextOptions && + typeof contextOptions !== 'function' && + contextOptions.error + ) { exitCode = 1; } // message: do not have all displayed text available so only passing placeholder. @@ -47020,7 +47254,7 @@ Expecting one of '${allowedValues.join("', '")}'`); _outputHelpIfRequested(args) { const helpOption = this._getHelpOption(); - const helpRequested = helpOption && args.find(arg => helpOption.is(arg)); + const helpRequested = helpOption && args.find((arg) => helpOption.is(arg)); if (helpRequested) { this.outputHelp(); // (Do not have all displayed text available so only passing placeholder.) @@ -47053,7 +47287,9 @@ function incrementNodeInspectorPort(args) { if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) { // e.g. --inspect debugOption = match[1]; - } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) { + } else if ( + (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null + ) { debugOption = match[1]; if (/^\d+$/.test(match[3])) { // e.g. --inspect=1234 @@ -47062,7 +47298,9 @@ function incrementNodeInspectorPort(args) { // e.g. --inspect=localhost debugHost = match[3]; } - } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) { + } else if ( + (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null + ) { // e.g. --inspect=localhost:1234 debugOption = match[1]; debugHost = match[3]; @@ -47086,7 +47324,6 @@ exports.Command = Command; /** * CommanderError class - * @class */ class CommanderError extends Error { /** @@ -47094,7 +47331,6 @@ class CommanderError extends Error { * @param {number} exitCode suggested exit code which could be used with process.exit * @param {string} code an id string representing the error * @param {string} message human-readable description of the error - * @constructor */ constructor(exitCode, code, message) { super(message); @@ -47109,13 +47345,11 @@ class CommanderError extends Error { /** * InvalidArgumentError class - * @class */ class InvalidArgumentError extends CommanderError { /** * Constructs the InvalidArgumentError class * @param {string} [message] explanation of why argument is invalid - * @constructor */ constructor(message) { super(1, 'commander.invalidArgument', message); @@ -47161,14 +47395,14 @@ class Help { */ visibleCommands(cmd) { - const visibleCommands = cmd.commands.filter(cmd => !cmd._hidden); + const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden); const helpCommand = cmd._getHelpCommand(); if (helpCommand && !helpCommand._hidden) { visibleCommands.push(helpCommand); } if (this.sortSubcommands) { visibleCommands.sort((a, b) => { - // @ts-ignore: overloaded return type + // @ts-ignore: because overloaded return type return a.name().localeCompare(b.name()); }); } @@ -47180,12 +47414,14 @@ class Help { * * @param {Option} a * @param {Option} b - * @returns number + * @returns {number} */ compareOptions(a, b) { const getSortKey = (option) => { // WYSIWYG for order displayed in help. Short used for comparison if present. No special handling for negated. - return option.short ? option.short.replace(/^-/, '') : option.long.replace(/^--/, ''); + return option.short + ? option.short.replace(/^-/, '') + : option.long.replace(/^--/, ''); }; return getSortKey(a).localeCompare(getSortKey(b)); } @@ -47208,9 +47444,13 @@ class Help { if (!removeShort && !removeLong) { visibleOptions.push(helpOption); // no changes needed } else if (helpOption.long && !removeLong) { - visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description)); + visibleOptions.push( + cmd.createOption(helpOption.long, helpOption.description), + ); } else if (helpOption.short && !removeShort) { - visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description)); + visibleOptions.push( + cmd.createOption(helpOption.short, helpOption.description), + ); } } if (this.sortOptions) { @@ -47230,8 +47470,14 @@ class Help { if (!this.showGlobalOptions) return []; const globalOptions = []; - for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) { - const visibleOptions = ancestorCmd.options.filter((option) => !option.hidden); + for ( + let ancestorCmd = cmd.parent; + ancestorCmd; + ancestorCmd = ancestorCmd.parent + ) { + const visibleOptions = ancestorCmd.options.filter( + (option) => !option.hidden, + ); globalOptions.push(...visibleOptions); } if (this.sortOptions) { @@ -47250,13 +47496,14 @@ class Help { visibleArguments(cmd) { // Side effect! Apply the legacy descriptions before the arguments are displayed. if (cmd._argsDescription) { - cmd.registeredArguments.forEach(argument => { - argument.description = argument.description || cmd._argsDescription[argument.name()] || ''; + cmd.registeredArguments.forEach((argument) => { + argument.description = + argument.description || cmd._argsDescription[argument.name()] || ''; }); } // If there are any arguments with a description then return all the arguments. - if (cmd.registeredArguments.find(argument => argument.description)) { + if (cmd.registeredArguments.find((argument) => argument.description)) { return cmd.registeredArguments; } return []; @@ -47271,11 +47518,15 @@ class Help { subcommandTerm(cmd) { // Legacy. Ignores custom usage string, and nested commands. - const args = cmd.registeredArguments.map(arg => humanReadableArgName(arg)).join(' '); - return cmd._name + + const args = cmd.registeredArguments + .map((arg) => humanReadableArgName(arg)) + .join(' '); + return ( + cmd._name + (cmd._aliases[0] ? '|' + cmd._aliases[0] : '') + (cmd.options.length ? ' [options]' : '') + // simplistic check for non-help option - (args ? ' ' + args : ''); + (args ? ' ' + args : '') + ); } /** @@ -47370,7 +47621,11 @@ class Help { cmdName = cmdName + '|' + cmd._aliases[0]; } let ancestorCmdNames = ''; - for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) { + for ( + let ancestorCmd = cmd.parent; + ancestorCmd; + ancestorCmd = ancestorCmd.parent + ) { ancestorCmdNames = ancestorCmd.name() + ' ' + ancestorCmdNames; } return ancestorCmdNames + cmdName + ' ' + cmd.usage(); @@ -47384,7 +47639,7 @@ class Help { */ commandDescription(cmd) { - // @ts-ignore: overloaded return type + // @ts-ignore: because overloaded return type return cmd.description(); } @@ -47397,7 +47652,7 @@ class Help { */ subcommandDescription(cmd) { - // @ts-ignore: overloaded return type + // @ts-ignore: because overloaded return type return cmd.summary() || cmd.description(); } @@ -47414,15 +47669,20 @@ class Help { if (option.argChoices) { extraInfo.push( // use stringify to match the display of the default value - `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`); + `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`, + ); } if (option.defaultValue !== undefined) { // default for boolean and negated more for programmer than end user, // but show true/false for boolean option as may be for hand-rolled env or config processing. - const showDefault = option.required || option.optional || + const showDefault = + option.required || + option.optional || (option.isBoolean() && typeof option.defaultValue === 'boolean'); if (showDefault) { - extraInfo.push(`default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`); + extraInfo.push( + `default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`, + ); } } // preset for boolean and negated are more for programmer than end user @@ -47451,10 +47711,13 @@ class Help { if (argument.argChoices) { extraInfo.push( // use stringify to match the display of the default value - `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`); + `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`, + ); } if (argument.defaultValue !== undefined) { - extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`); + extraInfo.push( + `default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`, + ); } if (extraInfo.length > 0) { const extraDescripton = `(${extraInfo.join(', ')})`; @@ -47482,7 +47745,11 @@ class Help { function formatItem(term, description) { if (description) { const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`; - return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth); + return helper.wrap( + fullText, + helpWidth - itemIndentWidth, + termWidth + itemSeparatorWidth, + ); } return term; } @@ -47496,12 +47763,18 @@ class Help { // Description const commandDescription = helper.commandDescription(cmd); if (commandDescription.length > 0) { - output = output.concat([helper.wrap(commandDescription, helpWidth, 0), '']); + output = output.concat([ + helper.wrap(commandDescription, helpWidth, 0), + '', + ]); } // Arguments const argumentList = helper.visibleArguments(cmd).map((argument) => { - return formatItem(helper.argumentTerm(argument), helper.argumentDescription(argument)); + return formatItem( + helper.argumentTerm(argument), + helper.argumentDescription(argument), + ); }); if (argumentList.length > 0) { output = output.concat(['Arguments:', formatList(argumentList), '']); @@ -47509,24 +47782,39 @@ class Help { // Options const optionList = helper.visibleOptions(cmd).map((option) => { - return formatItem(helper.optionTerm(option), helper.optionDescription(option)); + return formatItem( + helper.optionTerm(option), + helper.optionDescription(option), + ); }); if (optionList.length > 0) { output = output.concat(['Options:', formatList(optionList), '']); } if (this.showGlobalOptions) { - const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => { - return formatItem(helper.optionTerm(option), helper.optionDescription(option)); - }); + const globalOptionList = helper + .visibleGlobalOptions(cmd) + .map((option) => { + return formatItem( + helper.optionTerm(option), + helper.optionDescription(option), + ); + }); if (globalOptionList.length > 0) { - output = output.concat(['Global Options:', formatList(globalOptionList), '']); + output = output.concat([ + 'Global Options:', + formatList(globalOptionList), + '', + ]); } } // Commands const commandList = helper.visibleCommands(cmd).map((cmd) => { - return formatItem(helper.subcommandTerm(cmd), helper.subcommandDescription(cmd)); + return formatItem( + helper.subcommandTerm(cmd), + helper.subcommandDescription(cmd), + ); }); if (commandList.length > 0) { output = output.concat(['Commands:', formatList(commandList), '']); @@ -47548,7 +47836,7 @@ class Help { helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), - helper.longestArgumentTermLength(cmd, helper) + helper.longestArgumentTermLength(cmd, helper), ); } @@ -47566,7 +47854,8 @@ class Help { wrap(str, width, indent, minColumnWidth = 40) { // Full \s characters, minus the linefeeds. - const indents = ' \\f\\t\\v\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff'; + const indents = + ' \\f\\t\\v\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff'; // Detect manually wrapped and indented strings by searching for line break followed by spaces. const manualIndent = new RegExp(`[\\n][${indents}]+`); if (str.match(manualIndent)) return str; @@ -47581,12 +47870,20 @@ class Help { const breaks = `\\s${zeroWidthSpace}`; // Match line end (so empty lines don't collapse), // or as much text as will fit in column, or excess text up to first break. - const regex = new RegExp(`\n|.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`, 'g'); + const regex = new RegExp( + `\n|.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`, + 'g', + ); const lines = columnText.match(regex) || []; - return leadingStr + lines.map((line, i) => { - if (line === '\n') return ''; // preserve empty lines - return ((i > 0) ? indentString : '') + line.trimEnd(); - }).join('\n'); + return ( + leadingStr + + lines + .map((line, i) => { + if (line === '\n') return ''; // preserve empty lines + return (i > 0 ? indentString : '') + line.trimEnd(); + }) + .join('\n') + ); } } @@ -47693,7 +47990,7 @@ class Option { * .addOption(new Option('--log', 'write logging information to file')) * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' })); * - * @param {Object} impliedOptionValues + * @param {object} impliedOptionValues * @return {Option} */ implies(impliedOptionValues) { @@ -47758,7 +48055,7 @@ class Option { } /** - * @package internal use only + * @package */ _concatValue(value, previous) { @@ -47780,7 +48077,9 @@ class Option { this.argChoices = values.slice(); this.parseArg = (arg, previous) => { if (!this.argChoices.includes(arg)) { - throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(', ')}.`); + throw new InvalidArgumentError( + `Allowed choices are ${this.argChoices.join(', ')}.`, + ); } if (this.variadic) { return this._concatValue(arg, previous); @@ -47819,7 +48118,7 @@ class Option { * * @param {string} arg * @return {boolean} - * @package internal use only + * @package */ is(arg) { @@ -47832,7 +48131,7 @@ class Option { * Options are one of boolean, negated, required argument, or optional argument. * * @return {boolean} - * @package internal use only + * @package */ isBoolean() { @@ -47855,7 +48154,7 @@ class DualOptions { this.positiveOptions = new Map(); this.negativeOptions = new Map(); this.dualOptions = new Set(); - options.forEach(option => { + options.forEach((option) => { if (option.negate) { this.negativeOptions.set(option.attributeName(), option); } else { @@ -47882,7 +48181,7 @@ class DualOptions { // Use the value to deduce if (probably) came from the option. const preset = this.negativeOptions.get(optionKey).presetArg; - const negativeValue = (preset !== undefined) ? preset : false; + const negativeValue = preset !== undefined ? preset : false; return option.negate === (negativeValue === value); } } @@ -47913,7 +48212,8 @@ function splitOptionFlags(flags) { // Use original very loose parsing to maintain backwards compatibility for now, // which allowed for example unintended `-sw, --short-word` [sic]. const flagParts = flags.split(/[ |,]+/); - if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1])) shortFlag = flagParts.shift(); + if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1])) + shortFlag = flagParts.shift(); longFlag = flagParts.shift(); // Add support for lone short flag without significantly changing parsing! if (!shortFlag && /^-[^-]$/.test(longFlag)) { @@ -47940,7 +48240,8 @@ function editDistance(a, b) { // (Simple implementation.) // Quick early exit, return worst case. - if (Math.abs(a.length - b.length) > maxDistance) return Math.max(a.length, b.length); + if (Math.abs(a.length - b.length) > maxDistance) + return Math.max(a.length, b.length); // distance between prefix substrings of a and b const d = []; @@ -47966,7 +48267,7 @@ function editDistance(a, b) { d[i][j] = Math.min( d[i - 1][j] + 1, // deletion d[i][j - 1] + 1, // insertion - d[i - 1][j - 1] + cost // substitution + d[i - 1][j - 1] + cost, // substitution ); // transposition if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { @@ -47994,7 +48295,7 @@ function suggestSimilar(word, candidates) { const searchingOptions = word.startsWith('--'); if (searchingOptions) { word = word.slice(2); - candidates = candidates.map(candidate => candidate.slice(2)); + candidates = candidates.map((candidate) => candidate.slice(2)); } let similar = []; @@ -48019,7 +48320,7 @@ function suggestSimilar(word, candidates) { similar.sort((a, b) => a.localeCompare(b)); if (searchingOptions) { - similar = similar.map(candidate => `--${candidate}`); + similar = similar.map((candidate) => `--${candidate}`); } if (similar.length > 1) { diff --git a/package-lock.json b/package-lock.json index 01d2dda..bbb4666 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2421,9 +2421,9 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/commander": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz", - "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==", + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", "engines": { "node": ">=18" } diff --git a/src/datasources.ts b/src/datasources.ts index a3734db..3b55f7b 100644 --- a/src/datasources.ts +++ b/src/datasources.ts @@ -112,7 +112,7 @@ export class GitHubSource implements IDataSource { return Buffer.from(config.content, "base64").toString(); } catch (error: unknown) { if (error instanceof RequestError && error.response) { - const reponseData = error.response.data as Record + const reponseData = error.response.data as Record; if ("message" in reponseData && reponseData.message === "Not Found") { return undefined; } From cff98c4f9d47999a229e1333d609f36b0e3189d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 02:58:50 +0000 Subject: [PATCH 22/22] chore(deps): bump @dev-build-deploy/commit-it from 2.3.0 to 2.3.1 Bumps [@dev-build-deploy/commit-it](https://github.com/dev-build-deploy/commit-it) from 2.3.0 to 2.3.1. - [Release notes](https://github.com/dev-build-deploy/commit-it/releases) - [Commits](https://github.com/dev-build-deploy/commit-it/compare/2.3.0...2.3.1) --- updated-dependencies: - dependency-name: "@dev-build-deploy/commit-it" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- lib/action/index.js | 8 ++++---- lib/cli/index.js | 8 ++++---- lib/precommit/index.js | 8 ++++---- package-lock.json | 6 +++--- src/datasources.ts | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/action/index.js b/lib/action/index.js index 9a1434a..cfe6c75 100644 --- a/lib/action/index.js +++ b/lib/action/index.js @@ -2250,9 +2250,9 @@ exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; * @returns True if the subject is a common merge pattern, false otherwise */ function subjectIsMergePattern(subject) { - const githubMergeRegex = /^Merge pull request #(\d+) from '?(.*)'?$/; - const bitbucketMergeRegex = /^Merged in '?(.*)'? \(pull request #(\d+)\)$/; - const gitlabMergeRegex = /^Merge( remote-tracking)? branch '?(.*?)'? into '?(.*?)'?$/; + const githubMergeRegex = /^Merge pull request #(\d+) from '?([a-zA-Z0-9_./-]+)'?$/; + const bitbucketMergeRegex = /^Merged in '?([a-zA-Z0-9_./-]+)'? \(pull request #(\d+)\)$/; + const gitlabMergeRegex = /^Merge( remote-tracking)? branch '?([a-zA-Z0-9_./-]+)'?? into '?([a-zA-Z0-9_./-]+)'?$/; return githubMergeRegex.test(subject) || bitbucketMergeRegex.test(subject) || gitlabMergeRegex.test(subject); } /** @@ -42423,8 +42423,8 @@ const assert_1 = __importDefault(__nccwpck_require__(9491)); const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); const github = __importStar(__nccwpck_require__(5438)); -const request_error_1 = __nccwpck_require__(537); const commit_it_1 = __nccwpck_require__(9403); +const request_error_1 = __nccwpck_require__(537); const simple_git_1 = __nccwpck_require__(9103); /** * File data source for parsing a file containing the commit message. diff --git a/lib/cli/index.js b/lib/cli/index.js index 669367c..e991dd0 100755 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -2251,9 +2251,9 @@ exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; * @returns True if the subject is a common merge pattern, false otherwise */ function subjectIsMergePattern(subject) { - const githubMergeRegex = /^Merge pull request #(\d+) from '?(.*)'?$/; - const bitbucketMergeRegex = /^Merged in '?(.*)'? \(pull request #(\d+)\)$/; - const gitlabMergeRegex = /^Merge( remote-tracking)? branch '?(.*?)'? into '?(.*?)'?$/; + const githubMergeRegex = /^Merge pull request #(\d+) from '?([a-zA-Z0-9_./-]+)'?$/; + const bitbucketMergeRegex = /^Merged in '?([a-zA-Z0-9_./-]+)'? \(pull request #(\d+)\)$/; + const gitlabMergeRegex = /^Merge( remote-tracking)? branch '?([a-zA-Z0-9_./-]+)'?? into '?([a-zA-Z0-9_./-]+)'?$/; return githubMergeRegex.test(subject) || bitbucketMergeRegex.test(subject) || gitlabMergeRegex.test(subject); } /** @@ -42424,8 +42424,8 @@ const assert_1 = __importDefault(__nccwpck_require__(9491)); const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); const github = __importStar(__nccwpck_require__(5438)); -const request_error_1 = __nccwpck_require__(537); const commit_it_1 = __nccwpck_require__(9403); +const request_error_1 = __nccwpck_require__(537); const simple_git_1 = __nccwpck_require__(9103); /** * File data source for parsing a file containing the commit message. diff --git a/lib/precommit/index.js b/lib/precommit/index.js index 6ec37d5..ceff0d9 100755 --- a/lib/precommit/index.js +++ b/lib/precommit/index.js @@ -2251,9 +2251,9 @@ exports.getFooterElementsFromParagraph = getFooterElementsFromParagraph; * @returns True if the subject is a common merge pattern, false otherwise */ function subjectIsMergePattern(subject) { - const githubMergeRegex = /^Merge pull request #(\d+) from '?(.*)'?$/; - const bitbucketMergeRegex = /^Merged in '?(.*)'? \(pull request #(\d+)\)$/; - const gitlabMergeRegex = /^Merge( remote-tracking)? branch '?(.*?)'? into '?(.*?)'?$/; + const githubMergeRegex = /^Merge pull request #(\d+) from '?([a-zA-Z0-9_./-]+)'?$/; + const bitbucketMergeRegex = /^Merged in '?([a-zA-Z0-9_./-]+)'? \(pull request #(\d+)\)$/; + const gitlabMergeRegex = /^Merge( remote-tracking)? branch '?([a-zA-Z0-9_./-]+)'?? into '?([a-zA-Z0-9_./-]+)'?$/; return githubMergeRegex.test(subject) || bitbucketMergeRegex.test(subject) || gitlabMergeRegex.test(subject); } /** @@ -42424,8 +42424,8 @@ const assert_1 = __importDefault(__nccwpck_require__(9491)); const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); const github = __importStar(__nccwpck_require__(5438)); -const request_error_1 = __nccwpck_require__(537); const commit_it_1 = __nccwpck_require__(9403); +const request_error_1 = __nccwpck_require__(537); const simple_git_1 = __nccwpck_require__(9103); /** * File data source for parsing a file containing the commit message. diff --git a/package-lock.json b/package-lock.json index bbb4666..aeeb7f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -673,9 +673,9 @@ "dev": true }, "node_modules/@dev-build-deploy/commit-it": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.3.0.tgz", - "integrity": "sha512-LZiPqr9y41hFKWH+WUhPQqXv1l9CzL5mAXyR1gJ2H0sylkC0ggD1WX/hWvxdRF4L7vqBftQSmr39RYI+Ff2q7g==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@dev-build-deploy/commit-it/-/commit-it-2.3.1.tgz", + "integrity": "sha512-fwLS2Y4yIJGsw2A/x/Zdxc45NNX+Yp1lmbt+d54qdr1ssOZOtu4QCQe3L//FZRyERC8HoUuKK5iefH+ZzgYpmw==", "dependencies": { "@dev-build-deploy/diagnose-it": "^1", "chalk": "<5" diff --git a/src/datasources.ts b/src/datasources.ts index 3b55f7b..fb3600b 100644 --- a/src/datasources.ts +++ b/src/datasources.ts @@ -8,8 +8,8 @@ import * as fs from "fs"; import * as core from "@actions/core"; import * as github from "@actions/github"; -import { RequestError } from "@octokit/request-error"; import { Commit } from "@dev-build-deploy/commit-it"; +import { RequestError } from "@octokit/request-error"; import { simpleGit } from "simple-git"; /** DataSource abstraction interface