"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 nodeVersioning = tslib_1.__importStar(require("../../versioning/node"));
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',
        versioning: semverVersioning.id,
        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 = {
    awscli: {
        asdfPluginUrl: 'https://github.com/MetricMike/asdf-awscli',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'aws/aws-cli',
            versioning: semverVersioning.id,
        },
    },
    bun: {
        asdfPluginUrl: 'https://github.com/cometkim/asdf-bun',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'oven-sh/bun',
            versioning: semverVersioning.id,
            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',
            versioning: semverVersioning.id,
        },
    },
    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',
            versioning: semverVersioning.id,
        },
    },
    deno: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-deno',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'denoland/deno',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    direnv: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-direnv',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'direnv/direnv',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    dprint: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-dprint',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'dprint/dprint',
            versioning: semverVersioning.id,
        },
    },
    elixir: {
        asdfPluginUrl: 'https://github.com/asdf-vm/asdf-elixir',
        config: {
            datasource: hexpm_bob_1.HexpmBobDatasource.id,
            packageName: 'elixir',
            versioning: semverVersioning.id,
        },
    },
    elm: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-elm',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'elm/compiler',
            versioning: semverVersioning.id,
        },
    },
    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',
            versioning: semverVersioning.id,
        },
    },
    gohugo: hugoDefinition,
    golang: {
        asdfPluginUrl: 'https://github.com/kennyp/asdf-golang',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'golang/go',
            versioning: semverVersioning.id,
            extractVersion: '^go(?<version>\\S+)',
        },
    },
    haskell: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-haskell',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'ghc/ghc',
            versioning: semverVersioning.id,
            extractVersion: '^ghc-(?<version>\\S+?)-release',
        },
    },
    helm: {
        asdfPluginUrl: 'https://github.com/Antiarchitect/asdf-helm',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'helm/helm',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    helmfile: {
        asdfPluginUrl: 'https://github.com/feniix/asdf-helmfile',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'helmfile/helmfile',
            versioning: semverVersioning.id,
            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',
            versioning: semverVersioning.id,
            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',
                    versioning: semverVersioning.id,
                    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',
                    versioning: semverVersioning.id,
                    currentValue: adoptOpenJreMatches.groups.version,
                };
            }
            return undefined;
        },
    },
    julia: {
        asdfPluginUrl: 'https://github.com/rkyleg/asdf-julia',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'JuliaLang/julia',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    just: {
        asdfPluginUrl: 'https://github.com/olofvndrhr/asdf-just',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'casey/just',
            versioning: semverVersioning.id,
        },
    },
    kotlin: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-kotlin',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'JetBrains/kotlin',
            versioning: semverVersioning.id,
            extractVersion: '^(Kotlin |v)(?<version>\\S+)',
        },
    },
    kustomize: {
        asdfPluginUrl: 'https://github.com/Banno/asdf-kustomize',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'kubernetes-sigs/kustomize',
            versioning: semverVersioning.id,
            extractVersion: '^kustomize/v(?<version>\\S+)',
        },
    },
    lua: {
        asdfPluginUrl: 'https://github.com/Stratus3D/asdf-lua',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'lua/lua',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    nim: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-nim',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'nim-lang/Nim',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    nodejs: {
        asdfPluginUrl: 'https://github.com/asdf-vm/asdf-nodejs',
        config: {
            depName: 'node',
            datasource: node_1.NodeDatasource.id,
            packageName: 'node',
            versioning: nodeVersioning.id,
        },
    },
    ocaml: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-ocaml',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'ocaml/ocaml',
            versioning: semverVersioning.id,
        },
    },
    perl: {
        asdfPluginUrl: 'https://github.com/ouest/asdf-perl',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'Perl/perl5',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    php: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-php',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'php/php-src',
            versioning: semverVersioning.id,
            extractVersion: '^php-(?<version>\\S+)',
        },
    },
    python: {
        asdfPluginUrl: 'https://github.com/danhper/asdf-python',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'python/cpython',
            versioning: semverVersioning.id,
            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',
            versioning: semverVersioning.id,
        },
    },
    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',
                    versioning: semverVersioning.id,
                    extractVersion: '^v(?<version>\\S+)',
                };
            }
            if (version.startsWith('3')) {
                return {
                    datasource: github_tags_1.GithubTagsDatasource.id,
                    packageName: 'lampepfl/dotty',
                    versioning: semverVersioning.id,
                };
            }
            return undefined;
        },
    },
    shellcheck: {
        asdfPluginUrl: 'https://github.com/luizm/asdf-shellcheck',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'koalaman/shellcheck',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    shfmt: {
        asdfPluginUrl: 'https://github.com/luizm/asdf-shfmt',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'mvdan/sh',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    terraform: {
        asdfPluginUrl: 'https://github.com/asdf-community/asdf-hashicorp',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'hashicorp/terraform',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    trivy: {
        asdfPluginUrl: 'https://github.com/zufardhiyaulhaq/asdf-trivy',
        config: {
            datasource: github_releases_1.GithubReleasesDatasource.id,
            packageName: 'aquasecurity/trivy',
            versioning: semverVersioning.id,
            extractVersion: '^v(?<version>\\S+)',
        },
    },
    zig: {
        asdfPluginUrl: 'https://github.com/cheetah/asdf-zig',
        config: {
            datasource: github_tags_1.GithubTagsDatasource.id,
            packageName: 'ziglang/zig',
            versioning: semverVersioning.id,
        },
    },
};
//# sourceMappingURL=upgradeable-tooling.js.map