"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.upgradeableTooling = void 0;
const tslib_1 = require("tslib");
const regex_1 = require("../../../util/regex");
const dart_version_1 = require("../../datasource/dart-version");
const docker_1 = require("../../datasource/docker");
const flutter_version_1 = require("../../datasource/flutter-version");
const github_releases_1 = require("../../datasource/github-releases");
const github_tags_1 = require("../../datasource/github-tags");
const hexpm_bob_1 = require("../../datasource/hexpm-bob");
const java_version_1 = require("../../datasource/java-version");
const node_version_1 = require("../../datasource/node-version");
const npm_1 = require("../../datasource/npm");
const pypi_1 = require("../../datasource/pypi");
const ruby_version_1 = require("../../datasource/ruby-version");
const regexVersioning = tslib_1.__importStar(require("../../versioning/regex"));
const semverVersioning = tslib_1.__importStar(require("../../versioning/semver"));
const hugoDefinition = {
    // This plugin supports the names `hugo` & `gohugo`
    asdfPluginUrl: 'https://github.com/NeoHsu/asdf-hugo',
    config: (version) => ({
        datasource: github_releases_1.GithubReleasesDatasource.id,
        packageName: 'gohugoio/hugo',
        extractVersion: '^v(?<version>\\S+)',
        // The asdf hugo plugin supports prefixing the version with
        // `extended_`. Extended versions feature Sass support.
        currentValue: version.replace(/^extended_/, ''),
    }),
};
exports.upgradeableTooling = {
    'adr-tools': {
        asdfPluginUrl: 'https://gitlab.com/td7x/asdf/adr-tools.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'npryce/adr-tools',
        },
    },
    argocd: {
        asdfPluginUrl: 'https://github.com/beardix/asdf-argocd',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'argoproj/argo-cd',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    awscli: {
        asdfPluginUrl: 'https://github.com/MetricMike/asdf-awscli',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'aws/aws-cli',
        },
    },
    bun: {
        asdfPluginUrl: 'https://github.com/cometkim/asdf-bun',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'oven-sh/bun',
            extractVersion: '^bun-v(?<version>\\S+)',
        },
    },
    'cargo-make': {
        asdfPluginUrl: 'https://github.com/kachick/asdf-cargo-make',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'sagiegurari/cargo-make',
        },
    },
    checkov: {
        asdfPluginUrl: 'https://github.com/bosmak/asdf-checkov.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'bridgecrewio/checkov',
        },
    },
    clojure: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-clojure',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'clojure/brew-install',
            versioning: `${regexVersioning.id}:^(?<major>\\d+?)\\.(?<minor>\\d+?)\\.(?<patch>\\d+)\\.(?<build>\\d+)$`,
        },
    },
    crystal: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-crystal',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'crystal-lang/crystal',
        },
    },
    dart: {
        asdfPluginUrl: 'https://github.com/PatOConnor43/asdf-dart',
        config: {
            datasource: dart_version_1.DartVersionDatasource.id,
        },
    },
    deno: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-deno',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'denoland/deno',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    direnv: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-direnv',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'direnv/direnv',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    dprint: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-dprint',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'dprint/dprint',
        },
    },
    ecspresso: {
        asdfPluginUrl: 'https://github.com/kayac/asdf-ecspresso',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'kayac/ecspresso',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    elixir: {
        asdfPluginUrl: 'https://github.com/asdf-vm/asdf-elixir',
        config: {
            datasource: hexpm_bob_1.HexpmBobDatasource.id,
        },
    },
    elm: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-elm',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'elm/compiler',
        },
    },
    erlang: {
        asdfPluginUrl: 'https://github.com/asdf-vm/asdf-erlang',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'erlang/otp',
            extractVersion: '^OTP-(?<version>\\S+)',
            versioning: `${regexVersioning.id}:^(?<major>\\d+?)\\.(?<minor>\\d+?)(\\.(?<patch>\\d+))?$`,
        },
    },
    flutter: {
        asdfPluginUrl: 'https://github.com/oae/asdf-flutter',
        config: (version) => ({
            datasource: flutter_version_1.FlutterVersionDatasource.id,
            // asdf-flutter plugin supports channel on version suffix.
            currentValue: version.replace((0, regex_1.regEx)(/-(stable|beta|dev)$/), ''),
        }),
    },
    flux2: {
        asdfPluginUrl: 'https://github.com/tablexi/asdf-flux2.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'fluxcd/flux2',
            extractVersion: '^v(?<version>.+)',
        },
    },
    gauche: {
        asdfPluginUrl: 'https://github.com/sakuro/asdf-gauche',
        config: {
            datasource: docker_1.DockerDatasource.id,
            packageName: 'practicalscheme/gauche',
        },
    },
    gohugo: hugoDefinition,
    golang: {
        asdfPluginUrl: 'https://github.com/kennyp/asdf-golang',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'golang/go',
            extractVersion: '^go(?<version>\\S+)',
        },
    },
    'golangci-lint': {
        asdfPluginUrl: 'https://github.com/hypnoglow/asdf-golangci-lint.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'golangci/golangci-lint',
            extractVersion: '^v(?<version>.+)',
        },
    },
    hadolint: {
        asdfPluginUrl: 'https://github.com/looztra/asdf-hadolint.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'hadolint/hadolint',
            extractVersion: '^v(?<version>.+)',
        },
    },
    haskell: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-haskell',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'ghc/ghc',
            extractVersion: '^ghc-(?<version>\\S+?)-release',
        },
    },
    helm: {
        asdfPluginUrl: 'https://github.com/Antiarchitect/asdf-helm',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'helm/helm',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    helmfile: {
        asdfPluginUrl: 'https://github.com/feniix/asdf-helmfile',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'helmfile/helmfile',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    hugo: hugoDefinition,
    idris: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-idris',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'idris-lang/Idris-dev',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    java: {
        asdfPluginUrl: 'https://github.com/halcyon/asdf-java',
        config: (version) => {
            const adoptOpenJdkMatches = version.match(/^adoptopenjdk-(?<version>\d\S+)/);
            if (adoptOpenJdkMatches) {
                return {
                    datasource: java_version_1.JavaVersionDatasource.id,
                    packageName: 'java-jdk',
                    currentValue: adoptOpenJdkMatches.groups.version,
                };
            }
            const adoptOpenJreMatches = version.match(/^adoptopenjdk-jre-(?<version>\d\S+)/);
            if (adoptOpenJreMatches) {
                return {
                    datasource: java_version_1.JavaVersionDatasource.id,
                    packageName: 'java-jre',
                    currentValue: adoptOpenJreMatches.groups.version,
                };
            }
            return undefined;
        },
    },
    julia: {
        asdfPluginUrl: 'https://github.com/rkyleg/asdf-julia',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'JuliaLang/julia',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    just: {
        asdfPluginUrl: 'https://github.com/olofvndrhr/asdf-just',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'casey/just',
        },
    },
    kotlin: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-kotlin',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'JetBrains/kotlin',
            extractVersion: '^(Kotlin |v)(?<version>\\S+)',
        },
    },
    kubectl: {
        asdfPluginUrl: 'https://github.com/Banno/asdf-kubectl.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'kubernetes/kubernetes',
            extractVersion: '^v(?<version>.+)',
        },
    },
    kustomize: {
        asdfPluginUrl: 'https://github.com/Banno/asdf-kustomize',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'kubernetes-sigs/kustomize',
            extractVersion: '^kustomize/v(?<version>\\S+)',
        },
    },
    lua: {
        asdfPluginUrl: 'https://github.com/Stratus3D/asdf-lua',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'lua/lua',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    nim: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-nim',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'nim-lang/Nim',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    nodejs: {
        asdfPluginUrl: 'https://github.com/asdf-vm/asdf-nodejs',
        config: {
            depName: 'node',
            datasource: node_version_1.NodeVersionDatasource.id,
        },
    },
    ocaml: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-ocaml',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'ocaml/ocaml',
        },
    },
    perl: {
        asdfPluginUrl: 'https://github.com/ouest/asdf-perl',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'Perl/perl5',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    php: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-php',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'php/php-src',
            extractVersion: '^php-(?<version>\\S+)',
        },
    },
    pnpm: {
        asdfPluginUrl: 'https://github.com/jonathanmorley/asdf-pnpm',
        config: {
            datasource: npm_1.NpmDatasource.id,
            packageName: 'pnpm',
            versioning: semverVersioning.id,
        },
    },
    poetry: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-poetry',
        config: {
            datasource: pypi_1.PypiDatasource.id,
            packageName: 'poetry',
        },
    },
    'pre-commit': {
        asdfPluginUrl: 'https://github.com/jonathanmorley/asdf-pre-commit.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'pre-commit/pre-commit',
            extractVersion: '^v(?<version>.+)',
        },
    },
    pulumi: {
        asdfPluginUrl: 'https://github.com/canha/asdf-pulumi.git',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'pulumi/pulumi',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    python: {
        asdfPluginUrl: 'https://github.com/danhper/asdf-python',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'python/cpython',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    ruby: {
        asdfPluginUrl: 'https://github.com/asdf-vm/asdf-ruby',
        config: {
            datasource: ruby_version_1.RubyVersionDatasource.id,
            packageName: 'ruby-version',
            versioning: semverVersioning.id,
        },
    },
    rust: {
        asdfPluginUrl: 'https://github.com/code-lever/asdf-rust',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'rust-lang/rust',
        },
    },
    scala: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-scala',
        config: (version) => {
            if (version.startsWith('2')) {
                return {
                    datasource: github_tags_1.GithubTagsDatasource.id,
                    packageName: 'scala/scala',
                    extractVersion: '^v(?<version>\\S+)',
                };
            }
            if (version.startsWith('3')) {
                return {
                    datasource: github_tags_1.GithubTagsDatasource.id,
                    packageName: 'lampepfl/dotty',
                };
            }
            return undefined;
        },
    },
    shellcheck: {
        asdfPluginUrl: 'https://github.com/luizm/asdf-shellcheck',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'koalaman/shellcheck',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    shfmt: {
        asdfPluginUrl: 'https://github.com/luizm/asdf-shfmt',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'mvdan/sh',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    sops: {
        asdfPluginUrl: 'https://github.com/feniix/asdf-sops',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'mozilla/sops',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    terraform: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-hashicorp',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'hashicorp/terraform',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    'terraform-docs': {
        asdfPluginUrl: 'https://github.com/looztra/asdf-terraform-docs.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'terraform-docs/terraform-docs',
            extractVersion: '^v(?<version>.+)',
        },
    },
    terragrunt: {
        asdfPluginUrl: 'https://github.com/ohmer/asdf-terragrunt',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'gruntwork-io/terragrunt',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    tflint: {
        asdfPluginUrl: 'https://github.com/skyzyx/asdf-tflint.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'terraform-linters/tflint',
            extractVersion: '^v(?<version>.+)',
        },
    },
    tfsec: {
        asdfPluginUrl: 'https://github.com/woneill/asdf-tfsec.git',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'aquasecurity/tfsec',
            extractVersion: '^v(?<version>.+)',
        },
    },
    trivy: {
        asdfPluginUrl: 'https://github.com/zufardhiyaulhaq/asdf-trivy',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'aquasecurity/trivy',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    zig: {
        asdfPluginUrl: 'https://github.com/cheetah/asdf-zig',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'ziglang/zig',
        },
    },
    maestro: {
        asdfPluginUrl: 'https://github.com/dotanuki-labs/asdf-maestro',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'mobile-dev-inc/maestro',
            extractVersion: '^cli-(?<version>\\S+)',
        },
    },
    detekt: {
        asdfPluginUrl: 'https://github.com/dotanuki-labs/asdf-detekt',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'detekt/detekt',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    ktlint: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-ktlint',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'pinterest/ktlint',
        },
    },
};
//# sourceMappingURL=upgradeable-tooling.js.map