@metamask-previews/foundryup 1.0.1-preview-abca9bcea → 2.0.0-preview-0a30e47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/{cli.mjs → cli.js} +2 -2
- package/dist/cli.js.map +1 -0
- package/dist/{download.d.cts → download.d.ts} +4 -9
- package/dist/download.d.ts.map +1 -0
- package/dist/{download.mjs → download.js} +5 -5
- package/dist/download.js.map +1 -0
- package/dist/{extract.d.cts → extract.d.ts} +2 -2
- package/dist/extract.d.ts.map +1 -0
- package/dist/{extract.mjs → extract.js} +15 -15
- package/dist/extract.js.map +1 -0
- package/dist/{index.d.cts → index.d.ts} +4 -7
- package/dist/index.d.ts.map +1 -0
- package/dist/{index.mjs → index.js} +12 -12
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +71 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/{options.mjs → options.js} +6 -6
- package/dist/options.js.map +1 -0
- package/dist/{types.d.mts → types.d.ts} +4 -10
- package/dist/types.d.ts.map +1 -0
- package/dist/{types.mjs → types.js} +1 -1
- package/dist/types.js.map +1 -0
- package/dist/{utils.d.cts → utils.d.ts} +3 -3
- package/dist/utils.d.ts.map +1 -0
- package/dist/{utils.mjs → utils.js} +4 -4
- package/dist/utils.js.map +1 -0
- package/package.json +11 -9
- package/dist/cli.cjs +0 -23
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.d.cts +0 -3
- package/dist/cli.d.cts.map +0 -1
- package/dist/cli.d.mts +0 -3
- package/dist/cli.d.mts.map +0 -1
- package/dist/cli.mjs.map +0 -1
- package/dist/download.cjs +0 -76
- package/dist/download.cjs.map +0 -1
- package/dist/download.d.cts.map +0 -1
- package/dist/download.d.mts +0 -30
- package/dist/download.d.mts.map +0 -1
- package/dist/download.mjs.map +0 -1
- package/dist/extract.cjs +0 -205
- package/dist/extract.cjs.map +0 -1
- package/dist/extract.d.cts.map +0 -1
- package/dist/extract.d.mts +0 -24
- package/dist/extract.d.mts.map +0 -1
- package/dist/extract.mjs.map +0 -1
- package/dist/index.cjs +0 -163
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -56
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/options.cjs +0 -157
- package/dist/options.cjs.map +0 -1
- package/dist/options.d.cts +0 -62
- package/dist/options.d.cts.map +0 -1
- package/dist/options.d.mts +0 -62
- package/dist/options.d.mts.map +0 -1
- package/dist/options.mjs.map +0 -1
- package/dist/types.cjs +0 -30
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts +0 -78
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts.map +0 -1
- package/dist/types.mjs.map +0 -1
- package/dist/utils.cjs +0 -110
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.d.cts.map +0 -1
- package/dist/utils.d.mts +0 -50
- package/dist/utils.d.mts.map +0 -1
- package/dist/utils.mjs.map +0 -1
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA,6CAAyC;AACzC,qCAAuC;AAEvC,+CAO0B;AAC1B,qCAAkC;AAClC,yCAAoD;AACpD,+CAAyC;AACzC,+BAA0C;AAE1C,8CAA2C;AAC3C,8CAAsD;AAEtD,0CAAiD;AACjD,0CAMoB;AAEpB;;;;;;GAMG;AACH,SAAgB,iBAAiB;IAC/B,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAC9B,IAAI,CAAC;QACH,MAAM,iBAAiB,GAAG,IAAA,sBAAY,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAC9D,MAAM,YAAY,GAAG,IAAA,YAAS,EAAC,iBAAiB,CAAC,CAAC;QAClD,iBAAiB,GAAG,Y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EACR,QAAQ,EACR,SAAS,GACV,GAAG,UAAU,CAAC,OAAO,CAAC;IAEvB,IAAA,wBAAW,GAAE,CAAC;IACd,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,IAAA,cAAG,EAAC,YAAY,IAAI,IAAI,OAAO,QAAQ,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;IAE3D,MAAM,eAAe,GAAG,mBAAmB,CACzC,IAAI,EACJ,GAAG,EACH,OAAO,EACP,QAAQ,EACR,IAAI,CACL,CAAC;IACF,MAAM,OAAO,GAAG,IAAA,gBAAI,EAAC,IAAA,kBAAG,GAAE,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAEpD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC;SAClC,MAAM,CAAC,GAAG,eAAe,IAAI,IAAI,EAAE,CAAC;SACpC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjB,MAAM,SAAS,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAE5C,MAAM,kBAAkB,GAAG,MAAM,wBAAwB,CACvD,GAAG,EACH,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,SAAS,CACV,CAAC;IAEF,MAAM,eAAe,CAAC,kBAAkB,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAE9D,IAAA,cAAG,EAAC,OAAO,CAAC,CAAC;AACf,CAAC;AAnDD,8EAmDC","sourcesContent":["#!/usr/bin/env -S node --require \"./node_modules/tsx/dist/preflight.cjs\" --import \"./node_modules/tsx/dist/loader.mjs\"\n\nimport { createHash } from 'node:crypto';\nimport { readFileSync } from 'node:fs';\nimport type { Dir } from 'node:fs';\nimport {\n copyFile,\n mkdir,\n opendir,\n rm,\n symlink,\n unlink,\n} from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { dirname, join, relative } from 'node:path';\nimport { cwd, exit } from 'node:process';\nimport { parse as parseYaml } from 'yaml';\n\nimport { extractFrom } from './extract.js';\nimport { parseArgs, printBanner } from './options.js';\nimport type { Checksums, Architecture, Binary } from './types.js';\nimport { Extension, Platform } from './types.js';\nimport {\n getVersion,\n isCodedError,\n noop,\n say,\n transformChecksums,\n} from './utils.js';\n\n/**\n * Determines the cache directory based on the .yarnrc.yml configuration.\n * If global cache is enabled, returns a path in the user's home directory.\n * Otherwise, returns a local cache path in the current working directory.\n *\n * @returns The path to the cache directory\n */\nexport function getCacheDirectory(): string {\n let enableGlobalCache = false;\n try {\n const configFileContent = readFileSync('.yarnrc.yml', 'utf8');\n const parsedConfig = parseYaml(configFileContent);\n enableGlobalCache = parsedConfig?.enableGlobalCache ?? false;\n } catch (error) {\n // If file doesn't exist or can't be read, default to local cache\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return join(cwd(), '.metamask', 'cache');\n }\n // For other errors, log but continue with default\n console.warn(\n 'Warning: Error reading .yarnrc.yml, using local cache:',\n error,\n );\n }\n return enableGlobalCache\n ? join(homedir(), '.cache', 'metamask')\n : join(cwd(), '.metamask', 'cache');\n}\n\n/**\n * Generates the URL for downloading the Foundry binary archive.\n *\n * @param repo - The GitHub repository (e.g., 'foundry-rs/foundry')\n * @param tag - The release tag (e.g., 'v1.0.0')\n * @param version - The version string\n * @param platform - The target platform (e.g., Platform.Linux)\n * @param arch - The target architecture (e.g., 'amd64')\n * @returns The URL for the binary archive\n */\nexport function getBinaryArchiveUrl(\n repo: string,\n tag: string,\n version: string,\n platform: Platform,\n arch: string,\n): string {\n const ext = platform === Platform.Windows ? Extension.Zip : Extension.Tar;\n return `https://github.com/${repo}/releases/download/${tag}/foundry_${version}_${platform}_${arch}.${ext}`;\n}\n\n/**\n * Checks if binaries are already in the cache. If not, downloads and extracts them.\n *\n * @param url - The URL to download the binaries from\n * @param binaries - The list of binaries to download\n * @param cachePath - The path to the cache directory\n * @param platform - The target platform\n * @param arch - The target architecture\n * @param checksums - Optional checksums for verification\n * @returns A promise that resolves to the directory containing the downloaded binaries\n */\nexport async function checkAndDownloadBinaries(\n url: URL,\n binaries: Binary[],\n cachePath: string,\n platform: Platform,\n arch: Architecture,\n checksums?: Checksums,\n): Promise<Dir> {\n let downloadedBinaries: Dir;\n try {\n say(`checking cache`);\n downloadedBinaries = await opendir(cachePath);\n say(`found binaries in cache`);\n } catch (e: unknown) {\n say(`binaries not in cache`);\n if ((e as NodeJS.ErrnoException).code === 'ENOENT') {\n say(`installing from ${url.toString()}`);\n // directory doesn't exist, download and extract\n const platformChecksums = transformChecksums(checksums, platform, arch);\n await extractFrom(url, binaries, cachePath, platformChecksums);\n downloadedBinaries = await opendir(cachePath);\n } else {\n throw e;\n }\n }\n return downloadedBinaries;\n}\n\n/**\n * Installs the downloaded binaries by creating symlinks or copying files.\n *\n * @param downloadedBinaries - The directory containing the downloaded binaries\n * @param BIN_DIR - The target directory for installation\n * @param cachePath - The path to the cache directory\n * @returns A promise that resolves when installation is complete\n */\nexport async function installBinaries(\n downloadedBinaries: Dir,\n BIN_DIR: string,\n cachePath: string,\n): Promise<void> {\n for await (const file of downloadedBinaries) {\n if (!file.isFile()) {\n continue;\n }\n const target = join(file.parentPath, file.name);\n const path = join(BIN_DIR, relative(cachePath, target));\n\n // compute the relative path from where the symlink will be created\n // to the target file, so that it works even if the project is moved\n // (like in some CI environments)\n const relativeTarget = relative(dirname(path), target);\n\n // create the BIN_DIR paths if they don't exists already\n await mkdir(BIN_DIR, { recursive: true });\n\n // clean up any existing files or symlinks\n await unlink(path).catch(noop);\n try {\n // create new symlink\n await symlink(relativeTarget, path);\n } catch (e) {\n if (!(isCodedError(e) && ['EPERM', 'EXDEV'].includes(e.code))) {\n throw e;\n }\n // symlinking can fail if it's a cross-device/filesystem link, or for\n // permissions reasons, so we'll just copy the file instead\n await copyFile(target, path);\n }\n // check that it works by logging the version\n say(`installed - ${getVersion(path).toString()}`);\n }\n}\n\n/**\n * Downloads and installs Foundry binaries based on command-line arguments.\n * If the command is 'cache clean', it removes the cache directory.\n * Otherwise, it downloads and installs the specified binaries.\n *\n * @returns A promise that resolves when the operation is complete\n */\nexport async function downloadAndInstallFoundryBinaries(): Promise<void> {\n const parsedArgs = parseArgs();\n\n const CACHE_DIR = getCacheDirectory();\n\n if (parsedArgs.command === 'cache clean') {\n await rm(CACHE_DIR, { recursive: true, force: true });\n say('done!');\n exit(0);\n }\n\n const {\n repo,\n version: { version, tag },\n arch,\n platform,\n binaries,\n checksums,\n } = parsedArgs.options;\n\n printBanner();\n const bins = binaries.join(', ');\n say(`fetching ${bins} ${version} for ${platform} ${arch}`);\n\n const BIN_ARCHIVE_URL = getBinaryArchiveUrl(\n repo,\n tag,\n version,\n platform,\n arch,\n );\n const BIN_DIR = join(cwd(), 'node_modules', '.bin');\n\n const url = new URL(BIN_ARCHIVE_URL);\n const cacheKey = createHash('sha256')\n .update(`${BIN_ARCHIVE_URL}-${bins}`)\n .digest('hex');\n const cachePath = join(CACHE_DIR, cacheKey);\n\n const downloadedBinaries = await checkAndDownloadBinaries(\n url,\n binaries,\n cachePath,\n platform,\n arch,\n checksums,\n );\n\n await installBinaries(downloadedBinaries, BIN_DIR, cachePath);\n\n say('done!');\n}\n"]}
|
package/dist/index.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB;AAgBnC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,oBAAmB;AAClE,OAAO,EAAa,QAAQ,EAAE,oBAAmB;AASjD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAoB1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,GACX,MAAM,CAGR;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,YAAY,EAClB,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,GAAG,CAAC,CAmBd;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAgCf;AAED;;;;;;GAMG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,IAAI,CAAC,CAmDvE"}
|
package/dist/index.d.mts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S node --require "./node_modules/tsx/dist/preflight.cjs" --import "./node_modules/tsx/dist/loader.mjs"
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node/fs.js" />
|
|
4
|
-
/// <reference types="npm-which/node_modules/@types/node/fs.js" />
|
|
5
|
-
import type { Dir } from "node:fs";
|
|
6
|
-
import type { Checksums, Architecture, Binary } from "./types.mjs";
|
|
7
|
-
import { Platform } from "./types.mjs";
|
|
8
|
-
/**
|
|
9
|
-
* Determines the cache directory based on the .yarnrc.yml configuration.
|
|
10
|
-
* If global cache is enabled, returns a path in the user's home directory.
|
|
11
|
-
* Otherwise, returns a local cache path in the current working directory.
|
|
12
|
-
*
|
|
13
|
-
* @returns The path to the cache directory
|
|
14
|
-
*/
|
|
15
|
-
export declare function getCacheDirectory(): string;
|
|
16
|
-
/**
|
|
17
|
-
* Generates the URL for downloading the Foundry binary archive.
|
|
18
|
-
*
|
|
19
|
-
* @param repo - The GitHub repository (e.g., 'foundry-rs/foundry')
|
|
20
|
-
* @param tag - The release tag (e.g., 'v1.0.0')
|
|
21
|
-
* @param version - The version string
|
|
22
|
-
* @param platform - The target platform (e.g., Platform.Linux)
|
|
23
|
-
* @param arch - The target architecture (e.g., 'amd64')
|
|
24
|
-
* @returns The URL for the binary archive
|
|
25
|
-
*/
|
|
26
|
-
export declare function getBinaryArchiveUrl(repo: string, tag: string, version: string, platform: Platform, arch: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Checks if binaries are already in the cache. If not, downloads and extracts them.
|
|
29
|
-
*
|
|
30
|
-
* @param url - The URL to download the binaries from
|
|
31
|
-
* @param binaries - The list of binaries to download
|
|
32
|
-
* @param cachePath - The path to the cache directory
|
|
33
|
-
* @param platform - The target platform
|
|
34
|
-
* @param arch - The target architecture
|
|
35
|
-
* @param checksums - Optional checksums for verification
|
|
36
|
-
* @returns A promise that resolves to the directory containing the downloaded binaries
|
|
37
|
-
*/
|
|
38
|
-
export declare function checkAndDownloadBinaries(url: URL, binaries: Binary[], cachePath: string, platform: Platform, arch: Architecture, checksums?: Checksums): Promise<Dir>;
|
|
39
|
-
/**
|
|
40
|
-
* Installs the downloaded binaries by creating symlinks or copying files.
|
|
41
|
-
*
|
|
42
|
-
* @param downloadedBinaries - The directory containing the downloaded binaries
|
|
43
|
-
* @param BIN_DIR - The target directory for installation
|
|
44
|
-
* @param cachePath - The path to the cache directory
|
|
45
|
-
* @returns A promise that resolves when installation is complete
|
|
46
|
-
*/
|
|
47
|
-
export declare function installBinaries(downloadedBinaries: Dir, BIN_DIR: string, cachePath: string): Promise<void>;
|
|
48
|
-
/**
|
|
49
|
-
* Downloads and installs Foundry binaries based on command-line arguments.
|
|
50
|
-
* If the command is 'cache clean', it removes the cache directory.
|
|
51
|
-
* Otherwise, it downloads and installs the specified binaries.
|
|
52
|
-
*
|
|
53
|
-
* @returns A promise that resolves when the operation is complete
|
|
54
|
-
*/
|
|
55
|
-
export declare function downloadAndInstallFoundryBinaries(): Promise<void>;
|
|
56
|
-
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB;AAgBnC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,oBAAmB;AAClE,OAAO,EAAa,QAAQ,EAAE,oBAAmB;AASjD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAoB1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,GACX,MAAM,CAGR;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,YAAY,EAClB,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,GAAG,CAAC,CAmBd;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAgCf;AAED;;;;;;GAMG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,IAAI,CAAC,CAmDvE"}
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,oBAAoB;AACzC,OAAO,EAAE,YAAY,EAAE,gBAAgB;AAEvC,OAAO,EACL,Q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M,kBAAkB,GAAG,MAAM,wBAAwB,CACvD,GAAG,EACH,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,SAAS,CACV,CAAC;IAEF,MAAM,eAAe,CAAC,kBAAkB,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAE9D,GAAG,CAAC,OAAO,CAAC,CAAC;AACf,CAAC","sourcesContent":["#!/usr/bin/env -S node --require \"./node_modules/tsx/dist/preflight.cjs\" --import \"./node_modules/tsx/dist/loader.mjs\"\n\nimport { createHash } from 'node:crypto';\nimport { readFileSync } from 'node:fs';\nimport type { Dir } from 'node:fs';\nimport {\n copyFile,\n mkdir,\n opendir,\n rm,\n symlink,\n unlink,\n} from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { dirname, join, relative } from 'node:path';\nimport { cwd, exit } from 'node:process';\nimport { parse as parseYaml } from 'yaml';\n\nimport { extractFrom } from './extract.js';\nimport { parseArgs, printBanner } from './options.js';\nimport type { Checksums, Architecture, Binary } from './types.js';\nimport { Extension, Platform } from './types.js';\nimport {\n getVersion,\n isCodedError,\n noop,\n say,\n transformChecksums,\n} from './utils.js';\n\n/**\n * Determines the cache directory based on the .yarnrc.yml configuration.\n * If global cache is enabled, returns a path in the user's home directory.\n * Otherwise, returns a local cache path in the current working directory.\n *\n * @returns The path to the cache directory\n */\nexport function getCacheDirectory(): string {\n let enableGlobalCache = false;\n try {\n const configFileContent = readFileSync('.yarnrc.yml', 'utf8');\n const parsedConfig = parseYaml(configFileContent);\n enableGlobalCache = parsedConfig?.enableGlobalCache ?? false;\n } catch (error) {\n // If file doesn't exist or can't be read, default to local cache\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return join(cwd(), '.metamask', 'cache');\n }\n // For other errors, log but continue with default\n console.warn(\n 'Warning: Error reading .yarnrc.yml, using local cache:',\n error,\n );\n }\n return enableGlobalCache\n ? join(homedir(), '.cache', 'metamask')\n : join(cwd(), '.metamask', 'cache');\n}\n\n/**\n * Generates the URL for downloading the Foundry binary archive.\n *\n * @param repo - The GitHub repository (e.g., 'foundry-rs/foundry')\n * @param tag - The release tag (e.g., 'v1.0.0')\n * @param version - The version string\n * @param platform - The target platform (e.g., Platform.Linux)\n * @param arch - The target architecture (e.g., 'amd64')\n * @returns The URL for the binary archive\n */\nexport function getBinaryArchiveUrl(\n repo: string,\n tag: string,\n version: string,\n platform: Platform,\n arch: string,\n): string {\n const ext = platform === Platform.Windows ? Extension.Zip : Extension.Tar;\n return `https://github.com/${repo}/releases/download/${tag}/foundry_${version}_${platform}_${arch}.${ext}`;\n}\n\n/**\n * Checks if binaries are already in the cache. If not, downloads and extracts them.\n *\n * @param url - The URL to download the binaries from\n * @param binaries - The list of binaries to download\n * @param cachePath - The path to the cache directory\n * @param platform - The target platform\n * @param arch - The target architecture\n * @param checksums - Optional checksums for verification\n * @returns A promise that resolves to the directory containing the downloaded binaries\n */\nexport async function checkAndDownloadBinaries(\n url: URL,\n binaries: Binary[],\n cachePath: string,\n platform: Platform,\n arch: Architecture,\n checksums?: Checksums,\n): Promise<Dir> {\n let downloadedBinaries: Dir;\n try {\n say(`checking cache`);\n downloadedBinaries = await opendir(cachePath);\n say(`found binaries in cache`);\n } catch (e: unknown) {\n say(`binaries not in cache`);\n if ((e as NodeJS.ErrnoException).code === 'ENOENT') {\n say(`installing from ${url.toString()}`);\n // directory doesn't exist, download and extract\n const platformChecksums = transformChecksums(checksums, platform, arch);\n await extractFrom(url, binaries, cachePath, platformChecksums);\n downloadedBinaries = await opendir(cachePath);\n } else {\n throw e;\n }\n }\n return downloadedBinaries;\n}\n\n/**\n * Installs the downloaded binaries by creating symlinks or copying files.\n *\n * @param downloadedBinaries - The directory containing the downloaded binaries\n * @param BIN_DIR - The target directory for installation\n * @param cachePath - The path to the cache directory\n * @returns A promise that resolves when installation is complete\n */\nexport async function installBinaries(\n downloadedBinaries: Dir,\n BIN_DIR: string,\n cachePath: string,\n): Promise<void> {\n for await (const file of downloadedBinaries) {\n if (!file.isFile()) {\n continue;\n }\n const target = join(file.parentPath, file.name);\n const path = join(BIN_DIR, relative(cachePath, target));\n\n // compute the relative path from where the symlink will be created\n // to the target file, so that it works even if the project is moved\n // (like in some CI environments)\n const relativeTarget = relative(dirname(path), target);\n\n // create the BIN_DIR paths if they don't exists already\n await mkdir(BIN_DIR, { recursive: true });\n\n // clean up any existing files or symlinks\n await unlink(path).catch(noop);\n try {\n // create new symlink\n await symlink(relativeTarget, path);\n } catch (e) {\n if (!(isCodedError(e) && ['EPERM', 'EXDEV'].includes(e.code))) {\n throw e;\n }\n // symlinking can fail if it's a cross-device/filesystem link, or for\n // permissions reasons, so we'll just copy the file instead\n await copyFile(target, path);\n }\n // check that it works by logging the version\n say(`installed - ${getVersion(path).toString()}`);\n }\n}\n\n/**\n * Downloads and installs Foundry binaries based on command-line arguments.\n * If the command is 'cache clean', it removes the cache directory.\n * Otherwise, it downloads and installs the specified binaries.\n *\n * @returns A promise that resolves when the operation is complete\n */\nexport async function downloadAndInstallFoundryBinaries(): Promise<void> {\n const parsedArgs = parseArgs();\n\n const CACHE_DIR = getCacheDirectory();\n\n if (parsedArgs.command === 'cache clean') {\n await rm(CACHE_DIR, { recursive: true, force: true });\n say('done!');\n exit(0);\n }\n\n const {\n repo,\n version: { version, tag },\n arch,\n platform,\n binaries,\n checksums,\n } = parsedArgs.options;\n\n printBanner();\n const bins = binaries.join(', ');\n say(`fetching ${bins} ${version} for ${platform} ${arch}`);\n\n const BIN_ARCHIVE_URL = getBinaryArchiveUrl(\n repo,\n tag,\n version,\n platform,\n arch,\n );\n const BIN_DIR = join(cwd(), 'node_modules', '.bin');\n\n const url = new URL(BIN_ARCHIVE_URL);\n const cacheKey = createHash('sha256')\n .update(`${BIN_ARCHIVE_URL}-${bins}`)\n .digest('hex');\n const cachePath = join(CACHE_DIR, cacheKey);\n\n const downloadedBinaries = await checkAndDownloadBinaries(\n url,\n binaries,\n cachePath,\n platform,\n arch,\n checksums,\n );\n\n await installBinaries(downloadedBinaries, BIN_DIR, cachePath);\n\n say('done!');\n}\n"]}
|
package/dist/options.cjs
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseArgs = exports.printBanner = void 0;
|
|
7
|
-
const node_os_1 = require("node:os");
|
|
8
|
-
const node_process_1 = require("node:process");
|
|
9
|
-
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
10
|
-
const types_js_1 = require("./types.cjs");
|
|
11
|
-
const utils_js_1 = require("./utils.cjs");
|
|
12
|
-
/**
|
|
13
|
-
* Type guard to check if a string is a valid version string starting with 'v'.
|
|
14
|
-
*
|
|
15
|
-
* @param value - The string to check
|
|
16
|
-
* @returns True if the string is a valid version string
|
|
17
|
-
*/
|
|
18
|
-
function isVersionString(value) {
|
|
19
|
-
return /^v\d/u.test(value);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Prints the Foundry banner to the console.
|
|
23
|
-
*/
|
|
24
|
-
function printBanner() {
|
|
25
|
-
console.log(`
|
|
26
|
-
.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx
|
|
27
|
-
|
|
28
|
-
╔═╗ ╔═╗ ╦ ╦ ╔╗╔ ╔╦╗ ╦═╗ ╦ ╦ Portable and modular toolkit
|
|
29
|
-
╠╣ ║ ║ ║ ║ ║║║ ║║ ╠╦╝ ╚╦╝ for Ethereum Application Development
|
|
30
|
-
╚ ╚═╝ ╚═╝ ╝╚╝ ═╩╝ ╩╚═ ╩ written in Rust.
|
|
31
|
-
|
|
32
|
-
.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx
|
|
33
|
-
|
|
34
|
-
Repo : https://github.com/foundry-rs/
|
|
35
|
-
Book : https://book.getfoundry.sh/
|
|
36
|
-
Chat : https://t.me/foundry_rs/
|
|
37
|
-
Support : https://t.me/foundry_support/
|
|
38
|
-
Contribute : https://github.com/orgs/foundry-rs/projects/2/
|
|
39
|
-
|
|
40
|
-
.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx
|
|
41
|
-
`);
|
|
42
|
-
}
|
|
43
|
-
exports.printBanner = printBanner;
|
|
44
|
-
/**
|
|
45
|
-
* Parses command line arguments and returns the parsed options.
|
|
46
|
-
*
|
|
47
|
-
* @param args - Command line arguments to parse
|
|
48
|
-
* @returns Parsed command line arguments
|
|
49
|
-
*/
|
|
50
|
-
function parseArgs(args = node_process_1.argv.slice(2)) {
|
|
51
|
-
const { $0, _, ...parsed } = (0, yargs_1.default)()
|
|
52
|
-
// Ensure unrecognized commands/options are reported as errors.
|
|
53
|
-
.strict()
|
|
54
|
-
// disable yargs's version, as it doesn't make sense here
|
|
55
|
-
.version(false)
|
|
56
|
-
// use the scriptName in `--help` output
|
|
57
|
-
.scriptName('yarn foundryup')
|
|
58
|
-
// wrap output at a maximum of 120 characters or `stdout.columns`
|
|
59
|
-
.wrap(Math.min(120, node_process_1.stdout.columns))
|
|
60
|
-
.parserConfiguration({
|
|
61
|
-
'strip-aliased': true,
|
|
62
|
-
'strip-dashed': true,
|
|
63
|
-
})
|
|
64
|
-
// enable ENV parsing, which allows the user to specify foundryup options
|
|
65
|
-
// via environment variables prefixed with `FOUNDRYUP_`
|
|
66
|
-
.env('FOUNDRYUP')
|
|
67
|
-
.command(['$0', 'install'], 'Install foundry binaries', (builder) => {
|
|
68
|
-
builder.options(getOptions()).pkgConf('foundryup');
|
|
69
|
-
})
|
|
70
|
-
.command('cache', '', (builder) => {
|
|
71
|
-
builder.command('clean', 'Remove the shared cache files').demandCommand();
|
|
72
|
-
})
|
|
73
|
-
.parseSync(args);
|
|
74
|
-
const command = _.join(' ');
|
|
75
|
-
if (command === 'cache clean') {
|
|
76
|
-
return {
|
|
77
|
-
command,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
// if we get here `command` is always 'install' or '' (yargs checks it)
|
|
81
|
-
return {
|
|
82
|
-
command: 'install',
|
|
83
|
-
options: parsed,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
exports.parseArgs = parseArgs;
|
|
87
|
-
const Binaries = Object.values(types_js_1.Binary);
|
|
88
|
-
/**
|
|
89
|
-
* Returns the command line options configuration.
|
|
90
|
-
*
|
|
91
|
-
* @param defaultPlatform - Default platform to use
|
|
92
|
-
* @param defaultArch - Default architecture to use
|
|
93
|
-
* @returns Command line options configuration
|
|
94
|
-
*/
|
|
95
|
-
function getOptions(defaultPlatform = (0, node_os_1.platform)(), defaultArch = (0, utils_js_1.normalizeSystemArchitecture)()) {
|
|
96
|
-
return {
|
|
97
|
-
binaries: {
|
|
98
|
-
alias: 'b',
|
|
99
|
-
type: 'array',
|
|
100
|
-
multiple: true,
|
|
101
|
-
description: 'Specify the binaries to install',
|
|
102
|
-
default: Binaries,
|
|
103
|
-
choices: Binaries,
|
|
104
|
-
coerce: (values) => [...new Set(values)], // Remove duplicates
|
|
105
|
-
},
|
|
106
|
-
checksums: {
|
|
107
|
-
alias: 'c',
|
|
108
|
-
description: 'JSON object containing checksums for the binaries.',
|
|
109
|
-
coerce: (rawChecksums) => {
|
|
110
|
-
try {
|
|
111
|
-
return typeof rawChecksums === 'string'
|
|
112
|
-
? JSON.parse(rawChecksums)
|
|
113
|
-
: rawChecksums;
|
|
114
|
-
}
|
|
115
|
-
catch {
|
|
116
|
-
throw new Error('Invalid checksums');
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
optional: true,
|
|
120
|
-
},
|
|
121
|
-
repo: {
|
|
122
|
-
alias: 'r',
|
|
123
|
-
description: 'Specify the repository',
|
|
124
|
-
default: 'foundry-rs/foundry',
|
|
125
|
-
},
|
|
126
|
-
version: {
|
|
127
|
-
alias: 'v',
|
|
128
|
-
description: 'Specify the version (see: https://github.com/foundry-rs/foundry/tags)',
|
|
129
|
-
default: 'nightly',
|
|
130
|
-
coerce: (rawVersion) => {
|
|
131
|
-
if (rawVersion.startsWith('nightly')) {
|
|
132
|
-
return { version: 'nightly', tag: rawVersion };
|
|
133
|
-
// we don't validate the version much, we just trust the user
|
|
134
|
-
}
|
|
135
|
-
else if (isVersionString(rawVersion)) {
|
|
136
|
-
return { version: rawVersion, tag: rawVersion };
|
|
137
|
-
}
|
|
138
|
-
throw new Error('Invalid version');
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
arch: {
|
|
142
|
-
alias: 'a',
|
|
143
|
-
description: 'Specify the architecture',
|
|
144
|
-
// if `defaultArch` is not a supported Architecture yargs will throw an error
|
|
145
|
-
default: defaultArch,
|
|
146
|
-
choices: Object.values(types_js_1.Architecture),
|
|
147
|
-
},
|
|
148
|
-
platform: {
|
|
149
|
-
alias: 'p',
|
|
150
|
-
description: 'Specify the platform',
|
|
151
|
-
// if `defaultPlatform` is not a supported Platform yargs will throw an error
|
|
152
|
-
default: defaultPlatform,
|
|
153
|
-
choices: Object.values(types_js_1.Platform),
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
//# sourceMappingURL=options.cjs.map
|
package/dist/options.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.cjs","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAmC;AACnC,+CAA4C;AAC5C,wDAAgC;AAEhC,0CAA4D;AAQ5D,0CAAyD;AAEzD;;;;;GAKG;AACH,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW;IACzB,OAAO,CAAC,GA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AAE,GAAG,EAAE,UAAU,EAAE,CAAC;oBAC/C,6DAA6D;gBAC/D,CAAC;qBAAM,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;oBACvC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;gBAClD,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACrC,CAAC;SACF;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,0BAA0B;YACvC,6EAA6E;YAC7E,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,uBAAY,CAAuB;SAC3D;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,sBAAsB;YACnC,6EAA6E;YAC7E,OAAO,EAAE,eAA2B;YACpC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAQ,CAAmB;SACnD;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { platform } from 'node:os';\nimport { argv, stdout } from 'node:process';\nimport yargs from 'yargs/yargs';\n\nimport { Architecture, Binary, Platform } from './types.js';\nimport type {\n Checksums,\n ParsedOptions,\n ArchitecturesTuple,\n BinariesTuple,\n PlatformsTuple,\n} from './types.js';\nimport { normalizeSystemArchitecture } from './utils.js';\n\n/**\n * Type guard to check if a string is a valid version string starting with 'v'.\n *\n * @param value - The string to check\n * @returns True if the string is a valid version string\n */\nfunction isVersionString(value: string): value is `v${string}` {\n return /^v\\d/u.test(value);\n}\n\n/**\n * Prints the Foundry banner to the console.\n */\nexport function printBanner() {\n console.log(`\n.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx\n\n ╔═╗ ╔═╗ ╦ ╦ ╔╗╔ ╔╦╗ ╦═╗ ╦ ╦ Portable and modular toolkit\n ╠╣ ║ ║ ║ ║ ║║║ ║║ ╠╦╝ ╚╦╝ for Ethereum Application Development\n ╚ ╚═╝ ╚═╝ ╝╚╝ ═╩╝ ╩╚═ ╩ written in Rust.\n\n.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx\n\nRepo : https://github.com/foundry-rs/\nBook : https://book.getfoundry.sh/\nChat : https://t.me/foundry_rs/\nSupport : https://t.me/foundry_support/\nContribute : https://github.com/orgs/foundry-rs/projects/2/\n\n.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx\n`);\n}\n\n/**\n * Parses command line arguments and returns the parsed options.\n *\n * @param args - Command line arguments to parse\n * @returns Parsed command line arguments\n */\nexport function parseArgs(args: string[] = argv.slice(2)) {\n const { $0, _, ...parsed } = yargs()\n // Ensure unrecognized commands/options are reported as errors.\n .strict()\n // disable yargs's version, as it doesn't make sense here\n .version(false)\n // use the scriptName in `--help` output\n .scriptName('yarn foundryup')\n // wrap output at a maximum of 120 characters or `stdout.columns`\n .wrap(Math.min(120, stdout.columns))\n .parserConfiguration({\n 'strip-aliased': true,\n 'strip-dashed': true,\n })\n // enable ENV parsing, which allows the user to specify foundryup options\n // via environment variables prefixed with `FOUNDRYUP_`\n .env('FOUNDRYUP')\n .command(['$0', 'install'], 'Install foundry binaries', (builder) => {\n builder.options(getOptions()).pkgConf('foundryup');\n })\n .command('cache', '', (builder) => {\n builder.command('clean', 'Remove the shared cache files').demandCommand();\n })\n .parseSync(args);\n\n const command = _.join(' ');\n if (command === 'cache clean') {\n return {\n command,\n } as const;\n }\n\n // if we get here `command` is always 'install' or '' (yargs checks it)\n return {\n command: 'install',\n options: parsed as ParsedOptions<ReturnType<typeof getOptions>>,\n } as const;\n}\n\nconst Binaries = Object.values(Binary) as BinariesTuple;\n\n/**\n * Returns the command line options configuration.\n *\n * @param defaultPlatform - Default platform to use\n * @param defaultArch - Default architecture to use\n * @returns Command line options configuration\n */\nfunction getOptions(\n defaultPlatform = platform(),\n defaultArch = normalizeSystemArchitecture(),\n) {\n return {\n binaries: {\n alias: 'b',\n type: 'array' as const,\n multiple: true,\n description: 'Specify the binaries to install',\n default: Binaries,\n choices: Binaries,\n coerce: (values: Binary[]): Binary[] => [...new Set(values)], // Remove duplicates\n },\n checksums: {\n alias: 'c',\n description: 'JSON object containing checksums for the binaries.',\n coerce: (rawChecksums: string | Checksums): Checksums => {\n try {\n return typeof rawChecksums === 'string'\n ? JSON.parse(rawChecksums)\n : rawChecksums;\n } catch {\n throw new Error('Invalid checksums');\n }\n },\n optional: true,\n },\n repo: {\n alias: 'r',\n description: 'Specify the repository',\n default: 'foundry-rs/foundry',\n },\n version: {\n alias: 'v',\n description:\n 'Specify the version (see: https://github.com/foundry-rs/foundry/tags)',\n default: 'nightly',\n coerce: (\n rawVersion: string,\n ): { version: 'nightly' | `v${string}`; tag: string } => {\n if (rawVersion.startsWith('nightly')) {\n return { version: 'nightly', tag: rawVersion };\n // we don't validate the version much, we just trust the user\n } else if (isVersionString(rawVersion)) {\n return { version: rawVersion, tag: rawVersion };\n }\n throw new Error('Invalid version');\n },\n },\n arch: {\n alias: 'a',\n description: 'Specify the architecture',\n // if `defaultArch` is not a supported Architecture yargs will throw an error\n default: defaultArch,\n choices: Object.values(Architecture) as ArchitecturesTuple,\n },\n platform: {\n alias: 'p',\n description: 'Specify the platform',\n // if `defaultPlatform` is not a supported Platform yargs will throw an error\n default: defaultPlatform as Platform,\n choices: Object.values(Platform) as PlatformsTuple,\n },\n };\n}\n"]}
|
package/dist/options.d.cts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Architecture, Binary, Platform } from "./types.cjs";
|
|
2
|
-
import type { Checksums, ParsedOptions } from "./types.cjs";
|
|
3
|
-
/**
|
|
4
|
-
* Prints the Foundry banner to the console.
|
|
5
|
-
*/
|
|
6
|
-
export declare function printBanner(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Parses command line arguments and returns the parsed options.
|
|
9
|
-
*
|
|
10
|
-
* @param args - Command line arguments to parse
|
|
11
|
-
* @returns Parsed command line arguments
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseArgs(args?: string[]): {
|
|
14
|
-
readonly command: "cache clean";
|
|
15
|
-
readonly options?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
readonly command: "install";
|
|
18
|
-
readonly options: ParsedOptions<{
|
|
19
|
-
binaries: {
|
|
20
|
-
alias: string;
|
|
21
|
-
type: "array";
|
|
22
|
-
multiple: boolean;
|
|
23
|
-
description: string;
|
|
24
|
-
default: [Binary];
|
|
25
|
-
choices: [Binary];
|
|
26
|
-
coerce: (values: Binary[]) => Binary[];
|
|
27
|
-
};
|
|
28
|
-
checksums: {
|
|
29
|
-
alias: string;
|
|
30
|
-
description: string;
|
|
31
|
-
coerce: (rawChecksums: string | Checksums) => Checksums;
|
|
32
|
-
optional: boolean;
|
|
33
|
-
};
|
|
34
|
-
repo: {
|
|
35
|
-
alias: string;
|
|
36
|
-
description: string;
|
|
37
|
-
default: string;
|
|
38
|
-
};
|
|
39
|
-
version: {
|
|
40
|
-
alias: string;
|
|
41
|
-
description: string;
|
|
42
|
-
default: string;
|
|
43
|
-
coerce: (rawVersion: string) => {
|
|
44
|
-
version: `v${string}` | "nightly";
|
|
45
|
-
tag: string;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
arch: {
|
|
49
|
-
alias: string;
|
|
50
|
-
description: string;
|
|
51
|
-
default: Architecture;
|
|
52
|
-
choices: [Architecture];
|
|
53
|
-
};
|
|
54
|
-
platform: {
|
|
55
|
-
alias: string;
|
|
56
|
-
description: string;
|
|
57
|
-
default: Platform;
|
|
58
|
-
choices: [Platform];
|
|
59
|
-
};
|
|
60
|
-
}>;
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=options.d.cts.map
|
package/dist/options.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.cts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAmB;AAC5D,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EAId,oBAAmB;AAapB;;GAEG;AACH,wBAAgB,WAAW,SAkB1B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,GAAE,MAAM,EAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCvD"}
|
package/dist/options.d.mts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Architecture, Binary, Platform } from "./types.mjs";
|
|
2
|
-
import type { Checksums, ParsedOptions } from "./types.mjs";
|
|
3
|
-
/**
|
|
4
|
-
* Prints the Foundry banner to the console.
|
|
5
|
-
*/
|
|
6
|
-
export declare function printBanner(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Parses command line arguments and returns the parsed options.
|
|
9
|
-
*
|
|
10
|
-
* @param args - Command line arguments to parse
|
|
11
|
-
* @returns Parsed command line arguments
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseArgs(args?: string[]): {
|
|
14
|
-
readonly command: "cache clean";
|
|
15
|
-
readonly options?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
readonly command: "install";
|
|
18
|
-
readonly options: ParsedOptions<{
|
|
19
|
-
binaries: {
|
|
20
|
-
alias: string;
|
|
21
|
-
type: "array";
|
|
22
|
-
multiple: boolean;
|
|
23
|
-
description: string;
|
|
24
|
-
default: [Binary];
|
|
25
|
-
choices: [Binary];
|
|
26
|
-
coerce: (values: Binary[]) => Binary[];
|
|
27
|
-
};
|
|
28
|
-
checksums: {
|
|
29
|
-
alias: string;
|
|
30
|
-
description: string;
|
|
31
|
-
coerce: (rawChecksums: string | Checksums) => Checksums;
|
|
32
|
-
optional: boolean;
|
|
33
|
-
};
|
|
34
|
-
repo: {
|
|
35
|
-
alias: string;
|
|
36
|
-
description: string;
|
|
37
|
-
default: string;
|
|
38
|
-
};
|
|
39
|
-
version: {
|
|
40
|
-
alias: string;
|
|
41
|
-
description: string;
|
|
42
|
-
default: string;
|
|
43
|
-
coerce: (rawVersion: string) => {
|
|
44
|
-
version: `v${string}` | "nightly";
|
|
45
|
-
tag: string;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
arch: {
|
|
49
|
-
alias: string;
|
|
50
|
-
description: string;
|
|
51
|
-
default: Architecture;
|
|
52
|
-
choices: [Architecture];
|
|
53
|
-
};
|
|
54
|
-
platform: {
|
|
55
|
-
alias: string;
|
|
56
|
-
description: string;
|
|
57
|
-
default: Platform;
|
|
58
|
-
choices: [Platform];
|
|
59
|
-
};
|
|
60
|
-
}>;
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=options.d.mts.map
|
package/dist/options.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.mts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAmB;AAC5D,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EAId,oBAAmB;AAapB;;GAEG;AACH,wBAAgB,WAAW,SAkB1B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,GAAE,MAAM,EAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCvD"}
|
package/dist/options.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.mjs","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,qBAAqB;AAC5C,OAAO,KAAK,oBAAoB;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAA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E;YACzE,OAAO,EAAE,SAAS;YAClB,MAAM,EAAE,CACN,UAAkB,EACkC,EAAE;gBACtD,IAAI,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;oBACrC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;oBAC/C,6DAA6D;gBAC/D,CAAC;qBAAM,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;oBACvC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;gBAClD,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACrC,CAAC;SACF;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,0BAA0B;YACvC,6EAA6E;YAC7E,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAuB;SAC3D;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,sBAAsB;YACnC,6EAA6E;YAC7E,OAAO,EAAE,eAA2B;YACpC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAmB;SACnD;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { platform } from 'node:os';\nimport { argv, stdout } from 'node:process';\nimport yargs from 'yargs/yargs';\n\nimport { Architecture, Binary, Platform } from './types.js';\nimport type {\n Checksums,\n ParsedOptions,\n ArchitecturesTuple,\n BinariesTuple,\n PlatformsTuple,\n} from './types.js';\nimport { normalizeSystemArchitecture } from './utils.js';\n\n/**\n * Type guard to check if a string is a valid version string starting with 'v'.\n *\n * @param value - The string to check\n * @returns True if the string is a valid version string\n */\nfunction isVersionString(value: string): value is `v${string}` {\n return /^v\\d/u.test(value);\n}\n\n/**\n * Prints the Foundry banner to the console.\n */\nexport function printBanner() {\n console.log(`\n.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx\n\n ╔═╗ ╔═╗ ╦ ╦ ╔╗╔ ╔╦╗ ╦═╗ ╦ ╦ Portable and modular toolkit\n ╠╣ ║ ║ ║ ║ ║║║ ║║ ╠╦╝ ╚╦╝ for Ethereum Application Development\n ╚ ╚═╝ ╚═╝ ╝╚╝ ═╩╝ ╩╚═ ╩ written in Rust.\n\n.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx\n\nRepo : https://github.com/foundry-rs/\nBook : https://book.getfoundry.sh/\nChat : https://t.me/foundry_rs/\nSupport : https://t.me/foundry_support/\nContribute : https://github.com/orgs/foundry-rs/projects/2/\n\n.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx\n`);\n}\n\n/**\n * Parses command line arguments and returns the parsed options.\n *\n * @param args - Command line arguments to parse\n * @returns Parsed command line arguments\n */\nexport function parseArgs(args: string[] = argv.slice(2)) {\n const { $0, _, ...parsed } = yargs()\n // Ensure unrecognized commands/options are reported as errors.\n .strict()\n // disable yargs's version, as it doesn't make sense here\n .version(false)\n // use the scriptName in `--help` output\n .scriptName('yarn foundryup')\n // wrap output at a maximum of 120 characters or `stdout.columns`\n .wrap(Math.min(120, stdout.columns))\n .parserConfiguration({\n 'strip-aliased': true,\n 'strip-dashed': true,\n })\n // enable ENV parsing, which allows the user to specify foundryup options\n // via environment variables prefixed with `FOUNDRYUP_`\n .env('FOUNDRYUP')\n .command(['$0', 'install'], 'Install foundry binaries', (builder) => {\n builder.options(getOptions()).pkgConf('foundryup');\n })\n .command('cache', '', (builder) => {\n builder.command('clean', 'Remove the shared cache files').demandCommand();\n })\n .parseSync(args);\n\n const command = _.join(' ');\n if (command === 'cache clean') {\n return {\n command,\n } as const;\n }\n\n // if we get here `command` is always 'install' or '' (yargs checks it)\n return {\n command: 'install',\n options: parsed as ParsedOptions<ReturnType<typeof getOptions>>,\n } as const;\n}\n\nconst Binaries = Object.values(Binary) as BinariesTuple;\n\n/**\n * Returns the command line options configuration.\n *\n * @param defaultPlatform - Default platform to use\n * @param defaultArch - Default architecture to use\n * @returns Command line options configuration\n */\nfunction getOptions(\n defaultPlatform = platform(),\n defaultArch = normalizeSystemArchitecture(),\n) {\n return {\n binaries: {\n alias: 'b',\n type: 'array' as const,\n multiple: true,\n description: 'Specify the binaries to install',\n default: Binaries,\n choices: Binaries,\n coerce: (values: Binary[]): Binary[] => [...new Set(values)], // Remove duplicates\n },\n checksums: {\n alias: 'c',\n description: 'JSON object containing checksums for the binaries.',\n coerce: (rawChecksums: string | Checksums): Checksums => {\n try {\n return typeof rawChecksums === 'string'\n ? JSON.parse(rawChecksums)\n : rawChecksums;\n } catch {\n throw new Error('Invalid checksums');\n }\n },\n optional: true,\n },\n repo: {\n alias: 'r',\n description: 'Specify the repository',\n default: 'foundry-rs/foundry',\n },\n version: {\n alias: 'v',\n description:\n 'Specify the version (see: https://github.com/foundry-rs/foundry/tags)',\n default: 'nightly',\n coerce: (\n rawVersion: string,\n ): { version: 'nightly' | `v${string}`; tag: string } => {\n if (rawVersion.startsWith('nightly')) {\n return { version: 'nightly', tag: rawVersion };\n // we don't validate the version much, we just trust the user\n } else if (isVersionString(rawVersion)) {\n return { version: rawVersion, tag: rawVersion };\n }\n throw new Error('Invalid version');\n },\n },\n arch: {\n alias: 'a',\n description: 'Specify the architecture',\n // if `defaultArch` is not a supported Architecture yargs will throw an error\n default: defaultArch,\n choices: Object.values(Architecture) as ArchitecturesTuple,\n },\n platform: {\n alias: 'p',\n description: 'Specify the platform',\n // if `defaultPlatform` is not a supported Platform yargs will throw an error\n default: defaultPlatform as Platform,\n choices: Object.values(Platform) as PlatformsTuple,\n },\n };\n}\n"]}
|
package/dist/types.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Binary = exports.Platform = exports.Extension = exports.Architecture = void 0;
|
|
4
|
-
// #endregion utils
|
|
5
|
-
// #region enums
|
|
6
|
-
var Architecture;
|
|
7
|
-
(function (Architecture) {
|
|
8
|
-
Architecture["Amd64"] = "amd64";
|
|
9
|
-
Architecture["Arm64"] = "arm64";
|
|
10
|
-
})(Architecture || (exports.Architecture = Architecture = {}));
|
|
11
|
-
var Extension;
|
|
12
|
-
(function (Extension) {
|
|
13
|
-
Extension["Zip"] = "zip";
|
|
14
|
-
Extension["Tar"] = "tar.gz";
|
|
15
|
-
})(Extension || (exports.Extension = Extension = {}));
|
|
16
|
-
var Platform;
|
|
17
|
-
(function (Platform) {
|
|
18
|
-
Platform["Windows"] = "win32";
|
|
19
|
-
Platform["Linux"] = "linux";
|
|
20
|
-
Platform["Mac"] = "darwin";
|
|
21
|
-
})(Platform || (exports.Platform = Platform = {}));
|
|
22
|
-
var Binary;
|
|
23
|
-
(function (Binary) {
|
|
24
|
-
Binary["Anvil"] = "anvil";
|
|
25
|
-
Binary["Forge"] = "forge";
|
|
26
|
-
Binary["Cast"] = "cast";
|
|
27
|
-
Binary["Chisel"] = "chisel";
|
|
28
|
-
})(Binary || (exports.Binary = Binary = {}));
|
|
29
|
-
// #endregion helpers
|
|
30
|
-
//# sourceMappingURL=types.cjs.map
|
package/dist/types.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAuBA,mBAAmB;AAEnB,gBAAgB;AAEhB,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,+BAAe,CAAA;IACf,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,2BAAc,CAAA;AAChB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,2BAAe,CAAA;IACf,0BAAc,CAAA;AAChB,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB;AAED,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,yBAAe,CAAA;IACf,yBAAe,CAAA;IACf,uBAAa,CAAA;IACb,2BAAiB,CAAA;AACnB,CAAC,EALW,MAAM,sBAAN,MAAM,QAKjB;AAsDD,qBAAqB","sourcesContent":["import type { Agent as HttpAgent } from 'node:http';\nimport type { Agent as HttpsAgent } from 'node:https';\nimport type { InferredOptionTypes, Options } from 'yargs';\n\n// #region utils\n\ntype UnionToIntersection<U> = ((k: U) => void) extends (k: infer I) => void\n ? I\n : never;\n\ntype LastInUnion<U extends PropertyKey> =\n UnionToIntersection<\n U extends PropertyKey ? () => U : never\n > extends () => infer Last\n ? Last\n : never;\n\ntype UnionToTuple<U extends PropertyKey, Last = LastInUnion<U>> = [U] extends [\n never,\n]\n ? []\n : [...UnionToTuple<Exclude<U, Last>>, Last];\n\n// #endregion utils\n\n// #region enums\n\nexport enum Architecture {\n Amd64 = 'amd64',\n Arm64 = 'arm64',\n}\n\nexport enum Extension {\n Zip = 'zip',\n Tar = 'tar.gz',\n}\n\nexport enum Platform {\n Windows = 'win32',\n Linux = 'linux',\n Mac = 'darwin',\n}\n\nexport enum Binary {\n Anvil = 'anvil',\n Forge = 'forge',\n Cast = 'cast',\n Chisel = 'chisel',\n}\n\n// #endregion enums\n\n// #region helpers\n\n/**\n * Tuple representing all members of the {@link Binary} enum.\n */\nexport type BinariesTuple = UnionToTuple<Binary>;\n\n/**\n * Tuple representing all members of the {@link Architecture} enum.\n */\nexport type ArchitecturesTuple = UnionToTuple<Architecture>;\n\n/**\n * Tuple representing all members of the {@link Platform} enum.\n */\nexport type PlatformsTuple = UnionToTuple<Platform>;\n\n/**\n * Checksum types expected by the CLI.\n */\nexport type Checksums = {\n algorithm: string;\n binaries: Record<Binary, Record<`${Platform}-${Architecture}`, string>>;\n};\n\n/**\n * Checksum type expected by application code, specific to the selected\n * {@link Platform} and {@link Architecture}.\n *\n * See also: {@link Checksums}.\n */\nexport type PlatformArchChecksums = {\n algorithm: string;\n binaries: Record<Binary, string>;\n};\n\n/**\n * Given a map of raw yargs options config, returns a map of inferred types.\n */\nexport type ParsedOptions<O extends { [key: string]: Options }> = {\n [key in keyof O]: InferredOptionTypes<O>[key];\n};\n\nexport type DownloadOptions = {\n method?: 'GET' | 'HEAD';\n headers?: Record<string, string>;\n agent?: HttpsAgent | HttpAgent;\n maxRedirects?: number;\n};\n\n// #endregion helpers\n"]}
|
package/dist/types.d.cts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node/http" />
|
|
4
|
-
/// <reference types="npm-which/node_modules/@types/node/http" />
|
|
5
|
-
/// <reference types="node/https" />
|
|
6
|
-
/// <reference types="npm-which/node_modules/@types/node/https" />
|
|
7
|
-
import type { Agent as HttpAgent } from "node:http";
|
|
8
|
-
import type { Agent as HttpsAgent } from "node:https";
|
|
9
|
-
import type { InferredOptionTypes, Options } from "yargs";
|
|
10
|
-
type UnionToIntersection<U> = ((k: U) => void) extends (k: infer I) => void ? I : never;
|
|
11
|
-
type LastInUnion<U extends PropertyKey> = UnionToIntersection<U extends PropertyKey ? () => U : never> extends () => infer Last ? Last : never;
|
|
12
|
-
type UnionToTuple<U extends PropertyKey, Last = LastInUnion<U>> = [U] extends [
|
|
13
|
-
never
|
|
14
|
-
] ? [] : [...UnionToTuple<Exclude<U, Last>>, Last];
|
|
15
|
-
export declare enum Architecture {
|
|
16
|
-
Amd64 = "amd64",
|
|
17
|
-
Arm64 = "arm64"
|
|
18
|
-
}
|
|
19
|
-
export declare enum Extension {
|
|
20
|
-
Zip = "zip",
|
|
21
|
-
Tar = "tar.gz"
|
|
22
|
-
}
|
|
23
|
-
export declare enum Platform {
|
|
24
|
-
Windows = "win32",
|
|
25
|
-
Linux = "linux",
|
|
26
|
-
Mac = "darwin"
|
|
27
|
-
}
|
|
28
|
-
export declare enum Binary {
|
|
29
|
-
Anvil = "anvil",
|
|
30
|
-
Forge = "forge",
|
|
31
|
-
Cast = "cast",
|
|
32
|
-
Chisel = "chisel"
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Tuple representing all members of the {@link Binary} enum.
|
|
36
|
-
*/
|
|
37
|
-
export type BinariesTuple = UnionToTuple<Binary>;
|
|
38
|
-
/**
|
|
39
|
-
* Tuple representing all members of the {@link Architecture} enum.
|
|
40
|
-
*/
|
|
41
|
-
export type ArchitecturesTuple = UnionToTuple<Architecture>;
|
|
42
|
-
/**
|
|
43
|
-
* Tuple representing all members of the {@link Platform} enum.
|
|
44
|
-
*/
|
|
45
|
-
export type PlatformsTuple = UnionToTuple<Platform>;
|
|
46
|
-
/**
|
|
47
|
-
* Checksum types expected by the CLI.
|
|
48
|
-
*/
|
|
49
|
-
export type Checksums = {
|
|
50
|
-
algorithm: string;
|
|
51
|
-
binaries: Record<Binary, Record<`${Platform}-${Architecture}`, string>>;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Checksum type expected by application code, specific to the selected
|
|
55
|
-
* {@link Platform} and {@link Architecture}.
|
|
56
|
-
*
|
|
57
|
-
* See also: {@link Checksums}.
|
|
58
|
-
*/
|
|
59
|
-
export type PlatformArchChecksums = {
|
|
60
|
-
algorithm: string;
|
|
61
|
-
binaries: Record<Binary, string>;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Given a map of raw yargs options config, returns a map of inferred types.
|
|
65
|
-
*/
|
|
66
|
-
export type ParsedOptions<O extends {
|
|
67
|
-
[key: string]: Options;
|
|
68
|
-
}> = {
|
|
69
|
-
[key in keyof O]: InferredOptionTypes<O>[key];
|
|
70
|
-
};
|
|
71
|
-
export type DownloadOptions = {
|
|
72
|
-
method?: 'GET' | 'HEAD';
|
|
73
|
-
headers?: Record<string, string>;
|
|
74
|
-
agent?: HttpsAgent | HttpAgent;
|
|
75
|
-
maxRedirects?: number;
|
|
76
|
-
};
|
|
77
|
-
export {};
|
|
78
|
-
//# sourceMappingURL=types.d.cts.map
|
package/dist/types.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,kBAAkB;AACpD,OAAO,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,mBAAmB;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,OAAO,EAAE,cAAc;AAI1D,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GACvE,CAAC,GACD,KAAK,CAAC;AAEV,KAAK,WAAW,CAAC,CAAC,SAAS,WAAW,IACpC,mBAAmB,CACjB,CAAC,SAAS,WAAW,GAAG,MAAM,CAAC,GAAG,KAAK,CACxC,SAAS,MAAM,MAAM,IAAI,GACtB,IAAI,GACJ,KAAK,CAAC;AAEZ,KAAK,YAAY,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;IAC5E,KAAK;CACN,GACG,EAAE,GACF,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAM9C,oBAAY,YAAY;IACtB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,GAAG,WAAW;CACf;AAED,oBAAY,QAAQ;IAClB,OAAO,UAAU;IACjB,KAAK,UAAU;IACf,GAAG,WAAW;CACf;AA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AS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,2BAAe,CAAA;IACf,0BAAc,CAAA;AAChB,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB;AAED,MAAM,CAAN,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,yBAAe,CAAA;IACf,yBAAe,CAAA;IACf,uBAAa,CAAA;IACb,2BAAiB,CAAA;AACnB,CAAC,EALW,MAAM,KAAN,MAAM,QAKjB;AAsDD,qBAAqB","sourcesContent":["import type { Agent as HttpAgent } from 'node:http';\nimport type { Agent as HttpsAgent } from 'node:https';\nimport type { InferredOptionTypes, Options } from 'yargs';\n\n// #region utils\n\ntype UnionToIntersection<U> = ((k: U) => void) extends (k: infer I) => void\n ? I\n : never;\n\ntype LastInUnion<U extends PropertyKey> =\n UnionToIntersection<\n U extends PropertyKey ? () => U : never\n > extends () => infer Last\n ? Last\n : never;\n\ntype UnionToTuple<U extends PropertyKey, Last = LastInUnion<U>> = [U] extends [\n never,\n]\n ? []\n : [...UnionToTuple<Exclude<U, Last>>, Last];\n\n// #endregion utils\n\n// #region enums\n\nexport enum Architecture {\n Amd64 = 'amd64',\n Arm64 = 'arm64',\n}\n\nexport enum Extension {\n Zip = 'zip',\n Tar = 'tar.gz',\n}\n\nexport enum Platform {\n Windows = 'win32',\n Linux = 'linux',\n Mac = 'darwin',\n}\n\nexport enum Binary {\n Anvil = 'anvil',\n Forge = 'forge',\n Cast = 'cast',\n Chisel = 'chisel',\n}\n\n// #endregion enums\n\n// #region helpers\n\n/**\n * Tuple representing all members of the {@link Binary} enum.\n */\nexport type BinariesTuple = UnionToTuple<Binary>;\n\n/**\n * Tuple representing all members of the {@link Architecture} enum.\n */\nexport type ArchitecturesTuple = UnionToTuple<Architecture>;\n\n/**\n * Tuple representing all members of the {@link Platform} enum.\n */\nexport type PlatformsTuple = UnionToTuple<Platform>;\n\n/**\n * Checksum types expected by the CLI.\n */\nexport type Checksums = {\n algorithm: string;\n binaries: Record<Binary, Record<`${Platform}-${Architecture}`, string>>;\n};\n\n/**\n * Checksum type expected by application code, specific to the selected\n * {@link Platform} and {@link Architecture}.\n *\n * See also: {@link Checksums}.\n */\nexport type PlatformArchChecksums = {\n algorithm: string;\n binaries: Record<Binary, string>;\n};\n\n/**\n * Given a map of raw yargs options config, returns a map of inferred types.\n */\nexport type ParsedOptions<O extends { [key: string]: Options }> = {\n [key in keyof O]: InferredOptionTypes<O>[key];\n};\n\nexport type DownloadOptions = {\n method?: 'GET' | 'HEAD';\n headers?: Record<string, string>;\n agent?: HttpsAgent | HttpAgent;\n maxRedirects?: number;\n};\n\n// #endregion helpers\n"]}
|