diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index 028b5b5846..f2a5fc7b76 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -26447,7 +26447,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -94796,7 +94796,7 @@ var require_commonjs16 = __commonJS({ var TYPEMASK = 1023; var entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN; var normalizeCache = /* @__PURE__ */ new Map(); - var normalize3 = (s) => { + var normalize2 = (s) => { const c = normalizeCache.get(s); if (c) return c; @@ -94809,7 +94809,7 @@ var require_commonjs16 = __commonJS({ const c = normalizeNocaseCache.get(s); if (c) return c; - const n = normalize3(s.toLowerCase()); + const n = normalize2(s.toLowerCase()); normalizeNocaseCache.set(s, n); return n; }; @@ -94978,7 +94978,7 @@ var require_commonjs16 = __commonJS({ */ constructor(name, type2 = UNKNOWN, root, roots, nocase, children, opts) { this.name = name; - this.#matchName = nocase ? normalizeNocase(name) : normalize3(name); + this.#matchName = nocase ? normalizeNocase(name) : normalize2(name); this.#type = type2 & TYPEMASK; this.nocase = nocase; this.roots = roots; @@ -95071,7 +95071,7 @@ var require_commonjs16 = __commonJS({ return this.parent || this; } const children = this.children(); - const name = this.nocase ? normalizeNocase(pathPart) : normalize3(pathPart); + const name = this.nocase ? normalizeNocase(pathPart) : normalize2(pathPart); for (const p of children) { if (p.#matchName === name) { return p; @@ -95316,7 +95316,7 @@ var require_commonjs16 = __commonJS({ * directly. */ isNamed(n) { - return !this.nocase ? this.#matchName === normalize3(n) : this.#matchName === normalizeNocase(n); + return !this.nocase ? this.#matchName === normalize2(n) : this.#matchName === normalizeNocase(n); } /** * Return the Path object corresponding to the target of a symbolic link. @@ -95455,7 +95455,7 @@ var require_commonjs16 = __commonJS({ #readdirMaybePromoteChild(e, c) { for (let p = c.provisional; p < c.length; p++) { const pchild = c[p]; - const name = this.nocase ? normalizeNocase(e.name) : normalize3(e.name); + const name = this.nocase ? normalizeNocase(e.name) : normalize2(e.name); if (name !== pchild.#matchName) { continue; } @@ -103286,7 +103286,7 @@ var require_tr46 = __commonJS({ TRANSITIONAL: 0, NONTRANSITIONAL: 1 }; - function normalize3(str2) { + function normalize2(str2) { return str2.split("\0").map(function(s) { return s.normalize("NFC"); }).join("\0"); @@ -103366,7 +103366,7 @@ var require_tr46 = __commonJS({ processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; } var error2 = false; - if (normalize3(label) !== label || label[3] === "-" && label[4] === "-" || label[0] === "-" || label[label.length - 1] === "-" || label.indexOf(".") !== -1 || label.search(combiningMarksRegex) === 0) { + if (normalize2(label) !== label || label[3] === "-" && label[4] === "-" || label[0] === "-" || label[label.length - 1] === "-" || label.indexOf(".") !== -1 || label.search(combiningMarksRegex) === 0) { error2 = true; } var len = countSymbols(label); @@ -103384,7 +103384,7 @@ var require_tr46 = __commonJS({ } function processing(domain_name, useSTD3, processing_option) { var result = mapChars(domain_name, useSTD3, processing_option); - result.string = normalize3(result.string); + result.string = normalize2(result.string); var labels = result.string.split("."); for (var i = 0; i < labels.length; ++i) { try { @@ -117487,7 +117487,6 @@ function wrapCliConfigurationError(cliError) { // src/config-utils.ts var fs3 = __toESM(require("fs")); var path3 = __toESM(require("path")); -var semver4 = __toESM(require_semver2()); // src/analyses.ts var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => { @@ -117500,8 +117499,17 @@ var supportedAnalysisKinds = new Set(Object.values(AnalysisKind)); // src/caching-utils.ts var core6 = __toESM(require_core()); +// src/config/db-config.ts +var semver2 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + // src/feature-flags.ts -var semver3 = __toESM(require_semver2()); +var semver4 = __toESM(require_semver2()); // src/overlay-database-utils.ts var fs2 = __toESM(require("fs")); @@ -117747,13 +117755,13 @@ function computeChangedFiles(baseFileOids, overlayFileOids) { } // src/tools-features.ts -var semver2 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); function isSupportedToolsFeature(versionInfo, feature) { return !!versionInfo.features && versionInfo.features[feature]; } var SafeArtifactUploadVersion = "2.20.3"; function isSafeArtifactUpload(codeQlVersion) { - return !codeQlVersion ? true : semver2.gte(codeQlVersion, SafeArtifactUploadVersion); + return !codeQlVersion ? true : semver3.gte(codeQlVersion, SafeArtifactUploadVersion); } // src/feature-flags.ts @@ -117955,12 +117963,6 @@ var OVERLAY_ANALYSIS_CODE_SCANNING_FEATURES = { rust: "overlay_analysis_code_scanning_rust" /* OverlayAnalysisCodeScanningRust */, swift: "overlay_analysis_code_scanning_swift" /* OverlayAnalysisCodeScanningSwift */ }; -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); function getPathToParsedConfigFile(tempDir) { return path3.join(tempDir, "config"); } diff --git a/lib/analyze-action.js b/lib/analyze-action.js index b15581ae2e..21150349ba 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -27722,7 +27722,7 @@ var require_pattern = __commonJS({ const absolute = []; const relative2 = []; for (const pattern of patterns) { - if (isAbsolute3(pattern)) { + if (isAbsolute2(pattern)) { absolute.push(pattern); } else { relative2.push(pattern); @@ -27731,10 +27731,10 @@ var require_pattern = __commonJS({ return [absolute, relative2]; } exports2.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative; - function isAbsolute3(pattern) { + function isAbsolute2(pattern) { return path20.isAbsolute(pattern); } - exports2.isAbsolute = isAbsolute3; + exports2.isAbsolute = isAbsolute2; } }); @@ -32296,7 +32296,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -90555,7 +90555,6 @@ function wrapCliConfigurationError(cliError) { // src/config-utils.ts var fs9 = __toESM(require("fs")); var path10 = __toESM(require("path")); -var semver4 = __toESM(require_semver2()); // src/caching-utils.ts var core6 = __toESM(require_core()); @@ -90569,6 +90568,15 @@ function shouldStoreCache(kind) { return kind === "full" /* Full */ || kind === "store" /* Store */; } +// src/config/db-config.ts +var semver2 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + // src/diff-informed-analysis-utils.ts var fs8 = __toESM(require("fs")); var path9 = __toESM(require("path")); @@ -90576,7 +90584,7 @@ var path9 = __toESM(require("path")); // src/feature-flags.ts var fs7 = __toESM(require("fs")); var path8 = __toESM(require("path")); -var semver3 = __toESM(require_semver2()); +var semver4 = __toESM(require_semver2()); // src/defaults.json var bundleVersion = "codeql-bundle-v2.23.0"; @@ -90982,7 +90990,7 @@ function createCacheKeyHash(components) { } // src/tools-features.ts -var semver2 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); function isSupportedToolsFeature(versionInfo, feature) { return !!versionInfo.features && versionInfo.features[feature]; } @@ -91266,7 +91274,7 @@ var GitHubFeatureFlags = class { DEFAULT_VERSION_FEATURE_FLAG_PREFIX.length, f.length - DEFAULT_VERSION_FEATURE_FLAG_SUFFIX.length ).replace(/_/g, "."); - if (!semver3.valid(version)) { + if (!semver4.valid(version)) { this.logger.warning( `Ignoring feature flag ${f} as it does not specify a valid CodeQL version.` ); @@ -91615,12 +91623,6 @@ var OVERLAY_ANALYSIS_CODE_SCANNING_FEATURES = { rust: "overlay_analysis_code_scanning_rust" /* OverlayAnalysisCodeScanningRust */, swift: "overlay_analysis_code_scanning_swift" /* OverlayAnalysisCodeScanningSwift */ }; -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); function getPathToParsedConfigFile(tempDir) { return path10.join(tempDir, "config"); } diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 526f1b97e2..d442a65d07 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -26447,7 +26447,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -78229,7 +78229,6 @@ function wrapCliConfigurationError(cliError) { // src/config-utils.ts var fs4 = __toESM(require("fs")); var path4 = __toESM(require("path")); -var semver4 = __toESM(require_semver2()); // src/analyses.ts var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => { @@ -78242,10 +78241,19 @@ var supportedAnalysisKinds = new Set(Object.values(AnalysisKind)); // src/caching-utils.ts var core6 = __toESM(require_core()); +// src/config/db-config.ts +var semver2 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + // src/feature-flags.ts var fs3 = __toESM(require("fs")); var path3 = __toESM(require("path")); -var semver3 = __toESM(require_semver2()); +var semver4 = __toESM(require_semver2()); // src/defaults.json var bundleVersion = "codeql-bundle-v2.23.0"; @@ -78487,7 +78495,7 @@ function computeChangedFiles(baseFileOids, overlayFileOids) { } // src/tools-features.ts -var semver2 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); function isSupportedToolsFeature(versionInfo, feature) { return !!versionInfo.features && versionInfo.features[feature]; } @@ -78770,7 +78778,7 @@ var GitHubFeatureFlags = class { DEFAULT_VERSION_FEATURE_FLAG_PREFIX.length, f.length - DEFAULT_VERSION_FEATURE_FLAG_SUFFIX.length ).replace(/_/g, "."); - if (!semver3.valid(version)) { + if (!semver4.valid(version)) { this.logger.warning( `Ignoring feature flag ${f} as it does not specify a valid CodeQL version.` ); @@ -78957,12 +78965,6 @@ var OVERLAY_ANALYSIS_CODE_SCANNING_FEATURES = { rust: "overlay_analysis_code_scanning_rust" /* OverlayAnalysisCodeScanningRust */, swift: "overlay_analysis_code_scanning_swift" /* OverlayAnalysisCodeScanningSwift */ }; -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); function getPathToParsedConfigFile(tempDir) { return path4.join(tempDir, "config"); } diff --git a/lib/init-action-post.js b/lib/init-action-post.js index bc86cec133..b1ae225861 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -27722,7 +27722,7 @@ var require_pattern = __commonJS({ const absolute = []; const relative2 = []; for (const pattern of patterns) { - if (isAbsolute3(pattern)) { + if (isAbsolute2(pattern)) { absolute.push(pattern); } else { relative2.push(pattern); @@ -27731,10 +27731,10 @@ var require_pattern = __commonJS({ return [absolute, relative2]; } exports2.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative; - function isAbsolute3(pattern) { + function isAbsolute2(pattern) { return path19.isAbsolute(pattern); } - exports2.isAbsolute = isAbsolute3; + exports2.isAbsolute = isAbsolute2; } }); @@ -32296,7 +32296,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -100645,7 +100645,7 @@ var require_commonjs16 = __commonJS({ var TYPEMASK = 1023; var entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN; var normalizeCache = /* @__PURE__ */ new Map(); - var normalize4 = (s) => { + var normalize3 = (s) => { const c = normalizeCache.get(s); if (c) return c; @@ -100658,7 +100658,7 @@ var require_commonjs16 = __commonJS({ const c = normalizeNocaseCache.get(s); if (c) return c; - const n = normalize4(s.toLowerCase()); + const n = normalize3(s.toLowerCase()); normalizeNocaseCache.set(s, n); return n; }; @@ -100827,7 +100827,7 @@ var require_commonjs16 = __commonJS({ */ constructor(name, type2 = UNKNOWN, root, roots, nocase, children, opts) { this.name = name; - this.#matchName = nocase ? normalizeNocase(name) : normalize4(name); + this.#matchName = nocase ? normalizeNocase(name) : normalize3(name); this.#type = type2 & TYPEMASK; this.nocase = nocase; this.roots = roots; @@ -100920,7 +100920,7 @@ var require_commonjs16 = __commonJS({ return this.parent || this; } const children = this.children(); - const name = this.nocase ? normalizeNocase(pathPart) : normalize4(pathPart); + const name = this.nocase ? normalizeNocase(pathPart) : normalize3(pathPart); for (const p of children) { if (p.#matchName === name) { return p; @@ -101165,7 +101165,7 @@ var require_commonjs16 = __commonJS({ * directly. */ isNamed(n) { - return !this.nocase ? this.#matchName === normalize4(n) : this.#matchName === normalizeNocase(n); + return !this.nocase ? this.#matchName === normalize3(n) : this.#matchName === normalizeNocase(n); } /** * Return the Path object corresponding to the target of a symbolic link. @@ -101304,7 +101304,7 @@ var require_commonjs16 = __commonJS({ #readdirMaybePromoteChild(e, c) { for (let p = c.provisional; p < c.length; p++) { const pchild = c[p]; - const name = this.nocase ? normalizeNocase(e.name) : normalize4(e.name); + const name = this.nocase ? normalizeNocase(e.name) : normalize3(e.name); if (name !== pchild.#matchName) { continue; } @@ -109135,7 +109135,7 @@ var require_tr46 = __commonJS({ TRANSITIONAL: 0, NONTRANSITIONAL: 1 }; - function normalize4(str2) { + function normalize3(str2) { return str2.split("\0").map(function(s) { return s.normalize("NFC"); }).join("\0"); @@ -109215,7 +109215,7 @@ var require_tr46 = __commonJS({ processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; } var error2 = false; - if (normalize4(label) !== label || label[3] === "-" && label[4] === "-" || label[0] === "-" || label[label.length - 1] === "-" || label.indexOf(".") !== -1 || label.search(combiningMarksRegex) === 0) { + if (normalize3(label) !== label || label[3] === "-" && label[4] === "-" || label[0] === "-" || label[label.length - 1] === "-" || label.indexOf(".") !== -1 || label.search(combiningMarksRegex) === 0) { error2 = true; } var len = countSymbols(label); @@ -109233,7 +109233,7 @@ var require_tr46 = __commonJS({ } function processing(domain_name, useSTD3, processing_option) { var result = mapChars(domain_name, useSTD3, processing_option); - result.string = normalize4(result.string); + result.string = normalize3(result.string); var labels = result.string.split("."); for (var i = 0; i < labels.length; ++i) { try { @@ -128746,7 +128746,6 @@ function wrapCliConfigurationError(cliError) { // src/config-utils.ts var fs9 = __toESM(require("fs")); var path10 = __toESM(require("path")); -var semver4 = __toESM(require_semver2()); // src/analyses.ts var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => { @@ -128775,6 +128774,15 @@ var CodeQuality = { // src/caching-utils.ts var core6 = __toESM(require_core()); +// src/config/db-config.ts +var semver2 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + // src/diff-informed-analysis-utils.ts var fs8 = __toESM(require("fs")); var path9 = __toESM(require("path")); @@ -128782,7 +128790,7 @@ var path9 = __toESM(require("path")); // src/feature-flags.ts var fs7 = __toESM(require("fs")); var path8 = __toESM(require("path")); -var semver3 = __toESM(require_semver2()); +var semver4 = __toESM(require_semver2()); // src/defaults.json var bundleVersion = "codeql-bundle-v2.23.0"; @@ -129077,13 +129085,13 @@ function computeChangedFiles(baseFileOids, overlayFileOids) { } // src/tools-features.ts -var semver2 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); function isSupportedToolsFeature(versionInfo, feature) { return !!versionInfo.features && versionInfo.features[feature]; } var SafeArtifactUploadVersion = "2.20.3"; function isSafeArtifactUpload(codeQlVersion) { - return !codeQlVersion ? true : semver2.gte(codeQlVersion, SafeArtifactUploadVersion); + return !codeQlVersion ? true : semver3.gte(codeQlVersion, SafeArtifactUploadVersion); } // src/feature-flags.ts @@ -129365,7 +129373,7 @@ var GitHubFeatureFlags = class { DEFAULT_VERSION_FEATURE_FLAG_PREFIX.length, f.length - DEFAULT_VERSION_FEATURE_FLAG_SUFFIX.length ).replace(/_/g, "."); - if (!semver3.valid(version)) { + if (!semver4.valid(version)) { this.logger.warning( `Ignoring feature flag ${f} as it does not specify a valid CodeQL version.` ); @@ -129570,12 +129578,6 @@ var OVERLAY_ANALYSIS_CODE_SCANNING_FEATURES = { rust: "overlay_analysis_code_scanning_rust" /* OverlayAnalysisCodeScanningRust */, swift: "overlay_analysis_code_scanning_swift" /* OverlayAnalysisCodeScanningSwift */ }; -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); function getPathToParsedConfigFile(tempDir) { return path10.join(tempDir, "config"); } diff --git a/lib/init-action.js b/lib/init-action.js index fe8a41dca6..808723f995 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -999,14 +999,14 @@ var require_util = __commonJS({ } const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80; let origin = url.origin != null ? url.origin : `${url.protocol}//${url.hostname}:${port}`; - let path19 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`; + let path20 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`; if (origin.endsWith("/")) { origin = origin.substring(0, origin.length - 1); } - if (path19 && !path19.startsWith("/")) { - path19 = `/${path19}`; + if (path20 && !path20.startsWith("/")) { + path20 = `/${path20}`; } - url = new URL(origin + path19); + url = new URL(origin + path20); } return url; } @@ -2620,20 +2620,20 @@ var require_parseParams = __commonJS({ var require_basename = __commonJS({ "node_modules/@fastify/busboy/lib/utils/basename.js"(exports2, module2) { "use strict"; - module2.exports = function basename(path19) { - if (typeof path19 !== "string") { + module2.exports = function basename(path20) { + if (typeof path20 !== "string") { return ""; } - for (var i = path19.length - 1; i >= 0; --i) { - switch (path19.charCodeAt(i)) { + for (var i = path20.length - 1; i >= 0; --i) { + switch (path20.charCodeAt(i)) { case 47: // '/' case 92: - path19 = path19.slice(i + 1); - return path19 === ".." || path19 === "." ? "" : path19; + path20 = path20.slice(i + 1); + return path20 === ".." || path20 === "." ? "" : path20; } } - return path19 === ".." || path19 === "." ? "" : path19; + return path20 === ".." || path20 === "." ? "" : path20; }; } }); @@ -5663,7 +5663,7 @@ var require_request = __commonJS({ } var Request = class _Request { constructor(origin, { - path: path19, + path: path20, method, body, headers, @@ -5677,11 +5677,11 @@ var require_request = __commonJS({ throwOnError, expectContinue }, handler) { - if (typeof path19 !== "string") { + if (typeof path20 !== "string") { throw new InvalidArgumentError("path must be a string"); - } else if (path19[0] !== "/" && !(path19.startsWith("http://") || path19.startsWith("https://")) && method !== "CONNECT") { + } else if (path20[0] !== "/" && !(path20.startsWith("http://") || path20.startsWith("https://")) && method !== "CONNECT") { throw new InvalidArgumentError("path must be an absolute URL or start with a slash"); - } else if (invalidPathRegex.exec(path19) !== null) { + } else if (invalidPathRegex.exec(path20) !== null) { throw new InvalidArgumentError("invalid request path"); } if (typeof method !== "string") { @@ -5744,7 +5744,7 @@ var require_request = __commonJS({ this.completed = false; this.aborted = false; this.upgrade = upgrade || null; - this.path = query ? util.buildURL(path19, query) : path19; + this.path = query ? util.buildURL(path20, query) : path20; this.origin = origin; this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent; this.blocking = blocking == null ? false : blocking; @@ -6752,9 +6752,9 @@ var require_RedirectHandler = __commonJS({ return this.handler.onHeaders(statusCode, headers, resume, statusText); } const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin))); - const path19 = search ? `${pathname}${search}` : pathname; + const path20 = search ? `${pathname}${search}` : pathname; this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin); - this.opts.path = path19; + this.opts.path = path20; this.opts.origin = origin; this.opts.maxRedirections = 0; this.opts.query = null; @@ -7994,7 +7994,7 @@ var require_client = __commonJS({ writeH2(client, client[kHTTP2Session], request); return; } - const { body, method, path: path19, host, upgrade, headers, blocking, reset } = request; + const { body, method, path: path20, host, upgrade, headers, blocking, reset } = request; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8044,7 +8044,7 @@ var require_client = __commonJS({ if (blocking) { socket[kBlocking] = true; } - let header = `${method} ${path19} HTTP/1.1\r + let header = `${method} ${path20} HTTP/1.1\r `; if (typeof host === "string") { header += `host: ${host}\r @@ -8107,7 +8107,7 @@ upgrade: ${upgrade}\r return true; } function writeH2(client, session, request) { - const { body, method, path: path19, host, upgrade, expectContinue, signal, headers: reqHeaders } = request; + const { body, method, path: path20, host, upgrade, expectContinue, signal, headers: reqHeaders } = request; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; @@ -8150,7 +8150,7 @@ upgrade: ${upgrade}\r }); return true; } - headers[HTTP2_HEADER_PATH] = path19; + headers[HTTP2_HEADER_PATH] = path20; headers[HTTP2_HEADER_SCHEME] = "https"; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { @@ -10390,20 +10390,20 @@ var require_mock_utils = __commonJS({ } return true; } - function safeUrl(path19) { - if (typeof path19 !== "string") { - return path19; + function safeUrl(path20) { + if (typeof path20 !== "string") { + return path20; } - const pathSegments = path19.split("?"); + const pathSegments = path20.split("?"); if (pathSegments.length !== 2) { - return path19; + return path20; } const qp = new URLSearchParams(pathSegments.pop()); qp.sort(); return [...pathSegments, qp.toString()].join("?"); } - function matchKey(mockDispatch2, { path: path19, method, body, headers }) { - const pathMatch = matchValue(mockDispatch2.path, path19); + function matchKey(mockDispatch2, { path: path20, method, body, headers }) { + const pathMatch = matchValue(mockDispatch2.path, path20); const methodMatch = matchValue(mockDispatch2.method, method); const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true; const headersMatch = matchHeaders(mockDispatch2, headers); @@ -10421,7 +10421,7 @@ var require_mock_utils = __commonJS({ function getMockDispatch(mockDispatches, key) { const basePath = key.query ? buildURL(key.path, key.query) : key.path; const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath; - let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path19 }) => matchValue(safeUrl(path19), resolvedPath)); + let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path20 }) => matchValue(safeUrl(path20), resolvedPath)); if (matchedMockDispatches.length === 0) { throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`); } @@ -10458,9 +10458,9 @@ var require_mock_utils = __commonJS({ } } function buildKey(opts) { - const { path: path19, method, body, headers, query } = opts; + const { path: path20, method, body, headers, query } = opts; return { - path: path19, + path: path20, method, body, headers, @@ -10909,10 +10909,10 @@ var require_pending_interceptors_formatter = __commonJS({ } format(pendingInterceptors) { const withPrettyHeaders = pendingInterceptors.map( - ({ method, path: path19, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ + ({ method, path: path20, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ Method: method, Origin: origin, - Path: path19, + Path: path20, "Status code": statusCode, Persistent: persist ? "\u2705" : "\u274C", Invocations: timesInvoked, @@ -15532,8 +15532,8 @@ var require_util6 = __commonJS({ } } } - function validateCookiePath(path19) { - for (const char of path19) { + function validateCookiePath(path20) { + for (const char of path20) { const code = char.charCodeAt(0); if (code < 33 || char === ";") { throw new Error("Invalid cookie path"); @@ -17213,11 +17213,11 @@ var require_undici = __commonJS({ if (typeof opts.path !== "string") { throw new InvalidArgumentError("invalid opts.path"); } - let path19 = opts.path; + let path20 = opts.path; if (!opts.path.startsWith("/")) { - path19 = `/${path19}`; + path20 = `/${path20}`; } - url = new URL(util.parseOrigin(url).origin + path19); + url = new URL(util.parseOrigin(url).origin + path20); } else { if (!opts) { opts = typeof url === "object" ? url : {}; @@ -18440,7 +18440,7 @@ var require_path_utils = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.toPlatformPath = exports2.toWin32Path = exports2.toPosixPath = void 0; - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); function toPosixPath(pth) { return pth.replace(/[\\]/g, "/"); } @@ -18450,7 +18450,7 @@ var require_path_utils = __commonJS({ } exports2.toWin32Path = toWin32Path; function toPlatformPath(pth) { - return pth.replace(/[/\\]/g, path19.sep); + return pth.replace(/[/\\]/g, path20.sep); } exports2.toPlatformPath = toPlatformPath; } @@ -18514,7 +18514,7 @@ var require_io_util = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getCmdPath = exports2.tryGetExecutablePath = exports2.isRooted = exports2.isDirectory = exports2.exists = exports2.READONLY = exports2.UV_FS_O_EXLOCK = exports2.IS_WINDOWS = exports2.unlink = exports2.symlink = exports2.stat = exports2.rmdir = exports2.rm = exports2.rename = exports2.readlink = exports2.readdir = exports2.open = exports2.mkdir = exports2.lstat = exports2.copyFile = exports2.chmod = void 0; var fs18 = __importStar4(require("fs")); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); _a = fs18.promises, exports2.chmod = _a.chmod, exports2.copyFile = _a.copyFile, exports2.lstat = _a.lstat, exports2.mkdir = _a.mkdir, exports2.open = _a.open, exports2.readdir = _a.readdir, exports2.readlink = _a.readlink, exports2.rename = _a.rename, exports2.rm = _a.rm, exports2.rmdir = _a.rmdir, exports2.stat = _a.stat, exports2.symlink = _a.symlink, exports2.unlink = _a.unlink; exports2.IS_WINDOWS = process.platform === "win32"; exports2.UV_FS_O_EXLOCK = 268435456; @@ -18563,7 +18563,7 @@ var require_io_util = __commonJS({ } if (stats && stats.isFile()) { if (exports2.IS_WINDOWS) { - const upperExt = path19.extname(filePath).toUpperCase(); + const upperExt = path20.extname(filePath).toUpperCase(); if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) { return filePath; } @@ -18587,11 +18587,11 @@ var require_io_util = __commonJS({ if (stats && stats.isFile()) { if (exports2.IS_WINDOWS) { try { - const directory = path19.dirname(filePath); - const upperName = path19.basename(filePath).toUpperCase(); + const directory = path20.dirname(filePath); + const upperName = path20.basename(filePath).toUpperCase(); for (const actualName of yield exports2.readdir(directory)) { if (upperName === actualName.toUpperCase()) { - filePath = path19.join(directory, actualName); + filePath = path20.join(directory, actualName); break; } } @@ -18686,7 +18686,7 @@ var require_io = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.findInPath = exports2.which = exports2.mkdirP = exports2.rmRF = exports2.mv = exports2.cp = void 0; var assert_1 = require("assert"); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var ioUtil = __importStar4(require_io_util()); function cp(source, dest, options = {}) { return __awaiter4(this, void 0, void 0, function* () { @@ -18695,7 +18695,7 @@ var require_io = __commonJS({ if (destStat && destStat.isFile() && !force) { return; } - const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path19.join(dest, path19.basename(source)) : dest; + const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path20.join(dest, path20.basename(source)) : dest; if (!(yield ioUtil.exists(source))) { throw new Error(`no such file or directory: ${source}`); } @@ -18707,7 +18707,7 @@ var require_io = __commonJS({ yield cpDirRecursive(source, newDest, 0, force); } } else { - if (path19.relative(source, newDest) === "") { + if (path20.relative(source, newDest) === "") { throw new Error(`'${newDest}' and '${source}' are the same file`); } yield copyFile(source, newDest, force); @@ -18720,7 +18720,7 @@ var require_io = __commonJS({ if (yield ioUtil.exists(dest)) { let destExists = true; if (yield ioUtil.isDirectory(dest)) { - dest = path19.join(dest, path19.basename(source)); + dest = path20.join(dest, path20.basename(source)); destExists = yield ioUtil.exists(dest); } if (destExists) { @@ -18731,7 +18731,7 @@ var require_io = __commonJS({ } } } - yield mkdirP(path19.dirname(dest)); + yield mkdirP(path20.dirname(dest)); yield ioUtil.rename(source, dest); }); } @@ -18794,7 +18794,7 @@ var require_io = __commonJS({ } const extensions = []; if (ioUtil.IS_WINDOWS && process.env["PATHEXT"]) { - for (const extension of process.env["PATHEXT"].split(path19.delimiter)) { + for (const extension of process.env["PATHEXT"].split(path20.delimiter)) { if (extension) { extensions.push(extension); } @@ -18807,12 +18807,12 @@ var require_io = __commonJS({ } return []; } - if (tool.includes(path19.sep)) { + if (tool.includes(path20.sep)) { return []; } const directories = []; if (process.env.PATH) { - for (const p of process.env.PATH.split(path19.delimiter)) { + for (const p of process.env.PATH.split(path20.delimiter)) { if (p) { directories.push(p); } @@ -18820,7 +18820,7 @@ var require_io = __commonJS({ } const matches = []; for (const directory of directories) { - const filePath = yield ioUtil.tryGetExecutablePath(path19.join(directory, tool), extensions); + const filePath = yield ioUtil.tryGetExecutablePath(path20.join(directory, tool), extensions); if (filePath) { matches.push(filePath); } @@ -18936,7 +18936,7 @@ var require_toolrunner = __commonJS({ var os5 = __importStar4(require("os")); var events = __importStar4(require("events")); var child = __importStar4(require("child_process")); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var io7 = __importStar4(require_io()); var ioUtil = __importStar4(require_io_util()); var timers_1 = require("timers"); @@ -19151,7 +19151,7 @@ var require_toolrunner = __commonJS({ exec() { return __awaiter4(this, void 0, void 0, function* () { if (!ioUtil.isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS && this.toolPath.includes("\\"))) { - this.toolPath = path19.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); + this.toolPath = path20.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); } this.toolPath = yield io7.which(this.toolPath, true); return new Promise((resolve9, reject) => __awaiter4(this, void 0, void 0, function* () { @@ -19651,7 +19651,7 @@ var require_core = __commonJS({ var file_command_1 = require_file_command(); var utils_1 = require_utils(); var os5 = __importStar4(require("os")); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var oidc_utils_1 = require_oidc_utils(); var ExitCode; (function(ExitCode2) { @@ -19679,7 +19679,7 @@ var require_core = __commonJS({ } else { (0, command_1.issueCommand)("add-path", {}, inputPath); } - process.env["PATH"] = `${inputPath}${path19.delimiter}${process.env["PATH"]}`; + process.env["PATH"] = `${inputPath}${path20.delimiter}${process.env["PATH"]}`; } exports2.addPath = addPath2; function getInput2(name, options) { @@ -21743,8 +21743,8 @@ var require_context = __commonJS({ if ((0, fs_1.existsSync)(process.env.GITHUB_EVENT_PATH)) { this.payload = JSON.parse((0, fs_1.readFileSync)(process.env.GITHUB_EVENT_PATH, { encoding: "utf8" })); } else { - const path19 = process.env.GITHUB_EVENT_PATH; - process.stdout.write(`GITHUB_EVENT_PATH ${path19} does not exist${os_1.EOL}`); + const path20 = process.env.GITHUB_EVENT_PATH; + process.stdout.write(`GITHUB_EVENT_PATH ${path20} does not exist${os_1.EOL}`); } } this.eventName = process.env.GITHUB_EVENT_NAME; @@ -26505,7 +26505,7 @@ var require_path = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.convertPosixPathToPattern = exports2.convertWindowsPathToPattern = exports2.convertPathToPattern = exports2.escapePosixPath = exports2.escapeWindowsPath = exports2.escape = exports2.removeLeadingDotSegment = exports2.makeAbsolute = exports2.unixify = void 0; var os5 = require("os"); - var path19 = require("path"); + var path20 = require("path"); var IS_WINDOWS_PLATFORM = os5.platform() === "win32"; var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g; @@ -26517,7 +26517,7 @@ var require_path = __commonJS({ } exports2.unixify = unixify; function makeAbsolute(cwd, filepath) { - return path19.resolve(cwd, filepath); + return path20.resolve(cwd, filepath); } exports2.makeAbsolute = makeAbsolute; function removeLeadingDotSegment(entry) { @@ -27814,7 +27814,7 @@ var require_braces = __commonJS({ var require_constants8 = __commonJS({ "node_modules/picomatch/lib/constants.js"(exports2, module2) { "use strict"; - var path19 = require("path"); + var path20 = require("path"); var WIN_SLASH = "\\\\/"; var WIN_NO_SLASH = `[^${WIN_SLASH}]`; var DOT_LITERAL = "\\."; @@ -27984,7 +27984,7 @@ var require_constants8 = __commonJS({ /* | */ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - SEP: path19.sep, + SEP: path20.sep, /** * Create EXTGLOB_CHARS */ @@ -28011,7 +28011,7 @@ var require_constants8 = __commonJS({ var require_utils6 = __commonJS({ "node_modules/picomatch/lib/utils.js"(exports2) { "use strict"; - var path19 = require("path"); + var path20 = require("path"); var win32 = process.platform === "win32"; var { REGEX_BACKSLASH, @@ -28040,7 +28040,7 @@ var require_utils6 = __commonJS({ if (options && typeof options.windows === "boolean") { return options.windows; } - return win32 === true || path19.sep === "\\"; + return win32 === true || path20.sep === "\\"; }; exports2.escapeLast = (input, char, lastIdx) => { const idx = input.lastIndexOf(char, lastIdx); @@ -29175,7 +29175,7 @@ var require_parse4 = __commonJS({ var require_picomatch = __commonJS({ "node_modules/picomatch/lib/picomatch.js"(exports2, module2) { "use strict"; - var path19 = require("path"); + var path20 = require("path"); var scan = require_scan(); var parse = require_parse4(); var utils = require_utils6(); @@ -29260,7 +29260,7 @@ var require_picomatch = __commonJS({ }; picomatch.matchBase = (input, glob2, options, posix = utils.isWindows(options)) => { const regex = glob2 instanceof RegExp ? glob2 : picomatch.makeRe(glob2, options); - return regex.test(path19.basename(input)); + return regex.test(path20.basename(input)); }; picomatch.isMatch = (str2, patterns, options) => picomatch(patterns, options)(str2); picomatch.parse = (pattern, options) => { @@ -29487,7 +29487,7 @@ var require_pattern = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.isAbsolute = exports2.partitionAbsoluteAndRelative = exports2.removeDuplicateSlashes = exports2.matchAny = exports2.convertPatternsToRe = exports2.makeRe = exports2.getPatternParts = exports2.expandBraceExpansion = exports2.expandPatternsWithBraceExpansion = exports2.isAffectDepthOfReadingPattern = exports2.endsWithSlashGlobStar = exports2.hasGlobStar = exports2.getBaseDirectory = exports2.isPatternRelatedToParentDirectory = exports2.getPatternsOutsideCurrentDirectory = exports2.getPatternsInsideCurrentDirectory = exports2.getPositivePatterns = exports2.getNegativePatterns = exports2.isPositivePattern = exports2.isNegativePattern = exports2.convertToNegativePattern = exports2.convertToPositivePattern = exports2.isDynamicPattern = exports2.isStaticPattern = void 0; - var path19 = require("path"); + var path20 = require("path"); var globParent = require_glob_parent(); var micromatch = require_micromatch(); var GLOBSTAR = "**"; @@ -29582,7 +29582,7 @@ var require_pattern = __commonJS({ } exports2.endsWithSlashGlobStar = endsWithSlashGlobStar; function isAffectDepthOfReadingPattern(pattern) { - const basename = path19.basename(pattern); + const basename = path20.basename(pattern); return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); } exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; @@ -29640,7 +29640,7 @@ var require_pattern = __commonJS({ } exports2.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative; function isAbsolute3(pattern) { - return path19.isAbsolute(pattern); + return path20.isAbsolute(pattern); } exports2.isAbsolute = isAbsolute3; } @@ -29817,8 +29817,8 @@ var require_utils7 = __commonJS({ exports2.errno = errno; var fs18 = require_fs(); exports2.fs = fs18; - var path19 = require_path(); - exports2.path = path19; + var path20 = require_path(); + exports2.path = path20; var pattern = require_pattern(); exports2.pattern = pattern; var stream2 = require_stream(); @@ -29930,8 +29930,8 @@ var require_async = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.read = void 0; - function read(path19, settings, callback) { - settings.fs.lstat(path19, (lstatError, lstat) => { + function read(path20, settings, callback) { + settings.fs.lstat(path20, (lstatError, lstat) => { if (lstatError !== null) { callFailureCallback(callback, lstatError); return; @@ -29940,7 +29940,7 @@ var require_async = __commonJS({ callSuccessCallback(callback, lstat); return; } - settings.fs.stat(path19, (statError, stat) => { + settings.fs.stat(path20, (statError, stat) => { if (statError !== null) { if (settings.throwErrorOnBrokenSymbolicLink) { callFailureCallback(callback, statError); @@ -29972,13 +29972,13 @@ var require_sync = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.read = void 0; - function read(path19, settings) { - const lstat = settings.fs.lstatSync(path19); + function read(path20, settings) { + const lstat = settings.fs.lstatSync(path20); if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { return lstat; } try { - const stat = settings.fs.statSync(path19); + const stat = settings.fs.statSync(path20); if (settings.markSymbolicLink) { stat.isSymbolicLink = () => true; } @@ -30049,17 +30049,17 @@ var require_out = __commonJS({ var sync = require_sync(); var settings_1 = require_settings(); exports2.Settings = settings_1.default; - function stat(path19, optionsOrSettingsOrCallback, callback) { + function stat(path20, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === "function") { - async.read(path19, getSettings(), optionsOrSettingsOrCallback); + async.read(path20, getSettings(), optionsOrSettingsOrCallback); return; } - async.read(path19, getSettings(optionsOrSettingsOrCallback), callback); + async.read(path20, getSettings(optionsOrSettingsOrCallback), callback); } exports2.stat = stat; - function statSync2(path19, optionsOrSettings) { + function statSync2(path20, optionsOrSettings) { const settings = getSettings(optionsOrSettings); - return sync.read(path19, settings); + return sync.read(path20, settings); } exports2.statSync = statSync2; function getSettings(settingsOrOptions = {}) { @@ -30275,16 +30275,16 @@ var require_async2 = __commonJS({ return; } const tasks = names.map((name) => { - const path19 = common2.joinPathSegments(directory, name, settings.pathSegmentSeparator); + const path20 = common2.joinPathSegments(directory, name, settings.pathSegmentSeparator); return (done) => { - fsStat.stat(path19, settings.fsStatSettings, (error2, stats) => { + fsStat.stat(path20, settings.fsStatSettings, (error2, stats) => { if (error2 !== null) { done(error2); return; } const entry = { name, - path: path19, + path: path20, dirent: utils.fs.createDirentFromStats(name, stats) }; if (settings.stats) { @@ -30402,7 +30402,7 @@ var require_settings2 = __commonJS({ "node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - var path19 = require("path"); + var path20 = require("path"); var fsStat = require_out(); var fs18 = require_fs4(); var Settings = class { @@ -30410,7 +30410,7 @@ var require_settings2 = __commonJS({ this._options = _options; this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); this.fs = fs18.createFileSystemAdapter(this._options.fs); - this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path19.sep); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path20.sep); this.stats = this._getValue(this._options.stats, false); this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); this.fsStatSettings = new fsStat.Settings({ @@ -30437,17 +30437,17 @@ var require_out2 = __commonJS({ var sync = require_sync2(); var settings_1 = require_settings2(); exports2.Settings = settings_1.default; - function scandir(path19, optionsOrSettingsOrCallback, callback) { + function scandir(path20, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === "function") { - async.read(path19, getSettings(), optionsOrSettingsOrCallback); + async.read(path20, getSettings(), optionsOrSettingsOrCallback); return; } - async.read(path19, getSettings(optionsOrSettingsOrCallback), callback); + async.read(path20, getSettings(optionsOrSettingsOrCallback), callback); } exports2.scandir = scandir; - function scandirSync(path19, optionsOrSettings) { + function scandirSync(path20, optionsOrSettings) { const settings = getSettings(optionsOrSettings); - return sync.read(path19, settings); + return sync.read(path20, settings); } exports2.scandirSync = scandirSync; function getSettings(settingsOrOptions = {}) { @@ -30974,7 +30974,7 @@ var require_settings3 = __commonJS({ "node_modules/@nodelib/fs.walk/out/settings.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - var path19 = require("path"); + var path20 = require("path"); var fsScandir = require_out2(); var Settings = class { constructor(_options = {}) { @@ -30984,7 +30984,7 @@ var require_settings3 = __commonJS({ this.deepFilter = this._getValue(this._options.deepFilter, null); this.entryFilter = this._getValue(this._options.entryFilter, null); this.errorFilter = this._getValue(this._options.errorFilter, null); - this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path19.sep); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path20.sep); this.fsScandirSettings = new fsScandir.Settings({ followSymbolicLinks: this._options.followSymbolicLinks, fs: this._options.fs, @@ -31046,7 +31046,7 @@ var require_reader2 = __commonJS({ "node_modules/fast-glob/out/readers/reader.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - var path19 = require("path"); + var path20 = require("path"); var fsStat = require_out(); var utils = require_utils7(); var Reader = class { @@ -31059,7 +31059,7 @@ var require_reader2 = __commonJS({ }); } _getFullEntryPath(filepath) { - return path19.resolve(this._settings.cwd, filepath); + return path20.resolve(this._settings.cwd, filepath); } _makeEntry(stats, pattern) { const entry = { @@ -31475,7 +31475,7 @@ var require_provider = __commonJS({ "node_modules/fast-glob/out/providers/provider.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - var path19 = require("path"); + var path20 = require("path"); var deep_1 = require_deep(); var entry_1 = require_entry(); var error_1 = require_error(); @@ -31489,7 +31489,7 @@ var require_provider = __commonJS({ this.entryTransformer = new entry_2.default(this._settings); } _getRootDirectory(task) { - return path19.resolve(this._settings.cwd, task.base); + return path20.resolve(this._settings.cwd, task.base); } _getReaderOptions(task) { const basePath = task.base === "." ? "" : task.base; @@ -32122,7 +32122,7 @@ var require_ignore = __commonJS({ // path matching. // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE` // @returns {TestResult} true if a file is ignored - test(path19, checkUnignored, mode) { + test(path20, checkUnignored, mode) { let ignored = false; let unignored = false; let matchedRule; @@ -32131,7 +32131,7 @@ var require_ignore = __commonJS({ if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) { return; } - const matched = rule[mode].test(path19); + const matched = rule[mode].test(path20); if (!matched) { return; } @@ -32152,17 +32152,17 @@ var require_ignore = __commonJS({ var throwError2 = (message, Ctor) => { throw new Ctor(message); }; - var checkPath = (path19, originalPath, doThrow) => { - if (!isString(path19)) { + var checkPath = (path20, originalPath, doThrow) => { + if (!isString(path20)) { return doThrow( `path must be a string, but got \`${originalPath}\``, TypeError ); } - if (!path19) { + if (!path20) { return doThrow(`path must not be empty`, TypeError); } - if (checkPath.isNotRelative(path19)) { + if (checkPath.isNotRelative(path20)) { const r = "`path.relative()`d"; return doThrow( `path should be a ${r} string, but got "${originalPath}"`, @@ -32171,7 +32171,7 @@ var require_ignore = __commonJS({ } return true; }; - var isNotRelative = (path19) => REGEX_TEST_INVALID_PATH.test(path19); + var isNotRelative = (path20) => REGEX_TEST_INVALID_PATH.test(path20); checkPath.isNotRelative = isNotRelative; checkPath.convert = (p) => p; var Ignore = class { @@ -32201,19 +32201,19 @@ var require_ignore = __commonJS({ } // @returns {TestResult} _test(originalPath, cache, checkUnignored, slices) { - const path19 = originalPath && checkPath.convert(originalPath); + const path20 = originalPath && checkPath.convert(originalPath); checkPath( - path19, + path20, originalPath, this._strictPathCheck ? throwError2 : RETURN_FALSE ); - return this._t(path19, cache, checkUnignored, slices); + return this._t(path20, cache, checkUnignored, slices); } - checkIgnore(path19) { - if (!REGEX_TEST_TRAILING_SLASH.test(path19)) { - return this.test(path19); + checkIgnore(path20) { + if (!REGEX_TEST_TRAILING_SLASH.test(path20)) { + return this.test(path20); } - const slices = path19.split(SLASH).filter(Boolean); + const slices = path20.split(SLASH).filter(Boolean); slices.pop(); if (slices.length) { const parent = this._t( @@ -32226,18 +32226,18 @@ var require_ignore = __commonJS({ return parent; } } - return this._rules.test(path19, false, MODE_CHECK_IGNORE); + return this._rules.test(path20, false, MODE_CHECK_IGNORE); } - _t(path19, cache, checkUnignored, slices) { - if (path19 in cache) { - return cache[path19]; + _t(path20, cache, checkUnignored, slices) { + if (path20 in cache) { + return cache[path20]; } if (!slices) { - slices = path19.split(SLASH).filter(Boolean); + slices = path20.split(SLASH).filter(Boolean); } slices.pop(); if (!slices.length) { - return cache[path19] = this._rules.test(path19, checkUnignored, MODE_IGNORE); + return cache[path20] = this._rules.test(path20, checkUnignored, MODE_IGNORE); } const parent = this._t( slices.join(SLASH) + SLASH, @@ -32245,29 +32245,29 @@ var require_ignore = __commonJS({ checkUnignored, slices ); - return cache[path19] = parent.ignored ? parent : this._rules.test(path19, checkUnignored, MODE_IGNORE); + return cache[path20] = parent.ignored ? parent : this._rules.test(path20, checkUnignored, MODE_IGNORE); } - ignores(path19) { - return this._test(path19, this._ignoreCache, false).ignored; + ignores(path20) { + return this._test(path20, this._ignoreCache, false).ignored; } createFilter() { - return (path19) => !this.ignores(path19); + return (path20) => !this.ignores(path20); } filter(paths) { return makeArray(paths).filter(this.createFilter()); } // @returns {TestResult} - test(path19) { - return this._test(path19, this._testCache, true); + test(path20) { + return this._test(path20, this._testCache, true); } }; var factory = (options) => new Ignore(options); - var isPathValid = (path19) => checkPath(path19 && checkPath.convert(path19), path19, RETURN_FALSE); + var isPathValid = (path20) => checkPath(path20 && checkPath.convert(path20), path20, RETURN_FALSE); var setupWindows = () => { const makePosix = (str2) => /^\\\\\?\\/.test(str2) || /["<>|\u0000-\u001F]+/u.test(str2) ? str2 : str2.replace(/\\/g, "/"); checkPath.convert = makePosix; const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i; - checkPath.isNotRelative = (path19) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path19) || isNotRelative(path19); + checkPath.isNotRelative = (path20) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path20) || isNotRelative(path20); }; if ( // Detect `process` so that it can run in browsers. @@ -32296,7 +32296,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -34050,7 +34050,7 @@ var require_internal_path_helper = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.safeTrimTrailingSeparator = exports2.normalizeSeparators = exports2.hasRoot = exports2.hasAbsoluteRoot = exports2.ensureAbsoluteRoot = exports2.dirname = void 0; - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var assert_1 = __importDefault4(require("assert")); var IS_WINDOWS = process.platform === "win32"; function dirname3(p) { @@ -34058,7 +34058,7 @@ var require_internal_path_helper = __commonJS({ if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) { return p; } - let result = path19.dirname(p); + let result = path20.dirname(p); if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) { result = safeTrimTrailingSeparator(result); } @@ -34096,7 +34096,7 @@ var require_internal_path_helper = __commonJS({ assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); if (root.endsWith("/") || IS_WINDOWS && root.endsWith("\\")) { } else { - root += path19.sep; + root += path20.sep; } return root + itemPath; } @@ -34134,10 +34134,10 @@ var require_internal_path_helper = __commonJS({ return ""; } p = normalizeSeparators(p); - if (!p.endsWith(path19.sep)) { + if (!p.endsWith(path20.sep)) { return p; } - if (p === path19.sep) { + if (p === path20.sep) { return p; } if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) { @@ -34470,7 +34470,7 @@ var require_minimatch = __commonJS({ "node_modules/minimatch/minimatch.js"(exports2, module2) { module2.exports = minimatch; minimatch.Minimatch = Minimatch; - var path19 = (function() { + var path20 = (function() { try { return require("path"); } catch (e) { @@ -34478,7 +34478,7 @@ var require_minimatch = __commonJS({ })() || { sep: "/" }; - minimatch.sep = path19.sep; + minimatch.sep = path20.sep; var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; var expand = require_brace_expansion(); var plTypes = { @@ -34567,8 +34567,8 @@ var require_minimatch = __commonJS({ assertValidPattern(pattern); if (!options) options = {}; pattern = pattern.trim(); - if (!options.allowWindowsEscape && path19.sep !== "/") { - pattern = pattern.split(path19.sep).join("/"); + if (!options.allowWindowsEscape && path20.sep !== "/") { + pattern = pattern.split(path20.sep).join("/"); } this.options = options; this.set = []; @@ -34937,8 +34937,8 @@ var require_minimatch = __commonJS({ if (this.empty) return f === ""; if (f === "/" && partial) return true; var options = this.options; - if (path19.sep !== "/") { - f = f.split(path19.sep).join("/"); + if (path20.sep !== "/") { + f = f.split(path20.sep).join("/"); } f = f.split(slashSplit); this.debug(this.pattern, "split", f); @@ -35070,7 +35070,7 @@ var require_internal_path = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Path = void 0; - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var pathHelper = __importStar4(require_internal_path_helper()); var assert_1 = __importDefault4(require("assert")); var IS_WINDOWS = process.platform === "win32"; @@ -35085,12 +35085,12 @@ var require_internal_path = __commonJS({ assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`); itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); if (!pathHelper.hasRoot(itemPath)) { - this.segments = itemPath.split(path19.sep); + this.segments = itemPath.split(path20.sep); } else { let remaining = itemPath; let dir = pathHelper.dirname(remaining); while (dir !== remaining) { - const basename = path19.basename(remaining); + const basename = path20.basename(remaining); this.segments.unshift(basename); remaining = dir; dir = pathHelper.dirname(remaining); @@ -35108,7 +35108,7 @@ var require_internal_path = __commonJS({ assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); this.segments.push(segment); } else { - assert_1.default(!segment.includes(path19.sep), `Parameter 'itemPath' contains unexpected path separators`); + assert_1.default(!segment.includes(path20.sep), `Parameter 'itemPath' contains unexpected path separators`); this.segments.push(segment); } } @@ -35119,12 +35119,12 @@ var require_internal_path = __commonJS({ */ toString() { let result = this.segments[0]; - let skipSlash = result.endsWith(path19.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result); + let skipSlash = result.endsWith(path20.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result); for (let i = 1; i < this.segments.length; i++) { if (skipSlash) { skipSlash = false; } else { - result += path19.sep; + result += path20.sep; } result += this.segments[i]; } @@ -35168,7 +35168,7 @@ var require_internal_pattern = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Pattern = void 0; var os5 = __importStar4(require("os")); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var pathHelper = __importStar4(require_internal_path_helper()); var assert_1 = __importDefault4(require("assert")); var minimatch_1 = require_minimatch(); @@ -35197,7 +35197,7 @@ var require_internal_pattern = __commonJS({ } pattern = _Pattern.fixupPattern(pattern, homedir2); this.segments = new internal_path_1.Path(pattern).segments; - this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path19.sep); + this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path20.sep); pattern = pathHelper.safeTrimTrailingSeparator(pattern); let foundGlob = false; const searchSegments = this.segments.map((x) => _Pattern.getLiteral(x)).filter((x) => !foundGlob && !(foundGlob = x === "")); @@ -35221,8 +35221,8 @@ var require_internal_pattern = __commonJS({ match(itemPath) { if (this.segments[this.segments.length - 1] === "**") { itemPath = pathHelper.normalizeSeparators(itemPath); - if (!itemPath.endsWith(path19.sep) && this.isImplicitPattern === false) { - itemPath = `${itemPath}${path19.sep}`; + if (!itemPath.endsWith(path20.sep) && this.isImplicitPattern === false) { + itemPath = `${itemPath}${path20.sep}`; } } else { itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); @@ -35257,9 +35257,9 @@ var require_internal_pattern = __commonJS({ assert_1.default(literalSegments.every((x, i) => (x !== "." || i === 0) && x !== ".."), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); pattern = pathHelper.normalizeSeparators(pattern); - if (pattern === "." || pattern.startsWith(`.${path19.sep}`)) { + if (pattern === "." || pattern.startsWith(`.${path20.sep}`)) { pattern = _Pattern.globEscape(process.cwd()) + pattern.substr(1); - } else if (pattern === "~" || pattern.startsWith(`~${path19.sep}`)) { + } else if (pattern === "~" || pattern.startsWith(`~${path20.sep}`)) { homedir2 = homedir2 || os5.homedir(); assert_1.default(homedir2, "Unable to determine HOME directory"); assert_1.default(pathHelper.hasAbsoluteRoot(homedir2), `Expected HOME directory to be a rooted path. Actual '${homedir2}'`); @@ -35343,8 +35343,8 @@ var require_internal_search_state = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.SearchState = void 0; var SearchState = class { - constructor(path19, level) { - this.path = path19; + constructor(path20, level) { + this.path = path20; this.level = level; } }; @@ -35466,7 +35466,7 @@ var require_internal_globber = __commonJS({ var core14 = __importStar4(require_core()); var fs18 = __importStar4(require("fs")); var globOptionsHelper = __importStar4(require_internal_glob_options_helper()); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var patternHelper = __importStar4(require_internal_pattern_helper()); var internal_match_kind_1 = require_internal_match_kind(); var internal_pattern_1 = require_internal_pattern(); @@ -35547,7 +35547,7 @@ var require_internal_globber = __commonJS({ continue; } const childLevel = item.level + 1; - const childItems = (yield __await4(fs18.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path19.join(item.path, x), childLevel)); + const childItems = (yield __await4(fs18.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path20.join(item.path, x), childLevel)); stack.push(...childItems.reverse()); } else if (match & internal_match_kind_1.MatchKind.File) { yield yield __await4(item.path); @@ -36932,7 +36932,7 @@ var require_cacheUtils = __commonJS({ var io7 = __importStar4(require_io()); var crypto2 = __importStar4(require("crypto")); var fs18 = __importStar4(require("fs")); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var semver9 = __importStar4(require_semver3()); var util = __importStar4(require("util")); var constants_1 = require_constants10(); @@ -36952,9 +36952,9 @@ var require_cacheUtils = __commonJS({ baseLocation = "/home"; } } - tempDirectory = path19.join(baseLocation, "actions", "temp"); + tempDirectory = path20.join(baseLocation, "actions", "temp"); } - const dest = path19.join(tempDirectory, crypto2.randomUUID()); + const dest = path20.join(tempDirectory, crypto2.randomUUID()); yield io7.mkdirP(dest); return dest; }); @@ -36978,7 +36978,7 @@ var require_cacheUtils = __commonJS({ _c = _g.value; _e = false; const file = _c; - const relativeFile = path19.relative(workspace, file).replace(new RegExp(`\\${path19.sep}`, "g"), "/"); + const relativeFile = path20.relative(workspace, file).replace(new RegExp(`\\${path20.sep}`, "g"), "/"); core14.debug(`Matched: ${relativeFile}`); if (relativeFile === "") { paths.push("."); @@ -44884,15 +44884,15 @@ var require_urlHelpers = __commonJS({ let isAbsolutePath = false; let requestUrl = replaceAll(baseUri, urlReplacements); if (operationSpec.path) { - let path19 = replaceAll(operationSpec.path, urlReplacements); - if (operationSpec.path === "/{nextLink}" && path19.startsWith("/")) { - path19 = path19.substring(1); + let path20 = replaceAll(operationSpec.path, urlReplacements); + if (operationSpec.path === "/{nextLink}" && path20.startsWith("/")) { + path20 = path20.substring(1); } - if (isAbsoluteUrl(path19)) { - requestUrl = path19; + if (isAbsoluteUrl(path20)) { + requestUrl = path20; isAbsolutePath = true; } else { - requestUrl = appendPath(requestUrl, path19); + requestUrl = appendPath(requestUrl, path20); } } const { queryParams, sequenceParams } = calculateQueryParameters(operationSpec, operationArguments, fallbackObject); @@ -44940,9 +44940,9 @@ var require_urlHelpers = __commonJS({ } const searchStart = pathToAppend.indexOf("?"); if (searchStart !== -1) { - const path19 = pathToAppend.substring(0, searchStart); + const path20 = pathToAppend.substring(0, searchStart); const search = pathToAppend.substring(searchStart + 1); - newPath = newPath + path19; + newPath = newPath + path20; if (search) { parsedUrl.search = parsedUrl.search ? `${parsedUrl.search}&${search}` : search; } @@ -49091,10 +49091,10 @@ var require_dist7 = __commonJS({ ]; function escapeURLPath(url2) { const urlParsed = new URL(url2); - let path19 = urlParsed.pathname; - path19 = path19 || "/"; - path19 = escape(path19); - urlParsed.pathname = path19; + let path20 = urlParsed.pathname; + path20 = path20 || "/"; + path20 = escape(path20); + urlParsed.pathname = path20; return urlParsed.toString(); } function getProxyUriFromDevConnString(connectionString) { @@ -49179,9 +49179,9 @@ var require_dist7 = __commonJS({ } function appendToURLPath(url2, name) { const urlParsed = new URL(url2); - let path19 = urlParsed.pathname; - path19 = path19 ? path19.endsWith("/") ? `${path19}${name}` : `${path19}/${name}` : name; - urlParsed.pathname = path19; + let path20 = urlParsed.pathname; + path20 = path20 ? path20.endsWith("/") ? `${path20}${name}` : `${path20}/${name}` : name; + urlParsed.pathname = path20; return urlParsed.toString(); } function setURLParameter(url2, name, value) { @@ -50262,9 +50262,9 @@ var require_dist7 = __commonJS({ * @param request - */ getCanonicalizedResourceString(request) { - const path19 = getURLPath(request.url) || "/"; + const path20 = getURLPath(request.url) || "/"; let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${this.factory.accountName}${path19}`; + canonicalizedResourceString += `/${this.factory.accountName}${path20}`; const queries = getURLQueries(request.url); const lowercaseQueries = {}; if (queries) { @@ -50557,9 +50557,9 @@ ${key}:${decodeURIComponent(lowercaseQueries[key])}`; return canonicalizedHeadersStringToSign; } function getCanonicalizedResourceString(request) { - const path19 = getURLPath(request.url) || "/"; + const path20 = getURLPath(request.url) || "/"; let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${options.accountName}${path19}`; + canonicalizedResourceString += `/${options.accountName}${path20}`; const queries = getURLQueries(request.url); const lowercaseQueries = {}; if (queries) { @@ -69861,8 +69861,8 @@ ${key}:${decodeURIComponent(lowercaseQueries[key])}`; if (this.operationCount >= BATCH_MAX_REQUEST) { throw new RangeError(`Cannot exceed ${BATCH_MAX_REQUEST} sub requests in a single batch`); } - const path19 = getURLPath(subRequest.url); - if (!path19 || path19 === "") { + const path20 = getURLPath(subRequest.url); + if (!path20 || path20 === "") { throw new RangeError(`Invalid url for sub request: '${subRequest.url}'`); } } @@ -69922,8 +69922,8 @@ ${key}:${decodeURIComponent(lowercaseQueries[key])}`; pipeline = newPipeline(credentialOrPipeline, options); } const storageClientContext = new StorageContextClient(url2, getCoreClientOptions(pipeline)); - const path19 = getURLPath(url2); - if (path19 && path19 !== "/") { + const path20 = getURLPath(url2); + if (path20 && path20 !== "/") { this.serviceOrContainerContext = storageClientContext.container; } else { this.serviceOrContainerContext = storageClientContext.service; @@ -78647,7 +78647,7 @@ var require_tar = __commonJS({ var exec_1 = require_exec(); var io7 = __importStar4(require_io()); var fs_1 = require("fs"); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); var constants_1 = require_constants10(); var IS_WINDOWS = process.platform === "win32"; @@ -78693,13 +78693,13 @@ var require_tar = __commonJS({ const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && compressionMethod !== constants_1.CompressionMethod.Gzip && IS_WINDOWS; switch (type2) { case "create": - args.push("--posix", "-cf", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path19.sep}`, "g"), "/"), "--exclude", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path19.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path19.sep}`, "g"), "/"), "--files-from", constants_1.ManifestFilename); + args.push("--posix", "-cf", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path20.sep}`, "g"), "/"), "--exclude", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path20.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path20.sep}`, "g"), "/"), "--files-from", constants_1.ManifestFilename); break; case "extract": - args.push("-xf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path19.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path19.sep}`, "g"), "/")); + args.push("-xf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path20.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path20.sep}`, "g"), "/")); break; case "list": - args.push("-tf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path19.sep}`, "g"), "/"), "-P"); + args.push("-tf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path20.sep}`, "g"), "/"), "-P"); break; } if (tarPath.type === constants_1.ArchiveToolType.GNU) { @@ -78745,7 +78745,7 @@ var require_tar = __commonJS({ return BSD_TAR_ZSTD ? [ "zstd -d --long=30 --force -o", constants_1.TarFilename, - archivePath.replace(new RegExp(`\\${path19.sep}`, "g"), "/") + archivePath.replace(new RegExp(`\\${path20.sep}`, "g"), "/") ] : [ "--use-compress-program", IS_WINDOWS ? '"zstd -d --long=30"' : "unzstd --long=30" @@ -78754,7 +78754,7 @@ var require_tar = __commonJS({ return BSD_TAR_ZSTD ? [ "zstd -d --force -o", constants_1.TarFilename, - archivePath.replace(new RegExp(`\\${path19.sep}`, "g"), "/") + archivePath.replace(new RegExp(`\\${path20.sep}`, "g"), "/") ] : ["--use-compress-program", IS_WINDOWS ? '"zstd -d"' : "unzstd"]; default: return ["-z"]; @@ -78769,7 +78769,7 @@ var require_tar = __commonJS({ case constants_1.CompressionMethod.Zstd: return BSD_TAR_ZSTD ? [ "zstd -T0 --long=30 --force -o", - cacheFileName.replace(new RegExp(`\\${path19.sep}`, "g"), "/"), + cacheFileName.replace(new RegExp(`\\${path20.sep}`, "g"), "/"), constants_1.TarFilename ] : [ "--use-compress-program", @@ -78778,7 +78778,7 @@ var require_tar = __commonJS({ case constants_1.CompressionMethod.ZstdWithoutLong: return BSD_TAR_ZSTD ? [ "zstd -T0 --force -o", - cacheFileName.replace(new RegExp(`\\${path19.sep}`, "g"), "/"), + cacheFileName.replace(new RegExp(`\\${path20.sep}`, "g"), "/"), constants_1.TarFilename ] : ["--use-compress-program", IS_WINDOWS ? '"zstd -T0"' : "zstdmt"]; default: @@ -78818,7 +78818,7 @@ var require_tar = __commonJS({ exports2.extractTar = extractTar2; function createTar(archiveFolder, sourceDirectories, compressionMethod) { return __awaiter4(this, void 0, void 0, function* () { - (0, fs_1.writeFileSync)(path19.join(archiveFolder, constants_1.ManifestFilename), sourceDirectories.join("\n")); + (0, fs_1.writeFileSync)(path20.join(archiveFolder, constants_1.ManifestFilename), sourceDirectories.join("\n")); const commands = yield getCommands(compressionMethod, "create"); yield execCommands(commands, archiveFolder); }); @@ -78888,7 +78888,7 @@ var require_cache3 = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core14 = __importStar4(require_core()); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); var cacheHttpClient = __importStar4(require_cacheHttpClient()); var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); @@ -78978,7 +78978,7 @@ var require_cache3 = __commonJS({ core14.info("Lookup only - skipping download"); return cacheEntry.cacheKey; } - archivePath = path19.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); + archivePath = path20.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); core14.debug(`Archive Path: ${archivePath}`); yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options); if (core14.isDebug()) { @@ -79047,7 +79047,7 @@ var require_cache3 = __commonJS({ core14.info("Lookup only - skipping download"); return response.matchedKey; } - archivePath = path19.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); + archivePath = path20.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); core14.debug(`Archive path: ${archivePath}`); core14.debug(`Starting download of archive to: ${archivePath}`); yield cacheHttpClient.downloadCache(response.signedDownloadUrl, archivePath, options); @@ -79110,7 +79110,7 @@ var require_cache3 = __commonJS({ throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`); } const archiveFolder = yield utils.createTempDirectory(); - const archivePath = path19.join(archiveFolder, utils.getCacheFileName(compressionMethod)); + const archivePath = path20.join(archiveFolder, utils.getCacheFileName(compressionMethod)); core14.debug(`Archive Path: ${archivePath}`); try { yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod); @@ -79174,7 +79174,7 @@ var require_cache3 = __commonJS({ throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`); } const archiveFolder = yield utils.createTempDirectory(); - const archivePath = path19.join(archiveFolder, utils.getCacheFileName(compressionMethod)); + const archivePath = path20.join(archiveFolder, utils.getCacheFileName(compressionMethod)); core14.debug(`Archive Path: ${archivePath}`); try { yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod); @@ -79349,7 +79349,7 @@ var require_internal_path_helper2 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.safeTrimTrailingSeparator = exports2.normalizeSeparators = exports2.hasRoot = exports2.hasAbsoluteRoot = exports2.ensureAbsoluteRoot = exports2.dirname = void 0; - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var assert_1 = __importDefault4(require("assert")); var IS_WINDOWS = process.platform === "win32"; function dirname3(p) { @@ -79357,7 +79357,7 @@ var require_internal_path_helper2 = __commonJS({ if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) { return p; } - let result = path19.dirname(p); + let result = path20.dirname(p); if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) { result = safeTrimTrailingSeparator(result); } @@ -79395,7 +79395,7 @@ var require_internal_path_helper2 = __commonJS({ (0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); if (root.endsWith("/") || IS_WINDOWS && root.endsWith("\\")) { } else { - root += path19.sep; + root += path20.sep; } return root + itemPath; } @@ -79433,10 +79433,10 @@ var require_internal_path_helper2 = __commonJS({ return ""; } p = normalizeSeparators(p); - if (!p.endsWith(path19.sep)) { + if (!p.endsWith(path20.sep)) { return p; } - if (p === path19.sep) { + if (p === path20.sep) { return p; } if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) { @@ -79587,7 +79587,7 @@ var require_internal_path2 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Path = void 0; - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var pathHelper = __importStar4(require_internal_path_helper2()); var assert_1 = __importDefault4(require("assert")); var IS_WINDOWS = process.platform === "win32"; @@ -79602,12 +79602,12 @@ var require_internal_path2 = __commonJS({ (0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`); itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); if (!pathHelper.hasRoot(itemPath)) { - this.segments = itemPath.split(path19.sep); + this.segments = itemPath.split(path20.sep); } else { let remaining = itemPath; let dir = pathHelper.dirname(remaining); while (dir !== remaining) { - const basename = path19.basename(remaining); + const basename = path20.basename(remaining); this.segments.unshift(basename); remaining = dir; dir = pathHelper.dirname(remaining); @@ -79625,7 +79625,7 @@ var require_internal_path2 = __commonJS({ (0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); this.segments.push(segment); } else { - (0, assert_1.default)(!segment.includes(path19.sep), `Parameter 'itemPath' contains unexpected path separators`); + (0, assert_1.default)(!segment.includes(path20.sep), `Parameter 'itemPath' contains unexpected path separators`); this.segments.push(segment); } } @@ -79636,12 +79636,12 @@ var require_internal_path2 = __commonJS({ */ toString() { let result = this.segments[0]; - let skipSlash = result.endsWith(path19.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result); + let skipSlash = result.endsWith(path20.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result); for (let i = 1; i < this.segments.length; i++) { if (skipSlash) { skipSlash = false; } else { - result += path19.sep; + result += path20.sep; } result += this.segments[i]; } @@ -79689,7 +79689,7 @@ var require_internal_pattern2 = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Pattern = void 0; var os5 = __importStar4(require("os")); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var pathHelper = __importStar4(require_internal_path_helper2()); var assert_1 = __importDefault4(require("assert")); var minimatch_1 = require_minimatch(); @@ -79718,7 +79718,7 @@ var require_internal_pattern2 = __commonJS({ } pattern = _Pattern.fixupPattern(pattern, homedir2); this.segments = new internal_path_1.Path(pattern).segments; - this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path19.sep); + this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path20.sep); pattern = pathHelper.safeTrimTrailingSeparator(pattern); let foundGlob = false; const searchSegments = this.segments.map((x) => _Pattern.getLiteral(x)).filter((x) => !foundGlob && !(foundGlob = x === "")); @@ -79742,8 +79742,8 @@ var require_internal_pattern2 = __commonJS({ match(itemPath) { if (this.segments[this.segments.length - 1] === "**") { itemPath = pathHelper.normalizeSeparators(itemPath); - if (!itemPath.endsWith(path19.sep) && this.isImplicitPattern === false) { - itemPath = `${itemPath}${path19.sep}`; + if (!itemPath.endsWith(path20.sep) && this.isImplicitPattern === false) { + itemPath = `${itemPath}${path20.sep}`; } } else { itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); @@ -79778,9 +79778,9 @@ var require_internal_pattern2 = __commonJS({ (0, assert_1.default)(literalSegments.every((x, i) => (x !== "." || i === 0) && x !== ".."), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); (0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); pattern = pathHelper.normalizeSeparators(pattern); - if (pattern === "." || pattern.startsWith(`.${path19.sep}`)) { + if (pattern === "." || pattern.startsWith(`.${path20.sep}`)) { pattern = _Pattern.globEscape(process.cwd()) + pattern.substr(1); - } else if (pattern === "~" || pattern.startsWith(`~${path19.sep}`)) { + } else if (pattern === "~" || pattern.startsWith(`~${path20.sep}`)) { homedir2 = homedir2 || os5.homedir(); (0, assert_1.default)(homedir2, "Unable to determine HOME directory"); (0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir2), `Expected HOME directory to be a rooted path. Actual '${homedir2}'`); @@ -79864,8 +79864,8 @@ var require_internal_search_state2 = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.SearchState = void 0; var SearchState = class { - constructor(path19, level) { - this.path = path19; + constructor(path20, level) { + this.path = path20; this.level = level; } }; @@ -79991,7 +79991,7 @@ var require_internal_globber2 = __commonJS({ var core14 = __importStar4(require_core()); var fs18 = __importStar4(require("fs")); var globOptionsHelper = __importStar4(require_internal_glob_options_helper2()); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var patternHelper = __importStar4(require_internal_pattern_helper2()); var internal_match_kind_1 = require_internal_match_kind2(); var internal_pattern_1 = require_internal_pattern2(); @@ -80067,7 +80067,7 @@ var require_internal_globber2 = __commonJS({ if (!stats) { continue; } - if (options.excludeHiddenFiles && path19.basename(item.path).match(/^\./)) { + if (options.excludeHiddenFiles && path20.basename(item.path).match(/^\./)) { continue; } if (stats.isDirectory()) { @@ -80077,7 +80077,7 @@ var require_internal_globber2 = __commonJS({ continue; } const childLevel = item.level + 1; - const childItems = (yield __await4(fs18.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path19.join(item.path, x), childLevel)); + const childItems = (yield __await4(fs18.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path20.join(item.path, x), childLevel)); stack.push(...childItems.reverse()); } else if (match & internal_match_kind_1.MatchKind.File) { yield yield __await4(item.path); @@ -80229,7 +80229,7 @@ var require_internal_hash_files = __commonJS({ var fs18 = __importStar4(require("fs")); var stream2 = __importStar4(require("stream")); var util = __importStar4(require("util")); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); function hashFiles2(globber, currentWorkspace, verbose = false) { var _a, e_1, _b, _c; var _d; @@ -80245,7 +80245,7 @@ var require_internal_hash_files = __commonJS({ _e = false; const file = _c; writeDelegate(file); - if (!file.startsWith(`${githubWorkspace}${path19.sep}`)) { + if (!file.startsWith(`${githubWorkspace}${path20.sep}`)) { writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); continue; } @@ -80651,7 +80651,7 @@ var require_tool_cache = __commonJS({ var fs18 = __importStar4(require("fs")); var mm = __importStar4(require_manifest()); var os5 = __importStar4(require("os")); - var path19 = __importStar4(require("path")); + var path20 = __importStar4(require("path")); var httpm = __importStar4(require_lib()); var semver9 = __importStar4(require_semver2()); var stream2 = __importStar4(require("stream")); @@ -80672,8 +80672,8 @@ var require_tool_cache = __commonJS({ var userAgent = "actions/tool-cache"; function downloadTool2(url, dest, auth, headers) { return __awaiter4(this, void 0, void 0, function* () { - dest = dest || path19.join(_getTempDirectory(), crypto2.randomUUID()); - yield io7.mkdirP(path19.dirname(dest)); + dest = dest || path20.join(_getTempDirectory(), crypto2.randomUUID()); + yield io7.mkdirP(path20.dirname(dest)); core14.debug(`Downloading ${url}`); core14.debug(`Destination ${dest}`); const maxAttempts = 3; @@ -80760,7 +80760,7 @@ var require_tool_cache = __commonJS({ process.chdir(originalCwd); } } else { - const escapedScript = path19.join(__dirname, "..", "scripts", "Invoke-7zdec.ps1").replace(/'/g, "''").replace(/"|\n|\r/g, ""); + const escapedScript = path20.join(__dirname, "..", "scripts", "Invoke-7zdec.ps1").replace(/'/g, "''").replace(/"|\n|\r/g, ""); const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ""); const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ""); const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`; @@ -80936,7 +80936,7 @@ var require_tool_cache = __commonJS({ } const destPath = yield _createToolPath(tool, version, arch2); for (const itemName of fs18.readdirSync(sourceDir)) { - const s = path19.join(sourceDir, itemName); + const s = path20.join(sourceDir, itemName); yield io7.cp(s, destPath, { recursive: true }); } _completeToolPath(tool, version, arch2); @@ -80954,7 +80954,7 @@ var require_tool_cache = __commonJS({ throw new Error("sourceFile is not a file"); } const destFolder = yield _createToolPath(tool, version, arch2); - const destPath = path19.join(destFolder, targetFile); + const destPath = path20.join(destFolder, targetFile); core14.debug(`destination file ${destPath}`); yield io7.cp(sourceFile, destPath); _completeToolPath(tool, version, arch2); @@ -80978,7 +80978,7 @@ var require_tool_cache = __commonJS({ let toolPath = ""; if (versionSpec) { versionSpec = semver9.clean(versionSpec) || ""; - const cachePath = path19.join(_getCacheDirectory(), toolName, versionSpec, arch2); + const cachePath = path20.join(_getCacheDirectory(), toolName, versionSpec, arch2); core14.debug(`checking cache: ${cachePath}`); if (fs18.existsSync(cachePath) && fs18.existsSync(`${cachePath}.complete`)) { core14.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch2}`); @@ -80993,12 +80993,12 @@ var require_tool_cache = __commonJS({ function findAllVersions2(toolName, arch2) { const versions = []; arch2 = arch2 || os5.arch(); - const toolPath = path19.join(_getCacheDirectory(), toolName); + const toolPath = path20.join(_getCacheDirectory(), toolName); if (fs18.existsSync(toolPath)) { const children = fs18.readdirSync(toolPath); for (const child of children) { if (isExplicitVersion(child)) { - const fullPath = path19.join(toolPath, child, arch2 || ""); + const fullPath = path20.join(toolPath, child, arch2 || ""); if (fs18.existsSync(fullPath) && fs18.existsSync(`${fullPath}.complete`)) { versions.push(child); } @@ -81053,7 +81053,7 @@ var require_tool_cache = __commonJS({ function _createExtractFolder(dest) { return __awaiter4(this, void 0, void 0, function* () { if (!dest) { - dest = path19.join(_getTempDirectory(), crypto2.randomUUID()); + dest = path20.join(_getTempDirectory(), crypto2.randomUUID()); } yield io7.mkdirP(dest); return dest; @@ -81061,7 +81061,7 @@ var require_tool_cache = __commonJS({ } function _createToolPath(tool, version, arch2) { return __awaiter4(this, void 0, void 0, function* () { - const folderPath = path19.join(_getCacheDirectory(), tool, semver9.clean(version) || version, arch2 || ""); + const folderPath = path20.join(_getCacheDirectory(), tool, semver9.clean(version) || version, arch2 || ""); core14.debug(`destination ${folderPath}`); const markerPath = `${folderPath}.complete`; yield io7.rmRF(folderPath); @@ -81071,7 +81071,7 @@ var require_tool_cache = __commonJS({ }); } function _completeToolPath(tool, version, arch2) { - const folderPath = path19.join(_getCacheDirectory(), tool, semver9.clean(version) || version, arch2 || ""); + const folderPath = path20.join(_getCacheDirectory(), tool, semver9.clean(version) || version, arch2 || ""); const markerPath = `${folderPath}.complete`; fs18.writeFileSync(markerPath, ""); core14.debug("finished caching tool"); @@ -81682,7 +81682,7 @@ var require_follow_redirects = __commonJS({ // src/init-action.ts var fs17 = __toESM(require("fs")); -var path18 = __toESM(require("path")); +var path19 = __toESM(require("path")); var core13 = __toESM(require_core()); var io6 = __toESM(require_io()); var semver8 = __toESM(require_semver2()); @@ -82138,12 +82138,12 @@ var import_fast_glob = __toESM(require_out4(), 1); var import_ignore = __toESM(require_ignore(), 1); // node_modules/slash/index.js -function slash(path19) { - const isExtendedLengthPath = path19.startsWith("\\\\?\\"); +function slash(path20) { + const isExtendedLengthPath = path20.startsWith("\\\\?\\"); if (isExtendedLengthPath) { - return path19; + return path20; } - return path19.replace(/\\/g, "/"); + return path20.replace(/\\/g, "/"); } // node_modules/globby/utilities.js @@ -82231,8 +82231,8 @@ var assertPatternsInput = (patterns) => { } }; var normalizePathForDirectoryGlob = (filePath, cwd) => { - const path19 = isNegativePattern(filePath) ? filePath.slice(1) : filePath; - return import_node_path3.default.isAbsolute(path19) ? path19 : import_node_path3.default.join(cwd, path19); + const path20 = isNegativePattern(filePath) ? filePath.slice(1) : filePath; + return import_node_path3.default.isAbsolute(path20) ? path20 : import_node_path3.default.join(cwd, path20); }; var getDirectoryGlob = ({ directoryPath, files, extensions }) => { const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : ""; @@ -86172,9 +86172,8 @@ function getDependencyCachingEnabled() { // src/config-utils.ts var fs9 = __toESM(require("fs")); -var path10 = __toESM(require("path")); +var path11 = __toESM(require("path")); var import_perf_hooks = require("perf_hooks"); -var semver4 = __toESM(require_semver2()); // src/analyses.ts var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => { @@ -86201,10 +86200,217 @@ async function parseAnalysisKinds(input) { } var codeQualityQueries = ["code-quality"]; +// src/config/db-config.ts +var path7 = __toESM(require("path")); +var semver2 = __toESM(require_semver2()); + +// src/error-messages.ts +var PACKS_PROPERTY = "packs"; +function getConfigFileOutsideWorkspaceErrorMessage(configFile) { + return `The configuration file "${configFile}" is outside of the workspace`; +} +function getConfigFileDoesNotExistErrorMessage(configFile) { + return `The configuration file "${configFile}" does not exist`; +} +function getConfigFileRepoFormatInvalidMessage(configFile) { + let error2 = `The configuration file "${configFile}" is not a supported remote file reference.`; + error2 += " Expected format //@"; + return error2; +} +function getConfigFileFormatInvalidMessage(configFile) { + return `The configuration file "${configFile}" could not be read`; +} +function getConfigFileDirectoryGivenMessage(configFile) { + return `The configuration file "${configFile}" looks like a directory, not a file`; +} +function getConfigFilePropertyError(configFile, property, error2) { + if (configFile === void 0) { + return `The workflow property "${property}" is invalid: ${error2}`; + } else { + return `The configuration file "${configFile}" is invalid: property "${property}" ${error2}`; + } +} +function getPacksStrInvalid(packStr, configFile) { + return configFile ? getConfigFilePropertyError( + configFile, + PACKS_PROPERTY, + `"${packStr}" is not a valid pack` + ) : `"${packStr}" is not a valid pack`; +} +function getNoLanguagesError() { + return "Did not detect any languages to analyze. Please update input in workflow or check that GitHub detects the correct languages in your repository."; +} +function getUnknownLanguagesError(languages) { + return `Did not recognize the following languages: ${languages.join(", ")}`; +} + +// src/config/db-config.ts +function shouldCombine(inputValue) { + return !!inputValue?.trim().startsWith("+"); +} +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); +function parsePacksSpecification(packStr) { + if (typeof packStr !== "string") { + throw new ConfigurationError(getPacksStrInvalid(packStr)); + } + packStr = packStr.trim(); + const atIndex = packStr.indexOf("@"); + const colonIndex = packStr.indexOf(":", atIndex); + const packStart = 0; + const versionStart = atIndex + 1 || void 0; + const pathStart = colonIndex + 1 || void 0; + const packEnd = Math.min( + atIndex > 0 ? atIndex : Infinity, + colonIndex > 0 ? colonIndex : Infinity, + packStr.length + ); + const versionEnd = versionStart ? Math.min(colonIndex > 0 ? colonIndex : Infinity, packStr.length) : void 0; + const pathEnd = pathStart ? packStr.length : void 0; + const packName = packStr.slice(packStart, packEnd).trim(); + const version = versionStart ? packStr.slice(versionStart, versionEnd).trim() : void 0; + const packPath = pathStart ? packStr.slice(pathStart, pathEnd).trim() : void 0; + if (!PACK_IDENTIFIER_PATTERN.test(packName)) { + throw new ConfigurationError(getPacksStrInvalid(packStr)); + } + if (version) { + try { + new semver2.Range(version); + } catch { + throw new ConfigurationError(getPacksStrInvalid(packStr)); + } + } + if (packPath && (path7.isAbsolute(packPath) || // Permit using "/" instead of "\" on Windows + // Use `x.split(y).join(z)` as a polyfill for `x.replaceAll(y, z)` since + // if we used a regex we'd need to escape the path separator on Windows + // which seems more awkward. + path7.normalize(packPath).split(path7.sep).join("/") !== packPath.split(path7.sep).join("/"))) { + throw new ConfigurationError(getPacksStrInvalid(packStr)); + } + if (!packPath && pathStart) { + throw new ConfigurationError(getPacksStrInvalid(packStr)); + } + return { + name: packName, + version, + path: packPath + }; +} +function validatePackSpecification(pack) { + return prettyPrintPack(parsePacksSpecification(pack)); +} +function parsePacksFromInput(rawPacksInput, languages, packsInputCombines) { + if (!rawPacksInput?.trim()) { + return void 0; + } + if (languages.length > 1) { + throw new ConfigurationError( + "Cannot specify a 'packs' input in a multi-language analysis. Use a codeql-config.yml file instead and specify packs by language." + ); + } else if (languages.length === 0) { + throw new ConfigurationError( + "No languages specified. Cannot process the packs input." + ); + } + rawPacksInput = rawPacksInput.trim(); + if (packsInputCombines) { + rawPacksInput = rawPacksInput.trim().substring(1).trim(); + if (!rawPacksInput) { + throw new ConfigurationError( + getConfigFilePropertyError( + void 0, + "packs", + "A '+' was used in the 'packs' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs." + ) + ); + } + } + return { + [languages[0]]: rawPacksInput.split(",").reduce((packs, pack) => { + packs.push(validatePackSpecification(pack)); + return packs; + }, []) + }; +} +async function calculateAugmentation(rawPacksInput, rawQueriesInput, languages) { + const packsInputCombines = shouldCombine(rawPacksInput); + const packsInput = parsePacksFromInput( + rawPacksInput, + languages, + packsInputCombines + ); + const queriesInputCombines = shouldCombine(rawQueriesInput); + const queriesInput = parseQueriesFromInput( + rawQueriesInput, + queriesInputCombines + ); + return { + packsInputCombines, + packsInput: packsInput?.[languages[0]], + queriesInput, + queriesInputCombines + }; +} +function parseQueriesFromInput(rawQueriesInput, queriesInputCombines) { + if (!rawQueriesInput) { + return void 0; + } + const trimmedInput = queriesInputCombines ? rawQueriesInput.trim().slice(1).trim() : rawQueriesInput?.trim() ?? ""; + if (queriesInputCombines && trimmedInput.length === 0) { + throw new ConfigurationError( + getConfigFilePropertyError( + void 0, + "queries", + "A '+' was used in the 'queries' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs." + ) + ); + } + return trimmedInput.split(",").map((query) => ({ uses: query.trim() })); +} +function generateCodeScanningConfig(originalUserInput, augmentationProperties) { + const augmentedConfig = cloneObject(originalUserInput); + if (augmentationProperties.queriesInput) { + if (augmentationProperties.queriesInputCombines) { + augmentedConfig.queries = (augmentedConfig.queries || []).concat( + augmentationProperties.queriesInput + ); + } else { + augmentedConfig.queries = augmentationProperties.queriesInput; + } + } + if (augmentedConfig.queries?.length === 0) { + delete augmentedConfig.queries; + } + if (augmentationProperties.packsInput) { + if (augmentationProperties.packsInputCombines) { + if (Array.isArray(augmentedConfig.packs)) { + augmentedConfig.packs = (augmentedConfig.packs || []).concat( + augmentationProperties.packsInput + ); + } else if (!augmentedConfig.packs) { + augmentedConfig.packs = augmentationProperties.packsInput; + } else { + const language = Object.keys(augmentedConfig.packs)[0]; + augmentedConfig.packs[language] = augmentedConfig.packs[language].concat(augmentationProperties.packsInput); + } + } else { + augmentedConfig.packs = augmentationProperties.packsInput; + } + } + if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) { + delete augmentedConfig.packs; + } + return augmentedConfig; +} + // src/feature-flags.ts var fs7 = __toESM(require("fs")); -var path8 = __toESM(require("path")); -var semver3 = __toESM(require_semver2()); +var path9 = __toESM(require("path")); +var semver4 = __toESM(require_semver2()); // src/defaults.json var bundleVersion = "codeql-bundle-v2.23.0"; @@ -86213,7 +86419,7 @@ var cliVersion = "2.23.0"; // src/overlay-database-utils.ts var crypto = __toESM(require("crypto")); var fs6 = __toESM(require("fs")); -var path7 = __toESM(require("path")); +var path8 = __toESM(require("path")); var actionsCache = __toESM(require_cache3()); // src/git-utils.ts @@ -86317,8 +86523,8 @@ var getFileOidsUnderPath = async function(basePath) { const match = line.match(regex); if (match) { const oid = match[1]; - const path19 = decodeGitFilePath(match[2]); - fileOidMap[path19] = oid; + const path20 = decodeGitFilePath(match[2]); + fileOidMap[path20] = oid; } else { throw new Error(`Unexpected "git ls-files" output: ${line}`); } @@ -86442,7 +86648,7 @@ async function readBaseDatabaseOidsFile(config, logger) { } } function getBaseDatabaseOidsFilePath(config) { - return path7.join(config.dbLocation, "base-database-oids.json"); + return path8.join(config.dbLocation, "base-database-oids.json"); } async function writeOverlayChangesFile(config, sourceRoot, logger) { const baseFileOids = await readBaseDatabaseOidsFile(config, logger); @@ -86452,7 +86658,7 @@ async function writeOverlayChangesFile(config, sourceRoot, logger) { `Found ${changedFiles.length} changed file(s) under ${sourceRoot}.` ); const changedFilesJson = JSON.stringify({ changes: changedFiles }); - const overlayChangesFile = path7.join( + const overlayChangesFile = path8.join( getTemporaryDirectory(), "overlay-changes.json" ); @@ -86581,7 +86787,7 @@ function createCacheKeyHash(components) { } // src/tools-features.ts -var semver2 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); function isSupportedToolsFeature(versionInfo, feature) { return !!versionInfo.features && versionInfo.features[feature]; } @@ -86766,7 +86972,7 @@ var Features = class { this.gitHubFeatureFlags = new GitHubFeatureFlags( gitHubVersion, repositoryNwo, - path8.join(tempDir, FEATURE_FLAGS_FILE_NAME), + path9.join(tempDir, FEATURE_FLAGS_FILE_NAME), logger ); } @@ -86865,7 +87071,7 @@ var GitHubFeatureFlags = class { DEFAULT_VERSION_FEATURE_FLAG_PREFIX.length, f.length - DEFAULT_VERSION_FEATURE_FLAG_SUFFIX.length ).replace(/_/g, "."); - if (!semver3.valid(version)) { + if (!semver4.valid(version)) { this.logger.warning( `Ignoring feature flag ${f} as it does not specify a valid CodeQL version.` ); @@ -87062,7 +87268,7 @@ var KnownLanguage = /* @__PURE__ */ ((KnownLanguage2) => { // src/trap-caching.ts var fs8 = __toESM(require("fs")); -var path9 = __toESM(require("path")); +var path10 = __toESM(require("path")); var actionsCache2 = __toESM(require_cache3()); var CACHE_VERSION2 = 1; var CODEQL_TRAP_CACHE_PREFIX = "codeql-trap"; @@ -87078,12 +87284,12 @@ async function downloadTrapCaches(codeql, languages, logger) { `Found ${languagesSupportingCaching.length} languages that support TRAP caching` ); if (languagesSupportingCaching.length === 0) return result; - const cachesDir = path9.join( + const cachesDir = path10.join( getTemporaryDirectory(), "trapCaches" ); for (const language of languagesSupportingCaching) { - const cacheDir = path9.join(cachesDir, language); + const cacheDir = path10.join(cachesDir, language); fs8.mkdirSync(cacheDir, { recursive: true }); result[language] = cacheDir; } @@ -87096,7 +87302,7 @@ async function downloadTrapCaches(codeql, languages, logger) { let baseSha = "unknown"; const eventPath = process.env.GITHUB_EVENT_PATH; if (getWorkflowEventName() === "pull_request" && eventPath !== void 0) { - const event = JSON.parse(fs8.readFileSync(path9.resolve(eventPath), "utf-8")); + const event = JSON.parse(fs8.readFileSync(path10.resolve(eventPath), "utf-8")); baseSha = event.pull_request?.base?.sha || baseSha; } for (const language of languages) { @@ -87170,44 +87376,6 @@ async function cachePrefix(codeql, language) { } // src/config-utils.ts -var PACKS_PROPERTY = "packs"; -function getPacksStrInvalid(packStr, configFile) { - return configFile ? getConfigFilePropertyError( - configFile, - PACKS_PROPERTY, - `"${packStr}" is not a valid pack` - ) : `"${packStr}" is not a valid pack`; -} -function getConfigFileOutsideWorkspaceErrorMessage(configFile) { - return `The configuration file "${configFile}" is outside of the workspace`; -} -function getConfigFileDoesNotExistErrorMessage(configFile) { - return `The configuration file "${configFile}" does not exist`; -} -function getConfigFileRepoFormatInvalidMessage(configFile) { - let error2 = `The configuration file "${configFile}" is not a supported remote file reference.`; - error2 += " Expected format //@"; - return error2; -} -function getConfigFileFormatInvalidMessage(configFile) { - return `The configuration file "${configFile}" could not be read`; -} -function getConfigFileDirectoryGivenMessage(configFile) { - return `The configuration file "${configFile}" looks like a directory, not a file`; -} -function getConfigFilePropertyError(configFile, property, error2) { - if (configFile === void 0) { - return `The workflow property "${property}" is invalid: ${error2}`; - } else { - return `The configuration file "${configFile}" is invalid: property "${property}" ${error2}`; - } -} -function getNoLanguagesError() { - return "Did not detect any languages to analyze. Please update input in workflow or check that GitHub detects the correct languages in your repository."; -} -function getUnknownLanguagesError(languages) { - return `Did not recognize the following languages: ${languages.join(", ")}`; -} async function getSupportedLanguageMap(codeql, features, logger) { const resolveSupportedLanguagesUsingCli = await features.getValue( "resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */, @@ -87236,7 +87404,7 @@ async function getSupportedLanguageMap(codeql, features, logger) { } var baseWorkflowsPath = ".github/workflows"; function hasActionsWorkflows(sourceRoot) { - const workflowsPath = path10.resolve(sourceRoot, baseWorkflowsPath); + const workflowsPath = path11.resolve(sourceRoot, baseWorkflowsPath); const stats = fs9.lstatSync(workflowsPath, { throwIfNoEntry: false }); return stats !== void 0 && stats.isDirectory() && fs9.readdirSync(workflowsPath).length > 0; } @@ -87279,7 +87447,9 @@ async function getLanguages(codeql, languagesInput, repository, sourceRoot, feat } const languages = Array.from(languagesSet); if (!autodetected && unknownLanguages.length > 0) { - throw new ConfigurationError(getUnknownLanguagesError(unknownLanguages)); + throw new ConfigurationError( + getUnknownLanguagesError(unknownLanguages) + ); } if (languages.length === 0) { throw new ConfigurationError(getNoLanguagesError()); @@ -87393,8 +87563,8 @@ async function downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logg async function loadUserConfig(configFile, workspacePath, apiDetails, tempDir) { if (isLocal(configFile)) { if (configFile !== userConfigFromActionPath(tempDir)) { - configFile = path10.resolve(workspacePath, configFile); - if (!(configFile + path10.sep).startsWith(workspacePath + path10.sep)) { + configFile = path11.resolve(workspacePath, configFile); + if (!(configFile + path11.sep).startsWith(workspacePath + path11.sep)) { throw new ConfigurationError( getConfigFileOutsideWorkspaceErrorMessage(configFile) ); @@ -87405,41 +87575,6 @@ async function loadUserConfig(configFile, workspacePath, apiDetails, tempDir) { return await getRemoteConfig(configFile, apiDetails); } } -async function calculateAugmentation(rawPacksInput, rawQueriesInput, languages) { - const packsInputCombines = shouldCombine(rawPacksInput); - const packsInput = parsePacksFromInput( - rawPacksInput, - languages, - packsInputCombines - ); - const queriesInputCombines = shouldCombine(rawQueriesInput); - const queriesInput = parseQueriesFromInput( - rawQueriesInput, - queriesInputCombines - ); - return { - packsInputCombines, - packsInput: packsInput?.[languages[0]], - queriesInput, - queriesInputCombines - }; -} -function parseQueriesFromInput(rawQueriesInput, queriesInputCombines) { - if (!rawQueriesInput) { - return void 0; - } - const trimmedInput = queriesInputCombines ? rawQueriesInput.trim().slice(1).trim() : rawQueriesInput?.trim() ?? ""; - if (queriesInputCombines && trimmedInput.length === 0) { - throw new ConfigurationError( - getConfigFilePropertyError( - void 0, - "queries", - "A '+' was used in the 'queries' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs." - ) - ); - } - return trimmedInput.split(",").map((query) => ({ uses: query.trim() })); -} var OVERLAY_ANALYSIS_FEATURES = { actions: "overlay_analysis_actions" /* OverlayAnalysisActions */, cpp: "overlay_analysis_cpp" /* OverlayAnalysisCpp */, @@ -87551,102 +87686,11 @@ async function getOverlayDatabaseMode(codeql, repository, features, languages, s useOverlayDatabaseCaching }; } -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); -function parsePacksFromInput(rawPacksInput, languages, packsInputCombines) { - if (!rawPacksInput?.trim()) { - return void 0; - } - if (languages.length > 1) { - throw new ConfigurationError( - "Cannot specify a 'packs' input in a multi-language analysis. Use a codeql-config.yml file instead and specify packs by language." - ); - } else if (languages.length === 0) { - throw new ConfigurationError( - "No languages specified. Cannot process the packs input." - ); - } - rawPacksInput = rawPacksInput.trim(); - if (packsInputCombines) { - rawPacksInput = rawPacksInput.trim().substring(1).trim(); - if (!rawPacksInput) { - throw new ConfigurationError( - getConfigFilePropertyError( - void 0, - "packs", - "A '+' was used in the 'packs' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs." - ) - ); - } - } - return { - [languages[0]]: rawPacksInput.split(",").reduce((packs, pack) => { - packs.push(validatePackSpecification(pack)); - return packs; - }, []) - }; -} -function parsePacksSpecification(packStr) { - if (typeof packStr !== "string") { - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - packStr = packStr.trim(); - const atIndex = packStr.indexOf("@"); - const colonIndex = packStr.indexOf(":", atIndex); - const packStart = 0; - const versionStart = atIndex + 1 || void 0; - const pathStart = colonIndex + 1 || void 0; - const packEnd = Math.min( - atIndex > 0 ? atIndex : Infinity, - colonIndex > 0 ? colonIndex : Infinity, - packStr.length - ); - const versionEnd = versionStart ? Math.min(colonIndex > 0 ? colonIndex : Infinity, packStr.length) : void 0; - const pathEnd = pathStart ? packStr.length : void 0; - const packName = packStr.slice(packStart, packEnd).trim(); - const version = versionStart ? packStr.slice(versionStart, versionEnd).trim() : void 0; - const packPath = pathStart ? packStr.slice(pathStart, pathEnd).trim() : void 0; - if (!PACK_IDENTIFIER_PATTERN.test(packName)) { - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - if (version) { - try { - new semver4.Range(version); - } catch { - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - } - if (packPath && (path10.isAbsolute(packPath) || // Permit using "/" instead of "\" on Windows - // Use `x.split(y).join(z)` as a polyfill for `x.replaceAll(y, z)` since - // if we used a regex we'd need to escape the path separator on Windows - // which seems more awkward. - path10.normalize(packPath).split(path10.sep).join("/") !== packPath.split(path10.sep).join("/"))) { - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - if (!packPath && pathStart) { - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - return { - name: packName, - version, - path: packPath - }; -} -function validatePackSpecification(pack) { - return prettyPrintPack(parsePacksSpecification(pack)); -} -function shouldCombine(inputValue) { - return !!inputValue?.trim().startsWith("+"); -} function dbLocationOrDefault(dbLocation, tempDir) { - return dbLocation || path10.resolve(tempDir, "codeql_databases"); + return dbLocation || path11.resolve(tempDir, "codeql_databases"); } function userConfigFromActionPath(tempDir) { - return path10.resolve(tempDir, "user-config-from-action.yml"); + return path11.resolve(tempDir, "user-config-from-action.yml"); } function hasQueryCustomisation(userConfig) { return isDefined(userConfig["disable-default-queries"]) || isDefined(userConfig.queries) || isDefined(userConfig["query-filters"]); @@ -87766,19 +87810,21 @@ async function getRemoteConfig(configFile, apiDetails) { getConfigFileDirectoryGivenMessage(configFile) ); } else { - throw new ConfigurationError(getConfigFileFormatInvalidMessage(configFile)); + throw new ConfigurationError( + getConfigFileFormatInvalidMessage(configFile) + ); } return load( Buffer.from(fileContents, "base64").toString("binary") ); } function getPathToParsedConfigFile(tempDir) { - return path10.join(tempDir, "config"); + return path11.join(tempDir, "config"); } async function saveConfig(config, logger) { const configString = JSON.stringify(config); const configFile = getPathToParsedConfigFile(config.tempDir); - fs9.mkdirSync(path10.dirname(configFile), { recursive: true }); + fs9.mkdirSync(path11.dirname(configFile), { recursive: true }); fs9.writeFileSync(configFile, configString, "utf8"); logger.debug("Saved config:"); logger.debug(configString); @@ -87789,7 +87835,7 @@ async function generateRegistries(registriesInput, tempDir, logger) { let qlconfigFile; if (registries) { const qlconfig = createRegistriesBlock(registries); - qlconfigFile = path10.join(tempDir, "qlconfig.yml"); + qlconfigFile = path11.join(tempDir, "qlconfig.yml"); const qlconfigContents = dump(qlconfig); fs9.writeFileSync(qlconfigFile, qlconfigContents, "utf8"); logger.debug("Generated qlconfig.yml:"); @@ -87866,41 +87912,6 @@ async function parseBuildModeInput(input, languages, features, logger) { } return input; } -function generateCodeScanningConfig(originalUserInput, augmentationProperties) { - const augmentedConfig = cloneObject(originalUserInput); - if (augmentationProperties.queriesInput) { - if (augmentationProperties.queriesInputCombines) { - augmentedConfig.queries = (augmentedConfig.queries || []).concat( - augmentationProperties.queriesInput - ); - } else { - augmentedConfig.queries = augmentationProperties.queriesInput; - } - } - if (augmentedConfig.queries?.length === 0) { - delete augmentedConfig.queries; - } - if (augmentationProperties.packsInput) { - if (augmentationProperties.packsInputCombines) { - if (Array.isArray(augmentedConfig.packs)) { - augmentedConfig.packs = (augmentedConfig.packs || []).concat( - augmentationProperties.packsInput - ); - } else if (!augmentedConfig.packs) { - augmentedConfig.packs = augmentationProperties.packsInput; - } else { - const language = Object.keys(augmentedConfig.packs)[0]; - augmentedConfig.packs[language] = augmentedConfig.packs[language].concat(augmentationProperties.packsInput); - } - } else { - augmentedConfig.packs = augmentationProperties.packsInput; - } - } - if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) { - delete augmentedConfig.packs; - } - return augmentedConfig; -} function appendExtraQueryExclusions(extraQueryExclusions, cliConfig) { const augmentedConfig = cloneObject(cliConfig); if (extraQueryExclusions.length === 0) { @@ -88100,13 +88111,13 @@ function flushDiagnostics(config) { // src/init.ts var fs15 = __toESM(require("fs")); -var path16 = __toESM(require("path")); +var path17 = __toESM(require("path")); var toolrunner4 = __toESM(require_toolrunner()); var io5 = __toESM(require_io()); // src/codeql.ts var fs14 = __toESM(require("fs")); -var path15 = __toESM(require("path")); +var path16 = __toESM(require("path")); var core10 = __toESM(require_core()); var toolrunner3 = __toESM(require_toolrunner()); @@ -88349,7 +88360,7 @@ function wrapCliConfigurationError(cliError) { // src/setup-codeql.ts var fs12 = __toESM(require("fs")); -var path13 = __toESM(require("path")); +var path14 = __toESM(require("path")); var toolcache3 = __toESM(require_tool_cache()); var import_fast_deep_equal = __toESM(require_fast_deep_equal()); var semver7 = __toESM(require_semver2()); @@ -88515,7 +88526,7 @@ function inferCompressionMethod(tarPath) { // src/tools-download.ts var fs11 = __toESM(require("fs")); var os3 = __toESM(require("os")); -var path12 = __toESM(require("path")); +var path13 = __toESM(require("path")); var import_perf_hooks2 = require("perf_hooks"); var core9 = __toESM(require_core()); var import_http_client = __toESM(require_lib()); @@ -88648,7 +88659,7 @@ async function downloadAndExtractZstdWithStreaming(codeqlURL, dest, authorizatio await extractTarZst(response, dest, tarVersion, logger); } function getToolcacheDirectory(version) { - return path12.join( + return path13.join( getRequiredEnvParam("RUNNER_TOOL_CACHE"), TOOLCACHE_TOOL_NAME, semver6.clean(version) || version, @@ -88788,7 +88799,7 @@ async function findOverridingToolsInCache(humanReadableVersion, logger) { const candidates = toolcache3.findAllVersions("CodeQL").filter(isGoodVersion).map((version) => ({ folder: toolcache3.find("CodeQL", version), version - })).filter(({ folder }) => fs12.existsSync(path13.join(folder, "pinned-version"))); + })).filter(({ folder }) => fs12.existsSync(path14.join(folder, "pinned-version"))); if (candidates.length === 1) { const candidate = candidates[0]; logger.debug( @@ -89121,12 +89132,12 @@ async function useZstdBundle(cliVersion2, tarSupportsZstd) { ); } function getTempExtractionDir(tempDir) { - return path13.join(tempDir, v4_default()); + return path14.join(tempDir, v4_default()); } // src/tracer-config.ts var fs13 = __toESM(require("fs")); -var path14 = __toESM(require("path")); +var path15 = __toESM(require("path")); async function shouldEnableIndirectTracing(codeql, config) { if (config.buildMode === "none" /* None */) { return false; @@ -89139,7 +89150,7 @@ async function shouldEnableIndirectTracing(codeql, config) { async function getTracerConfigForCluster(config) { const tracingEnvVariables = JSON.parse( fs13.readFileSync( - path14.resolve( + path15.resolve( config.dbLocation, "temp/tracingEnvironment/start-tracing.json" ), @@ -89186,7 +89197,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliV toolsDownloadStatusReport )}` ); - let codeqlCmd = path15.join(codeqlFolder, "codeql", "codeql"); + let codeqlCmd = path16.join(codeqlFolder, "codeql", "codeql"); if (process.platform === "win32") { codeqlCmd += ".exe"; } else if (process.platform !== "linux" && process.platform !== "darwin") { @@ -89241,7 +89252,7 @@ async function getCodeQLForCmd(cmd, checkVersion) { }, async isTracedLanguage(language) { const extractorPath = await this.resolveExtractor(language); - const tracingConfigPath = path15.join( + const tracingConfigPath = path16.join( extractorPath, "tools", "tracing-config.lua" @@ -89317,7 +89328,7 @@ async function getCodeQLForCmd(cmd, checkVersion) { }, async runAutobuild(config, language) { applyAutobuildAzurePipelinesTimeoutFix(); - const autobuildCmd = path15.join( + const autobuildCmd = path16.join( await this.resolveExtractor(language), "tools", process.platform === "win32" ? "autobuild.cmd" : "autobuild.sh" @@ -89730,7 +89741,7 @@ async function getTrapCachingExtractorConfigArgsForLang(config, language) { ]; } function getGeneratedCodeScanningConfigPath(config) { - return path15.resolve(config.tempDir, "user-config.yaml"); + return path16.resolve(config.tempDir, "user-config.yaml"); } function getExtractionVerbosityArguments(enableDebugLogging) { return enableDebugLogging ? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`] : []; @@ -89819,9 +89830,9 @@ async function checkPacksForOverlayCompatibility(codeql, config, logger) { } function checkPackForOverlayCompatibility(packDir, codeQlOverlayVersion, logger) { try { - let qlpackPath = path16.join(packDir, "qlpack.yml"); + let qlpackPath = path17.join(packDir, "qlpack.yml"); if (!fs15.existsSync(qlpackPath)) { - qlpackPath = path16.join(packDir, "codeql-pack.yml"); + qlpackPath = path17.join(packDir, "codeql-pack.yml"); } const qlpackContents = load( fs15.readFileSync(qlpackPath, "utf8") @@ -89829,7 +89840,7 @@ function checkPackForOverlayCompatibility(packDir, codeQlOverlayVersion, logger) if (!qlpackContents.buildMetadata) { return true; } - const packInfoPath = path16.join(packDir, ".packinfo"); + const packInfoPath = path17.join(packDir, ".packinfo"); if (!fs15.existsSync(packInfoPath)) { logger.warning( `The query pack at ${packDir} does not have a .packinfo file, so it cannot support overlay analysis. Recompiling the query pack with the latest CodeQL CLI should solve this problem.` @@ -89862,7 +89873,7 @@ function checkPackForOverlayCompatibility(packDir, codeQlOverlayVersion, logger) } async function checkInstallPython311(languages, codeql) { if (languages.includes("python" /* python */) && process.platform === "win32" && !(await codeql.getVersion()).features?.supportsPython312) { - const script = path16.resolve( + const script = path17.resolve( __dirname, "../python-setup", "check_python12.ps1" @@ -90127,7 +90138,7 @@ async function createInitWithConfigStatusReport(config, initStatusReport, config // src/workflow.ts var fs16 = __toESM(require("fs")); -var path17 = __toESM(require("path")); +var path18 = __toESM(require("path")); var import_zlib = __toESM(require("zlib")); var core12 = __toESM(require_core()); function toCodedErrors(errors) { @@ -90282,7 +90293,7 @@ async function getWorkflow(logger) { } async function getWorkflowAbsolutePath(logger) { const relativePath = await getWorkflowRelativePath(); - const absolutePath = path17.join( + const absolutePath = path18.join( getRequiredEnvParam("GITHUB_WORKSPACE"), relativePath ); @@ -90378,7 +90389,7 @@ async function run() { core13.exportVariable("JOB_RUN_UUID" /* JOB_RUN_UUID */, jobRunUuid); core13.exportVariable("CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */, "true"); const configFile = getOptionalInput("config-file"); - const sourceRoot = path18.resolve( + const sourceRoot = path19.resolve( getRequiredEnvParam("GITHUB_WORKSPACE"), getOptionalInput("source-root") || "" ); @@ -90555,14 +90566,14 @@ async function run() { )) { try { logger.debug(`Applying static binary workaround for Go`); - const tempBinPath = path18.resolve( + const tempBinPath = path19.resolve( getTemporaryDirectory(), "codeql-action-go-tracing", "bin" ); fs17.mkdirSync(tempBinPath, { recursive: true }); core13.addPath(tempBinPath); - const goWrapperPath = path18.resolve(tempBinPath, "go"); + const goWrapperPath = path19.resolve(tempBinPath, "go"); fs17.writeFileSync( goWrapperPath, `#!/bin/bash diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 784b37f3cf..447d12c654 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -26447,7 +26447,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -78228,7 +78228,6 @@ function wrapCliConfigurationError(cliError) { // src/config-utils.ts var fs3 = __toESM(require("fs")); var path3 = __toESM(require("path")); -var semver4 = __toESM(require_semver2()); // src/analyses.ts var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => { @@ -78241,8 +78240,17 @@ var supportedAnalysisKinds = new Set(Object.values(AnalysisKind)); // src/caching-utils.ts var core6 = __toESM(require_core()); +// src/config/db-config.ts +var semver2 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + // src/feature-flags.ts -var semver3 = __toESM(require_semver2()); +var semver4 = __toESM(require_semver2()); // src/overlay-database-utils.ts var fs2 = __toESM(require("fs")); @@ -78480,7 +78488,7 @@ function computeChangedFiles(baseFileOids, overlayFileOids) { } // src/tools-features.ts -var semver2 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); function isSupportedToolsFeature(versionInfo, feature) { return !!versionInfo.features && versionInfo.features[feature]; } @@ -78684,12 +78692,6 @@ var OVERLAY_ANALYSIS_CODE_SCANNING_FEATURES = { rust: "overlay_analysis_code_scanning_rust" /* OverlayAnalysisCodeScanningRust */, swift: "overlay_analysis_code_scanning_swift" /* OverlayAnalysisCodeScanningSwift */ }; -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); function getPathToParsedConfigFile(tempDir) { return path3.join(tempDir, "config"); } diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index c26090ba03..adcfb47e4d 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -26447,7 +26447,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -93456,7 +93456,7 @@ var require_commonjs16 = __commonJS({ var TYPEMASK = 1023; var entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN; var normalizeCache = /* @__PURE__ */ new Map(); - var normalize2 = (s) => { + var normalize = (s) => { const c = normalizeCache.get(s); if (c) return c; @@ -93469,7 +93469,7 @@ var require_commonjs16 = __commonJS({ const c = normalizeNocaseCache.get(s); if (c) return c; - const n = normalize2(s.toLowerCase()); + const n = normalize(s.toLowerCase()); normalizeNocaseCache.set(s, n); return n; }; @@ -93638,7 +93638,7 @@ var require_commonjs16 = __commonJS({ */ constructor(name, type2 = UNKNOWN, root, roots, nocase, children, opts) { this.name = name; - this.#matchName = nocase ? normalizeNocase(name) : normalize2(name); + this.#matchName = nocase ? normalizeNocase(name) : normalize(name); this.#type = type2 & TYPEMASK; this.nocase = nocase; this.roots = roots; @@ -93731,7 +93731,7 @@ var require_commonjs16 = __commonJS({ return this.parent || this; } const children = this.children(); - const name = this.nocase ? normalizeNocase(pathPart) : normalize2(pathPart); + const name = this.nocase ? normalizeNocase(pathPart) : normalize(pathPart); for (const p of children) { if (p.#matchName === name) { return p; @@ -93976,7 +93976,7 @@ var require_commonjs16 = __commonJS({ * directly. */ isNamed(n) { - return !this.nocase ? this.#matchName === normalize2(n) : this.#matchName === normalizeNocase(n); + return !this.nocase ? this.#matchName === normalize(n) : this.#matchName === normalizeNocase(n); } /** * Return the Path object corresponding to the target of a symbolic link. @@ -94115,7 +94115,7 @@ var require_commonjs16 = __commonJS({ #readdirMaybePromoteChild(e, c) { for (let p = c.provisional; p < c.length; p++) { const pchild = c[p]; - const name = this.nocase ? normalizeNocase(e.name) : normalize2(e.name); + const name = this.nocase ? normalizeNocase(e.name) : normalize(e.name); if (name !== pchild.#matchName) { continue; } @@ -101946,7 +101946,7 @@ var require_tr46 = __commonJS({ TRANSITIONAL: 0, NONTRANSITIONAL: 1 }; - function normalize2(str2) { + function normalize(str2) { return str2.split("\0").map(function(s) { return s.normalize("NFC"); }).join("\0"); @@ -102026,7 +102026,7 @@ var require_tr46 = __commonJS({ processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; } var error2 = false; - if (normalize2(label) !== label || label[3] === "-" && label[4] === "-" || label[0] === "-" || label[label.length - 1] === "-" || label.indexOf(".") !== -1 || label.search(combiningMarksRegex) === 0) { + if (normalize(label) !== label || label[3] === "-" && label[4] === "-" || label[0] === "-" || label[label.length - 1] === "-" || label.indexOf(".") !== -1 || label.search(combiningMarksRegex) === 0) { error2 = true; } var len = countSymbols(label); @@ -102044,7 +102044,7 @@ var require_tr46 = __commonJS({ } function processing(domain_name, useSTD3, processing_option) { var result = mapChars(domain_name, useSTD3, processing_option); - result.string = normalize2(result.string); + result.string = normalize(result.string); var labels = result.string.split("."); for (var i = 0; i < labels.length; ++i) { try { @@ -117127,7 +117127,6 @@ async function getGitHubVersion() { // src/config-utils.ts var fs = __toESM(require("fs")); var path = __toESM(require("path")); -var semver4 = __toESM(require_semver2()); // src/analyses.ts var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => { @@ -117140,8 +117139,17 @@ var supportedAnalysisKinds = new Set(Object.values(AnalysisKind)); // src/caching-utils.ts var core6 = __toESM(require_core()); +// src/config/db-config.ts +var semver2 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + // src/feature-flags.ts -var semver3 = __toESM(require_semver2()); +var semver4 = __toESM(require_semver2()); // src/overlay-database-utils.ts var actionsCache = __toESM(require_cache3()); @@ -117163,7 +117171,7 @@ var OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_MB = 15e3; var OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_BYTES = OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_MB * 1e6; // src/tools-features.ts -var semver2 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); // src/feature-flags.ts var featureConfig = { @@ -117364,12 +117372,6 @@ var OVERLAY_ANALYSIS_CODE_SCANNING_FEATURES = { rust: "overlay_analysis_code_scanning_rust" /* OverlayAnalysisCodeScanningRust */, swift: "overlay_analysis_code_scanning_swift" /* OverlayAnalysisCodeScanningSwift */ }; -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); function getPathToParsedConfigFile(tempDir) { return path.join(tempDir, "config"); } diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 474b6d820d..7a0475a3a1 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -44975,7 +44975,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, diff --git a/lib/upload-lib.js b/lib/upload-lib.js index 88dc2d5890..fe2660b72e 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -29019,7 +29019,7 @@ var require_pattern = __commonJS({ const absolute = []; const relative2 = []; for (const pattern of patterns) { - if (isAbsolute3(pattern)) { + if (isAbsolute2(pattern)) { absolute.push(pattern); } else { relative2.push(pattern); @@ -29028,10 +29028,10 @@ var require_pattern = __commonJS({ return [absolute, relative2]; } exports2.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative; - function isAbsolute3(pattern) { + function isAbsolute2(pattern) { return path15.isAbsolute(pattern); } - exports2.isAbsolute = isAbsolute3; + exports2.isAbsolute = isAbsolute2; } }); @@ -33593,7 +33593,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -88873,7 +88873,6 @@ function wrapCliConfigurationError(cliError) { // src/config-utils.ts var fs7 = __toESM(require("fs")); var path9 = __toESM(require("path")); -var semver4 = __toESM(require_semver2()); // src/analyses.ts var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => { @@ -88886,12 +88885,21 @@ var supportedAnalysisKinds = new Set(Object.values(AnalysisKind)); // src/caching-utils.ts var core6 = __toESM(require_core()); +// src/config/db-config.ts +var semver2 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + // src/diff-informed-analysis-utils.ts var fs6 = __toESM(require("fs")); var path8 = __toESM(require("path")); // src/feature-flags.ts -var semver3 = __toESM(require_semver2()); +var semver4 = __toESM(require_semver2()); // src/defaults.json var bundleVersion = "codeql-bundle-v2.23.0"; @@ -89175,7 +89183,7 @@ function computeChangedFiles(baseFileOids, overlayFileOids) { } // src/tools-features.ts -var semver2 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); function isSupportedToolsFeature(versionInfo, feature) { return !!versionInfo.features && versionInfo.features[feature]; } @@ -89398,12 +89406,6 @@ var OVERLAY_ANALYSIS_CODE_SCANNING_FEATURES = { rust: "overlay_analysis_code_scanning_rust" /* OverlayAnalysisCodeScanningRust */, swift: "overlay_analysis_code_scanning_swift" /* OverlayAnalysisCodeScanningSwift */ }; -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); function getPathToParsedConfigFile(tempDir) { return path9.join(tempDir, "config"); } diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index 0d03682546..65af1249c2 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -26447,7 +26447,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -117287,14 +117287,20 @@ var cliErrorsConfig = { } }; -// src/config-utils.ts -var semver4 = __toESM(require_semver2()); - // src/caching-utils.ts var core6 = __toESM(require_core()); +// src/config/db-config.ts +var semver2 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + // src/feature-flags.ts -var semver3 = __toESM(require_semver2()); +var semver4 = __toESM(require_semver2()); // src/overlay-database-utils.ts var actionsCache = __toESM(require_cache3()); @@ -117324,10 +117330,10 @@ var OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_MB = 15e3; var OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_BYTES = OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_MB * 1e6; // src/tools-features.ts -var semver2 = __toESM(require_semver2()); +var semver3 = __toESM(require_semver2()); var SafeArtifactUploadVersion = "2.20.3"; function isSafeArtifactUpload(codeQlVersion) { - return !codeQlVersion ? true : semver2.gte(codeQlVersion, SafeArtifactUploadVersion); + return !codeQlVersion ? true : semver3.gte(codeQlVersion, SafeArtifactUploadVersion); } // src/feature-flags.ts @@ -117529,12 +117535,6 @@ var OVERLAY_ANALYSIS_CODE_SCANNING_FEATURES = { rust: "overlay_analysis_code_scanning_rust" /* OverlayAnalysisCodeScanningRust */, swift: "overlay_analysis_code_scanning_swift" /* OverlayAnalysisCodeScanningSwift */ }; -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); // src/setup-codeql.ts var toolcache3 = __toESM(require_tool_cache()); diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index f603d0aa17..f4a55884c0 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -27722,7 +27722,7 @@ var require_pattern = __commonJS({ const absolute = []; const relative2 = []; for (const pattern of patterns) { - if (isAbsolute3(pattern)) { + if (isAbsolute2(pattern)) { absolute.push(pattern); } else { relative2.push(pattern); @@ -27731,10 +27731,10 @@ var require_pattern = __commonJS({ return [absolute, relative2]; } exports2.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative; - function isAbsolute3(pattern) { + function isAbsolute2(pattern) { return path16.isAbsolute(pattern); } - exports2.isAbsolute = isAbsolute3; + exports2.isAbsolute = isAbsolute2; } }); @@ -32296,7 +32296,7 @@ var require_package = __commonJS({ lint: "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - test: "npm run transpile && ava src/**.test.ts --serial --verbose", + test: "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", transpile: "tsc --build --verbose" }, @@ -89619,11 +89619,19 @@ var core9 = __toESM(require_core()); // src/config-utils.ts var fs8 = __toESM(require("fs")); var path10 = __toESM(require("path")); -var semver4 = __toESM(require_semver2()); // src/caching-utils.ts var core8 = __toESM(require_core()); +// src/config/db-config.ts +var semver4 = __toESM(require_semver2()); +var PACK_IDENTIFIER_PATTERN = (function() { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + // src/diff-informed-analysis-utils.ts var fs7 = __toESM(require("fs")); var path9 = __toESM(require("path")); @@ -89672,12 +89680,6 @@ var OVERLAY_ANALYSIS_CODE_SCANNING_FEATURES = { rust: "overlay_analysis_code_scanning_rust" /* OverlayAnalysisCodeScanningRust */, swift: "overlay_analysis_code_scanning_swift" /* OverlayAnalysisCodeScanningSwift */ }; -var PACK_IDENTIFIER_PATTERN = (function() { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); function getPathToParsedConfigFile(tempDir) { return path10.join(tempDir, "config"); } diff --git a/package.json b/package.json index 8cffcaa509..8c33d89879 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "lint": "eslint --report-unused-disable-directives --max-warnings=0 .", "lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint --report-unused-disable-directives --max-warnings=0 . --format @microsoft/eslint-formatter-sarif --output-file=eslint.sarif", "lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix", - "test": "npm run transpile && ava src/**.test.ts --serial --verbose", + "test": "npm run transpile && ava src/ --serial --verbose", "test-debug": "npm run test -- --timeout=20m", "transpile": "tsc --build --verbose" }, diff --git a/src/config-utils.test.ts b/src/config-utils.test.ts index b5ef777170..8938adf845 100644 --- a/src/config-utils.test.ts +++ b/src/config-utils.test.ts @@ -12,6 +12,7 @@ import * as api from "./api-client"; import { CachingKind } from "./caching-utils"; import { createStubCodeQL } from "./codeql"; import * as configUtils from "./config-utils"; +import * as errorMessages from "./error-messages"; import { Feature } from "./feature-flags"; import * as gitUtils from "./git-utils"; import { KnownLanguage, Language } from "./languages"; @@ -32,7 +33,6 @@ import { import { GitHubVariant, GitHubVersion, - prettyPrintPack, ConfigurationError, withTmpDir, BuildMode, @@ -341,7 +341,7 @@ test("load input outside of workspace", async (t) => { t.deepEqual( err, new ConfigurationError( - configUtils.getConfigFileOutsideWorkspaceErrorMessage( + errorMessages.getConfigFileOutsideWorkspaceErrorMessage( path.join(tempDir, "../input"), ), ), @@ -368,7 +368,7 @@ test("load non-local input with invalid repo syntax", async (t) => { t.deepEqual( err, new ConfigurationError( - configUtils.getConfigFileRepoFormatInvalidMessage( + errorMessages.getConfigFileRepoFormatInvalidMessage( "octo-org/codeql-config@main", ), ), @@ -397,7 +397,7 @@ test("load non-existent input", async (t) => { t.deepEqual( err, new ConfigurationError( - configUtils.getConfigFileDoesNotExistErrorMessage( + errorMessages.getConfigFileDoesNotExistErrorMessage( path.join(tempDir, "input"), ), ), @@ -604,7 +604,7 @@ test("Remote config handles the case where a directory is provided", async (t) = t.deepEqual( err, new ConfigurationError( - configUtils.getConfigFileDirectoryGivenMessage(repoReference), + errorMessages.getConfigFileDirectoryGivenMessage(repoReference), ), ); } @@ -632,7 +632,7 @@ test("Invalid format of remote config handled correctly", async (t) => { t.deepEqual( err, new ConfigurationError( - configUtils.getConfigFileFormatInvalidMessage(repoReference), + errorMessages.getConfigFileFormatInvalidMessage(repoReference), ), ); } @@ -660,7 +660,7 @@ test("No detected languages", async (t) => { } catch (err) { t.deepEqual( err, - new ConfigurationError(configUtils.getNoLanguagesError()), + new ConfigurationError(errorMessages.getNoLanguagesError()), ); } }); @@ -683,344 +683,15 @@ test("Unknown languages", async (t) => { t.deepEqual( err, new ConfigurationError( - configUtils.getUnknownLanguagesError(["rubbish", "english"]), + errorMessages.getUnknownLanguagesError(["rubbish", "english"]), ), ); } }); }); -/** - * Test macro for ensuring the packs block is valid - */ -const parsePacksMacro = test.macro({ - exec: ( - t: ExecutionContext, - packsInput: string, - languages: Language[], - expected: configUtils.Packs | undefined, - ) => - t.deepEqual( - configUtils.parsePacksFromInput(packsInput, languages, false), - expected, - ), - - title: (providedTitle = "") => `Parse Packs: ${providedTitle}`, -}); - -/** - * Test macro for testing when the packs block is invalid - */ -const parsePacksErrorMacro = test.macro({ - exec: ( - t: ExecutionContext, - packsInput: string, - languages: Language[], - expected: RegExp, - ) => - t.throws( - () => configUtils.parsePacksFromInput(packsInput, languages, false), - { - message: expected, - }, - ), - title: (providedTitle = "") => `Parse Packs Error: ${providedTitle}`, -}); - -/** - * Test macro for testing when the packs block is invalid - */ -const invalidPackNameMacro = test.macro({ - exec: (t: ExecutionContext, name: string) => - parsePacksErrorMacro.exec( - t, - name, - [KnownLanguage.cpp], - new RegExp(`^"${name}" is not a valid pack$`), - ), - title: (_providedTitle: string | undefined, arg: string | undefined) => - `Invalid pack string: ${arg}`, -}); - -test("no packs", parsePacksMacro, "", [], undefined); -test("two packs", parsePacksMacro, "a/b,c/d@1.2.3", [KnownLanguage.cpp], { - [KnownLanguage.cpp]: ["a/b", "c/d@1.2.3"], -}); -test( - "two packs with spaces", - parsePacksMacro, - " a/b , c/d@1.2.3 ", - [KnownLanguage.cpp], - { - [KnownLanguage.cpp]: ["a/b", "c/d@1.2.3"], - }, -); -test( - "two packs with language", - parsePacksErrorMacro, - "a/b,c/d@1.2.3", - [KnownLanguage.cpp, KnownLanguage.java], - new RegExp( - "Cannot specify a 'packs' input in a multi-language analysis. " + - "Use a codeql-config.yml file instead and specify packs by language.", - ), -); - -test( - "packs with other valid names", - parsePacksMacro, - [ - // ranges are ok - "c/d@1.0", - "c/d@~1.0.0", - "c/d@~1.0.0:a/b", - "c/d@~1.0.0+abc:a/b", - "c/d@~1.0.0-abc:a/b", - "c/d:a/b", - // whitespace is removed - " c/d @ ~1.0.0 : b.qls ", - // and it is retained within a path - " c/d @ ~1.0.0 : b/a path with/spaces.qls ", - // this is valid. the path is '@'. It will probably fail when passed to the CLI - "c/d@1.2.3:@", - // this is valid, too. It will fail if it doesn't match a path - // (globbing is not done) - "c/d@1.2.3:+*)_(", - ].join(","), - [KnownLanguage.cpp], - { - [KnownLanguage.cpp]: [ - "c/d@1.0", - "c/d@~1.0.0", - "c/d@~1.0.0:a/b", - "c/d@~1.0.0+abc:a/b", - "c/d@~1.0.0-abc:a/b", - "c/d:a/b", - "c/d@~1.0.0:b.qls", - "c/d@~1.0.0:b/a path with/spaces.qls", - "c/d@1.2.3:@", - "c/d@1.2.3:+*)_(", - ], - }, -); - -test(invalidPackNameMacro, "c"); // all packs require at least a scope and a name -test(invalidPackNameMacro, "c-/d"); -test(invalidPackNameMacro, "-c/d"); -test(invalidPackNameMacro, "c/d_d"); -test(invalidPackNameMacro, "c/d@@"); -test(invalidPackNameMacro, "c/d@1.0.0:"); -test(invalidPackNameMacro, "c/d:"); -test(invalidPackNameMacro, "c/d:/a"); -test(invalidPackNameMacro, "@1.0.0:a"); -test(invalidPackNameMacro, "c/d@../a"); -test(invalidPackNameMacro, "c/d@b/../a"); -test(invalidPackNameMacro, "c/d:z@1"); - -/** - * Test macro for pretty printing pack specs - */ -const packSpecPrettyPrintingMacro = test.macro({ - exec: (t: ExecutionContext, packStr: string, packObj: configUtils.Pack) => { - const parsed = configUtils.parsePacksSpecification(packStr); - t.deepEqual(parsed, packObj, "parsed pack spec is correct"); - const stringified = prettyPrintPack(packObj); - t.deepEqual( - stringified, - packStr.trim(), - "pretty-printed pack spec is correct", - ); - - t.deepEqual( - configUtils.validatePackSpecification(packStr), - packStr.trim(), - "pack spec is valid", - ); - }, - title: ( - _providedTitle: string | undefined, - packStr: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _packObj: configUtils.Pack, - ) => `Prettyprint pack spec: '${packStr}'`, -}); - -test(packSpecPrettyPrintingMacro, "a/b", { - name: "a/b", - version: undefined, - path: undefined, -}); -test(packSpecPrettyPrintingMacro, "a/b@~1.2.3", { - name: "a/b", - version: "~1.2.3", - path: undefined, -}); -test(packSpecPrettyPrintingMacro, "a/b@~1.2.3:abc/def", { - name: "a/b", - version: "~1.2.3", - path: "abc/def", -}); -test(packSpecPrettyPrintingMacro, "a/b:abc/def", { - name: "a/b", - version: undefined, - path: "abc/def", -}); -test(packSpecPrettyPrintingMacro, " a/b:abc/def ", { - name: "a/b", - version: undefined, - path: "abc/def", -}); - const mockLogger = getRunnerLogger(true); -const calculateAugmentationMacro = test.macro({ - exec: async ( - t: ExecutionContext, - _title: string, - rawPacksInput: string | undefined, - rawQueriesInput: string | undefined, - languages: Language[], - expectedAugmentationProperties: configUtils.AugmentationProperties, - ) => { - const actualAugmentationProperties = - await configUtils.calculateAugmentation( - rawPacksInput, - rawQueriesInput, - languages, - ); - t.deepEqual(actualAugmentationProperties, expectedAugmentationProperties); - }, - title: (_, title) => `Calculate Augmentation: ${title}`, -}); - -test( - calculateAugmentationMacro, - "All empty", - undefined, - undefined, - [KnownLanguage.javascript], - { - ...configUtils.defaultAugmentationProperties, - }, -); - -test( - calculateAugmentationMacro, - "With queries", - undefined, - " a, b , c, d", - [KnownLanguage.javascript], - { - ...configUtils.defaultAugmentationProperties, - queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }], - }, -); - -test( - calculateAugmentationMacro, - "With queries combining", - undefined, - " + a, b , c, d ", - [KnownLanguage.javascript], - { - ...configUtils.defaultAugmentationProperties, - queriesInputCombines: true, - queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }], - }, -); - -test( - calculateAugmentationMacro, - "With packs", - " codeql/a , codeql/b , codeql/c , codeql/d ", - undefined, - [KnownLanguage.javascript], - { - ...configUtils.defaultAugmentationProperties, - packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"], - }, -); - -test( - calculateAugmentationMacro, - "With packs combining", - " + codeql/a, codeql/b, codeql/c, codeql/d", - undefined, - [KnownLanguage.javascript], - { - ...configUtils.defaultAugmentationProperties, - packsInputCombines: true, - packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"], - }, -); - -const calculateAugmentationErrorMacro = test.macro({ - exec: async ( - t: ExecutionContext, - _title: string, - rawPacksInput: string | undefined, - rawQueriesInput: string | undefined, - languages: Language[], - expectedError: RegExp | string, - ) => { - await t.throwsAsync( - () => - configUtils.calculateAugmentation( - rawPacksInput, - rawQueriesInput, - languages, - ), - { message: expectedError }, - ); - }, - title: (_, title) => `Calculate Augmentation Error: ${title}`, -}); - -test( - calculateAugmentationErrorMacro, - "Plus (+) with nothing else (queries)", - undefined, - " + ", - [KnownLanguage.javascript], - /The workflow property "queries" is invalid/, -); - -test( - calculateAugmentationErrorMacro, - "Plus (+) with nothing else (packs)", - " + ", - undefined, - [KnownLanguage.javascript], - /The workflow property "packs" is invalid/, -); - -test( - calculateAugmentationErrorMacro, - "Packs input with multiple languages", - " + a/b, c/d ", - undefined, - [KnownLanguage.javascript, KnownLanguage.java], - /Cannot specify a 'packs' input in a multi-language analysis/, -); - -test( - calculateAugmentationErrorMacro, - "Packs input with no languages", - " + a/b, c/d ", - undefined, - [], - /No languages specified/, -); - -test( - calculateAugmentationErrorMacro, - "Invalid packs", - " a-pack-without-a-scope ", - undefined, - [KnownLanguage.javascript], - /"a-pack-without-a-scope" is not a valid pack/, -); - test("no generateRegistries when registries is undefined", async (t) => { return await withTmpDir(async (tmpDir) => { const registriesInput = undefined; @@ -1097,28 +768,28 @@ const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); languagesInput: "", languagesInRepository: ["html"], expectedApiCall: true, - expectedError: configUtils.getNoLanguagesError(), + expectedError: errorMessages.getNoLanguagesError(), }, { name: "no languages", languagesInput: "", languagesInRepository: [], expectedApiCall: true, - expectedError: configUtils.getNoLanguagesError(), + expectedError: errorMessages.getNoLanguagesError(), }, { name: "unrecognized languages from input", languagesInput: "a, b, c, javascript", languagesInRepository: [], expectedApiCall: false, - expectedError: configUtils.getUnknownLanguagesError(["a", "b"]), + expectedError: errorMessages.getUnknownLanguagesError(["a", "b"]), }, { name: "extractors that aren't languages aren't included (specified)", languagesInput: "html", languagesInRepository: [], expectedApiCall: false, - expectedError: configUtils.getUnknownLanguagesError(["html"]), + expectedError: errorMessages.getUnknownLanguagesError(["html"]), }, { name: "extractors that aren't languages aren't included (autodetected)", diff --git a/src/config-utils.ts b/src/config-utils.ts index 538c366e86..1915102899 100644 --- a/src/config-utils.ts +++ b/src/config-utils.ts @@ -3,7 +3,6 @@ import * as path from "path"; import { performance } from "perf_hooks"; import * as yaml from "js-yaml"; -import * as semver from "semver"; import { getActionVersion, isAnalyzingPullRequest } from "./actions-util"; import { @@ -17,7 +16,14 @@ import { import * as api from "./api-client"; import { CachingKind, getCachingKind } from "./caching-utils"; import { type CodeQL } from "./codeql"; +import { + calculateAugmentation, + ExcludeQueryFilter, + generateCodeScanningConfig, + UserConfig, +} from "./config/db-config"; import { shouldPerformDiffInformedAnalysis } from "./diff-informed-analysis-utils"; +import * as errorMessages from "./error-messages"; import { Feature, FeatureEnablement } from "./feature-flags"; import { getGitRoot, isAnalyzingDefaultBranch } from "./git-utils"; import { KnownLanguage, Language } from "./languages"; @@ -30,7 +36,6 @@ import { RepositoryNwo } from "./repository"; import { downloadTrapCaches } from "./trap-caching"; import { GitHubVersion, - prettyPrintPack, ConfigurationError, BuildMode, codeQlVersionAtLeast, @@ -38,34 +43,7 @@ import { isDefined, } from "./util"; -// Property names from the user-supplied config file. - -const PACKS_PROPERTY = "packs"; - -/** - * Format of the config file supplied by the user. - */ -export interface UserConfig { - name?: string; - "disable-default-queries"?: boolean; - queries?: Array<{ - name?: string; - uses: string; - }>; - "paths-ignore"?: string[]; - paths?: string[]; - - // If this is a multi-language analysis, then the packages must be split by - // language. If this is a single language analysis, then no split by - // language is necessary. - packs?: Record | string[]; - - // Set of query filters to include and exclude extra queries based on - // codeql query suite `include` and `exclude` properties - "query-filters"?: QueryFilter[]; -} - -export type QueryFilter = ExcludeQueryFilter | IncludeQueryFilter; +export * from "./config/db-config"; export type RegistryConfigWithCredentials = RegistryConfigNoCredentials & { // Token to use when downloading packs from this registry. @@ -90,14 +68,6 @@ export interface RegistryConfigNoCredentials { kind?: "github" | "docker"; } -interface ExcludeQueryFilter { - exclude: Record; -} - -interface IncludeQueryFilter { - include: Record; -} - /** * Format of the parsed config file. */ @@ -199,121 +169,6 @@ export interface Config { useOverlayDatabaseCaching: boolean; } -/** - * Describes how to augment the user config with inputs from the action. - * - * When running a CodeQL analysis, the user can supply a config file. When - * running a CodeQL analysis from a GitHub action, the user can supply a - * config file _and_ a set of inputs. - * - * The inputs from the action are used to augment the user config before - * passing the user config to the CodeQL CLI invocation. - */ -export interface AugmentationProperties { - /** - * Whether or not the queries input combines with the queries in the config. - */ - queriesInputCombines: boolean; - - /** - * The queries input from the `with` block of the action declaration - */ - queriesInput?: Array<{ uses: string }>; - - /** - * Whether or not the packs input combines with the packs in the config. - */ - packsInputCombines: boolean; - - /** - * The packs input from the `with` block of the action declaration - */ - packsInput?: string[]; -} - -/** - * The default, empty augmentation properties. This is most useful - * for tests. - */ -export const defaultAugmentationProperties: AugmentationProperties = { - queriesInputCombines: false, - packsInputCombines: false, - packsInput: undefined, - queriesInput: undefined, -}; -export type Packs = Partial>; - -export interface Pack { - name: string; - version?: string; - path?: string; -} - -export function getPacksStrInvalid( - packStr: string, - configFile?: string, -): string { - return configFile - ? getConfigFilePropertyError( - configFile, - PACKS_PROPERTY, - `"${packStr}" is not a valid pack`, - ) - : `"${packStr}" is not a valid pack`; -} - -export function getConfigFileOutsideWorkspaceErrorMessage( - configFile: string, -): string { - return `The configuration file "${configFile}" is outside of the workspace`; -} - -export function getConfigFileDoesNotExistErrorMessage( - configFile: string, -): string { - return `The configuration file "${configFile}" does not exist`; -} - -export function getConfigFileRepoFormatInvalidMessage( - configFile: string, -): string { - let error = `The configuration file "${configFile}" is not a supported remote file reference.`; - error += " Expected format //@"; - - return error; -} - -export function getConfigFileFormatInvalidMessage(configFile: string): string { - return `The configuration file "${configFile}" could not be read`; -} - -export function getConfigFileDirectoryGivenMessage(configFile: string): string { - return `The configuration file "${configFile}" looks like a directory, not a file`; -} - -function getConfigFilePropertyError( - configFile: string | undefined, - property: string, - error: string, -): string { - if (configFile === undefined) { - return `The workflow property "${property}" is invalid: ${error}`; - } else { - return `The configuration file "${configFile}" is invalid: property "${property}" ${error}`; - } -} - -export function getNoLanguagesError(): string { - return ( - "Did not detect any languages to analyze. " + - "Please update input in workflow or check that GitHub detects the correct languages in your repository." - ); -} - -export function getUnknownLanguagesError(languages: string[]): string { - return `Did not recognize the following languages: ${languages.join(", ")}`; -} - export async function getSupportedLanguageMap( codeql: CodeQL, features: FeatureEnablement, @@ -450,13 +305,15 @@ export async function getLanguages( const languages = Array.from(languagesSet); if (!autodetected && unknownLanguages.length > 0) { - throw new ConfigurationError(getUnknownLanguagesError(unknownLanguages)); + throw new ConfigurationError( + errorMessages.getUnknownLanguagesError(unknownLanguages), + ); } // If the languages parameter was not given and no languages were // detected then fail here as this is a workflow configuration error. if (languages.length === 0) { - throw new ConfigurationError(getNoLanguagesError()); + throw new ConfigurationError(errorMessages.getNoLanguagesError()); } if (autodetected) { @@ -666,7 +523,7 @@ async function loadUserConfig( // Error if the config file is now outside of the workspace if (!(configFile + path.sep).startsWith(workspacePath + path.sep)) { throw new ConfigurationError( - getConfigFileOutsideWorkspaceErrorMessage(configFile), + errorMessages.getConfigFileOutsideWorkspaceErrorMessage(configFile), ); } } @@ -676,73 +533,6 @@ async function loadUserConfig( } } -/** - * Calculates how the codeql config file needs to be augmented before passing - * it to the CLI. The reason this is necessary is the codeql-action can be called - * with extra inputs from the workflow. These inputs are not part of the config - * and the CLI does not know about these inputs so we need to inject them into - * the config file sent to the CLI. - * - * @param rawPacksInput The packs input from the action configuration. - * @param rawQueriesInput The queries input from the action configuration. - * @param languages The languages that the config file is for. If the packs input - * is non-empty, then there must be exactly one language. Otherwise, an - * error is thrown. - * - * @returns The properties that need to be augmented in the config file. - * - * @throws An error if the packs input is non-empty and the languages input does - * not have exactly one language. - */ -// exported for testing. -export async function calculateAugmentation( - rawPacksInput: string | undefined, - rawQueriesInput: string | undefined, - languages: Language[], -): Promise { - const packsInputCombines = shouldCombine(rawPacksInput); - const packsInput = parsePacksFromInput( - rawPacksInput, - languages, - packsInputCombines, - ); - const queriesInputCombines = shouldCombine(rawQueriesInput); - const queriesInput = parseQueriesFromInput( - rawQueriesInput, - queriesInputCombines, - ); - - return { - packsInputCombines, - packsInput: packsInput?.[languages[0]], - queriesInput, - queriesInputCombines, - }; -} - -function parseQueriesFromInput( - rawQueriesInput: string | undefined, - queriesInputCombines: boolean, -) { - if (!rawQueriesInput) { - return undefined; - } - - const trimmedInput = queriesInputCombines - ? rawQueriesInput.trim().slice(1).trim() - : (rawQueriesInput?.trim() ?? ""); - if (queriesInputCombines && trimmedInput.length === 0) { - throw new ConfigurationError( - getConfigFilePropertyError( - undefined, - "queries", - "A '+' was used in the 'queries' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs.", - ), - ); - } - return trimmedInput.split(",").map((query) => ({ uses: query.trim() })); -} - const OVERLAY_ANALYSIS_FEATURES: Record = { actions: Feature.OverlayAnalysisActions, cpp: Feature.OverlayAnalysisCpp, @@ -938,161 +728,6 @@ export async function getOverlayDatabaseMode( }; } -/** - * Pack names must be in the form of `scope/name`, with only alpha-numeric characters, - * and `-` allowed as long as not the first or last char. - **/ -const PACK_IDENTIFIER_PATTERN = (function () { - const alphaNumeric = "[a-z0-9]"; - const alphaNumericDash = "[a-z0-9-]"; - const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; - return new RegExp(`^${component}/${component}$`); -})(); - -// Exported for testing -export function parsePacksFromInput( - rawPacksInput: string | undefined, - languages: Language[], - packsInputCombines: boolean, -): Packs | undefined { - if (!rawPacksInput?.trim()) { - return undefined; - } - - if (languages.length > 1) { - throw new ConfigurationError( - "Cannot specify a 'packs' input in a multi-language analysis. Use a codeql-config.yml file instead and specify packs by language.", - ); - } else if (languages.length === 0) { - throw new ConfigurationError( - "No languages specified. Cannot process the packs input.", - ); - } - - rawPacksInput = rawPacksInput.trim(); - if (packsInputCombines) { - rawPacksInput = rawPacksInput.trim().substring(1).trim(); - if (!rawPacksInput) { - throw new ConfigurationError( - getConfigFilePropertyError( - undefined, - "packs", - "A '+' was used in the 'packs' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs.", - ), - ); - } - } - - return { - [languages[0]]: rawPacksInput.split(",").reduce((packs, pack) => { - packs.push(validatePackSpecification(pack)); - return packs; - }, [] as string[]), - }; -} - -/** - * Validates that this package specification is syntactically correct. - * It may not point to any real package, but after this function returns - * without throwing, we are guaranteed that the package specification - * is roughly correct. - * - * The CLI itself will do a more thorough validation of the package - * specification. - * - * A package specification looks like this: - * - * `scope/name@version:path` - * - * Version and path are optional. - * - * @param packStr the package specification to verify. - * @param configFile Config file to use for error reporting - */ -export function parsePacksSpecification(packStr: string): Pack { - if (typeof packStr !== "string") { - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - - packStr = packStr.trim(); - const atIndex = packStr.indexOf("@"); - const colonIndex = packStr.indexOf(":", atIndex); - const packStart = 0; - const versionStart = atIndex + 1 || undefined; - const pathStart = colonIndex + 1 || undefined; - const packEnd = Math.min( - atIndex > 0 ? atIndex : Infinity, - colonIndex > 0 ? colonIndex : Infinity, - packStr.length, - ); - const versionEnd = versionStart - ? Math.min(colonIndex > 0 ? colonIndex : Infinity, packStr.length) - : undefined; - const pathEnd = pathStart ? packStr.length : undefined; - - const packName = packStr.slice(packStart, packEnd).trim(); - const version = versionStart - ? packStr.slice(versionStart, versionEnd).trim() - : undefined; - const packPath = pathStart - ? packStr.slice(pathStart, pathEnd).trim() - : undefined; - - if (!PACK_IDENTIFIER_PATTERN.test(packName)) { - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - if (version) { - try { - new semver.Range(version); - } catch { - // The range string is invalid. OK to ignore the caught error - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - } - - if ( - packPath && - (path.isAbsolute(packPath) || - // Permit using "/" instead of "\" on Windows - // Use `x.split(y).join(z)` as a polyfill for `x.replaceAll(y, z)` since - // if we used a regex we'd need to escape the path separator on Windows - // which seems more awkward. - path.normalize(packPath).split(path.sep).join("/") !== - packPath.split(path.sep).join("/")) - ) { - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - - if (!packPath && pathStart) { - // 0 length path - throw new ConfigurationError(getPacksStrInvalid(packStr)); - } - - return { - name: packName, - version, - path: packPath, - }; -} - -export function validatePackSpecification(pack: string) { - return prettyPrintPack(parsePacksSpecification(pack)); -} - -/** - * The convention in this action is that an input value that is prefixed with a '+' will - * be combined with the corresponding value in the config file. - * - * Without a '+', an input value will override the corresponding value in the config file. - * - * @param inputValue The input value to process. - * @returns true if the input value should replace the corresponding value in the config file, - * false if it should be appended. - */ -function shouldCombine(inputValue?: string): boolean { - return !!inputValue?.trim().startsWith("+"); -} - function dbLocationOrDefault( dbLocation: string | undefined, tempDir: string, @@ -1245,7 +880,7 @@ function getLocalConfig(configFile: string): UserConfig { // Error if the file does not exist if (!fs.existsSync(configFile)) { throw new ConfigurationError( - getConfigFileDoesNotExistErrorMessage(configFile), + errorMessages.getConfigFileDoesNotExistErrorMessage(configFile), ); } @@ -1264,7 +899,7 @@ async function getRemoteConfig( // 5 = 4 groups + the whole expression if (pieces === null || pieces.groups === undefined || pieces.length < 5) { throw new ConfigurationError( - getConfigFileRepoFormatInvalidMessage(configFile), + errorMessages.getConfigFileRepoFormatInvalidMessage(configFile), ); } @@ -1282,10 +917,12 @@ async function getRemoteConfig( fileContents = response.data.content; } else if (Array.isArray(response.data)) { throw new ConfigurationError( - getConfigFileDirectoryGivenMessage(configFile), + errorMessages.getConfigFileDirectoryGivenMessage(configFile), ); } else { - throw new ConfigurationError(getConfigFileFormatInvalidMessage(configFile)); + throw new ConfigurationError( + errorMessages.getConfigFileFormatInvalidMessage(configFile), + ); } return yaml.load( @@ -1496,56 +1133,6 @@ export async function parseBuildModeInput( return input as BuildMode; } -export function generateCodeScanningConfig( - originalUserInput: UserConfig, - augmentationProperties: AugmentationProperties, -): UserConfig { - // make a copy so we can modify it - const augmentedConfig = cloneObject(originalUserInput); - - // Inject the queries from the input - if (augmentationProperties.queriesInput) { - if (augmentationProperties.queriesInputCombines) { - augmentedConfig.queries = (augmentedConfig.queries || []).concat( - augmentationProperties.queriesInput, - ); - } else { - augmentedConfig.queries = augmentationProperties.queriesInput; - } - } - if (augmentedConfig.queries?.length === 0) { - delete augmentedConfig.queries; - } - - // Inject the packs from the input - if (augmentationProperties.packsInput) { - if (augmentationProperties.packsInputCombines) { - // At this point, we already know that this is a single-language analysis - if (Array.isArray(augmentedConfig.packs)) { - augmentedConfig.packs = (augmentedConfig.packs || []).concat( - augmentationProperties.packsInput, - ); - } else if (!augmentedConfig.packs) { - augmentedConfig.packs = augmentationProperties.packsInput; - } else { - // At this point, we know there is only one language. - // If there were more than one language, an error would already have been thrown. - const language = Object.keys(augmentedConfig.packs)[0]; - augmentedConfig.packs[language] = augmentedConfig.packs[ - language - ].concat(augmentationProperties.packsInput); - } - } else { - augmentedConfig.packs = augmentationProperties.packsInput; - } - } - if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) { - delete augmentedConfig.packs; - } - - return augmentedConfig; -} - /** * Appends `extraQueryExclusions` to `cliConfig`'s `query-filters`. * diff --git a/src/config/db-config.test.ts b/src/config/db-config.test.ts new file mode 100644 index 0000000000..78750a29ad --- /dev/null +++ b/src/config/db-config.test.ts @@ -0,0 +1,331 @@ +import test, { ExecutionContext } from "ava"; + +import { KnownLanguage, Language } from "../languages"; +import { prettyPrintPack } from "../util"; + +import * as dbConfig from "./db-config"; + +/** + * Test macro for ensuring the packs block is valid + */ +const parsePacksMacro = test.macro({ + exec: ( + t: ExecutionContext, + packsInput: string, + languages: Language[], + expected: dbConfig.Packs | undefined, + ) => + t.deepEqual( + dbConfig.parsePacksFromInput(packsInput, languages, false), + expected, + ), + + title: (providedTitle = "") => `Parse Packs: ${providedTitle}`, +}); + +/** + * Test macro for testing when the packs block is invalid + */ +const parsePacksErrorMacro = test.macro({ + exec: ( + t: ExecutionContext, + packsInput: string, + languages: Language[], + expected: RegExp, + ) => + t.throws(() => dbConfig.parsePacksFromInput(packsInput, languages, false), { + message: expected, + }), + title: (providedTitle = "") => `Parse Packs Error: ${providedTitle}`, +}); + +/** + * Test macro for testing when the packs block is invalid + */ +const invalidPackNameMacro = test.macro({ + exec: (t: ExecutionContext, name: string) => + parsePacksErrorMacro.exec( + t, + name, + [KnownLanguage.cpp], + new RegExp(`^"${name}" is not a valid pack$`), + ), + title: (_providedTitle: string | undefined, arg: string | undefined) => + `Invalid pack string: ${arg}`, +}); + +test("no packs", parsePacksMacro, "", [], undefined); +test("two packs", parsePacksMacro, "a/b,c/d@1.2.3", [KnownLanguage.cpp], { + [KnownLanguage.cpp]: ["a/b", "c/d@1.2.3"], +}); +test( + "two packs with spaces", + parsePacksMacro, + " a/b , c/d@1.2.3 ", + [KnownLanguage.cpp], + { + [KnownLanguage.cpp]: ["a/b", "c/d@1.2.3"], + }, +); +test( + "two packs with language", + parsePacksErrorMacro, + "a/b,c/d@1.2.3", + [KnownLanguage.cpp, KnownLanguage.java], + new RegExp( + "Cannot specify a 'packs' input in a multi-language analysis. " + + "Use a codeql-config.yml file instead and specify packs by language.", + ), +); + +test( + "packs with other valid names", + parsePacksMacro, + [ + // ranges are ok + "c/d@1.0", + "c/d@~1.0.0", + "c/d@~1.0.0:a/b", + "c/d@~1.0.0+abc:a/b", + "c/d@~1.0.0-abc:a/b", + "c/d:a/b", + // whitespace is removed + " c/d @ ~1.0.0 : b.qls ", + // and it is retained within a path + " c/d @ ~1.0.0 : b/a path with/spaces.qls ", + // this is valid. the path is '@'. It will probably fail when passed to the CLI + "c/d@1.2.3:@", + // this is valid, too. It will fail if it doesn't match a path + // (globbing is not done) + "c/d@1.2.3:+*)_(", + ].join(","), + [KnownLanguage.cpp], + { + [KnownLanguage.cpp]: [ + "c/d@1.0", + "c/d@~1.0.0", + "c/d@~1.0.0:a/b", + "c/d@~1.0.0+abc:a/b", + "c/d@~1.0.0-abc:a/b", + "c/d:a/b", + "c/d@~1.0.0:b.qls", + "c/d@~1.0.0:b/a path with/spaces.qls", + "c/d@1.2.3:@", + "c/d@1.2.3:+*)_(", + ], + }, +); + +test(invalidPackNameMacro, "c"); // all packs require at least a scope and a name +test(invalidPackNameMacro, "c-/d"); +test(invalidPackNameMacro, "-c/d"); +test(invalidPackNameMacro, "c/d_d"); +test(invalidPackNameMacro, "c/d@@"); +test(invalidPackNameMacro, "c/d@1.0.0:"); +test(invalidPackNameMacro, "c/d:"); +test(invalidPackNameMacro, "c/d:/a"); +test(invalidPackNameMacro, "@1.0.0:a"); +test(invalidPackNameMacro, "c/d@../a"); +test(invalidPackNameMacro, "c/d@b/../a"); +test(invalidPackNameMacro, "c/d:z@1"); + +/** + * Test macro for pretty printing pack specs + */ +const packSpecPrettyPrintingMacro = test.macro({ + exec: (t: ExecutionContext, packStr: string, packObj: dbConfig.Pack) => { + const parsed = dbConfig.parsePacksSpecification(packStr); + t.deepEqual(parsed, packObj, "parsed pack spec is correct"); + const stringified = prettyPrintPack(packObj); + t.deepEqual( + stringified, + packStr.trim(), + "pretty-printed pack spec is correct", + ); + + t.deepEqual( + dbConfig.validatePackSpecification(packStr), + packStr.trim(), + "pack spec is valid", + ); + }, + title: ( + _providedTitle: string | undefined, + packStr: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _packObj: dbConfig.Pack, + ) => `Prettyprint pack spec: '${packStr}'`, +}); + +test(packSpecPrettyPrintingMacro, "a/b", { + name: "a/b", + version: undefined, + path: undefined, +}); +test(packSpecPrettyPrintingMacro, "a/b@~1.2.3", { + name: "a/b", + version: "~1.2.3", + path: undefined, +}); +test(packSpecPrettyPrintingMacro, "a/b@~1.2.3:abc/def", { + name: "a/b", + version: "~1.2.3", + path: "abc/def", +}); +test(packSpecPrettyPrintingMacro, "a/b:abc/def", { + name: "a/b", + version: undefined, + path: "abc/def", +}); +test(packSpecPrettyPrintingMacro, " a/b:abc/def ", { + name: "a/b", + version: undefined, + path: "abc/def", +}); + +const calculateAugmentationMacro = test.macro({ + exec: async ( + t: ExecutionContext, + _title: string, + rawPacksInput: string | undefined, + rawQueriesInput: string | undefined, + languages: Language[], + expectedAugmentationProperties: dbConfig.AugmentationProperties, + ) => { + const actualAugmentationProperties = await dbConfig.calculateAugmentation( + rawPacksInput, + rawQueriesInput, + languages, + ); + t.deepEqual(actualAugmentationProperties, expectedAugmentationProperties); + }, + title: (_, title) => `Calculate Augmentation: ${title}`, +}); + +test( + calculateAugmentationMacro, + "All empty", + undefined, + undefined, + [KnownLanguage.javascript], + { + ...dbConfig.defaultAugmentationProperties, + }, +); + +test( + calculateAugmentationMacro, + "With queries", + undefined, + " a, b , c, d", + [KnownLanguage.javascript], + { + ...dbConfig.defaultAugmentationProperties, + queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }], + }, +); + +test( + calculateAugmentationMacro, + "With queries combining", + undefined, + " + a, b , c, d ", + [KnownLanguage.javascript], + { + ...dbConfig.defaultAugmentationProperties, + queriesInputCombines: true, + queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }], + }, +); + +test( + calculateAugmentationMacro, + "With packs", + " codeql/a , codeql/b , codeql/c , codeql/d ", + undefined, + [KnownLanguage.javascript], + { + ...dbConfig.defaultAugmentationProperties, + packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"], + }, +); + +test( + calculateAugmentationMacro, + "With packs combining", + " + codeql/a, codeql/b, codeql/c, codeql/d", + undefined, + [KnownLanguage.javascript], + { + ...dbConfig.defaultAugmentationProperties, + packsInputCombines: true, + packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"], + }, +); + +const calculateAugmentationErrorMacro = test.macro({ + exec: async ( + t: ExecutionContext, + _title: string, + rawPacksInput: string | undefined, + rawQueriesInput: string | undefined, + languages: Language[], + expectedError: RegExp | string, + ) => { + await t.throwsAsync( + () => + dbConfig.calculateAugmentation( + rawPacksInput, + rawQueriesInput, + languages, + ), + { message: expectedError }, + ); + }, + title: (_, title) => `Calculate Augmentation Error: ${title}`, +}); + +test( + calculateAugmentationErrorMacro, + "Plus (+) with nothing else (queries)", + undefined, + " + ", + [KnownLanguage.javascript], + /The workflow property "queries" is invalid/, +); + +test( + calculateAugmentationErrorMacro, + "Plus (+) with nothing else (packs)", + " + ", + undefined, + [KnownLanguage.javascript], + /The workflow property "packs" is invalid/, +); + +test( + calculateAugmentationErrorMacro, + "Packs input with multiple languages", + " + a/b, c/d ", + undefined, + [KnownLanguage.javascript, KnownLanguage.java], + /Cannot specify a 'packs' input in a multi-language analysis/, +); + +test( + calculateAugmentationErrorMacro, + "Packs input with no languages", + " + a/b, c/d ", + undefined, + [], + /No languages specified/, +); + +test( + calculateAugmentationErrorMacro, + "Invalid packs", + " a-pack-without-a-scope ", + undefined, + [KnownLanguage.javascript], + /"a-pack-without-a-scope" is not a valid pack/, +); diff --git a/src/config/db-config.ts b/src/config/db-config.ts new file mode 100644 index 0000000000..95138460f8 --- /dev/null +++ b/src/config/db-config.ts @@ -0,0 +1,363 @@ +import * as path from "path"; + +import * as semver from "semver"; + +import * as errorMessages from "../error-messages"; +import { Language } from "../languages"; +import { cloneObject, ConfigurationError, prettyPrintPack } from "../util"; + +export interface ExcludeQueryFilter { + exclude: Record; +} + +export interface IncludeQueryFilter { + include: Record; +} + +export type QueryFilter = ExcludeQueryFilter | IncludeQueryFilter; + +/** + * Format of the config file supplied by the user. + */ +export interface UserConfig { + name?: string; + "disable-default-queries"?: boolean; + queries?: Array<{ + name?: string; + uses: string; + }>; + "paths-ignore"?: string[]; + paths?: string[]; + + // If this is a multi-language analysis, then the packages must be split by + // language. If this is a single language analysis, then no split by + // language is necessary. + packs?: Record | string[]; + + // Set of query filters to include and exclude extra queries based on + // codeql query suite `include` and `exclude` properties + "query-filters"?: QueryFilter[]; +} + +/** + * Describes how to augment the user config with inputs from the action. + * + * When running a CodeQL analysis, the user can supply a config file. When + * running a CodeQL analysis from a GitHub action, the user can supply a + * config file _and_ a set of inputs. + * + * The inputs from the action are used to augment the user config before + * passing the user config to the CodeQL CLI invocation. + */ +export interface AugmentationProperties { + /** + * Whether or not the queries input combines with the queries in the config. + */ + queriesInputCombines: boolean; + + /** + * The queries input from the `with` block of the action declaration + */ + queriesInput?: Array<{ uses: string }>; + + /** + * Whether or not the packs input combines with the packs in the config. + */ + packsInputCombines: boolean; + + /** + * The packs input from the `with` block of the action declaration + */ + packsInput?: string[]; +} + +/** + * The default, empty augmentation properties. This is most useful + * for tests. + */ +export const defaultAugmentationProperties: AugmentationProperties = { + queriesInputCombines: false, + packsInputCombines: false, + packsInput: undefined, + queriesInput: undefined, +}; + +/** + * The convention in this action is that an input value that is prefixed with a '+' will + * be combined with the corresponding value in the config file. + * + * Without a '+', an input value will override the corresponding value in the config file. + * + * @param inputValue The input value to process. + * @returns true if the input value should replace the corresponding value in the config file, + * false if it should be appended. + */ +function shouldCombine(inputValue?: string): boolean { + return !!inputValue?.trim().startsWith("+"); +} + +export type Packs = Partial>; + +export interface Pack { + name: string; + version?: string; + path?: string; +} + +/** + * Pack names must be in the form of `scope/name`, with only alpha-numeric characters, + * and `-` allowed as long as not the first or last char. + **/ +const PACK_IDENTIFIER_PATTERN = (function () { + const alphaNumeric = "[a-z0-9]"; + const alphaNumericDash = "[a-z0-9-]"; + const component = `${alphaNumeric}(${alphaNumericDash}*${alphaNumeric})?`; + return new RegExp(`^${component}/${component}$`); +})(); + +/** + * Validates that this package specification is syntactically correct. + * It may not point to any real package, but after this function returns + * without throwing, we are guaranteed that the package specification + * is roughly correct. + * + * The CLI itself will do a more thorough validation of the package + * specification. + * + * A package specification looks like this: + * + * `scope/name@version:path` + * + * Version and path are optional. + * + * @param packStr the package specification to verify. + * @param configFile Config file to use for error reporting + */ +export function parsePacksSpecification(packStr: string): Pack { + if (typeof packStr !== "string") { + throw new ConfigurationError(errorMessages.getPacksStrInvalid(packStr)); + } + + packStr = packStr.trim(); + const atIndex = packStr.indexOf("@"); + const colonIndex = packStr.indexOf(":", atIndex); + const packStart = 0; + const versionStart = atIndex + 1 || undefined; + const pathStart = colonIndex + 1 || undefined; + const packEnd = Math.min( + atIndex > 0 ? atIndex : Infinity, + colonIndex > 0 ? colonIndex : Infinity, + packStr.length, + ); + const versionEnd = versionStart + ? Math.min(colonIndex > 0 ? colonIndex : Infinity, packStr.length) + : undefined; + const pathEnd = pathStart ? packStr.length : undefined; + + const packName = packStr.slice(packStart, packEnd).trim(); + const version = versionStart + ? packStr.slice(versionStart, versionEnd).trim() + : undefined; + const packPath = pathStart + ? packStr.slice(pathStart, pathEnd).trim() + : undefined; + + if (!PACK_IDENTIFIER_PATTERN.test(packName)) { + throw new ConfigurationError(errorMessages.getPacksStrInvalid(packStr)); + } + if (version) { + try { + new semver.Range(version); + } catch { + // The range string is invalid. OK to ignore the caught error + throw new ConfigurationError(errorMessages.getPacksStrInvalid(packStr)); + } + } + + if ( + packPath && + (path.isAbsolute(packPath) || + // Permit using "/" instead of "\" on Windows + // Use `x.split(y).join(z)` as a polyfill for `x.replaceAll(y, z)` since + // if we used a regex we'd need to escape the path separator on Windows + // which seems more awkward. + path.normalize(packPath).split(path.sep).join("/") !== + packPath.split(path.sep).join("/")) + ) { + throw new ConfigurationError(errorMessages.getPacksStrInvalid(packStr)); + } + + if (!packPath && pathStart) { + // 0 length path + throw new ConfigurationError(errorMessages.getPacksStrInvalid(packStr)); + } + + return { + name: packName, + version, + path: packPath, + }; +} + +export function validatePackSpecification(pack: string) { + return prettyPrintPack(parsePacksSpecification(pack)); +} + +// Exported for testing +export function parsePacksFromInput( + rawPacksInput: string | undefined, + languages: Language[], + packsInputCombines: boolean, +): Packs | undefined { + if (!rawPacksInput?.trim()) { + return undefined; + } + + if (languages.length > 1) { + throw new ConfigurationError( + "Cannot specify a 'packs' input in a multi-language analysis. Use a codeql-config.yml file instead and specify packs by language.", + ); + } else if (languages.length === 0) { + throw new ConfigurationError( + "No languages specified. Cannot process the packs input.", + ); + } + + rawPacksInput = rawPacksInput.trim(); + if (packsInputCombines) { + rawPacksInput = rawPacksInput.trim().substring(1).trim(); + if (!rawPacksInput) { + throw new ConfigurationError( + errorMessages.getConfigFilePropertyError( + undefined, + "packs", + "A '+' was used in the 'packs' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs.", + ), + ); + } + } + + return { + [languages[0]]: rawPacksInput.split(",").reduce((packs, pack) => { + packs.push(validatePackSpecification(pack)); + return packs; + }, [] as string[]), + }; +} + +/** + * Calculates how the codeql config file needs to be augmented before passing + * it to the CLI. The reason this is necessary is the codeql-action can be called + * with extra inputs from the workflow. These inputs are not part of the config + * and the CLI does not know about these inputs so we need to inject them into + * the config file sent to the CLI. + * + * @param rawPacksInput The packs input from the action configuration. + * @param rawQueriesInput The queries input from the action configuration. + * @param languages The languages that the config file is for. If the packs input + * is non-empty, then there must be exactly one language. Otherwise, an + * error is thrown. + * + * @returns The properties that need to be augmented in the config file. + * + * @throws An error if the packs input is non-empty and the languages input does + * not have exactly one language. + */ +// exported for testing. +export async function calculateAugmentation( + rawPacksInput: string | undefined, + rawQueriesInput: string | undefined, + languages: Language[], +): Promise { + const packsInputCombines = shouldCombine(rawPacksInput); + const packsInput = parsePacksFromInput( + rawPacksInput, + languages, + packsInputCombines, + ); + const queriesInputCombines = shouldCombine(rawQueriesInput); + const queriesInput = parseQueriesFromInput( + rawQueriesInput, + queriesInputCombines, + ); + + return { + packsInputCombines, + packsInput: packsInput?.[languages[0]], + queriesInput, + queriesInputCombines, + }; +} + +function parseQueriesFromInput( + rawQueriesInput: string | undefined, + queriesInputCombines: boolean, +) { + if (!rawQueriesInput) { + return undefined; + } + + const trimmedInput = queriesInputCombines + ? rawQueriesInput.trim().slice(1).trim() + : (rawQueriesInput?.trim() ?? ""); + if (queriesInputCombines && trimmedInput.length === 0) { + throw new ConfigurationError( + errorMessages.getConfigFilePropertyError( + undefined, + "queries", + "A '+' was used in the 'queries' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs.", + ), + ); + } + return trimmedInput.split(",").map((query) => ({ uses: query.trim() })); +} + +export function generateCodeScanningConfig( + originalUserInput: UserConfig, + augmentationProperties: AugmentationProperties, +): UserConfig { + // make a copy so we can modify it + const augmentedConfig = cloneObject(originalUserInput); + + // Inject the queries from the input + if (augmentationProperties.queriesInput) { + if (augmentationProperties.queriesInputCombines) { + augmentedConfig.queries = (augmentedConfig.queries || []).concat( + augmentationProperties.queriesInput, + ); + } else { + augmentedConfig.queries = augmentationProperties.queriesInput; + } + } + if (augmentedConfig.queries?.length === 0) { + delete augmentedConfig.queries; + } + + // Inject the packs from the input + if (augmentationProperties.packsInput) { + if (augmentationProperties.packsInputCombines) { + // At this point, we already know that this is a single-language analysis + if (Array.isArray(augmentedConfig.packs)) { + augmentedConfig.packs = (augmentedConfig.packs || []).concat( + augmentationProperties.packsInput, + ); + } else if (!augmentedConfig.packs) { + augmentedConfig.packs = augmentationProperties.packsInput; + } else { + // At this point, we know there is only one language. + // If there were more than one language, an error would already have been thrown. + const language = Object.keys(augmentedConfig.packs)[0]; + augmentedConfig.packs[language] = augmentedConfig.packs[ + language + ].concat(augmentationProperties.packsInput); + } + } else { + augmentedConfig.packs = augmentationProperties.packsInput; + } + } + if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) { + delete augmentedConfig.packs; + } + + return augmentedConfig; +} diff --git a/src/error-messages.ts b/src/error-messages.ts new file mode 100644 index 0000000000..61dd3ef92e --- /dev/null +++ b/src/error-messages.ts @@ -0,0 +1,66 @@ +const PACKS_PROPERTY = "packs"; + +export function getConfigFileOutsideWorkspaceErrorMessage( + configFile: string, +): string { + return `The configuration file "${configFile}" is outside of the workspace`; +} + +export function getConfigFileDoesNotExistErrorMessage( + configFile: string, +): string { + return `The configuration file "${configFile}" does not exist`; +} + +export function getConfigFileRepoFormatInvalidMessage( + configFile: string, +): string { + let error = `The configuration file "${configFile}" is not a supported remote file reference.`; + error += " Expected format //@"; + + return error; +} + +export function getConfigFileFormatInvalidMessage(configFile: string): string { + return `The configuration file "${configFile}" could not be read`; +} + +export function getConfigFileDirectoryGivenMessage(configFile: string): string { + return `The configuration file "${configFile}" looks like a directory, not a file`; +} + +export function getConfigFilePropertyError( + configFile: string | undefined, + property: string, + error: string, +): string { + if (configFile === undefined) { + return `The workflow property "${property}" is invalid: ${error}`; + } else { + return `The configuration file "${configFile}" is invalid: property "${property}" ${error}`; + } +} + +export function getPacksStrInvalid( + packStr: string, + configFile?: string, +): string { + return configFile + ? getConfigFilePropertyError( + configFile, + PACKS_PROPERTY, + `"${packStr}" is not a valid pack`, + ) + : `"${packStr}" is not a valid pack`; +} + +export function getNoLanguagesError(): string { + return ( + "Did not detect any languages to analyze. " + + "Please update input in workflow or check that GitHub detects the correct languages in your repository." + ); +} + +export function getUnknownLanguagesError(languages: string[]): string { + return `Did not recognize the following languages: ${languages.join(", ")}`; +}