"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.upgradeableTooling = void 0;
const tslib_1 = require("tslib");
const adoptium_java_1 = require("../../datasource/adoptium-java");
const docker_1 = require("../../datasource/docker");
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 node_1 = require("../../datasource/node");
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 = {
    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',
        },
    },
    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',
        },
    },
    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',
        },
    },
    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+))?$`,
        },
    },
    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+)',
        },
    },
    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: adoptium_java_1.AdoptiumJavaDatasource.id,
                    packageName: 'java-jdk',
                    currentValue: adoptOpenJdkMatches.groups.version,
                };
            }
            const adoptOpenJreMatches = version.match(/^adoptopenjdk-jre-(?<version>\d\S+)/);
            if (adoptOpenJreMatches) {
                return {
                    datasource: adoptium_java_1.AdoptiumJavaDatasource.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+)',
        },
    },
    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_1.NodeDatasource.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+)',
        },
    },
    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+)',
        },
    },
    terraform: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-hashicorp',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'hashicorp/terraform',
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    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',
        },
    },
};
//# sourceMappingURL=upgradeable-tooling.js.map